You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(animation): recompute scales per frame with time.rescale
`rescale` was declared on the time encoding but never read, so a frame's
scales were always fixed across the whole animation. That is the right
default -- it keeps positions comparable between frames -- but it makes
some animations unreadable: in a racing bar chart the early frames'
values are a rounding error against the final ones, so the bars start out
invisible and never reorder.
Read it. When set, redirect the affected scale domains to the current
frame dataset during domain assembly.
Three things are deliberately excluded. Scales with a discrete output
range are left alone, since moving between their outputs is not a
continuous change. The time scale is left alone because it defines the
extent of the animation, and narrowing it to the current frame would
collapse the very domain being played through. And only the unit's own
raw and main sources are redirected, since other datasets have no
per-frame counterpart.
Both raw and main are redirected because a domain may read either: a band
domain sorted by another field reads the raw source, and in a racing bar
chart that domain is precisely the one whose reordering is the point.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: build/vega-lite-schema.json
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -26942,6 +26942,7 @@
26942
26942
"description": "__Required.__ A string defining the name of the field from which to pull a data value or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__ 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`). If field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`). See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). 2) `field` is not required if `aggregate` is `count`."
26943
26943
},
26944
26944
"rescale": {
26945
+
"description": "Whether the animated marks' scales should be recomputed from the current frame rather than held fixed across the whole animation. Rescaling keeps each frame's data filling the view -- as in a racing bar chart, where the bars stay legible as their magnitudes grow -- at the cost of making positions incomparable between frames.\n\nScales with a discrete output range (`ordinal`, `bin-ordinal`, `quantile`, `quantize`, and `threshold`) are never rescaled, since interpolating between their outputs is not meaningful.\n\n__Default value:__ `false`",
26945
26946
"type": "boolean"
26946
26947
},
26947
26948
"scale": {
@@ -29507,6 +29508,7 @@
29507
29508
"description": "__Required.__ A string defining the name of the field from which to pull a data value or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n\n__See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n\n__Notes:__ 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`). If field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`). See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). 2) `field` is not required if `aggregate` is `count`."
29508
29509
},
29509
29510
"rescale": {
29511
+
"description": "Whether the animated marks' scales should be recomputed from the current frame rather than held fixed across the whole animation. Rescaling keeps each frame's data filling the view -- as in a racing bar chart, where the bars stay legible as their magnitudes grow -- at the cost of making positions incomparable between frames.\n\nScales with a discrete output range (`ordinal`, `bin-ordinal`, `quantile`, `quantize`, and `threshold`) are never rescaled, since interpolating between their outputs is not meaningful.\n\n__Default value:__ `false`",
Copy file name to clipboardExpand all lines: site/docs/animation.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ This is the design described in [Animated Vega-Lite](https://vis.csail.mit.edu/p
29
29
30
30
The `time` channel names the field the animation runs over and how that field maps onto elapsed time.
31
31
32
-
{% include table.html props="field,type,timeUnit,scale" source="TimeFieldDef" %}
32
+
{% include table.html props="field,type,timeUnit,scale,rescale" source="TimeFieldDef" %}
33
33
34
34
{:#timing}
35
35
@@ -45,6 +45,18 @@ Set `"scale": {"type": "linear"}` instead when the field is continuous and what
45
45
46
46
Unlike a visual channel, the time channel accepts either scale type for any orderable field, temporal ones included: it maps onto elapsed playback time rather than a visual range.
47
47
48
+
{:#rescale}
49
+
50
+
## Rescaling
51
+
52
+
By default the scales are fixed across the whole animation, which keeps positions comparable between frames. Set `"rescale": true` on the time encoding to recompute them from each frame instead. This is what makes a racing bar chart readable: without it, the early frames' values are a rounding error against the final ones and the bars start out invisible.
Scales with a discrete output range (`ordinal`, `bin-ordinal`, `quantile`, `quantize`, and `threshold`) are never rescaled, since moving between their outputs is not a continuous change. Neither is the time scale itself, which defines the extent of the animation.
0 commit comments