Accessing of chart tools

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
asupriya
Advanced
Posts: 179
Joined: Mon Dec 01, 2008 12:00 am

Accessing of chart tools

Post by asupriya » Thu Jun 11, 2009 4:07 am

I have a cursortool and a colorline tools added to a dynamically generated chart. CursorTool is added first and then the colorline tool.

Now, i want to access these tools. I am currently accessing these tools in the order of addition to the chart as follows:

Code: Select all

CType(myDynamicChart.Tools.Item(0), Steema.TeeChart.Tools.CursorTool).XValue = myXValue

CType(myDynamicChart.Tools.Item(1), Steema.TeeChart.Tools.ColorLine).Value = myValue
But, sometimes the tools index is reversed (index 0 shows the colorline and 1 shows the cursortool) and is throwing an exception. How can I reliably access these tools on a dynamically generated chart?

Thanks

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Accessing of chart tools

Post by Sandra » Fri Jun 12, 2009 9:19 am

Hello asupriya,

I couldn't reproduce your problem with last version of TeeChart .Net v4 and and I couldn't reproduce the problem in v2 either. Please use next code for check if type of tools is correct.

Code: Select all

  Private Sub InitializeChart()
        TChart1.Aspect.View3D = False
        Line1 = New Steema.TeeChart.Styles.Line(TChart1.Chart)
        CursorTool1 = New Steema.TeeChart.Tools.CursorTool(TChart1.Chart)
        ColorLine1 = New Steema.TeeChart.Tools.ColorLine(TChart1.Chart)
        Line1.FillSampleValues(5)

        If (TypeOf TChart1.Tools.Item(0) Is Steema.TeeChart.Tools.CursorTool) Then
            CType(TChart1.Tools.Item(0), Steema.TeeChart.Tools.CursorTool).FastCursor = True
        End If
        CType(TChart1.Tools.Item(0), Steema.TeeChart.Tools.CursorTool).XValue = 3
        CType(TChart1.Tools.Item(1), Steema.TeeChart.Tools.ColorLine).Value = 100
        If (TypeOf TChart1.Tools.Item(0) Is Steema.TeeChart.Tools.CursorTool) Then
            CType(TChart1.Tools.Item(0), Steema.TeeChart.Tools.CursorTool).FastCursor = True

        End If
        
    End Sub
If this not works fine, please, you could send us a simple example project we can run "as-is" to reproduce the problem here? You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply