Ideally, I'd like to set slice borders but not circumference border.
I tried this:
$p1 = new PiePlotC($data);
$p1->ShowBorder(true);
$p1->SetColor('blue');
I also tried $p1->ShowBorder(false, true);
No border appeared.
I noticed that the theme: UniversalTheme set the border to false.
I remmed those lines out of the theme.
case 'PiePlot':
{
//$plot->SetCenter(0.5, 0.45);
//$plot->ShowBorder(false);
//$plot->SetSliceColors($this->GetThemeColors());
break;
}
That did not help.
The pie slice colors did appear even though I remmed that line out.
I know that theme is the one used because I had to rem:
$plot->SetCenter(0.5, 0.45); out to be able to move the pie.
That worked.
I think it's a bad design to have the theme overwrite settings set by the client (user). The user's settings should override the theme.
How can I set borders for each slice in a PiePlotC?
Also, how can I set the size (line width) of the borders?
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/Business/Config.php');
require_once (BASE_PATH . '/PHPJpGraph/jpgraph.php');
require_once (BASE_PATH . '/PHPJpGraph/jpgraph_pie.php');
$data = array(50,28,25,27,31,20);
// A new pie graph
$graph = new PieGraph(1000,1000,'auto');
$graph->SetFrame(false);
$graph->title->Set("PiePlotC");
$graph->title->SetFont(FF_ARIAL,FS_BOLD,18);
$graph->title->SetMargin(8); // Add a little bit more margin from the top
$p1 = new PiePlotC($data);
//$p1->clearTheme();
$p1->ShowBorder(true);
$p1->SetColor('blue');
//$p1->SetBorder($aWeight, $aColor);
$p1->SetLabelType(PIE_VALUE_ABS);
$p1->value->SetFormat("%d");
$p1->SetSize(0.35);
$p1->SetCenter(0.5, 0.5);
$p1->value->SetFont(FF_ARIAL,FS_BOLD,12);
$p1->value->Show();
$p1->SetMidSize(0.75);
$p1->midtitle->Set("Test mid\nRow 1\nRow 2");
$p1->midtitle->SetFont(FF_ARIAL,FS_NORMAL,12);
$p1->SetMidColor('white');
$p1->SetLabelType(PIE_VALUE_ABS);
$lbl = array("adam\n%.1f","bertil\n%.1f","johan\n%.1f",
"peter\n%.1f","daniel\n%.1f","erik\n%.1f%%");
$p1->SetLabels($lbl);
$graph->Add($p1);
$graph->Stroke();
Right after the new PieGraph clear the default theme using
$graph->clearTheme();and see if that helps.I find nothing in the examples or documentation that indicates that the borders and size for pie slices may be changed. You may want to see if using ExplodeAll
$p1->ExplodeAll(5);would help. There are also options to explode 1 or more slices but not all of them. And there are several themes provide as well as the option to set the colors of each slice yourself.