100pah commented on issue #9028: 用dataset这种方式渲染pie图时,如果name的值为数字,value会无效,渲染时用的是name的值 URL: https://github.com/apache/incubator-echarts/issues/9028#issuecomment-419489456 `dimensions` 里面的值其实是用户自定义的,虽然叫做 `'name'`、`'value'`,echarts 并不能识别其含义。在没有提供 `encode` 信息的情况下,echarts 只是做猜测,如果第一列看着像是 文本的话,就作为 `name`,如果看着像数值的话,就作为 `value`。这种猜测策略是以 “多数场景” 的习惯状态为依据的。 如果猜测不准确,那么就应该手动指定 `encode`,如: ```js option = { legend: {}, tooltip: {}, dataset: { dimension:['name','value'], source: [ ['10', 52.2], ['20', 43.3], ['30', 83.1], ['40', 86.4], ['50', 72.4] ] }, series: [{ type: 'pie', encode: { itemName: 0, value: 1 } }] }; ```
---------------------------------------------------------------- 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]
