KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

How to skip first chart color? #2952

Open GHSix opened this topic on on Jan 18, 2023 - 2 comments

GHSix commented on Jan 18, 2023

Hi. I have this two connected D3 charts but, the first chart have one value more and I want this value to be the first one for normalization purposes. Now, the rest of the values are the same but are now with different colors and I would like them to be the same.

So, is there a way to skip the first color (red) in the second chart in the automatic color scheme?

KoolReport commented on Jan 19, 2023

Yes you can, you do this to remove the first color in your chart:

use \koolreport\dashboard\ColorList;

class MyChart extends BarChart
    protected function onCreated()

The array_shift() methods will remove the first color in the default color list.

GHSix commented on Jan 23, 2023

To avoid Only variables should be passed by reference error, I had to

$cl = ColorList::default();

But then I got different colors, probably because I'm using AppStack theme, but I can't figure out how to make it right since it looks like the ColorList::default is, indeed, holding the colors the AppStack uses.

I goi it right by doing like this:


But I got puzzled on the why ColorList::default didn't work as expected.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed