How to load dynamic canvas chart using asp.net data?
Below is jquery code.
var chart = new CanvasJS.Chart("graph1", {
title: {
text: "Cash Flow"
},
axisX: {
valueFormatString: "MMM YYYY"
},
axisY2: {
title: "Median List Price",
prefix: "$",
suffix: "K"
},
toolTip: {
shared: true
},
legend: {
cursor: "pointer",
verticalAlign: "top",
horizontalAlign: "center",
dockInsidePlotArea: true,
itemclick: toogleDataSeries
},
data: [{
type: "line",
axisYType: "secondary",
name: "Income",
showInLegend: true,
markerSize: 0,
yValueFormatString: "$#,###k",
dataPoints: [
{ x: new Date(2016, 00, 01), y: 995 },
{ x: new Date(2016, 01, 01), y: 1090 },
{ x: new Date(2016, 02, 01), y: 1100 },
{ x: new Date(2016, 03, 01), y: 1150 },
{ x: new Date(2016, 04, 01), y: 1150 },
{ x: new Date(2016, 05, 01), y: 1150 },
{ x: new Date(2016, 07, 01), y: 1100 },
{ x: new Date(2016, 08, 01), y: 1150 },
{ x: new Date(2016, 09, 01), y: 1170 },
{ x: new Date(2016, 10, 01), y: 1150 },
{ x: new Date(2016, 11, 01), y: 1150 }
]
},
{
type: "line",
axisYType: "secondary",
name: "Expense",
showInLegend: true,
markerSize: 0,
yValueFormatString: "$#,###k",
dataPoints: [
{ x: new Date(2016, 00, 01), y: 2000 },
{ x: new Date(2016, 01, 01), y: 1920 },
{ x: new Date(2016, 02, 01), y: 1750 },
{ x: new Date(2016, 03, 01), y: 1850 },
{ x: new Date(2016, 04, 01), y: 1750 },
{ x: new Date(2016, 05, 01), y: 1730 },
{ x: new Date(2016, 06, 01), y: 1700 },
{ x: new Date(2016, 07, 01), y: 1730 },
{ x: new Date(2016, 08, 01), y: 1720 },
{ x: new Date(2016, 09, 01), y: 1740 },
{ x: new Date(2016, 10, 01), y: 1750 },
{ x: new Date(2016, 11, 01), y: 1750 }
]
}]
});
chart.render();