Home Forums Chart Support something wrong on my chart

something wrong on my chart

Viewing 2 posts - 1 through 2 (of 2 total)
  • #22030

    hello, i have a problem here. there is something wrong with my chart.
    here is the result Result
    please help me
    window.onload = function()
    {
    var dataPoints = [];
    var dataPoints2 = [];
    var chart2;

    chart2 = new CanvasJS.Chart(“Temp”,{
    animationEnabled: true,
    title:{
    text:”Temp”
    },
    exportFileName: “Temp 17 June 2018”,
    exportEnabled: true,
    axisY:
    {
    includeZero: false,
    title: “Temp (C)”,
    suffix: ” C”
    },

    axisX:
    {
    includeZero: false,
    valueFormatString: “YYYY-MM-DD HH:mm:ss”,
    title: “Time”
    },
    legend:
    {
    cursor:”pointer”,
    fontSize: 22,
    fontColor: “dimGrey”,
    },
    data:
    [{
    name: “S 1”,
    type: “line”,
    dataPoints : dataPoints,
    },
    {
    name: “S 2”,
    type: “line”,
    dataPoints : dataPoints2,

    }]
    });

    function getData() {
    $.getJSON(“../menu/g.php”, function(data) {

    for(var i = 0; i < data.length; i++){
    dataPoints.push({
    x: new Date(data[i].Time),
    y: data[i].Temp1
    });
    dataPoints2.push({
    x: new Date(data[i].Time),
    y: data[i].Temp2
    });
    }
    });
    }

    setInterval(function(){
    getData();
    chart2.render();
    chart.render();
    if (datapoints.length > 5){
    datapoints.shift();
    datapoints2.shift();
    }
    }, 1000);
    }

    #22034

    @khennaa,

    Can you kindly create and share a jsfiddle(with sample data) reproducing your issue, so that we can understand your scenario better and help you out?

    __
    Priyanka M S
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.