Alternative maths – plotting negative values on a logarithmic axis.

by

  @TorsteinHonsi


HighchartsLine chart0 comments

Strictly speaking, a logarithmic scale can't plot negative values, for the simple reason that it is not mathematically correct.

Math.log(1) => 0;
Math.log(0.1) => -2.3025850929940455;
Math.log(0) => -Infinity;
Math.log(-1) => NaN;

But in the real world, there are cases where we want to combine the pros of a log axis with zero or negative values, so in the next Highcharts version we have provided hooks for adding custom conversion functions.

Do you have some code you want to share with the world as well? Go here to learn how you may contribute some helpful code of your own.

Consent for marketing cookies needs to be given to post comments