vue-vben-admin
vue-vben-admin copied to clipboard
echart 使用dataset 对象数组数据源无法显示图表
⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.
- [ ] Read the docs.
- [ ] Make sure the code is up to date. (Some bugs have been fixed in the latest code)
- [ ] This is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Describe the bug
使用echarts官方示例中的对象数组数据集无法渲染出图表,在官方实例中,代码则可以正常运行
Reproduction
option = { legend: {}, tooltip: {}, dataset: { 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 } ] }, xAxis: { type: 'category' }, yAxis: {}, // Declare several bar series, each will be mapped // to a column of dataset.source by default. series: [{ type: 'bar' }, { type: 'bar' }, { type: 'bar' }] }
System Info
- Operating System:
- Node version:
- Package manager (npm/yarn/pnpm) and version:
因为echarts是按需引入的,你需要在src/utils/lib/echarts.ts使用DatasetComponent
因为echarts是按需引入的,你需要在src/utils/lib/echarts.ts使用DatasetComponent
当然已经引入无效之后才提的
因为echarts是按需引入的,你需要在src/utils/lib/echarts.ts使用DatasetComponent
当然已经引入无效之后才提的
我试过了哦,引入DatasetComponent之后,这个配置是可以加载出图表的
因为echarts是按需引入的,你需要在src/utils/lib/echarts.ts使用DatasetComponent
当然已经引入无效之后才提的
如果使用了 transform 还需要引入 TransformComponent
因为echarts是按需引入的,你需要在src/utils/lib/echarts.ts使用DatasetComponent
感谢!