Ticket T1146051
Visible to All Users

Chart for WPF - Custom Color Palette for pie chart

created 2 years ago

I calculate a custom color palette considering the count of data I have. I wanted that my color is getting brighter with each displayed data. I don't found a good formular or rather algorithm to do this - so I decided to decrease the A-value of my RGBA-Color.
The result is ok, but I found one issue: the line which connects one pie segment with its label does not use exactly the same color (surely to achieve a better visibility of this thin lines).
Now it would be nice if you can answer my three questions:
a) How I can make the lines ends at the border of its label (on the left, or rather on the right side)?
b) How I can make the lines to use exactly the same color like its segment and label?
c) do you know an algorithm to make color brighter only using its RGB-values

Thank you very much.

Answers approved by DevExpress Support

created 2 years ago

Hi,

You can use the following algorithm to generate a gray-scale palette based on the number of points (it should be less then 256):

C#
var cp = new CustomPalette(); for (int i = 0; i < count; i++) { byte grayScale = Convert.ToByte(i * 255d / count); cp.Colors.Add(Color.FromRgb(grayScale, grayScale, grayScale)); } chartControl1.Palette = cp;

Regarding the label's connector color and length, it looks like you customize specific styles/templates, because the default layout is displayed as expected:

So, I recommend you remove or comment out your customization and check if this fixes the issue.

If this does not help, please modify the attached code example so that we can reproduce and debug the issue locally. Thank you for your time and cooperation.

Regards,
Alessandro

    Show previous comments (3)
    Alessandro (DevExpress Support) 2 years ago

      Hi,

      We have not found an appropriate method to access or modify a connector color/layout. After discussing this behavior, we concluded that the only possible solutions are to hide connector labels or use non-transparent colors in the palette.

      Since you mentioned that the first option is not appropriate for you, please consider using the second one to achieve the correct rendering.

        This issue is caused by the alpha-blending feature of colors in WPF. Is it possible to disable alpha blending in your controls?

        Alessandro (DevExpress Support) 2 years ago

          Hi,

          Yes, since the issue is specific to color transparency, we recommend that you specify non-transparent colors (without using the alpha channel) to avoid it.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.