Ticket Q480759
Visible to All Users

Set series colors

created 12 years ago

Hi,
I have a chart where I'm adding series at runtime. Some of the series I want change their colors to match a related series. But after I'm done adding the chart series, the series colors are not yet set, so the pallette colors get assigned every time. I want to use the pallete colors but after colors are assigned, i need to go through the series and match the color of some series to that of its related series. When do the series colors get set? Is there an event i can subscribe to? Or a way to force the color assignments at runtime?
(I'm using Series.View.Color to set the colors of the series but since the colors haven't yet been set, they all end up Color.Empty)

(I'm trying to set line series colors to match that of related bar series.)
Thanks,
Andy

Comments (1)

    See attached screen shot

    Answers approved by DevExpress Support

    created 12 years ago (modified 12 years ago)

    Use the ChartControl.GetPaletteEntries Method to obtain the series color:

    C#
    PaletteEntry[] palette = WebChartControl1.GetPaletteEntries(WebChartControl1.Series.Count); Color seriesColor = palette[<SeriesIndex>].Color;

    Then you can set a new color either by using Series.View.Color or in the CustomDrawSeries event handler.

      Show previous comments (2)
      DevExpress Support Team 11 years ago

        Hi Timo,
        I confirm that this behavior is correct (see my answer in the Q533309 ticket). Feel free to update the ticket if further assistance is necessary. I will be glad to help you.

          I'm using WPF ChartControl BarStackedSeries2D and need the same control on the colors. GetPaletteEntries is not support. Please, advice

          DevExpress Support Team 11 years ago

            Hi Sarit,

            Palette entries can be obtained using the Palette[index] syntax. Please try this approach and let me know if you have any questions.

            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.