Forum Replies Created by arbitus40

Viewing 2 posts - 1 through 2 (of 2 total)
  • in reply to: Multiple canvasjs charts in MVC partial views #20888

    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

    in reply to: Multiple canvasjs charts in MVC partial views #20791

    i have the same problem.
    this my partial view

    <script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
        <script>        
            window.onload = function () {           
    var chart= new CanvasJS.Chart("chart", {
        theme: "light1", // "light1", "light2", "dark1", "dark2"
        exportEnabled: true,
    	animationEnabled: true,
    	title: {
    		text: "Analisis de Daños"
    	},
    	subtitles: [{
    		text: "Vandrservices"
    	}],
    	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="chart" style="height: 300px; width: 100%;"></div>

    and i used in a a index page to create many chart, but only show the last one, i am working with mvc.

Viewing 2 posts - 1 through 2 (of 2 total)