Angular 16 NgxECharts面积图:EChartsOption类型赋值报错排查
ECharts类型定义与配置疑问
我尝试将ECharts配置项options的类型从any改为EChartsOption:
options!: EChartsOption; // options!: any;
此时触发lint错误:
Type '{ normal: { color: string; }; emphasis: { color: string; borderColor: string; borderWidth: number; }; }' is not assignable to type 'ItemStyleOption<CallbackDataParams>'. Object literal may only specify known properties, and 'normal' does not exist in type 'ItemStyleOption<CallbackDataParams>'.
当类型设为any时,图表可正常渲染,且配置中的normal字段确实生效:
normal: { color: 'rgba(0,0,0,0.3)', },
另外查阅ECharts v4英文文档时,发现series下并未列出itemStyle配置项,但实际配置该字段却能生效。想请教:
- 是我的图表配置有误,还是
EChartsOption的类型定义存在遗漏? - 为何文档未提及的
itemStyle能实际生效?
内容的提问来源于stack exchange,提问作者Ole
相关产品推荐
相关产品推荐

