HuasoFoundries /
jpgraph
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * JPGraph v4.0.3 |
||
| 5 | */ |
||
| 6 | |||
| 7 | namespace Amenadiel\JpGraph\Graph; |
||
| 8 | |||
| 9 | class PolarLogScale extends LogScale |
||
| 10 | { |
||
| 11 | private $graph; |
||
| 12 | public $clockwise = false; |
||
| 13 | |||
| 14 | public function __construct($aMax, $graph, $aClockwise = false) |
||
| 15 | { |
||
| 16 | parent::__construct(0, $aMax, 'x'); |
||
| 17 | $this->graph = $graph; |
||
| 18 | if ($this->ticks instanceof LogTicks) { |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 19 | $this->ticks->SetLabelLogType(LOGLABELS_MAGNITUDE); |
||
| 20 | } |
||
| 21 | $this->clockwise = $aClockwise; |
||
| 22 | } |
||
| 23 | |||
| 24 | public function SetClockwise($aFlg) |
||
| 25 | { |
||
| 26 | $this->clockwise = $aFlg; |
||
| 27 | } |
||
| 28 | |||
| 29 | public function PTranslate($aAngle, $aRad) |
||
| 30 | { |
||
| 31 | if ($aRad == 0) { |
||
| 32 | $aRad = 1; |
||
| 33 | } |
||
| 34 | |||
| 35 | $aRad = log10($aRad); |
||
| 36 | $m = $this->scale[1]; |
||
| 37 | $w = $this->graph->img->plotwidth / 2; |
||
| 38 | $aRad = $aRad / $m * $w; |
||
| 39 | |||
| 40 | $a = $aAngle / 180 * M_PI; |
||
| 41 | if ($this->clockwise) { |
||
| 42 | $a = 2 * M_PI - $a; |
||
| 43 | } |
||
| 44 | |||
| 45 | $x = cos($a) * $aRad; |
||
| 46 | $y = sin($a) * $aRad; |
||
| 47 | |||
| 48 | $x += $w + $this->graph->img->left_margin; //$this->_Translate(0); |
||
| 49 | if ($this->graph->iType == POLAR_360) { |
||
| 50 | $y = ($this->graph->img->top_margin + $this->graph->img->plotheight / 2) - $y; |
||
| 51 | } else { |
||
| 52 | $y = ($this->graph->img->top_margin + $this->graph->img->plotheight) - $y; |
||
| 53 | } |
||
| 54 | |||
| 55 | return [$x, $y]; |
||
| 56 | } |
||
| 57 | } |
||
| 58 |