Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chart balloon not update using updateChart on amChartsService #76

Open
MohamedChaabouni opened this issue May 9, 2018 · 3 comments
Open

Comments

@MohamedChaabouni
Copy link

I working on updating all chart properties using amcharts angular 5. I changed successfully properties such as backgroundColor ect.. using amChartsService but on working with balloons the balloon color and background color aren't changing. I used to destroy the chart and re-create it, but it's not the best way to do it. I believe that there is a better way to do it there's my code.

this.amChartsService.updateChart(this.currentChart, () => {
this.currentChart['balloon']['color'] = value;
});
on the console.log(this.currentChart.balloon.color); the value already been changed but not in the chart.

Why i'm getting this ? is it a bugg that should be reported or I'm doing something wrong ??

Thanks.

@shreddison
Copy link

shreddison commented May 9, 2018

I'd say the code looks fine, where are you placing it?

Have a look at this example based on your code:

`
ngAfterViewInit() {
this.chart = this.amChartsService.makeChart('chartdiv', { …. });

this.amChartsService.updateChart(this.chart, () => {
this.chart['balloon']['color'] = 'blue';
});
}
`

@MohamedChaabouni
Copy link
Author

This is exactly what i'm doing and the color in the object is changing but not in the chart for other properties the chart is updated but not for the balloon properties that's quite strange

@amcharts
Copy link
Owner

New comment from Zendesk by Anthony Piris on ticket 34046.
(replying here will automatically notify amCharts support agent)

Hi there,

Do you happen to have a chart cursor enabled? This might be due to a bug within the chart library itself. If you have a chart cursor enabled, updating the balloon through the global balloon property (this.chart.balloon.color = ...;) doesn't work, however if you update the balloon object inside the graph object(s), the update will work, i.e.

ngAfterViewInit() {
  // ...
  this.AmCharts.updateChart(this.chart, () => {
    this.chart.graphs[0].balloon.color = 'blue';
  });
}

Let me know if that helps.

Best,

Anthony Piris
amCharts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants