Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
I think the legend order is based on the data rows' order so we have to order data rows of the chart's datastore:
$labelOrder = array(
"Cold" => 0,
"Low" => 1,
"Medium" => 2,
"Hot" => 3,
); //I'm not sure if your Null is a null value or a "Null" string
DonutChart::create(array(
"dataSource" => $this->dataStore("myDS")->sort(array(
"labelColumn" => function($a, $b) use ($labelOrder) {
if (!isset($labelOrder[$a])) return 1; // if $labelOrder[$a] == null, return 1 or -1 depending on your needed order
if (!isset($labelOrder[$b])) return -1;
if ($labelOrder[$a] === $labelOrder[$b]) return 0;
return $labelOrder[$a] > $labelOrder[$b] ? 1 : -1; //change 1 and -1 depending on your needed order
}
)),
Let us know if we understand your question correctly. Tks,
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo