Home forums Using CanvasJS Multiple canvasjs charts in MVC partial views Reply To: Multiple canvasjs charts in MVC partial views

#20888

arbitus40
Member

thanks for your healp, i try in this way, but didnot work
<script>
window.onload = function () {

var chart= new CanvasJS.Chart(@Html.Raw(ViewBag.nombre), {
theme: “light1”, // “light1”, “light2”, “dark1”, “dark2”
exportEnabled: true,
animationEnabled: true,
title: {
text: “Analisis de Daños”
},
subtitles: [{
text: @Html.Raw(ViewBag.nombre)
}],
data: [{
type: “pie”,
startAngle: 180,
toolTipContent: “<b>{label}</b>: {y}%”,
showInLegend: “true”,
legendText: “{label}”,
indexLabel: “{label} – {y}%”,
dataPoints: @Html.Raw(ViewBag.DataPoints)
}]
});
chart.render();
}
</script>

<div id=@Html.Raw(ViewBag.nombre) style=”height: 300px; width: 100%;”></div>

still only show the last chart
please some help