pChart is not needed anymore

This commit is contained in:
Tyron Madlener 2011-06-09 20:08:38 +02:00
parent 831da843c1
commit 659252cd71
20 changed files with 0 additions and 5778 deletions

View File

@ -1,164 +0,0 @@
/**
* Holds the definition and the creation of the imageMap object
* @author Martynas Mickevicius <mmartynas@gmail.com>
* @package phpMyAdmin
*/
/**
* responsible for showing tooltips above the image chart
*/
var imageMap = {
'mouseMoved': function(event, cont) {
// return if no imageMap set
// this can happen if server has no json
if (!this.imageMap) {
return;
}
// get mouse coordinated relative to image
var mouseX = event.pageX - cont.offsetLeft;
var mouseY = event.pageY - cont.offsetTop;
//console.log("X: " + mouseX + ", Y: " + mouseY);
/* Check if we are flying over a map zone
* Lets use the following method to check if a given
* point is in any convex polygon.
* http://www.programmingforums.org/post168124-3.html
*/
var found = false;
for (var key = 0; key < this.imageMap.length; key++)
{
var seriesName = this.imageMap[key]['n'];
var seriesValue = this.imageMap[key]['v'];
var signSum = 0;
for (var i = 0; i < this.imageMap[key]['p'].length; i++)
{
var index1;
var index2;
if (i == this.imageMap[key]['p'].length - 1)
{
index1 = i;
index2 = 0;
}
else
{
index1 = i;
index2 = i+1;
}
var result = this.getDeterminant(
this.imageMap[key]['p'][index1][0],
this.imageMap[key]['p'][index1][1],
this.imageMap[key]['p'][index2][0],
this.imageMap[key]['p'][index2][1],
mouseX,
mouseY
);
if (result > 0) { signSum += 1; } else { signSum += -1; }
}
if (Math.abs(signSum) == this.imageMap[key]['p'].length)
{
found = true;
if (this.currentKey != key)
{
this.tooltip.show();
this.tooltip.title(seriesName);
this.tooltip.text(seriesValue);
this.currentKey = key;
}
this.tooltip.move(mouseX + 20, mouseY + 20);
}
}
if (!found && this.currentKey != -1 )
{
this.tooltip.hide();
this.currentKey = -1;
}
},
'getDeterminant': function (X1, Y1, X2, Y2, X3, Y3) {
return (X2*Y3 - X3*Y2) - (X1*Y3 - X3*Y1) + (X1*Y2 - X2*Y1);
},
'loadImageMap': function(map) {
this.imageMap = JSON.parse(map);
for (key in this.imageMap)
{
// FIXME
// without this loop image map does not work
// on IE8 in the status page
}
},
'init': function() {
this.tooltip.init();
$("div#chart").bind('mousemove',function(e) {
imageMap.mouseMoved(e, this);
});
this.tooltip.attach("div#chart");
this.currentKey = -1;
},
'tooltip': {
'init': function () {
this.el = $('<div></div>');
this.el.css('position', 'absolute');
this.el.css('font-family', 'tahoma');
this.el.css('background-color', '#373737');
this.el.css('color', '#BEBEBE');
this.el.css('padding', '3px');
var title = $('<p></p>');
title.attr('id', 'title');
title.css('margin', '0px');
title.css('padding', '3px');
title.css('background-color', '#606060');
title.css('text-align', 'center');
title.html('Title');
this.el.append(title);
var text = $('<p></p>');
text.attr('id', 'text');
text.css('margin', '0');
text.html('Text');
this.el.append(text);
this.hide();
},
'attach': function (element) {
$(element).prepend(this.el);
},
'move': function (x, y) {
this.el.css('margin-left', x);
this.el.css('margin-top', y);
},
'hide': function () {
this.el.css('display', 'none');
},
'show': function () {
this.el.css('display', 'block');
},
'title': function (title) {
this.el.find("p#title").html(title);
},
'text': function (text) {
this.el.find("p#text").html(text.replace(/;/g, "<br />"));
}
}
};
$(document).ready(function() {
imageMap.init();
});

View File

@ -1,256 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Chart functions used to generate various types of charts.
* @package phpMyAdmin
*/
/**
*
*/
define('ERR_NO_GD', 0);
define('ERR_NO_JSON', 1);
require_once './libraries/chart/pma_pchart_pie.php';
require_once './libraries/chart/pma_pchart_single_bar.php';
require_once './libraries/chart/pma_pchart_multi_bar.php';
require_once './libraries/chart/pma_pchart_stacked_bar.php';
require_once './libraries/chart/pma_pchart_single_line.php';
require_once './libraries/chart/pma_pchart_multi_line.php';
require_once './libraries/chart/pma_pchart_single_radar.php';
require_once './libraries/chart/pma_pchart_multi_radar.php';
/**
* Formats a chart for the status page.
* @param array $data data for the status chart
* @return string HTML and JS code for the chart
*/
function PMA_chart_status($data)
{
// format keys which will be shown in the chart
$chartData = array();
foreach($data as $dataKey => $dataValue) {
$key = ucwords(str_replace(array('Com_', '_'), array('', ' '), $dataKey));
$value = (int)$dataValue;
$chartData[$key] = $value;
}
$chart = new PMA_pChart_Pie(
$chartData,
array('titleText' => __('Query statistics'))
);
$chartCode = $chart->toString();
PMA_handle_chart_err($chart->getErrors());
echo $chartCode;
}
/**
* Formats a chart for the profiling page.
* @param array $data data for the status chart
* @return string HTML and JS code for the chart
*/
function PMA_chart_profiling($data)
{
$chartData = array();
foreach($data as $dataValue) {
$value = (int)($dataValue['Duration'] * 1000000);
$key = ucwords($dataValue['Status']);
$chartData[$key] = $value;
}
$chart = new PMA_pChart_Pie(
$chartData,
array('titleText' => __('Query execution time comparison (in microseconds)'))
);
$chartCode = $chart->toString();
PMA_handle_chart_err($chart->getErrors());
echo $chartCode;
}
/**
* Formats a chart for the query results page.
* @param array $data data for the status chart
* @param array $chartSettings settings used to generate the chart
* @return string HTML and JS code for the chart
*/
function PMA_chart_results($data, &$chartSettings)
{
$chartData = array();
$chart = null;
// set default title if not already set
if (empty($chartSettings['titleText'])) {
$chartSettings['titleText'] = __('Query results');
}
// set default type if not already set
if (empty($chartSettings['type'])) {
$chartSettings['type'] = 'bar';
}
// set default type if not already set
if (empty($chartSettings['continuous'])) {
$chartSettings['continuous'] = 'off';
}
// set default bar type if needed
if ($chartSettings['type'] == 'bar' && empty($chartSettings['barType'])) {
$chartSettings['barType'] = 'stacked';
}
// default for legend
$chartSettings['legend'] = false;
// default for muti series
$chartSettings['multi'] = false;
if (! isset($data[0])) {
// empty data
return __('No data found for the chart.');
}
if (count($data[0]) == 1 || count($data[0]) == 2) {
// One or two columns in every row.
// This data is suitable for a simple bar chart.
if ($chartSettings['type'] == 'pie') {
// loop through the rows, data for pie chart has to be formated
// in a different way then in other charts.
foreach ($data as $rowKey => $row) {
$values = array_values($row);
if (count($row) == 1) {
$chartData[$rowKey] = $values[0];
}
else {
$chartData[$values[1]] = $values[0];
}
}
$chartSettings['legend'] = true;
$chart = new PMA_pChart_pie($chartData, $chartSettings);
}
else {
// loop through the rows
foreach ($data as $rowKey => $row) {
// loop through the columns in the row
foreach ($row as $valueKey => $value) {
$chartData[$valueKey][] = $value;
}
// if only one column, we need to add
// placeholder data for x axis
if (count($row) == 1) {
$chartData[''][] = $rowKey;
}
}
switch ($chartSettings['type']) {
case 'bar':
default:
$chart = new PMA_pChart_single_bar($chartData, $chartSettings);
break;
case 'line':
$chart = new PMA_pChart_single_line($chartData, $chartSettings);
break;
case 'radar':
$chart = new PMA_pChart_single_radar($chartData, $chartSettings);
break;
}
}
}
else if (count($data[0]) == 3) {
// Three columns (x axis, y axis, series) in every row.
// This data is suitable for a stacked bar chart.
$chartSettings['multi'] = true;
$keys = array_keys($data[0]);
$yAxisKey = $keys[0];
$xAxisKey = $keys[1];
$seriesKey = $keys[2];
// get all the series labels
$seriesLabels = array();
foreach ($data as $row) {
$seriesLabels[] = $row[$seriesKey];
}
$seriesLabels = array_unique($seriesLabels);
// loop through the rows
$currentXLabel = $data[0][$xAxisKey];
foreach ($data as $row) {
// save the label
// use the same value as the key and the value to get rid of duplicate results
$chartData[$xAxisKey][$row[$xAxisKey]] = $row[$xAxisKey];
// make sure to set value to every serie
$currentSeriesLabel = (string)$row[$seriesKey];
foreach ($seriesLabels as $seriesLabelsValue) {
if ($currentSeriesLabel == $seriesLabelsValue) {
// the value os for this serie
$chartData[$yAxisKey][$seriesLabelsValue][$row[$xAxisKey]] = (int)$row[$yAxisKey];
}
else if (! isset($chartData[$yAxisKey][$seriesLabelsValue][$row[$xAxisKey]])) {
// if the value for this serie is not set, set it to 0
$chartData[$yAxisKey][$seriesLabelsValue][$row[$xAxisKey]] = 0;
}
}
}
$chartSettings['legend'] = true;
// determine the chart type
switch ($chartSettings['type']) {
case 'bar':
default:
// determine the bar chart type
switch ($chartSettings['barType']) {
case 'stacked':
default:
$chart = new PMA_pChart_stacked_bar($chartData, $chartSettings);
break;
case 'multi':
$chart = new PMA_pChart_multi_bar($chartData, $chartSettings);
break;
}
break;
case 'line':
$chart = new PMA_pChart_multi_line($chartData, $chartSettings);
break;
case 'radar':
$chart = new PMA_pChart_multi_radar($chartData, $chartSettings);
break;
}
}
else {
// unknown data format
return '';
}
$chartCode = $chart->toString();
$chartSettings = $chart->getSettings();
$chartErrors = $chart->getErrors();
PMA_handle_chart_err($chartErrors);
return $chartCode;
}
/**
* Simple handler of chart errors.
* @param array $errors all occured errors
*/
function PMA_handle_chart_err($errors)
{
if (in_array(ERR_NO_GD, $errors)) {
PMA_warnMissingExtension('GD', false, __('GD extension is needed for charts.'));
}
else if (in_array(ERR_NO_JSON, $errors)) {
PMA_warnMissingExtension('JSON', false, __('JSON encoder is needed for chart tooltips.'));
}
}
?>

View File

@ -1,99 +0,0 @@
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
Bitstream Vera Fonts Copyright
------------------------------
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
a trademark of Bitstream, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute the
Font Software, including without limitation the rights to use, copy, merge,
publish, distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to the
following conditions:
The above copyright and trademark notices and this permission notice shall
be included in all copies of one or more of the Font Software typefaces.
The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional glyphs or characters may be added to the Fonts, only if the fonts
are renamed to names not containing either the words "Bitstream" or the word
"Vera".
This License becomes null and void to the extent applicable to Fonts or Font
Software that has been modified and is distributed under the "Bitstream
Vera" names.
The Font Software may be sold as part of a larger software package but no
copy of one or more of the Font Software typefaces may be sold by itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
FONT SOFTWARE.
Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font Software
without prior written authorization from the Gnome Foundation or Bitstream
Inc., respectively. For further information, contact: fonts at gnome dot
org.
Arev Fonts Copyright
------------------------------
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and
associated documentation files (the "Font Software"), to reproduce
and distribute the modifications to the Bitstream Vera Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to
the following conditions:
The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.
The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Tavmjong Bah" or the word "Arev".
This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the
"Tavmjong Bah Arev" names.
The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Except as contained in this notice, the name of Tavmjong Bah shall not
be used in advertising or otherwise to promote the sale, use or other
dealings in this Font Software without prior written authorization
from Tavmjong Bah. For further information, contact: tavmjong @ free
. fr.
$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $

View File

@ -1,6 +0,0 @@
The tahoma.ttf file which is bundled with pChart 1.27d was replaced due to uncertainty with it's licence.
As a replacement the DejaVuSans.ttf font file was extracted from the DejaVu fonts 2.32 package available from dejavu-fonts.org
For license information see LICENSE.

View File

@ -1,119 +0,0 @@
<?php
/*
pCache - Faster renderding using data cache
Copyright (C) 2008 Jean-Damien POGOLOTTI
Version 1.1.2 last updated on 06/17/08
http://pchart.sourceforge.net
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 1,2,3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Class initialisation :
pCache($CacheFolder="Cache/")
Cache management :
IsInCache($Data)
GetFromCache($ID,$Data)
WriteToCache($ID,$Data,$Picture)
DeleteFromCache($ID,$Data)
ClearCache()
Inner functions :
GetHash($ID,$Data)
*/
/* pCache class definition */
class pCache
{
var $HashKey = "";
var $CacheFolder = "Cache/";
/* Create the pCache object */
function pCache($CacheFolder="Cache/")
{
$this->CacheFolder = $CacheFolder;
}
/* This function is clearing the cache folder */
function ClearCache()
{
if ($handle = opendir($this->CacheFolder))
{
while (false !== ($file = readdir($handle)))
{
if ( $file != "." && $file != ".." )
unlink($this->CacheFolder.$file);
}
closedir($handle);
}
}
/* This function is checking if we have an offline version of this chart */
function IsInCache($ID,$Data,$Hash="")
{
if ( $Hash == "" )
$Hash = $this->GetHash($ID,$Data);
if ( file_exists($this->CacheFolder.$Hash) )
return(TRUE);
else
return(FALSE);
}
/* This function is making a copy of drawn chart in the cache folder */
function WriteToCache($ID,$Data,$Picture)
{
$Hash = $this->GetHash($ID,$Data);
$FileName = $this->CacheFolder.$Hash;
imagepng($Picture->Picture,$FileName);
}
/* This function is removing any cached copy of this chart */
function DeleteFromCache($ID,$Data)
{
$Hash = $this->GetHash($ID,$Data);
$FileName = $this->CacheFolder.$Hash;
if ( file_exists($FileName ) )
unlink($FileName);
}
/* This function is retrieving the cached picture if applicable */
function GetFromCache($ID,$Data)
{
$Hash = $this->GetHash($ID,$Data);
if ( $this->IsInCache("","",$Hash ) )
{
$FileName = $this->CacheFolder.$Hash;
header('Content-type: image/png');
@readfile($FileName);
exit();
}
}
/* This function is building the graph unique hash key */
function GetHash($ID,$Data)
{
$mKey = "$ID";
foreach($Data as $key => $Values)
{
$tKey = "";
foreach($Values as $Serie => $Value)
$tKey = $tKey.$Serie.$Value;
$mKey = $mKey.md5($tKey);
}
return(md5($mKey));
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,260 +0,0 @@
<?php
/*
pData - Simplifying data population for pChart
Copyright (C) 2008 Jean-Damien POGOLOTTI
Version 1.13 last updated on 08/17/08
http://pchart.sourceforge.net
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 1,2,3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Class initialisation :
pData()
Data populating methods :
ImportFromCSV($FileName,$Delimiter=",",$DataColumns=-1,$HasHeader=FALSE,$DataName=-1)
AddPoint($Value,$Serie="Serie1",$Description="")
Series manipulation methods :
AddSerie($SerieName="Serie1")
AddAllSeries()
RemoveSerie($SerieName="Serie1")
SetAbsciseLabelSerie($SerieName = "Name")
SetSerieName($Name,$SerieName="Serie1")
+ SetSerieSymbol($Name,$Symbol)
SetXAxisName($Name="X Axis")
SetYAxisName($Name="Y Axis")
SetXAxisFormat($Format="number")
SetYAxisFormat($Format="number")
SetXAxisUnit($Unit="")
SetYAxisUnit($Unit="")
removeSerieName($SerieName)
removeAllSeries()
Data retrieval methods :
GetData()
GetDataDescription()
*/
/* pData class definition */
class pData
{
var $Data;
var $DataDescription;
function pData()
{
$this->Data = array();
$this->DataDescription = "";
$this->DataDescription["Position"] = "Name";
$this->DataDescription["Format"]["X"] = "number";
$this->DataDescription["Format"]["Y"] = "number";
$this->DataDescription["Unit"]["X"] = NULL;
$this->DataDescription["Unit"]["Y"] = NULL;
}
function ImportFromCSV($FileName,$Delimiter=",",$DataColumns=-1,$HasHeader=FALSE,$DataName=-1)
{
$handle = @fopen($FileName,"r");
if ($handle)
{
$HeaderParsed = FALSE;
while (!feof($handle))
{
$buffer = fgets($handle, 4096);
$buffer = str_replace(chr(10),"",$buffer);
$buffer = str_replace(chr(13),"",$buffer);
$Values = split($Delimiter,$buffer);
if ( $buffer != "" )
{
if ( $HasHeader == TRUE && $HeaderParsed == FALSE )
{
if ( $DataColumns == -1 )
{
$ID = 1;
foreach($Values as $key => $Value)
{ $this->SetSerieName($Value,"Serie".$ID); $ID++; }
}
else
{
$SerieName = "";
foreach($DataColumns as $key => $Value)
$this->SetSerieName($Values[$Value],"Serie".$Value);
}
$HeaderParsed = TRUE;
}
else
{
if ( $DataColumns == -1 )
{
$ID = 1;
foreach($Values as $key => $Value)
{ $this->AddPoint(intval($Value),"Serie".$ID); $ID++; }
}
else
{
$SerieName = "";
if ( $DataName != -1 )
$SerieName = $Values[$DataName];
foreach($DataColumns as $key => $Value)
$this->AddPoint($Values[$Value],"Serie".$Value,$SerieName);
}
}
}
}
fclose($handle);
}
}
function AddPoint($Value,$Serie="Serie1",$Description="")
{
if (is_array($Value) && count($Value) == 1)
$Value = array_pop($Value);
$ID = 0;
for($i=0;$i<=count($this->Data);$i++)
{ if(isset($this->Data[$i][$Serie])) { $ID = $i+1; } }
if ( count($Value) == 1 )
{
$this->Data[$ID][$Serie] = $Value;
if ( $Description != "" )
$this->Data[$ID]["Name"] = $Description;
elseif (!isset($this->Data[$ID]["Name"]))
$this->Data[$ID]["Name"] = $ID;
}
else
{
foreach($Value as $key => $Val)
{
$this->Data[$ID][$Serie] = $Val;
if (!isset($this->Data[$ID]["Name"]))
$this->Data[$ID]["Name"] = $ID;
$ID++;
}
}
}
function AddSerie($SerieName="Serie1")
{
if ( !isset($this->DataDescription["Values"]) )
{
$this->DataDescription["Values"][] = $SerieName;
}
else
{
$Found = FALSE;
foreach($this->DataDescription["Values"] as $key => $Value )
if ( $Value == $SerieName ) { $Found = TRUE; }
if ( !$Found )
$this->DataDescription["Values"][] = $SerieName;
}
}
function AddAllSeries()
{
unset($this->DataDescription["Values"]);
if ( isset($this->Data[0]) )
{
foreach($this->Data[0] as $Key => $Value)
{
if ( $Key != "Name" )
$this->DataDescription["Values"][] = $Key;
}
}
}
function RemoveSerie($SerieName="Serie1")
{
if ( !isset($this->DataDescription["Values"]) )
return(0);
$Found = FALSE;
foreach($this->DataDescription["Values"] as $key => $Value )
{
if ( $Value == $SerieName )
unset($this->DataDescription["Values"][$key]);
}
}
function SetAbsciseLabelSerie($SerieName = "Name")
{
$this->DataDescription["Position"] = $SerieName;
}
function SetSerieName($Name,$SerieName="Serie1")
{
$this->DataDescription["Description"][$SerieName] = $Name;
}
function SetXAxisName($Name="X Axis")
{
$this->DataDescription["Axis"]["X"] = $Name;
}
function SetYAxisName($Name="Y Axis")
{
$this->DataDescription["Axis"]["Y"] = $Name;
}
function SetXAxisFormat($Format="number")
{
$this->DataDescription["Format"]["X"] = $Format;
}
function SetYAxisFormat($Format="number")
{
$this->DataDescription["Format"]["Y"] = $Format;
}
function SetXAxisUnit($Unit="")
{
$this->DataDescription["Unit"]["X"] = $Unit;
}
function SetYAxisUnit($Unit="")
{
$this->DataDescription["Unit"]["Y"] = $Unit;
}
function SetSerieSymbol($Name,$Symbol)
{
$this->DataDescription["Symbol"][$Name] = $Symbol;
}
function removeSerieName($SerieName)
{
if ( isset($this->DataDescription["Description"][$SerieName]) )
unset($this->DataDescription["Description"][$SerieName]);
}
function removeAllSeries()
{
foreach($this->DataDescription["Values"] as $Key => $Value)
unset($this->DataDescription["Values"][$Key]);
}
function GetData()
{
return($this->Data);
}
function GetDataDescription()
{
return($this->DataDescription);
}
}
?>

View File

@ -1,183 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Holds the base class that all charts inherit from and some widely used
* constants.
* @package phpMyAdmin
*/
/**
*
*/
define('RED', 0);
define('GREEN', 1);
define('BLUE', 2);
/**
* The base class that all charts inherit from.
* @abstract
* @package phpMyAdmin
*/
abstract class PMA_chart
{
/**
* @var array All the default settigs values are here.
*/
protected $settings = array(
// Default title for every chart.
'titleText' => 'Chart',
// The style of the chart title.
'titleColor' => '#FAFAFA',
// Colors for the different slices in the pie chart.
'colors' => array(
'#BCE02E',
'#E0642E',
'#E0D62E',
'#2E97E0',
'#B02EE0',
'#E02E75',
'#5CE02E',
'#E0B02E',
'#000000',
'#0022E0',
'#726CB1',
'#481A36',
'#BAC658',
'#127224',
'#825119',
'#238C74',
'#4C489B',
'#87C9BF',
),
// Chart background color.
'bgColor' => '#84AD83',
// The width of the chart.
'width' => 520,
// 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' => '',
);
/**
* @var array Options that the user has specified
*/
private $userSpecifiedSettings = null;
/**
* @var array Error codes will be stored here
*/
protected $errors = array();
/**
* Store user specified options
* @param array $options users specified options
*/
function __construct($options = null)
{
$this->userSpecifiedSettings = $options;
}
/**
* All the variable initialization has to be done here.
*/
protected function init()
{
$this->handleOptions();
}
/**
* A function which handles passed parameters. Useful if desired
* chart needs to be a little bit different from the default one.
*/
private function handleOptions()
{
if (is_null($this->userSpecifiedSettings)) {
return;
}
$this->settings = array_merge($this->settings, $this->userSpecifiedSettings);
}
protected function getTitleText()
{
return $this->settings['titleText'];
}
protected function getTitleColor($component)
{
return $this->hexStrToDecComp($this->settings['titleColor'], $component);
}
protected function getColors()
{
return $this->settings['colors'];
}
protected function getWidth()
{
return $this->settings['width'];
}
protected function getHeight()
{
return $this->settings['height'];
}
protected function getBgColor($component)
{
return $this->hexStrToDecComp($this->settings['bgColor'], $component);
}
protected function setXLabel($label)
{
$this->settings['xLabel'] = $label;
}
protected function getXLabel()
{
return $this->settings['xLabel'];
}
protected function setYLabel($label)
{
$this->settings['yLabel'] = $label;
}
protected function getYLabel()
{
return $this->settings['yLabel'];
}
public function getSettings()
{
return $this->settings;
}
public function getErrors()
{
return $this->errors;
}
/**
* Get one the dec color component from the hex color string
* @param string $colorString color string, i.e. #5F22A99
* @param int $component color component to get, i.e. 0 gets red.
*/
protected function hexStrToDecComp($colorString, $component)
{
return hexdec(substr($colorString, ($component * 2) + 1, 2));
}
}
?>

View File

@ -1,402 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Holds the base class that all charts using pChart inherit from and some
* widely used constants
* @package phpMyAdmin
*/
/**
*
*/
define('TOP', 0);
define('RIGHT', 1);
define('BOTTOM', 2);
define('LEFT', 3);
require_once 'pma_chart.php';
require_once 'pChart/pData.class';
require_once 'pChart/pChart.class';
/**
* Base class for every chart implemented using pChart.
* @abstract
* @package phpMyAdmin
*/
abstract class PMA_pChart_chart extends PMA_chart
{
/**
* @var String title text
*/
protected $titleText;
/**
* @var array data for the chart
*/
protected $data;
/**
* @var object pData object that holds the description of the data
*/
protected $dataSet;
/**
* @var object pChart object that holds the chart
*/
protected $chart;
/**
* @var array holds base64 encoded chart image parts
*/
protected $partsEncoded = array();
public function __construct($data, $options = null)
{
parent::__construct($options);
$this->data = $data;
$this->settings['fontPath'] = './libraries/chart/pChart/fonts/';
$this->settings['scale'] = SCALE_ADDALLSTART0;
$this->settings['labelHeight'] = 20;
$this->settings['fontSize'] = 8;
$this->settings['continuous'] = 'off';
// as in CSS (top, right, bottom, left)
$this->setAreaMargins(array(20, 20, 40, 60));
// Get color settings from theme
$this->settings = array_merge($this->settings,$GLOBALS['cfg']['chartColor']);
}
protected function init()
{
parent::init();
// create pChart object
$this->chart = new pChart($this->getWidth(), $this->getHeight());
// create pData object
$this->dataSet = new pData;
$this->chart->reportWarnings('GD');
$this->chart->ErrorFontName = $this->getFontPath().'DejaVuSans.ttf';
// initialize colors
foreach ($this->getColors() as $key => $color) {
$this->chart->setColorPalette(
$key,
hexdec(substr($color, 1, 2)),
hexdec(substr($color, 3, 2)),
hexdec(substr($color, 5, 2))
);
}
$this->chart->setFontProperties($this->getFontPath().'DejaVuSans.ttf', $this->getFontSize());
$this->chart->setImageMap(true, 'mapid');
}
/**
* data is put to the $dataSet object according to what type chart is
* @abstract
*/
abstract protected function prepareDataSet();
/**
* all components of the chart are drawn
*/
protected function prepareChart()
{
$this->drawBackground();
$this->drawChart();
}
/**
* draws the background
*/
protected function drawBackground()
{
$this->drawCommon();
$this->drawTitle();
$this->setGraphAreaDimensions();
$this->drawGraphArea();
}
/**
* draws the part of the background which is common to most of the charts
*/
protected function drawCommon()
{
$this->chart->drawGraphAreaGradient(
$this->getBgColor(RED),
$this->getBgColor(GREEN),
$this->getBgColor(BLUE),
// With a gradientIntensity of 0 the background does't draw, oddly
($this->settings['gradientIntensity']==0)?1:$this->settings['gradientIntensity'],TARGET_BACKGROUND);
if(is_string($this->settings['border']))
$this->chart->addBorder(1,$this->getBorderColor(RED),$this->getBorderColor(GREEN),$this->getBorderColor(BLUE));
}
/**
* draws the chart title
*/
protected function drawTitle()
{
// Draw the title
$this->chart->drawTextBox(
0,
0,
$this->getWidth(),
$this->getLabelHeight(),
$this->getTitleText(),
0,
$this->getTitleColor(RED),
$this->getTitleColor(GREEN),
$this->getTitleColor(BLUE),
ALIGN_CENTER,
false,
$this->getTitleBgColor(RED),
$this->getTitleBgColor(GREEN),
$this->getTitleBgColor(BLUE)
);
}
/**
* calculates and sets the dimensions that will be used for the actual graph
*/
protected function setGraphAreaDimensions()
{
$this->chart->setGraphArea(
$this->getAreaMargin(LEFT),
$this->getLabelHeight() + $this->getAreaMargin(TOP),
$this->getWidth() - $this->getAreaMargin(RIGHT),
$this->getHeight() - $this->getAreaMargin(BOTTOM)
);
}
/**
* draws graph area (the area where all bars, lines, points will be seen)
*/
protected function drawGraphArea()
{
$this->chart->drawGraphArea(
$this->getGraphAreaColor(RED),
$this->getGraphAreaColor(GREEN),
$this->getGraphAreaColor(BLUE),
false
);
$this->chart->drawScale(
$this->dataSet->GetData(),
$this->dataSet->GetDataDescription(),
$this->getScale(),
$this->getScaleColor(RED),
$this->getScaleColor(GREEN),
$this->getScaleColor(BLUE),
true,0,2,true
);
if($this->settings['gradientIntensity']>0)
$this->chart->drawGraphAreaGradient(
$this->getGraphAreaGradientColor(RED),
$this->getGraphAreaGradientColor(GREEN),
$this->getGraphAreaGradientColor(BLUE),
$this->settings['gradientIntensity']
);
else
$this->chart->drawGraphArea(
$this->getGraphAreaGradientColor(RED),
$this->getGraphAreaGradientColor(GREEN),
$this->getGraphAreaGradientColor(BLUE)
);
$this->chart->drawGrid(
4,
true,
$this->getGridColor(RED),
$this->getGridColor(GREEN),
$this->getGridColor(BLUE),
20
);
}
/**
* draws the chart
* @abstract
*/
protected abstract function drawChart();
/**
* Renders the chart, base 64 encodes the output and puts it into
* array partsEncoded.
*
* Parameter can be used to slice the chart vertically into parts. This
* solves an issue where some browsers (IE8) accept base64 images only up
* to some length.
*
* @param integer $parts number of parts to render.
* Default value 1 means that all the
* chart will be in one piece.
*/
protected function render($parts = 1)
{
$fullWidth = 0;
for ($i = 0; $i < $parts; $i++) {
// slicing is vertical so part height is the full height
$partHeight = $this->chart->YSize;
// there will be some rounding erros, will compensate later
$partWidth = round($this->chart->XSize / $parts);
$fullWidth += $partWidth;
$partX = $partWidth * $i;
if ($i == $parts - 1) {
// if this is the last part, compensate for the rounding errors
$partWidth += $this->chart->XSize - $fullWidth;
}
// get a part from the full chart image
$part = imagecreatetruecolor($partWidth, $partHeight);
imagecopy($part, $this->chart->Picture, 0, 0, $partX, 0, $partWidth, $partHeight);
// render part and save it to variable
ob_start();
imagepng($part, NULL, 9, PNG_ALL_FILTERS);
$output = ob_get_contents();
ob_end_clean();
// base64 encode the current part
$partEncoded = base64_encode($output);
$this->partsEncoded[$i] = $partEncoded;
}
}
/**
* get the HTML and JS code for the configured chart
* @return string HTML and JS code for the chart
*/
public function toString()
{
if (!function_exists('gd_info')) {
array_push($this->errors, ERR_NO_GD);
return '';
}
$this->init();
$this->prepareDataSet();
$this->prepareChart();
//$this->chart->debugImageMap();
//$this->chart->printErrors('GD');
// check if a user wanted a chart in one part
if ($this->isContinuous()) {
$this->render(1);
}
else {
$this->render(20);
}
$returnData = '<div id="chart">';
foreach ($this->partsEncoded as $part) {
$returnData .= '<img src="data:image/png;base64,'.$part.'" />';
}
$returnData .= '</div>';
// add tooltips only if json is available
if (function_exists('json_encode')) {
$returnData .= '
<script type="text/javascript">
//<![CDATA[
imageMap.loadImageMap(\''.json_encode($this->getImageMap()).'\');
//]]>
</script>
';
}
else {
array_push($this->errors, ERR_NO_JSON);
}
return $returnData;
}
protected function getLabelHeight()
{
return $this->settings['labelHeight'];
}
protected function setAreaMargins($areaMargins)
{
$this->settings['areaMargins'] = $areaMargins;
}
protected function getAreaMargin($side)
{
return $this->settings['areaMargins'][$side];
}
protected function getFontPath()
{
return $this->settings['fontPath'];
}
protected function getScale()
{
return $this->settings['scale'];
}
protected function getFontSize()
{
return $this->settings['fontSize'];
}
protected function isContinuous()
{
return $this->settings['continuous'] == 'on';
}
protected function getImageMap()
{
return $this->chart->getImageMap();
}
protected function getGraphAreaColor($component)
{
return $this->hexStrToDecComp($this->settings['graphAreaColor'], $component);
}
protected function getGraphAreaGradientColor($component)
{
return $this->hexStrToDecComp($this->settings['graphAreaGradientColor'], $component);
}
protected function getGridColor($component)
{
return $this->hexStrToDecComp($this->settings['gridColor'], $component);
}
protected function getScaleColor($component)
{
return $this->hexStrToDecComp($this->settings['scaleColor'], $component);
}
protected function getTitleBgColor($component)
{
return $this->hexStrToDecComp($this->settings['titleBgColor'], $component);
}
protected function getBorderColor($component)
{
return $this->hexStrToDecComp($this->settings['border'], $component);
}
}
?>

View File

@ -1,117 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @package phpMyAdmin
*/
/**
*
*/
require_once 'pma_pchart_chart.php';
/**
* Base class for every chart that uses multiple series.
* All of these charts will require legend box.
* @abstract
* @package phpMyAdmin
*/
abstract class PMA_pChart_multi extends PMA_pChart_chart
{
public function __construct($data, $options = null)
{
parent::__construct($data, $options);
// as in CSS (top, right, bottom, left)
$this->setLegendMargins(array(20, 10, 0, 0));
}
/**
* data set preparation for multi serie graphs
*/
protected function prepareDataSet()
{
$values = array_values($this->data);
$keys = array_keys($this->data);
// Dataset definition
$this->dataSet->AddPoint($values[0], "Keys");
$i = 0;
foreach ($values[1] as $seriesName => $seriesData) {
$this->dataSet->AddPoint($seriesData, "Values".$i);
$this->dataSet->SetSerieName($seriesName, "Values".$i);
$i++;
}
$this->dataSet->AddAllSeries();
$this->dataSet->RemoveSerie("Keys");
$this->dataSet->SetAbsciseLabelSerie("Keys");
$xLabel = $this->getXLabel();
if (empty($xLabel)) {
$this->setXLabel($keys[0]);
}
$yLabel = $this->getYLabel();
if (empty($yLabel)) {
$this->setYLabel($keys[1]);
}
$this->dataSet->SetXAxisName($this->getXLabel());
$this->dataSet->SetYAxisName($this->getYLabel());
}
/**
* set graph area dimensions with respect to legend box size
*/
protected function setGraphAreaDimensions()
{
$this->chart->setGraphArea(
$this->getAreaMargin(LEFT),
$this->getLabelHeight() + $this->getAreaMargin(TOP),
$this->getWidth() - $this->getAreaMargin(RIGHT) - $this->getLegendBoxWidth() - $this->getLegendMargin(LEFT) - $this->getLegendMargin(RIGHT),
$this->getHeight() - $this->getAreaMargin(BOTTOM)
);
}
/**
* multi serie charts need a legend. draw it
*/
protected function drawChart()
{
$this->drawLegend();
}
/**
* draws a legend
*/
protected function drawLegend()
{
// Draw the legend
$this->chart->drawLegend(
$this->getWidth() - $this->getLegendMargin(RIGHT) - $this->getLegendBoxWidth(),
$this->getLabelHeight() + $this->getLegendMargin(TOP),
$this->dataSet->GetDataDescription(),
250,250,250,50,50,50
);
}
protected function setLegendMargins($legendMargins)
{
if (!isset($this->settings['legendMargins'])) {
$this->settings['legendMargins'] = $legendMargins;
}
}
protected function getLegendMargin($side)
{
return $this->settings['legendMargins'][$side];
}
protected function getLegendBoxWidth()
{
$legendSize = $this->chart->getLegendBoxSize($this->dataSet->GetDataDescription());
return $legendSize[0];
}
}
?>

View File

@ -1,37 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @package phpMyAdmin
*/
/**
*
*/
require_once 'pma_pchart_multi.php';
/**
* implements multi bar chart
* @package phpMyAdmin
*/
class PMA_pChart_multi_bar extends PMA_pChart_multi
{
public function __construct($data, $options = null)
{
parent::__construct($data, $options);
$this->settings['scale'] = SCALE_NORMAL;
}
/**
* draws multi bar graph
*/
protected function drawChart()
{
parent::drawChart();
// Draw the bar chart
$this->chart->drawBarGraph($this->dataSet->GetData(), $this->dataSet->GetDataDescription(), 70);
}
}
?>

View File

@ -1,38 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @package phpMyAdmin
*/
/**
*
*/
require_once 'pma_pchart_multi.php';
/**
* implements multi line chart
* @package phpMyAdmin
*/
class PMA_pChart_multi_line extends PMA_pChart_multi
{
public function __construct($data, $options = null)
{
parent::__construct($data, $options);
$this->settings['scale'] = SCALE_NORMAL;
}
/**
* draws multi line chart
*/
protected function drawChart()
{
parent::drawChart();
// Draw the bar chart
$this->chart->drawLineGraph($this->dataSet->GetData(), $this->dataSet->GetDataDescription());
$this->chart->drawPlotGraph($this->dataSet->GetData(), $this->dataSet->GetDataDescription(), 3, 1, -1, -1, -1, true);
}
}
?>

View File

@ -1,107 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @package phpMyAdmin
*/
/**
*
*/
require_once 'pma_pchart_multi.php';
/**
* implements multi radar chart
* @package phpMyAdmin
*/
class PMA_pChart_multi_radar extends PMA_pChart_multi
{
public function __construct($data, $options = null)
{
parent::__construct($data, $options);
$this->normalizeValues();
}
/**
* Get the largest value from the data and normalize all the other values.
*/
private function normalizeValues()
{
$maxValue = 0;
$keys = array_keys($this->data);
$valueKey = $keys[1];
// get the max value
foreach ($this->data[$valueKey] as $values) {
if (max($values) > $maxValue) {
$maxValue = max($values);
}
}
// normalize all the values according to the max value
foreach ($this->data[$valueKey] as &$values) {
foreach ($values as &$value) {
$value = $value / $maxValue * 10;
}
}
}
/**
* graph area for the radar chart does not include grid lines
*/
protected function drawGraphArea()
{
$this->chart->drawGraphArea(
$this->getGraphAreaColor(RED),
$this->getGraphAreaColor(GREEN),
$this->getGraphAreaColor(BLUE),
false
);
if($this->settings['gradientIntensity']>0)
$this->chart->drawGraphAreaGradient(
$this->getGraphAreaGradientColor(RED),
$this->getGraphAreaGradientColor(GREEN),
$this->getGraphAreaGradientColor(BLUE),
$this->settings['gradientIntensity']
);
else
$this->chart->drawGraphArea(
$this->getGraphAreaGradientColor(RED),
$this->getGraphAreaGradientColor(GREEN),
$this->getGraphAreaGradientColor(BLUE)
);
}
/**
* draw multi radar chart
*/
protected function drawChart()
{
parent::drawChart();
// when drawing radar graph we can specify the border from the top of
// graph area. We want border to be dynamic, so that either the top
// or the side of the radar is some distance away from the top or the
// side of the graph area.
$areaWidth = $this->chart->GArea_X2 - $this->chart->GArea_X1;
$areaHeight = $this->chart->GArea_Y2 - $this->chart->GArea_Y1;
if ($areaHeight > $areaWidth) {
$borderOffset = ($areaHeight - $areaWidth) / 2;
}
else {
$borderOffset = 0;
}
// the least ammount that radar is away from the graph area side.
$borderOffset += 40;
// Draw the radar chart
$this->chart->drawRadarAxis($this->dataSet->GetData(), $this->dataSet->GetDataDescription(), true, $borderOffset,
120, 120, 120, 230, 230, 230, -1, 2);
$this->chart->drawFilledRadar($this->dataSet->GetData(), $this->dataSet->GetDataDescription(), 50, $borderOffset);
}
}
?>

View File

@ -1,109 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @package phpMyAdmin
*/
/**
*
*/
require_once 'pma_pchart_multi.php';
/**
* implements pie chart
* @package phpMyAdmin
*/
class PMA_pChart_Pie extends PMA_pChart_multi
{
public function __construct($data, $options = null)
{
// limit data size, no more than 18 pie slices
$data = array_slice($data, 0, 18, true);
parent::__construct($data, $options);
$this->setAreaMargins(array(20, 10, 20, 20));
}
/**
* prepare data set for the pie chart
*/
protected function prepareDataSet()
{
// Dataset definition
$this->dataSet->AddPoint(array_values($this->data), "Values");
$this->dataSet->AddPoint(array_keys($this->data), "Keys");
$this->dataSet->AddAllSeries();
$this->dataSet->SetAbsciseLabelSerie("Keys");
}
/**
* graph area for the pie chart does not include grid lines
*/
protected function drawGraphArea()
{
$this->chart->drawGraphArea(
$this->getGraphAreaColor(RED),
$this->getGraphAreaColor(GREEN),
$this->getGraphAreaColor(BLUE),
false
);
if($this->settings['gradientIntensity']>0)
$this->chart->drawGraphAreaGradient(
$this->getGraphAreaGradientColor(RED),
$this->getGraphAreaGradientColor(GREEN),
$this->getGraphAreaGradientColor(BLUE),
$this->settings['gradientIntensity']
);
else
$this->chart->drawGraphArea(
$this->getGraphAreaGradientColor(RED),
$this->getGraphAreaGradientColor(GREEN),
$this->getGraphAreaGradientColor(BLUE)
);
}
/**
* draw the pie chart
*/
protected function drawChart()
{
parent::drawChart();
// draw pie chart in the middle of graph area
$middleX = ($this->chart->GArea_X1 + $this->chart->GArea_X2) / 2;
$middleY = ($this->chart->GArea_Y1 + $this->chart->GArea_Y2) / 2;
$this->chart->drawPieGraph(
$this->dataSet->GetData(),
$this->dataSet->GetDataDescription(),
$middleX,
// pie graph is skewed. Upper part is shorter than the
// lower part. This is why we set an offset to the
// Y middle coordiantes.
$middleY - 15,
120, PIE_PERCENTAGE, false, 60, 30, 10, 1);
}
/**
* draw legend for the pie chart
*/
protected function drawLegend()
{
$this->chart->drawPieLegend(
$this->getWidth() - $this->getLegendMargin(RIGHT) - $this->getLegendBoxWidth(),
$this->getLabelHeight() + $this->getLegendMargin(TOP),
$this->dataSet->GetData(),
$this->dataSet->GetDataDescription(),
250, 250, 250);
}
protected function getLegendBoxWidth()
{
$legendSize = $this->chart->getPieLegendBoxSize($this->dataSet->GetData());
return $legendSize[0];
}
}
?>

View File

@ -1,56 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @package phpMyAdmin
*/
/**
*
*/
require_once 'pma_pchart_chart.php';
/**
* Base class for every chart that uses only one series.
* @abstract
* @package phpMyAdmin
*/
abstract class PMA_pChart_single extends PMA_pChart_chart
{
public function __construct($data, $options = null)
{
parent::__construct($data, $options);
}
/**
* data set preparation for single serie charts
*/
protected function prepareDataSet()
{
$values = array_values($this->data);
$keys = array_keys($this->data);
// Dataset definition
$this->dataSet->AddPoint($values[0], "Values");
$this->dataSet->AddPoint($values[1], "Keys");
//$this->dataSet->AddAllSeries();
$this->dataSet->AddSerie("Values");
$this->dataSet->SetAbsciseLabelSerie("Keys");
$yLabel = $this->getYLabel();
if (empty($yLabel)) {
$this->setYLabel($keys[0]);
}
$xLabel = $this->getXLabel();
if (empty($xLabel)) {
$this->setXLabel($keys[1]);
}
$this->dataSet->SetXAxisName($this->getXLabel());
$this->dataSet->SetYAxisName($this->getYLabel());
$this->dataSet->SetSerieName($this->getYLabel(), "Values");
}
}
?>

View File

@ -1,34 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @package phpMyAdmin
*/
/**
*
*/
require_once 'pma_pchart_single.php';
/**
* implements single bar chart
* @package phpMyAdmin
*/
class PMA_pChart_single_bar extends PMA_pChart_single
{
public function __construct($data, $options = null)
{
parent::__construct($data, $options);
}
/**
* draws single bar chart
*/
protected function drawChart()
{
// Draw the bar chart
// use stacked bar graph function, because it gives bars with alpha
$this->chart->drawStackedBarGraph($this->dataSet->GetData(), $this->dataSet->GetDataDescription(), 70);
}
}
?>

View File

@ -1,34 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @package phpMyAdmin
*/
/**
*
*/
require_once 'pma_pchart_single.php';
/**
* implements single line chart
* @package phpMyAdmin
*/
class PMA_pChart_single_line extends PMA_pChart_single
{
public function __construct($data, $options = null)
{
parent::__construct($data, $options);
}
/**
* draws single line chart
*/
protected function drawChart()
{
// Draw the line chart
$this->chart->drawLineGraph($this->dataSet->GetData(), $this->dataSet->GetDataDescription());
$this->chart->drawPlotGraph($this->dataSet->GetData(), $this->dataSet->GetDataDescription(), 3, 1, -1, -1, -1, true);
}
}
?>

View File

@ -1,96 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @package phpMyAdmin
*/
/**
*
*/
require_once 'pma_pchart_single.php';
/**
* implements single radar chart
* @package phpMyAdmin
*/
class PMA_pChart_single_radar extends PMA_pChart_single
{
public function __construct($data, $options = null)
{
parent::__construct($data, $options);
$this->normalizeValues();
}
/**
* Get the largest value from the data and normalize all the other values.
*/
private function normalizeValues()
{
$maxValue = 0;
$keys = array_keys($this->data);
$valueKey = $keys[0];
$maxValue = max($this->data[$valueKey]);
foreach ($this->data[$valueKey] as &$value) {
$value = $value / $maxValue * 10;
}
}
/**
* graph area for the radar chart does not include grid lines
*/
protected function drawGraphArea()
{
$this->chart->drawGraphArea(
$this->getGraphAreaColor(RED),
$this->getGraphAreaColor(GREEN),
$this->getGraphAreaColor(BLUE),
false
);
if($this->settings['gradientIntensity']>0)
$this->chart->drawGraphAreaGradient(
$this->getGraphAreaGradientColor(RED),
$this->getGraphAreaGradientColor(GREEN),
$this->getGraphAreaGradientColor(BLUE),
$this->settings['gradientIntensity']
);
else
$this->chart->drawGraphArea(
$this->getGraphAreaGradientColor(RED),
$this->getGraphAreaGradientColor(GREEN),
$this->getGraphAreaGradientColor(BLUE)
);
}
/**
* draws the radar chart
*/
protected function drawChart()
{
// when drawing radar graph we can specify the border from the top of
// graph area. We want border to be dynamic, so that either the top
// or the side of the radar is some distance away from the top or the
// side of the graph area.
$areaWidth = $this->chart->GArea_X2 - $this->chart->GArea_X1;
$areaHeight = $this->chart->GArea_Y2 - $this->chart->GArea_Y1;
if ($areaHeight > $areaWidth) {
$borderOffset = ($areaHeight - $areaWidth) / 2;
}
else {
$borderOffset = 0;
}
// the least ammount that radar is away from the graph area side.
$borderOffset += 40;
$this->chart->drawRadarAxis($this->dataSet->GetData(), $this->dataSet->GetDataDescription(),
true, $borderOffset, 120, 120, 120, 230, 230, 230, -1, 2);
$this->chart->drawFilledRadar($this->dataSet->GetData(), $this->dataSet->GetDataDescription(), 50, $borderOffset);
}
}
?>

View File

@ -1,35 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @package phpMyAdmin
*/
/**
*
*/
require_once 'pma_pchart_multi.php';
/**
* implements stacked bar chart
* @package phpMyAdmin
*/
class PMA_pChart_stacked_bar extends PMA_pChart_multi
{
public function __construct($data, $options = null)
{
parent::__construct($data, $options);
}
/**
* draws stacked bar chart
*/
protected function drawChart()
{
parent::drawChart();
// Draw the bar chart
$this->chart->drawStackedBarGraph($this->dataSet->GetData(), $this->dataSet->GetDataDescription(), 70);
}
}
?>