Forum


Replies: 1   Views: 63
Chart colors of column, line and radarchart

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);

 

Posted by admin  · 16-04-2024 - 14:43

Hello,

UPDATE: we have replied by email a minor patch to apply custom theme colors to lines (it will be included in the next stable release of phpdocx) as required by these chart types and code samples.

You username doesn't have any license tied. Please send to contact[at]phpdocx.com the username or email of the user that purchased the license you are using.

Regards.