Ad Widget

Collapse

fix drawLegend color

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dakol
    Member
    • Jan 2008
    • 50

    #1

    fix drawLegend color

    Hi,

    case: stacked graph with filled regions:

    I found the color of the small square of the legend did not match the filled region.

    before:


    after:


    patch:
    --- /tmp/chart.inc.php.old Wed May 6 17:20:50 2009
    +++ include/classes/chart.inc.php Wed May 6 17:20:39 2009
    @@ -338,7 +338,7 @@
    $color = $this->GetColor('HistoryMinMax');
    }
    else{
    - $color = $this->GetColor($this->items[$i]['color']);
    + $color = $this->GetColor($this->items[$i]['color'], GRAPH_STACKED_ALFA);
    switch($this->items[$i]['calc_fnc']){
    case CALC_FNC_MIN: $fnc_name = 'min'; break;
    case CALC_FNC_MAX: $fnc_name = 'max'; break;
    Last edited by dakol; 06-05-2009, 17:27.
  • krimson
    Member
    • Sep 2008
    • 49

    #2
    Thanks for that. There is a similar problem with normal graphs and (overlapping) plot area's. The colors will go wrong.

    Use this patch to fix: (your fix is included as well):
    Code:
    341c341
    < 				$color = $this->GetColor($this->items[$i]['color']);
    ---
    > 				$color = $this->GetColor($this->items[$i]['color'],GRAPH_STACKED_ALFA);
    1359,1362c1359,1362
    < 				$max_color	= $this->GetColor('ValueMax');
    < 				$avg_color	= $this->GetColor($this->items[$item]['color']);
    < 				$min_color	= $this->GetColor('ValueMin');
    < 				$minmax_color	= $this->GetColor('ValueMinMax');
    ---
    > 				$max_color	= $this->GetColor('ValueMax',GRAPH_STACKED_ALFA);
    > 				$avg_color	= $this->GetColor($this->items[$item]['color'],GRAPH_STACKED_ALFA);
    > 				$min_color	= $this->GetColor('ValueMin',GRAPH_STACKED_ALFA);
    > 				$minmax_color	= $this->GetColor('ValueMinMax',GRAPH_STACKED_ALFA);

    Comment

    • krimson
      Member
      • Sep 2008
      • 49

      #3
      Proper patch for 1.6.5:

      Code:
      --- /data/zabbix/zabbix-1.6.5/frontends/php/include/classes/chart.inc.php	2009-06-16 13:12:36.000000000 +0000
      +++ chart.inc.php	2009-06-23 10:22:19.000000000 +0000
      @@ -338,7 +338,7 @@
       				$color = $this->GetColor('HistoryMinMax');
       			}
       			else{
      -				$color = $this->GetColor($this->items[$i]['color']);
      +				$color = $this->GetColor($this->items[$i]['color'], GRAPH_STACKED_ALFA);
       				switch($this->items[$i]['calc_fnc']){
       					case CALC_FNC_MIN:	$fnc_name = 'min';	break;
       					case CALC_FNC_MAX:	$fnc_name = 'max';	break;
      @@ -1356,10 +1356,10 @@
       			else{
       				$drawtype	= $this->items[$item]['drawtype'];
       
      -				$max_color	= $this->GetColor('ValueMax');
      -				$avg_color	= $this->GetColor($this->items[$item]['color']);
      -				$min_color	= $this->GetColor('ValueMin');
      -				$minmax_color	= $this->GetColor('ValueMinMax');
      +				$max_color	= $this->GetColor('ValueMax',GRAPH_STACKED_ALFA);
      +				$avg_color	= $this->GetColor($this->items[$item]['color'],GRAPH_STACKED_ALFA);
      +				$min_color	= $this->GetColor('ValueMin',GRAPH_STACKED_ALFA);
      +				$minmax_color	= $this->GetColor('ValueMinMax',GRAPH_STACKED_ALFA);
       
       				$calc_fnc = $this->items[$item]['calc_fnc'];
       			}

      Comment

      Working...