Page 1 of 1

Markstip by series

Posted: Mon May 18, 2009 3:41 pm
by 13045482
I have 3 series in the chart, on each series I need to to implement a different markstip so that when I hover a point, a tooltip will show depending on the markstip I assigned. Is there someone who knows how to do this? I need a vb code for this one. I already tried using the mousehover and the gettext but still don't have luck. Thanks in advance.

Posted: Tue May 19, 2009 11:21 am
by 10050769
Hello shikha,


I am not sure what is the problem markstips in your application. Please, could you 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, and explain exactly that we do for reproduce your problem with marksTips.

Thanks,

Markstip per series

Posted: Wed May 20, 2009 5:43 am
by 13045482
The code below shows the creation of 3 series in a chart. The Markstip style in this example is set to Steema.TeeChart.Styles.MarksStyles.XY. Is it possible to set the markstip by series? Example: for the first and third series (stcslCurveLine1 and stcslCurveLine2) , I would like to set the markstip to Steema.TeeChart.Styles.MarksStyles.SeriesTitle. For the second series (stcslCurvePoints) I would like to set the markstip to Steema.TeeChart.Styles.MarksStyles.XY. So that if I hover to series 1 and 3 the markstip is the series title and if I hover to series 2 the markstip that will show is the XY values.

tcCurve is the name of the chart

Dim stcslCurveLine1 As New Steema.TeeChart.Styles.Line
Dim stcslCurvePoints As New Steema.TeeChart.Styles.Points
Dim stcslCurveLine2 As New Steema.TeeChart.Styles.Line

stcslCurveLine1.FillSampleValues(6)
stcslCurvePoints.FillSampleValues(6)
stcslCurveLine2.FillSampleValues(6)

Me.tcCurve.Series.Add(stcslCurveLine1)
Me.tcCurve.Series.Add(stcslCurvePoints)
Me.tcCurve.Series.Add(stcslCurveLine2)

Dim MarksTip1 As New Steema.TeeChart.Tools.MarksTip(tcCurve.Chart)
MarksTip1.Style = Steema.TeeChart.Styles.MarksStyles.XY

Posted: Wed May 20, 2009 10:50 am
by 10050769
Hello shikha,

I could reproduce your problem and I have added to the list of Bug Report with number [ TF02014165] we will try to fix it for next versions of TeeChart .NET

In the other hand, you could use Annotation Tools for solve your problem, I make and example Please check that next code works fine in your application:

Initialitze Chart:

Code: Select all

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        
        Dim line1 As Steema.TeeChart.Styles.Line = New Steema.TeeChart.Styles.Line(TChart1.Chart)
        Dim line2 As Steema.TeeChart.Styles.Line = New Steema.TeeChart.Styles.Line(TChart1.Chart)
        Dim point1 As Steema.TeeChart.Styles.Points = New Steema.TeeChart.Styles.Points(TChart1.Chart)

        line1.FillSampleValues(6)
        line2.FillSampleValues(6)
        point1.FillSampleValues(6)

    End Sub

MouseMove Event:

Code: Select all


    Private annotation1 As Steema.TeeChart.Tools.Annotation

    Private Sub TChart1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TChart1.MouseMove
        Dim i As Integer
        For i = 0 To TChart1.Series.Count - 1
            Dim index As Integer = TChart1(i).Clicked(e.X, e.Y)

            If (index <> -1) Then
                DrawAnnotation(i, index)
                Exit For
            End If
            If (Not (annotation1) Is Nothing) Then
                annotation1.Active = False
            End If

        Next

    End Sub

Method DrawAnnotation:

Code: Select all

Private Sub DrawAnnotation(ByVal Series As Integer, ByVal index As Integer)

        If (annotation1 Is Nothing) Then
            annotation1 = New Steema.TeeChart.Tools.Annotation(TChart1.Chart)
        End If

        annotation1.Active = True
        Dim s As Steema.TeeChart.Styles.Series = TChart1(Series)
        Dim tmp As String = s.Title

        If (Series = TChart1.Series.Count - 1) Then
            tmp = s.XValues(index).ToString() + " " + s.YValues(index).ToString()
        End If

        annotation1.Text = tmp
        annotation1.Shape.CustomPosition = True
        annotation1.Shape.Left = s.CalcXPos(index)
        annotation1.Shape.Top = s.CalcYPos(index)

    End Sub
I hope that will helps

Thanks

Thanks Thanks

Posted: Thu May 21, 2009 6:43 am
by 13045482
Thank you very much. The code you gave me works. Thank you very much