Home Forums Chart Support number after the decimal point Reply To: number after the decimal point

#44099

Thanks for your help but it doesn’t work.

Link graph

Here is my code:

window.onload = function () {
	var chart = new CanvasJS.Chart("chartContainer",
	{ backgroundColor: "#D5DBDB",
 interactivityEnabled: false,	 
	 zoomEnabled: false,
      zoomType: "x",
      title:{
        text: "Graphique vent "
      },
		title:{
			text:"Graphique Vent",
		},
		axisX: {
		labelAutoFit: true,				
        interval: 50,
		title: "",
		crosshair: {
        enabled: false
      }
	},
	axisY: {
		valueFormatString: "#0.0",		
		title: "Km/h",
		 interval: 0.1,
	},

		data: [{
			type: "spline",
 color: "red",
			dataPoints : [],
		},
		]
	});

	function updateChart() {
		$.getJSON("service2.php", function(data) {		
			chart.options.data[0].dataPoints = [];
			$.each((data), function(key, value){
			
				chart.options.data[0].dataPoints.push({label: value[0], y: parseInt(value[1])
				})
				if (chart.options.data[0].dataPoints.length > 350 ) {
   chart.options.data[0].dataPoints.shift();
 };					
			});	

			chart.render();
			
			updateChart();
		});
	}

	setInterval(function(){updateChart()}, 2000);
		 
}