Hi All
I am trying to bind list below to a Radchart but it isn't binding correctly.
Can anyone please help?
Below code and Markup - attached JPG of what it looks like when I run it.
It should group by name, trnasmission and fuel - then display results for the year
I would like to see 4 series :-
BMW Auto Petrol
BMW Manual Petrol
BMW Auto Diesel
BMW Auto Petrol
Any help much appreciated.
Kind Regards,
Ram
I am trying to bind list below to a Radchart but it isn't binding correctly.
Can anyone please help?
Below code and Markup - attached JPG of what it looks like when I run it.
It should group by name, trnasmission and fuel - then display results for the year
I would like to see 4 series :-
BMW Auto Petrol
BMW Manual Petrol
BMW Auto Diesel
BMW Auto Petrol
Any help much appreciated.
Kind Regards,
Ram
if
(!IsPostBack)
{
var bm =
new
List<BMW>();
bm.Add(
new
BMW() { name =
"BMW"
, value = 1, transmission =
"auto"
, year = 2012, fuel =
"Petrol"
});
bm.Add(
new
BMW() { name =
"BMW"
, value = 2, transmission =
"auto"
, year = 2013, fuel =
"Petrol"
});
bm.Add(
new
BMW() { name =
"BMW"
, value = 3, transmission =
"manual"
, year = 2012, fuel =
"Petrol"
});
bm.Add(
new
BMW() { name =
"BMW"
, value = 4, transmission =
"manual"
, year = 2013, fuel =
"Petrol"
});
bm.Add(
new
BMW() { name =
"BMW"
, value = 5, transmission =
"auto"
, year = 2012, fuel =
"Diesel"
});
bm.Add(
new
BMW() { name =
"BMW"
, value = 6, transmission =
"auto"
, year = 2013, fuel =
"Diesel"
});
bm.Add(
new
BMW() { name =
"BMW"
, value = 7, transmission =
"manual"
, year = 2012, fuel =
"Diesel"
});
bm.Add(
new
BMW() { name =
"BMW"
, value = 8, transmission =
"manual"
, year = 2013, fuel =
"Diesel"
});
testing.PlotArea.XAxis.DataLabelsColumn =
"year"
;
testing.DefaultType = Telerik.Charting.ChartSeriesType.Line;
//Use DataGroupColumn in order to group items
testing.DataGroupColumn =
"name"
;
testing.DataManager.ValuesYColumns =
new
string
[] {
"transmission"
,
"fuel"
};
testing.DataSource = bm;
testing.Height = 1200;
testing.Width = 1090;
testing.DataBind();
}
}
public
class
BMW
{
public
string
name {
get
;
set
; }
public
double
value {
get
;
set
; }
public
string
transmission {
get
;
set
; }
public
int
year {
get
;
set
; }
public
string
fuel {
get
;
set
; }
}
<
telerik:RadChart
ID
=
"testing"
runat
=
"server"
Width
=
"400px"
SeriesOrientation
=
"Vertical"
>
<
Series
>
<
telerik:ChartSeries
DataYColumn
=
"value"
Type
=
"Line"
Appearance-ShowLabels
=
"true"
>
</
telerik:ChartSeries
>
</
Series
>
</
telerik:RadChart
>