Dot cloud mouse over label

hortensette34 Posted messages 4 Status Member -  
hortensette34 Posted messages 4 Status Member -
Hello,

Thank you first for all the information you provide. I wonder if you have found a way to display the labels just when hovering over the point with the mouse? If I display all the labels, my file becomes unreadable.

Thank you

Configuration: Windows 7 / Chrome 46.0.2490.71

2 answers

JvDo Posted messages 1924 Registration date   Status Member Last intervention   859
 
Hello,

take a look at this topic: https://forums.commentcamarche.net/forum/affich-31218345-modifier-infobulle-sur-nuage-de-points-excel-2003

there may be useful information.

best regards
0
hortensette34 Posted messages 4 Status Member
 
Thank you. I've used some things. I can't control two different series charts with event management in a class module and specifying my object in an open workbook. Could someone correct this or indicate where I'm going wrong? Thank you very much. I'm putting it in a class module, class chart.

Option Explicit

Public WithEvents chart1 As Chart

'*** Event Handling *********

Private Sub chart1_MouseMove(ByVal Button As Long, ByVal Shift As Long, _
ByVal x As Long, ByVal y As Long)

Dim ElementID As Long
Dim Arg1 As Long, Arg2 As Long

On Error Resume Next
ChartObjects(1).GetChartElement x, y, ElementID, Arg1, Arg2

If Arg2 = 0 Then
ActiveChart.Shapes("Rectangle 1").Visible = msoFalse
Else

With ActiveChart.Shapes("Rectangle 1")
.Visible = msoTrue
.TextFrame.Characters.Text = _
Range("C1").Offset(Arg2, -2) & vbCrLf & _
Range("C1").Offset(Arg2, -1) & vbCrLf & _
Range("C1").Offset(Arg2, 0)
.Left = x - (x * 0.4)
.Top = y - (y * 0.4)
End With
End If
End Sub

Option Explicit

Public WithEvents chart2 As Chart

'*** Event Handling *********

Private Sub chart2_MouseMove(ByVal Button As Long, ByVal Shift As Long, _
ByVal x As Long, ByVal y As Long)

Dim ElementID As Long
Dim Arg1 As Long, Arg2 As Long

On Error Resume Next
ChartObjects(2).GetChartElement x, y, ElementID, Arg1, Arg2

If Arg2 = 0 Then
ActiveChart.Shapes("Rectangle 1").Visible = msoFalse
Else

With ActiveChart.Shapes("Rectangle 1")
.Visible = msoTrue
.TextFrame.Characters.Text = _
Range("C1").Offset(Arg2, -2) & vbCrLf & _
Range("C1").Offset(Arg2, -1) & vbCrLf & _
Range("C1").Offset(Arg2, 0)
.Left = x - (x * 0.4)
.Top = y - (y * 0.4)
End With
End If
End Sub

In another class module Appli
Option Explicit

Public WithEvents XL As Excel.Application

Dim ClTabChart() As ClasseChart

'Allows integrating embedded charts from the active sheet
Public Sub XL_SheetActivate(ByVal Feuille As Object)
Dim i As Integer
'Checks if it is a worksheet
If TypeOf Sheet3("Y.S Densité") Is Worksheet Then
'Checks if there are charts on the sheet
If Sheet3("Y.S Densité").ChartObjects.Count = 0 Then Exit Sub
'If there are charts,
'loop to integrate them into the class module
For i = 1 To Sheet3("Y.S Densité").ChartObjects.Count
ReDim Preserve ClTabChart(i)
Set ClTabChart(i) = New ClasseChart
Set ClTabChart(i).Graph = Sheet3("Y.S Densité").ChartObjects(i).Chart
Next i
End If
End Sub

'Allows clearing the class on sheet deactivation
Private Sub XL_SheetDeactivate(ByVal Feuille As Object)
Dim j As Integer
On Error Resume Next
For j = 1 To UBound(ClTabChart)
Set ClTabChart(j).Graph = Nothing
Next
End Sub
In This workbook:

Option Explicit
Dim ClTabChart1 As ClasseChart
Dim ClTabChart2 As ClasseChart
Dim XlAppli As New ClasseAppli

Private Sub Workbook_Open()
Set XlAppli.XL = Excel.Application
Sheets("Y.S Densité").Activate
Set ClTabChart1 = New ClasseChart
Set ClTabChart2 = New ClasseChart
Set ClTabChart1.Graph = Worksheets("Y.S Densité").ChartObjects(1).Chart
Set ClTabChart2.Graph = Worksheets("Y.S Densité").ChartObjects(2).Chart

'disables the labels and values
Application.ShowChartTipNames = False
Application.ShowChartTipValues = False
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'reactivates the labels and values
Application.ShowChartTipNames = True
Application.ShowChartTipValues = True
End Sub

compilation error incorrect attribute
0