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

Dashboard filters #1545

Merged
merged 37 commits into from
Jun 4, 2024
Merged

Dashboard filters #1545

merged 37 commits into from
Jun 4, 2024

Conversation

ptbrowne
Copy link
Collaborator

@ptbrowne ptbrowne commented May 30, 2024

Work in progress.

Functionality

It is now possible to activate a single shared temporal filter for all charts depending on a particular temporal dimensions.

  • Shared time slider, takes unit from dimension
  • UI to activate/deactivate year filter
  • Ability to change default from/to of the time rane
  • Dashboard filter is not shown inside the "configurating" view
  • Chart config gains a new attribute dashboardFilters where sharedFilters are stored

How to test

  1. Start from Photovoltaikanlagen
  2. Add a line chart
  3. Add a new dataset like Median electricity tariff for Switzerland
  4. Proceed to layout options
  5. Choose Dashboard as a layout
  6. See that a section "Shared filters" appears in the left panel
  7. Activate the shared filter on Year
  8. You can now interactively control both charts with the same filter
  9. Control the default extent through the date pickers in the left panel
  10. Publish the chart

Next steps in following PRs

  • Implement the logic for data filters
  • Implement the logic for "point in time" filter

Refactors

Take the opportunity to explode the big configurator-state file into multiple ones. With this, it should be easier to add changes. I'd like your feedback on this Bartosz also.

Copy link

vercel bot commented May 30, 2024

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

Name Status Preview Comments Updated (UTC)
visualization-tool ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 4, 2024 10:25am

@ptbrowne ptbrowne force-pushed the feat/dashboard-filters branch from 38369bc to 00f4fab Compare June 3, 2024 12:31
@ptbrowne ptbrowne force-pushed the fix/dashboard-published branch from 6a5a667 to 9a9595f Compare June 3, 2024 12:31
Base automatically changed from fix/dashboard-published to main June 3, 2024 12:50
Copy link
Collaborator

@bprusinowski bprusinowski left a comment

Choose a reason for hiding this comment

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

Code LGTM, with some questions and small nits 💯

When it comes to testing the deployment preview, I think it breaks when you merge cubes:

  1. Go to this link.
  2. Add a line chart.
  3. Merge Heavy metal soil contamination dataset to the line chart.
  4. Proceed to layout options.
  5. Switch to Free canvas Dashboard layout.
  6. Enable shared filters.
  7. See that the filters do not work and the slider is not shown on top of the charts.

Comment on lines 30 to 34
const formatSecond = timeFormat("%Y-%m-%dT%H:%M:%S");
const formatMinute = timeFormat("%Y-%m-%dT%H:%M");
const formatDay = timeFormat("%Y-%m-%d");
const formatMonth = timeFormat("%Y-%m");
const formatYear = timeFormat("%Y");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thinking out loud if these shouldn't be connected to RDF definitions? See that we already defined some of them here:

const timeFormatters = new Map<string, (d: Date) => string>([
[ns.xsd.gYear.value, timeFormat("%Y")],
[ns.xsd.date.value, timeFormat("%Y-%m-%d")],
[ns.xsd.dateTime.value, timeFormat("%Y-%m-%dT%H:%M:%S")],
]);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean that we should make sure that there are the same string formats used on the client & on the server, for example having a time-formats where

export const timeFormats : Record<TimeUnit, string> = {
  Year: "%Y"
  Second: "%Y-%m-%dT%H:%M:%S"
  ...
}

and imported by both ui-helpers and rdf/parse ?

Copy link
Collaborator

@bprusinowski bprusinowski Jun 3, 2024

Choose a reason for hiding this comment

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

Yes, I was wondering if this would make sense and is actually needed. It looks that the formatters I shared in the link are only used in interpolateTimeValues function from the same file which is not used anywhere; so I guess we could just clean up and remove these server-side variables 👀

app/stores/interactive-filters.tsx Outdated Show resolved Hide resolved
app/utils/chart-config/versioning.ts Show resolved Hide resolved
app/configurator/configurator-state/init.tsx Outdated Show resolved Hide resolved
app/configurator/configurator-state/reducer.tsx Outdated Show resolved Hide resolved
app/stores/interactive-filters.tsx Show resolved Hide resolved
app/stores/interactive-filters.tsx Outdated Show resolved Hide resolved
app/components/chart-panel.tsx Show resolved Hide resolved
app/configurator/components/layout-configurator.tsx Outdated Show resolved Hide resolved
app/configurator/components/layout-configurator.tsx Outdated Show resolved Hide resolved
@bprusinowski
Copy link
Collaborator

For the breaking of giant configurator state into smaller files, I think it's a very good step into making this more manageable, which also shouldn't really change any behavior if I am not mistaken, so I am all for it :)

ptbrowne added 2 commits June 4, 2024 11:48
Wrap shared filter content inside ControlSectionContent for it to collapse correctly
@ptbrowne ptbrowne merged commit 16c14d6 into main Jun 4, 2024
5 of 6 checks passed
@ptbrowne ptbrowne deleted the feat/dashboard-filters branch June 4, 2024 10:32
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.

2 participants