Toggle navigation
没数据时无法显示chart
By
skyjune5
2017-05-31 03:56:39
脚本
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 = { textStyle: { fontSize:24 }, tooltip: { trigger: "axis" // formatter: function (params) { // // console.log(params[0].value[0]); // return params[0].value[0] + " / " + params[0].value[1]; // } }, grid: { left: "6%", right: "3%" }, legend: { left : "right", top: "20", //离容器上侧的距离 right: "200", //离容器右侧的距离 aligh: "right", data:[{ // name: this.option.oBundle.getText("AlertState"), //name: "Alert State", icon: "square", textStyle: { color: "#222222", fontSize: "13px", fontFamily: "Arial" } }] }, xAxis: { name: "Time Period", nameLocation: "middle", nameGap: "40", nameTextStyle: { fontSize: "16", fontWeight: "500", fontStyle: "normal", fontFamily: "Arial" }, data: [], axisLine: { show: false }, axisTick: { show: false }, splitLine: { show: false } }, yAxis: { max: 'dataMax', min: 'dataMin', // name: "Fatigue", nameTextStyle: { fontSize: "20", fontWeight: "500", fontStyle: "normal", fontFamily: "Arial" }, type: "value", axisLabel: { show: true, formatter: function (value) { return value.toFixed(2); } }, axisLine: { show: true, interval: 1 }, axisTick: { show: false }, splitLine: { show: true, interval: 1 } }, series: [{ type: 'line', showSymbol: false, hoverAnimation: false, data: [], itemStyle: { normal: { color: '#199CD8', borderColor: '#fff', borderWith: 1, shadowBlur: 2, shadowOffsetX: 2, shadowOffsetY: 5 } }, lineStyle: { normal: { width: 2, shadowColor: 'rgba(112, 155, 233, 0.5)', shadowBlur: 4, shadowOffsetY: 4 } } }, //为了调色用 { name: "Alert State", type: 'line', itemStyle: { normal: { color: 'rgba(251,222,222,0.5)' } }, markLine: { silent: true, symbol: false, animation: false, label: { normal: { show: false } }, data: [{ yAxis: -0.10 }], lineStyle: { normal: { type: "solid", color: "#CE1C08" } } }, markArea: { //图形是否不响应和触发鼠标事件,默认为 false,即响应和触发鼠标事件。markArea 默认的 z 比较大会覆盖在上面. silent: true, itemStyle: { normal: { color: "rgba(251,222,222,0.5)", borderColor: "#CE1C08", borderWith: 1 } }, data: [ [{ coord: 0 }, { yAxis: 4.10 }] ] } }] }; option.yAxis.name = "Fatigue"; option.series[1].name = "Alert State"; option.legend.data[0].name = "Alert State"; // option.xAxis.name = "TimePeriod"; function randomData() { now = new Date(+now + oneMinute); var fatigue = Math.random() * 2 - 1; return { value: [ [now.getHours(), now.getMinutes()].join(":"), Math.round(fatigue * 100) / 100 ] }; } // var now = +new Date(); // var oneMinute = 60 * 1000; // var data = []; // var x = []; // // for (var i = 0; i < 50; i++) { // var item = randomData(); // data.push(item) // x.push(item.value[0]) // // } // option.xAxis.data = x; // option.series[0].data = data;