当前位置: 首页>>代码示例>>PHP>>正文


PHP BarPlot::setBackgroundColor方法代码示例

本文整理汇总了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);
 }
开发者ID:jjechev,项目名称:phpTdConvert,代码行数:75,代码来源:jpgraph.php

示例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();
}
开发者ID:Kervinou,项目名称:OBM,代码行数:37,代码来源:chart_index.php


注:本文中的BarPlot::setBackgroundColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。