code.pyret.org
code.pyret.org copied to clipboard
upgrade and fix pie chart rendering
Based on a bug report from a teacher
It turns out that unlike scatter plots, histograms, and all manner of bar charts, the order of SVG pie slices does not follow the order of the rows in the table! This PR makes the following changes:
- Compute the correct ordering of SVG slices before drawing the new ones
- Draw the new slices at a better location in the DOM, which fixes a number of display issues regarding interactive labels
- Draw tiny versions of the images in the legend as well
Thanks, @sorawee ! I've pushed fixes for these.
@blerner I've added tests (all of which pass when run in the browser), but I wasn't able to run npm run test from my command line due to missing packages.
I'm going to assume that this PR does what @schanzer needs it to do, and that the remaining branch CI failure is because this branch doesn't yet have @jpolitz 's fix from #horizon.