Area Graph question

TeeChart for ActiveX, COM and ASP
Post Reply
Teechart Activex Question
Newbie
Newbie
Posts: 19
Joined: Fri Nov 15, 2002 12:00 am
Contact:

Area Graph question

Post by Teechart Activex Question » Thu Feb 12, 2004 6:50 pm

HOw do i put a text in the middle of each area?Example i want to say
my first area graph is "high" by putting a text label high in the middle
of that high area

Chart.AddSeries scArea
Chart.Series(0).asArea.UseYOrigin = True
Chart.Series(0).asArea.YOrigin = Spimax
Chart.Series(0).Add Spimax CDate(GraphArray(1, i)), VbColor(14)

Chart.AddSeries scArea
Chart.Series(1).Title = "Project at Risk"
Chart.Series(1).asArea.UseYOrigin = True
Chart.Series(1).asArea.YOrigin = Spimin
Chart.Series(1).Add Spimax, CDate(GraphArray(1, i)), VbColor(12)

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

Post by Pep » Fri Feb 13, 2004 9:40 am

Hi,

you could use something like the following ocde (also you can customize the text and the Marks you want to show) :

Code: Select all

Private Sub Form_Load()
With TChart1
    .Aspect.View3D = False
    .AddSeries scArea
    .Series(0).FillSampleValues 10
    .Series(0).Marks.Visible = True
End With
End Sub

Private Sub TChart1_OnGetSeriesMark(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, MarkText As String)
Dim BarHeight As Double
With TChart1
    AreaHeight = (.Axis.Bottom.Position - .Series(0).CalcYPos(ValueIndex)) / 2
    .Series(0).Marks.ArrowLength = AreaHeight * -1 - 8
    .Series(0).Marks.Arrow.Visible = False
End With
End Sub

Teechart Activex Question
Newbie
Newbie
Posts: 19
Joined: Fri Nov 15, 2002 12:00 am
Contact:

How do i assign the MarkText?

Post by Teechart Activex Question » Fri Feb 13, 2004 2:45 pm

Thanks for answering previous question.
Regaring this post, i just want to know how i assign MarkText to area graph?

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

Post by Pep » Sun Feb 15, 2004 6:42 pm

Hi,

you must set the Marks labels visible to True :
tChart1.Series(0).Marks.Visible = true

and then you can do something like this :

Code: Select all

Private Sub TChart1_OnGetSeriesMark(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, MarkText As String) 
Dim BarHeight As Double 
With TChart1 
  if ValueIndex = 5 then
    AreaHeight = (.Axis.Bottom.Position - .Series(0).CalcYPos(ValueIndex)) / 2 
    .Series(0).Marks.ArrowLength = AreaHeight * -1 - 8 
    .Series(0).Marks.Arrow.Visible = False 
    MarkText = "My Custom Mark"
  else
    MarkText = ""
  end if
End With 
End Sub 

Post Reply