Home forums Using CanvasJS Problem with axis and null value

This topic contains 1 reply, has 1 voice, and was last updated by  zEro 6 months, 1 week ago.

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

    zEro
    Member

    Hello, I have a problem with my axisX :

    I do this:`axisX:{
    suffix: “h”,
    minimum: -1,
    maximum: 24
    },`

    And I use a query for the data points :

    echo 'dataPoints: [',"\n";
     while ($row = mysqli_fetch_array($query)){
             $statut=$row['AVG(statut)'];
             $heure=$row['heure'];
             echo '{label:'.$heure.',y:'.$statut.'},';
             echo "\n";
        }
      echo ' ]',"\n";

    I want the $statut for every hour of one day, so 24 values. But sometimes in my database, there is no hours in the middle of the day, I want to write a value of 0 for those hours which are not in the database. So I need an axis with 24 graduations and some blanks where there is no value.

    Now I’ve got an axis with the hours of the days where $statut is not null. So there is not 24 graduations. And the axis put the value of my data and it get back to 0 after, its like this:

    1h-8h-16h-22h-8h-10h-12h-14h-16h-18h-20h-22h-24h

    Maybe it will be clear with pictures but I didn’t find how to import screenshots here.

    Thanks and sorry for my english.

    #11038

    zEro
    Member

    Finally I find my problem.

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

You must be logged in to reply to this topic.