Incubator-echarts: dataset中使用key-value形式的数组,当key为数字时,其数据无法显示

Created on 7 Feb 2018  ·  2Comments  ·  Source: apache/incubator-echarts

One-line summary [问题简述]

dataset中使用key-value形式的数组,当key为数字时,数据无法显示

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]:4.0.2
  • Browser version [浏览器类型和版本]:chrome 64

Expected behaviour [期望结果]

数字字符串不识别为列数

ECharts option [ECharts配置项]


option ={"legend":{"data":["2","4","-1001"]},"xAxis":{"type":"time"},"yAxis":{},"series":[{"type":"line","name":"2","encode":{"x":"timestamp","y":"2"}},{"type":"line","name":"4","encode":{"x":"timestamp","y":"4"}},{"type":"line","name":"-1001","encode":{"x":"timestamp","y":"-1001"}}],"dataset":{"source":[{"2":250,"4":330,"timestamp":"2018-02-05T00:00:00.000+08:00","-1001":300},{"2":350,"4":200,"timestamp":"2018-02-06T00:00:00.000+08:00","-1001":400},{"2":200,"4":100,"timestamp":"2018-02-07T00:00:00.000+08:00","-1001":300}],"dimensions":["timestamp","2","4","-1001"]}}

Other comments [其他信息]


stale

All 2 comments

官方有例子,是不是你用错了

dataset: {
// 这里指定了维度名的顺序,从而可以利用默认的维度到坐标轴的映射。
// 如果不指定 dimensions,也可以通过指定 series.encode 完成映射,参见后文。
dimensions: ['product', '2015', '2016', '2017'],
source: [
{product: 'Matcha Latte', '2015': 43.3, '2016': 85.8, '2017': 93.7},
{product: 'Milk Tea', '2015': 83.1, '2016': 73.4, '2017': 55.1},
{product: 'Cheese Cocoa', '2015': 86.4, '2016': 65.2, '2017': 82.5},
{product: 'Walnut Brownie', '2015': 72.4, '2016': 53.9, '2017': 39.1}
]
}

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings