Home › Forums › Chart Support › StripLines for every 5 minutes › Reply To: StripLines for every 5 minutes
@blazg,
You can render stripLines on x-axis for every 5 minutes in a dynamic chart with a few extra lines of code as shown in the code snippet below:
function updateChart() { var deltaY ; time.setTime(time.getTime()+60*updateInterval); deltaY = 0.5 + Math.random() *(-0.5-0.5); yValue = Math.round((yValue + deltaY)*100)/100; dataPoints.push({ x: time.getTime(), y: yValue }); if(stripLineCounter%5 == 0) { stripLineArray.push({value:time.getTime(), label: CanvasJS.formatDate(time.getTime(), "hh:mm")}); } stripLineCounter++; if (dataPoints.length > 100 ) { dataPoints.shift(); } chart.render(); setTimeout(updateChart, updateInterval); } updateChart(); }
Please check this JSFiddle for a working example.
— Thangaraj Raman Team CanvasJS