Completed
Last Updated: 13 Nov 2014 08:48 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 08 Oct 2014 10:41
Category: ChartView
Type: Bug Report
0
FIX. RadChartView - The BackColor is lost in the legend for inherited BarSeries
To reproduce:

public partial class Form1 : Form
{
    private BindingList<MyData> data;

    public Form1()
    {
        InitializeComponent();
        LoadDatas();

        MyBarSeries bars = new MyBarSeries();
        bars.DataSource = data;
        bars.ValueMember = "Montant";
        bars.CategoryMember = "Month";
        bars.LegendTitle = "My series of MyData";
        this.radChartView1.ShowLegend = true;
        this.radChartView1.Series.Add(bars);
    }

    private void LoadDatas()
    {
        data = new BindingList<MyData>();
        data.Add(new MyData(20, "janv", 1));
        data.Add(new MyData(50, "fev", 2));
        data.Add(new MyData(30, "mars", 3));
        data.Add(new MyData(25, "avril", 4));
        data.Add(new MyData(40, "mai", 5));
        data.Add(new MyData(80, "juin", 6));
        data.Add(new MyData(20, "juil", 7));
    }

    public class MyData
    {
        public int Montant { get; set; }

        public string Month { get; set; }

        public double NumMonth { get; set; }

        public MyData(int montant, string month, double numMonth)
        {
            this.Montant = montant;
            this.Month = month;
            this.NumMonth = numMonth;
        }
    }

    public class MyBarSeries : BarSeries
    {
       
    }
}

Resolution: 
When you inherit from a serie, the original control themes are not automatically inherited. You need to override the ThemeRole property. Here is the code snippet: 
public class MyBarSeries : BarSeries
{
    public override string ThemeRole
    {
        get
        {
            return typeof(BarSeries).Name;
        }
    }
}
Attached Files:
0 comments