Toggle navigation
我的Line chart
By
i***行
2020-11-18 07:04:47
脚本
16
21
作品使用的第三方脚本
数据管理
上传数据
支持小于 5M 任意格式(csv, xlsx, json, xml, ...)的数据文件
上传后可以通过生成的文件链接异步获取托管的数据。
历史数据
0 条
无历史数据
代码修改记录
信息提示
保存作品
对当前截图不满意?你还可以
上传本地截图
重新截图
作品名称
作品描述
标签
geo
grid
legend
markLine
markPoint
bar
effectScatter
line
lines
map
timeline
title
toolbox
tooltip
visualMap
作品默认版本
最新
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
20:11:45
图表已生成
整理代码
刷新
代码
/* 最近本人发现了配置更简单,更容易理解,更容易修改,bug更少的写法 所以更新了原图表,这里分享给大家 不知道用以前写法的小伙伴有没有发现 1.项目中如果数据为0的话,hover的时候用以前的写法文字会将圆点盖住... 2.鼠标放上的时候,x轴Pointer文字可能会有些轻微的向上或向下的移动... 3.文字下划线和文字见的距离过小,有的时候不是很符合需求... 以下旧写法我都注释了哈,现在生效的是新写法,新写法我也解释说明了哦 */ /* 这个注释建议看完代码再看哦 1.如果axisLabel和axisPointer的margin相同,则padding[0]必须等于0 2.实现效果axisLabel和AxisPointer的字体大小必须相同 3.此配置实现效果axisLabel和axisPointer的margin必须相同 其他配置同样可以实现效果,如lineHeight等 这是我整理、删除多余相同配置项后总结出的,使用方便,便于封装复用 适用于大多数图表的配置 更复杂的样式还是要参考配置文档的哦??? */ const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF'] option = { backgroundColor: '#080b30', title: { text: '全国6月销售统计', textStyle: { fontSize: 12, fontWeight: 400 }, left: 'center', top: '5%' }, legend: { icon: 'circle', top: '5%', right: '5%', itemWidth: 6, itemGap: 20, textStyle: { color: '#556677' } }, tooltip: { trigger: 'axis', axisPointer: { lineStyle: { color: { type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: 'rgba(0, 255, 233,0)' }, { offset: 0.5, color: 'rgba(255, 255, 255,1)', }, { offset: 1, color: 'rgba(0, 255, 233,0)' }], global: false } }, }, backgroundColor: '#fff', textStyle: { color: '#5c6c7c' }, padding: [10, 10], extraCssText: 'box-shadow: 1px 0 2px 0 rgba(163,163,163,0.5)' }, grid: { top: '15%' }, xAxis: [{ type: 'category', data: ['北京', '上海', '广州', '深圳', '香港', '澳门', '台湾'], axisLine: { show: true }, splitArea: { // show: true, color: '#f00', lineStyle: { color: '#f00' }, }, axisLabel: { color: '#fff' }, splitLine: { show: false }, boundaryGap: false }], yAxis: [{ type: 'value', min: 0, // max: 140, splitNumber: 6, splitLine: { show: true, lineStyle: { color: 'rgba(255,255,255,0.1)' } }, axisLine: { show: false, }, axisLabel: { show: false, margin: 20, textStyle: { color: '#d1e6eb', }, }, axisTick: { show: false, }, }, { type: 'value', position: 'right', axisTick: { show: false }, axisLabel: { show: false, textStyle: { color: '#556677' }, formatter: '{value}' }, axisLine: { show: false, lineStyle: { color: '#DCE2E8' } }, splitLine: { show: false } }], series: [ { name: 'Nike', type: 'line', data: [5, 12, 11, 14, 12, 16, 10], symbolSize: 10, symbol: 'circle', smooth: true, yAxisIndex: 0, showSymbol: false, lineStyle: { width: 3, color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{ offset: 0, color: '#73DD39' }, { offset: 1, color: '#00ca95' } ]), shadowColor: 'rgba(0, 0, 0, .3)', shadowBlur: 0, shadowOffsetY: 5, shadowOffsetX: 5, }, label: { show: true, position: 'top', textStyle: { color: '#00ca95', } }, itemStyle: { normal: { color: "#00ca95", borderColor: "#fff", borderWidth: 1, shadowColor: 'rgba(0, 0, 0, .3)', shadowBlur: 0, shadowOffsetY: 2, shadowOffsetX: 2 } }, areaStyle: { normal: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgba(0,202,149,0.3)' }, { offset: 1, color: 'rgba(0,202,149,0)' } ], false), shadowColor: 'rgba(0,202,149, 0.9)', shadowBlur: 20 } } }, { name: '老北京布鞋', type: 'line', data: [150, 120, 170, 140, 500, 160, 110], symbolSize: 10, yAxisIndex: 1, symbol: 'circle', smooth: true, showSymbol: false, lineStyle: { width: 3, color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ offset: 0, color: '#6c50f3' }, { offset: 1, color: '#6c50f3' } ]), shadowColor: 'rgba(0, 0, 0, .3)', shadowBlur: 0, shadowOffsetY: 5, shadowOffsetX: 5, }, label: { show: true, position: 'top', textStyle: { color: '#6c50f3', } }, itemStyle: { normal: { color: "#6c50f3", borderColor: "#fff", borderWidth: 1, shadowColor: 'rgba(0, 0, 0, .3)', shadowBlur: 0, shadowOffsetY: 2, shadowOffsetX: 2 } },areaStyle: { normal: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: 'rgba(108,80,243,0.3)' }, { offset: 1, color: 'rgba(108,80,243,0)' } ], false), shadowColor: 'rgba(108,80,243, 0.9)', shadowBlur: 20 } } } ] };