Overlapping Points

TeeChart for ActiveX, COM and ASP
Post Reply
ASM
Newbie
Newbie
Posts: 13
Joined: Thu Nov 18, 2004 5:00 am

Overlapping Points

Post by ASM » Fri Feb 22, 2008 6:03 pm

Hello,

I've searched the forums but couldn't find anything like this, so I apologize if this has been asked before. Our client wants a dot chart where we graph the number of days for several locations over a period of time.

Image

The problem that we have is that some points will be directly graphed on top of each other, and the client would like to be able to see each individual location. Is it possible to spread the points to the left and right of the dates a bit so that they are still over the appropriate date, but the points do not overlap each other?

I would appreciate any help you can provide.

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 Feb 25, 2008 11:23 am

Hi ASM,

In that case you can apply a little offset to the points doing something like this:

Code: Select all

Option Explicit

Private Sub Form_Load()
    Dim i, j As Integer
    
    TeeCommander1.Chart = TChart1
    
    TChart1.Aspect.View3D = False
    
    For i = 0 To 3
        TChart1.AddSeries scPoint
        
        For j = 0 To 10
            AddValue i, j, Rnd()
        Next
    Next
End Sub

Private Sub AddValue(ByVal SeriesIndex As Long, ByVal X As Double, ByVal Y As Double)
    
    Dim XVal As Double
    
    If SeriesIndex Mod 2 = 0 Then
        XVal = X + (SeriesIndex / 100)
    Else
        XVal = X - (SeriesIndex / 100)
    End If
    
    TChart1.Series(SeriesIndex).AddXY XVal, Y, "", clTeeColor
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

ASM
Newbie
Newbie
Posts: 13
Joined: Thu Nov 18, 2004 5:00 am

Post by ASM » Mon Feb 25, 2008 4:32 pm

Thank you for your reply; this has been very helpful!

Post Reply