Toggle navigation
大声道
By
1***去
2020-06-11 05:23:15
脚本
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
图表已生成
整理代码
刷新
代码
option = { backgroundColor: '#0c1e55', //背景颜色 title: { text: '大声道', //表头 x: 'center', top: "20", textStyle: { //文字颜色 color: '#ffff', //字体风格 fontStyle: 'normal', //字体粗细 fontWeight: 'bold', //字体系列 fontFamily: 'sans-serif', //字体大小 fontSize: 18 }, }, tooltip: { trigger: 'axis', // transitionDuration: 0, // confine: true, // bordeRadius: 51, borderWidth: 1, //提示框边框的大小 borderColor: '#333', //提示框边框的颜色 backgroundColor: 'rgba(255,255,255,0.9)', //提示框的背景颜色(0.9为透明度) textStyle: { fontSize: 12, //提示框的字体大小 color: '#333', //提示框里的字体颜色 aligin: 'center', }, }, color: ['red', '#12C3C3', '#FBCD14'], //颜色配置 legend: { data: ['叠翠园', '北岳北'], // right:'30',//标签头 居右距离 bottom: '70', // top:'20', //标签头 居上距离 textStyle: { // color: [ '#','#'], // 标签头 提示文字的颜色 color: '#ffff' }, icon: "circle", //icon 长方形 circle 圆形 arrow箭头型 diamond菱形 // triangle三角形 emptyDiamond 空心菱形 //emptyCircle 空心圆型 emptyRectangle 空心长方形 emptyTriangle 空心三角形 }, dataZoom: [{ type: 'slider', realtime: true, //拖拉 handleSize: '100%', //滑动条两侧的大小 start: 0, //开始位置 end: 50, //结束位置 bottom: 25, //居下的距离 textStyle: { color: '#1bb4f6' // 滑动条的文字颜色 }, }], grid: { left: '3%', //整个曲线居左的距离 right: '4%', //整个曲线居右左的距离 bottom: '20%', //整个曲线居下左的距离 height: '70%', //整个曲线的高 containLabel: true }, toolbox: { show: true, feature: { // dataZoom: {}, dataView: { readOnly: true }, magicType: { type: ['line', 'bar', 'pie'] }, restore: {}, textStyle: { color: '#1bb4f6', // 左上角切换的颜色 }, // saveAsImage: {} } }, optionToContent: function(opt) { let axisData = opt.xAxis[0].data; //坐标数据 let series = opt.series; //折线图数据 let tdHeads = '
时间
'; //表头 let tdBodys = ''; //数据 series.forEach(function(item) { //组装表头 tdHeads += `
${item.name}
`; }); let table = `
${tdHeads}
`; for (let i = 0, l = axisData.length; i < l; i++) { for (let j = 0; j < series.length; j++) { //组装表数据 tdBodys += `
${ series[j].data[i]}
`; } table += `
${axisData[i]}
${tdBodys}
`; tdBodys = ''; } table += '
'; return table; }, xAxis: { type: 'category', boundaryGap: false, data: ['10月1日', '10月2日', '10月3日', '10月4日', '10月5日', '10月6日', '10月7日'], axisLine: { lineStyle: { color: '#BA55D3', //设置X轴的颜色 width: 1.5, //设置X轴的粗细 } }, axisLabel: { show: true, textStyle: { color: '#00FF00' //Y轴的数据字体颜色 }, }, }, yAxis: [{ name: "亿元", //左侧单位 nameTextStyle: { color: "#ebf8ac" //左侧单位文字 }, type: 'value', axisLine: { lineStyle: { color: '#FFFF', //设置Y轴的颜色 width: 1.5, //设置Y轴的粗细 } }, axisLabel: { show: true, //formatter: "{value} %", //左侧单位添加后缀 textStyle: { color: '#00FF00' //Y轴的数据字体颜色 }, }, splitLine: { show: true, lineStyle: { color: '#FFC125' //网格线的颜色 } } }, { type: "value", name: "同比", nameTextStyle: { color: "red" }, position: "right", splitLine: { show: false }, axisTick: { show: false }, axisLine: { lineStyle: { color: 'red', //设置Y轴的颜色 width: 1.5, //设置Y轴的粗细 } }, axisLabel: { show: true, formatter: "{value} %", //右侧Y轴文字显示 textStyle: { color: "red" } } }, ], series: [{ name: '叠翠园', type: 'line', smooth: true, //圆滑的曲线 data: [180, 92, 81, 174, 210, 280, 210], symbolSize: 1, // color: '#BA55D3', yAxisIndex: 1, //下标以右侧同比数据参考 lineStyle: { width: 5 //改变线条的粗细 }, label: { show: true, //是否显示 // position: 'top', //位置 // distance: 15, //高度 // color: '#DB5E6A', //颜色 // fontWeight: 'bolder', //加粗 // fontSize: 20, //字体大小 }, }, { name: '北岳北', type: 'line', smooth: true, data: [340, 382, 391, 334, 390, 390, 410], // symbolSize: 1, // label: { // show: true, //是否显示 // position: 'top', //位置 // distance: 15, //高度 // // color: '#DB5E6A', //颜色 // fontWeight: 'bolder', //加粗 // // fontSize: 20, //字体大小 // }, } ] };