Home forums Using CanvasJS [Loop] How to get data from DB inside chart Reply To: [Loop] How to get data from DB inside chart

#27033
data: [
		
		{
		type: "column",
		name: "Class 1",
		showInLegend: true,      
		yValueFormatString: "#,##0.# Units",
		dataPoints: [
			{ label: "Math",  y: 5.0 },
		
		]
	},
	{
		type: "column",
		name: "Class 2",
		showInLegend: true,      
		yValueFormatString: "#,##0.# Units",
		dataPoints: [
			{ label: "Math",  y: 10 },
	
		]
	},
	
	
	{
		type: "column",
		name: "Class 3",
		
		showInLegend: true,
		yValueFormatString: "#,##0.# Units",
		dataPoints: [
			{ label: "Math",  y: 10 },
		
		]
	},
	
	{
		type: "column",
		name: "Class 1",
		
		showInLegend: true,
		yValueFormatString: "#,##0.# Units",
		dataPoints: [
			{ label: "Math",  y: 0 },
			{ label: "Geography", y: 5 },
		
		]
	}]

I have 2 problems:

How can I show dynamycally when A course was created, when a class (with the number of students) updated and so on…?
How can I show the second course , thirty…, for the right way? Because the chart always need the first one to keep orderly