Skip to content

docs: animated time encoding documentation and examples #9535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jonathanzong
Copy link
Member

@jonathanzong jonathanzong commented Feb 18, 2025

This PR contains documentation for animation features added in #8921.

  • added doc comments to time encoding channel, animationDuration and framesPerSecond scale config (updates schema)
  • add time channel to encoding.md documentation.
    • lists current restrictions with use of time channel
  • add animation-related config to scale.md under new Animation subhead in Configuration section
  • add two examples to the example gallery under new Animated header (after Interactive)
    • Gapminder frame animation
    • Hypothetical outcome plot
  • removed the legend from the gapminder example so it looks cleaner

A problem before I ask for a review: the automatic vg2png thumbnail generation doesn't currently work with animated specs (it'll generate an image with without filtering, i.e. all the frames show at once). I imagine this is probably because the animated specs are getting run through an older version of the compiler before we added animation. I'd appreciate some guidance on what I need to do to fix this. We can't push the docs until then because presumably running the script will over-write the pngs with incorrect ones even if we put correct ones in manually.

closes #9534

@jonathanzong jonathanzong requested a review from a team as a code owner February 18, 2025 20:46
@jonathanzong jonathanzong marked this pull request as draft February 18, 2025 20:46
@@ -458,6 +458,13 @@ To provide themes for all scales, the scale config (`config: {scale: {...}}`) ca

{% include table.html props="invalid" source="ScaleConfig" %}

#### Animation

<!-- TODO(jzong): uncomment animationDuration when linear scales for animation are implemented -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reference an issue so we know when this work is done and keep track of what needs to be done here.

*
* __Default value:__ `2`
*
*/
framesPerSecond?: number;

/**
* Default animation duration (in seconds) for time encodings, except for [`band`](https://vega.github.io/vega-lite/docs/scale.html#band) scales.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not supported yet, we should not expose this in the spec. You can use @hidden if you still need it in the types.

@domoritz
Copy link
Member

A problem before I ask for a review: the automatic vg2png thumbnail generation doesn't currently work with animated specs (it'll generate an image with without filtering, i.e. all the frames show at once). I imagine this is probably because the animated specs are getting run through an older version of the compiler before we added animation. I'd appreciate some guidance on what I need to do to fix this. We can't push the docs until then because presumably running the script will over-write the pngs with incorrect ones even if we put correct ones in manually.

Yeah, don't put manual ones in. I suspect something doesn't get cleared.

@domoritz domoritz added this to the 6.0 milestone Feb 20, 2025
@domoritz
Copy link
Member

I'm seeing warnings for Channel time should not be used with an unsorted discrete field. for the gap minder example. We should try to avid having examples throw warnings.

@domoritz domoritz requested a review from arvind February 21, 2025 19:36
@jonathanzong jonathanzong marked this pull request as ready for review April 14, 2025 18:50
jonathanzong and others added 2 commits April 14, 2025 14:33
Co-authored-by: Dominik Moritz <domoritz@gmail.com>
@jonathanzong
Copy link
Member Author

opened a PR for the vg2png issue: vega/vega#4061

@domoritz
Copy link
Member

Eventually, we could replace the custom image generation pipeline with vitest/playwright's snapshot generation. But that's a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation for animation
3 participants