Skip to content

Commit

Permalink
Added limit_text_angle option for axis text angle.
Browse files Browse the repository at this point in the history
  • Loading branch information
goat1000 committed Jul 19, 2021
1 parent c19492d commit e97249c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
9 changes: 9 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Version 3.10 (19/07/2021)
------------
- Added support for using text as a shape or figure.
- Fixed angled axis text being badly placed with new limit_text_angle option.
- Fixed guidelines not showing on date/time graphs.
- Fixed some missing date/time tokens in crosshair text.
- Fixed histograms not supporting non-integer values.
- Fixed polar area graphs drawing incorrectly with date/time keys.

Version 3.9 (24/05/2021)
-----------
- Added support for linking legend entries and title.
Expand Down
9 changes: 9 additions & 0 deletions DisplayAxis.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ public function __construct(&$graph, &$axis, $axis_no, $orientation, $type,
if($this->show_text) {
$styles['t_angle'] = $graph->getOption(
['axis_text_angle_' . $o, $axis_no], 0);
if($graph->getOption('limit_text_angle')) {
$angle = $styles['t_angle'] % 360;
if($angle > 180)
$angle = -360 + $angle;
if($angle < -180)
$angle = 360 + $angle;
$angle = min(90, max(-90, $angle));
$styles['t_angle'] = $angle;
}
$styles['t_position'] = $graph->getOption(
['axis_text_position_' . $o, $axis_no], 'axis_text_position');
$styles['t_location'] = $graph->getOption(
Expand Down
4 changes: 2 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SVGGraph Library version 3.9
============================
SVGGraph Library version 3.10
=============================

This library provides PHP classes and functions for easily creating SVG
graphs from data. Version 3.0 of SVGGraph requires at least PHP 5.4 - if
Expand Down
2 changes: 1 addition & 1 deletion SVGGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SVGGraph {

use SVGGraphTrait;

const VERSION = 'SVGGraph 3.9';
const VERSION = 'SVGGraph 3.10';
private $width = 100;
private $height = 100;
private $settings = [];
Expand Down
1 change: 1 addition & 0 deletions svggraph.ini
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ force_block_label_x = false
axis_zero_y = true
axis_ticks_x = null
axis_ticks_y = null
limit_text_angle = true

[BarGraph]
bar_space = 10
Expand Down

0 comments on commit e97249c

Please sign in to comment.