1

I've seen a few answers online but none that seem to apply to angular.

I have an example with a simple chart and two series. I want the toggle to toggle the visability of the second series.

this.chartOptions.series[1].visible = true|false;

but this doesn't trigger the chart to redraw. And since I defined the chart in the Angular html template I don't think I can re-instantiated the chart element like the docs suggest.

Can anyone help me toggle the chart to redraw?

Dustin
  • 387
  • 4
  • 14
  • 2
    stackblitz link has changed – C.OG Dec 24 '19 at 00:01
  • Redraw callback function in docs: https://api.highcharts.com/highcharts/chart.events.redraw. Example here: https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/chart/events-load/ – Nathaniel Flick Dec 24 '19 at 00:48
  • I think that this demo from official Highcharts Angular documentation should help you to implement the update event in your chart: https://codesandbox.io/s/k24qxvzlk7 docs: https://github.com/highcharts/highcharts-angular. If not - could you share your stackblitz again? Current link doesn't work. – Sebastian Wędzel Dec 24 '19 at 10:41
  • Updated the link... thanks – Dustin Dec 24 '19 at 14:23

1 Answers1

0

I screwed up and posted an invalid link, but Nathaniel pointed me in the right direction.

I just needed to set the update flag to true.

Dustin
  • 387
  • 4
  • 14