Skip to content
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

Example of a line chart with a label annotating the final value #2623

Merged
merged 4 commits into from
Jul 3, 2022

Conversation

palewire
Copy link
Contributor

Fixes #2622

It should look like this:
visualization

The example was drawn from the Vega-Lite docs

@joelostblom
Copy link
Contributor

Thanks for this contribution! I recently fixed the CI tests, could you rebase this on the main branch so that we can see that all the tests are passing here before merging?

@palewire
Copy link
Contributor Author

I believe I've done that.

@mattijn
Copy link
Contributor

mattijn commented Jul 1, 2022

Interesting approach! I was not aware of argmax in this context.

While I like your approach, there exist a shorthand for

x=alt.X('date:T', aggregate='max')

namely

x=alt.X('max(date):T')

And, while shorter in your example, this line:

y=alt.Y('price:Q', aggregate={'argmax': 'date'})

could be written in the Altair approach as

y=alt.Y('price:Q', aggregate=alt.ArgmaxDef(argmax='date'))

since there is no shorthand for this (that I'm aware of).

All in all, the possible changes won't make it more readable..
What you think @joelostblom?

Maybe we could create an issue as well to expand the Altair docs for aggregation as well with more info from vl-aggregate-ops and vl-aggregate-argmax.

@palewire
Copy link
Contributor Author

palewire commented Jul 1, 2022

I'm fine with those edits if it's what you'd prefer to showcase.

@palewire
Copy link
Contributor Author

palewire commented Jul 3, 2022

I made the changes for you.

@mattijn mattijn merged commit 756e4de into vega:master Jul 3, 2022
@mattijn
Copy link
Contributor

mattijn commented Jul 3, 2022

Thanks!

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.

Example gallery should show how to mark and label the final value in a timeseries
3 participants