大致成品如图所示

关键的步骤:

var dom = document.getElementById("myChart");
var myChart = echarts.init(dom);
var app = {};
var option = null;
option = {
backgroundColor:'rgba(128, 128, 128, 1)',
title: {
text: '线路故障发生概率预测',
left: '50%',
top: '5%',
botom:"5%"
},
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'line' // 默认为直线,可选为:'line' | 'shadow'
} },
legend: {
// orient: 'vertical',
show: false,
left: 'rigth',
data: [{
name: 'line1',
icon: 'bar'
}, {
name: 'line2',
icon: 'bar'
}, {
name: 'line3',
icon: 'bar'
}, {
name: 'line4',
icon: 'bar'
}, {
name: 'line5',
icon: 'bar'
}, {
name: 'line6',
icon: 'bar'
}],
selected: {
'line1': true,
'line2': true,
'line3': true,
'line4': true,
'line5': true,
'line6': true,
//不想显示的都设置成false
}
},
grid: {
top: '14%',
left: '3%',
right: '1%',
bottom: '3%',
containLabel: true,
// color: '#032c78'
},
color: ['rgba(52,252,53,1)', '#FFF82F', '#F99A2D', '#FB343B', '#C936D7', '#6B3370'],
xAxis: {
// nameLocation: 'center',
type: 'category',
boundaryGap: false,
data: this.mouthDate,
// show: true,
// axisTick: {
// show: true
// },
// nameTextStyle: {
// fontSize: 20
// },
position: 'bottom',
axisLabel: { //坐标轴刻度的属性
fontSize: 32,
color: 'rgba(17,108,255,1)',
// textalign: 'center',
rotate: 90,
// interval:0
}, },
yAxis: [{
// nameLocation:'center',
nameGap: 35,
name: '',
boundaryGap: true,
min: 0,
max: 280,
// splitNumber: 10,
interval: 35,
type: 'value',
// yAxisIndex: 0,
axisLabel: {
formatter: '{value}',
},
nameTextStyle: { //坐标轴名称的样式
color: "rgba(255,255,255,1)",
fontSize: 24,
textShadowColor: 'rgba(0,128,255,1)',
fontFamily: "SourceHanSansCN",
textShadowOffsetX: 0,
textShadowOffsetY: 0,
textShadowBlur: 15,
padding: [0, 0, 0, 0]
},
splitLine: {
show: false
},
axisTick: { //是否显示坐标轴刻度
show: false
},
axisLabel: { //坐标轴刻度的属性
fontSize: 32,
color: 'rgba(17,108,255,1)',
textalign: 'center' },
yAxisIndex: 1
} ], series: [ //就是从这个地方开始的 主要用的是markArea 和legend
{
name: 'line1',
type: 'line',
animation: false,
areaStyle: {
normal: {}
},
lineStyle: {
normal: {
width: 1
}
},
markArea: {
data: [
[{
yAxis: '0',
itemStyle: {
color: 'rgba(52,252,53,1)'
}
}, {
yAxis: '35'
}]
]
}, }, {
name: 'line2',
type: 'line',
animation: false,
areaStyle: {
normal: {}
},
lineStyle: {
normal: {
width: 1
}
},
markArea: {
data: [
[{
yAxis: '35',
itemStyle: {
color: '#FFF82F'
}
}, {
yAxis: '70'
}]
]
}
}, {
name: 'line3',
type: 'line',
animation: false,
areaStyle: {
normal: {}
},
lineStyle: {
normal: {
width: 1
}
},
markArea: {
data: [
[{
yAxis: '70',
itemStyle: {
color: '#F99A2D'
}
}, {
yAxis: '115'
}]
]
}
},
{
name: 'line4',
type: 'line',
animation: false,
areaStyle: {
normal: {}
},
lineStyle: {
normal: {
width: 1
}
},
markArea: {
data: [
[{
yAxis: '115',
itemStyle: {
color: '#FB343B'
}
}, {
yAxis: '150'
}]
]
}
},
{
name: 'line5',
type: 'line',
animation: false,
areaStyle: {
normal: {}
},
lineStyle: {
normal: {
width: 1
}
},
markArea: {
data: [
[{
yAxis: '150',
itemStyle: {
color: '#C936D7'
}
}, {
yAxis: '250'
}]
]
}
}, {
name: 'line6',
type: 'line',
animation: false,
areaStyle: {
normal: {}
},
lineStyle: {
normal: {
width: 1
}
},
markArea: {
data: [
[{
yAxis: '250',
itemStyle: {
color: '#6B3370'
}
}, {
yAxis: '280'
}]
]
}
},
{
name: '',
type: 'line',
smooth: "true",
symbol: 'circle', //设置拐点
symbolSize: 16, //设置拐点的大小
itemStyle: { //拐点的属性
color: '#005664',
//
},
lineStyle: {
color: "#007B8F",
width: 5,
},
data: this.mouthPm25List
}, ],
}
myChart.setOption(option)

echarts绘制彩虹色背景的更多相关文章

  1. 使用echarts绘制漂亮的渐变键盘仪表盘

    echarts官方示例和默认样式都比较难看,经过一顿捣鼓实现比较漂亮的渐变仪表盘. 第一步:设置轴线 将图表轴线.label.分割线.隐藏,只保留刻度,然后修改刻度样式达到最终效果.不过要注意的是ax ...

  2. 使用android.graphics.Path类自绘制PopupWindow背景

    PopupWindow简单介绍 PopupWindow是悬浮在当前activity上的一个容器,用它能够展示随意的内容. PopupWindow跟位置有关的API有以下几个: showAsDropDo ...

  3. 使用echarts绘制条形图和扇形图

    使用echarts绘制条形图和扇形图 简单举例说明下echarts如何绘制条形图和扇形图 代码示例 <!doctype html> <html lang="en" ...

  4. echarts —— 绘制横向柱状图(圆角、无坐标轴)

    UI给了设计图,看了一眼觉得简单,不就是无序列表布局嘛(ul,li),后来才知道那是echarts图,好吧,样式如下: 代码如下:(渐变色没做) <!DOCTYPE html> <h ...

  5. C#绘制渐变背景

    //绘制渐变色背景 Graphics g = e.Graphics; LinearGradientBrush linearGradientBrush = new LinearGradientBrush ...

  6. Html飞机大战(一):绘制动态背景

    好家伙,飞机大战终于开始弄了 这会有很多很多复杂的东西,但是我们总要从最简单,和最基础的部分开始,   我们先从背景开始弄吧! 1.绘制静态背景 这里我们会用到canvas <!DOCTYPE ...

  7. react使用Echarts绘制高亮可点击选中的省市地图

    最近做项目遇到一个需求,需要显示广东省各个地级市的地图,并且鼠标移入高亮显示,鼠标点击可以选中某个地级市.在网上查阅了大量资料之后,最后选择了使用echarts实现该需求.在此记录一下,希望可以帮到有 ...

  8. 用ECharts绘制Prometheus图表,实现类似Grafana的自定义Dashboard

      大家一般都是用Grafana自定义Dashboard来监控Prometheus数据的,作者这次尝试用ECharts来绘制Prometheus数据图表,一方面可以减少依赖,另一方面可以将监控界面灵活 ...

  9. 前端 | 使用 ECharts 绘制关系图

    0 需求 做的项目需要画一个关系图,主要需求如下: 需要展示6种对象之间的关系:数据机构 数据 合约 模型 计算机构 应用 支持突出显示6种对象中的某一种的所有对象 支持Top x子图功能.top x ...

随机推荐

  1. 【java基础】- java双亲委派机制

    在了解双亲委派机制之前,你应当知道classloader(如果不了解,可以现在去恶补一下哈) 四种classloader 虚拟机自带 引导类加载器(Bootstrap ClassLoader) 扩展类 ...

  2. 推荐一款简单易用线上引流测试工具:GoReplay

    一. 引流测试产生背景 日常大部分的测试工作都是在测试环境下,通过模拟用户的行为来对系统进行验证,包括功能以及性能.在这个过程中,你可能会遇到以下问题: 用户访问行为比较复杂,模拟很难和用户行为一致, ...

  3. 关于ESET占用CPU严重 的解决方案||ESET CPU 100%||用迅雷时ESET占用CPU(6月22日再次更新)

    关于ESET占用CPU严重 的解决方案 本文根据原帖有适量删改. ESET 的杀毒软件历来以占用资源少,CPU消耗少著称,可是很多朋友(特别是中国大陆的朋友)反应ESS & EAV 间歇性占用 ...

  4. Linux x64 Hadoop-2.4.1配置-解决错误Unable to load native-hadoop library for your platform

    网上配置hadoop的教程一堆,各不尽相同,但没有一个是完整系统的. 下面给出遇到的错误的解决方法,相信能解决很多人的问题. 错误:Exception in thread "main&quo ...

  5. WebApp 滚动列表的实现

    实现效果: 实现技术:overflow,flex,element::-webkit-scrollbar 实现步骤: //html:代码<div id="slider"> ...

  6. 过滤器、拦截器和AOP的分析与对比

    目录 一.过滤器(Filter) 1.1 简介 1.2 应用场景 1.3 源码分析 二.拦截器(Interceptor) 2.1 简介 2.2 应用场景 2.2 源码分析 三.面向切面编程(AOP) ...

  7. Spring Boot项目中如何定制servlet-filters

    本文首发于个人网站:Spring Boot项目中如何定制servlet-filters 在实际的web应用程序中,经常需要在请求(request)外面增加包装用于:记录调用日志.排除有XSS威胁的字符 ...

  8. 操作系统实现(一):从Bootloader到ELF内核(转载)

    原文链接: http://www.cppblog.com/airtrack/archive/2014/10/30/208729.html Bootloader 我们知道计算机启动是从BIOS开始,再由 ...

  9. [考试反思]阶段性总结:NOIP模拟测试7~13

    苟且Rank#1.第二次分机房结束. 得到了喘息一会的权利. 在最后两场考试中大脸skyh慷慨舍弃264分让出Rank#1的故事也十分感人 然而还是有很多东西值得思考. 虽说是反思,但是还是有一些地方 ...

  10. Kettle(6.0) 参数方式连接数据库

    数据库连接条件(视自己实际情况而定) 数据库: Oracle 主机名称(IP): localhost 或 127.0.0.1 数据库名称(SID):MYORCL 端口号: 1521 用户名: scot ...