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

[6.2] Parameterizable URL #2063

Open
5 tasks
sosiology opened this issue Jan 31, 2025 · 0 comments
Open
5 tasks

[6.2] Parameterizable URL #2063

sosiology opened this issue Jan 31, 2025 · 0 comments
Assignees
Milestone

Comments

@sosiology
Copy link
Contributor

sosiology commented Jan 31, 2025

Description

Currently, there is no way to set filter values directly via URL parameters. This limitation means we must create multiple versions of the same visualization to share it with different filter values.

For example, if we want to display data for a specific canton without showing data from other cantons, we must create a separate visualization for each canton. This approach is inefficient and cumbersome, especially when managing multiple filtered views for different target audiences.

Proposed Solution

I would like all filter options to be configurable via URL parameters so that we can embed the visualization with specific filters.

This would allow us to share the same visualization with different filter settings without duplicating the visualization itself. As a result, we could provide tailored views directly to specific audiences, such as individual cantons, without exposing data intended for other groups.

Possible Alternatives

Currently, we address this need by creating multiple versions of the same visualization, each with a hardcoded filter for a specific canton. This approach is resource-intensive and not scalable.

Use Cases and Impact

This improvement would significantly enhance the flexibility, scalability, and security of data visualizations. By enabling filter settings via URL parameters, we could efficiently share customized visualizations with specific target audiences (e.g., individual cantons) without exposing data meant for other groups.

This would streamline workflows, save time, and reduce the complexity of managing multiple visualizations. Additionally, charts accessed via the Visualize API (/preview) cannot currently be shared because the chart state is neither implicitly nor explicitly stored in the URL.

Definition of Done (DoD):

  • Parameterizing API calls according to Visualize API documentation should be possible via hash parameters (#...) on Visualize Admin, including from an iFrame.

  • Passing selected parameters (e.g., station, timestamp, etc.) for existing diagrams to override the stored configuration.

  • Partial parameterization for existing diagrams & full dynamic parameterization for new diagrams via iFrame link, e.g.:
    <iframe src="https://visualize.admin.ch/embed/1234abcd/#{my-json-chart-parameters-overriding-the-chart-state: { 'https://ld.admin.ch/cube/hydro/stationID': 'https://ld.admin.ch/cube/hydro/station/357' }}"></iframe>

  • Updating the existing documentation to include these points.

  • Sharing API charts from /preview by storing the chart state as a URL parameter (see above).

Source: https://gitlab.ldbar.ch/bafu/visualize/-/issues/716

@sosiology sosiology self-assigned this Jan 31, 2025
@sosiology sosiology changed the title Parameterizable URL [6.2] Parameterizable URL Feb 20, 2025
@sosiology sosiology added this to the WE06 milestone Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant