How to place four split the screen into four and place a google chart in each division (html) -
i don't know html. have produce project on fly. need experts in forum. need place 3 line charts , 1 gauge chart google on 1 page, how write html code split screen 4 quarters place each chart. here html code 1 of line charts:
<html> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {'packages':['corechart']}); google.charts.setonloadcallback(drawchart); function drawchart() { var data = google.visualization.arraytodatatable([ ['year', 'sales', 'expenses'], ['2004', 1000, 400], ['2005', 1170, 460], ['2006', 660, 1120], ['2007', 1030, 540] ]); var options = { title: 'company performance', curvetype: 'function', legend: { position: 'bottom' } }; var chart = new google.visualization.linechart(document.getelementbyid('curve_chart')); chart.draw(data, options); } </script> </head> <body> <div id="curve_chart" style="width: 900px; height: 500px"></div> </body> </html> and here gauge chart html code:
<html> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {'packages':['gauge']}); google.charts.setonloadcallback(drawchart); function drawchart() { var data = google.visualization.arraytodatatable([ ['label', 'value'], ['memory', 80], ['cpu', 55] ]); var options = { width: 400, height: 120, redfrom: 90, redto: 100, yellowfrom:75, yellowto: 90, minorticks: 5 }; var chart = new google.visualization.gauge(document.getelementbyid('chart_div')); chart.draw(data, options); </script> </head> <body> <div id="chart_div" style="width: 400px; height: 120px;"></div> </body> </html>
basically, here's structure divide screen 4 parts
.wrapper > div { position:absolute; width:50vw; height:50vh; overflow:hidden; } #chart1 {top:0;left:0;} #chart2 {top:0;right:0;} #chart3 {bottom:0;left:0;} #chart4 {bottom:0;right:0;} <div class="wrapper"> <div id="chart1"></div> <div id="chart2"></div> <div id="chart3"></div> <div id="chart4"></div> </div> ofcourse have refresh charts once screen size changes
here online demo: https://jsfiddle.net/0cr5enak/
edit
well, stack vertically go setting height property 1/4 screen size each div: https://jsfiddle.net/0cr5enak/2/
Comments
Post a Comment