Bubble Chart Click

TeeChart for ActiveX, COM and ASP
Post Reply
Productivity Guy
Newbie
Newbie
Posts: 21
Joined: Tue Mar 01, 2005 5:00 am
Location: Spokane, WA
Contact:

Bubble Chart Click

Post by Productivity Guy » Thu Nov 08, 2007 6:01 am

I've tried to follow the examples about using OnSeriesClick and OnMouseMove with a Bubble chart to display bubble values, to no avail.

I can't even get the mouse events to react to the bubbles at all. The closest I've come is to get responses as I click or move the mouse along the X axis.

Is this a bug?

How can I point to and/or click on a bubble and have code respond to that?

I appear to be using: v7.0.1.4

Yeray
Site Admin
Site Admin
Posts: 9601
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Thu Nov 08, 2007 9:45 am

Hi Productivity Guy,

For the OnClickSeries event this code works fine here after adding three Bubble series in achart:

Code: Select all

Private Sub Form_Load()
  TChart1.Aspect.View3D = False
  TChart1.Series(0).FillSampleValues 6
  TChart1.Series(1).FillSampleValues 6
  TChart1.Series(2).FillSampleValues 6
End Sub


Private Sub TChart1_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  TChart1.Repaint
  
  With TChart1.Series(SeriesIndex)
    Label1.Caption = "Clicked Series:  " + .Name + "     Point:  " + Str$(ValueIndex) + "      X:  " + Str$(FormatNumber(.XValues.Value(ValueIndex), 2)) + "    Y:  " + Str$(FormatNumber(.YValues.Value(ValueIndex), 2))
  End With
  
  TChart1.Canvas.TextOut X, Y, "Clicked"
End Sub
And for the OnMouseMove event, you could try the following code after addingone bubble series in a chart:

Code: Select all

Private Sub Form_Load()
  TChart1.Aspect.View3D = False
  TChart1.Series(0).FillSampleValues 6
End Sub

Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
  TChart1.Repaint
  Index = TChart1.Series(0).Clicked(X, Y)
  If Index <> -1 Then
    Label1.Caption = "Value:" & TChart1.Series(0).asBubble.RadiusValues.Value(Index)
  Else
    Label1.Caption = "Move the mouse over a bubble"
  End If
  lastIndex = Index
End Sub
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Productivity Guy
Newbie
Newbie
Posts: 21
Joined: Tue Mar 01, 2005 5:00 am
Location: Spokane, WA
Contact:

Post by Productivity Guy » Thu Nov 08, 2007 4:56 pm

Well, here's my problem. I can't even get a bubble to recognize the click.

Code: Select all

Private Sub TChart0_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
  MsgBox "Clicked"
End Sub
Does not work when I click on a bubble. I DID find, however, that there are a few places in the X axis that register the click.

Here's the code I'm using to generate the chart (TChart0):

Code: Select all

  TChart0.Series(0).Clear

  With prs
    Do While Not .EOF
      TChart0.Series(0).asBubble.AddBubble !LS, !LL * 100, 2.5, "TEST", RGB(0, 0, 255)
      
      .MoveNext
    Loop
  End With
  
  With TChart0
    .Canvas.UseAntiAlias = True
    .Series(0).asBubble.Pointer.Gradient.Visible = True
    tmp = .Axis.Left.CalcXSizeValue(.Series(0).asBubble.RadiusValues.First)
    .Axis.Bottom.MinimumOffset = tmp * (1 + 0.4)
    tmp = .Axis.Left.CalcXSizeValue(.Series(0).asBubble.RadiusValues.Last)
    .Axis.Bottom.MaximumOffset = tmp * (1 + 0.4)
    tmp = .Axis.Left.CalcXSizeValue(.Series(0).asBubble.RadiusValues.First)
    .Axis.Left.MinimumOffset = tmp * (1 + 0.4)
    
  End With

(The !LS, !LL are fields from the recordset passed as a parameter [prs] to the procedure.)

Can you see any reason I don't get the click event attached to a bubble?

Productivity Guy
Newbie
Newbie
Posts: 21
Joined: Tue Mar 01, 2005 5:00 am
Location: Spokane, WA
Contact:

Post by Productivity Guy » Thu Nov 08, 2007 5:04 pm

Hmmmm....

I created a brand new bubble chart on a brand new form, and YOUR sample code works. (I only tested the Click sample, so far.)

So, now I have to figure out what's different about MY chart that's keeping the click from working.

Do you notice anything?

Could it be that my Y axis values are all percents (i.e. all under 1)?

Yeray
Site Admin
Site Admin
Posts: 9601
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Fri Nov 09, 2007 11:08 am

Hi Productivity Guy,

Could you try to do and send a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply