本文整理汇总了PHP中pData::drawAll方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::drawAll方法的具体用法?PHP pData::drawAll怎么用?PHP pData::drawAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::drawAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ($arrSeries as $serie) {
if (in_array($serie, $arrSeriesY2)) {
$myData->setSerieDrawable($serie, TRUE);
} else {
$myData->setSerieDrawable($serie, FALSE);
}
}
$myPicture->drawLineChart();
if ($plot == 1) {
$myPicture->drawPlotChart(array("DisplayValues" => FALSE, "PlotSize" => $weight * 1.5 + 3, "PlotBorder" => TRUE, "BorderSize" => 0.8, "BorderAlpha" => 75, "Surrounding" => -30));
}
if ($plot == 2) {
$myPicture->drawPlotChart(array("DisplayValues" => TRUE, "PlotSize" => $weight * 1.5 + 3, "PlotBorder" => TRUE, "BorderSize" => 0.8, "BorderAlpha" => 75, "Surrounding" => -30));
}
}
$myData->drawAll();
/* Write the data bounds */
$boundSetting = array("DrawBox" => FALSE, "MaxLabelTxt" => 'Max:', "MinLabelTxt" => 'Min:', "MinDisplayR" => 0, "MinDisplayG" => 0, "MinDisplayB" => 0, "DisplayOffset" => 5);
if ($bound == 'min') {
$myPicture->writeBounds(BOUND_MIN, $boundSetting);
}
if ($bound == 'max') {
$myPicture->writeBounds(BOUND_MAX, $boundSetting);
}
if ($bound == 'both') {
$myPicture->writeBounds(BOUND_BOTH, $boundSetting);
}
}
}
/* Render the picture (choose the best way) */
if ($resultType == 'charttable') {
示例2: pData
//.........这里部分代码省略.........
// Make scales based on 5% of the range of values
$scaleMax = round($range * 0.05 + $scaleMax);
if ($scaleMin < 0) {
$scaleMin = $scaleMin - round($range * 0.05);
}
$AxisBoundaries = array(0 => array("Min" => $scaleMin, "Max" => $scaleMax));
$scaleSettings["Mode"] = SCALE_MODE_MANUAL;
$scaleSettings["ManualScale"] = $AxisBoundaries;
} else {
if ($barexists) {
$scaleMin = "Unknown";
$scaleMax = 0;
foreach ($this->plot as $k => $v) {
if ($v["type"] == "BAR" || $v["type"] == "STACKEDBAR") {
$series = $v["name"] . $k;
$min = $graphData->getMin($series);
if ($scaleMin == "Unknown" || $min < $scaleMin) {
$scaleMin = $min;
}
$max = $graphData->getMax($series);
if ($scaleMax == "Unknown" || $max > $scaleMax) {
$scaleMax = $max;
}
}
}
if ($scaleMin > 0) {
$scaleMin = 0;
}
$range = $scaleMax - $scaleMin;
// Make scales based on 5% of the range of values
$scaleMax = round($range * 0.05 + $scaleMax);
if ($scaleMin < 0) {
$scaleMin = $scaleMin - round($range * 0.05);
}
$AxisBoundaries = array(0 => array("Min" => $scaleMin, "Max" => $scaleMax));
$scaleSettings["Mode"] = SCALE_MODE_MANUAL;
$scaleSettings["ManualScale"] = $AxisBoundaries;
}
}
$graphImage->drawScale($scaleSettings);
// If there's a Pie chart we want to draw different legends
$piechart = false;
foreach ($this->plot as $k => $v) {
foreach ($this->plot as $k1 => $v1) {
$series = $v1["name"] . $k1;
$graphData->setSerieDrawable($series, FALSE);
}
$series = $v["name"] . $k;
$graphData->setSerieDrawable($series, TRUE);
switch ($v["type"]) {
case "PIE":
$piechart = true;
$pie = new pPie($graphImage, $graphData);
//$pie->draw2DPie($width_actual / 2,$height_actual / 2,80,array("DrawLabels"=>TRUE,"LabelStacked"=>TRUE,"Border"=>TRUE));
$pie->draw2DPie($width_actual / 2, $height_actual / 2, 80, array("WriteValues" => PIE_VALUE_PERCENTAGE, "DataGapAngle" => 10, "DataGapRadius" => 6, "Border" => TRUE, "BorderR" => 255, "BorderG" => 255, "BorderB" => 255));
break;
case "PIE3D":
$piechart = true;
$pie = new pPie($graphImage, $graphData);
$pie->draw3DPie($this->width_actual / 2, $this->height_actual / 2, 80, array("SecondPass" => FALSE));
break;
case "STACKEDBAR":
case "BAR":
if ($stackeddrawn) {
break;
}
if ($barexists) {
foreach ($this->plot as $k1 => $v1) {
if ($v1["type"] == "BAR" || $v1["type"] == "STACKEDBAR") {
$graphData->setSerieDrawable($v1["name"] . $k1, TRUE);
}
}
}
$stackeddrawn = true;
$settings = array("Surrounding" => -30, "InnerSurrounding" => 30);
if ($stackedexists) {
$graphImage->drawStackedBarChart($settings);
} else {
$graphImage->drawBarChart($settings);
}
break;
case "LINE":
default:
if (count($v["data"]) == 1) {
$v["data"][] = 0;
}
$graphImage->drawLineChart($settings);
break;
}
}
$graphData->drawAll();
if ($piechart) {
$pie->drawPieLegend($this->width_actual - 100, 30, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));
} else {
$graphImage->drawLegend($this->width_actual - 180, 22, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));
}
$graphImage->setShadow(TRUE, array("X" => 0, "Y" => 0, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$graphImage->render($outputfile);
return true;
}
示例3: array
$myPicture->drawFilledRectangle(50, 60, 670, 340, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
$axisBoundaries = array(0 => array("Min" => 0, "Max" => $yaxis - 1));
$scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawXLines" => FALSE, "MinDivHeight" => 50, "DrawSubTicks" => FALSE, "CycleBackground" => TRUE, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => $axisBoundaries);
$myPicture->drawScale($scaleSettings);
/* Graph title */
//$myPicture->setFontProperties(array("FontName"=>"../pChart/fonts/Forgotte.ttf","FontSize"=>11));
//$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
//$myPicture->drawText(50,52,"Chart subtitle",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
$Palette = array("0" => array("R" => 32, "G" => 74, "B" => 140, "Alpha" => 100), "1" => array("R" => 32, "G" => 74, "B" => 140, "Alpha" => 100), "2" => array("R" => 69, "G" => 43, "B" => 135, "Alpha" => 100), "3" => array("R" => 69, "G" => 43, "B" => 135, "Alpha" => 100));
/* Draw the bar chart chart */
$myPicture->setFontProperties(array("FontName" => "../pChart/fonts/verdana.ttf", "FontSize" => 10));
$data->setSerieDrawable("Last year", FALSE);
$myPicture->drawBarChart(array("DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "DisplayOrientation" => ORIENTATION_HORIZONTAL, "Surrounding" => 30, "OverrideColors" => $Palette, "DisplayColor" => DISPLAY_MANUAL, "DisplayR" => 255, "DisplayG" => 255, "DisplayB" => 255));
$myPicture->drawThresholdArea($result->Benchmark_Low, $result->Benchmark_High, array("R" => 177, "G" => 221, "B" => 207, "Alpha" => 40));
/* Make sure all series are drawable before writing the scale */
$data->drawAll();
/* Write the legend */
//$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
//$myPicture->drawLegend(580,35,array("Style"=>LEGEND_ROUND,"Alpha"=>20,"Mode"=>LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
//$myPicture->autoOutput("pictures/example.combo.png");
$myPicture->Stroke();
} else {
$entries = $tc->getEntries();
$metrics = $tc->getScored();
$option_values = '';
foreach ($entries as $entry) {
$option_values .= '<option value="' . $entry->Account->Id . '">' . $entry->Account->Name . '</option>';
}
$option_metrics = '';
foreach ($metrics as $metric) {
示例4: array
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 700, 20, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "Chart title", array("R" => 255, "G" => 255, "B" => 255));
/* Draw the scale */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->setGraphArea(50, 60, 670, 190);
$myPicture->drawFilledRectangle(50, 60, 670, 190, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
$myPicture->drawScale(array("CycleBackground" => TRUE));
/* Graph title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->drawText(50, 52, "Chart subtitle", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMLEFT));
/* Draw the bar chart chart */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$MyData->setSerieDrawable("Last year", FALSE);
$myPicture->drawBarChart();
/* Draw the line and plot chart */
$MyData->setSerieDrawable("Last year", TRUE);
$MyData->setSerieDrawable("This year", FALSE);
$myPicture->drawSplineChart();
$myPicture->drawPlotChart();
/* Make sure all series are drawable before writing the scale */
$MyData->drawAll();
/* Write the legend */
$myPicture->drawLegend(580, 35, array("Style" => LEGEND_ROUND, "Alpha" => 20, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.combo.png");
示例5: htmltorgb
if ($stackedexists) {
$graphImage->drawStackedBarChart($settings);
} else {
$graphImage->drawBarChart($settings);
}
break;
case "LINE":
default:
if (count($v["data"]) == 1) {
$v["data"][] = 0;
}
$graphImage->drawLineChart($settings);
break;
}
}
$graphData->drawAll();
if ($piechart) {
$pie->drawPieLegend($width - 100, 30, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));
} else {
$graphImage->drawLegend($width - 180, 22, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));
}
$graphImage->setShadow(TRUE, array("X" => 0, "Y" => 0, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$graphImage->autoOutput("pictures/example.drawBarChart.simple.png");
function htmltorgb($color)
{
if ($color[0] == '#') {
$color = substr($color, 1);
}
if (strlen($color) == 6) {
list($r, $g, $b) = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]);
} elseif (strlen($color) == 3) {