-
Notifications
You must be signed in to change notification settings - Fork 144
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
[POC] Add chart gallery dashboard #559
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I've fixed it already 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry my review took so long - I wanted to give this the full love it deserves because it's really an amazing dashboard ⭐ 💯 This is going to be a looooong review comment also, sorry...
I've checked through all the pages and all the graph are still in the right categories and all the links etc. work so no need for you to check that.
I ended up doing a bit of refactoring because I was having quite a good time 😁 Hopefully the commit comments make it clear what's changed. I'm happy to discuss/explain more if you like, but in summary:
chart_groups
now provides a central source of truth on page groupings, which pages are incomplete, etc. so there's less duplication and potential inconsistencies and easier contribution processIncompletePage
class which simplifies things quite a bit since it can be handled the same way asvm.Page
- example code split off into separate files to make it easier to edit and benefit from linting
- example code is run through
black
with customisable line length and other options so it doesn't have to reflect our repo settings - now there's a new requirement (
black
), we have arequirements.txt
file and new hatch environment for running examples - pages reorganised into one python file for each chart group
- page paths are now hierarchical, e.g.
http://localhost:8050/deviation/butterfly
- I think it works really nicely for this example so it seemed like a good showcase for the feature which we don't demonstrate anywhere else and probably most people aren't aware is possible utils
generally moved/removed with just a few bits left in_pages_utils.py
- svg files de-duplicated and no need for
remove_prefix
any more - the page titles map onto svgs 1-1
In terms of the actual content, I changed very little - mainly just tiny English corrections and bits. The biggest changes are:
- remove scatter factory since it was only used once
- copied the intro text from README.md onto a card for the All tab on homepaeg
- decided that ordered bar/column should be distinct from bar/column so split them off (but content is still identical)
- set opacity to 0.3 rather than 0.5 for incomplete pages since the contrast seemed a bit low to me (I love love love this way of showing something as inactive btw, super simple and effective)
Things you might still like to change in this PR. Feel free to ignore if you disagree or save it for another time if you agree but don't want to do it now, because I know this has already been a huge task:
- is it worth putting in a reference to the data viz book that the FT based their work on also? (I'm curious, what is the source?)
- should the code snippet occupy the same height as the graph? It feels a bit squashed to me currently?
- the
html.H3(self.title)
in theCodeClipboard
feels a bit redundant/clutter to me given it says "Show code" right above it, and the copy button doesn't actually apply to that but appears in a position that makes it look like it does - maybe nice to have an overall dashboard title? "Vizro chart gallery" or similar?
- some of the icons used in
NavLink
could maybe be improved. Distribution being waterfall icon is a bit confusing given that waterfall isn't one of those charts. But I can't find any other icon that would be more suitable there :/ And there's nothing wrong with these how they currently are, but in case you prefer them: deviation to one of these? Flow to air? - explanation for treemap doesn't make sense where it appears on the Magnitude category, it's really written for the Part-to-whole page
- violin plot explanation mentions quartiles but these aren't actually shown without hovering over the plot. Maybe change the explanation or use
box=True
or something to show them in the plot? - sankey plot renders with C1 overlapping other bars which looks a bit odd. You can drag and drop the bars to separate them so it's not a problem with the data, but maybe there's some option that would separate these out?
- might be worth tweaking the black settings in
black.Mode
e.g. for line length - I didn't experiment with these at all, just left them on default - is there a simpler dataset that would work for the bar/column charts? Surely there's something in
px.data
that doesn't require us to do the aggregations on it? - did you see these look like svgs with transparent backgrounds so might work better than the black ones? I don't mind the current ones though
- thanks for doing the change to navicon highlighting, I wasn't actually expecting you to do that! Does it mean we need to update lots of screenshots for the tests? If so then I think not worth doing here, let's just leave it as is because I also had some comments/questions on the right design for this anyway.
Aaaand finally some TODOs that we shouldn't do now but I didn't want to lose as future ideas. Maybe some could be done in Grace Hopper, maybe some before that, maybe some after that or never... These are all in the code but let me put them all here, roughly in order of lowest to highest priority:
# TODO: this is currently identical to ordered column/bar. It should be:
# - unordered (currently ordering is done in tips_agg)
# - different svg
# - slightly different text
# - slightly different example
# TODO: this is currently identical to bar/column. It should be:
# - slightly different text since it says "you can arrange your bars in any order"
# TODO: think about the best way to do code examples, e.g.
# - do we want full dashboard example or plot-only example?
# - or both? Could be done using a toggle switch or multiple tabs.
# - a link to py.cafe showing the dashboard code?
# TODO: Charts that are commented out in incomplete_pages below do not have an svg made yet.
# Uncomment them once they are ready.
# TODO: consider whether each chart group should have its own individual homepage, e.g. at http://localhost:8050/deviation/.
# This could just repeat the content of the tab from the homepage and would work nicely with the hierarchical navigation.
# TODO: consider how this should be represented in the code example files. Since the code is copy and pasted
# it can get out of sync. But probably we don't want the docstrings in the short code snippet.
# Ultimately these charts will probably move to vizro.charts anyway.
# TODO: eventually deduplicate page generation into a function rather than copying and pasting across files?
- Add dashboard title - Add reference to original data viz book - Remove header from CodeClipboard - Improve navigation icons - Move navigation coloring to custom CSS
- Remove treemap from magnitude category - Simplify sankey data - Optimise black formatting - Optimise layout - Comment out navigation icon highlighting - Add box to violing chart
For my own tracking: Things you might still like to change in this PR. Feel free to ignore if you disagree or save it for another time if you agree but don't want to do it now, because I know this has already been a huge task:
|
|
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…into demo/chart-gallery
Co-authored-by: Antony Milne <[email protected]>
Description
Note: Don't distribute this POC just yet. We plan to publish it internally and externally when the majority of content is filled :)
Also ignore the large number of code line changes, it's mostly the code for the svg files 😄 And lots of description text for the charts, so hopefully it doesn't look too daunting anymore.
Screenshot
Notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":