Posted 30 January 2023, 8:28 pm EST
Hi
We are using “@grapecity/wijmo.all”, version 5.20213.824 in an Angular 13 application.
I have a request from our business. They would like to be able to define a certain colour for a given value in a Pivot Pie Chart.
I know the Pie Chart has the palette, but that does not fully cover what I need.
Let me try to explain.
We have a , which can be configured to show as a Pie.
For some of our datasets we KNOW that the only possible values are e.g. A, B, and C. But I can’t guarantee the order of them, so palette doesn’t cover it.
But there is no way in our system that the dataset can have more values than A, B and C. The percentages between them do vary obviously.
Is there a way to hook into the rendering/calculate pipeline of the Pivot Pie chart, that lets me set that A’s are Green, B’s are Yellow and C’s are Red.
I would expect I could something using the flexPies ItemFormatter, but cant seem to get a complete hold on it.
I have this code, which hooks in fine, and the slice for “A” is rendered green if I do like this.
But the legend still shows the color from the palette - so now the pie and Palette doesnt match.
this.pivotChart.flexPie.itemFormatter = (engine: chart.IRenderEngine, hitTestInfo: chart.HitTestInfo, defaultFormat) => {
var name = hitTestInfo.name;
if (name === 'A') {
engine.fill = 'rgba(0,255,0,0.5)';
else {
defaultFormat();
}
}
I hope the request is clear, and you can provide me with a sample on how to achieve this.
Best regards
Anders