Forum


Replies: 3   Views: 926
Repeat x axis name in colchart
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 admin  · 20-02-2017 - 09:22

Hello,

phpdocx uses associative arrays as X name values, so you need to add unique values.

You can add empty spaces to repeat values, but if you need to use the exact name as axis, please edit the CreateBarChart.inc file and change these lines:

foreach ($this->values as $legend => $value) {
    if ($legend == 'legend') {
        continue;
    }
    $this->generatePT($num);
    $this->generateV($legend);
    $num++;
}

By a new code that uses other array value instead of key values. For example:

foreach ($this->values as $value) {
    if ($value['legend'] == 'legend') {
        continue;
    }
    $this->generatePT($num);
    $this->generateV($value['legend']);
    $num++;
}

You also need to change $this->values variable in this same file to storage the data values. So instead of settings legends as array key, you can use other array value to set legends.

We have added a task to consider adding these changes to a future release of the library, but the current version of phpdocx uses unique values as X axis names.

Regards,
phpdocx support team