how to visualize data from firebase into google chart ?

1,177 views
Skip to first unread message

ade guntoro

unread,
Jun 4, 2017, 2:49:19 PM6/4/17
to Firebase Google Group
sorry for my bad english.
so, i got source code from Nuke66[1]: https://github.com/nuke66/IoT-demo.
he use firebase and google chart "gauge" to visualize his data. but when i try to implement with another google chart, my browser not show anything.
this is his code <br>
`var config = {
    };
            firebase.initializeApp(config);
            firebase.database().ref('sensor').on('value', function(data) {
                var sensor = data.val();
                mydata.setValue(0, 1, sensor.suhu);
                chart.draw(mydata, myoptions);
            });`<br>
and his "gauge" chart <br>

    google.charts.load('current', {'packages':['gauge']});
            google.charts.setOnLoadCallback(drawChart);
            function drawChart() {
                mydata = google.visualization.arrayToDataTable([
                    ['Label', 'Value'],
                    ['Temp' , 0]
                ]);
                myoptions           = {
                    width           : 300,
                    height          : 300,
                    max             : 100,
                    min             : -10,
                    minorTicks      : 5,
                    majorTicks      : ['-10','-5','0','10','20','30','40','50','60','70','80','90','100']};
                chart               = new google.visualization.Gauge(document.getElementById('line'));
                chart.draw(mydata, myoptions);
            }
how to implement into bar chart ?line or the others

Reply all
Reply to author
Forward
0 new messages