5

I'm having an issue with PHPExcel that it is not PHPExcel's fault. In a graph, the values being presented are very large, so since the default setting for the axis options for Minimum is Automatic, Excel is deciding to use a minimum value for the Y axis of 156,000. The issue can be "Fixed" in Excel by going into the Axis format option and setting a Fixed value of 0 for the minimum of that axis.

So I've been trying to figure out if you can set this option from within PHPExcel, but can't figure out if it's even possible.

So can you change the Chart Axis format options from within PHPExcel, and if so... how?

Thanks,

Arturo Alvarado
  • 498
  • 1
  • 5
  • 10

2 Answers2

5

It shall be possible now with this fix: https://github.com/PHPOffice/PHPExcel/commit/1a237573f9127a02388f4e306732122b39d1ea49

Usage example (100 is the max. value):

$axis =  new PHPExcel_Chart_Axis();
$axis->setAxisOptionsProperties('nextTo', null, null, null, null, null, null, 100);

$chart = new PHPExcel_Chart('chart' . $locTL, $title, $legend, $pa, true, 0, NULL, NULL, $axis); 

I have tested only max limit but I believe it shall function properly for min limit as well.

Paweł Mikołajczuk
  • 3,692
  • 25
  • 32
user38759
  • 96
  • 1
  • 3
4

It's an option that isn't yet available with PHPExcel

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
  • Thanks, great job with the tool BTW. Do you have any suggestion on how could I "trick" Excel to use 0 for the minimum, and have it not be "obvious" when looking at the graph. – Arturo Alvarado Nov 02 '12 at 21:39
  • 1
    Not at the moment: I've been stabilising the charting so it's now no longer experimental (though it still has issues with some chart types and features), and will be doing some work on extending the chart options (such as adding styling choices), but haven't started that work yet - afraid I can't think of any way to "trick" Excel at all – Mark Baker Nov 02 '12 at 21:50
  • 2
    @MarkBaker Is it now (2016) possible somehow? – madflow Feb 11 '16 at 16:03