ShapeSeries as a Horizontal Line

TeeChart for ActiveX, COM and ASP
Post Reply
nefis
Newbie
Newbie
Posts: 62
Joined: Wed Oct 22, 2003 4:00 am
Location: chicago

ShapeSeries as a Horizontal Line

Post by nefis » Tue Feb 03, 2004 1:03 pm

Hello,

could you tell me what's wrong in the code. if I set
TChart1.Series(1).asShape.X1 = 38020.1 then line is shown
if I set
TChart1.Series(1).asShape.X1 = 38021 then line isn't shown

Code: Select all

Option Explicit
Const aSec = 1# / (24# * 60# * 60#)

Private Sub Form_Load()
  Dim t As Date
  Dim v As Double
  Call TChart1.AddSeries(scLine)
  TChart1.Aspect.View3D = False
  TChart1.Legend.Visible = False
  v = 100
  With TChart1.Series(0)
    .Clear
    .XValues.DateTime = True
    TChart1.Axis.Bottom.Automatic = False
    TChart1.Axis.Bottom.Labels.DateTimeFormat = "hh:nn:ss"
    t = 38020 'feb 3, 2003
    Call TChart1.Axis.Bottom.SetMinMax(t, t + 150# * aSec)
    For t = t To t + 150# * aSec Step aSec
      v = CreateTick(v)
      Call .AddXY(t, v, "", vbRed)
    Next
  End With
  Call TChart1.AddSeries(scShape)
  With TChart1.Series(1).asShape
    TChart1.Series(1).Active = True
    .Style = chasHorizLine
    .Pen.Style = psSolid
    .Pen.Width = 1
    .Pen.Color = vbRed
    .XYStyle = xysAxis
    .X0 = 38020
    .X1 = 38020.1 'line is shown
    '.X1 = 38021 'line isn't shown
    .Y0 = 100
    .Y1 = 100
  End With
End Sub

Private Function CreateTick(PrevTick As Double) As Double
  CreateTick = PrevTick + 2 * Rnd - 1
End Function
nefis

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

Post by Pep » Tue Feb 03, 2004 2:50 pm

Hi nefis,

I've tried to reproduce the problem using your code with the TeeChart Pro v5.06 and v6.04 and in both version I'm able to see the line. Which TeeChart version are you using ?

Also, this can be done using the ColorLine Tool.

Post Reply