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!!
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!!