在 PHPEXCEL 中更改 Y 轴的对齐方式

changing alignment of Y-Axis in PHPEXCEL

以下是我使用 PHPEXCEL 生成图表的代码:

$categories = new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C'.$old_constant.':$C'.$new_constant);
        $values = new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$E'.$old_constant.':$E'.$new_constant);
        $series = new PHPExcel_Chart_DataSeries(
            PHPExcel_Chart_DataSeries::TYPE_BARCHART,       // plotType
            PHPExcel_Chart_DataSeries::GROUPING_CLUSTERED,  // plotGrouping
            array(0),                                       // plotOrder
            array(),                                        // plotLabel
            array($categories),                             // plotCategory
            array($values)                                  // plotValues
          );
        $series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);

        $layout = new PHPExcel_Chart_Layout();
        $plotarea = new PHPExcel_Chart_PlotArea($layout, array($series));
        $title = new PHPExcel_Chart_Title($row[meter_name]);
        $yAxisLabel = new PHPExcel_Chart_Title('Energy Consumed (KWH)');
        $xAxisLabel = new PHPExcel_Chart_Title('Day');

        $chart = new PHPExcel_Chart('sample', $title, null, $plotarea,true,0,$xAxisLabel,$yAxisLabel);


        $chart->setTopLeftPosition('M'.$old_constant);

        $chart->setBottomRightPosition('Z'.($new_constant+5));


        $constant=$constant+5;
        $objPHPExcel->getActiveSheet()->addChart($chart);

这是我在 excel 中得到的输出图表:

我希望 Y 轴垂直对齐,不是horizontally.Any帮助将不胜感激。

然后尝试更改

$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);

$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_BAR);

列是垂直的(从上到下),条是水平的(从左到右)