Forum


Replies: 4   Views: 989
How to create a colchart with grouped values
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by dev@ram  · 05-04-2017 - 18:23

Hi,

I am looking at your addChart() example. But I'm not sure how to group data.

Suppose I have a set of 3 kpi's I have to show in a vertical bar graph(colChart)

on the x axis. The values for these KPI's could be bars between 1.0 - 10.0 on the Y axis.

Let's say these are

1) Customer Satisfaction

2) Scalability 

3) Quality of Product

Now I need to show the value of these 3 kpi's grouped by year on a bar graph(colChart).

How do I achieve this.

Please see sample data

                                                      2011      2012    2013

Customer Satisfaction                   9.5         8.6       7.0

Scalability                                      7.2         8.8       8.9 

Quality of Product                          8.2         8.7      9.1 

I need to show the kpi's on the x axis grouped by year. Also how do i format y axis labels to show like

1.0, 2.0, 3.0 ...10.0 instead of 1, 2, 3 ..10 (for majorlines)

Thank you for the great support and response time so far.

 

Posted by admin  · 06-04-2017 - 06:24

Hello,

The option groupBar allows to group the data in bar and columns chart. Please check this option in the API documentation:

https://www.phpdocx.com/api-documentation/word-content/add-chart-Word-document-with-PHP

and the included example addChart/sample_3.php

About customize major and minor units, it's supported in bar bar and line charts through majorUnit and minorUnit parameters (and also scalingMax and scalingMin).

To customize charts using parameters or styles not supported in the API method

https://www.phpdocx.com/api-documentation/word-content/add-chart-Word-document-with-PHP

we recommend to use the replaceChartData method available in Advanced and Premium licenses:

https://www.phpdocx.com/api-documentation/docxutilities/replace-chart-data-Word-document

with the MultiMerge class:

https://www.phpdocx.com/api-documentation/docxutilities/replace-chart-data-Word-document

Regards.

Posted by dev@ram  · 06-04-2017 - 12:34

To customize charts using parameters or styles not supported in the API method

Could you please confirm the link. Its the same as the first one ???

 

Posted by dev@ram  · 06-04-2017 - 13:44

Deleted by dev@ram · 06-04-2017 - 13:48

Posted by admin  · 06-04-2017 - 14:02

Hello,

Yes, it's the same link, we pointed out the groupBar parameter and the API addChart page (both are the same page). You can set groupBar as clustered and in the data array you set the values of the array; the included sample addChart/sample_3.php uses the groupBar option.

If you think you may need further support about this task, you could open a support ticket (https://www.phpdocx.com/support) an a member of the dev team will create a custom script.

Regards.