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

Testing implementation of wagtailcharts #7250

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

csebianlander
Copy link
Contributor

This is a draft PR designed to test the wagtailcharts package as a potential replacement or supplement to our Simple Charts module.

Right now, the rendering template is not working, because of reasons presumably beyond my understanding or expertise, but you can add, edit, and save the block properly in the page editor (I've only added it to the Browse page type for now just for testing purposes).

@csebianlander
Copy link
Contributor Author

You'll need to run pip install wagtailcharts on your local environment before testing.

@chosak
Copy link
Member

chosak commented Sep 21, 2022

@csebianlander I think I got this working thanks to some helpful JS tips from @anselmbradford. Ans, if you have a minute, can you take a glance at my JS and see if it seems reasonable?

I'm able to get working charts on a BrowsePage (for example http://localhost:8000/admin/pages/12070/edit/) with a configuration like this:

image

This generates a chart like this:

image

You'll need to yarn build to properly build the frontend script for this.

@csebianlander
Copy link
Contributor Author

I've made a lot of notes and have a lot of thoughts about this. The most prevalent is that it's a wonderful improvement from a back-end usability perspective.

We can add our CFPB-specific palette using the ChartBlock(colors=COLORS) argument described in the wagtailcharts docs, but my attempt to implement this led to some weird artifacts, so I'd love it someone who knows better what they're doing could make this change and add this set of colors:

    COLORS = (
        ('#20aa3f', 'Green'),
        ('#0072ce', 'Pacific'),
        ('#5a5d61', 'Gray'),
        ('#257675', 'Teal'),
        ('#254b87', 'Navy'),
        ('#b4267a', 'Purple'),
    )

Some things I wonder if we can integrate simply into this test:

  • Additional/custom fields
  • SimpleCharts-based styling, to implement our fonts and color styles.
  • Style/function overrides, either in the editor or (probably more practically) within the wagtail template? The more we can manipulate the charts.js API in our testing, the more easily we can convey to the wagtailcharts folks what we've found in terms of potential fixes and implementations for field options.

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.

None yet

2 participants