パスワードを忘れた? アカウント作成
82042 journal

k3mの日記: PHPlotの円グラフの描き方を修正

日記 by k3m
PHPlotで円グラフを作成すると、右から反時計回りで描かれるので、それを上から時計回りに描くようにfunction DrawPieChart()を修正してみました。

--- phplot.php.orig 2009-01-22 12:05:02.000000000 +0900
+++ phplot.php 2009-04-09 19:51:37.000000000 +0900
@@ -4085,11 +4085,11 @@
                                  $end_angle += $val;
                                  // This method of conversion to integer - truncate after reversing it - was
                                  // chosen to match the implicit method of PHPlot<=5.0.4 to get the same slices.
- $arc_start_angle = (int)(360 - $start_angle);
- $arc_end_angle = (int)(360 - $end_angle);
+ $arc_start_angle = (int)($end_angle + 270);
+ $arc_end_angle = (int)($start_angle + 270);

                                  if ($arc_start_angle > $arc_end_angle) {
- $mid_angle = deg2rad($end_angle - ($val / 2));
+ $mid_angle = deg2rad(90 - ($end_angle - ($val / 2)));
この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
typodupeerror

UNIXはただ死んだだけでなく、本当にひどい臭いを放ち始めている -- あるソフトウェアエンジニア

読み込み中...