Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HighCharts: Logarithmic scale

Tags:

highcharts

I am using logarithmic axes on HighCharts and sometimes the chart will not render due to issues such as negative or 0 values which is totally understandable but it also fails if the axis label happens to be 0 or less as well. My question is: is there a way to capture or detect this issue during rendering so that I can dynamically change to linear axes as a fallback and render a message to notify the user why it failed?

Here is an example of a failed curve rendering due to a 0 label on the x-axis:

http://jsfiddle.net/axl163/Eqc5G/1/

Here are some more details on the HighCharts error:

http://www.highcharts.com/errors/10

I would appreciate any suggestions.

Thanks!

like image 747
Allen Liu Avatar asked Apr 14 '26 18:04

Allen Liu


2 Answers

in your series add pointStart:1 and it should work. example:

    series: [{            
        data: [0.001,1,1.2,1.4, 2,30],
        pointStart: 1
    }]
like image 72
codeBarer Avatar answered Apr 16 '26 07:04

codeBarer


I addressed this issue by checking the values that go into HighCharts and if there are unacceptable values, the axes will automatically be changed to linear.

like image 40
Allen Liu Avatar answered Apr 16 '26 08:04

Allen Liu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!