Page 1 of 1

Overlapping Points

Posted: Fri Feb 22, 2008 6:03 pm
by 9524907
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.

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

Posted: Mon Feb 25, 2008 4:32 pm
by 9524907
Thank you for your reply; this has been very helpful!