Within my Pie chart, I have specific elements that I want to show as the same color always. I have tried using the brushes option ot set my colors in the same order as my dataset, but of course sometimes some pieces of the data might be ), and therefore not draw, which then throws the brushes off.
How can I make sure that Element A always has color "#FEFEFE" and Element F always has color "#123456"?
Hristo, I found one more issue. If the pie is missing more than one slice, the wrong colors get removed by this function because it removes the array items by index starting with the first which causes the second slice to refer to the wrong index as they have been renumbered by the first remove. I worked around this by processing the array in reverse order (code follows)
Hi Greg,
Thanks for your explanation. I missed to consider that my code is iterating the data using jQuery $.each and the dataSourceUrl in your case actually would return a string. I am glad you have resolved the issue. True that it seems too much effort to just apply color, but as you understand it is like a custom scenario, because the default colors do not suit you.
You can still log a feature request about that at ideas.infragistics.com
Hristo, using DataSourceUrl and your code, I would get a jquery error on one of the $.each lines in your code.
I fixed it by wrapping the pie chart code with
$.getJSON(myurl, function (data) {
And then I removed the datasourceUrl property and instead set datasource to data.
At this point, the error went away but my colors were still mismatched. I had to change my datasource to include entries with 0 for the missing slices then the code started working.
This seems like a lot of code to just set the slice colors.
Defining a brushesh array has nothing to do with the DataSourceUrl and should not be affected by it. Could you please send a sample or explain what exactly the issue is ?
Is there a better way to do this with the latest version of the controls?
I tried your sample code but it fails since I am using dataSourceUrl to set my data source.
Alternatively, is there a way to make this work with dataSourceUrl ?