Ignore:
Timestamp:
06/21/05 15:01:45 (18 years ago)
Author:
bastiaans
Message:

toga/libtoga.php:

  • Only search jobs in 'F' state

toga/search.php:

  • Fixed form validation

web/addons/toga/graph.php:

  • Added x-grid determination for labels and such along x-axis
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/toga/graph.php

    r149 r152  
    329329//}
    330330
     331function determineXGrid( $p_start, $p_stop ) {
     332
     333        $period = intval( $p_stop - $p_start );
     334
     335        // Syntax: <minor_grid_lines_time_declr>:<major_grid_lines_time_declr>:<labels_time_declr>:<offset>:<format>
     336        //
     337        // Where each <*time_declr*> = <time_type>:<time_interval>
     338
     339        // Less than 1 minute
     340        if( $period < 60 )
     341
     342                $my_grid = "SECOND:5:SECOND:25:SECOND:25:0:%X";
     343
     344        // Less than 10 minutes
     345        else if( $period < 600 )
     346
     347                $my_grid = "SECOND:50:MINUTE:1:MINUTE:1:0:%X";
     348
     349        // Less than 1 hour
     350        else if( $period < 3600 )
     351
     352                $my_grid = "MINUTE:5:MINUTE:10:MINUTE:10:0:%X";
     353
     354        // Less than 1 day
     355        //
     356        else if( $period < 86400 )
     357
     358                $my_grid = "HOUR:1:HOUR:2:HOUR:2:0:%X";
     359
     360        // Less than 15 days
     361        //
     362        else if( $period < 1296000 )
     363
     364                $my_grid = "HOUR:30:DAY:1:DAY:1:0:%x";
     365               
     366        // Less than 30 days (a month)
     367        //
     368        elseif( $period < 2592000 )
     369
     370                $my_grid = "DAY:5:DAY:10:DAY:10:0:%x";
     371
     372        if( isset( $my_grid ) )
     373
     374                return "--x-grid $my_grid";
     375
     376        else
     377                return "";
     378}
     379
     380$xgrid = determineXGrid( $period_start, $period_stop );
     381
    331382#
    332383# Generate the rrdtool graph command.
     
    334385$command = RRDTOOL . " graph - --start $period_start --end $period_stop ".
    335386        "--width $width --height $height $upper_limit $lower_limit ".
    336         "--title '$title' $vertical_label $extras $background ".
     387        "--title '$title' $vertical_label $extras $background $xgrid ".
    337388        $series;
    338389
Note: See TracChangeset for help on using the changeset viewer.