Ad Widget

Collapse

PATCH: graph font scaling and graph title misalignment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krimson
    Member
    • Sep 2008
    • 49

    #1

    PATCH: graph font scaling and graph title misalignment

    This patch fixes a few things in Zabbix 1.8 (& trunk)

    * misaligned graph title on smaller graphs (title was not centered) [ZBX-1320]
    * for smaller graphs, the font sizes were not scaled accordingly, causing text to fall off
    * Y axis type is displayed vertically to save space
    * less "whitespace" on small graphs to make them more compact

    I have attached two examples of how it looks now. Patch can be applied to Zabbix trunk (and possibly to 1.8, not tested).

    UPDATED: Also attached a patch for Zabbix 2.0.3.
    Attached Files
    Last edited by krimson; 21-11-2012, 17:30.
  • Palmertree
    Senior Member
    • Sep 2005
    • 746

    #2
    Krimson, nice patch. It works great against the latest 1.8 trunk 9330. Thanks for sharing this.

    Comment

    • dotneft
      Senior Member
      • Nov 2008
      • 699

      #3
      exellent patch, thanks. But thise patch not resize triggers text((
      Attached Files

      Comment

      • Palmertree
        Senior Member
        • Sep 2005
        • 746

        #4
        Fixed the triggers by modifying the same file at the following lines:

        Code:
        @@ -1505,7 +1507,7 @@
                                );
                        $legend->color = $this->getColor($this->graphtheme['textcolor'], 0);
                        $legend->rowheight = 14;
        -               $legend->fontsize = 9;
        +               $legend->fontsize = $this->baseFontSize+1;
        
         // Draw percentile
                        if($this->type == GRAPH_TYPE_NORMAL){
        @@ -1558,7 +1560,7 @@
                                );
                        $legend->color = $this->getColor($this->graphtheme['textcolor'], 0);
                        $legend->rowheight = 14;
        -               $legend->fontsize = 9;
        +               $legend->fontsize = $this->baseFontSize+1;
        
         // Draw triggers
         //SDII($this->triggers);

        Comment

        • Firm
          Senior Member
          • Dec 2009
          • 342

          #5
          Confirmed patch working even with initial 1.8 release.

          P.S. Krimson, would you be so kind to fix this issue too? On attached graph some digits of Y-axis values are out of graph edge.
          Attached Files

          Comment

          • krimson
            Member
            • Sep 2008
            • 49

            #6
            Oops, can't believe I missed the trigger text

            Fixed that, and also "fixed" the Y-axis text. See screenshot for how it looks now. I have updated my original post with the actual patch and screenshots.
            Last edited by krimson; 18-01-2010, 17:33.

            Comment

            • Firm
              Senior Member
              • Dec 2009
              • 342

              #7
              Krimson,

              Good work! Patched successfully against latest rev9421 from svn. But there's one bug has been appeared. Units' name is now rotated and moved from the label on Y-axis.
              Attached Files

              Comment

              • krimson
                Member
                • Sep 2008
                • 49

                #8
                It is supposed to show the itemtype only once now on the Y axis to save space. I updated the patch so it leaves a little more space for larger graphs and fontsize. Give it a try

                Comment

                • Firm
                  Senior Member
                  • Dec 2009
                  • 342

                  #9
                  krimson,

                  Graphs are displayed fine now. Thanks, man!

                  Comment

                  • Firm
                    Senior Member
                    • Dec 2009
                    • 342

                    #10
                    Patch works against Zabbix 1.8.1 (released today).

                    Comment

                    • krimson
                      Member
                      • Sep 2008
                      • 49

                      #11
                      Good stuff

                      Comment

                      • bogus
                        Junior Member
                        • Jun 2007
                        • 9

                        #12
                        Krimson, great patch. Did you update the patch maybe to work with 1.8.2?

                        Comment

                        • fjrial
                          Senior Member
                          • Feb 2010
                          • 140

                          #13
                          tested and working with 1.8.2

                          Just tested with 1.8.2 and it works..

                          but you can't apply the patch, because line numbers have changed. You'll have to overwrite lines by searching and replacing (or at least, this is how I did it, because I don't know other way to do it).

                          thanks for this wonderful patch.

                          Comment

                          • krimson
                            Member
                            • Sep 2008
                            • 49

                            #14
                            Here's a patch for Zabbix 1.8.3 Give it a try.
                            Attached Files

                            Comment

                            • Pada
                              Senior Member
                              • Apr 2012
                              • 236

                              #15
                              updated patch for v1.8.11+

                              Thank you very much for that patch!

                              I wasn't able to apply that patch with the patch application since too much has changed since 1.8.3 & 1.8.11.

                              I have modified the patch a bit so that it works on 1.8.11 and I've just tried it on 1.8.13 and it was successful too.

                              There are certain areas that I've not been able to completely update, and I've marked those parts in the patches with "Patch partially applied" or "Patch not applied due to new code".

                              I have also decreased the base font size from 8 to 7 in my version of the patch.

                              Off-Topic:
                              I've also submitted a patch that allows you to set limits separately for the left & right Y-axis: https://support.zabbix.com/browse/ZBXNEXT-245
                              Attached Files
                              Last edited by Pada; 29-05-2012, 14:16.

                              Comment

                              Working...