icons
8 years ago
markers
8 years ago
GoogleChart.php
8 years ago
GoogleChartApi.php
8 years ago
GoogleChartAxis.php
8 years ago
GoogleChartData.php
8 years ago
GoogleChartIcon.php
8 years ago
GoogleChartMarker.php
8 years ago
LICENSE
8 years ago
GoogleChartIcon.php
84 lines
| 1 | <?php |
| 2 | |
| 3 | /** @file |
| 4 | * This file is part of Google Chart PHP library. |
| 5 | * |
| 6 | * Copyright (c) 2010 Rémi Lanvin <remi@cloudconnected.fr> |
| 7 | * |
| 8 | * Licensed under the MIT license. |
| 9 | * |
| 10 | * For the full copyright and license information, please view the LICENSE file. |
| 11 | */ |
| 12 | |
| 13 | require_once 'GoogleChartApi.php'; |
| 14 | |
| 15 | /** |
| 16 | * A dynamic icon. |
| 17 | */ |
| 18 | abstract class GoogleChartIcon extends GoogleChartApi |
| 19 | { |
| 20 | /** |
| 21 | * @var GoogleChartData Will hold the data serie. |
| 22 | */ |
| 23 | protected $data = null; |
| 24 | |
| 25 | /** |
| 26 | * @name Freestanding icon functions |
| 27 | */ |
| 28 | //@{ |
| 29 | /** |
| 30 | * @internal |
| 31 | */ |
| 32 | protected function computeQuery() |
| 33 | { |
| 34 | $q = array(); |
| 35 | |
| 36 | $q['chld'] = $this->computeChld(); |
| 37 | $q['chst'] = $this->computeChst(); |
| 38 | |
| 39 | $q = array_merge($q, $this->parameters); |
| 40 | |
| 41 | return $q; |
| 42 | } |
| 43 | //@} |
| 44 | |
| 45 | /** |
| 46 | * @name Icon as dynamic marker functions. |
| 47 | */ |
| 48 | //@{ |
| 49 | |
| 50 | public function setData(GoogleChartData $data) |
| 51 | { |
| 52 | $this->data = $data; |
| 53 | return $this; |
| 54 | } |
| 55 | |
| 56 | public function getData() |
| 57 | { |
| 58 | return $this->data; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @internal |
| 63 | */ |
| 64 | public function compute($index = 0, $chart_type = null) |
| 65 | { |
| 66 | $str = 'y;'; |
| 67 | |
| 68 | // Remove the "d_" for "s" parameter |
| 69 | $tmp = $this->computeChst(); |
| 70 | if ( $tmp[0] == 'd' && $tmp[1] == '_' ) |
| 71 | $tmp = substr($tmp,2); |
| 72 | $str .= 's='.$tmp; |
| 73 | |
| 74 | |
| 75 | // Escape the "d" parameter |
| 76 | $str .= ';d='.$this->computeChld(',',',','@'); |
| 77 | |
| 78 | $str .= ';ds='.$index; |
| 79 | |
| 80 | return $str; |
| 81 | } |
| 82 | //@} |
| 83 | } |
| 84 |