【问题标题】:How to Change Theme On 3D Pie for JpChart如何更改 JpChart 的 3D 饼图主题
【发布时间】:2019-10-03 22:27:54
【问题描述】:

我无法在 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);

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

【问题讨论】:

    标签: php jpgraph


    【解决方案1】:

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

    下面显示的更改应该有效:

    // 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");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-15
      • 1970-01-01
      相关资源
      最近更新 更多