Axis Labels



    PLOT
        AXISLABELS
      WITH
        NO SIDES
        NO YAXIS
    SELECT
        year from CPI limit 50;

Use AXISLABELS to assign a column for axis labels.

When there are many labels, Entrance will automatically eliminate some. You can change this default behavior using ALL AXISLABELS to show all of them, or ONLY (n) AXISLABELS to show just the number you specify.


        ONLY 2 AXISLABELS



        ALL AXISLABELS



        ONLY 7 AXISLABELS

You can use ALL AXISLABELS to disable automatic filtering, and then use MySQL IF() to filter for some criteria. When IF() returns null or the empty string, Entrance displays neither a label nor a tick. This example uses the trick to show labels for the 1st and 15th of each month:

    PLOT
        ALL AXISLABELS, BAR
    SELECT
        IF(DAY(dtime) = 1 OR DAY(dtime) = 15,
        CONCAT(MONTH(dtime), '-', DAY(dtime)),''),

        COUNT(DISTINCT ip)
    FROM ACCESS_HISTORY
    WHERE dtime >= '2009-01-01'
    GROUP BY CONCAT(MONTH(dtime), '-', DAY(dtime))
    ORDER BY dtime;

Use a string containing a single blank to draw an unlabeled tick mark, eg. replacing the IF() above with this:

    IF(DAY(dtime) = 1 OR DAY(dtime) = 15,' ', ''

we get:

.

Comments are closed.