added configurable settings for title and labels

This commit is contained in:
Martynas Mickevicius
2010-06-23 14:06:57 +03:00
parent 278ee6e2ca
commit c2e7aef7ba
4 changed files with 51 additions and 7 deletions

View File

@@ -50,6 +50,16 @@ class PMA_Chart
* The height of the chart.
*/
'height' => 325,
/*
* Default X Axis label. If empty, label will be taken from the data.
*/
'xLabel' => '',
/*
* Default Y Axis label. If empty, label will be taken from the data.
*/
'yLabel' => '',
);
function __construct($options = null)
@@ -98,6 +108,16 @@ class PMA_Chart
return hexdec(substr($this->settings['bgColor'], ($component * 2) + 1, 2));
}
function getXLabel()
{
return $this->settings['xLabel'];
}
function getYLabel()
{
return $this->settings['yLabel'];
}
function getSettings()
{
return $this->settings;

View File

@@ -31,8 +31,18 @@ class PMA_pChart_bar extends PMA_pChart_Chart
$this->dataSet->AddAllSeries();
//$DataSet->RemoveSerie("Serie3");
$this->dataSet->SetAbsciseLabelSerie("Keys");
$this->dataSet->SetXAxisName($keys[0]);
$this->dataSet->SetYAxisName($keys[1]);
$xLabel = $this->getXLabel();
if (empty($xLabel)) {
$xLabel = $keys[0];
}
$this->dataSet->SetXAxisName($xLabel);
$yLabel = $this->getYLabel();
if (empty($yLabel)) {
$yLabel = $keys[1];
}
$this->dataSet->SetYAxisName($yLabel);
//$DataSet->SetYAxisUnit("°C");
//$DataSet->SetXAxisUnit("h");
}