0
Hello, I’m making a program to generate graphics and started to appear this error in some, but the strange thing is, the graphics are generated from some selected checkbox, so when you select a certain amount of checkbox from right, another amount from wrong, someone would know to tell me what causes this to try to fix this mistake?
Generate the Graphics:
for (int j = 0; j < @Model.pdisAno.Count; j++)
{
<script type="text/javascript">
google.charts.load('current', { 'packages': ['bar'] });
var teste = "teste" + @j
google.charts.setOnLoadCallback(teste)
function teste() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Ano');
data.addColumn('number', 'Quantidade de Operadores');
@for (int i = 0; i < @Model.AnosPdi[j].Count; i++)
{
@: data.addRow(['@Model.AnosPdi[j][i]',@Model.conAnos[j][i]]);
}
var options = {
chart: {
title: '@Model.pdisAno[j]',
subtitle: 'Quantidade de Operarios por ano'
},
chartArea: { width: '100%', height: '50%' }
};
var chart = new google.charts.Bar(document.getElementById('columnchart_material' + '@j'));
chart.draw(data, google.charts.Bar.convertOptions(options));
}
</script>
}
This part to generate the Divs and show the Graphics:
for (int i = 0; i < @Model.pdisAno.Count; i = i + 3)
{
string nome1 = "columnchart_material" + i;
string nome2 = "columnchart_material" + (i + 1);
string nome3 = "columnchart_material" + (i + 2);
<table style="width:100%">
<tr>
<td style="width:30%">
<div id="@nome1" style="height:250px;"></div>
</td>
<td style="width:30%">
<div id="@nome2" style="height:250px;"></div>
</td>
<td style="width:30%">
<div id="@nome3" style="height:250px;"></div>
</td>
</tr>
</table>
<br />
}
Could put the code?
– Cassio Alves
I put, apparently what’s causing the error is this part of the code, I need to generate these graphs dynamically, I tried to do so but it’s giving this error
– Carlos Eduardo
Shows the line giving the error in the console?
– Cassio Alves
No, the error is shown where you should show the chart
– Carlos Eduardo
Thanks for your help ^^
– Carlos Eduardo