Toggle navigation
双y轴 Normalization
By
大爱娜拉姐
2017-09-08 07:55:38
脚本
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 data = { // x轴类目数据 cate: [1, 2, 3, 4, 5, 6, 7, 8], // 左侧y中的系列 yAxisLeft: { // 系列值与cate个数一致,则可以省略x下标 '人数': [1 ,2 ,3, 4, 5, 6, 7, 8], // 系列值与cate个数不一致,则不能省略x下标 '人数二': [ [2, 3], [3, 3], [6, 8] ] }, // 右侧y中的系列 yAxisRight: { // 系列值与cate个数一致,则可以省略x下标 '个数': [1 ,2 ,3, 4, 5, 6, 7, 8], // 系列值与cate个数不一致,则不能省略x下标 '个数二': [ [2, 3], [3, 3], [6, 8] ] } } var leftLegends = Object.keys(data.yAxisLeft) var rightLegends = Object.keys(data.yAxisRight) var leftSeries = leftLegends.map(key => { return { name: key, data: data.yAxisLeft[key], yAxisIndex: 0, type: 'scatter' } }) var rightSeries = rightLegends.map(key => { return { name: key, data: data.yAxisRight[key], yAxisIndex: 1, type: 'scatter' } }) option = { legend: { data: leftLegends.concat(rightLegends) }, xAxis: { name: 'xAxis', data: data.cate }, yAxis: [{ type: 'value', name: '人数', min: 0, position: 'left' }, { type: 'value', name: '个数', min: 0, position: 'right' }], tooltip: { show: true }, series: leftSeries.concat(rightSeries) }