0

jpgraph を使用してグラフを作成しましたが、動作しますが、x 軸のラベルの長さが原因で、一部のテキストが「カットオフ」されて表示されません。改行を使用するカスタム関数を作成しましたが、それでもチャートのラベルの 1 つでいくつかの文字が削除されます。

x軸ラベルの実際の長さを実際に定義する方法はありますか?たとえば、幅をピクセル単位で設定しますか? ありがとう

        // Create the graph. These two calls are always required
    $graph = new Graph(1000,500,'auto');
    $graph->SetScale("textlin");

    //$theme_class="DefaultTheme";
    //$graph->SetTheme(new $theme_class());

    // set major and minor tick positions manually
    $graph->yaxis->SetTickPositions(array(0,1,2,3,4,5), array(0.5,1.5,2.5,3.5,4.5));
    $graph->SetBox(false);

    //$graph->ygrid->SetColor('gray');
    $graph->ygrid->SetFill(false);
    $graph->xaxis->SetLabelAngle(90); // 45 degrees angle
    $graph->xaxis->SetTickLabels($new_labels);
    $graph->yaxis->HideLine(false);
    $graph->yaxis->HideTicks(false,false);

    // Create the bar plots
    $b1plot = new BarPlot($data);

    // ...and add it to the graPH
    $graph->Add($b1plot);        

    $b1plot->SetColor("white");
    $b1plot->SetFillGradient("#4B0082","white",GRAD_LEFT_REFLECTION);
    $b1plot->SetWidth(45);
    $graph->title->Set("Bar Gradient(Left reflection)");

    // Display the graph
    $graph->Stroke();
4

2 に答える 2

0

Figured out (almost) Just in case anyone else needs help use the following:

$graph->xaxis->SetLabelAlign('right','center','right');
于 2012-08-01T15:58:33.190 に答える
0

ラベルの長さを設定できないと思います。$graph->setMargin(a,b,c,d);またはを使用してグラフの余白を設定する必要があり$graph->Set90AndMargin(a,b,c,d);ます。a - 左、b - 右、c - 上、d - 下の余白。

これらの関数に関するドキュメントを調べてください。回転したグラフと少し混乱する可能性があります。

于 2013-08-22T01:01:28.957 に答える