Changing the chart type at runtime

Stimulsoft Reports.NET discussion
Post Reply
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

Changing the chart type at runtime

Post by satisht »

Is it possible to change the Chart type at runtime ?, if I want to change chart type from bar to pie?
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Changing the chart type at runtime

Post by Vladimir »

Code: Select all

Chart.Area = new StiPieArea();
Thank you.
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

Changing the chart type at runtime

Post by satisht »

I am having object StiReport and I have designed report at design time but how shoud i chage the type of report at runutiem?
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

Changing the chart type at runtime

Post by satisht »

I am having object of StiReport and I have designed report (chart) at design time but how should i chage the type of report at runutieme?
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Changing the chart type at runtime

Post by Vital »

You can use following code:

Code: Select all

StiChart chart = report.GetComponents()["Chart1"] as StiChart;
chart.Area= new StiPieArea();
report.Render();
Thank you.
satisht
Posts: 150
Joined: Mon Apr 09, 2007 12:28 am
Location: Pune

Changing the chart type at runtime

Post by satisht »

I have tried to chage the type of chart at runtime in vb.net but It is showing empty chart

Report.Load(Application.StartupPath + "\status.mrt")
Dim chart As StiChart = CType(Report.GetComponents()("Chart1"), StiChart)
chart.Area = New StiPieArea()
Report.Render()
Report.Compile()
Report.Show()

Can you tell me the code to do it?
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Changing the chart type at runtime

Post by Vital »

For also you need assign new series (Pie based).

Thank you.
Post Reply