本文整理汇总了PHP中pImage::drawStackedBarChart方法的典型用法代码示例。如果您正苦于以下问题:PHP pImage::drawStackedBarChart方法的具体用法?PHP pImage::drawStackedBarChart怎么用?PHP pImage::drawStackedBarChart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pImage
的用法示例。
在下文中一共展示了pImage::drawStackedBarChart方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pData
/* CAT:Stacked chart */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(4, VOID, VOID, 12, 8, 3), "Frontend #1");
$MyData->addPoints(array(3, 12, 15, 8, 5, 5), "Frontend #2");
$MyData->addPoints(array(2, 7, 5, 18, 19, 22), "Frontend #3");
$MyData->setAxisName(0, "Average Usage");
$MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun"), "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the scale and the chart */
$myPicture->setGraphArea(60, 20, 680, 190);
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "Mode" => SCALE_MODE_ADDALL_START0));
$myPicture->setShadow(FALSE);
$myPicture->drawStackedBarChart(array("Surrounding" => -15, "InnerSurrounding" => 15));
/* Write a label */
$myPicture->writeLabel(array("Frontend #1", "Frontend #2", "Frontend #3"), 1, array("DrawVerticalLine" => TRUE));
/* Write the chart legend */
$myPicture->drawLegend(480, 210, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawStackedBarChart.shaded.png");
示例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
}
$arrDisplayValues = array("DisplayValues" => FALSE);
if ($plot == 2) {
$arrDisplayValues["DisplayValues"] = TRUE;
}
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the stacked area chart */
if ($chartType == 'area2') {
$myPicture->drawStackedAreaChart();
} else {
if ($chartType == 'bar') {
$myPicture->drawBarChart(array("Surrounding" => -15, "InnerSurrounding" => 15) + $arrDisplayValues);
} else {
if ($chartType == 'bar2') {
$myPicture->drawStackedBarChart();
} else {
$myPicture->drawLineChart();
if ($plot > 0) {
$myPicture->drawPlotChart($arrDisplayValues + array("PlotSize" => $weight * 1.5 + 3, "PlotBorder" => TRUE, "BorderSize" => 0.8, "BorderAlpha" => 75, "Surrounding" => -30));
}
}
}
}
// 隐藏主坐标轴数据,画副坐标轴数据
if (isset($arrSeriesY2)) {
foreach ($arrSeries as $serie) {
if (in_array($serie, $arrSeriesY2)) {
$myData->setSerieDrawable($serie, TRUE);
} else {
$myData->setSerieDrawable($serie, FALSE);
示例4: pImage
$MyData->addPoints(array(19, 0, -8, 8, -8, 12, -19, -10, 5, 12, -20, -8, 10, -11, -12, 8, -17, -14, 0), "Probe 4");
$MyData->setAxisName(0, "Temperatures");
$MyData->addPoints(array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22), "Time");
$MyData->setSerieDescription("Time", "Hour of the day");
$MyData->setAbscissa("Time");
$MyData->setXAxisUnit("h");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
/* Overlay with a gradient */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the scale */
$myPicture->setGraphArea(60, 30, 650, 190);
$myPicture->drawScale(array("CycleBackground" => TRUE, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10, "Mode" => SCALE_MODE_ADDALL));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw some thresholds */
$myPicture->setShadow(FALSE);
$myPicture->drawThreshold(-40, array("WriteCaption" => TRUE, "R" => 0, "G" => 0, "B" => 0, "Ticks" => 4));
$myPicture->drawThreshold(28, array("WriteCaption" => TRUE, "R" => 0, "G" => 0, "B" => 0, "Ticks" => 4));
/* Draw the chart */
$myPicture->drawStackedBarChart(array("Rounded" => TRUE, "DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO, "DisplaySize" => 6, "BorderR" => 255, "BorderG" => 255, "BorderB" => 255));
/* Write the chart legend */
$myPicture->drawLegend(570, 212, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawStackedBarChart.rounded.png");
示例5: array
/* Overlay with a gradient */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$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" => 80));
/* 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, "drawStackedBarChart() - draw a stacked bar chart", array("R" => 255, "G" => 255, "B" => 255));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(250, 55, "Average temperature", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Draw the scale and the 1st chart */
$myPicture->setGraphArea(60, 60, 450, 190);
$myPicture->drawFilledRectangle(60, 60, 450, 190, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "Mode" => SCALE_MODE_ADDALL));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->drawStackedBarChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO, "Rounded" => TRUE, "Surrounding" => 60));
$myPicture->setShadow(FALSE);
/* Draw the scale and the 2nd chart */
$myPicture->setGraphArea(500, 60, 670, 190);
$myPicture->drawFilledRectangle(500, 60, 670, 190, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
$myPicture->drawScale(array("Pos" => SCALE_POS_TOPBOTTOM, "Mode" => SCALE_MODE_ADDALL, "DrawSubTicks" => TRUE));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->drawStackedBarChart();
$myPicture->setShadow(FALSE);
/* Write the chart legend */
$myPicture->drawLegend(510, 205, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawStackedBarChart.png");
示例6: tests_pchart2
//.........这里部分代码省略.........
$class->setTestMethods($methods);
$classes[] = $class;
}*/
foreach ($xmls as $node) {
$assertions = 0;
// total number of "test" points
$successes = array();
// assertions - failures
$failures = array();
$testMethods = array();
$classXml = f($node);
$class = new TestClass();
$class->setName($classXml->getName());
$class->setFile((string) $classXml->attributes()->file);
$class->setTests((string) $classXml->attributes()->tests);
$class->setAssertions((string) $classXml->attributes()->assertions);
$class->setFailures((string) $classXml->attributes()->failures);
$class->setErrors((string) $classXml->attributes()->errors);
$class->setTime((string) $classXml->attributes()->time);
$methods = array();
$i = 0;
foreach ($classXml->children() as $methodXml) {
$method = new TestMethod();
$method->setName($methodXml->getName());
$method->setTests((string) $methodXml->attributes()->tests);
$method->setAssertions((string) $methodXml->attributes()->assertions);
$method->setFailures((string) $methodXml->attributes()->failures);
$method->setErrors((string) $methodXml->attributes()->errors);
$method->setTime((string) $methodXml->attributes()->time);
/*
$cases = array();
foreach ($methodXml->children() as $caseXml) {
$case = new TestCase();
$case->setName((string)$caseXml->getName());
$case->setAssertions((string)$caseXml->attributes()->assertions);
$case->setTime((string)$caseXml->attributes()->time);
$cases[] = $case;
}
$method->setTestCases($cases);
*/
$methods[] = $method;
$time = (double) $methodXml->attributes()->time * 1000;
// to milliseconds
$testMethods[] = $methodXml->attributes()->name;
$f = (double) $methodXml->attributes()->failures * $time / (double) $methodXml->attributes()->assertions;
$successes[] = (double) $time - (double) $f;
$failures[] = $f;
$i++;
}
$chartWidth = 700;
if ($i == 1) {
$i++;
}
$chartHeight = 25 * $i + 60;
/* pChart library inclusions */
include 'lib/pChart/class/pData.class';
include 'lib/pChart/class/pDraw.class';
include 'lib/pChart/class/pImage.class';
$MyData = new pData();
$MyData->addPoints($successes, "Ok");
$MyData->addPoints($failures, "Fail");
$MyData->setPalette("Ok", array("R" => 124, "G" => 196, "B" => 0, "Alpha" => 100));
$MyData->setPalette("Fail", array("R" => 254, "G" => 15, "B" => 0, "Alpha" => 100));
$MyData->setAxisName(0, "Time (ms)");
//$MyData->setAxisUnit(0,"ms");
$MyData->addPoints($testMethods, " ");
$MyData->setAbscissa(" ");
/* Create the pChart object */
//
// ~40px for each test
//
$myPicture = new pImage($chartWidth, $chartHeight, $MyData);
$myPicture->Antialias = false;
$myPicture->drawGradientArea(0, 0, $chartWidth, $chartHeight, DIRECTION_VERTICAL, array("StartR" => 100, "StartG" => 100, "StartB" => 100, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => CINTIENT_INSTALL_DIR . "lib/pChart/fonts/pf_arma_five.ttf", "FontSize" => 6, "R" => 255, "G" => 255, "B" => 255));
$myPicture->drawText(10, 13, "Unit tests on " . $classXml->getName(), array("R" => 255, "G" => 255, "B" => 255));
/* Draw the scale and the chart */
$myPicture->setGraphArea(240, 40, 640, $chartHeight - 20);
$myPicture->drawFilledRectangle(240, 40, 640, $chartHeight - 20, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -100, "Alpha" => 10));
$myPicture->drawScale(array("Pos" => SCALE_POS_TOPBOTTOM, "Mode" => SCALE_MODE_ADDALL, "DrawSubTicks" => true, "MinDivHeight" => 20, 'GridTicks' => 2, 'DrawXLines' => true, 'DrawYLines' => ALL));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->drawStackedBarChart(array("Interleave" => 2, "Gradient" => false));
$myPicture->drawLegend(15, $chartHeight - 15, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
$myPicture->setShadow(FALSE);
/* Write the chart legend */
//$myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawStackedBarChart.png");
$class->setTestMethods($methods);
$classes[] = $class;
}
//
// We're exactly at the test class (file) root level, with level 1 being
// the unit test (method of the original class) and level 2 being
// the various datasets used in the test (each a test case).
//
/* @ 700x230 Stacked bar chart drawing example. */
exit;
}
示例7: array
$myPicture->drawScale($Settings);
$Config = array("DisplayValues" => 0, "AroundZero" => 0, "BreakVoid" => 1, "RecordImageMap" => FALSE);
$GraphType = 'SplineChart';
switch ($GraphType) {
case 'AreaChart':
$myPicture->drawAreaChart($Config);
break;
case 'FilledSplineChart':
$myPicture->drawFilledSplineChart($Config);
break;
case 'SplineChart':
$myPicture->drawSplineChart($Config);
break;
case 'BarChart':
$myPicture->drawBarChart($Config, 'tetimes');
break;
case 'StackedBarChart':
$myPicture->drawStackedBarChart($Config);
break;
case 'PlotChart':
$myPicture->drawPlotChart($Config);
break;
default:
break;
}
$Config = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => $LibPath . "fonts/verdana.ttf", "FontSize" => 8, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL);
$myPicture->drawLegend($Graphwidth - 65, 40, $Config);
$myPicture->setFontProperties(array("FontName" => $LibPath . "fonts/verdana.ttf", "FontSize" => 10));
$TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 0, "G" => 0, "B" => 0);
$myPicture->drawText(200, 15, $GraphLabel, $TextSettings);
$myPicture->render(__DIR__ . '/temp/' . $Type . '_' . $SensorID . '.png');
示例8: fgets
$string = fgets($handler);
$myArray = explode(',', $string);
$i = 0;
while ($string = fgets($handler)) {
$myArray = explode(',', $string);
$components[$i] = $myArray[0];
++$i;
}
$MyData = new pData();
$MyData->importFromCSV("foundit.csv", array("GotHeader" => TRUE, "SkipColumns" => array(0)));
$MyData->setAxisName(0, "Bug Count");
$MyData->setAxisName(1, "Components");
$MyData->addPoints($components, "Components");
$MyData->setAbscissa("Components");
//$MyData->setSerieOnAxis("Component",1);
//$MyData->setAxisXY(1,AXIS_X);
/* Create the pChart object */
$myPicture = new pImage(3000, 700, $MyData);
$myPicture->drawGradientArea(0, 0, 3000, 700, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 3000, 700, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the scale and the chart */
$myPicture->setGraphArea(60, 20, 3000, 680);
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "Mode" => SCALE_MODE_ADDALL_START0));
$myPicture->setShadow(FALSE);
$myPicture->drawStackedBarChart(array("Interleave" => 0.5, "Surrounding" => -15, "InnerSurrounding" => 15));
/* Write the chart legend */
$myPicture->drawLegend(800, 10, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->Render("foundit.png");
示例9: YAxisFormat
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(20, 40, 65, 100, 70, 55, 40, 22, 12), "Male");
$MyData->addPoints(array(-22, -44, -61, -123, -74, -60, -52, -34, -21), "Female");
$MyData->setAxisName(0, "Community members");
$MyData->addPoints(array("0-10", "10-20", "20-30", "30-40", "40-50", "50-60", "60-70", "70-80", "80-90"), "Labels");
$MyData->setSerieDescription("Labels", "Ages");
$MyData->setAbscissa("Labels");
$MyData->setAxisDisplay(0, AXIS_FORMAT_CUSTOM, "YAxisFormat");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the scale and the chart */
$myPicture->setGraphArea(60, 20, 680, 190);
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "Mode" => SCALE_MODE_ADDALL));
$myPicture->setShadow(FALSE);
$myPicture->drawStackedBarChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO, "Gradient" => TRUE, "Surrounding" => -20, "InnerSurrounding" => 20));
/* Write the chart legend */
$myPicture->drawLegend(600, 210, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawStackedBarChart.pyramid.png");
function YAxisFormat($Value)
{
return abs($Value);
}
示例10: pData
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(-4, VOID, VOID, 12, 8, 3), "Frontend #1");
$MyData->addPoints(array(3, 12, 15, 8, 5, -5), "Frontend #2");
$MyData->addPoints(array(2, 7, 5, 18, 19, 22), "Frontend #3");
$MyData->setAxisName(0, "Average Usage");
$MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun"), "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
/* Normalize all the data series to 100% */
$MyData->normalize(100, "%");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the scale and the chart */
$myPicture->setGraphArea(60, 20, 680, 190);
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "Mode" => SCALE_MODE_ADDALL));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->drawStackedBarChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO, "Gradient" => TRUE, "GradientMode" => GRADIENT_EFFECT_CAN, "Surrounding" => 30));
$myPicture->setShadow(FALSE);
/* Write the chart legend */
$myPicture->drawLegend(480, 210, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawStackedBarChart.can.png");
示例11: array
$myPicture->dumpImageMap("ImageMapStackedBarChart", IMAGE_MAP_STORAGE_FILE, "StackedBarChart", "../tmp");
}
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMapStackedBarChart", IMAGE_MAP_STORAGE_FILE, "StackedBarChart", "../tmp");
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
/* Overlay with a gradient */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => FONT_PATH . "/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 650, 200);
/* Draw the scale */
$scaleSettings = array("Mode" => SCALE_MODE_ADDALL, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
$myPicture->drawLegend(580, 12, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$Settings = array("RecordImageMap" => TRUE);
$myPicture->drawStackedBarChart($Settings);
/* Render the picture (choose the best way) */
$myPicture->autoOutput("../tmp/StackedBarChart.png");
示例12: foreach
case "STACKEDBAR":
case "BAR":
if ($stackeddrawn) {
break;
}
if ($barexists) {
foreach ($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) {