Toggle navigation
电量统计
By
hao123hahaha
2018-12-20 09:24:58
脚本
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
图表已生成
整理代码
刷新
代码
var Chart = { Config: { y_font_color: '#60F194', x_font_color: '#fff', y_line_color: '#184483', x_line_color: '#184483', split_line_color: 'rgba(0,53,115,0.6)' }, getXAxisData(timestamp) { let date = new Date(); if (timestamp) date.setTime(parseInt(timestamp)); let year = date.getFullYear(); date.setMonth(date.getMonth() + 1); date.setDate(0); let month = date.getMonth() + 1; let day_max = date.getDate(); let data = []; for (let i = 1; i <= day_max; i++) { data.push(i < 10 ? year + '/' + month + '/0' + i : year + '/' + month + '/' + i); } return data; }, //用于进行双轴均分计算,这里的max和min需要提前获取到 split(){ let max = 10; let min = 0; //双轴切割线均分重合 if (max > 0 && line_max > 0) { //此处定义规则 let interval_y_left = parseInt(max / 6) + 1; let interval_y_right = parseFloat((parseFloat(line_max / 6) * 1.1).toFixed(1)); option.yAxis = [{ max: (interval_y_left * 6).toFixed(2), interval: interval_y_left }, { max: (interval_y_right * 6).toFixed(2), interval: interval_y_right }]; } else { option.yAxis = [{max: 1}, {max: 1}]; } } }; option = { backgroundColor: '#141845', color: ['#26CEFB', '#FEE99A'], tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: { color: '#999' } } }, legend: { top: '2%', right: '2%', data: ['日用电量(kw·h)', '单位用电量(kw·h/m³)'], textStyle: { color: '#fff', fontSize: '14px' }, icon: 'rect', itemHeight: 7 }, grid: { left: '5%', right: '5%', top: '18%', bottom: '38%' }, xAxis: [{ type: 'category', data: Chart.getXAxisData(), axisPointer: { type: 'shadow' }, axisLine: { lineStyle: { color: Chart.Config.x_line_color } }, axisLabel: { // margin: 26, interval: 0, rotate: 30, textStyle: { color: Chart.Config.x_font_color, fontSize: '70%' } } }], yAxis: [{ axisPointer: { show: false }, splitNumber: 6, type: 'value', min: 0, //max: 6000, axisLabel: { textStyle: { color: Chart.Config.y_font_color, fontSize: '12px' } }, axisLine: { lineStyle: { color: Chart.Config.y_line_color, } }, splitLine: { lineStyle: { color: Chart.Config.split_line_color, width: 0, type: 'solid' } } }, { axisPointer: { show: false }, splitNumber: 6, type: 'value', min: 0, //max: 0.6, axisLabel: { textStyle: { color: Chart.Config.y_font_color, fontSize: '12px' } }, axisLine: { lineStyle: { color: Chart.Config.y_line_color, } }, splitLine: { lineStyle: { color: Chart.Config.split_line_color, width: 1, type: 'solid' } } } ], series: [{ name: '日用电量(kw·h)', type: 'bar', data: [12, 23, 33, 2, 11, 43, 66, 2, 12, 44, 84, 27, 2] }, { name: '单位用电量(kw·h/m³)', type: 'line', yAxisIndex: 1, data: [11, 55, 2, 54, 17, 29, 42, 56, 78, 2, 22, 4, 3] }] };