I am working on creating excel sheet using PHPexcel. This excel sheet has a chart. I am not writing whole script for generating excel sheet from scratch. I already have code from existing project.
So, I am using existing code to create sheet. In the generated sheet, everything is coming fine. But the chart in this sheet is not showing title. Even I have checked, the title instance is passing to chart constructor properly.
Instead of showing title that I have given, it is showing a strange text "as". Below I have shared screenshot of both sheet:
Sheet generated from existing system:
Sheet generated by me using same code:
you can clearly see the title on both chart. I am not able to figure out what is the issue in the code even i have copied exact code from existing system.
Below is the code that I am using:
$series->setPlotDirection(\PHPExcel_Chart_DataSeries::DIRECTION_COL);
$layout = new \PHPExcel_Chart_Layout();
$plotarea = new \PHPExcel_Chart_PlotArea($layout, array($series));
$legend = new \PHPExcel_Chart_Legend(\PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
$chartitle = new \PHPExcel_Chart_Title('Business Studies', $layout);
$chart = new \PHPExcel_Chart('sample', $chartitle, $legend, $plotarea, true, 0, NULL, NULL);
$chart->setTopLeftPosition('M25');
$chart->setBottomRightPosition('V40');
$thissheet->addChart($chart);
Please someone help me on this. Thanks in Advance.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire