Forum


Replies: 7   Views: 312
Serdatalabels - how to use?
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  · 21-05-2024 - 13:18

Hello,

Please note that each chart type support only specific positions.

If you open MS Word and create a line chart, you can check the available positions for this chart type are the following: center, left, right, above (top), below (bottom).

Column chart supports the following positions: center, insideEnd, insideBase and outsideEnd.

Unfortunately, MS Word doesn't support all positions types for all chart types (https://c-rex.net/samples/ooxml/e1/Part4/OOXML_P4_DOCX_ST_DLblPos_topic_ID0EJ3QRB.html#topic_ID0EJ3QRB). And the bestFit value is not supported in most cases (and may generate a corrupted document).

For your task, maybe the best approach is adding a supported position for each series (mixing them):

'theme' => array(
    'serDataLabels' => array(
        array(
            'showValue' => 1,
            'formatCode' => '#,##0.00',
            'position' => 'top',
        ),
        array(
            'showValue' => 1,
            'formatCode' => '##,##0.000',
            'position' => 'bottom',
        ),
        array(
            'showValue' => 1,
            'formatCode' => '#,##0.0000',
            'position' => 'right',
        ),
    ),
),

Regards.