I want the user to choose the desired chart type (bar or line). In my code I am generating the chart and the only difference is in either creating the series with a ColumnSeries or a LineSeries. How do I declare the variable cs to use either type.
I tried defining cs as an Object but then to use it with the properties it needs to be casted but the type could be either.
if
(RadComboBoxChartType.SelectedValue==
"Bar"
)
cs =
new
ColumnSeries();
else
cs =
new
LineSeries();
cs.Name = row[
"Description"
].ToString();
cs.Appearance.FillStyle.BackgroundColor = generator.NextColor();
cs.TooltipsAppearance.ClientTemplate =
"#= series.name# : #= dataItem.value#"
;
cs.LabelsAppearance.Visible =
false
;
RadHtmlChartDashboard.PlotArea.Series.Add(cs);