Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
Cómo omitir valores base de datos en tiempo real firebase

Estoy revisando las últimas 100000 medidas de humedad y haciendo un gráfico, pero en el gráfico quiero mostrar cada 100 medidas, ¿cómo puedo modificar este código para hacer esto?

 firebase.database().ref("Humidity").ref.orderByChild("time").limitToLast(100000).on("child_added",snapshot => { var a = snapshot.val().wartosc; var b = (new Date(snapshot.val().time *1000)).toLocaleString("pl-PL"); addData(myChart, b, a);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Esto debería funcionar:

 firebase.database().ref("Humidity") // 👈 Remove the extra ref here .orderByChild("time") .limitToLast(100000) .on("value", snapshot => { // 👈 use value instead of child_added let index = 0; snapshot.forEach((child) => { if (index++ % 1000 === 0) { // 👈 check for every 1000th child var a = child.val().wartosc; var b = (new Date(child.val().time * 1000)).toLocaleString("pl-PL"); } addData(myChart, b, a); }) })

He marcado los cambios principales, pero es posible que también se necesiten algunos cambios más pequeños.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!