diff --git a/SVGChartBuilder.php b/SVGChartBuilder.php index a9a3205..30dee2a 100644 --- a/SVGChartBuilder.php +++ b/SVGChartBuilder.php @@ -193,8 +193,8 @@ class SVGChartBuilder { // Top and bottom grid labels $gridText = - ''.($this->labelFormat($this->yMax, $labelPrecision + 1)).'' . - ''.($this->labelFormat($this->yMin, $labelPrecision + 1)).''; + ''.($this->labelFormat($this->yMax, $labelPrecision + 1)).'' . + ''.($this->labelFormat($this->yMin, $labelPrecision + 1)).''; // Main labels and grid lines for ( @@ -204,14 +204,14 @@ class SVGChartBuilder { ) { $labelHeight = $this->transformY($labelY); if ( // label is not too close to the min or max - $labelHeight < $this->height - 2.5 * $this->options['fontSize'] && - $labelHeight > $this->options['fontSize'] * 2.5 + $labelHeight < $this->height - 1.5 * $this->options['fontSize'] && + $labelHeight > $this->options['fontSize'] * 1.5 ) { - $gridText .= ''.$this->labelFormat($labelY, $labelPrecision).''; + $gridText .= ''.$this->labelFormat($labelY, $labelPrecision).''; $gridLines .= ' M0,'.$labelHeight.' '.$this->width.','.$labelHeight; } else if ( // label is too close - $labelHeight < $this->height - $this->options['fontSize'] / 2 && - $labelHeight > $this->options['fontSize'] / 2 + $labelHeight < $this->height - $this->options['fontSize'] * 0.75 && + $labelHeight > $this->options['fontSize'] * 0.75 ) { $gridLines .= ' M'.( // move grid line over when it's very close to the min or max label $labelHeight < $this->height - $this->options['fontSize'] / 2 && $labelHeight > $this->options['fontSize'] / 2 ? 0 : $this->options['fontSize'] / 2 diff --git a/demo.php b/demo.php index 8b4567f..0a9deb2 100644 --- a/demo.php +++ b/demo.php @@ -21,6 +21,9 @@ +
+

PHP SVG Chart Builder: chart demos

+

Poloniex Dash/BTC Price