KoolReport's Forum

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

Color homogeneity #1677

Closed Markus Mohr opened this topic on on Oct 21, 2020 - 2 comments

Markus Mohr commented on Oct 21, 2020

If I have the exact same query structure for, say, "surgery 1" compared to "surgery 2" displaying the always same 5 surgery types - when they have different percentage results, the highest one, the second one, etc. always receive the same color

How can I make each individual of the 5 surgery types retain the same color independent of their percentage?

KoolReport commented on Oct 29, 2020

May be this code will help:

PieChart::create([
    "dataSource"=>$this->dataStore("store"),
    "columns"=>[
        "category",
        "amount"=>[
            "style"=>function($row) {
                switch(($row["category"])
                {
                    case "surgery1":
                        return "color: #aaa";
                    case "surgery2":
                        return "color: #bbb";
                }
            }
        ]
    ]
]);
Markus Mohr commented on Oct 29, 2020

Thank you, I had thought of playing with the categories myself, but your explanation does the trick.

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
solved

None