答案 0 :(得分:1)
在研究代码后,我发现反转轴可能:
$yAxis = new \PHPExcel_Chart_Axis();
$yAxis->setsetAxisOptionsProperties(
\PHPExcel_Chart_Axis::AXIS_LABELS_NEXT_TO,
null,
null,
\PHPExcel_Properties::ORIENTATION_REVERSED
);
$chart = new \PHPExcel_Chart(
"Chart1",
$titile,
$legend,
$plotArea,
true,
'0',
null,
null,
null, //xAxis parameter if you want to reverse the x axis
$yAxis
);
注意:如果您将系列方向设置为列而不是条
$series = new \PHPExcel_Chart_DataSeries(....);
$series->setPlotDirection(\PHPExcel_Chart_DataSeries::DIRECTION_COL);
轴是反转的,因此您设置为Y轴的选项将应用于X轴和相反的轴。
然而,通过其他预期有效的方法可以实现的反转>>:
$chart->getChartAxisY()->setAxisOrientation(\PHPExcel_Properties::ORIENTATION_REVERSED);
或
$yAxis = new \PHPExcel_Chart_Axis();
$yAxis->setAxisOrientation(\PHPExcel_Properties::ORIENTATION_REVERSED);
$chart = new \PHPExcel_Chart(
"Chart1",
$titile,
$legend,
$plotArea,
true,
'0',
null,
null,
null, //xAxis parameter if you want to reverse the x axis
$yAxis
);