This is a migrated thread and some comments may be shown as answers.

Changing chart types runtime

1 Answer 99 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Debashis Pyne
Top achievements
Rank 1
Debashis Pyne asked on 28 Aug 2010, 01:46 PM
Hi,

I have a drop down control which lists 4 of the chart types (Area, Pie, Line and Bar).

My default chart type is Pie.
I would like to change the chart type dynamically during run time based on the selection in the drop down.

The folllowing the code I have used:

protected void DdlChartType_SelectedIndexChanged(object sender, EventArgs e)
{
radChart.Clear();
chartSeries.Clear();

TextBox1.Text = DdlChartType.SelectedValue.ToString();
if (DdlChartType.SelectedValue == "ChartSeriesType.Area")
{
chartSeries.Type = ChartSeriesType.Area;
Chart1();
}
else if (DdlChartType.SelectedValue == "ChartSeriesType.Pie")
{
chartSeries.Type = ChartSeriesType.Pie;
Chart1();
}
}
}


protected void Chart1()
{
radChart.ChartTitle.TextBlock.Text = "My RadChart";
chartSeries.Name = "Sales";
chartSeries.AddItem(120, "Internet");
chartSeries.AddItem(140, "Retail");
chartSeries.AddItem(35, "Wholesale");
radChart.Series.Add(chartSeries);
this.Page.Controls.Add(radChart);
}


The problem is I am always getting the same chart type and it does not change.
is it beacuse if cache?
Any ideas?

Thanks!!

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 01 Sep 2010, 09:18 AM
Hello Debashis,

Attached to this message, is a small application, which handles a functionality close to the one which you mentioned. I hope it gets you started properly.

Regards,
Yavor
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart (Obsolete)
Asked by
Debashis Pyne
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or