本文整理汇总了PHP中pImage::drawStepChart方法的典型用法代码示例。如果您正苦于以下问题:PHP pImage::drawStepChart方法的具体用法?PHP pImage::drawStepChart怎么用?PHP pImage::drawStepChart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pImage
的用法示例。
在下文中一共展示了pImage::drawStepChart方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PlotLine
function PlotLine($rowX, $rowY, $name, $ch)
{
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pData.class.php";
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pDraw.class.php";
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pImage.class.php";
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pPie.class.php";
//**************************************
$myData = new pData();
$myData->addPoints($rowX, "Serie1");
$myData->setSerieDescription("Serie1", $name);
//$myData->setSerieOnAxis("Serie1",0);
$myData->addPoints($rowY, "Absissa");
$myData->setAbscissa("Absissa");
//$myData->addPoints(array("January","February","March","April","May","June","July","August"),"Absissa");
//$myData->setAbscissa("Absissa");
$myData->setAxisPosition(0, AXIS_POSITION_LEFT);
//$myData->setAxisName(0,"1st axis");
$myData->setAxisUnit(0, "");
$myPicture = new pImage(700, 230, $myData);
$Settings = array("R" => 240, "G" => 242, "B" => 241, "Dash" => 1, "DashR" => 260, "DashG" => 262, "DashB" => 261);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
$Settings = array("StartR" => 252, "StartG" => 255, "StartB" => 254, "EndR" => 252, "EndG" => 255, "EndB" => 254, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
$myPicture->setFontProperties(array("FontName" => "fonts/Forgotte.ttf", "FontSize" => 14));
$TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 252, "G" => 252, "B" => 252, "DrawBox" => 1, "BoxAlpha" => 30);
//$myPicture->drawText(350,25,$name,$TextSettings);
$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(50, 50, 675, 190);
//$myPicture->setFontProperties(array("R"=>0,"G"=>0,"B"=>0,"FontName"=>"fonts/pf_arma_five.ttf","FontSize"=>6));
$Settings = array("Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_FLOATING, "LabelingMethod" => LABELING_ALL, "GridR" => 255, "GridG" => 255, "GridB" => 255, "GridAlpha" => 50, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 50, "LabelRotation" => 0, "CycleBackground" => 1, "DrawXLines" => 1, "DrawSubTicks" => 1, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 50, "DrawYLines" => ALL);
$myPicture->drawScale($Settings);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
$Config = "";
if ($ch == 1) {
$myPicture->drawSplineChart($Config);
}
if ($ch == 2) {
$myPicture->drawBarChart($Config);
}
if ($ch == 3) {
$myPicture->drawLineChart($Config);
}
if ($ch == 4) {
$myPicture->drawPlotChart($Config);
}
if ($ch == 5) {
$myPicture->drawStepChart($Config);
}
if ($ch == 6) {
$myPicture->drawAreaChart($Config);
}
if ($ch == 7) {
$myPicture->drawFilledSplineChart($Config);
}
if ($ch == 8) {
$myPicture->drawFilledStepChart($Config);
}
if ($ch == 9) {
$myPicture->drawStackedAreaChart($Config);
}
$Config = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => "fonts/pf_arma_five.ttf", "FontSize" => 6, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL);
$myPicture->drawLegend(563, 16, $Config);
$myPicture->stroke();
}
示例2: pData
/* CAT:Step 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(VOID, VOID, VOID, 2, 6, 3), "Probe 1");
$MyData->addPoints(array(13, 12, 15, 18, 15, 10), "Probe 2");
$MyData->setAxisName(0, "Temperatures");
$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);
/* Turn of AAliasing */
$myPicture->Antialias = FALSE;
/* Draw the border */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 30, 650, 190);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Draw the step chart */
$myPicture->drawStepChart();
/* Write the chart legend */
$myPicture->drawLegend(590, 17, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawStepChart.simple.png");
示例3: drawImage
public function drawImage()
{
$qr_result = $this->values;
//var_dump($qr_result);die();
$va_columns = $this->parameters["columns"];
$width = $this->parameters["width"];
$format = $this->parameters["format"];
$va_charting_columns = $this->parameters["charting_columns"];
$va_chart_types = $this->parameters["chart_types"];
$qr_result->seek();
if ($qr_result->numRows() == 0) {
//if no result nothing to do
return false;
}
// Loading chart format specifications
// TODO : this coding part should be out of this function, sending values in 1 parameter
if (is_array($va_chart_types)) {
foreach ($va_chart_types as $type => $settings) {
if ($type == $format) {
$chart_type = $settings["googletype"];
$message = $settings["message"];
}
}
}
/* Create and populate the pData object */
$MyData = new pData();
// Fulfillment of the results
$va_row_no = 0;
$va_content = array();
while ($qr_result->nextRow()) {
$va_column_no = 0;
foreach ($va_columns as $va_column => $va_column_label) {
// only render columns specified in XML field charting_columns
if (in_array($va_column_label, $va_charting_columns)) {
$va_content[$va_column_label][$va_row_no] = $qr_result->get($va_column_label);
$va_column_no++;
}
}
$va_row_no++;
}
//var_dump($va_content);
$va_row_no = 0;
foreach ($va_charting_columns as $va_column_label) {
//print "MyData->addPoints(\"".implode("\",\"",$va_content[$va_column_label])."\",\"".$va_column_label."\");<br/>";
$MyData->addPoints($va_content[$va_column_label], $va_column_label);
if ($va_row_no == 0) {
//print "MyData->setAbscissa(\"Labels\")<br/>";
$MyData->setAbscissa($va_column_label);
} else {
//print "MyData->setSerieDescription(\"".$va_column_label."\",\"".$va_column_label."\");<br/>";
$MyData->setSerieDescription($va_column_label, $va_column_label);
}
$va_row_no++;
}
/* Create the pChart object */
$myPicture = new pImage($width, $width / 2, $MyData);
/* Set the common properties */
$myPicture->setFontProperties(array("FontName" => __CA_STATISTICSVIEWER_CLASS_DIR__ . "/fonts/verdana.ttf", "FontSize" => 0.014 * $width, "R" => 80, "G" => 80, "B" => 80));
$RectangleSettings = array("R" => 200, "G" => 200, "B" => 200);
$myPicture->drawRectangle(1, 1, $width - 1, $width / 2 - 1, $RectangleSettings);
$myPicture->setGraphArea($width / 9, $width / 10, $width * 0.75, $width * 0.4);
// if not pie, draw the legend
if ($format != "pie") {
$myPicture->drawLegend($width * 0.8, $width * 0.05, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
}
switch ($format) {
case "bar":
$myPicture->drawScale(array("Pos" => SCALE_POS_TOPBOTTOM, "DrawSubTicks" => FALSE, "RemoveYAxis" => TRUE, "GridAlpha" => 90, "DrawXLines" => FALSE));
$myPicture->drawBarChart();
break;
case "column":
$myPicture->drawScale(array("DrawSubTicks" => FALSE, "RemoveYAxis" => TRUE, "GridAlpha" => 90, "DrawXLines" => FALSE));
$myPicture->drawBarChart();
break;
case "step":
$myPicture->drawScale(array("DrawXLines" => FALSE, "DrawYLines" => ALL, "GridR" => 127, "GridG" => 127, "GridB" => 127));
$myPicture->drawStepChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
break;
case "area":
$myPicture->drawScale(array("DrawXLines" => FALSE, "DrawYLines" => ALL, "GridR" => 127, "GridG" => 127, "GridB" => 127));
$myPicture->drawAreaChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
break;
case "pie":
$PieChart = new pPie($myPicture, $MyData);
$PieChart->draw2DPie(0.4 * $width, 0.25 * $width, array("WriteValues" => PIE_VALUE_PERCENTAGE, "ValueR" => 95, "ValueG" => 95, "ValueB" => 95, "ValuePadding" => 0.03 * $width, "Radius" => 0.16 * $width, "SecondPass" => TRUE, "Border" => TRUE, "Precision" => 0));
$myPicture->setShadow(FALSE);
$myPicture->setFontProperties(array("FontName" => __CA_STATISTICSVIEWER_CLASS_DIR__ . "/fonts/verdana.ttf", "FontSize" => 0.018 * $width, "R" => 80, "G" => 80, "B" => 80));
$PieChart->drawPieLegend(0.8 * $width, 0.05 * $width, array("Style" => LEGEND_NOBORDER, "BoxSize" => $width / 60, "FontR" => 0, "FontG" => 0, "FontB" => 0));
break;
case "line":
default:
$myPicture->drawScale(array("DrawXLines" => FALSE, "DrawYLines" => ALL, "GridR" => 127, "GridG" => 127, "GridB" => 127));
$myPicture->drawLineChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
break;
}
/* Render the picture (choose the best way) */
$myPicture->autoOutput();
}
示例4: array
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMapStepChart", IMAGE_MAP_STORAGE_FILE, "StepChart", "../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));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => FONT_PATH . "/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, "Measured values", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* 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("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Draw the line chart */
$Settings = array("RecordImageMap" => TRUE);
$myPicture->drawStepChart($Settings);
/* Write the chart legend */
$myPicture->drawLegend(540, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("../tmp/LineChart.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, "drawStepChart() - draw a step 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));
$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->drawStepChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
$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, "DrawSubTicks" => TRUE));
$myPicture->setShadow(TRUE, array("X" => -1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->drawStepChart();
$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.drawStepChart.png");
示例6: dumpArray
$myPicture->drawLineChart($Config);
} else {
echo dumpArray("Config", $Config);
echo '$myPicture->drawLineChart($Config);' . "\r\n";
}
}
if ($c_family == "step") {
if ($c_break == "true") {
list($BreakR, $BreakG, $BreakB) = extractColors($c_break_color);
$Config["BreakVoid"] = 0;
$Config["BreakR"] = $BreakR;
$Config["BreakG"] = $BreakG;
$Config["BreakB"] = $BreakB;
}
if ($Mode == "Render") {
$myPicture->drawStepChart($Config);
} else {
echo dumpArray("Config", $Config);
echo '$myPicture->drawStepChart($Config);' . "\r\n";
}
}
if ($c_family == "spline") {
if ($c_break == "true") {
list($BreakR, $BreakG, $BreakB) = extractColors($c_break_color);
$Config["BreakVoid"] = 0;
$Config["BreakR"] = $BreakR;
$Config["BreakG"] = $BreakG;
$Config["BreakB"] = $BreakB;
}
if ($Mode == "Render") {
$myPicture->drawSplineChart($Config);