It would be great to be able to specify more layout properties via the data bound data. For example, if we could bind a property in the data to a series type we could generate different series on the fly. This is important to me as I want to make the page as responsive as possible, so all charts load on demand - but as the data is generated in an asynchronous fashion, I'm not able to predetermine how many series I can create.
Hi,
The item is declined due to lack of popularity among the community for many years.
Nevertheless, you can create the chart series dynamically based on the columns in your data base in a similar way:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GenerateChart();
}
}
private void GenerateChart()
{
DataTable dt = GetData(); //your data accessing logic here
for (int i = 1; i < dt.Columns.Count; i++)
{
DataColumn col = dt.Columns[i];
ColumnSeries series = new ColumnSeries();
series.Name = col.ColumnName;
series.DataFieldY = col.ColumnName;
RadHtmlChart1.PlotArea.Series.Add(series);
}
RadHtmlChart1.DataSource = dt;
RadHtmlChart1.DataBind();
}
private DataTable GetData()
{
DataTable dt = new DataTable();
dt.Columns.Add("nameField");
dt.Columns.Add("series1");
dt.Columns.Add("series2");
dt.Columns.Add("series3");
dt.Columns.Add("series4");
dt.Rows.Add("item 1", 10, 5, 3, 8);
dt.Rows.Add("item 2", 20, 15, 13, 28);
dt.Rows.Add("item 3", 35, 25, 23, 18);
dt.Rows.Add("item 4", 45, 35, 13, 8);
return dt;
}
Regards,
Vessy
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.