Home › Forums › StockChart Support › Showing date in milliseconds for x-axis even if I pass date in correct format › Reply To: Showing date in milliseconds for x-axis even if I pass date in correct format
@vsingh,
In case there are no dataPoints to be rendered, you can add a dummy dataPoint by setting the x-value as axis-x minimum and y-value as 0 to achieve your requirement. Please find the code snippet for the same below.
function checkIfNoDataPoints() { for(var i = 0; i < chart.options.data.length; i++) { if(chart.options.data[i].dataPoints.length == 0) { chart.options.data[i].dataPoints.push({x:chart.axisX[0].get("minimum"), y:0, color: "transparent", toolTipContent: null, indexLabel: " "}) } } chart.render(); }
Please take a look at this JSFiddle for a working example
— Thangaraj Raman Team CanvasJS