I am currently working on a Choropleth map for a dashboard I am creating.
In the dashboard designer, I changed the Map's Value colors to 0=blue, 1=green, 2=yellow, and 3=red.
However, when I build the project, all of the colors were being displayed incorrectly. For example, if a State's value was 1, it should have been colored in green, however it was instead coloring in the state blue.
Below is the code for my map for the colors:
C#customPalette1.Colors.Add(System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255))))));
customPalette1.Colors.Add(System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(175)))), ((int)(((byte)(80))))));
customPalette1.Colors.Add(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(235)))), ((int)(((byte)(59))))));
customPalette1.Colors.Add(System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(67)))), ((int)(((byte)(54))))));
valueMap1.Palette = customPalette1;
customScale1.IsPercent = false;
customScale1.RangeStops.Add(0D);
customScale1.RangeStops.Add(1D);
customScale1.RangeStops.Add(2D);
customScale1.RangeStops.Add(3D);
However, as I said when a State has a given value, it seems to subtract 1 and present that color instead (i.e: State value = 3, color should be red - however it displays Yellow).
Any help or guidance would be greatly appreciated.
-Patrick
Hello Patrick,
I would like to better investigate your scenario. Would you please describe the way you use to set a palette in greater detail? Do you try to use internal dashboards controls? What is the valueMap1 variable type? I hope to hear from you soon.
Hi Maxim,
I have taken a screenshot of my map settings using the GUI.
Since my post, I have removed line 1 and line 7 from the code above.
As for valueMap1, here is the code that initializes it:
DevExpress.DashboardCommon.ValueMap valueMap1 = new DevExpress.DashboardCommon.ValueMap(); And here is where I set the colors: valueMap1.Scale = customScale1; valueMap1.AddDataItem("Value", measure2);
All of these were set when I used the dashboard designer's drag and drop features (the GUI)
Thanks again,
-Patrick
Thank you for your clarification. Just wanted to drop you a note to let you know that we need a bit more time to finish working on our answer to your inquiry. Thanks so much for your patience.
After taking a break and looking at it again, I think I realized that what RangeStops actually does.
So if I have RangeStops(1), that essentially says that any number <1 will be marked. And for RangeStops(2), any number 1<=x<2 will be marked.
I think this is what was confusing me the most, especially because the Dashboard designer displays the information one way and in the browser it is displayed the way I described above.