Horizontal Target Line Drawn on Bar Chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
phil1995
Newbie
Newbie
Posts: 3
Joined: Tue May 21, 2013 12:00 am

Horizontal Target Line Drawn on Bar Chart

Post by phil1995 » Tue Jul 16, 2013 5:51 pm

I would like to draw a horizontal target line stretching from the X axis origin to the end of the X axis. From best I can tell, I need to use the afterdraw event to make this work. I have not been able to successfully get the afterdraw event to fire. Could someone please help me with the following items:

1. How to get the afterdraw event to fire using VB.Net
2. How to draw a horizontal line at a given Y coordinate from the X axis Origin to the X axis termination.

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

Re: Horizontal Target Line Drawn on Bar Chart

Post by Sandra » Wed Jul 17, 2013 11:44 am

Hello phil1995,

I think you can do something as next code:

Code: Select all

  Private ch1 As Steema.TeeChart.TChart
    Private line As Steema.TeeChart.Styles.Line
    Private Sub Initializechart()

        ch1 = New Steema.TeeChart.TChart()
        Me.Controls.Add(ch1)
        ch1.Aspect.View3D = False
        line = New Line(ch1.Chart)
        line.FillSampleValues()
        AddHandler ch1.AfterDraw, AddressOf ch1_AfterDraw

    End Sub
  
    Private Sub ch1_AfterDraw(sender As Object, g As Steema.TeeChart.Drawing.Graphics3D)
        Dim p0, p1 As Point
        Dim depth, depth1 As Integer
        p0 = New Point(ch1.Axes.Bottom.IStartPos, ch1.Axes.Left.CalcYPosValue(ch1(0).YValues(0)))
        p1 = New Point(ch1.Axes.Bottom.IEndPos, ch1.Axes.Left.CalcYPosValue(ch1(0).YValues(0)))
        depth = ch1.Axes.Depth.IStartPos
        depth1 = ch1.Axes.Depth.IEndPos
        g.Line(p0, p1, depth1)
    End Sub
Could you tell us if previous code works in your end?

I hope will helps.

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