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:
Thanks in advance &
Best regards
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