5

PHPでJpGraphを使用しました。すべて問題ありませんが、スライス ($p1->SetSliceColors($color);) の色は機能しません。それは常にデフォルトの色です。これが私の使用コードです。私を助けてください :

    $data    = array('40','50', '10');
    $Legends = array('Loss','Win',  'Draw');
    $labels  = array("Loss\n(%.1f%%)","Win\n(%.1f%%)","Draw\n(%.1f%%)");
    $color   = array('red','red','red');
    $graph   = new PieGraph(550,350);
    $graph->SetShadow();

    $p1 = new PiePlot3D($data);
    $p1->ExplodeSlice(1);
    $p1->SetCenter(0.55);
    $p1->SetLegends($Legends);
    $graph->legend->Pos(0.5,0.1);


    $p1->SetTheme("earth");
    $p1->SetSliceColors($color);

    // Setup the labels to be displayed
    $p1->SetLabels($labels);
    $p1->SetLabelPos(1);
    $p1->SetLabelType(PIE_VALUE_PER);
    $p1->value->Show();
    $p1->value->SetFont(FF_FONT1,FS_NORMAL,9);
    $p1->value->SetColor('navy');

    $graph->Add($p1);
    $graph->Stroke();
4

2 に答える 2

12

私も同じ問題を抱えていました。色を設定する前に Add メソッドを呼び出します。

$p1 = new PiePlot3D($data);
$graph->Add($p1);

折れ線グラフ・棒グラフの表示設定を変更する

于 2011-05-23T10:10:37.777 に答える
5

試す

 $graph   = new PieGraph(550,350);
 $graph->ClearTheme();

除外する

 $p1->SetTheme("earth");

SetSliceColors はうまくいきました。

于 2011-04-06T12:41:57.390 に答える