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

116
Views
Firestore with chart.js window onload

I want to see my firestore field on loading but it passed as 1 value with 2 params.

I dont know how to solve this plz help :)

[firestore] : https://i.stack.imgur.com/Vhww8.png

[chart + some console.log] : https://i.stack.imgur.com/yY1o6.png

var dataArray = [];
    const pH = {};
    async function GetDocument() {
        var ref = doc(db,"pHvalue", "pH");
        const docSnap = await getDoc(ref);
    
         if(docSnap.exists()){
             pH.value = docSnap.data().pH;
             dataArray.value = dataArray.push(pH.value); 
             console.log(pH);   
             console.log(pH.value);   
             console.log(dataArray); 
        };
    
    Chart.defaults.font.size = 20;
    Chart.defaults.font.color = '#000';
    const ctx = document.getElementById('myChartpH').getContext('2d');

    const myChart = new Chart(ctx, {
        type: 'line',
        data: {
            labels: ['pH'],
            datasets: [{
                label: 'pH value',
                data: dataArray,
                fill: true,
                backgroundColor: 'rgb(120, 16, 126)',
                borderWidth: 1,
        pointStyle: 'circle',
        pointRadius: 5,
        pointBackgroundColor: "yellow",
        pointBorderColor: 'rgb(0, 0, 0)'
            }]
        },
        options: {            
                scales: {
                    y: {
                    beginAtZero: true,
                        }      
                }
            },
        });

    }
        window.onload = GetDocument;
about 4 years ago · Juan Pablo Isaza
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!