大致成品如图所示

关键的步骤:

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. [AHOI2002]哈利·波特与魔法石

    这道题比较简单,就是一个最短路(SSSP).数据水,用Floyd即可AC.这里用了Dijkstra. #include <iostream> #include <cstdio> ...

  2. angular7新特性

    Angular 是最流行的 Web 应用程序开发框架之一.随着 Angular 7 的发布,它为 Web 开发人员带来了更多功能,包括核心框架.Angular Material.与主要版本保持同步的 ...

  3. mp-vue拖拽组件的实现

    作为一个效率还不错的小前端,自己的任务做完之后真的好闲啊,千盼万盼终于盼来了业务的新需求,他要我多加一个排序题,然后用户通过拖拽来排序,项目经理看我是个实习生,说有点复杂做不出来就算了,我这么闲的一个 ...

  4. Python字典及相关操作(内含例题)

    Python字典类型 今天将会介绍一种在python中十分常见的组合数据类型——字典 通过一些实例来理解字典中的常规操作 什么是字典类型? 列表中查找是通过整数的索引(元素在列表中的序号)来实现查找功 ...

  5. SoapUI 关联之Property Transfer、JSONPath、Xpath

    进行接口功能测试过程中,经常会碰到,需要获取到上一个请求响应结果中数据,传递到下一个请求中来使用.在soapui中我们通过Property Transfer来实现. 1.Property Transf ...

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

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

  7. 数据库系统(六)---MySQL语句及存储过程

    一.DDL.DML.DCL常用语句 1.DDL(Data Definition Language)数据库定义语言 (1)数据库模式定义 #创建数据库 create database if exsite ...

  8. 小白学 Python(14):基础数据结构(集合)(上)

    人生苦短,我选Python 前文传送门 小白学 Python(1):开篇 小白学 Python(2):基础数据类型(上) 小白学 Python(3):基础数据类型(下) 小白学 Python(4):变 ...

  9. python解释器执行文件的流程

    一: 启动python解释器,加载内置模块. 找到主文件读入内存,这里涉及到编码问题,一般都是utf8 解释器拿到主文件开始语法词法分析,编译然后执行

  10. 安卓—自定义 AlertDialog 的样式

    自定义修改安卓弹出框的样式 效果图: 1.在style.xml下添加 <!-- 自定义弹出样式 --> <style name="MyDialogStyle" p ...