import { ref } from 'vue'

export function useChartTooltip<T>() {
    const tooltipItem = ref<T | null>(null)
    const tooltipX = ref(0)
    const tooltipY = ref(0)

    const onMouseMove = (e: MouseEvent) => {
        tooltipX.value = e.clientX + 14
        tooltipY.value = e.clientY + 14
    }

    const onMouseLeave = () => {
        tooltipItem.value = null
    }

    return { tooltipItem, tooltipX, tooltipY, onMouseMove, onMouseLeave }
}
