Ad Widget

Collapse

Hide Legend in graphs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tmenard
    Junior Member
    • Mar 2010
    • 5

    #1

    Hide Legend in graphs

    Hi,

    I'm trying to hide legend in graphs, is there a way to do that in screens specifically or globaly ?

    I'm building a monitoring dashboard using screens and slideshows in zabbix, I graph the same thing on dozen of servers, I don't need the legend (which is actually bigger than the graph itself !)

    I saw that in the graphs table there is a field called show_legend, I tried to change the flag but it's not working.

    Is there someone who has an idea ?

    Thx
  • Aly
    ZABBIX developer
    • May 2007
    • 1126

    #2
    As I remember in some version of 1.8.x, we hide chart legend if chart size is lower 100px.. In zabbix 2.0 graph legend will be configurable.
    Zabbix | ex GUI developer

    Comment

    • tmenard
      Junior Member
      • Mar 2010
      • 5

      #3
      Hi,

      I found in graph2.php a row commented regarding the field show_legend.

      If I uncomment this line all the graph loose the legend.

      It's just the contrary of what I wanted but If I set the show_legend field to '1' the legend reappear.

      So for me it's OK.

      Thx

      Comment

      • fredushka
        Member
        • May 2009
        • 53

        #4
        This patсh will disable legends & timegrid if (sizeY < ZBX_GRAPH_LEGEND_HEIGHT)

        ZBX_GRAPH_LEGEND_HEIGHT defined in defines.inc.php

        Code:
        --- php/include/classes/class.cchart.php.org    2011-09-28 13:13:58.000000000 +0400
        +++ php/include/classes/class.cchart.php        2011-11-02 08:41:50.000000000 +0400
        @@ -2051,6 +2051,13 @@
                        $this->fullSizeX = $this->sizeX+$this->shiftXleft+$this->shiftXright+1;
                        $this->fullSizeY = $this->sizeY+$this->shiftY+$this->legendOffsetY;
        
        +
        +//beg
        +               if($this->sizeY < ZBX_GRAPH_LEGEND_HEIGHT){
        +                       $this->drawLegend = 0;
        +                       $this->fullSizeY -= 70;
        +               }
        +//end
                        if($this->drawLegend){
                                $trCount = $this->m_showTriggers?count($this->triggers):0;
                                $this->fullSizeY += 14 * ($this->num+1+(($this->sizeY < 120)?0:count($this->triggers))) + 8;
        @@ -2078,7 +2085,12 @@
        
                        $this->drawWorkPeriod();
         //*/ grid
        -               $this->drawTimeGrid();
        +
        +//beg
        +               if($this->sizeY >= ZBX_GRAPH_LEGEND_HEIGHT){
        +                       $this->drawTimeGrid();
        +               }
        +//end
                        $this->drawVerticalGrid();
                        $this->drawXYAxisScale($this->graphtheme['gridbordercolor']);
         //-----*/
        Last edited by fredushka; 02-11-2011, 11:55.

        Comment

        • BDiE8VNy
          Senior Member
          • Apr 2010
          • 680

          #5
          Related ticket: ZBXNEXT-1509

          Comment

          Working...