本文整理汇总了PHP中BarPlot::setBackgroundColor方法的典型用法代码示例。如果您正苦于以下问题:PHP BarPlot::setBackgroundColor方法的具体用法?PHP BarPlot::setBackgroundColor怎么用?PHP BarPlot::setBackgroundColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BarPlot
的用法示例。
在下文中一共展示了BarPlot::setBackgroundColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _renderPlotBar
private function _renderPlotBar($groupID, $dimensions = '2d')
{
$rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection();
// Rotate for bar rather than column chart
if ($groupID == 0 && $rotation == 'bar') {
$this->_graph->Set90AndMargin();
}
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation);
// Rotate for bar rather than column chart
if ($rotation == 'bar') {
$datasetLabels = array_reverse($datasetLabels);
$this->_graph->yaxis->SetPos('max');
$this->_graph->yaxis->SetLabelAlign('center', 'top');
$this->_graph->yaxis->SetLabelSide(SIDE_RIGHT);
}
$this->_graph->xaxis->SetTickLabels($datasetLabels);
}
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
if ($grouping == 'percentStacked') {
$sumValues = $this->_percentageSumCalculation($groupID, $seriesCount);
}
// Loop through each data series in turn
for ($j = 0; $j < $seriesCount; ++$j) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
if ($grouping == 'percentStacked') {
$dataValues = $this->_percentageAdjustValues($dataValues, $sumValues);
}
// Fill in any missing values in the $dataValues array
$testCurrentIndex = 0;
foreach ($dataValues as $k => $dataValue) {
while ($k != $testCurrentIndex) {
$dataValues[$testCurrentIndex] = null;
++$testCurrentIndex;
}
++$testCurrentIndex;
}
// Reverse the $dataValues order for bar rather than column chart
if ($rotation == 'bar') {
$dataValues = array_reverse($dataValues);
}
$seriesPlot = new BarPlot($dataValues);
$seriesPlot->setBackgroundColor('black');
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]);
if ($dimensions == '3d') {
$seriesPlot->SetShadow();
}
if (!$this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) {
$dataLabel = '';
} else {
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue();
}
$seriesPlot->SetLegend($dataLabel);
$seriesPlots[] = $seriesPlot;
}
// Reverse the plot order for bar rather than column chart
if ($rotation == 'bar' && !($grouping == 'percentStacked')) {
$seriesPlots = array_reverse($seriesPlots);
}
if ($grouping == 'clustered') {
$groupPlot = new GroupBarPlot($seriesPlots);
} elseif ($grouping == 'standard') {
$groupPlot = new GroupBarPlot($seriesPlots);
} else {
$groupPlot = new AccBarPlot($seriesPlots);
if ($dimensions == '3d') {
$groupPlot->SetShadow();
}
}
$this->_graph->Add($groupPlot);
}
示例2: dis_chart_bar
function dis_chart_bar($chart) {
$values = $chart["values"];
$labels = $chart["labels"];
$title = $chart["title"];
$xlabels = $chart["xlabels"];
$graph = new Graph(600, 250);
$graph->setAntiAliasing(TRUE);
// Chart infos : colors, size, shaow
$plot = new BarPlot($values, 1, 1);
$plot->setBarColor(new Color(42, 71, 180));
$plot->setBackgroundColor(new Color(240, 240, 240));
$plot->setBarSize(0.6);
$plot->setSpace(3, 3, NULL, NULL);
$plot->barShadow->setSize(2);
$plot->barShadow->smooth(TRUE);
// Labels infos
$label = new Label($labels);
$label->setFont(new Tuffy(8));
$label->setAlign(NULL, LABEL_TOP);
$plot->label = $label;
// X axis Labels infos
$xlabel = new Label($xlabels);
$plot->xAxis->setlabelText($xlabels);
// Title infos
if ($title != "") {
$graph->title->set("$title");
}
$graph->add($plot);
$graph->draw();
}