Page 1 of 2

Assigning Labels to specific points in XY Line Chart

Posted: Fri Jun 23, 2006 6:36 am
by 9531181
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

Posted: Fri Jun 23, 2006 8:41 am
by narcis
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.

Posted: Fri Jun 23, 2006 10:56 am
by 9531181
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

Posted: Fri Jun 23, 2006 11:01 am
by narcis
Hi Faizullah,

Ok, send it directly to me.

Posted: Mon Jun 26, 2006 7:48 am
by narcis
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

Posted: Wed Jul 05, 2006 4:29 am
by 9531181
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

Posted: Mon Jul 10, 2006 7:45 am
by Pep
Hi,

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

Posted: Tue Jul 11, 2006 1:16 pm
by 9531181
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

Posted: Sun Jul 16, 2006 11:07 am
by Pep
Hi,

how about using the TeeCommander1_OnEditedChart() event ?

Posted: Wed Jul 19, 2006 11:52 am
by 9531181
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

Posted: Thu Jul 20, 2006 9:33 am
by Pep
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?

Posted: Fri Jul 21, 2006 8:51 am
by 9531181
Hi

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

Thanks and Regard

Posted: Fri Jul 28, 2006 6:40 am
by 9531181
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

Posted: Fri Jul 28, 2006 7:37 am
by narcis
Hi Faizullah,

You can try using:

Code: Select all

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

Posted: Wed Aug 02, 2006 7:44 am
by 9531181
Hi

I tried this code ,it works fine.

Code: Select all

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