I want to use phpexcel to draw a radar chart, but when I open the generated file with Microsoft Excel 2010, the chart's main axis is missing(like below image, the first is wrong, the second is correct).
The wrong chart draw by phpexcel
The correct chart draw by Excel 2010
Then I read phpexcel's examples '33chartcreate-radar.php', but it has the same problem.
How do I make the main axis show?
$excel = new PHPExcel();
$sheet = $excel->getActiveSheet();
$sheet->setTitle('sheet');
$data = [
['Direction', 'N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'],
['Frequency', 10, 20, 5, 10, 15, 30, 5, 5]
];
$sheet->fromArray($data, null, 'A1');
$dataseriesLabels = array(new PHPExcel_Chart_DataSeriesValues('String',
'sheet!$A$2', NULL, 1));
$xAxisTickValues = array(new PHPExcel_Chart_DataSeriesValues('String',
'sheet!$B$1:$I$1', NULL, 8));
$dataSeriesValues = array(new PHPExcel_Chart_DataSeriesValues('String',
'sheet!$B$2:$I$2', NULL, 8));
$series = new PHPExcel_Chart_DataSeries(
PHPExcel_Chart_DataSeries::TYPE_RADARCHART,
null,
range(0, count($dataSeriesValues)-1),
$dataseriesLabels,
$xAxisTickValues,
$dataSeriesValues,
null,
null,
PHPExcel_Chart_DataSeries::STYLE_MARKER
);
$plotarea = new PHPExcel_Chart_PlotArea(null, array($series));
$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_TOPRIGHT,
NULL, false);
$title = new PHPExcel_Chart_Title('Wind Rose Diagram');
$chart = new PHPExcel_Chart(
'chart1',
$title,
$legend,
$plotarea,
true,
0,
null,
null
);
$chart->setTopLeftPosition('A7');
$chart->setBottomRightPosition('I32');
$sheet->addChart($chart);
$ExcelWrite = PHPExcel_IOFactory::createWriter($excel, "Excel2007");
$ExcelWrite->setIncludeCharts(true);
$ExcelWrite->save('D:\TestRadarChart.xlsx');