<?php include "../jpgraph.php"; include "../jpgraph_radar.php"; // Some data to plot $data = array(55, 80, 46, 71, 95); // Create the graph and the plot $graph = new RadarGraph(300, 200, "auto"); $graph->title->Set('Weekly goals'); $graph->subtitle->Set('Year 2003'); $plot = new RadarPlot($data); $plot->SetFillColor('lightred'); $graph->SetSize(0.6); $graph->SetPos(0.5, 0.6); // Add the plot and display the graph $graph->Add($plot); $graph->Stroke();
public function radarGraph_3(&$data, &$data_pro, $project_id) { require_once '../app/classes/jpgraph/jpgraph_radar.php'; require_once '../app/classes/jpgraph/jpgraph_iconplot.php'; //数组处理 $title_array = array(); $sys_array = array(); $pro_array = array(); foreach ($data['advantage']['value'] as $value) { $data_pro_tmp = $data_pro; $title_array[] = $value['chs_name']; $sys_array[] = $value['score']; $data_pro_tmp = array_flip($data_pro_tmp); $key = $data_pro_tmp[trim($value['chs_name'])]; $pro_array[] = $data_pro[$key + 1]; } foreach ($data['disadvantage']['value'] as $value) { $data_pro_tmp = $data_pro; $title_array[] = $value['chs_name']; $sys_array[] = $value['score']; $data_pro_tmp = array_flip($data_pro_tmp); $key = $data_pro_tmp[trim($value['chs_name'])]; $pro_array[] = $data_pro[$key + 1]; } // Create the basic rtadar graph $graph = new RadarGraph(600, 450); // Set background color and shadow $graph->SetColor("white"); // $graph->SetShadow(); // Position the graph $graph->SetCenter(0.45, 0.5); $graph->SetTitles($title_array); // Setup the axis formatting $graph->axis->title->SetFont(FF_CHINESE, FS_NORMAL, 11); $graph->axis->SetFont(FF_FONT1, FS_BOLD, 11); $graph->axis->SetWeight(1); // Setup the grid lines $graph->grid->SetLineStyle("solid"); $graph->grid->SetColor("gray"); $graph->grid->Show(); $graph->SetGridDepth(DEPTH_BACK); $graph->SetSize(0.6); $graph->HideTickMarks(); // Setup graph titles // Create the first radar plot $plot = new RadarPlot($pro_array); $plot->SetLegend("胜任标准"); $plot->SetColor("blue", "lightblue"); $plot->SetFill(false); $plot->SetLineWeight(3); // Create the second radar plot $plot2 = new RadarPlot($sys_array); $plot2->SetLegend("个人测评值"); $plot2->SetColor("red", "lightred"); $plot2->mark->SetType(MARK_IMG_SBALL, 'red'); $plot2->SetFill(false); $plot2->SetLineWeight(3); // Add the plots to the graph $graph->Add($plot); $graph->Add($plot2); $date = date('H_i_s'); $stamp = rand(100, 900); $fileName = './tmp/' . $project_id . $date . '_' . $stamp . '.jpeg'; $graph->Stroke($fileName); return $fileName; }