[Chartjs]-Chart JS not working with Phonegap

1๐Ÿ‘

โœ…

i could fix the issue =)
The issue was caused by setting the div

temp_graph_div.style.display = 'inherit';

after creating the chart.

Now, my code looks like this (no big change, but big success):

        var temp_graph_div = document.getElementById('temp_graph');
    temp_graph_div.style.display = 'inherit';

    var canvas = document.getElementById('myChart'),
        ctx = canvas.getContext('2d'),
        startingData = {
            labels: [tempValues[9][3], tempValues[8][3], tempValues[7][3], tempValues[6][3], tempValues[5][3], tempValues[4][3], tempValues[3][3], tempValues[2][3], tempValues[1][3], tempValues[0][3]],
            datasets: [{
                  label: 'ยฐC',
                  fill: false,
                  lineTension: 0.1,
                  backgroundColor: "rgba(255, 205, 200,0.4)",
                  borderColor: "rgba(255, 205, 200,1)",
                  borderCapStyle: 'butt',
                  borderDash: [],
                  borderDashOffset: 0.0,
                  borderJoinStyle: 'miter',
                  pointBorderColor: "rgba(75,192,192,1)",
                  pointBackgroundColor: "#fff",
                  pointBorderWidth: 1,
                  pointHoverRadius: 5,
                  pointHoverBackgroundColor: "rgba(75,192,192,1)",
                  pointHoverBorderColor: "rgba(220,220,220,1)",
                  pointHoverBorderWidth: 2,
                  pointRadius: 1,
                  pointHitRadius: 10,
                  responsive: true,
                  maintainAspectRatio: true,
                  data: [tempValues[9][6], tempValues[8][6], tempValues[7][6], tempValues[6][6], tempValues[5][6], tempValues[4][6], tempValues[3][6], tempValues[2][6], tempValues[1][6], tempValues[0][6]]
              }]
        };


    var myChart = new Chart(ctx, {
        type: 'line',
        data: startingData,
    });

Leave a comment