最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - "echarts"' has no exported member named 'EChartOption'. Did you mean &

programmeradmin3浏览0评论

I am using Angular 9 along with "ngx-echarts": "5.2.2" and "echarts": "5.0.0"

Everything works fine accept while setting icon: 'circle' for legends. It says below thing.

Type '{ icon: string; top: string; left: string; orient: "vertical"; }' is not assignable to type 'LegendOption | ScrollableLegendOption | (LegendOption | ScrollableLegendOption)[]'.

As per example in ngx-echarts I can't use import { EChartOption } from 'echarts';

I have checked that icon is available in EchartOption instead of EchartsOption

Is there anything i am missing?

After installing @types/echarts my code is working and showing legend with circle icon but have random error that it can't find EchartOption in echarts (My angular is not taking care of this and running application by ignoring this error)

RIght now i went with import { EChartsOption } from 'echarts'; and removed @types/echarts library. And i can't change legend icon for the moment :( Any help?

Thanks, Jayesh

I am using Angular 9 along with "ngx-echarts": "5.2.2" and "echarts": "5.0.0"

Everything works fine accept while setting icon: 'circle' for legends. It says below thing.

Type '{ icon: string; top: string; left: string; orient: "vertical"; }' is not assignable to type 'LegendOption | ScrollableLegendOption | (LegendOption | ScrollableLegendOption)[]'.

As per example in ngx-echarts I can't use import { EChartOption } from 'echarts';

I have checked that icon is available in EchartOption instead of EchartsOption

Is there anything i am missing?

After installing @types/echarts my code is working and showing legend with circle icon but have random error that it can't find EchartOption in echarts (My angular is not taking care of this and running application by ignoring this error)

RIght now i went with import { EChartsOption } from 'echarts'; and removed @types/echarts library. And i can't change legend icon for the moment :( Any help?

Thanks, Jayesh

Share Improve this question edited Feb 24, 2021 at 12:27 Jayesh Dhandha asked Feb 24, 2021 at 5:04 Jayesh DhandhaJayesh Dhandha 2,11931 silver badges55 bronze badges 3
  • You should include the code that causes the issue, so that we can see the types that you try to use – TmTron Commented Mar 13, 2021 at 10:22
  • in my EchartOption config, I want a option which can convert my legends to circle instead of rectangle. Does code required for that? – Jayesh Dhandha Commented Mar 13, 2021 at 11:20
  • Of course - how should anyone know what's wrong with your code, when we cannot see it?. It would be even better when you create a Minimal Reproducible Example – TmTron Commented Mar 13, 2021 at 12:44
Add a comment  | 

2 Answers 2

Reset to default 20

When yo use echarts 5 you MUST NOT install @types/echarts, because echarts 5 is now written in typescript: i.e. the echarts package already includes the correct types for this version.

There have been many changes between echarts 4 and echarts5 - one of them is that EchartOption is now called EchartsOption (with plural "s")

Try this:

import * as echarts from 'echarts';

type EChartsOption = echarts.EChartsOption;

You can find code example here: https://echarts.apache.org/examples/en/editor.html?c=line-simple&lang=ts, click Full Code tab

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论