Spider Label Color

5 posts, 0 answers
  1. Cap
    Cap avatar
    2 posts
    Member since:
    Jun 2010

    Posted 20 Jul 2010 Link to this post

    Hi, 

    We are trying to set custom colors for Silces in a pie chart as given below .

    private static Style CreateItemStyle(Control control, Style baseStyle, DataPoint dataPoint, DataSeries dataSeries)
            {
                if (control is ChartLegendItem)
                    return baseStyle;

                if (dataPoint == null)
                    return baseStyle;
                Style newStyle = new Style(baseStyle.TargetType);
                newStyle.BasedOn = baseStyle;
                if (control is BaseChartItem2D)
                {
                    Brush brush = Utils.CustomDrawChart.Palette[ColorCount];
                    newStyle.Setters.Add(new Setter(Shape.FillProperty, brush));
                }
                ColorCount++;
                return newStyle;
            }


    But our spider labels are showing up in a different color( Obviously set by default rendering ) 
    Any help on how to solve this?

    Thanks 

    Rosh
  2. Cap
    Cap avatar
    2 posts
    Member since:
    Jun 2010

    Posted 21 Jul 2010 Link to this post

    Helloooooooooooooo helloo.... (echo) 

    Any little help here ? - admin? Vladimir ??

  3. Sia
    Admin
    Sia avatar
    745 posts

    Posted 21 Jul 2010 Link to this post

    Hi Cap,

    You need to add another if condition concerning the labels in your code as follows:
    if (control is SeriesItemLabel)
    {
       Brush brush = new SolidColorBrush(Colors.Red);
       newStyle.Setters.Add(new Setter(SeriesItemLabel.FillProperty, brush));
       newStyle.Setters.Add(new Setter(SeriesItemLabel.StrokeProperty, brush));
    }

    Of course you need to use the same color as the one for the slices:
    Brush brush = Utils.CustomDrawChart.Palette[ColorCount];

    Regards,
    Sia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. Jeff Kershner
    Jeff Kershner avatar
    62 posts
    Member since:
    Aug 2009

    Posted 07 Sep 2010 Link to this post

    I have a similar problem where I am using the chart.CreateItemStyleDelegate.  My spider lines and backgrounds are also the wrong colors. 

    private Style BuildCustomItemStyle(Control item, Style style, DataPoint point, DataSeries dataSeries)
    {
        if ((item as BaseChartItem) == null)
            return style;
      
        Style newStyle = new Style();
        newStyle.BasedOn = style;
      
        newStyle.TargetType = typeof(Shape);
      
        Brush brush;
      
        switch ((item as BaseChartItem).CurrentIndex % 7)
        {
            case 0:
                brush = new SolidColorBrush(Color.FromArgb(255, 2, 123, 8));
                break;
      
            case 1:
                brush = new SolidColorBrush(Color.FromArgb(255, 238, 192, 5));
                break;
      
            case 2:
                brush = new SolidColorBrush(Color.FromArgb(255, 238, 97, 6));
                break;
      
            case 3:
                brush = new SolidColorBrush(Color.FromArgb(255, 1, 240, 6));
                break;
      
            case 4:
                brush = new SolidColorBrush(Color.FromArgb(255, 238, 240, 6));
                break;
      
            case 5:
                brush = new SolidColorBrush(Color.FromArgb(255, 179, 181, 183));
                break;
      
            default://case 6:
                brush = new SolidColorBrush(Color.FromArgb(255, 237, 240, 242));
                break;
        }
      
        newStyle.Setters.Add(new Setter(Shape.FillProperty, brush));
        return newStyle;
    }
  5. Sia
    Admin
    Sia avatar
    745 posts

    Posted 10 Sep 2010 Link to this post

    Hello Jeff Kershner,

    Please check my answer here.

    Greetings,
    Sia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top