Unable to access 'getModel' function in typescript
Version
5.2.2
Link to Minimal Reproduction
No response
Steps to Reproduce
- Create any chart
- on the chart finish event . I am trying to access chart.getModel().getComponent('grid')
- So while running the application we are getting below issue
Property 'getModel' is private and only accessible within class 'ECharts'.
Current Behavior
It is working as expected but need to make the getModel function as public
Expected Behavior
It is working as expected but need to make the getModel function as public
Environment
- OS:
- Browser:
- Framework:
Any additional comments?
If any workaround is there to get the component other than getModel function
getModel is not ready to be public yet because it will expose too much internal abstraction. We only suggest using this method when it's the only workaround to solve the issue and you can accept the missing doc and potential breaking change of this method in the future.
Please close this issue if you don't have further questions. Thanks! @RavalikaP
@pissang
- I'm a bit confused,
getModel()appears frequently, both in the documentation and in git. For example, https://echarts.apache.org/en/faq.html#baidu-map and https://github.com/apache/echarts/tree/5.3.3/extension-src/bmap both mentionchart.getModel().getComponent('bmap').getBMap();, which specifically accesses the private method. If this is not allowed to be used directly, should we update the documentation?
@pissang @Ovilia but if not using getModel(), how can I get the component value when zooming in and zooming out?
You should listen to datazoom event.