xieziyu / ngx-echarts

An angular (ver >= 2.x) directive for ECharts (ver >= 3.x)
https://xieziyu.github.io/ngx-echarts/
MIT License
1.1k stars 195 forks source link

Navigation issue on chart click #18

Closed cghanassia closed 7 years ago

cghanassia commented 7 years ago

Hello, The navigation failed when i try to navigate after click on chart

public chartClicked(e: any): void { this.router.navigate(['/page/home']); }

<div echarts [options]="optionPieWhite" class="demo-chart-2" (chartClick)="chartClicked($event)"></div>

This is an issue from ngx-echarts or angular 4 ?

Thank for your response.

xieziyu commented 7 years ago

@cghanassia I'm afraid this should not be an issue of ngx-echarts if chartClick is correctly emitted. I did some test in my project and it can navigate to the target url when I clicked some components in the chart.

Remember that, the chartClick is only emitted when you clicked certain components in the chart. Please refer to the official doc of echarts for details about the events: https://ecomfe.github.io/echarts-doc/public/en/api.html

cghanassia commented 7 years ago

Thank you to your response.

For sure, i dont' manage efficiently angular 4 or echarts. I just find a workaround i declare also a 'click' event and by lucky this event is trigger after 'chartClick'.

So i get back what i need for the navigation and on 'click' event i do the navigation.

I hope for the futur release for Angular or Echarts the event 'chartClick' work correctly.