assignMissingColors method
void
assignMissingColors(
- Iterable<
MutableSeries< seriesList, {D> > - required bool emptyCategoryUsesSinglePalette,
inherited
Assigns missing colors in case when color accessor functions are not set.
Assigned color is based on the depth of each node.
Implementation
@override
void assignMissingColors(Iterable<MutableSeries<D>> seriesList,
{required bool emptyCategoryUsesSinglePalette}) {
for (final series in seriesList) {
final colorPalettes =
StyleFactory.style.getOrderedPalettes(series.data.length);
final count = colorPalettes.length;
series.fillColorFn ??= (int? index) {
var node = series.data[index!] as TreeNode<Object>;
return colorPalettes[node.depth % count].shadeDefault;
};
// Pattern color and stroke color defaults to the default config stroke
// color if no accessor is provided.
series.colorFn ??= (index) => config.strokeColor;
series.patternColorFn ??= (index) => config.strokeColor;
}
}