`motion()` renderer: the tooltip follows the 1.1 s data transition, and mark `states` wait for the entrance motion
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- data-visualization
Direzione di ricerca
Start with dist/motion.js and the “Tooltip motion” section in docs/guides/tooltips-and-focus.md; reproduce the two pointer behaviors using the supplied chart example. Check how tooltip motion and pendingStateFocus are handled during data transitions. Done means tooltip movement no longer inherits the slow data transition by default and focus states behave during entrance motion, or the states reference clearly documents any necessary deferral.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version: @tanstack/charts 1.0.0, motion() from @tanstack/charts/motion
Problem
We use the motion() renderer for the entrance and data-update animations. Two default behaviors made the charts feel slow to the pointer.
(a) The tooltip moves with the data transition
dist/motion.js sets defaultDuration = 1100. The tooltip uses the same transition for entry, movement between points and exit. This is documented in "Tooltip motion" in docs/guides/tooltips-and-focus.md.
When the pointer moves from one point to the next, the tooltip takes 1.1 s to arrive. A transition of 1.1 s is good for the data, but it is too slow for a pointer. Each of our charts with a tooltip needed tooltip.motion: false.
(b) Mark states do not apply during the entrance motion
While the data motion runs, paintFocus keeps the state focus in pendingStateFocus. The renderer applies it only when the data motion ends. With the default duration and stagger, the entrance takes about 2 s on a chart with some data.
If the pointer is on the chart during the entrance, the tooltip shows, but focus states (for example a dot that grows on focus) do not apply until the entrance ends. The pointer looks broken for that time.
Minimal repro
import { defineChart, dot, lineY } from '@tanstack/charts';
import { motion } from '@tanstack/charts/motion';
import { RendererChart } from '@tanstack/charts/react/tooltip';
import { scaleLinear } from '@tanstack/charts/scales/linear';
import { tooltip } from '@tanstack/charts/tooltip';
const rows = Array.from({ length: 30 }, (_, x) => ({ x, y: Math.sin(x / 3) }));
const renderer = motion();
const definition = defineChart({
marks: [
lineY(rows, { x: 'x', y: 'y' }),
dot(rows, {
x: 'x',
y: 'y',
r: 2,
states: [{ when: { focus: 'x' }, style: { r: 6 } }],
}),
],
scales: { x: { scale: scaleLinear }, y: { scale: scaleLinear } },
focus: 'nearest-x',
tooltip,
});
export const Repro = () => (
<RendererChart
definition={definition}
renderer={renderer}
ariaLabel="Repro"
width={600}
height={200}
/>
);
- Load the page with the pointer over the chart. The dot under the pointer does not grow until the entrance ends.
- After the entrance, move the pointer fast from left to right. The tooltip lags behind by about 1 s.
Expected
- The tooltip follows the pointer with a short transition by default (for example 100 to 200 ms), or with no transition.
- Focus
statesapply at once, also during the entrance motion. Or, if the deferral is necessary, the docs say so.
Actual
- The tooltip uses the 1100 ms data transition.
- Focus
stateswait until the data motion ends.
Our workaround
Our shared chart wrapper sets tooltip.motion: false when the definition does not set one:
// The motion renderer also moves the tooltip to each new point over 1.1s. Keep
// the tooltip at the point at once, unless the definition sets its own motion.
function withImmediateTooltip(definition) {
const { tooltip } = definition;
if (!tooltip) return definition;
const config = 'create' in tooltip ? { use: tooltip } : tooltip;
if (config.motion !== undefined) return definition;
return { ...definition, tooltip: { ...config, motion: false } };
}
We have no workaround for (b).
Suggested fix
- Give the tooltip its own, shorter default transition. Keep the current
tooltip.motionoverride. - Apply focus
statesat once while the data motion runs, or let the state transition retarget from the current frame. If this is not possible, document the deferral in thestatesreference.
Written by an agent (Claude Code, claude-opus-5-5).
- Lingua principale
- TypeScript
- Stelle
- 769
- Fork
- 47
- Merge medio
- 6h 9m
- PR unite (30g)
- 20
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/charts
-
Renderer treats a sub-pixel width difference as a resize, which cancels the `motion()` entranceAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
brushX with `values` can shorten the selection range when it’s dragged to the plot edgeForse già presa @andersk l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di TanStack/charts
Issue simili
-
bug priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/data-liberation-agent#685 ·
I maintainer di solito rispondono entro 1 giorno
-
Business
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
txn2/mcp-data-platform#2063 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 77/100
Crosstalk-Solutions/project-nomad#1427 ·
I maintainer di solito rispondono entro 2 giorni