TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
-
Hermes
- Newbie
- Posts: 33
- Joined: Fri Feb 03, 2012 12:00 am
Post
by Hermes » Fri Feb 24, 2012 9:18 pm
if I run this code:
Code: Select all
WebChart lChart = new WebChart();
Bar lBar1 = new Bar(lChart.Chart);
lBar1.FillSampleValues(10);
lChart.Chart.Aspect.View3D = false;
Bar lBar2 = new Bar(lChart.Chart);
lBar2.FillSampleValues(10);
Line lLine = new Line(lChart.Chart);
lLine.Function = new Steema.TeeChart.Functions.MovingAverage();
lLine.Function.Period = 3;
lLine.DataSource = lBar1;
lChart.TempChart = TempChartStyle.Httphandler;
Page.Form.Controls.Add(lChart);
I get an exception saying: IChart.FindParentForm().
It doesn't happen if I add the chart declaratively.
Any Hints?
thanks!
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Tue Feb 28, 2012 12:39 pm
Hello Hermes,
Your problem is produced by the order as you have added the components, so, you have to add WebChart in the page before add series as do in next lines of code:
Code: Select all
//chart
WebChart lChart = new WebChart();
this.Form.Controls.Add(lChart);
lChart.TempChart = TempChartStyle.Httphandler;
//Series
Bar lBar1 = new Bar(lChart.Chart);
lBar1.FillSampleValues(10);
lChart.Chart.Aspect.View3D = false;
Bar lBar2 = new Bar(lChart.Chart);
lBar2.FillSampleValues(10);
Line lLine = new Line(lChart.Chart);
lLine.Function = new Steema.TeeChart.Functions.MovingAverage();
lLine.Function.Period = 3;
lLine.DataSource = lBar1;
Can you tell us, if previous code works as you expect?
Thanks,
-
Hermes
- Newbie
- Posts: 33
- Joined: Fri Feb 03, 2012 12:00 am
Post
by Hermes » Wed Feb 29, 2012 10:35 am
Hi Sandra,
That code works, but we generate charts in a service and then send its stream to a web page so we don't have Page there.
As a workaround we instanciated a Form and added the chart to it and it seems to work. It sounds a bit dummy as the form isn't on a page or anything but untill we reach a solution it works.
Do I need to always have the chart added to a page before working with it? Even to add series or functions?
Thanks!
-
Sandra
- Site Admin
- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Mon Mar 05, 2012 4:38 pm
Hello Hermes,
I inform you that your problem is solved for next maintenance release of TeeChartFor .Net. I recommend you to be aware at this forum, our
RSS news feed,
twitter and
facebook accounts for new release announcements and what's implemented on them.
Thanks,
-
Hermes
- Newbie
- Posts: 33
- Joined: Fri Feb 03, 2012 12:00 am
Post
by Hermes » Tue Mar 06, 2012 10:25 am
That's great! Thanks!