コード例 #1
0
 public function columnChart($title, $labels, $data, $unit)
 {
     //        debug($title);
     //        debug($labels);
     //        debug($data);
     //        debug($unit);
     //        debug(array_values($data));
     //        return;
     //        if (sizeof($data) == 1){
     //            $data[] = $data[0]+1;
     //            $labels[] = '参照物';
     //        }
     require $this->KoolControlsFolder . "/KoolChart/koolchart.php";
     $chart = new KoolChart("chart");
     $chart->scriptFolder = $this->KoolControlsFolder . "/KoolChart";
     $chart->Title->Text = $title;
     $chart->Width = 820;
     $chart->Height = 500;
     //$chart->BackgroundColor = "#ffffee";
     //        $chart->PlotArea->XAxis->Title = "Quarters";
     if (count($data) == 0) {
         $maxV = 0;
     } else {
         $maxV = max($data);
     }
     $chart->PlotArea->XAxis->Set($labels);
     $chart->PlotArea->YAxis->MinValue = 0;
     $chart->PlotArea->YAxis->MaxValue = $maxV;
     $chart->PlotArea->YAxis->Title = "注册人数 ( .{$unit})";
     $chart->PlotArea->YAxis->LabelsAppearance->DataFormatString = "\$ {0}";
     $chart->PlotArea->YAxis->MajorStep = $maxV < 5 ? $maxV : (int) ($maxV / 5);
     $series = new ColumnSeries();
     $series->Name = "人数";
     $series->TooltipsAppearance->DataFormatString = "\$ {0} {$unit}";
     $series->ArrayData($data);
     $chart->PlotArea->AddSeries($series);
     //        $chart->Render();
     return $chart->Render();
     //        debug($chart);
     //        $series = new ColumnSeries();
     //        $series->Name = "Computers";
     //        $series->TooltipsAppearance->DataFormatString = "$ {0} millions";
     //        $series->ArrayData(array(34, 55, 10, 40));
     //        $chart->PlotArea->AddSeries($series);
     //
     //        $series = new ColumnSeries();
     //        $series->Name = "Tablets & e-readers";
     //        $series->TooltipsAppearance->DataFormatString = "$ {0} millions";
     //        $series->ArrayData(array(56, 23, 56, 80));
     //        $chart->PlotArea->AddSeries($series);
 }
コード例 #2
0
$chart_column_line->Legend->Appearance->Visible = false;
$chart_column_line->PlotArea->XAxis->Title = "";
$chart_column_line->PlotArea->XAxis->Color = "black";
$chart_column_line->PlotArea->XAxis->MajorGridLines->Color = "#b4b4b4";
$chart_column_line->PlotArea->XAxis->MinorGridLines->Color = "#d2d2d2";
$chart_column_line->PlotArea->XAxis->Set(array("Q1", "Q2", "Q3", "Q4", "Q5"));
$chart_column_line->PlotArea->YAxis->Title = "";
$chart_column_line->PlotArea->YAxis->MinorTickSize = 0;
$chart_column_line->PlotArea->YAxis->MaxValue = 100;
$chart_column_line->PlotArea->YAxis->MinValue = 0;
$chart_column_line->PlotArea->YAxis->MajorStep = 10;
$chart_column_line->PlotArea->YAxis->MinorStep = 2;
$chart_column_line->PlotArea->YAxis->Color = "black";
$chart_column_line->PlotArea->YAxis->MajorGridLines->Color = "#b4b4b4";
$chart_column_line->PlotArea->YAxis->MinorGridLines->Color = "#d2d2d2";
$series = new ColumnSeries();
$series->Appearance->BackgroundColor = "#5CB8E3";
$series->ArrayData(array(20, 30, 40, 70, 50));
$chart_column_line->PlotArea->AddSeries($series);
$series = new LineSeries();
$series->Appearance->BackgroundColor = "green";
$series->ArrayData(array(76, 15, 60, 35, 80));
$chart_column_line->PlotArea->AddSeries($series);
?>

<form id="form1" method="post">
	
	<div>
		<?php 
echo $chart_scatter->Render();
?>
コード例 #3
0
//$chart->BackgroundColor = "#ffffee";
$chart->PlotArea->XAxis->Title = "Quarters";
$chart->PlotArea->XAxis->Set(array("Q1", "Q2", "Q3", "Q4"));
$chart->PlotArea->YAxis->Title = "Sales ( .millions)";
$chart->PlotArea->YAxis->LabelsAppearance->DataFormatString = "\$ {0}";
$series = new ColumnSeries();
$series->Name = "TVs";
$series->TooltipsAppearance->DataFormatString = "\$ {0} millions";
$series->ArrayData(array(20, 30, 40, 70));
$chart->PlotArea->AddSeries($series);
$series = new ColumnSeries();
$series->Name = "Computers";
$series->TooltipsAppearance->DataFormatString = "\$ {0} millions";
$series->ArrayData(array(34, 55, 10, 40));
$chart->PlotArea->AddSeries($series);
$series = new ColumnSeries();
$series->Name = "Tablets & e-readers";
$series->TooltipsAppearance->DataFormatString = "\$ {0} millions";
$series->ArrayData(array(56, 23, 56, 80));
$chart->PlotArea->AddSeries($series);
$chart->ClientEvents["OnItemOver"] = "Handle_OnItemOver";
$chart->ClientEvents["OnItemClick"] = "Handle_OnItemClick";
$chart->ClientEvents["OnItemDblClick"] = "Handle_OnItemDblClick";
?>

<form id="form1" method="post">

	<style>
		#log
		{
			width:670px;
コード例 #4
0
//var_dump($date);
//var_dump($count);
for ($i = 0; $i < count($count); $i++) {
    $count[$i] = (int) $count[$i];
}
$chart = new KoolChart("chart");
$chart->scriptFolder = $KoolControlsFolder . "/KoolChart";
$chart->Title->Text = "注册统计";
$chart->Width = 1280;
$chart->Height = 1024;
$chart->Legend->Appearance->Position = "top";
$chart->PlotArea->XAxis->Title = "时间";
$chart->PlotArea->XAxis->Set($date);
$chart->PlotArea->YAxis->Title = "注册人数";
$chart->PlotArea->YAxis->LabelsAppearance->DataFormatString = "{0}";
$series = new ColumnSeries();
$series->Name = "人数";
$series->TooltipsAppearance->DataFormatString = "{0}人";
$series->ArrayData($count);
$chart->PlotArea->AddSeries($series);
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8;"  />
        <title>注册人数统计</title>
    </head>
    <body>
        <form id="form1" method="post">
            <?php 
echo $koolajax->Render();
?>