Finding the Default Color Used for the Series

When defining a series programmatically you can find out what series color will be drawn in using the Loaded event, like the following:

DataSeries ds = new DataSeries() { ValuesSource = new double[] { 1, 2, 3 } };

ds.Loaded += (s, e) => // fired for each plot element in data series

{

    PlotElement pe = (PlotElement)s;

    SolidColorBrush sb = pe.Fill as SolidColorBrush;

    if( sb!=null)

        Debug.WriteLine(sb.Color);

};

 

chart.Data.Children.Add(ds);

 


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.