public function render($outputDestination = null) { $libraryName = PHPExcel_Settings::getChartRendererName(); if (is_null($libraryName)) { return false; } // Ensure that data series values are up-to-date before we render $this->refresh(); $libraryPath = PHPExcel_Settings::getChartRendererPath(); $includePath = str_replace('\\', '/', get_include_path()); $rendererPath = str_replace('\\', '/', $libraryPath); if (strpos($rendererPath, $includePath) === false) { set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath); } $rendererName = 'PHPExcel_Chart_Renderer_' . $libraryName; $renderer = new $rendererName($this); if ($outputDestination == 'php://output') { $outputDestination = null; } return $renderer->render($outputDestination); }
* This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel * @package PHPExcel_Chart_Renderer * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ require_once PHPExcel_Settings::getChartRendererPath() . '/jpgraph.php'; /** * PHPExcel_Chart_Renderer_jpgraph * * @category PHPExcel * @package PHPExcel_Chart_Renderer * @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) */ class PHPExcel_Chart_Renderer_jpgraph { private static $_width = 640; private static $_height = 480; private static $_colourSet = array('mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1', 'darkmagenta', 'coral', 'dodgerblue3', 'eggplant', 'mediumblue', 'magenta', 'sandybrown', 'cyan', 'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen', 'goldenrod2'); private static $_markSet = array('diamond' => MARK_DIAMOND, 'square' => MARK_SQUARE, 'triangle' => MARK_UTRIANGLE, 'x' => MARK_X, 'star' => MARK_STAR, 'dot' => MARK_FILLEDCIRCLE, 'dash' => MARK_DTRIANGLE, 'circle' => MARK_CIRCLE, 'plus' => MARK_CROSS); private $_chart = null; private $_graph = null;
private function renderCombinationChart($groupCount, $dimensions, $outputDestination) { require_once PHPExcel_Settings::getChartRendererPath() . 'jpgraph_line.php'; require_once PHPExcel_Settings::getChartRendererPath() . 'jpgraph_bar.php'; require_once PHPExcel_Settings::getChartRendererPath() . 'jpgraph_scatter.php'; require_once PHPExcel_Settings::getChartRendererPath() . 'jpgraph_regstat.php'; require_once PHPExcel_Settings::getChartRendererPath() . 'jpgraph_line.php'; $this->renderCartesianPlotArea(); for ($i = 0; $i < $groupCount; ++$i) { $dimensions = null; $chartType = $this->chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); switch ($chartType) { case 'area3DChart': $dimensions = '3d'; // no break // no break case 'areaChart': $this->renderPlotLine($i, true, true, $dimensions); break; case 'bar3DChart': $dimensions = '3d'; // no break // no break case 'barChart': $this->renderPlotBar($i, $dimensions); break; case 'line3DChart': $dimensions = '3d'; // no break // no break case 'lineChart': $this->renderPlotLine($i, false, true, $dimensions); break; case 'scatterChart': $this->renderPlotScatter($i, false); break; case 'bubbleChart': $this->renderPlotScatter($i, true); break; default: $this->graph = null; return false; } } $this->renderLegend(); $this->graph->Stroke($outputDestination); return true; }