Forum


Replies: 1   Views: 272
Chart colors of column, line and radarchart
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 256bytes  · 16-04-2024 - 14:38

Hi,

i am using phpdocx13 premium and i am building a radarchart, a bar chart and a linechart. however i am not able to use custom colors in the line and radarchart.

the examples provided dont have a linechart example included.

the colors do work with a colChart but not with a lineChart and not with a radarChart.

can you provide a simple example with that chart types?

             $data = [
                        'legend' => array('Series 1', 'Series 2'),
                    'data'   => array(
                                array(
                                        'name' => '2019',
                                        'values' => array(10, 7),
                                ),
                                array(
                                        'name' => '2020',
                                        'values' => array(20, 60),
                                ),
                                array(
                                        'name' => '2021',
                                        'values' => array(50, 33),
                                ),
                                array(
                                        'name' => '2022',
                                        'values' => array(25, 2),
                                ),
                                array(
                                        'name' => '2023',
                                        'values' => array(20, 8),
                                )
                        )
                ];

                $params = [
                        'data' => $data,
                        'color'     => 3,
                                'sizeX'     => 8,
                                'sizeY'     => 3.3,
                                'legendPos' => 'none',
                        'type'      => 'colChart',
                        'hgrid'     => 1,
                        'vgrid'     => 1,
                        'stylesTitle' => [
                                'bold'     => true,
                                'fontSize' => 750
                        ],
                        'theme'     => [
                                'serRgbColors' => ['FF0000', '00FF00']
                        ]
                ];

                $docx->addChart($params);