JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<br/><!-- Just so that JSFiddle's Result label doesn't overlap the Chart -->
<div id="chartContainer" style="height: 360px; width: 100%;"></div>
JavaScript
var minValue = 0.1;
var chart = new CanvasJS.Chart("chartContainer", {
title:{
text: "Basic Column Chart"
},
axisY:{
logarithmic: true //change it to false
},
data: [{
dataPoints: [
{ x: 10, y: 0 },
{ x: 20, y: 0},
{ x: 30, y: 50 }
]
}]
});
parseZeroValue();
chart.render();
function parseZeroValue() {
var data = chart.options.data;
for(var i = 0; i < data.length; i++) {
for(var j =0; j < data[i].dataPoints.length; j++) {
var yValue = data[i].dataPoints[j].y;
if(yValue === 0) {
data[i].dataPoints[j].y = null; //Set this to some value like 0.01, if you like to show column
data[i].dataPoints[j].toolTipContent = ("{x}: " + yValue);
}
}
}
}