public function execute($request) { $this->data = $this->getGraphService()->getEmployeeCountBySubUnit(); if (count($this->data) > 0) { $pieChart = new PieChart(); $pieChart->setChartNumber('emp_distribution'); $pieChart->setWidth(300); $pieChart->setHeight(225); $pieChart->setStyles(array('margin-top' => '10px')); $dataFormatter = new GraphDataFormatter(); $dataFormatter->setGroupMappings(array('default-label' => '---', 'label-index' => 'name', 'value-index' => 'COUNT')); $pieChart->setDataFormatter($dataFormatter); $metaDataObject = new GraphMetaData(); $legend = new GraphLegendData(); $legend->setLegendDivId('div_legend_pim_employee_distribution'); $legend->setUseSeparateContainer(true); $legend->setLabels($dataFormatter->extractLabels($this->data, 'name')); $metaDataObject->setLegend($legend); $pieChart->setData($this->data); $pieChart->setPropertes(array('show-legend' => true, 'show-labels' => true, 'interactive' => true, 'suffixForValueHover' => 'Employee(s)')); $pieChart->setMetaDataObject($metaDataObject); $this->chart = $pieChart; } }
} else { array_push($matchtype, $data[$c]); } } } } require_once "/var/www/ChartDirector/lib/phpchartdir.php"; # Create a PieChart object of size 360 x 300 pixels $c = new PieChart(780, 390); # Set the center of the pie at (180, 140) and the radius to 100 pixels $c->setPieSize(410, 215, 195); # Add a title to the pie chart $c->addTitle($display_date); # Set the color palette $colors = array(0x3e8e35, 0x8fc28a, 0x2c7524, 0xe38919, 0xf8930d, 0xa86916, 0xc2965d); # Set the font $c->setLabelStyle("arial.ttf", 10); # Set the sector colors $c->setColors2(DataColor, $colors); # Set the gradient $c->setSectorStyle(LocalGradientShading); # Draw the pie in 3D $c->set3D(); $c->addLegend(0, 0); $c->setLabelFormat("{percent}%"); # Set the pie data and the pie labels $c->setData($count, $matchtype); # Explode the 1st sector (index = 0) $c->setExplode(0); $filename = $path . "/provider/charts/tempimages/" . $imagename; $c->makeChart($filename);
} else { array_push($services, $data[$c]); } } } } require_once "/var/www/ChartDirector/lib/phpchartdir.php"; # Create a PieChart object of size 360 x 300 pixels $c = new PieChart(770, 390); # Set the center of the pie at (180, 140) and the radius to 100 pixels $c->setPieSize(470, 200, 180); # Add a title to the pie chart $c->addTitle($display_date . ' / ' . $display_geo . ' / ' . $display_searchtype); # Set the color palette $colors = array(0x378a30, 0x71cb68, 0x276a21, 0x7bb372, 0xe8fee7, 0x5d9758, 0x355e72, 0x6699b6, 0x6a9db8, 0x7fb0ce, 0x95c8e5, 0x699cb9, 0xd47710, 0xde8a30, 0xd37108, 0xd29039, 0xf29e43, 0xee7d05); # Set the font $c->setLabelStyle("arial.ttf", 9); # Set the sector colors $c->setColors2(DataColor, $colors); # Set the gradient $c->setSectorStyle(LocalGradientShading); # Draw the pie in 3D $c->set3D(); $c->addLegend(0, 30); $c->setLabelFormat("{percent}%"); # Set the pie data and the pie labels $c->setData($searches, $services); # Explode the 1st sector (index = 0) $c->setExplode(0); $filename = $path . "/provider/charts/tempimages/" . $imagename; $c->makeChart($filename);
$servicecategoryname = array(); $numsearches = array(); while ($rs = pg_fetch_array($res_pop_services)) { array_push($servicecategoryname, trim($rs['servicecategoryname'])); array_push($numsearches, trim($rs['numsearches'])); } require_once "/var/www/ChartDirector/lib/phpchartdir.php"; # Create a PieChart object of size 360 x 300 pixels $c = new PieChart(720, 390); # Set the center of the pie at (180, 140) and the radius to 100 pixels $c->setPieSize(410, 270, 110); # Add a title to the pie chart $c->addTitle("Most popular services in my area"); # Draw the pie in 3D $c->set3D(); $c->addLegend(10, 60); $c->setLabelFormat("{percent}%"); # Set the pie data and the pie labels $c->setData($numsearches, $servicecategoryname); # Explode the 1st sector (index = 0) $c->setExplode(0); if ($data1 == 1) { $filename = $path . "/provider/charts/defaultimages/" . $imagename; } else { $filename = $path . "/provider/charts/tempimages/" . $imagename; } if (file_exists($filename)) { unlink($filename); } $c->makeChart($filename); }