//		Cell reference for data
//		Format Code
//		Number of datapoints in series
//		Data values
//		Data Marker
$xAxisTickValues = array(new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12));
//	Set the Data values for each data series we want to plot
//		Datatype
//		Cell reference for data
//		Format Code
//		Number of datapoints in series
//		Data values
//		Data Marker
$dataSeriesValues1 = array(new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$13', NULL, 12));
//	Build the dataseries
$series1 = new \PHPExcel\Chart\DataSeries(\PHPExcel\Chart\DataSeries::TYPE_BARCHART, \PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, range(0, count($dataSeriesValues1) - 1), $dataSeriesLabels1, $xAxisTickValues, $dataSeriesValues1);
//	Set additional dataseries parameters
//		Make it a vertical column rather than a horizontal bar graph
$series1->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_COL);
//	Set the Data values for each data series we want to plot
//		Datatype
//		Cell reference for data
//		Format Code
//		Number of datapoints in series
//		Data values
//		Data Marker
$dataSeriesValues2 = array(new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12));
//	Build the dataseries
$series2 = new \PHPExcel\Chart\DataSeries(\PHPExcel\Chart\DataSeries::TYPE_LINECHART, \PHPExcel\Chart\DataSeries::GROUPING_STANDARD, range(0, count($dataSeriesValues2) - 1), $dataSeriesLabels2, NULL, $dataSeriesValues2);
//	Set the Data values for each data series we want to plot
//		Datatype
예제 #2
0
//		Cell reference for data
//		Format Code
//		Number of datapoints in series
//		Data values
//		Data Marker
$xAxisTickValues = array(new \PHPExcel\Chart\DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4));
//	Set the Data values for each data series we want to plot
//		Datatype
//		Cell reference for data
//		Format Code
//		Number of datapoints in series
//		Data values
//		Data Marker
$dataSeriesValues = array(new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4), new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4), new \PHPExcel\Chart\DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4));
//	Build the dataseries
$series = new \PHPExcel\Chart\DataSeries(\PHPExcel\Chart\DataSeries::TYPE_BARCHART, \PHPExcel\Chart\DataSeries::GROUPING_CLUSTERED, range(0, count($dataSeriesValues) - 1), $dataSeriesLabels, $xAxisTickValues, $dataSeriesValues);
//	Set additional dataseries parameters
//		Make it a horizontal bar rather than a vertical column graph
$series->setPlotDirection(\PHPExcel\Chart\DataSeries::DIRECTION_BAR);
//	Set the series in the plot area
$plotArea = new \PHPExcel\Chart\PlotArea(NULL, array($series));
//	Set the chart legend
$legend = new \PHPExcel\Chart\Legend(\PHPExcel\Chart\Legend::POSITION_RIGHT, NULL, false);
$title = new \PHPExcel\Chart\Title('Test Bar Chart');
$yAxisLabel = new \PHPExcel\Chart\Title('Value ($k)');
//	Create the chart
$chart = new \PHPExcel\Chart('chart1', $title, $legend, $plotArea, true, 0, NULL, $yAxisLabel);
//	Set the position where the chart should appear in the worksheet
$chart->setTopLeftPosition('A7');
$chart->setBottomRightPosition('H20');
//	Add the chart to the worksheet