Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix: Scale dot on hover

Blue Mousefbbf89f74c45
diff --git a/web/app/pages/Project/View/ViewProject.helpers.tsx b/web/app/pages/Project/View/ViewProject.helpers.tsx
index a2f22e56f..cd1126f42 100644
--- a/web/app/pages/Project/View/ViewProject.helpers.tsx
+++ b/web/app/pages/Project/View/ViewProject.helpers.tsx
@@ -722,6 +722,8 @@ const getSettings = (
}
}
: undefined,
+ onover: undefined,
+ onout: undefined,
types: {
unique: chartType === chartTypes.line ? area() : bar(),
uniqueCompare: chartType === chartTypes.line ? line() : bar(),
@@ -1015,10 +1017,10 @@ const getSettings = (
: {
focus: {
only: xAxisSize > 1,
- expand: onDataPointClick ? { enabled: true, r: 5 } : undefined,
+ expand: onDataPointClick ? { enabled: true, r: 4 } : undefined,
},
pattern: ['circle'],
- r: 2,
+ r: 4,
sensitivity: onDataPointClick ? 50 : undefined,
},
legend: {
@@ -1095,6 +1097,45 @@ const getSettings = (
if (!eventRectsGroup || eventRectsGroup.__clickAttached) return
eventRectsGroup.__clickAttached = true
+ eventRectsGroup.addEventListener(
+ 'mousemove',
+ (e: MouseEvent) => {
+ const groupRect = eventRectsGroup.getBoundingClientRect()
+ const mouseX = e.clientX - groupRect.left
+ const mouseY = e.clientY - groupRect.top
+
+ const circles = svg.querySelectorAll('.bb-circle')
+ let closestCircle: Element | null = null
+ let minDistance = 25 // 25px sensitivity for direct hover
+
+ circles.forEach((c: Element) => {
+ const cx = parseFloat(c.getAttribute('cx') || '0')
+ const cy = parseFloat(c.getAttribute('cy') || '0')
+ const distance = Math.hypot(cx - mouseX, cy - mouseY)
+
+ if (distance < minDistance) {
+ minDistance = distance
+ closestCircle = c
+ }
+ })
+
+ circles.forEach((c: Element) => {
+ if (c === closestCircle) {
+ c.classList.add('is-direct-hover')
+ } else {
+ c.classList.remove('is-direct-hover')
+ }
+ })
+ },
+ )
+
+ eventRectsGroup.addEventListener('mouseleave', () => {
+ const circles = svg.querySelectorAll('.bb-circle')
+ circles.forEach((c: Element) => {
+ c.classList.remove('is-direct-hover')
+ })
+ })
+
eventRectsGroup.addEventListener('click', (e: MouseEvent) => {
const target = e.target as SVGRectElement
if (!target?.classList?.contains('bb-event-rect')) return
diff --git a/web/app/styles/ProjectViewStyle.css b/web/app/styles/ProjectViewStyle.css
index 0668089fa..2650c4c33 100644
--- a/web/app/styles/ProjectViewStyle.css
+++ b/web/app/styles/ProjectViewStyle.css
@@ -236,6 +236,16 @@ body.dark .bb-ygrid {
cursor: pointer;
}
+.bb-circle {
+ transition: transform 0.1s ease-in-out;
+ transform-box: fill-box;
+ transform-origin: center;
+}
+
+.bb-circle.is-direct-hover {
+ transform: scale(1.5);
+}
+
#traffic-chart .bb-lines path,
#traffic-chart .bb-areas path {
pointer-events: stroke;