-
-
Notifications
You must be signed in to change notification settings - Fork 802
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
docs: Add documentation for initial interval selection date ranges #3815
base: main
Are you sure you want to change the base?
Conversation
This commit adds a new "Setting Initial Values" subsection to the "Interval Selections" documentation in `parameters.rst`. It explains how to use the `value` parameter with `datetime.date` and `datetime.datetime` objects to set an initial range for interval selections. This addresses issue vega#3643.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dsmedia big thank you for getting to this!
Flow
You mentioned 3 potential solutions, I think some narrative docs might work well here:
When I suggested that, I seem to have missed this pretty important part of those docs 🤦♂️
(emphasis mine)
Now that we have seen the basics of how we can use a selection to interact with a chart, let’s take a more systematic look at some of the types of selection parameters available in Altair.
For simplicity, we’ll use a common chart in all the following examples; a simple heat-map based on thecars
dataset.
Have you tried reading from Selection Types to see how it flows together?
On my read, it seems a bit disjointed:
cars
is not used in the first example- Neither example is a heat-map
- All of this is before the sentence that introduces that you can provide arguments
The
selection_interval()
function takes additional arguments to customize behavior.
Interaction
The examples demonstrate how to set initial values - but not why you'd want to.
Your interval_selection example from (#3667) does this much better - since the interaction is mapped to an encoding channel property.
Here we have an interval but nothing changes for data in/outside it 🤔
Summary
I still believe we could benefit from narrative docs on this topic - and this PR makes the first steps towards that.
Would you be able to take another stab at it with these concerns in mind?
Note
Super grateful for all the work you've been putting in over at vega_datasets
🎉
Perfectly valid feedback @dangotbanned . Here's try two, which reorders, smooths out the flow and expands a bit. (I see there was a problem with one of the checks but I believe this may be an unrelated issue?) |
This pull request adds documentation to
parameters.rst
to explain how to set initial date ranges for interval selections using Python's nativedatetime.date
anddatetime.datetime
objects.Changes:
parameters.rst
.alt.selection_interval
with thevalue
parameter and Pythondatetime.date
objects to set an initial date range.Context:
This documentation update addresses issue #3643, which requested clarification on how to use initial values in selection intervals with dates. This enhancement is made possible by the recent improvements to datetime support in Altair (PRs #3653 and #3662).
This PR specifically focuses on documenting the usage within
parameters.rst
. Further documentation updates related to #3643, such as adding information to the selection documentation and potentially thetimes_and_dates
section, may be considered in separate pull requests.Testing:
Link to issue #3643
Link to PR #3653
Link to PR #3662