@@ -62,6 +62,7 @@ export const MainGraph = ({
6262 const { mode } = useTheme ( )
6363 const navigate = useAppNavigate ( )
6464 const { primaryGradient, secondaryGradient } = paletteByTheme [ mode ]
65+ const [ isTouchDevice , setIsTouchDevice ] = useState ( false )
6566 const [ tooltip , setTooltip ] = useState < {
6667 x : number
6768 y : number
@@ -190,7 +191,10 @@ export const MainGraph = ({
190191 )
191192
192193 const onPointerMove = useCallback < PointerHandler > (
193- ( { inHoverableArea, closestIndex, x, y } ) => {
194+ ( { inHoverableArea, closestIndex, x, y, event } ) => {
195+ if ( event instanceof PointerEvent ) {
196+ setIsTouchDevice ( event . pointerType === 'touch' )
197+ }
194198 if ( ! inHoverableArea ) {
195199 setTooltip ( { selectedIndex : null , x : 0 , y : 0 } )
196200 } else {
@@ -265,6 +269,7 @@ export const MainGraph = ({
265269 datum = { remappedData [ selectedIndex ] }
266270 bucketIndex = { selectedIndex }
267271 totalBuckets = { remappedData . length }
272+ isTouchDevice = { isTouchDevice }
268273 />
269274 ) }
270275 </ Graph >
@@ -283,7 +288,8 @@ const MainGraphTooltip = ({
283288 datum,
284289 showZoomToPeriod,
285290 bucketIndex,
286- totalBuckets
291+ totalBuckets,
292+ isTouchDevice
287293} : {
288294 metric : FormattableMetric
289295 interval : string
@@ -297,8 +303,10 @@ const MainGraphTooltip = ({
297303 bucketIndex : number
298304 totalBuckets : number
299305 maxX : number
306+ isTouchDevice : boolean
300307} ) => {
301308 const formatter = MetricFormatterShort [ metric ]
309+
302310 return (
303311 < GraphTooltipWrapper
304312 x = { x }
@@ -307,6 +315,7 @@ const MainGraphTooltip = ({
307315 maxX = { maxX }
308316 bucketIndex = { bucketIndex }
309317 totalBuckets = { totalBuckets }
318+ isTouchDevice = { isTouchDevice }
310319 className = {
311320 'absolute select-none pointer-events-none bg-gray-800 dark:bg-gray-950 py-3 px-4 rounded-md z-[100] shadow shadow-gray-200 dark:shadow-gray-850'
312321 }
@@ -378,7 +387,9 @@ const MainGraphTooltip = ({
378387 < >
379388 < hr className = "border-gray-600 dark:border-gray-800 my-1" />
380389 < span className = "text-gray-300 dark:text-gray-400 text-xs" >
381- Click to view { interval }
390+ { isTouchDevice
391+ ? `Release to view ${ interval } `
392+ : `Click to view ${ interval } ` }
382393 </ span >
383394 </ >
384395 ) }
@@ -610,7 +621,7 @@ const remapAndFillData = (
610621 if ( isPartial ) {
611622 startOfLastPartialSlice = index
612623 } else {
613- // if there is a full period after a partial slice,
624+ // if there is a full period after a partial slice,
614625 // it's not a partial slice anchored at the end of the series
615626 startOfLastPartialSlice = null
616627 }
0 commit comments