Ad Widget

Collapse

Patch for more readable graph dates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kmradke
    Member
    • Aug 2009
    • 33

    #1

    Patch for more readable graph dates

    Not being accustomed to the european date format used in the graphs, I created this little patch to include weekday names and abbreviated month names in graphs. Instead of "16.02" this would use "Tue 16 Feb".

    This probably should be configurable, but it was easiest to just change the hardcoded format in include/classes/class.cchart.php:

    Click image for larger version

Name:	chart.php.jpg
Views:	1
Size:	37.0 KB
ID:	315334

    diff class.cchart.php.orig class.cchart.php
    Code:
    1146c1146
    <                       else if($interval > 86400) $date_format = 'd.m';
    ---
    >                       else if($interval > 86400) $date_format = 'D d M';
    1164c1164
    <               $str = date('d.m H:i',$this->stime);
    ---
    >               $str = date('D d M H:i',$this->stime);
    1178c1178
    <               $str = date('d.m H:i',$endtime);
    ---
    >               $str = date('D d M H:i',$endtime);
    1193,1194c1193,1194
    <                       if(date('Hi', $new_time) == 0) $date_format = 'd.m';
    <                       else $date_format = 'd.m H:i';
    ---
    >                       if(date('Hi', $new_time) == 0) $date_format = 'D d M';
    >                       else $date_format = 'D d M H:i';
    Last edited by kmradke; 16-02-2010, 22:17. Reason: diff in other direction
  • tchjts1
    Senior Member
    • May 2008
    • 1605

    #2
    Excellent idea. The European format is throwing off my users as well.

    I think your patch works well on simple graphs that only have one item, but when you look at compound graphs with 2 or more items in it, the date extends down into the metrics text.
    Attached Files

    Comment

    • zabbix_zen
      Senior Member
      • Jul 2009
      • 426

      #3
      Hi.

      Even with the overlapping issue it should be sugested to Zabbix DEV team.
      They'll decide if it should be incorporated as is or with some modification.

      Please file a request on,

      Comment

      • kmradke
        Member
        • Aug 2009
        • 33

        #4
        The overlap seemed hit and miss. I have some graphs with a larger number of items that do not overlap. I'm sure that could easily be remedied with a more complex patch. I'll go ahead and add it as a feature request https://support.zabbix.com/browse/ZBXNEXT-255 .
        Last edited by kmradke; 24-02-2010, 21:59. Reason: Add feature request id

        Comment

        • tchjts1
          Senior Member
          • May 2008
          • 1605

          #5
          I've also pointed it out to Alexei. Sounded like he liked it and was open to implementing it at some point.

          Comment

          Working...