echarts绘制彩虹色背景

大致成品如图所示
关键的步骤:
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绘制彩虹色背景的更多相关文章
- 使用echarts绘制漂亮的渐变键盘仪表盘
echarts官方示例和默认样式都比较难看,经过一顿捣鼓实现比较漂亮的渐变仪表盘. 第一步:设置轴线 将图表轴线.label.分割线.隐藏,只保留刻度,然后修改刻度样式达到最终效果.不过要注意的是ax ...
- 使用android.graphics.Path类自绘制PopupWindow背景
PopupWindow简单介绍 PopupWindow是悬浮在当前activity上的一个容器,用它能够展示随意的内容. PopupWindow跟位置有关的API有以下几个: showAsDropDo ...
- 使用echarts绘制条形图和扇形图
使用echarts绘制条形图和扇形图 简单举例说明下echarts如何绘制条形图和扇形图 代码示例 <!doctype html> <html lang="en" ...
- echarts —— 绘制横向柱状图(圆角、无坐标轴)
UI给了设计图,看了一眼觉得简单,不就是无序列表布局嘛(ul,li),后来才知道那是echarts图,好吧,样式如下: 代码如下:(渐变色没做) <!DOCTYPE html> <h ...
- C#绘制渐变背景
//绘制渐变色背景 Graphics g = e.Graphics; LinearGradientBrush linearGradientBrush = new LinearGradientBrush ...
- Html飞机大战(一):绘制动态背景
好家伙,飞机大战终于开始弄了 这会有很多很多复杂的东西,但是我们总要从最简单,和最基础的部分开始, 我们先从背景开始弄吧! 1.绘制静态背景 这里我们会用到canvas <!DOCTYPE ...
- react使用Echarts绘制高亮可点击选中的省市地图
最近做项目遇到一个需求,需要显示广东省各个地级市的地图,并且鼠标移入高亮显示,鼠标点击可以选中某个地级市.在网上查阅了大量资料之后,最后选择了使用echarts实现该需求.在此记录一下,希望可以帮到有 ...
- 用ECharts绘制Prometheus图表,实现类似Grafana的自定义Dashboard
大家一般都是用Grafana自定义Dashboard来监控Prometheus数据的,作者这次尝试用ECharts来绘制Prometheus数据图表,一方面可以减少依赖,另一方面可以将监控界面灵活 ...
- 前端 | 使用 ECharts 绘制关系图
0 需求 做的项目需要画一个关系图,主要需求如下: 需要展示6种对象之间的关系:数据机构 数据 合约 模型 计算机构 应用 支持突出显示6种对象中的某一种的所有对象 支持Top x子图功能.top x ...
随机推荐
- linux系统状态网络、权限、用户大杂烩
来来来,我们聊一下liunx系统相关的知识!! 首先从查询网络配置开始 ifconfig 查询.设置网卡和ip等参数 ifup,ifdown 脚本命令,更简单的方式启动关闭网络 ip命令是结合了ifc ...
- LevelDB性能测试|Golang调用LevelDB
LevelDB性能测试|Golang调用LevelDB 不同方式使用压力测试 用ssdb,TCP连接方式调用,底层存储levelDB 直接调用Cgo的levelDB (必须保证串行) 直接调用Gola ...
- V2er - Best client for V2EX
V2er - Best client for V2EX 可能是体验最好的掌上 V2EX 客户端,专为 iOS 打造并在 Github 开源. 关于 V2EX,V2EX 是创意工作者们的社区.这里目前汇 ...
- Eureka -- 浅谈Eureka
目录: 一:Eureka介绍 二:Eureka架构图 三:Eureka组件 四:Eureka作用 五:Eureka和Zookeeper对比 什么是Eureka 引入SpringCloud中文文档介绍 ...
- LeetCode刷题笔记(1)常用知识点
1.Integer.parseInt(String s, int radix)方法的作用是:将radix进制的字符串s转化成10进制的int型数字并返回. Integer.valueof(String ...
- VSCode实现文献管理
1 常用文献管理软件 常用的文献管理软件有mendely,zotero,endnote和Papers(需要付费),具体对比参考链接1.1.1.2 笔者只用过Mendely,当时综合考虑挑了Endnot ...
- 爬取bing背景图片
因为工作环境的原因,没办法用梯子,也不喜欢用某度,只能用bing,发现背景图片蛮好看的,刚好最近在学习摄影,需要提高审美,就想着把bing背景图片都爬去下来做桌面背景.写的代码比较入门,只是做个记录, ...
- 学习笔记37_MVC模板页
ASPX母版页: 1.添加一个母版页,位置../Views/Shared,有 <asp:ContentPlaceHolder ID = "ContentPlaceHolder1&quo ...
- 如何在vue-cli项目中结合mockjs模拟假数据
1.前言 在如今前后端分离的开发方式已被广泛采用的今天,前端同学和后端同学各自独立开发,后端提供数据接口,前端调用接口获取数据渲染页面.但是在实际开发中,后端开发由于逻辑相对复杂接口迟迟提供不到位,而 ...
- sshd服务以及基于口令的远程登陆
ssh用为客户端,主要进行服务器端的连接:sshd用为服务器端 几个常用的命令: systemctl ##服务控制命令 systemctl start sshd ## ...