Scookie commented on issue #7853: 使用dataset和time,在多个维度时异常 URL: https://github.com/apache/incubator-echarts/issues/7853#issuecomment-434972128 you can do it according to the following way. 你可以试试下面的方法. ``` option = { legend: {}, tooltip: {}, dataset: { source: [ ['time', 'pay', 'income'], ['2017/5/3', 43.3, 85.8], ['2017/5/4', 83.1, 73.4], ['2017/5/5', 86.4, 65.2], ['2017/5/6', 72.4, 53.9] ] }, xAxis: {type: 'time'}, yAxis: {}, series: [ { type: 'line', name:"pay", encode:{ x:"time", y:"pay" } }, { type: 'line', name:"income", encode:{ x:"time", y:"income" } } ] } ```  Or you can do it like this. 或者你也可以优化下写成这样 ``` let data = [ ['time', 'pay', 'income'], ['2017/5/3', 43.3, 85.8], ['2017/5/4', 83.1, 73.4], ['2017/5/5', 86.4, 65.2], ['2017/5/6', 72.4, 53.9] ]; let dimensions = data[0]; let timeKey = "time"; let series = []; dimensions.forEach(item => { if(item != timeKey){ series.push({ type: 'line', name:item, encode:{ x:timeKey, y:item } }); } }) option = { legend: {}, tooltip: {}, dataset: { source: data }, xAxis: {type: 'time'}, yAxis: {}, series: series } ``` 
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
