echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Bug] The documentation for `EChartsInitOpts` has a type error about height and width

Open linghengqian opened this issue 3 years ago • 2 comments

Version

master https://github.com/apache/echarts/commit/c9e9a022d1fc71c78c0f85ebc8d5169c0edc1ab6

Link to Minimal Reproduction

Just a documentation error.

Steps to Reproduce

  • Open https://echarts.apache.org/en/api.html#echarts.init which states that both width and height are of type number|string. We should therefore expect https://github.com/apache/echarts/blob/master/src/core/echarts.ts or https://github.com/apache/echarts/blob/5.3.3/src/core/echarts.ts to be consistent with this documentation.

  • image

Current Behavior

  • For https://github.com/apache/echarts/blob/master/src/core/echarts.ts and https://github.com/apache/echarts/blob/5.3.3/src/core/echarts.ts , width and height are both number, which means the following paragraph of the document is not reasonable enough.
width Specify width explicitly, in pixel. If setting to null/undefined/'auto', width of dom (instance container) will be used.
height Specify height explicitly, in pixel. If setting to null/undefined/'auto', height of dom (instance container) will be used.
  • Refer to
  • https://github.com/apache/echarts/blob/5.3.3/src/core/echarts.ts#L322
  • https://github.com/apache/echarts/blob/master/src/core/echarts.ts#L323

image

Expected Behavior

  • Updating documentation is expected behavior.

Environment

- OS: Windows 11
- Browser: 105.0.1343.42
- Framework: Vue@2

Any additional comments?

  • I believe most of the people in https://github.com/apache/echarts/issues/10478 get that kind of error simply because they misunderstood the documentation.

linghengqian avatar Sep 18 '22 12:09 linghengqian

This issue is labeled with difficulty: easy. @linghengqian Would you like to debug it by yourself? This is a quicker way to get your problem fixed. Or you may wait for the community to fix.

Please have a look at How to debug ECharts if you'd like to give a try. 🤓

echarts-bot[bot] avatar Sep 19 '22 05:09 echarts-bot[bot]

This issue is labeled with difficulty: easy. @linghengqian Would you like to debug it by yourself? This is a quicker way to get your problem fixed. Or you may wait for the community to fix.

Please have a look at How to debug ECharts if you'd like to give a try. 🤓

  • I'm a bit confused about this tag, does this require modifying the document or let's modify the typescript type in echarts.ts ?

linghengqian avatar Sep 19 '22 05:09 linghengqian