You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "ChepteaCatalin (via GitHub)" <gi...@apache.org> on 2023/09/15 10:48:12 UTC
[GitHub] [echarts] ChepteaCatalin commented on issue #18216: [Bug] Dataset treats array of array differently than array of object
ChepteaCatalin commented on issue #18216:
URL: https://github.com/apache/echarts/issues/18216#issuecomment-1721067253
@tobibe, when using an array of arrays as `source` with `seriesLayoutBy: 'row'`, the `dimensions` are implicitly inferred from your data as:
```javascript
['product', 'Matcha Latte', 'Milk Tea', 'Cheese Cocoa', 'Walnut Brownie']
```
If you want to achieve the same result using an array of objects as a data source, you have to explicitly set dimensions as shown above and replace `product` with `year`:
```javascript
dataset: {
dimensions: ['year', 'Matcha Latte', 'Milk Tea', 'Cheese Cocoa'],
source: [
{ year: 2015, 'Matcha Latte': 43.3, 'Milk Tea': 83.1, 'Cheese Cocoa': 86.4 },
{ year: 2016, 'Matcha Latte': 85.8, 'Milk Tea': 73.4, 'Cheese Cocoa': 65.2 },
{ year: 2017, 'Matcha Latte': 93.7, 'Milk Tea': 55.1, 'Cheese Cocoa': 82.5 },
]
},
```
`seriesLayoutBy` in this case would not make sense, and you could remove it. It only helps to correctly infer `dimensions` and corresponding data from your dataset when you are using an array of arrays as the data source.
@Ovilia, am I right, or did I miss something?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org