Module talk:Piechart
Option not to sum to 100 percent
Would be nice to have an "other" chunk that isn't mentioned in the legend. Wizmut (talk) 22:00, 4 February 2024 (UTC)
- @Wizmut You can see an example for "other" here: Template:Latest pie chart of world power by source. Though this only makes sense if you have percentages as values. It might be a bit harder to update charts this way. Depends on whether the source has percentages or absolute values. Nux (talk) 02:50, 24 January 2025 (UTC)
- I'm not sure how this example applies. The other chunk is mentioned in the legend, the opposite of what I asked for. Wizmut (talk) 03:36, 24 January 2025 (UTC)
Combining with Template:Pie chart
This has some advantages over {{Pie chart}} (tooltips, calculates percentages, no crosshair glitches). I've been tinkering with using the template's pie chart as a replacement for the one in {{Pie chart}}. There are a bunch of demos of {{Pie chart/sandbox2}} at Template:Pie chart/testcases. Nux, I have a few questions, is this something that you'd want to get wider usage or more a proof of concept. It's only transcluded to a handful of pages right now.
Also, the module should do something to sanitize user input for titles. A lot of people will place links there so the brackets ([ and ]) need to be checked for, and in case they use a piped link, it also needs to remove the pipe (|) and the wikilink target. Rjjiii (talk) 21:03, 22 January 2025 (UTC)
- Hi, yes this module can be used widely. I've added suport for links in labels and added an example here: Module:Piechart#Links. I think now in most cases you should be able to replace {{Pie chart}}, maybe even converting it automatically to the {{Piechart}}. Also added support for floating graphs in the template. Nux (talk) 02:45, 24 January 2025 (UTC)
- Fantastic! I checked the link out above and it looks clean. When you mention "converting it automatically" do you mean as a kind of wrapper template that could just feed the parameters from existing transclusions to {{Piechart}}? Rjjiii (talk) 08:48, 24 January 2025 (UTC)
- @Nux I've gone ahead and made sandbox copies for the module and template. I also started Template:Piechart/testcases and am checking for any bugs. If you look at "verbose", the colored bullets in the legend need "min-width" set somewhere. On mobile, the live template as a "thumb" moves to the left instead of the center. It looks like adding "display:flex" to "div.pie-thumb" should fix it (visible in the sandbox). Also, I tried applying the same styling to the caption as in Template:Pie chart. That template can likely be made into a wrapper for this one, Rjjiii (talk) 07:44, 25 January 2025 (UTC)
- Fantastic! I checked the link out above and it looks clean. When you mention "converting it automatically" do you mean as a kind of wrapper template that could just feed the parameters from existing transclusions to {{Piechart}}? Rjjiii (talk) 08:48, 24 January 2025 (UTC)