大致成品如图所示

关键的步骤:

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. FreeSql 已支持 .NetFramework 4.0、ODBC 访问

    FreeSql 开源发布快一年了,目前主仓库代码量 64118 行,用 git 命令统计的命令如下: find . "(" -name "*.cs" " ...

  2. The usage of Markdown---文字强调:加粗/斜体/文本高亮/删除线/下划线/按键效果

    更新时间:2019.09.14 1. 序言 有时候,我们需要对某些文字进行强调,例如粗体和斜体.而Markdown通常可以使用星号*或者下划线_进行文字强调. 2. 加粗 如果想要达到加粗的效果,可以 ...

  3. Leetcode Tags(5)Hash Table

    一.500. Keyboard Row 给定一个单词列表,只返回可以使用在键盘同一行的字母打印出来的单词. 输入: ["Hello", "Alaska", &q ...

  4. JS旋转和css旋转

    js旋转 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <styl ...

  5. 使用 HTML5 WebSocket 构建实时 Web 应用

    原文地址:http://www.ibm.com/developerworks/cn/web/1112_huangxa_websocket/ HTML5 WebSocket 简介和实战演练 本文主要介绍 ...

  6. CSPS模拟测试59

    这场考得我心态爆炸......... 开场T1只会$n^{2}$,然后发现bfs时每个点只需要被更新一次,其他的更新都是没用的. 也就是说,我们可以只更新还没被更新的点? 于是我先YY了一个链表,发现 ...

  7. 【PyTorch教程】P3. Python学习中的两大法宝函数(当然也可以用在PyTorch)

    温馨提示:为了更好的教程体验,提供视频.阅读地址 Youtube: https://www.youtube.com/playlist?list=PLgAyVnrNJ96CqYdjZ8v9YjQvCBc ...

  8. csps模拟测试57

    T1 天空龙 大神题,考察多方面知识,例如:快读 附上考试代码,以供后人学习 应某迪要求,我决定多写一点. 正如文化课有知识性失分和非知识性失分一样,OI也同样存在. 但非知识性失分往往比知识性失分更 ...

  9. git 生成密匙时遇到报错 :Too many arguments.

    今天在我用新电脑想要向github上的远程库上传项目时,由于新电脑上的本地库没有与远程库建立连接,所以要在本地生成密匙添加到github上才可以上传,在我执行命令 ssh-keygen -t rsa- ...

  10. Java实现不遍历数组求和

    package com.jts.t1; /** * 不遍历数组求和 * 方法省略异常检查 */ public class Demo1 { public static void main(String[ ...