[CLOSED] line drawn out of boundaries of the chart

TeeChart for ActiveX, COM and ASP
Post Reply
jika
Newbie
Newbie
Posts: 27
Joined: Mon Mar 18, 2013 12:00 am

[CLOSED] line drawn out of boundaries of the chart

Post by jika » Fri Apr 12, 2013 11:45 am

after Scoll, the line drawn on top of the chart is outside the boundaries of the chart
Attachments
steema topline.PNG
steema topline.PNG (44.23 KiB) Viewed 9181 times
Last edited by jika on Fri Apr 12, 2013 3:12 pm, edited 1 time in total.

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: line drawn out of boundaries of the chart

Post by Yeray » Fri Apr 12, 2013 12:07 pm

Hello,

I assume you followed the example I wrote here.
That was just an example to show you how to start. There are basically used:
- FirstValueIndex and LastValueIndex properties to loop through the series.
- IsNull function to check what points are the nulls. In that example the nulls are the frontier between two arrows. Your case may be different.
- CalcXPos to get the X position in pixels of a point.
- GetChartRect Left and Right properties to get the limits of the chart in pixels.
- Canvas DrawLine to draw the different parts of the arrows.
- Canvas TextOut to draw the texts.

The rest is just logic to determine when to draw what part of the arrows. If you find something isn't being drawn as you expected please, feel free to modify that code to fit your needs.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

jika
Newbie
Newbie
Posts: 27
Joined: Mon Mar 18, 2013 12:00 am

Re: line drawn out of boundaries of the chart

Post by jika » Fri Apr 12, 2013 12:26 pm

Your example is very clear.
I used to make my program.
everything works fine,
thank you

there is one little problem that I have not solve.
when I scroll the chart, the lines drawn outside the chart.

for marks
Marks.clip = true
for points
tchart1.clip = true

but for lines and text
???

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: line drawn out of boundaries of the chart

Post by Yeray » Fri Apr 12, 2013 1:19 pm

Hi,

Right. These clip functions control whether a mark or a point has to be drawn out of the boundaries or not.
However, since these arrows are being drawn manually at OnAfterDraw event, you have to fully control it in the same event.

On the other hand, when I scroll that example, the arrow looks fine for me here:
clipping.png
clipping.png (17.68 KiB) Viewed 9148 times
I'm using TeeChart v2012.0.0.9, VB6 and Windows 7 x64

Also note you can also set a region clipping before using the drawing functions at OnafterDraw event, and unclip the region after the drawing. For example:

Code: Select all

Private Sub TChart1_OnAfterDraw()
  With TChart1.GetChartRect
    TChart1.Canvas.ClipRectangle .Left, 0, .Right, .Bottom
  End With

  'Drawing stuff

  TChart1.Canvas.UnClipRectangle
End Sub
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply