I have an HTML object in a subform to display a gauge chart. Within the subform, I also have a field called ind_rango, where any value can be entered to be displayed with the image. I can do this process in a normal form without any problems, but when I try to do it within a subform, it doesn't work. The question I have about this is how I should express the variable: var ir so that the value entered can be displayed in the HTML object. The code I use is the following:
Code: Select all
<!DOCTYPE html>
<html>
<head>
<title>Indicador</title>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
var ir = parseFloat(nuSubformRowObject(event.target.id, 'ind_rango').val());
google.charts.load('current', {
'packages': ['gauge']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Label', 'Value'],
['%', ri]
]);
var options = {
width: 400,
height: 200,
max: 120,
redFrom: 0,
redTo: $r1,
yellowFrom: $r1,
yellowTo: 70,
greenFrom: 70,
greenTo: 100,
blueFrom: 100,
blueTo: 120,
yellowColor: "#FFFF93",
redColor: "#FF3300",
greenColor: "#99FF33",
minorTicks: 5,
titleTextStyle: {
fontSize: 4
}
};
var chart = new google.visualization.Gauge(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<h1>"% decrease"</h1>
<style>
h1 {
font-size: 12px;
}
</style>
<div id="chart_div" style="width: 400px; height: 200px;"></div>
</body>
</html>