Dynamically generating the charts
Posted: Wed Dec 10, 2008 7:38 pm
Hi,
Please see the prior communication below by scrolling down. I am posting here for prompt reply.
When i use
Panel2.Controls.Add(TChart1) to define parent for the chart, i get the following compilation error. It could be because i am defining these charts as an array of Chart objects and the size of the array of these Chart objects is defined at runtime (after reading certain parameters from a file). So, I am not able to use 'Withevents' for the Chart as the VS 2005 complaining that 'Withevents' can not be used with array of objects.
If i try to create individual chart objects within the calling function, compiler says that i can not use 'Withevents' with the local variables.
So, the real question is how can i define as many chart objects as i need at the runtime. If you have any example code, please share.
Error 1 Value of type 'Steema.TeeChart.Chart' cannot be converted to
'System.Windows.Forms.Control'.
-Prototype\Form1.vb
101 40 TeeChart-Prototype
Please suggest what i should do.
Thanks,
Supriya
From: "Narcís Calvet" <support@steema.com>
Newsgroups: steema.private.support.teechart.dotnet
Sent: Wednesday, December 10, 2008 2:19 AM
Subject: Re: Dynamically generating charts
>
> Try this:
>
> Panel2.Controls.Add(TChart1)
>
> Hope this helps!
>
>
> --
> Best Regards,
>
> Narcís Calvet
> Steema Support Central
> http://support.steema.com
>
> "Important note: If you are a TeeChart registered customer, please post
> your support questions at Steema's Support monitored Forums for customers:
> http://support.steema.com for a prompter reply."
>
>
> <asupriya@xxx.xxx> wrote in message
> news:Pa%23NYYpWJHA.1896@TEEPC.Steema.local...
>> Hi,
>> I need to generate charts dynamically based on the parameters that is
>> read from a file. When i tried to do it in the following way, I get an
>> error at at the .parent setup property. Can you please help me?
>>
>> Below is my code. ChartLegends is an array of legends to be posted. There
>> needs to be one series per chart and each series should be present in the
>> legend.
>>
>> Thanks,
>> Supriya
>>
>> For i = 0 To chartLegends.Length - 2
>>
>> myFastLine(i) = New Steema.TeeChart.Styles.FastLine
>>
>> TChart1(i) = New Chart
>>
>> TChart1(i).Page.MaxPointsPerPage = 1000
>>
>> TChart1(i).Page.ScaleLastPage = False
>>
>> 'Me.Panel2.Controls.Add(Me.TChart1(i))
>>
>> 'Panel2 = CType(Panel2, Steema.TeeChart.IChart)
>>
>> TChart1(i).Parent = Panel2
>>
>> TChart1(i).Width = Panel2.Width
>>
>> TChart1(i).Height = 100
>>
>> 'TChart1(i).Page.Current = 0
>>
>> myFastLine(i).Title = chartLegends(i + 1)
>>
>> myFastLine(i).ColorEach = True
>>
>> 'myFastLine(i).Color = Color.FromArgb(333 * i)
>>
>> TChart1(i).Series.Add(myFastLine(i))
>>
>> myFastLine(i).DrawAllPoints = True
>>
>> 'myFastLine(i).TreatNulls =
>> Steema.TeeChart.Styles.TreatNullsStyle.Skip
>>
>> Next
>>
>>
>
>
Please see the prior communication below by scrolling down. I am posting here for prompt reply.
When i use
Panel2.Controls.Add(TChart1) to define parent for the chart, i get the following compilation error. It could be because i am defining these charts as an array of Chart objects and the size of the array of these Chart objects is defined at runtime (after reading certain parameters from a file). So, I am not able to use 'Withevents' for the Chart as the VS 2005 complaining that 'Withevents' can not be used with array of objects.
If i try to create individual chart objects within the calling function, compiler says that i can not use 'Withevents' with the local variables.
So, the real question is how can i define as many chart objects as i need at the runtime. If you have any example code, please share.
Error 1 Value of type 'Steema.TeeChart.Chart' cannot be converted to
'System.Windows.Forms.Control'.
-Prototype\Form1.vb
101 40 TeeChart-Prototype
Please suggest what i should do.
Thanks,
Supriya
From: "Narcís Calvet" <support@steema.com>
Newsgroups: steema.private.support.teechart.dotnet
Sent: Wednesday, December 10, 2008 2:19 AM
Subject: Re: Dynamically generating charts
>
> Try this:
>
> Panel2.Controls.Add(TChart1)
>
> Hope this helps!
>
>
> --
> Best Regards,
>
> Narcís Calvet
> Steema Support Central
> http://support.steema.com
>
> "Important note: If you are a TeeChart registered customer, please post
> your support questions at Steema's Support monitored Forums for customers:
> http://support.steema.com for a prompter reply."
>
>
> <asupriya@xxx.xxx> wrote in message
> news:Pa%23NYYpWJHA.1896@TEEPC.Steema.local...
>> Hi,
>> I need to generate charts dynamically based on the parameters that is
>> read from a file. When i tried to do it in the following way, I get an
>> error at at the .parent setup property. Can you please help me?
>>
>> Below is my code. ChartLegends is an array of legends to be posted. There
>> needs to be one series per chart and each series should be present in the
>> legend.
>>
>> Thanks,
>> Supriya
>>
>> For i = 0 To chartLegends.Length - 2
>>
>> myFastLine(i) = New Steema.TeeChart.Styles.FastLine
>>
>> TChart1(i) = New Chart
>>
>> TChart1(i).Page.MaxPointsPerPage = 1000
>>
>> TChart1(i).Page.ScaleLastPage = False
>>
>> 'Me.Panel2.Controls.Add(Me.TChart1(i))
>>
>> 'Panel2 = CType(Panel2, Steema.TeeChart.IChart)
>>
>> TChart1(i).Parent = Panel2
>>
>> TChart1(i).Width = Panel2.Width
>>
>> TChart1(i).Height = 100
>>
>> 'TChart1(i).Page.Current = 0
>>
>> myFastLine(i).Title = chartLegends(i + 1)
>>
>> myFastLine(i).ColorEach = True
>>
>> 'myFastLine(i).Color = Color.FromArgb(333 * i)
>>
>> TChart1(i).Series.Add(myFastLine(i))
>>
>> myFastLine(i).DrawAllPoints = True
>>
>> 'myFastLine(i).TreatNulls =
>> Steema.TeeChart.Styles.TreatNullsStyle.Skip
>>
>> Next
>>
>>
>
>