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


PHP pChart::drawXYPlotGraph方法代码示例

本文整理汇总了PHP中pChart::drawXYPlotGraph方法的典型用法代码示例。如果您正苦于以下问题:PHP pChart::drawXYPlotGraph方法的具体用法?PHP pChart::drawXYPlotGraph怎么用?PHP pChart::drawXYPlotGraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pChart的用法示例。


在下文中一共展示了pChart::drawXYPlotGraph方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: make


//.........这里部分代码省略.........
     }
     $plot->drawGraphArea($background['R'], $background['G'], $background['B']);
     // pick the largest scale
     $plot->drawXYScale($data->GetData(), $data->GetDataDescription(), 'Serie' . $max_col, 'Serie' . $x_column, 0, 0, 0, TRUE, 0, 0);
     $line_no = 0;
     $colors = array();
     foreach ($columns as $column) {
         $name = $this->plot->column($column + 1);
         $style = $this->plot->line_style($name, 'style');
         $line_color = $this->plot->line_style($name, 'color');
         if (!$line_color) {
             $colors[$name] = array('R' => 0, 'G' => 0, 'B' => 0);
         } else {
             $colors[$name] = html_color_to_RGB($line_color);
         }
         $plot->setColorPalette($line_no, $colors[$name]['R'], $colors[$name]['G'], $colors[$name]['B']);
         if (!$style || $style == 'line' || $style == 'both') {
             $line_width = $this->plot->line_style($name, 'width');
             if (!$line_width) {
                 $line_width = 1;
             }
             $dot_size = $this->plot->line_style($name, 'dot-size');
             if (!$dot_size) {
                 $dot_size = 0;
             }
             $plot->setLineStyle($line_width, $dot_size);
             $plot->drawXYGraph($data->GetData(), $data->GetDataDescription(), 'Serie' . $column, 'Serie' . $x_column, $line_no);
         }
         if ($style == 'point' || $style == 'both') {
             $radius = $this->plot->line_style($name, 'radius');
             if (!$radius) {
                 $radius = 5;
             }
             $plot->drawXYPlotGraph($data->GetData(), $data->GetDataDescription(), 'Serie' . $column, 'Serie' . $x_column, $line_no, $radius, $radius - 2);
         }
         $line_no++;
     }
     $title = $this->plot->property('title');
     foreach ($columns as $column) {
         $data->removeSerie('Serie' . $column);
     }
     $in_legend = array();
     $description = $data->GetDataDescription();
     $description['Description'] = array();
     $palette_id = 0;
     foreach ($columns as $column) {
         $name = $this->plot->column($column + 1);
         if (in_array($name, $in_legend)) {
             continue;
         }
         $in_legend[] = $name;
         $description['Description']['Serie' . $column] = $name;
         $plot->setColorPalette($palette_id, $colors[$name]['R'], $colors[$name]['G'], $colors[$name]['B']);
         ++$palette_id;
     }
     $legend_box_size = $plot->getLegendBoxSize($description);
     $legend_position = $this->plot->property('legend-position');
     if (!$legend_position) {
         $legend_position = 'top-left';
     }
     switch ($legend_position) {
         case 'top-left':
             $legend_left = 0;
             $legend_top = 0;
             break;
         case 'top':
开发者ID:omusico,项目名称:isle-web-framework,代码行数:67,代码来源:plot.php

示例2: pData


//.........这里部分代码省略.........
                 $graphImage->drawPieGraph($graphData->GetData(), $graphData->GetDataDescription(), $this->width_pdf_actual / 2, $this->margintop_actual + ($this->height_pdf_actual - $this->margintop_actual - $this->marginbottom_actual) / 2, ($this->height_pdf_actual - $this->marginbottom_actual - $this->margintop_actual - 20) * 0.5, PIE_PERCENTAGE_LABEL, true, 60, 20, 0, 0);
                 break;
             case "OVERLAYBAR":
             case "STACKEDBAR":
             case "BAR":
                 if ($stackeddrawn) {
                     break;
                 }
                 if ($barexists || $overlayexists) {
                     foreach ($this->plot as $k1 => $v1) {
                         if ($v1["type"] == "BAR" || $v1["type"] == "STACKEDBAR" || $v1["type"] == "OVERLAYBAR") {
                             setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE);
                         }
                     }
                 }
                 $stackeddrawn = true;
                 if ($stackedexists) {
                     $graphImage->drawStackedBarGraph($graphData->GetData(), $graphData->GetDataDescription(), 90);
                 } else {
                     if ($overlayexists) {
                         $graphImage->drawOverlayBarGraph($graphData->GetData(), $graphData->GetDataDescription(), 90);
                     } else {
                         $graphImage->drawBarGraph($graphData->GetData(), $graphData->GetDataDescription());
                     }
                 }
                 break;
             case "SCATTER":
                 if ($scatterdrawn) {
                     break;
                 }
                 $scatterdrawn = true;
                 $series1 = false;
                 $series2 = false;
                 $graphImage->reportWarnings("GD");
                 $ct = 0;
                 foreach ($this->plot as $k1 => $v1) {
                     if ($v1["type"] == "SCATTER") {
                         if ($ct == 0) {
                             $series1 = $v1["name"] . $k1;
                         }
                         if ($ct == 1) {
                             $series2 = $v1["name"] . $k1;
                         }
                         $ct++;
                         setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE);
                     }
                 }
                 if (count($v["data"]) == 1) {
                     $v["data"][] = 0;
                 }
                 $graphImage->drawXYScale($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2, 0, 0, 0);
                 //$graphImage->drawXYGraph($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2);
                 $graphImage->drawXYPlotGraph($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2);
                 $graphImage->writeValues($graphData->GetData(), $graphData->GetDataDescription(), $series2);
                 break;
             case "LINE":
             default:
                 if ($linedrawn) {
                     break;
                 }
                 $linedrawn = true;
                 foreach ($this->plot as $k1 => $v1) {
                     if ($v1["type"] == "LINE") {
                         setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE);
                     }
                 }
                 if (count($v["data"]) == 1) {
                     $v["data"][] = 0;
                 }
                 $graphImage->LineWidth = 1;
                 $graphImage->drawLineGraph($graphData->GetData(), $graphData->GetDataDescription());
                 $graphImage->drawPlotGraph($graphData->GetData(), $graphData->GetDataDescription());
                 $graphImage->LineWidth = 1;
                 break;
         }
     }
     foreach ($this->plot as $k1 => $v1) {
         setSerieDrawable($this->plot, $graphData, $v1["name"] . $k1, TRUE);
     }
     // Draw Legend if legend value has been set
     $drawlegend = false;
     foreach ($this->plot as $k => $v) {
         if (isset($v["legend"]) && $v["legend"]) {
             // Temporarily Dont draw legend for Pie
             //if ( $piechart )
             //$graphImage->drawPieLegend($this->width_pdf_actual - 180,30,$graphData->GetData(), $graphData->GetDataDescription(), 250, 250, 250);
             if (!$piechart) {
                 $graphImage->drawLegend($this->width_pdf_actual - 120, 30, $graphData->GetDataDescription(), 254, 254, 254, 0, 0, 0);
             }
             break;
         }
     }
     $graphImage->setFontProperties(PCHARTFONTS_DIR . $this->xtitlefont, $this->titlefontsize);
     $graphImage->drawTitle(0, 24, $this->title_actual, 50, 50, 50, $this->width_pdf_actual);
     //$graphImage->setShadow(TRUE,array("X"=>0,"Y"=>0,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
     //$graphImage->Render("example.png");
     //$graphImage->Stroke();
     $graphImage->render($outputfile);
     return true;
 }
开发者ID:JorgeUlises,项目名称:higia,代码行数:101,代码来源:swgraph_pchart.php

示例3: setSerieDrawable

             if ($ct == 0) {
                 $series1 = $v1["name"] . $k1;
             }
             if ($ct == 1) {
                 $series2 = $v1["name"] . $k1;
             }
             $ct++;
             setSerieDrawable($plot, $graphData, $v1["name"] . $k1, TRUE);
         }
     }
     if (count($v["data"]) == 1) {
         $v["data"][] = 0;
     }
     $graphImage->drawXYScale($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2, 0, 0, 0);
     //$graphImage->drawXYGraph($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2);
     $graphImage->drawXYPlotGraph($graphData->GetData(), $graphData->GetDataDescription(), $series1, $series2);
     $graphImage->writeValues($graphData->GetData(), $graphData->GetDataDescription(), $series2);
     break;
 case "LINE":
 default:
     if ($linedrawn) {
         break;
     }
     $linedrawn = true;
     foreach ($plot as $k1 => $v1) {
         if ($v1["type"] == "LINE") {
             setSerieDrawable($plot, $graphData, $v1["name"] . $k1, TRUE);
         }
     }
     if (count($v["data"]) == 1) {
         $v["data"][] = 0;
开发者ID:lihaobin0320,项目名称:yii2-reportico,代码行数:31,代码来源:dyngraph_pchart.php

示例4: testDrawXYPlotGraph

 public function testDrawXYPlotGraph()
 {
     $dataSet = new pData();
     $dataSet->addPoints(array(1, 3, 2, 6, 3, 1), 'X');
     $dataSet->addPoints(array(5, 2, 4, 12, 7, 3), 'Y');
     $dataSet->addSeries('X');
     $dataSet->addSeries('Y');
     $canvas = new TestCanvas();
     $chart = new pChart(300, 300, $canvas);
     $chart->setFontProperties('Fonts/tahoma.ttf', 8);
     $chart->setGraphArea(55, 30, 270, 230);
     $scaleStyle = new ScaleStyle(SCALE_NORMAL, new Color(213, 217, 221));
     $chart->drawXYScale($dataSet, $scaleStyle, 'Y', 'X', 45);
     $backgroundStyle = new BackgroundStyle(new Color(213, 217, 221), FALSE);
     $chart->drawGraphBackground($backgroundStyle);
     $chart->drawGrid(new GridStyle(4, TRUE, new Color(230), 20));
     $chart->drawXYPlotGraph($dataSet->getData(), 'Y', 'X');
     file_put_contents(dirname(__FILE__) . '/action_logs/testDrawXYPlotGraph', $canvas->getActionLog());
     $this->assertEquals('a769bf6298734bb20665fc27f7f462ab', md5($canvas->getActionLog()));
 }
开发者ID:rbraband,项目名称:pChart,代码行数:20,代码来源:pChartTest.php

示例5: resolution

 public function resolution()
 {
     $result = $this->hlp->Query()->resolution($this->tlimit, 0, 100);
     $data1 = array();
     $data2 = array();
     $data3 = array();
     foreach ($result as $row) {
         $data1[] = $row['res_x'];
         $data2[] = $row['res_y'];
         $data3[] = $row['cnt'];
     }
     $DataSet = new pData();
     $DataSet->AddPoints($data1, 'Serie1');
     $DataSet->AddPoints($data2, 'Serie2');
     $DataSet->AddPoints($data3, 'Serie3');
     $DataSet->AddAllSeries();
     $Canvas = new GDCanvas(650, 490, false);
     $Chart = new pChart(650, 490, $Canvas);
     $Chart->setFontProperties(dirname(__FILE__) . '/pchart/Fonts/DroidSans.ttf', 8);
     $Chart->setGraphArea(50, 30, 630, 470);
     $Chart->drawXYScale($DataSet, new ScaleStyle(SCALE_NORMAL, new Color(127)), 'Serie2', 'Serie1');
     $Chart->drawXYPlotGraph($DataSet, 'Serie2', 'Serie1', 0, 20, 2, null, false, 'Serie3');
     header('Content-Type: image/png');
     $Chart->Render('');
 }
开发者ID:splitbrain,项目名称:dokuwiki-plugin-statistics,代码行数:25,代码来源:StatisticsGraph.class.php


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