aspnet learner
aspnet learner

Reputation: 99

How to invert a chart in Highcharts through code?

I am trying to invert a chart through code in Highcharts.

I am setting the chart inverted property:

chart.inverted = true;
chart.redraw();

You can see the code I am using here:

http://jsfiddle.net/Wajood/Hz4bH/

This doesn't invert the chart. It seems to me that the redraw() function doesn't seem to care for the inverted property.

Any help/suggestions/tips in the matter will be appreciated.

Thanks.

Upvotes: 5

Views: 932

Answers (2)

Matt Layman
Matt Layman

Reputation: 21

I faced a similar problem and was able to solve it using chart.update.

chart.update({chart: {inverted: true}});
chart.redraw();

http://api.highcharts.com/highcharts/Chart.update

Upvotes: 2

Rory McCrossan
Rory McCrossan

Reputation: 337550

Calling redraw() will only redraw data changes. Browsing the methods in the Highcharts API there does not appear to be a method which will change the inverted setting of an existing chart.

Your only option in this case is to destroy the existing chart and create a new one with the relevant chart.inverted setting.

Upvotes: 3

Related Questions