50
Vote

Implement chart functionality

description

Implement chart functionality
 
  • Milestone 1: Simple column chart, included in Excel2007 writer

file attachments

comments

fks wrote Jun 19, 2007 at 5:35 PM

this would be a great feature!a functionality that allows creating simple bar and pie charts :-)

Thymus wrote Nov 15, 2007 at 9:37 AM

Hello

Could we have some news about this functionnality ?

I need to create Pie and bar charts

Thanks a lot dear belgian developper (I'm also belgian) ;)

Cheers,

maartenba wrote Nov 15, 2007 at 1:55 PM

It is actually quite a lot of work to implement this one in a flexible manner. And as I'm quite busy these days... Would you be interested in contributing?

retiolum wrote Mar 26, 2008 at 3:59 PM

I've done some pretty nice graph drawing recently using the graph component from ezComponents (http://ezcomponents.org/docs/tutorials/Graph); therefore I created the graph, rendered it to a temporary file and added it afterwards to the Excel sheet. It works pretty fine (except that the included graphics don't show up in OpenOffice).

b166er wrote May 17, 2008 at 11:54 AM

hi, i'm also afraid to hear about this issue.
but how about to use JpGraph (http://www.aditus.nu/jpgraph/) instead of ezComponents?
because i think its pretty neutral.
but it's only my position.

thanks

maecka wrote Sep 15, 2008 at 12:52 PM

I have started to work on this.

General_Luzi wrote Oct 1, 2008 at 9:58 AM

Could someone give me a statement about the schedule of this feature please?

zero007 wrote Mar 30, 2009 at 9:01 PM

I'd like to know when this feature will be available...
I need to read from a file several data, maybe change it. Included in this data there's a chart that is dependent on these data. I don't need to modify this graph, only the data and the graph should modify whit this updated data.
make this question to see if this new implementation wolud include this feature, or i just look in some other place

Other cuestion, where i can get information of excel document structure in case i could develop something like this.. ??

Thks

maartenba wrote Mar 31, 2009 at 7:02 AM

We're working on it, no estimated dtae of completion. File format docs are available at http://phpexcel.codeplex.com/Wiki/View.aspx?title=Documents&referringTitle=Home

zero007 wrote Mar 31, 2009 at 12:35 PM

OK, thanks for answering. I keep up to date...
This feature, will cover the example that i wrote before?
Great library, and sorry for the inconvenience

jackue wrote Feb 4, 2010 at 10:48 AM

Hello,

I work on a project which use phpexcel. I need to insert a chart into excel. The chart will be updated while i modify the data. At the moment, i use PHP COM for it. But it works only under Windows + Office MS. That means that it will not work on the linux server. So if this fonctionnality will be added in PHPExcel, i wish that it could work on linux. That's just a wish.

Thx

MarkBaker wrote Feb 4, 2010 at 10:55 AM

@jackue
It's ongoing development at the moment, but I'm not prepared to commit to any timescales
When we do make it available, it won't matter what operating system you're running on. The point of PHPExcel is that it's pure PHP, making it cross-platform, rather than dependent on OS-specific plug-ins or features

Manash082 wrote Sep 21, 2010 at 8:42 AM

Hi,
Just need to know whether showing chart in excel sheet using PHP Excel has come in to picture or still in cards.If this functionality is available now,do send me some link where I'll get to know more about this particular feature.

Thanking you in advance,
MaK

MarkBaker wrote Sep 21, 2010 at 1:58 PM

@Manash082
Target for the initial release of charting is the next release of PHPExcel (1.7.5) sometime in October/November, when I hope to have charts implemented for the Excel2007 Reader and Writer, some basic methods for creating/editing charts, and options for rendering a gif/jpg image from a chart definition using a configurable 3rd party library such as jpGraph.

Currently I have the basis of:
  • Column and Bar - Grouped, Stacked and Percentage in both 2 and 3D
  • Line and Area - Stacked and Percentage (with/without markers for lines) ... no 3D yet
  • Pie and Pie 3D (including exploded)
  • Doughnut and Exploded Doughnut
  • Scatter - with line or bezier join (with/without markers) but not yet true scatter without any joining line
  • Radar
  • Bubble chart - 2d only at present
  • Contour/Wireframe/Surface - absolute basics only
  • Legends, Titles, and x/y-axes with labels (but not multiple axes)
  • No backgrounds
  • No Stock charts yet
Other readers/writers and other rendering libraries (Graphpite would be my second choice) to follow in subsequent releases. I'm looking to target OOCalc and Gnumeric Readers/Writers after the initial Excel2007 Readers/Writers.... mainly because they're a very similar XML structure and should be straightforward to write.

Manash082 wrote Oct 6, 2010 at 11:24 AM

@MarkBaker
thanks for your quick reply.But I have one more query.

Well Mark you have mentioned that there are certain charts available.Well that's great but I didn't find any help regarding implementing chart using PHP Excel.I am saying about the coding helps.In the developer documentation also no such things are specified.
Can you please tell me from where I can get help regarding how to generate chart using PHP Excel?

Or the documentation for generating chart will be included when the whole functionality will come in to picture that is in the next release.

Please do clarify.
Thanks
MaK

maartenba wrote Oct 12, 2010 at 7:59 PM

Mark, is this checked in somewhere? I want to make everything regarding charts in PHPExcel and PHPPowerPoint as similar as possible. Looks like a good feature set already! Keep up the good work :-)

marek_zebrowski wrote Aug 12, 2011 at 9:02 AM

I came across the same problem - I needed charts in PHPExcel. What I did is I ported some changes from charts (wi16-graph branch) to work in 1.7.6 code.
It worked for OpenOffice but not for excel. I did some more research, learnt how much brain-damaged OpenXML is [http://www.codeproject.com/KB/XML/ooxml_is_defective.aspx]
and produced something that works (at least with excel2010)
It's not complete, it only allows to save charts.
How to use:
  1. you have to have a chart template prepared (just create chart in excel and extract xl/charts/chart1.xml file).
    [code]
    $objDrawing = new PHPExcel_Worksheet_ChartDrawing();
    $objDrawing->setTemplate($template); //$template is string with original chart contents
    $objDrawing->setWorksheet($worksheet);

    // set some data
    $objDrawing->setLabels($labelsRange="A1:A10");
    $objDrawing->setDataset($dataRange="B1:B10",$dataArray); //$dataArray should have actual array values
    $objDrawing->addDataset($anotherRange="C1:C10",$actualDataArray);
    // set cooridnates - must set both as positioning uses twoCellAnchor
    $objDrawing->setCoordinates("D1");
    $objDrawing->setCoordinates2("E2");
    [/code]
And thats all. I apologize for ugly code, but that was all functionality I needed at this time. Some things I got right though:
  1. Excel really needs calcChain.xml, so I generate one (PHPExcel_Writer_Excel2007_ContentTypes, PHPExcel_Writer_Excel2007_Rels,PHPExcel_Writer_Excel2007)
  2. Charts needs its own relations and content types (PHPExcel_Writer_Excel2007, PHPExcel_Writer_Excel2007_ContentTypes, PHPExcel_Writer_Excel2007_Rels)
  3. twoCell anchor works better for chart positioning that oneCellAnchor (PHPExcel_Writer_Excel2007_Drawing, PHPExcel_Worksheet_BaseDrawing)
That patch is not a complete solution but some parts of it may be a start for future work.

Mike_SEO wrote Aug 22, 2011 at 5:03 PM

That patch looks promising. I want to try it out but am struggling to apply the patch. Could you (or someone else) provide pre-patched versions?

Thanks,

Mike

Wanted wrote Oct 17, 2011 at 9:19 PM

Hello to all, this is my first comment on PHPExcel :)
This PHPExcel is very nice and the possibility to make charts will be very usefull.
I work on 1.7.6. There is the possibility to apply the patch on this version?
Or i have to download the wi16-graph branch entirely?
What is the version on the wi16-graph branch is based?

Thanks to all.

pchclininfo wrote Dec 16, 2011 at 6:27 AM

@marek
I tried to applied the patch but I do not find the PHPExcel_Writer_Excel2007_CalcChain classe.
Is there a way to get it ?
Thanks in advance

ujin_z wrote Apr 26, 2012 at 9:24 AM

I'm testing chart functionality on changeset 89095 and found some "errors".

function refresh on PHPExcel/Chart.php:
$this->$_plotArea...... should be $this->_plotArea.....

function _charttitle on PHPExcel/Reader/Excel2007/Chart.php:
gives me an error -> Node no longer exists

function _writePlotSeriesValues on PHPExcel/Writer/Excel2007/Chart.php:
$plotSeriesValues->getDataValues() returns -> "Sheet1!$B10:$B26" instead of an array of values.

function _writeTitle on PHPExcel/Writer/Excel2007/Chart.php:

doesn't check if $caption array has values, only checks if is an array

VAshot wrote Feb 6, 2013 at 12:27 PM

Can I have a scatter chart (x - A1: A10, y - B1: B100)?
Are there any ways? Using the template .xlsx, get an error when opening .xlsx in Excell.