Home forums Using CanvasJS How to populate data from PHP, MYSQL to Multi Series Line Graph

This topic contains 1 reply, has 2 voices, and was last updated by  Sanjoy 1 year ago.

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


    Hi Sunil,
    based on my JSON data from MySQL below: how can i display into in multi series line charts.
    – The report_date will be in x axis
    – submited,pending,approved,declined will be displayed in four different lines.
    – each labels will be display on each line.


    When i do below, i only get one line. which is only ‘submitted’ line.

    $result= getReportStatistic($startDate,$endDate);
         $data_points = array();
            foreach($result as $row){
                $point = array(“label”=>$row[‘report_date’],”y”=>$row[‘submited’]);
                array_push($data_points, $point);
    echo json_encode($data$data_points, JSON_NUMERIC_CHECK);


    success: function(data){
            var result = $.parseJSON(data);
            var columnchart = new CanvasJS.Chart(“chartContainer”, {
                      text: “Overall report statistic”
                     gridColor: “Silver”,
                     tickColor: “silver”,
                     valueFormatString: “DD/MMM”
                 data: result

    Really Appreciated for your help.
    Best Regards,
    Elvis Ximenes



    Hi Elvisximenes,

    You can format your json data across multiple series as shown in this example

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

You must be logged in to reply to this topic.