Gaps Between dates on my X axis

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

Gaps Between dates on my X axis

Post by Teechart Activex Question » Mon Mar 22, 2004 2:44 pm

The dates look a little out of the ordinary where i have lot of dates on my X axis.
When i have dates like 1/12/2004,1/13/2004,1/14/2004,1/17/2004, 1/18/2004 on my x axis,I see like 3 gap space between date 1/14 and 1/17.How do i avoid this gap?

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

Post by Pep » Mon Mar 22, 2004 5:09 pm

Hi,

you can see one example which show you how to solve this in the TeeChart Pro AX v6 Demo Features project under :
Welcome ! -> Previous Version -> New Features -> Series -> Candle -> Axis labels no weekends

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

but where in code?

Post by Teechart Activex Question » Mon Mar 22, 2004 6:19 pm

i found the code, but what code say to avoid the gaps?

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

Post by Pep » Mon Mar 22, 2004 6:26 pm

Hi,

in this example you can see the strategy which you can use to remove the gaps.

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

still dont know

Post by Teechart Activex Question » Mon Mar 22, 2004 6:44 pm

i looked the code , but i dont have a hint how to remove the gap.

Here is my code, can you modify code?


Chart.AddSeries scLine
Chart.Series(0).asLine.LinePen.Width = 3

Chart.Series(0).Color = VbColor(16)
Chart.Series(0).Title = "Schedule Performance Index"

Chart.Series(0).XValues.DateTime = True
Chart.Series(0).Add CDec(GraphArray(0, i)), Format(GraphArray(1, i), "mm/dd/yyyy"), VbColor(16)

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Tue Mar 23, 2004 1:46 pm

Hi --

The example Pep mentioned is the answer you're looking for.

Try opening the Feature Demo source code under:
C:\Program Files\Steema Software\TeeChart Pro v6 ActiveX Control\Examples\Visual Basic\TeeChartAXV6Demo

Open the form CandleAxisLabelsForm and change the AddAsDatetime() method to the following:

Code: Select all

Private Sub AddAsDatetime()
Dim tmpopen, tmp As Integer
  ' This option simulates a sequential datetime Axis
  ' Candle Series
  NotDateTime = False
  TChart1.RemoveAllSeries
  TChart1.AddSeries (scCandle)
  TChart1.Axis.Bottom.Labels.Angle = 90

  With TChart1.Series(0)
    .Clear
    tmpopen = 1000 + Rnd(100)
    For t = 0 To 14
      tmp = Int(100 * Rnd - 50)
      If (Weekday(Format(Now - 15, "000000") + t) <> 1) And (Weekday(Format(Now - 15, "000000") + t) <> 7) Then
        .asCandle.AddCandle Format(Now - 15, "000000") + t, tmpopen, tmpopen + 20, tmpopen - 20, tmpopen + tmp
      End If
      tmpopen = tmpopen + tmp
    Next t
  End With
End Sub
Now run the project and open the form again -- you should be able to see how this technique removes the gaps more clearly.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply