Page 1 of 1

Point mark when point is visible

Posted: Tue Nov 30, 2010 5:45 pm
by 15051059
Hi,

Is there a way to make the mark of a point visible if and only if the point is visible on the graph?
Label_Overrun.jpg
Label_Overrun.jpg (190.33 KiB) Viewed 7457 times
In the image above, the mark [357.5] still shows even when the point is no longer visible on the graph. I tried clipping; however, it clips the mark. What I want to do is to not show the mark if the point is no longer visible.

Re: Point mark when point is visible

Posted: Wed Dec 01, 2010 9:23 am
by narcis
Hi Raymond,

Have you tried clipping marks?

Code: Select all

    TChart1.Series(0).Marks.Clip = True

Re: Point mark when point is visible

Posted: Wed Dec 01, 2010 4:35 pm
by 15051059
I tried that. The problem is it clips the marks. What I want to do is to not show the mark if the point is no longer visible on the graph. However, if the point is still visible, even though the mark will be off the graph, I still want to show the mark.

Re: Point mark when point is visible

Posted: Fri Dec 03, 2010 10:25 am
by 10050769
Hello Rymond,

Ok. I made a simple code that uses method of series CalcYPos(i). I think you can use it for solve your problem with marks in your application. Moreover we can added it request in wish-list with number (TV52015303) to be enhanced for next releases.

Code: Select all

Private Sub Form_Load()
    TChart1.Aspect.View3D = False
    TChart1.AddSeries scLine
    TChart1.Series(0).FillSampleValues 25
    TChart1.Series(0).Marks.Visible = True
End Sub
Private Sub TChart1_OnAfterDraw()

    Dim yPos As Integer
    For i = 0 To TChart1.Series(0).Count - 1
        yPos = TChart1.Series(0).CalcYPos(i)
        With TChart1.Series(0).Marks
            If (yPos < TChart1.Axis.Left.IStartPos) Or (yPos > TChart1.Axis.Left.IEndPos) Then
                .Item(i).Hide

            Else
                .Item(i).Show
            End If
        End With
    Next
End Sub
I hope will helps.

Thanks,