Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何更改JpChart的3D饼图主题_Php_Jpgraph - Fatal编程技术网

Php 如何更改JpChart的3D饼图主题

Php 如何更改JpChart的3D饼图主题,php,jpgraph,Php,Jpgraph,我无法在3D饼图上更改主题或切片颜色。我的代码是: $graph = new PieGraph(350,250); $graph->SetShadow(); $graph->title->SetFont(FF_VERDANA,FS_BOLD,18); $graph->title->SetColor("darkblue"); $graph->legend->Pos(0.1,0.9); // Create 3D pie plot $p1 = new P

我无法在3D饼图上更改主题或切片颜色。我的代码是:

$graph = new PieGraph(350,250);
$graph->SetShadow();

$graph->title->SetFont(FF_VERDANA,FS_BOLD,18); 
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.1,0.9);

// Create 3D pie plot
$p1 = new PiePlot3d($data);
$p1->SetLegends($legends);
$p1->SetTheme("earth");
$p1->SetCenter(0.4);
$p1->SetSize(100);
$p1->SetSliceColors(array("red","blue","yellow","orange"));

$p1->SetAngle(45);

$p1->value->SetFont(FF_ARIAL,FS_BOLD,8);
$p1->value->SetColor("navy");

$graph->Add($p1);

无论我做什么,颜色都不会改变。我遗漏了什么吗?

在更改主题和颜色之前,将绘图添加到图表中。如果你仔细想想,这是非常有道理的。您必须先创建(定义/添加)某些内容,然后才能对其进行修改

以下所示的更改应该有效:

// Create 3D pie plot
$p1 = new PiePlot3d($data);

$graph->Add($p1);  // moved adding the plot to the graph before changing other things

$p1->SetLegends($legends);
$p1->SetTheme("earth");
$p1->SetCenter(0.4);
$p1->SetSize(100);
$p1->SetSliceColors(array("red","blue","yellow","orange"));
$p1->SetAngle(45);
$p1->value->SetFont(FF_ARIAL,FS_BOLD,8);
$p1->value->SetColor("navy");

在更改主题和颜色之前,将绘图添加到图形中。如果你仔细想想,这是非常有道理的。您必须先创建(定义/添加)某些内容,然后才能对其进行修改

以下所示的更改应该有效:

// Create 3D pie plot
$p1 = new PiePlot3d($data);

$graph->Add($p1);  // moved adding the plot to the graph before changing other things

$p1->SetLegends($legends);
$p1->SetTheme("earth");
$p1->SetCenter(0.4);
$p1->SetSize(100);
$p1->SetSliceColors(array("red","blue","yellow","orange"));
$p1->SetAngle(45);
$p1->value->SetFont(FF_ARIAL,FS_BOLD,8);
$p1->value->SetColor("navy");