0

Firebase Realtime database: I want to take random data from the Firebase realtime database like the picture in this link (https://drive.google.com/file/d/1ZqEugWRN03ddaN59nFqIbw0NSCpDNGaJ/view?usp=sharing) and immediately pour it into the graphics Highcharts, I am confused by the programming code in javascript. is my code correct?

const numbers = 2000;
const randomIndex = Math.floor(Math.random() * numberOfUsers);
var FireBase2 = firebase.database().ref('Perangkat2/hujan_menit/1/hujanpermenit');
var result2; //humidity variable
var snap = Firebase2.limitToFirst(randomIndex).limitToLast(1).once('value').then(datasnapshot =>{         
result2 = parseFloat(datasnapshot.val())
};
FireBase2.on("value", snap)
Highcharts.setOptions({
    global: {
        useUTC: false
    }
});
  • what code are you confused by? – jtate Feb 18 '19 at 03:46
  • javascript, to retrieve random data from firebase realtime database to highcharts – sri dewi sartika Feb 18 '19 at 08:36
  • clik this link for the picture : https://drive.google.com/file/d/1ZqEugWRN03ddaN59nFqIbw0NSCpDNGaJ/view?usp=sharing – sri dewi sartika Feb 18 '19 at 09:15
  • Hi sri dewi sartika, Here you can find a helpful topic related with random data from Firebase: https://stackoverflow.com/questions/45145596/get-random-item-from-firebase Please provide me with a sample received data if you have a problem with adding the data to the Highcharts chart. – ppotaczek Feb 21 '19 at 11:08
  • i have problem with Highcharts chart, is my code correct? click this link to see the picture : https://drive.google.com/file/d/1SO2s5ScNrT0NYyUl0FoP71wJccxsG2oT/view?usp=sharing – sri dewi sartika Feb 27 '19 at 06:17

0 Answers0