Initial commit
This commit is contained in:
201
jpgraph/src/themes/AquaTheme.class.php
Normal file
201
jpgraph/src/themes/AquaTheme.class.php
Normal file
@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Aqua Theme class
|
||||
*/
|
||||
class AquaTheme extends Theme
|
||||
{
|
||||
protected $font_color = '#0044CC';
|
||||
protected $background_color = '#DDFFFF';
|
||||
protected $axis_color = '#0066CC';
|
||||
protected $grid_color = '#3366CC';
|
||||
|
||||
function GetColorList() {
|
||||
return array(
|
||||
'#183152',
|
||||
'#C4D7ED',
|
||||
'#375D81',
|
||||
'#ABC8E2',
|
||||
'#E1E6FA',
|
||||
'#9BBAB2',
|
||||
'#3B4259',
|
||||
'#0063BC',
|
||||
'#1D5A73',
|
||||
'#ABABFF',
|
||||
'#27ADC5',
|
||||
'#EDFFCC',
|
||||
|
||||
/*
|
||||
|
||||
'#66FFFF',
|
||||
'#00AABB',
|
||||
'#00FFCC',
|
||||
'#33CCFF',
|
||||
'#008866',
|
||||
'#99FFFF',
|
||||
'#0099FF',
|
||||
'#99FFCC',
|
||||
'#3399FF',
|
||||
'#2277FF',
|
||||
'#445588',
|
||||
'#003388',
|
||||
'#338877',
|
||||
'#55DDFF',
|
||||
'#00FF99',
|
||||
'#BBBBBB',
|
||||
'#77AAFF',
|
||||
'#00FFCC',
|
||||
*/
|
||||
);
|
||||
}
|
||||
|
||||
function SetupGraph($graph) {
|
||||
|
||||
// graph
|
||||
/*
|
||||
$img = $graph->img;
|
||||
$height = $img->height;
|
||||
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
|
||||
*/
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetFillColor('white');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// xaxis
|
||||
$graph->xaxis->title->SetColor($this->font_color);
|
||||
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
|
||||
$graph->xaxis->SetLabelMargin(10);
|
||||
|
||||
// yaxis
|
||||
$graph->yaxis->title->SetColor($this->font_color);
|
||||
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->yaxis->SetTickSide(SIDE_LEFT);
|
||||
$graph->yaxis->SetLabelMargin(8);
|
||||
$graph->yaxis->HideLine();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->xaxis->SetTitleMargin(15);
|
||||
|
||||
// grid
|
||||
$graph->ygrid->SetColor($this->grid_color);
|
||||
$graph->ygrid->SetLineStyle('dotted');
|
||||
|
||||
|
||||
// font
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
// $graph->img->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function SetupPieGraph($graph) {
|
||||
|
||||
// graph
|
||||
$graph->SetFrame(false);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFillColor('white');
|
||||
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.80, 'center', 'top');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(4);
|
||||
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// title
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
$graph->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function PreStrokeApply($graph) {
|
||||
if ($graph->legend->HasItems()) {
|
||||
$img = $graph->img;
|
||||
$graph->SetMargin(
|
||||
$img->raw_left_margin,
|
||||
$img->raw_right_margin,
|
||||
$img->raw_top_margin,
|
||||
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ApplyPlot($plot) {
|
||||
|
||||
switch (get_class($plot))
|
||||
{
|
||||
case 'GroupBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AccBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'BarPlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$color = $this->GetNextColor();
|
||||
$plot->SetColor($color);
|
||||
$plot->SetFillColor($color);
|
||||
//$plot->SetShadow();
|
||||
break;
|
||||
}
|
||||
|
||||
case 'LinePlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
$plot->SetColor($this->GetNextColor());
|
||||
$plot->SetWeight(2);
|
||||
// $plot->SetBarCenter();
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot':
|
||||
{
|
||||
$plot->SetCenter(0.5, 0.45);
|
||||
$plot->ShowBorder(false);
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot3D':
|
||||
{
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
182
jpgraph/src/themes/GreenTheme.class.php
Normal file
182
jpgraph/src/themes/GreenTheme.class.php
Normal file
@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Green Theme class
|
||||
*/
|
||||
class GreenTheme extends Theme
|
||||
{
|
||||
private $font_color = '#009900';
|
||||
private $background_color = '#EEFFDD';
|
||||
private $axis_color = '#00CC00';
|
||||
private $grid_color = '#33CC33';
|
||||
|
||||
function GetColorList() {
|
||||
return array(
|
||||
'#66CC00',
|
||||
'#009900',
|
||||
'#AAFF77',
|
||||
'#559922',
|
||||
'#00CC33',
|
||||
'#99FF00',
|
||||
'#009966',
|
||||
'#00FF99',
|
||||
'#99BB66',
|
||||
'#33FF00',
|
||||
'#DDFFBB',
|
||||
'#669933',
|
||||
'#BBDDCC',
|
||||
'#77CCBB',
|
||||
'#668833',
|
||||
'#BBEE66',
|
||||
);
|
||||
}
|
||||
|
||||
function SetupGraph($graph) {
|
||||
|
||||
// graph
|
||||
/*
|
||||
$img = $graph->img;
|
||||
$height = $img->height;
|
||||
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
|
||||
*/
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetFillColor('white');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// xaxis
|
||||
$graph->xaxis->title->SetColor($this->font_color);
|
||||
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
|
||||
$graph->xaxis->SetLabelMargin(10);
|
||||
|
||||
// yaxis
|
||||
$graph->yaxis->title->SetColor($this->font_color);
|
||||
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->yaxis->SetTickSide(SIDE_LEFT);
|
||||
$graph->yaxis->SetLabelMargin(8);
|
||||
$graph->yaxis->HideLine();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->xaxis->SetTitleMargin(15);
|
||||
|
||||
// grid
|
||||
$graph->ygrid->SetColor($this->grid_color);
|
||||
$graph->ygrid->SetLineStyle('dotted');
|
||||
|
||||
|
||||
// font
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
// $graph->img->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function SetupPieGraph($graph) {
|
||||
|
||||
// graph
|
||||
$graph->SetFrame(false);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFillColor('white');
|
||||
/*
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
*/
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// title
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
$graph->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function PreStrokeApply($graph) {
|
||||
if ($graph->legend->HasItems()) {
|
||||
$img = $graph->img;
|
||||
$graph->SetMargin(
|
||||
$img->raw_left_margin,
|
||||
$img->raw_right_margin,
|
||||
$img->raw_top_margin,
|
||||
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ApplyPlot($plot) {
|
||||
|
||||
switch (get_class($plot))
|
||||
{
|
||||
case 'GroupBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AccBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'BarPlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$color = $this->GetNextColor();
|
||||
$plot->SetColor($color);
|
||||
$plot->SetFillColor($color);
|
||||
$plot->SetShadow('red', 3, 4, false);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'LinePlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$plot->SetColor($this->GetNextColor().'@0.4');
|
||||
$plot->SetWeight(2);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot':
|
||||
{
|
||||
$plot->ShowBorder(false);
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot3D':
|
||||
{
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
184
jpgraph/src/themes/OceanTheme.class.php
Normal file
184
jpgraph/src/themes/OceanTheme.class.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Ocean Theme class
|
||||
*/
|
||||
class OceanTheme extends Theme
|
||||
{
|
||||
protected $font_color = '#0066FF';
|
||||
private $background_color = '#DDEEFF';
|
||||
private $axis_color = '#0000CC';
|
||||
private $grid_color = '#3333CC';
|
||||
|
||||
function GetColorList() {
|
||||
return array(
|
||||
'#0066FF',
|
||||
'#CCCCFF',
|
||||
'#0000FF',
|
||||
'#3366FF',
|
||||
'#33CCFF',
|
||||
'#660088',
|
||||
'#3300FF',
|
||||
'#0099FF',
|
||||
'#6633FF',
|
||||
'#0055EE',
|
||||
'#2277EE',
|
||||
'#3300FF',
|
||||
'#AA00EE',
|
||||
'#778899',
|
||||
'#114499',
|
||||
'#7744EE',
|
||||
'#002288',
|
||||
'#6666FF',
|
||||
);
|
||||
}
|
||||
|
||||
function SetupGraph($graph) {
|
||||
|
||||
// graph
|
||||
/*
|
||||
$img = $graph->img;
|
||||
$height = $img->height;
|
||||
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
|
||||
*/
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetFillColor('white');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// xaxis
|
||||
$graph->xaxis->title->SetColor($this->font_color);
|
||||
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
|
||||
$graph->xaxis->SetLabelMargin(10);
|
||||
|
||||
// yaxis
|
||||
$graph->yaxis->title->SetColor($this->font_color);
|
||||
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->yaxis->SetTickSide(SIDE_LEFT);
|
||||
$graph->yaxis->SetLabelMargin(8);
|
||||
$graph->yaxis->HideLine();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->xaxis->SetTitleMargin(15);
|
||||
|
||||
// grid
|
||||
$graph->ygrid->SetColor($this->grid_color);
|
||||
$graph->ygrid->SetLineStyle('dotted');
|
||||
|
||||
|
||||
// font
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
// $graph->img->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function SetupPieGraph($graph) {
|
||||
|
||||
// graph
|
||||
$graph->SetFrame(false);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFillColor('white');
|
||||
/*
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
*/
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// title
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
$graph->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function PreStrokeApply($graph) {
|
||||
if ($graph->legend->HasItems()) {
|
||||
$img = $graph->img;
|
||||
$graph->SetMargin(
|
||||
$img->raw_left_margin,
|
||||
$img->raw_right_margin,
|
||||
$img->raw_top_margin,
|
||||
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ApplyPlot($plot) {
|
||||
|
||||
switch (get_class($plot))
|
||||
{
|
||||
case 'GroupBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AccBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'BarPlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$color = $this->GetNextColor();
|
||||
$plot->SetColor($color);
|
||||
$plot->SetFillColor($color);
|
||||
$plot->SetShadow('red', 3, 4, false);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'LinePlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$plot->SetColor($this->GetNextColor());
|
||||
$plot->SetWeight(2);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot':
|
||||
{
|
||||
$plot->ShowBorder(false);
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot3D':
|
||||
{
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
184
jpgraph/src/themes/OrangeTheme.class.php
Normal file
184
jpgraph/src/themes/OrangeTheme.class.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Orange Theme class
|
||||
*/
|
||||
class OrangeTheme extends Theme
|
||||
{
|
||||
private $font_color = '#CC4400';
|
||||
private $background_color = '#FFEEDD';
|
||||
private $axis_color = '#CC6600';
|
||||
private $grid_color = '#CC6633';
|
||||
|
||||
function GetColorList() {
|
||||
return array(
|
||||
'#FF9900',
|
||||
'#FFCC00',
|
||||
'#AA6600',
|
||||
'#CCCC00',
|
||||
'#CC6600',
|
||||
'#FFFF66',
|
||||
'#CCFF00',
|
||||
'#CC3300',
|
||||
'#669933',
|
||||
'#EE7700',
|
||||
'#AAEE33',
|
||||
'#77AA00',
|
||||
'#CCFF99',
|
||||
'#FF6633',
|
||||
'#885500',
|
||||
'#AADD00',
|
||||
'#99CC44',
|
||||
'#887711',
|
||||
);
|
||||
}
|
||||
|
||||
function SetupGraph($graph) {
|
||||
|
||||
// graph
|
||||
/*
|
||||
$img = $graph->img;
|
||||
$height = $img->height;
|
||||
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
|
||||
*/
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetFillColor('white');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// xaxis
|
||||
$graph->xaxis->title->SetColor($this->font_color);
|
||||
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
|
||||
$graph->xaxis->SetLabelMargin(10);
|
||||
|
||||
// yaxis
|
||||
$graph->yaxis->title->SetColor($this->font_color);
|
||||
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->yaxis->SetTickSide(SIDE_LEFT);
|
||||
$graph->yaxis->SetLabelMargin(8);
|
||||
$graph->yaxis->HideLine();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->xaxis->SetTitleMargin(15);
|
||||
|
||||
// grid
|
||||
$graph->ygrid->SetColor($this->grid_color);
|
||||
$graph->ygrid->SetLineStyle('dotted');
|
||||
|
||||
|
||||
// font
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
// $graph->img->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function SetupPieGraph($graph) {
|
||||
|
||||
// graph
|
||||
$graph->SetFrame(false);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFillColor('white');
|
||||
/*
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
*/
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// title
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
$graph->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function PreStrokeApply($graph) {
|
||||
if ($graph->legend->HasItems()) {
|
||||
$img = $graph->img;
|
||||
$graph->SetMargin(
|
||||
$img->raw_left_margin,
|
||||
$img->raw_right_margin,
|
||||
$img->raw_top_margin,
|
||||
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ApplyPlot($plot) {
|
||||
|
||||
switch (get_class($plot))
|
||||
{
|
||||
case 'GroupBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AccBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'BarPlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$color = $this->GetNextColor();
|
||||
$plot->SetColor($color);
|
||||
$plot->SetFillColor($color);
|
||||
$plot->SetShadow('red', 3, 4, false);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'LinePlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$plot->SetColor($this->GetNextColor().'@0.4');
|
||||
$plot->SetWeight(2);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot':
|
||||
{
|
||||
$plot->ShowBorder(false);
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot3D':
|
||||
{
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
179
jpgraph/src/themes/PastelTheme.class.php
Normal file
179
jpgraph/src/themes/PastelTheme.class.php
Normal file
@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Pastel Theme class
|
||||
*/
|
||||
class PastelTheme extends Theme
|
||||
{
|
||||
private $font_color = '#0044CC';
|
||||
private $background_color = '#DDFFFF';
|
||||
private $axis_color = '#0066CC';
|
||||
private $grid_color = '#3366CC';
|
||||
|
||||
function GetColorList() {
|
||||
return array(
|
||||
'#FFAACC',
|
||||
'#AAEECC',
|
||||
'#AACCFF',
|
||||
'#CCAAFF',
|
||||
'#EEDDFF',
|
||||
'#FFCCAA',
|
||||
'#CCBBDD',
|
||||
'#CCFFAA',
|
||||
'#C7D7C2',
|
||||
'#FFEEDD',
|
||||
'#FFCCEE',
|
||||
'#BFECFA',
|
||||
);
|
||||
}
|
||||
|
||||
function SetupGraph($graph) {
|
||||
|
||||
// graph
|
||||
/*
|
||||
$img = $graph->img;
|
||||
$height = $img->height;
|
||||
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
|
||||
*/
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetFillColor('white');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// xaxis
|
||||
$graph->xaxis->title->SetColor($this->font_color);
|
||||
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
|
||||
$graph->xaxis->SetLabelMargin(10);
|
||||
|
||||
// yaxis
|
||||
$graph->yaxis->title->SetColor($this->font_color);
|
||||
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->yaxis->SetTickSide(SIDE_LEFT);
|
||||
$graph->yaxis->SetLabelMargin(8);
|
||||
$graph->yaxis->HideLine();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->xaxis->SetTitleMargin(15);
|
||||
|
||||
// grid
|
||||
$graph->ygrid->SetColor($this->grid_color);
|
||||
$graph->ygrid->SetLineStyle('dotted');
|
||||
|
||||
|
||||
// font
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
// $graph->img->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function SetupPieGraph($graph) {
|
||||
|
||||
// graph
|
||||
$graph->SetFrame(false);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFillColor('white');
|
||||
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.80, 'center', 'top');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(4);
|
||||
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// title
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
$graph->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function PreStrokeApply($graph) {
|
||||
if ($graph->legend->HasItems()) {
|
||||
$img = $graph->img;
|
||||
$graph->SetMargin(
|
||||
$img->raw_left_margin,
|
||||
$img->raw_right_margin,
|
||||
$img->raw_top_margin,
|
||||
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ApplyPlot($plot) {
|
||||
|
||||
switch (get_class($plot))
|
||||
{
|
||||
case 'GroupBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AccBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'BarPlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$color = $this->GetNextColor();
|
||||
$plot->SetColor($color);
|
||||
$plot->SetFillColor($color);
|
||||
$plot->SetShadow('red', 3, 4, false);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'LinePlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
$plot->SetColor($this->GetNextColor().'@0.4');
|
||||
$plot->SetWeight(2);
|
||||
// $plot->SetBarCenter();
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot':
|
||||
{
|
||||
$plot->SetCenter(0.5, 0.45);
|
||||
$plot->ShowBorder(false);
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot3D':
|
||||
{
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
184
jpgraph/src/themes/RoseTheme.class.php
Normal file
184
jpgraph/src/themes/RoseTheme.class.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Rose Theme class
|
||||
*/
|
||||
class RoseTheme extends Theme
|
||||
{
|
||||
private $font_color = '#CC0044';
|
||||
private $background_color = '#FFDDDD';
|
||||
private $axis_color = '#CC0000';
|
||||
private $grid_color = '#CC3333';
|
||||
|
||||
function GetColorList() {
|
||||
return array(
|
||||
'#FF0000',
|
||||
'#FF99FF',
|
||||
'#AA0099',
|
||||
'#FF00FF',
|
||||
'#FF6666',
|
||||
'#FF0099',
|
||||
'#FFBB88',
|
||||
'#AA2211',
|
||||
'#FF6699',
|
||||
'#BBAA88',
|
||||
'#FF2200',
|
||||
'#883333',
|
||||
'#EE7777',
|
||||
'#EE7711',
|
||||
'#FF0066',
|
||||
'#DD7711',
|
||||
'#AA6600',
|
||||
'#EE5500',
|
||||
);
|
||||
}
|
||||
|
||||
function SetupGraph($graph) {
|
||||
|
||||
// graph
|
||||
/*
|
||||
$img = $graph->img;
|
||||
$height = $img->height;
|
||||
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
|
||||
*/
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetFillColor('white');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// xaxis
|
||||
$graph->xaxis->title->SetColor($this->font_color);
|
||||
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
|
||||
$graph->xaxis->SetLabelMargin(10);
|
||||
|
||||
// yaxis
|
||||
$graph->yaxis->title->SetColor($this->font_color);
|
||||
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->yaxis->SetTickSide(SIDE_LEFT);
|
||||
$graph->yaxis->SetLabelMargin(8);
|
||||
$graph->yaxis->HideLine();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->xaxis->SetTitleMargin(15);
|
||||
|
||||
// grid
|
||||
$graph->ygrid->SetColor($this->grid_color);
|
||||
$graph->ygrid->SetLineStyle('dotted');
|
||||
|
||||
|
||||
// font
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
// $graph->img->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function SetupPieGraph($graph) {
|
||||
|
||||
// graph
|
||||
$graph->SetFrame(false);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFillColor('white');
|
||||
/*
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
*/
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// title
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
$graph->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function PreStrokeApply($graph) {
|
||||
if ($graph->legend->HasItems()) {
|
||||
$img = $graph->img;
|
||||
$graph->SetMargin(
|
||||
$img->raw_left_margin,
|
||||
$img->raw_right_margin,
|
||||
$img->raw_top_margin,
|
||||
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ApplyPlot($plot) {
|
||||
|
||||
switch (get_class($plot))
|
||||
{
|
||||
case 'GroupBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AccBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'BarPlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$color = $this->GetNextColor();
|
||||
$plot->SetColor($color);
|
||||
$plot->SetFillColor($color);
|
||||
$plot->SetShadow('red', 3, 4, false);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'LinePlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$plot->SetColor($this->GetNextColor().'@0.4');
|
||||
$plot->SetWeight(2);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot':
|
||||
{
|
||||
$plot->ShowBorder(false);
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot3D':
|
||||
{
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
213
jpgraph/src/themes/SoftyTheme.class.php
Normal file
213
jpgraph/src/themes/SoftyTheme.class.php
Normal file
@ -0,0 +1,213 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Softy Theme class
|
||||
*/
|
||||
class SoftyTheme extends Theme
|
||||
{
|
||||
protected $font_color = '#000000';
|
||||
protected $background_color = '#F7F8F4';
|
||||
protected $axis_color = '#000000';
|
||||
protected $grid_color = '#CCCCCC';
|
||||
|
||||
function GetColorList() {
|
||||
return array(
|
||||
'#CFE7FB',
|
||||
'#F9D76F',
|
||||
'#B9D566',
|
||||
'#FFBB90',
|
||||
'#66BBBB',
|
||||
'#E69090',
|
||||
'#BB90BB',
|
||||
'#9AB67C',
|
||||
'#D1CC66',
|
||||
|
||||
/*
|
||||
|
||||
'#AFD8F8',
|
||||
'#F6BD0F',
|
||||
'#8BBA00',
|
||||
'#FF8E46',
|
||||
'#008E8E',
|
||||
|
||||
'#D64646',
|
||||
'#8E468E',
|
||||
'#588526',
|
||||
'#B3AA00',
|
||||
'#008ED6',
|
||||
|
||||
'#9D080D',
|
||||
'#A186BE',
|
||||
*/
|
||||
);
|
||||
}
|
||||
|
||||
function SetupGraph($graph) {
|
||||
|
||||
// graph
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetMarginColor('white');
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetFillColor('white');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// xaxis
|
||||
$graph->xaxis->title->SetColor($this->font_color);
|
||||
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
|
||||
$graph->xaxis->SetLabelMargin(10);
|
||||
|
||||
// yaxis
|
||||
$graph->yaxis->title->SetColor($this->font_color);
|
||||
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->yaxis->SetTickSide(SIDE_LEFT);
|
||||
$graph->yaxis->SetLabelMargin(8);
|
||||
$graph->yaxis->HideLine();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->xaxis->SetTitleMargin(15);
|
||||
|
||||
// y2~
|
||||
if (isset($graph->y2axis)) {
|
||||
$graph->y2axis->title->SetColor($this->font_color);
|
||||
$graph->y2axis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->y2axis->SetTickSide(SIDE_LEFT);
|
||||
$graph->y2axis->SetLabelMargin(8);
|
||||
$graph->y2axis->HideLine();
|
||||
$graph->y2axis->HideTicks();
|
||||
}
|
||||
|
||||
// yn
|
||||
if (isset($graph->y2axis)) {
|
||||
foreach ($graph->ynaxis as $axis) {
|
||||
$axis->title->SetColor($this->font_color);
|
||||
$axis->SetColor($this->axis_color, $this->font_color);
|
||||
$axis->SetTickSide(SIDE_LEFT);
|
||||
$axis->SetLabelMargin(8);
|
||||
$axis->HideLine();
|
||||
$axis->HideTicks();
|
||||
}
|
||||
}
|
||||
|
||||
// grid
|
||||
$graph->ygrid->SetColor($this->grid_color);
|
||||
$graph->ygrid->SetLineStyle('dotted');
|
||||
$graph->ygrid->SetFill(true, '#FFFFFF', $this->background_color);
|
||||
$graph->xgrid->Show();
|
||||
$graph->xgrid->SetColor($this->grid_color);
|
||||
$graph->xgrid->SetLineStyle('dotted');
|
||||
|
||||
|
||||
// font
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
// $graph->img->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function SetupPieGraph($graph) {
|
||||
|
||||
// graph
|
||||
$graph->SetFrame(false);
|
||||
|
||||
// title
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
$graph->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function PreStrokeApply($graph) {
|
||||
if ($graph->legend->HasItems()) {
|
||||
$img = $graph->img;
|
||||
$graph->SetMargin(
|
||||
$img->raw_left_margin,
|
||||
$img->raw_right_margin,
|
||||
$img->raw_top_margin,
|
||||
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ApplyPlot($plot) {
|
||||
|
||||
switch (get_class($plot))
|
||||
{
|
||||
case 'BarPlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$color = $this->GetNextColor();
|
||||
$plot->SetColor($color);
|
||||
$plot->SetFillColor($color);
|
||||
$plot->SetShadow('red', 3, 4, false);
|
||||
$plot->value->SetAlign('center', 'center');
|
||||
break;
|
||||
}
|
||||
|
||||
case 'LinePlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$plot->SetColor($this->GetNextColor());
|
||||
$plot->SetWeight(2);
|
||||
// $plot->SetBarCenter();
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot':
|
||||
{
|
||||
$plot->ShowBorder(false);
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 'GroupBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AccBarPlot':
|
||||
{
|
||||
$plot->value->SetAlign('center', 'center');
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
$_plot->SetValuePos('center');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'ScatterPlot':
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case 'PiePlot3D':
|
||||
{
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
187
jpgraph/src/themes/UniversalTheme.class.php
Normal file
187
jpgraph/src/themes/UniversalTheme.class.php
Normal file
@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Universal Theme class
|
||||
*/
|
||||
class UniversalTheme extends Theme
|
||||
{
|
||||
private $font_color = '#444444';
|
||||
private $background_color = '#F4F4F4';
|
||||
private $axis_color = '#888888';
|
||||
private $grid_color = '#E3E3E3';
|
||||
|
||||
function GetColorList() {
|
||||
return array(
|
||||
'#61a9f3',#blue
|
||||
'#f381b9',#red
|
||||
'#61E3A9',#green
|
||||
|
||||
#'#D56DE2',
|
||||
'#85eD82',
|
||||
'#F7b7b7',
|
||||
'#CFDF49',
|
||||
'#88d8f2',
|
||||
'#07AF7B',
|
||||
'#B9E3F9',
|
||||
'#FFF3AD',
|
||||
'#EF606A',
|
||||
'#EC8833',
|
||||
'#FFF100',
|
||||
'#87C9A5',
|
||||
);
|
||||
}
|
||||
|
||||
function SetupGraph($graph) {
|
||||
|
||||
// graph
|
||||
/*
|
||||
$img = $graph->img;
|
||||
$height = $img->height;
|
||||
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
|
||||
*/
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetBox(true, '#DADADA');
|
||||
// $graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetFillColor('white');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// xaxis
|
||||
$graph->xaxis->title->SetColor($this->font_color);
|
||||
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
|
||||
$graph->xaxis->SetLabelMargin(10);
|
||||
$graph->xaxis->HideTicks();
|
||||
$graph->xaxis->SetTitleMargin(15);
|
||||
//$graph->xaxis->SetLabelMargin(30);
|
||||
|
||||
// yaxis
|
||||
$graph->yaxis->title->SetColor($this->font_color);
|
||||
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->yaxis->SetTickSide(SIDE_LEFT);
|
||||
$graph->yaxis->SetLabelMargin(8);
|
||||
// $graph->yaxis->SetTickPositions(array(50, 100, 150));
|
||||
// $graph->yaxis->HideLine();
|
||||
$graph->yaxis->HideTicks();
|
||||
|
||||
// grid
|
||||
$graph->ygrid->SetColor($this->grid_color);
|
||||
$graph->ygrid->SetFill(true, '#FFFFFF', $this->background_color);
|
||||
// $graph->ygrid->SetLineStyle('dotted');
|
||||
|
||||
|
||||
// font
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
$graph->img->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function SetupPieGraph($graph) {
|
||||
|
||||
// graph
|
||||
$graph->SetFrame(false);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFillColor('white');
|
||||
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.80, 'center', 'top');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(4);
|
||||
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// title
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
$graph->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function PreStrokeApply($graph) {
|
||||
if ($graph->legend->HasItems()) {
|
||||
$img = $graph->img;
|
||||
$graph->SetMargin(
|
||||
$img->raw_left_margin,
|
||||
$img->raw_right_margin,
|
||||
$img->raw_top_margin,
|
||||
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ApplyPlot($plot) {
|
||||
|
||||
switch (get_class($plot))
|
||||
{
|
||||
case 'GroupBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AccBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'BarPlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$color = $this->GetNextColor();
|
||||
$plot->SetColor($color);
|
||||
$plot->SetFillColor($color);
|
||||
$plot->SetShadow('red', 3, 4, false);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'LinePlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
$plot->SetColor($this->GetNextColor().'@0.4');
|
||||
$plot->SetWeight(2);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot':
|
||||
{
|
||||
$plot->SetCenter(0.5, 0.45);
|
||||
$plot->ShowBorder(false);
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot3D':
|
||||
{
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
179
jpgraph/src/themes/VividTheme.class.php
Normal file
179
jpgraph/src/themes/VividTheme.class.php
Normal file
@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Vivid Theme class
|
||||
*/
|
||||
class VividTheme extends Theme
|
||||
{
|
||||
private $font_color = '#0044CC';
|
||||
private $background_color = '#DDFFFF';
|
||||
private $axis_color = '#0066CC';
|
||||
private $grid_color = '#3366CC';
|
||||
|
||||
function GetColorList() {
|
||||
return array(
|
||||
'#FFFB11',
|
||||
'#005EBC',
|
||||
'#9AEB67',
|
||||
'#FF4A26',
|
||||
'#FDFF98',
|
||||
'#6B7EFF',
|
||||
'#BCE02E',
|
||||
'#E0642E',
|
||||
'#E0D62E',
|
||||
'#2E97E0',
|
||||
'#02927F',
|
||||
'#FF005A',
|
||||
);
|
||||
}
|
||||
|
||||
function SetupGraph($graph) {
|
||||
|
||||
// graph
|
||||
/*
|
||||
$img = $graph->img;
|
||||
$height = $img->height;
|
||||
$graph->SetMargin($img->left_margin, $img->right_margin, $img->top_margin, $height * 0.25);
|
||||
*/
|
||||
$graph->SetFrame(false);
|
||||
$graph->SetMarginColor('white');
|
||||
$graph->SetBackgroundGradient($this->background_color, '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.85, 'center', 'top');
|
||||
$graph->legend->SetFillColor('white');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(3);
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// xaxis
|
||||
$graph->xaxis->title->SetColor($this->font_color);
|
||||
$graph->xaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->xaxis->SetTickSide(SIDE_BOTTOM);
|
||||
$graph->xaxis->SetLabelMargin(10);
|
||||
|
||||
// yaxis
|
||||
$graph->yaxis->title->SetColor($this->font_color);
|
||||
$graph->yaxis->SetColor($this->axis_color, $this->font_color);
|
||||
$graph->yaxis->SetTickSide(SIDE_LEFT);
|
||||
$graph->yaxis->SetLabelMargin(8);
|
||||
$graph->yaxis->HideLine();
|
||||
$graph->yaxis->HideTicks();
|
||||
$graph->xaxis->SetTitleMargin(15);
|
||||
|
||||
// grid
|
||||
$graph->ygrid->SetColor($this->grid_color);
|
||||
$graph->ygrid->SetLineStyle('dotted');
|
||||
|
||||
|
||||
// font
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
// $graph->img->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function SetupPieGraph($graph) {
|
||||
|
||||
// graph
|
||||
$graph->SetFrame(false);
|
||||
|
||||
// legend
|
||||
$graph->legend->SetFillColor('white');
|
||||
|
||||
$graph->legend->SetFrameWeight(0);
|
||||
$graph->legend->Pos(0.5, 0.80, 'center', 'top');
|
||||
$graph->legend->SetLayout(LEGEND_HOR);
|
||||
$graph->legend->SetColumns(4);
|
||||
|
||||
$graph->legend->SetShadow(false);
|
||||
$graph->legend->SetMarkAbsSize(5);
|
||||
|
||||
// title
|
||||
$graph->title->SetColor($this->font_color);
|
||||
$graph->subtitle->SetColor($this->font_color);
|
||||
$graph->subsubtitle->SetColor($this->font_color);
|
||||
|
||||
$graph->SetAntiAliasing();
|
||||
}
|
||||
|
||||
|
||||
function PreStrokeApply($graph) {
|
||||
if ($graph->legend->HasItems()) {
|
||||
$img = $graph->img;
|
||||
$graph->SetMargin(
|
||||
$img->raw_left_margin,
|
||||
$img->raw_right_margin,
|
||||
$img->raw_top_margin,
|
||||
is_numeric($img->raw_bottom_margin) ? $img->raw_bottom_margin : $img->height * 0.25
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ApplyPlot($plot) {
|
||||
|
||||
switch (get_class($plot))
|
||||
{
|
||||
case 'GroupBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'AccBarPlot':
|
||||
{
|
||||
foreach ($plot->plots as $_plot) {
|
||||
$this->ApplyPlot($_plot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'BarPlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
|
||||
$color = $this->GetNextColor();
|
||||
$plot->SetColor($color);
|
||||
$plot->SetFillColor($color);
|
||||
$plot->SetShadow('red', 3, 4, false);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'LinePlot':
|
||||
{
|
||||
$plot->Clear();
|
||||
$plot->SetColor($this->GetNextColor().'@0.4');
|
||||
$plot->SetWeight(2);
|
||||
// $plot->SetBarCenter();
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot':
|
||||
{
|
||||
$plot->SetCenter(0.5, 0.45);
|
||||
$plot->ShowBorder(false);
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
case 'PiePlot3D':
|
||||
{
|
||||
$plot->SetSliceColors($this->GetThemeColors());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user