Skip to content

Commit

Permalink
Bug fixes in 2.23.1
Browse files Browse the repository at this point in the history
  • Loading branch information
goat1000 committed Aug 3, 2016
1 parent 788ffc3 commit 7559cfa
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 10 deletions.
9 changes: 9 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
Version 2.23.1 (03/08/2016)
--------------
- Added datetime_key_format option.
- Fixed per-dataset stroke_width with a 0 value.
- Fixed default structure missing values with string keys when main key is 0.
- Fixed error when using datetime keys with multiple unstructured datasets.
- Fixed legend autohide not working when no other Javascript options enabled.
- Fixed error in radar graphs when given some dual-Y axis settings.

Version 2.23 (22/06/2016)
------------
- Added date/time axis.
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 2.23
=============================
SVGGraph Library version 2.23.1
===============================

This library provides PHP classes and functions for easily creating SVG
graphs from data. As of version 2.0, SVGGraph works with PHP 5 only -
Expand Down
3 changes: 2 additions & 1 deletion SVGGraphJavascript.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (C) 2012-2015 Graham Breach
* Copyright (C) 2012-2016 Graham Breach
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -472,6 +472,7 @@ function svgCursorCoords(e) {
$this->AddFunction('init');
$this->AddFunction('getE');
$this->AddFunction('setattr');
$this->AddFunction('finditem');
$this->InsertVariable('initfns', NULL, 'autoHide');
$fn = <<<JAVASCRIPT
function autoHide() {
Expand Down
3 changes: 2 additions & 1 deletion SVGGraphMultiGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ public function __construct($values, $force_assoc, $datetime_keys, $int_keys)
}
}
$new_data = array_values($new_data);

require_once('SVGGraphStructuredData.php');
$this->values = new SVGGraphStructuredData($new_data, $force_assoc,
$datetime_keys, null, false, $int_keys, null);
$datetime_keys, null, false, $int_keys, null, true);
}
$this->datasets = count($this->values);
}
Expand Down
15 changes: 11 additions & 4 deletions SVGGraphRadarGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,8 @@ protected function XAxisTextPositions(&$points, $xoff, $yoff, $angle, $inside)
$position['transform'] = "rotate($angle,$rcx,$rcy)";
}
// $c == -1 is particular too : XAxis text can bump YAxis texts
$y_nudge = $this->GetFirst($this->axis_font_size_v,
$y_nudge = $this->GetFirst(
$this->ArrayOption($this->axis_font_size_v, 0),
$this->axis_font_size) / 2;
if($c == -1 && $this->start_angle % 360 == 90) {
$position['y'] -= $y_nudge;
Expand Down Expand Up @@ -682,9 +683,15 @@ protected function YAxisTextPositions(&$points, $xoff, $yoff, $angle, $inside, $
{
$positions = array();
$labels = '';
$font_size = $this->GetFirst($this->axis_font_size_v, $this->axis_font_size);
$font_adjust = $this->GetFirst($this->axis_font_adjust_v, $this->axis_font_adjust);
$text_space = $this->GetFirst($this->axis_text_space_v, $this->axis_text_space);
$font_size = $this->GetFirst(
$this->ArrayOption($this->axis_font_size_v, $axis_no),
$this->axis_font_size);
$font_adjust = $this->GetFirst(
$this->ArrayOption($this->axis_font_adjust_v, $axis_no),
$this->axis_font_adjust);
$text_space = $this->GetFirst(
$this->ArrayOption($this->axis_text_space_v, $axis_no),
$this->axis_text_space);
$c = cos($this->arad);
$s = sin($this->arad);
$a = $this->arad + ($s * $c > 0 ? - M_PI_2 : M_PI_2);
Expand Down
7 changes: 5 additions & 2 deletions SVGGraphStructuredData.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class SVGGraphStructuredData implements Countable, ArrayAccess, Iterator {
public $error = null;

public function __construct(&$data, $force_assoc, $datetime_keys,
$structure, $repeated_keys, $integer_keys, $requirements)
$structure, $repeated_keys, $integer_keys, $requirements,
$rekey_done = FALSE)
{
if(!is_null($structure) && !empty($structure)) {
// structure provided, is it valid?
Expand Down Expand Up @@ -111,13 +112,15 @@ public function __construct(&$data, $force_assoc, $datetime_keys,
// reindex the array to 0, 1, 2, ...
$this->data = array_values($this->data);
if($datetime_keys) {
if($this->Rekey('SVGGraphDateConvert')) {
if($rekey_done || $this->Rekey('SVGGraphDateConvert')) {
$this->datetime = true;
$this->assoc = false;
} else {
$this->error = 'Too many date/time conversion errors';
return;
}
$GLOBALS['SVGGraphFieldSortField'] = $this->key_field;
usort($this->data, 'SVGGraphFieldSort');
}
} elseif(!is_null($this->key_field)) {
// if not associative, sort by key field
Expand Down

0 comments on commit 7559cfa

Please sign in to comment.