This is a migrated thread and some comments may be shown as answers.

Setting DisplayMember has no effect

2 Answers 94 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
OLIVER
Top achievements
Rank 1
OLIVER asked on 22 Aug 2012, 08:44 AM
Hello Telerik,

I`m currently evaluating wether the ChartView could fit our needs.

Now I got stuck when trying to give the Y-values displayed in the Chart another format (currency):
I`m setting LineSeries instance properties "DisplayMember" without achieving an effect i.e. the values are displayed the same way as if DisplayMember  was not set (f.e. 4995148.92 instead of 4.995.148.92 €).

This is the code:

public partial class Form1 : Form
{
 
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        InitChartView();
    }       
 
    private void InitChartView()
    {
        var series1 = new LineSeries();
        series1.DisplayMember = "ValueFormatted";
        series1.ValueMember = "Value";
        series1.CategoryMember = "Category";
        series1.DataSource = Data.GetSomeDataYear1();
        series1.ShowLabels = true;
        radChartView1.Series.Add(series1);
 
        var series2 = new LineSeries();
        series2.ValueMember = "Value";
        series2.CategoryMember = "Category";
        series2.DisplayMember = "ValueFormatted";
        series2.DataSource = Data.GetSomeDataYear2();
        series2.ShowLabels = true;
        radChartView1.Series.Add(series2);
    }
}
 
public class SomeChartData
{
    public decimal Value { get; set; }
    public string ValueFormatted { get { return Value.ToString("C", CultureInfo.GetCultureInfo("de-DE")); } }
    public string Category { get; set; }
}
 
public static class Data
{
    public static IList<SomeChartData> GetSomeDataYear1(){
        return new List<SomeChartData>(){
            new SomeChartData() { Category = "Jan",        Value = 4845741.12M },
            new SomeChartData() { Category = "Feb",        Value = 4345642.41M },
            new SomeChartData() { Category = "März",       Value = 4237854.06M },
            new SomeChartData() { Category = "April",      Value = 4035341.33M },
            new SomeChartData() { Category = "Mai",        Value = 3843723.21M },
            new SomeChartData() { Category = "Juni",       Value = 4125344.42M },
            new SomeChartData() { Category = "Juli",       Value = 4443741.22M },
            new SomeChartData() { Category = "August",     Value = 4645530.42M },
            new SomeChartData() { Category = "September",  Value = 5144431.39M },
            new SomeChartData() { Category = "Oktober",    Value = 5034720.42M },
            new SomeChartData() { Category = "November",   Value = 5030842.98M },
            new SomeChartData() { Category = "Dezember",   Value = 4995148.92M }
        };
    }
}

Thanks in advance &
Best regards

2 Answers, 1 is accepted

Sort by
0
OLIVER
Top achievements
Rank 1
answered on 22 Aug 2012, 09:26 AM
I forgot to mention : the Version is 2012.2.726.20.
0
Accepted
Julian Benkov
Telerik team
answered on 24 Aug 2012, 02:53 PM
Hello Oliver,

Thank you for wriiting.

I logged the issue in our Public Issue Tracking System. Currently, the rendering system of RadChartView does not support this functionality. For the next version we will extend and introduce the Label rendering and customization functionality. The new label elements will support DisplayMember binding, formatting settings and mechanism for override.

Thank you for your time and cooperation. Your Telerik points have been updated.

Kind regards,
Julian Benkov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
ChartView
Asked by
OLIVER
Top achievements
Rank 1
Answers by
OLIVER
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or