Home forums Using CanvasJS Multiple Charts with unknown count Reply To: Multiple Charts with unknown count

#24672

If it helps this is the javascript for the chart I want multiple of…

var chart = new CanvasJS.Chart(“BudgetGoal”, {
animationEnabled: true,
backgroundColor: “#F0F0F0″,
//height of bar (eliminates whitespace)
height: 100,
//width of bar
dataPointWidth: 30,
axisX: {
//hide axis label (need both of these)
tickLength: 0,
labelFormatter: function(){
return ” “;
}
},
axisY: {
prefix: “$”,
//sets budget goal max
lineThickness: 0,
maximum: 200 <== variable that will differ
},
toolTip: {
shared: true
},
legend:{
cursor: “pointer”,
itemclick: toggleDataSeries
},
data: [{
type: “stackedBar”,
name: “Spent”,
yValueFormatString: “$#,##0″,
color:”red”,
dataPoints: [
{ label: “Shopping (3/15/18 – 4/15/18)”, y: 90 } <== variables that will differ
]
},
{
type: “stackedBar”,
name: “Money left”,
//showInLegend: “true”,
//xValueFormatString: “DD, MMM”,
yValueFormatString: “$#,##0″,
color:”#808080”,
dataPoints: [
{ label: “Shopping (3/15/18 – 4/15/18)”, y: 110 } <== variables that will differ
]
},
]
});
chart.render();

and here is the div tag in the html
<div id=”BudgetGoal” style=”height: 100px; width: 100%;”></div>

  • This reply was modified 1 month, 1 week ago by  dillonw777.