Home forums Using CanvasJS how do i achieve displaying graphs by weeks based on date?

This topic contains 1 reply, has 2 voices, and was last updated by  Shashi Ranjan 8 months, 2 weeks ago.

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

    // query para sa year of enrollment
    $res = $conn->query(“SELECT *, SUM(visitor_price) FROM visitors GROUP BY year”) or die(mysqli_error());
    $data_points = array();
    while($result = $res->fetch_array()){
    $R = $result[‘year’];
    $q1 = $conn->query(“SELECT *, SUM(visitor_price) as total FROM visitors WHERE year = ‘$R’ group by year”) or die(mysqli_error());
    $f1 = $q1->fetch_array();
    $FR = intval($f1[‘total’]);$R = $result[‘year’];
    $point = array(‘label’ => $R, ‘y’ => $FR);
    array_push($data_points, $point);
    }
    json_encode($data_points);

    this is my query by year and I would like to know by Weeks

    #24555

    @jfranco30,

    CanvasJS just renders charts based on the data that you pass in the chart-options. You can modify your MySQL query to get data based on weeks and pass it to chart to show weekly data.

    ____
    Shashi Ranjan
    Team CanvasJS

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

You must be logged in to reply to this topic.