I am trying to print the bottom label of Google sensors on the outside (just below the corresponding sensors). In addition, I want to provide two different suffixes for two sensors. I tried to provide separate formatting (formatter1, formatter2) for both and separate data (data1 and data2), but did not even draw gauges (without errors). In this case, draw_data_guage will have a fourth argument.
var e = document.getElementById('draw_chart'); e.onclick = draw_data_gauge(80, 68, '%'); function draw_data_gauge(cpu_data, memory_data, suffix) { console.log("in guage") google.charts.load('current', { 'packages': ['gauge'] }); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data1 = google.visualization.arrayToDataTable([ ['Label', 'Value'], ['CPU', cpu_data], ['Memory', memory_data], ]); var options = { width: 500, height: 150, redFrom: 90, redTo: 100, yellowFrom: 75, yellowTo: 90, minorTicks: 5, }; var formatter1 = new google.visualization.NumberFormat({ suffix: suffix, }); formatter1.format(data1, 1); var chart = new google.visualization.Gauge(document.getElementById('chart_div')); chart.draw(data1, options); } }
<script src="https://www.gstatic.com/charts/loader.js"></script> <input name="Button" type="button" value="Draw" id="draw_chart" /> <div id="chart_div"></div>
I want the bottom label of the sensor to be displayed outside and able to give separate suffixes for both sensors. Consider the jsfiddle link. I want to display percentages (bottom label) outside the sensors just below them. My jsfiddle link is here . Thanks in advance.
source share