ralscha / blog

Source code for my blog
https://golb.hplar.ch/
MIT License
222 stars 246 forks source link

cannot show the info in HTML file when click number dot in the Echarts #4

Closed JerryMissTom closed 7 years ago

JerryMissTom commented 7 years ago

Hi ralscha, I have read your blog "Integrate Echarts into an Ionic3 app", it is nice and easy to understand. good work. I tried to use ECharts 3.X to draw chart in my app built with Ionic V3.3. When I click the number dot in my chart, the related data will show in a field in HTML file. In the click event, I could get the data and copy it to a variable, but could not show value of the variable in HTML file. The screenshot of code is: html 1 ts 2 result 3

but when I write this.text='hello world' in ngOnInit() method, it will show "hello world" without any problem. Did you ever met with this scene?

ralscha commented 7 years ago

Hi Havn't experienced any problems so far, but I didn't do a lot with echarts so far.

I think in your example this in the listener does not point to the ContactPage. I guess this is the chart element

Try this instead

this.domMain.on('click', param => this.text = param.value + '');
JerryMissTom commented 7 years ago

it works!! Thank you very much, it help me a lot. This problem frustrates me all day.

ralscha commented 7 years ago

Glad I could help