Skip to content

Commit b1d754a

Browse files
committed
remove tooltips
1 parent 03acf21 commit b1d754a

File tree

2 files changed

+0
-112
lines changed

2 files changed

+0
-112
lines changed

lib/components/SChartBar.vue

-56
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ const props = withDefaults(defineProps<{
3333
const chartRef = useTemplateRef('chart')
3434
const { width, height } = useElementSize(chartRef)
3535
36-
let tooltipTimeout: number = 0
37-
let animationFrame: number = 0
38-
3936
// Function to render the chart
4037
function renderChart({
4138
clientWidth,
@@ -220,45 +217,6 @@ function renderChart({
220217
}
221218
}
222219
223-
if (props.tooltip) {
224-
// Create a tooltip
225-
const Tooltip = d3
226-
.select(chartRef.value)
227-
.append('div')
228-
.attr('class', 'tooltip')
229-
230-
// Add interactivity
231-
bars
232-
.on('mouseenter', (event: PointerEvent, d) => {
233-
const [x, y] = d3.pointer(event, chartRef.value)
234-
Tooltip
235-
.html(props.tooltipFormat(d, color(d)))
236-
.style('transform', `translate3d(${x + 14}px,${y + 14}px,0)`)
237-
clearTimeout(tooltipTimeout)
238-
tooltipTimeout = setTimeout(() => {
239-
Tooltip
240-
.style('visibility', 'visible')
241-
}, 750) as unknown as number
242-
})
243-
.on('mousemove', (event: PointerEvent) => {
244-
const [x, y] = d3.pointer(event, chartRef.value)
245-
if (!animationFrame) {
246-
animationFrame = requestAnimationFrame(() => {
247-
Tooltip
248-
.style('transform', `translate3d(${x + 14}px,${y + 14}px,0)`)
249-
animationFrame = 0
250-
})
251-
}
252-
})
253-
.on('mouseleave', () => {
254-
clearTimeout(tooltipTimeout)
255-
tooltipTimeout = setTimeout(() => {
256-
Tooltip
257-
.style('visibility', 'hidden')
258-
}, 750) as unknown as number
259-
})
260-
}
261-
262220
// Render outline for debugging
263221
if (props.debug) {
264222
d3
@@ -303,20 +261,6 @@ watch(
303261
position: relative;
304262
}
305263
306-
:deep(.tooltip) {
307-
visibility: hidden;
308-
pointer-events: none;
309-
position: absolute;
310-
top: 0;
311-
left: 0;
312-
padding: 2px 8px;
313-
transition: transform 0.4s ease-out;
314-
background-color: var(--c-bg-elv-2);
315-
border: 1px solid var(--c-divider);
316-
border-radius: 6px;
317-
font-size: 12px;
318-
}
319-
320264
:deep(.tick line) {
321265
display: none;
322266
}

lib/components/SChartPie.vue

-56
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ const props = withDefaults(defineProps<{
4242
const chartRef = useTemplateRef('chart')
4343
const { width, height } = useElementSize(chartRef)
4444
45-
let tooltipTimeout: number = 0
46-
let animationFrame: number = 0
47-
4845
// Function to render the chart
4946
function renderChart({
5047
clientWidth,
@@ -273,45 +270,6 @@ function renderChart({
273270
}
274271
}
275272
276-
if (props.tooltip) {
277-
// Create a tooltip
278-
const Tooltip = d3
279-
.select(chartRef.value)
280-
.append('div')
281-
.attr('class', 'tooltip')
282-
283-
// Add interactivity
284-
arcs
285-
.on('mouseenter', (event: PointerEvent, d) => {
286-
const [x, y] = d3.pointer(event, chartRef.value)
287-
Tooltip
288-
.html(props.tooltipFormat(d.data, color(d.data)))
289-
.style('transform', `translate3d(${x + 14}px,${y + 14}px,0)`)
290-
clearTimeout(tooltipTimeout)
291-
tooltipTimeout = setTimeout(() => {
292-
Tooltip
293-
.style('visibility', 'visible')
294-
}, 750) as unknown as number
295-
})
296-
.on('mousemove', (event: PointerEvent) => {
297-
const [x, y] = d3.pointer(event, chartRef.value)
298-
if (!animationFrame) {
299-
animationFrame = requestAnimationFrame(() => {
300-
Tooltip
301-
.style('transform', `translate3d(${x + 14}px,${y + 14}px,0)`)
302-
animationFrame = 0
303-
})
304-
}
305-
})
306-
.on('mouseleave', () => {
307-
clearTimeout(tooltipTimeout)
308-
tooltipTimeout = setTimeout(() => {
309-
Tooltip
310-
.style('visibility', 'hidden')
311-
}, 750) as unknown as number
312-
})
313-
}
314-
315273
// Render outline for debugging
316274
if (props.debug) {
317275
d3
@@ -355,18 +313,4 @@ watch(
355313
font-feature-settings: 'tnum' 1;
356314
position: relative;
357315
}
358-
359-
:deep(.tooltip) {
360-
visibility: hidden;
361-
pointer-events: none;
362-
position: absolute;
363-
top: 0;
364-
left: 0;
365-
padding: 2px 8px;
366-
transition: transform 0.4s ease-out;
367-
background-color: var(--c-bg-elv-2);
368-
border: 1px solid var(--c-divider);
369-
border-radius: 6px;
370-
font-size: 12px;
371-
}
372316
</style>

0 commit comments

Comments
 (0)