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

web: Extend ChartWidget with local interval selection #98

Open
mhthies opened this issue Nov 3, 2024 · 0 comments
Open

web: Extend ChartWidget with local interval selection #98

mhthies opened this issue Nov 3, 2024 · 0 comments

Comments

@mhthies
Copy link
Owner

mhthies commented Nov 3, 2024

From discussion #88: The ChartWidget shall be extended to allow users the local selection of different (pre-configured) time intervals. For simpler implementation, this shall not influence the fetching of the data series data, but instead only reconfigure the Chart.js x axis accordingly.

For pre-configuring the available time intervals, the ChartWidget constructor shall be extended with a new (optional) parameter selectable_intervals, taking a list of datetime.timedelta and corresponding label strings. If this parameter is set, the interval parameter must match one of the selectable_intervals entries. It is then used as the default interval, which is shown initially when opening the web page.

If this parameter is set, the list of intervals and corresponding labels is passed to the JavaScript code via the data-spec JSON attribute. The JavaScript shall then create a button group below the chart itself, according to this list. Instead of fetching the time series data for the configured (default) interval, the JavaScript code shall fetch the time series data for the maximum interval defined in the selectable_intervals list. The JavaScript code shall track the current selected interval and update the color of the buttons and the configuration of the Chart.js x-axis accordingly.

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

No branches or pull requests

1 participant