Page 1 of 1

Accessing of chart tools

Posted: Thu Jun 11, 2009 4:07 am
by 13051032
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

Re: Accessing of chart tools

Posted: Fri Jun 12, 2009 9:19 am
by 10050769
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,