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

feat: Add time slider to interactive filters #816

Merged
merged 15 commits into from
Nov 3, 2022
Merged

Conversation

bprusinowski
Copy link
Collaborator

@bprusinowski bprusinowski commented Oct 28, 2022

Contributes to #802.

This PR introduces a basic time slider which can be used to interactively filter a chart based on time dimension.

How to test

  1. Go to /en/browse/dataset/https%3A%2F%2Fenvironment.ld.admin.ch%2Ffoen%2Fubd0104prod%2F5?dataSource=Int&flag__timeslider=true (notice the flag__timeslider, feature is not available by default).
  2. Create a column chart.
  3. Change X variable to Parameter.
  4. Go to Publishing step and enable Time Slider.
  5. See that a slider appeared below the chart.
  6. Use the slider to filter the data.
  7. Change X dimension back to Date and see that a time slider disappeared.

@vercel
Copy link

vercel bot commented Oct 28, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
visualization-tool ✅ Ready (Inspect) Visit Preview Nov 3, 2022 at 5:09PM (UTC)

Copy link
Collaborator

@ptbrowne ptbrowne left a comment

Choose a reason for hiding this comment

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

I was curious and did a pre-review :) Looks great.

app/configurator/configurator-state.spec.tsx Outdated Show resolved Hide resolved
return true;

default:
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why could we have the default case ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll also need to probably improve this, the case here is that activeField could be a lot of things – areaLayer, segment, x, y, but also interactive filter and here I wanted to catch these cases in more clear way, for all other strings the default case if triggered. Do you have an idea how to handle this better?

app/charts/area/areas-state.tsx Show resolved Hide resolved
app/charts/shared/chart-state.ts Show resolved Hide resolved
app/charts/area/areas-state.tsx Outdated Show resolved Hide resolved
app/configurator/interactive-filters/time-slider.tsx Outdated Show resolved Hide resolved
app/configurator/interactive-filters/time-slider.tsx Outdated Show resolved Hide resolved
@ptbrowne
Copy link
Collaborator

ptbrowne commented Nov 1, 2022

I think we could have

  • Enable time slider for more chart types
  • Add transitions to charts (visx?)

in a next PR, and we would hide the interactive filter behind a flag. The PR is already getting big ;) What do you think ?

@bprusinowski
Copy link
Collaborator Author

Thanks @ptbrowne for review! Yes, it's getting big, I'll try to clean up the stuff and I even think it would make sense to leave things like chart container size, animation, design of the slider also for another PR and just fix things here + hide the feature behind a feature flag. I think it would make sense to merge before new UI is implemented so we can avoid lots of conflicts 😨

@ptbrowne
Copy link
Collaborator

ptbrowne commented Nov 1, 2022

Yep, makes sense 💯

Copy link
Collaborator

@ptbrowne ptbrowne left a comment

Choose a reason for hiding this comment

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

LGTM 🙇

app/charts/shared/use-sync-interactive-filters.tsx Outdated Show resolved Hide resolved
@bprusinowski bprusinowski changed the title feat: Add timeSlider to interactive filters feat: Add time slider to interactive filters Nov 3, 2022
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.

Tech Exploration: Animated Charts / Time Slider with Play Button
2 participants