Right now the only way to do data-binding in the markup is to use NameField, DataFieldY, ColorField within the PieSeries tag. This requires a per record model. My current need requires a per field model such as with some of your other controls.
You include an Items tag where each telerik:SeriesItem can be manually defined. If I could data-bind them, then I could do something such as:
<
Items
>
<
telerik:SeriesItem
NameField
=
"A1"
DataFieldY
=
"B1"
ColorField
=
"C1"
/>
<
telerik:SeriesItem
NameField
=
"A2"
DataFieldY
=
"B2"
ColorField
=
"C2"
/>
<
telerik:SeriesItem
NameField
=
"A3"
DataFieldY
=
"B3"
ColorField
=
"C3"
/>
</
Items
>
To give some context my current usage is:
RadPanelBar
ItemTemplate
Panel
RadHtmlChart + asp:Table
So you see I need to be able to do the data within the chart all as one record. This works as I know I have a static amount of items for the PieSeries. Currently I've been doing this all in my codebehind as I can do a local pivot of a subset of each record and treat it as three separate records:
DataTable chartData = GetChartData();
radHtmlChart.DataSource = chartData;
radHtmlChart.DataBind();
PieSeries pieChartSeries =
new
PieSeries();
pieChartSeries.NameField =
"Name"
;
pieChartSeries.DataFieldY =
"Percentage"
;
pieChartSeries.ColorField =
"Color"
;
radHtmlChart.PlotArea.Series.Add(pieChartSeries);
Now I know it's possible to bind my chart to a separate datasource, but I'd rather not do a whole new query. If there were a way to have a source use another source and pivot the data such as an adapter, then I'd be open to that as well. I'm still new to all of this on the markup side of things and haven't learned enough of the differences between a asp:SqlDataSource and telerik:RadClientDataSource for example.
Thanks!