有没有办法设置我们的图表,所以它看起来像这样.. http://www.epicstan.com/graf.jpg?
我们无法找到如何摆脱图表周围的数字。
以下是生成http://www.epicstan.com/export.xlsx的文件,在表2中我们需要更改该图形外观。
这是代码..
<?php
/* part of generater code */
/* charts */
$dataSeriesValues = array(
new \PHPExcel_Chart_DataSeriesValues('Number', 'sheet2!$I$'.(($i*5)+3).':$I$'.(($i*5)+5), NULL, 6),
);
// Build the dataseries
$series = new \PHPExcel_Chart_DataSeries(
\PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D, // plotType
NULL,
range(0, count($dataSeriesValues)-1),
NULL,
NULL,
$dataSeriesValues
);
$series->setPlotDirection(\PHPExcel_Chart_DataSeries::DIRECTION_BAR);
$layout = new \PHPExcel_Chart_Layout();
$layout->setManual3dAlign(true);
$layout->setXRotation(10);
$layout->setYRotation(20);
$layout->setRightAngleAxes(1);
$layout->setShowVal(true);
$plotarea = new \PHPExcel_Chart_PlotArea($layout, array($series));
$chart = new \PHPExcel_Chart(
'chart1',
NULL,
NULL,
$plotarea,
true,
0,
NULL,
NULL
);
$chart->setTopLeftPosition('I'.(($i*5)+2));
$chart->setBottomRightPosition('J'.(($i*5)+8));
$excel->getActiveSheet()->addChart($chart);
$excel->setActiveSheetIndex(0);
$objWriter = new \PHPExcel_Writer_Excel2007($excel);
$objWriter->setIncludeCharts(TRUE);
$file = DOWNLOAD_DIR . 'export.xlsx';
$objWriter->save($file);
谢谢。
彼得
答案 0 :(得分:0)
更改数据构造函数的参数,以设置一系列字符串plotCategories:
// Build the dataseries
$series = new \PHPExcel_Chart_DataSeries(
\PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D, // plotType
NULL,
range(0, count($dataSeriesValues)-1),
NULL,
new \PHPExcel_Chart_DataSeriesValues(
'String',
NULL,
NULL,
count($dataSeriesValues)
),
$dataSeriesValues
);