Home › Forums › Chart Support › Fix date on x-axis › Reply To: Fix date on x-axis
@ahadali791,
You can convert the x-values to labels and combine dataPoints with the same date using similar x-values. Please find the code snippet for the same below.
function setXValue(data) { var xValue = 0; for(var i = 0; i < data.length; i++) { if(data[i+1] && data[i].x.getTime() === data[i+1].x.getTime()) { data[i].label = data[i].x; data[i].x = xValue; } else { data[i].label = data[i].x; data[i].x = xValue; xValue++ } } return data }
Please take a look at this JSFiddle for a working example.
— Thangaraj Raman Team CanvasJS