-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature: Add datavis (chart-builder) app (initial version) #80
Open
ababic
wants to merge
38
commits into
main
Choose a base branch
from
feature/datavis
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ababic
force-pushed
the
feature/datavis
branch
10 times, most recently
from
January 20, 2025 09:07
6b8f500
to
80ceda0
Compare
…ns from config in favour of including data and options separately for each series
… types only, and add consistant class methods for returning panels for different tabs
…more datasource views to remove unwanted ChecksSidePanel
…es and remove unnecessary cruft
…ditional data sources
* Bring in some of the styling from the proof of concept * Tidying up before mere
ababic
force-pushed
the
feature/datavis
branch
from
January 30, 2025 16:25
0aff35f
to
fb891fb
Compare
ababic
force-pushed
the
feature/datavis
branch
from
January 30, 2025 17:24
e4f5418
to
57faf50
Compare
ababic
force-pushed
the
feature/datavis
branch
2 times, most recently
from
January 30, 2025 20:45
d20fa50
to
693e5d4
Compare
ababic
force-pushed
the
feature/datavis
branch
from
January 30, 2025 21:20
33be099
to
e617992
Compare
ababic
changed the title
Feature: Add datavis (charts) app
Feature: Add datavis (chart-builder) app
Jan 31, 2025
ababic
changed the title
Feature: Add datavis (chart-builder) app
Feature: Add datavis (chart-builder) app (initial version)
Jan 31, 2025
ababic
force-pushed
the
feature/datavis
branch
from
January 31, 2025 09:04
e617992
to
717acd8
Compare
ababic
force-pushed
the
feature/datavis
branch
from
January 31, 2025 09:10
717acd8
to
d5efe54
Compare
ababic
force-pushed
the
feature/datavis
branch
from
January 31, 2025 09:23
cd75657
to
87a48ef
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Includes a baseline implementation of chart-builder functionality for Wagtail
How to review
Data sources
The data source index/listing
The listing for data sources has been customised to include additional information about each item, including:
The listing includes a search option, which will filter the list to include matches on 'Title' or 'UUID' (if known), and also includes a number of filter options to help identify items of interest:
Adding a data source
NOTE: The "Data" field (particularly the custom streamfield block that provides the table-like interface) works well from a UX perspective, but doesn't do a great job of storing data in a way that can be easily used by visualisations. So, when a data source is saved, and the 'Data' value has changed, the value is parsed to extract the row and column values, and convert anything that looks like a number to int or float values. This extracted data is then saved to a hidden
data
field on the model as JSON, which can be efficiently pulled out of the database with all of the numbers values in-tact, so that no on-the-fly reformatting of data is needed.Previewing data sources as different visualisation types
When creating or editing a data source, the preview tab in Wagtail allows you to easily see what the data could look like as different types of chart (using the default settings for each)
The available preview options are hardcoded on the
Datasource
model, and do not update automatically to reflect newly-added visualisation types.Copying a data source
A data source can be easily created from an existing one using the 'Copy' feature, which can be accessed via the item-specific option menu in the listing:
For data sources, this uses the stock 'Copy view' that Wagtail provides for snippets.
Visualisations
The visualisation index/listing
The listing for visualisation has been customised to include additional information about each item, including:
The listing includes a search option, which will filter the list to include matches on 'Name', 'Type', 'Title', 'Subtitle' or 'Caption', and also includes a number of filter options to help identify items of interest:
Adding a visualisation
When adding a visualisation, the first step of the process is to select which type of visualisation is required.
This step is required to allow the second step to be able to identify the relevant model class and render a UI that makes sense for the selected type. Currently, only the 'Bar chart' type makes any significant changes (to relabel the X axis and Y axis options), but this is likely to change in future.
In the second step, the new visualisation can be previewed without saving, as soon as all of the required fields have been populated. Like with pages, any changes made to the available options will trigger an automatic refresh of the preview (provided the form has no validation errors to resolve).
All visualisation types require a "Primary data source" to be selected, which provides the data used when rendering. Because we're using Wagtail's native snippet chooser here, the chooser is permission-aware, and only presents datasources for selection that are visible to the current user.
All included chart types currently render using a common template and JS. This will change to use one or more official Design System component when they becomes available.
Adding annotations to a visualisation
Annotations can be added via the "Advanced" tab in the edit interface for all current visualisation types. For each item, the editor must provide the label text, X position and Y position. The positional fields should correspond to "values" on the X and Y axis, but no validation is currently applied.
Annotations are not rendering reliably yet, because Highcharts doesn't support defining axis position values that use strings out-of-the-box. Further JS customisation is needed to evaluate annotation values when the chart is loaded and convert string values to coordinates that Highcharts will understand.
Adding additional data sources to a visualisation
These can also be added via the "Advanced" tab in the edit interface for all current visualisation types. For each item, the editor must select the data source and choose how the data should be rendered:
The "Include in downloadables?" option is ignored currently, but will come into play when we eventually come to generating download links for the various sets of data featured in a chart.
Copying a visualisation
A visualisation can easily be created from an existing one using the 'Copy' feature, which can be accessed via the item-specific menu in the listing:
Rather than taking you to a fully-populated form like the Wagtail's built-in version, this custom version only has two fields, allowing you to specify a name for the new visualisation, and also choose a different visualisation type to created it as:
The new object is created using the same data source and configuration options as the original, but is saved as an instance of the selected type.
Currently, all visualisation types are similar enough that the values are compatible across all types. However, in future, this is less likely to be the case.
Featuring charts on a page
The
DataVisBlock
is available as an option on the "Information page" only for now. The block allows you to choose from any visualisations visible to the current user, and forces the editor to provide accompanying 'Title' and 'Subtitle" text, which replace the values set on the selected visualisation when the block is rendered.When the page is rendered, any additional media required for rendering visualisations on the page is collected together, deduplicated, and included in the
<head>
section of the page.Developer notes
Permissioning
For now, both the
Datasource
andVisualisation
models use theCollectionOwnershipPermissionPolicy
from Wagtail, which is the same approach taken for images and documents, and is outlined here. More information about collections in general can be found here.This can be reviewed / amended at a later time as necessary.
Follow-up Actions