Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • in reply to: PHP dynamic graph interval update #28469

    Hi! The way to update the graph is to get the updated JSON array from php. The example code generates the x and y values whereas mine is retrieved from php.
    Take a look at my code, especially the updating function. It doesn’t work and I dont think its the right way to write a javascript code. Not sure if javascript works the same as python, c, c++, etc.

    in reply to: using json array from php json_encode #28434

    @ShashiRanjan, thanks for your help! I will look through your sample code when my workload lightens. Thanks once again

    in reply to: using json array from php json_encode #28325

    I have placed all relevant files in this folder: folder

    My objectives:
    – plot only the latest 50 data points
    – x axis will be Date value
    – y axis will be sensor value
    – update the graph every 5 seconds and only showing 50 data points

    in reply to: using json array from php json_encode #28324

    i cant seem to be able to upload my php codes. i keep getting blocked.

    in reply to: using json array from php json_encode #28323

    Using https://canvasjs.com/php-charts/dynamic-live-multi-series-chart/ as reference, this is what i came up with:
    This is my JSON array:
    [{“ID”:6,”Date”:”2020-01-24 07:35:46″,”sensorName”:”sensor 1″,”sensorValue”:213},{“ID”:7,”Date”:”2020-01-24 07:35:46″,”sensorName”:”sensor 1″,”sensorValue”:433},{“ID”:8,”Date”:”2020-01-24 07:35:46″,”sensorName”:”sensor 2″,”sensorValue”:45},{“ID”:9,”Date”:”2020-01-24 07:35:46″,”sensorName”:”sensor 3″,”sensorValue”:54}]

    Im not sure how to retrieve data (Date, sensorName, sensorValue) from the JSON array.
    For the graph, the x-axis will be the Date value from the JSON array. the y-axis will have values from the sensorValue. the graph should only show the latest 50 data points from the JSON array. the graph updates every 2 secs.

    in reply to: using json array from php json_encode #28277

    I just do not know how to start using CanvasJS. I have a json array but i do not know how to integrate it with canvasJS. A point in the right direction would be extremely helpful. I have looked at the examples on canvasJS but i still do not know how to proceed.

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