Assigning Labels to specific points in XY Line Chart

TeeChart for ActiveX, COM and ASP
Faizullah Khan
Newbie
Newbie
Posts: 50
Joined: Wed Apr 26, 2006 12:00 am

Assigning Labels to specific points in XY Line Chart

Post by Faizullah Khan » Fri Jun 23, 2006 6:36 am

Hi,

I am using XY line Chart ,my requirement is that I want to assign Point lables for specific XY points .

This is just a sample Code

Code: Select all


For i = 0 To 10

    If pointlabel <> vbNullString Then
        TChart2.Series(0).AddXY i + 4, i + 3, PointLabe, clTeeColor
    Else
        TChart2.Series(0).AddXY i + 2, i + 5, "", clTeeColor
    End If

 Next

But problem is that it add the Point Lables on the X-Axis as Labels of Points.

is it possible that i directly send the sample project to Steema support Team.

VB .0
Windows Xp
TeeChart Pro 7

kindly help me in this regard

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jun 23, 2006 8:41 am

Hi Faizullah,

If you don't want the labels being displayed in the bottom axis you can use:

Code: Select all

    TChart1.Axis.Bottom.Labels.Style=talValue
If this doesn't solve the problem please post your example project at news://www.steema.net/steema.public.attachments newsgroup.
Best Regards,
Narcís Calvet / 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

Faizullah Khan
Newbie
Newbie
Posts: 50
Joined: Wed Apr 26, 2006 12:00 am

Post by Faizullah Khan » Fri Jun 23, 2006 10:56 am

hi

This code only disable the lables that are drawn on the x-Axix,
I want to draw these Labels on the Specific XY points ,how this possible.
I have problems to access the newsgroup
kindly provide me mail address so so that i send my code directly.

Its urgent.....
Thanks

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jun 23, 2006 11:01 am

Hi Faizullah,

Ok, send it directly to me.
Last edited by Narcís on Wed Oct 04, 2006 11:05 am, edited 1 time in total.
Best Regards,
Narcís Calvet / 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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jun 26, 2006 7:48 am

Hi Faizullah,

Thanks for the example. You have 2 options to achieve what you request:

1. Making you series marks visible, setting them to display the labels:

Code: Select all

   TChart1.Series(0).Marks.Visible = True
   TChart1.Series(0).Marks.Style = smsLabel
and hide the marks which don't have a customized label:

Code: Select all

Private Sub TChart1_OnGetSeriesMark(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, MarkText As String)
    If (MarkText = CStr(TChart1.Series(SeriesIndex).YValues.Value(ValueIndex))) Then
        MarkText = ""
    End If
End Sub
2. Custom drawing on TeeChart's canvas using the OnAfterDraw event, i.e.:

Code: Select all

Private Sub TChart1_OnAfterDraw()
    TChart1.Canvas.TextOut TChart1.Series(0).CalcXPosValue(5), TChart1.Series(0).CalcYPosValue(10), "My custom text"
End Sub
Best Regards,
Narcís Calvet / 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

Faizullah Khan
Newbie
Newbie
Posts: 50
Joined: Wed Apr 26, 2006 12:00 am

Post by Faizullah Khan » Wed Jul 05, 2006 4:29 am

Hi

Thanks ,my point label problem is solved with little modification

Code: Select all

Private Sub TChart1_OnGetSeriesMark(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, MarkText As String)

    MarkText = CStr(TChart1.Series(SeriesIndex).PointLabel(ValueIndex))

    If UCase(MarkText) = "AB" 
      Exit Sub
    Else
      MarkText = ""
    End If

End Sub
But When at run time I Change some properties like Series Color the values are again shown on the points. How can I handle this situation.

Thanks and Regard

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Jul 10, 2006 7:45 am

Hi,

have you tried to do a Repaint (TChart1.Repaint), after the changes has been applied ?

Faizullah Khan
Newbie
Newbie
Posts: 50
Joined: Wed Apr 26, 2006 12:00 am

Post by Faizullah Khan » Tue Jul 11, 2006 1:16 pm

Hi


This situation is occur when I Change some properties like Series Color
from the ToolBar (TeeEditor) the values are again shown on the points.

On What Event of TeeChart I use TChart1.Repaint.

Thanks & Regards

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Sun Jul 16, 2006 11:07 am

Hi,

how about using the TeeCommander1_OnEditedChart() event ?

Faizullah Khan
Newbie
Newbie
Posts: 50
Joined: Wed Apr 26, 2006 12:00 am

Post by Faizullah Khan » Wed Jul 19, 2006 11:52 am

Hi
Thanks for timely responce
This event

Code: Select all

Private Sub TeeCommander1_OnEditedChart()
  TChart1.Repaint
End Sub
works fine when we change some poperties from the ToolBar and after closing the ToolBar the point values disappered as my requirement.

But when we go to "Print" Option from the ToolBar again point values shown on the series and staight forwardly point values printed,when we print the Chart.

Kindly suggest a comprehensive solution for this problem.
very urgent

Thanks & Regards

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Jul 20, 2006 9:33 am

Hi,

IN VB6.0 these kinds of problems are remedied by creating an EXE from your project and running it - have you tried doing that with your project?

Faizullah Khan
Newbie
Newbie
Posts: 50
Joined: Wed Apr 26, 2006 12:00 am

Post by Faizullah Khan » Fri Jul 21, 2006 8:51 am

Hi

Creating Exe of project and running, these problems are solved.

Thanks and Regard

Faizullah Khan
Newbie
Newbie
Posts: 50
Joined: Wed Apr 26, 2006 12:00 am

Post by Faizullah Khan » Fri Jul 28, 2006 6:40 am

Hi

When we drag the chart with mouse scrolling then the point labels that are shown on the points ,are still visible even if it is outside the chart fram.

how we hide the point label when it goes out of the chart displayed area .


Thanks & Regards

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jul 28, 2006 7:37 am

Hi Faizullah,

You can try using:

Code: Select all

    TChart1.Series(0).Marks.Clip = True
Best Regards,
Narcís Calvet / 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

Faizullah Khan
Newbie
Newbie
Posts: 50
Joined: Wed Apr 26, 2006 12:00 am

Post by Faizullah Khan » Wed Aug 02, 2006 7:44 am

Hi

I tried this code ,it works fine.

Code: Select all

TChart1.Series(0).Marks.Clip = True
Thanks & Regards[/code]

Post Reply