Search the Community
Showing results for tags 'select changed'.
-
In the code below I need to select an item in the "select" the graphic is rendered, how could implement this? @using (Html.BeginForm()){ @Html.AntiForgeryToken() @Html.ValidationSummary(true)<select id="animais" name="cod_animal" class="form-control"></select><script type="text/javascript"> //google.load('visualization', '1.1', { 'packages': ['corechart'] }); //google.setOnLoadCallback(drawChart); function drawChart() { var frm = document.getElementById('#animais'); var animais = frm.options[frm.selectedIndex].value; var url = '/Programa_Nutricao/Avaliacao/EvolucaoPeso/' + animais; $.get(url, {}, function (data) { var tdata = new google.visualization.DataTable(); tdata.addColumn('date', 'data_semanal'); tdata.addColumn('number', 'peso_kg'); for (var i = 0; i < data.length; i++) { if (data[i].data_semanal != null) tdata.addRow([ToJavaScriptDate(data[i].data_semanal), parseFloat(data[i].peso_kg)]); } var options = { title: 'Evolução do peso corporal', width: 700, height: 500, vAxis: { title: "PESO (kg)", minValue: 1, maxValue: 6 }, hAxis: { title: "DATA", textStyle: { fontSize: 10 } }, legend: { position: "none" } }; var chart = new google.visualization.LineChart(document.getElementById('EvolucaoPeso')); chart.draw(tdata, options); }); }</script> <div id="EvolucaoPeso" style="width: 900px; height: 500px;"></div>