Home Forums Chart Support Zero values in logarithmic mode draw off chart top?

# Zero values in logarithmic mode draw off chart top?

Viewing 2 posts - 1 through 2 (of 2 total)
• #28653

If you paste the following into the “try it” edit box, notice that any zero value renders as a # of the top of the chart.

The only solution I’ve found is to set all zeros to 1. Am I missing something or is this a bug?

CanvasJS.Chart(“chartContainer”,{
axisY: { logarithmic: true },
data: [{
type: “line”,
dataPoints: [{y:10},{y:0},{y:50},{y:65},{y:150},{y:400},{y:950},{y:4500},{y:10000}]
}] });

Thank you!
Michael

#28661

Michael,

A logarithmic axis can only plot positive values. There simply is no way to put negative values or zero on a logarithmic axis.

Fundamental: If 10L = Z, then L is the logarithm (base 10) of Z. If L is a negative value, then Z is a positive fraction less than 1.0. If L is zero, then Z equals 1.0. If L is greater than 0, then Z is greater than 1.0. Note that there no value of L will result in a value of Z that is zero or negative. Logarithms are simply not defined for zero or negative numbers.

Vishwas R
Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.