3.4.0-rc1
[phpmyadmin/thilanka.git] / libraries / chart / pma_pchart_single.php
blob6579a9bc3db7b137ddafa6a9045e766b36824659
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * @package phpMyAdmin
5 */
7 /**
9 */
10 require_once 'pma_pchart_chart.php';
12 /**
13 * Base class for every chart that uses only one series.
14 * @abstract
15 * @package phpMyAdmin
17 abstract class PMA_pChart_single extends PMA_pChart_chart
19 public function __construct($data, $options = null)
21 parent::__construct($data, $options);
24 /**
25 * data set preparation for single serie charts
27 protected function prepareDataSet()
29 $values = array_values($this->data);
30 $keys = array_keys($this->data);
32 // Dataset definition
33 $this->dataSet->AddPoint($values[0], "Values");
34 $this->dataSet->AddPoint($values[1], "Keys");
36 //$this->dataSet->AddAllSeries();
37 $this->dataSet->AddSerie("Values");
39 $this->dataSet->SetAbsciseLabelSerie("Keys");
41 $yLabel = $this->getYLabel();
42 if (empty($yLabel)) {
43 $this->setYLabel($keys[0]);
45 $xLabel = $this->getXLabel();
46 if (empty($xLabel)) {
47 $this->setXLabel($keys[1]);
50 $this->dataSet->SetXAxisName($this->getXLabel());
51 $this->dataSet->SetYAxisName($this->getYLabel());
52 $this->dataSet->SetSerieName($this->getYLabel(), "Values");