Home Forums Chart Support php mysql array elements

php mysql array elements

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

    Hello, I am wondering if there is some way to display more array information than x and y on a chart.
    If I have array elements from a db table such as:

    
    $seqnum		= $row5[1];
    $currdate	= $row5[2];
    $prevdate	= $row5[3];
    $daysdiff	= $row5[4];
    $freq		= $row5[5];
    

    I created a chart using bar or column with points as
    $points = array( "label" => $seqnum, "x" => $seqnum, "y" => $daysdiff );

    Is there any way to add more of the elements to points or to the datapoints for information purposes?

    Thanks in advance.

    #36426

    @xmanhattan,

    You can pass the desired variables to $points as key value pairs to create an associative array as shown below –

    $points = array( "label" => $seqnum, "x" => $seqnum, "y" => $daysdiff, "currdate" => $currdate, "prevdate" => $prevdate, "freq" => $freq );

    The same variables would be available within the chart and can be accessed through the chart options –

    chart.options.data[0].dataPoints[0].freq

    ___________
    Indranil Singh Deo
    Team CanvasJS

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

You must be logged in to reply to this topic.