Skip to content

Commit

Permalink
Final updates for 2.19.
Browse files Browse the repository at this point in the history
  • Loading branch information
goat1000 committed Jul 17, 2015
1 parent 165341a commit a93c2a1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Version 2.19
Version 2.19 (17/07/2015)
------------
- Added histogram.
- Added shading overlay for 3D bar sides and top.
- Added best_fit_opacity and best_fit_above options.
- Added semantic class for best fit lines.
- Added tooltip and data label callback options.
- Added data_label_min_space option.

Version 2.18 (03/04/2015)
------------
Expand Down
10 changes: 9 additions & 1 deletion SVGGraphBarGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function Draw()
$body = $this->Grid() . $this->Guidelines(SVGG_GUIDELINE_BELOW);
$bnum = 0;
$bar_width = $this->BarWidth();
$bspace = max(0, ($this->x_axes[$this->main_x_axis]->Unit() - $bar_width) / 2);
$bspace = $this->BarSpace($bar_width);
$this->ColourSetup($this->values->ItemsCount());
$bars = '';

Expand Down Expand Up @@ -95,6 +95,14 @@ protected function BarWidth()
return $this->bar_space >= $unit_w ? '1' : $unit_w - $this->bar_space;
}

/**
* Returns the space before a bar
*/
protected function BarSpace($bar_width)
{
return max(0, ($this->x_axes[$this->main_x_axis]->Unit() - $bar_width) / 2);
}

/**
* Fills in the y-position and height of a bar
* @param number $value bar value
Expand Down
13 changes: 11 additions & 2 deletions SVGGraphHistogram.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,17 @@ protected function BarWidth()
{
if(is_numeric($this->bar_width) && $this->bar_width >= 1)
return $this->bar_width;
$unit_w = $this->x_axes[$this->main_x_axis]->Unit();
return $unit_w * $this->increment;
$unit_w = $this->increment * $this->x_axes[$this->main_x_axis]->Unit();
return $this->bar_space >= $unit_w ? '1' : $unit_w - $this->bar_space;
}

/**
* Returns the space before a bar
*/
protected function BarSpace($bar_width)
{
$uwidth = $this->increment * $this->x_axes[$this->main_x_axis]->Unit();
return max(0, ($uwidth - $bar_width) / 2);
}
}

0 comments on commit a93c2a1

Please sign in to comment.