Jump to content

Module talk:Piechart

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Rjjiii (talk | contribs) at 08:48, 24 January 2025 (Combining with Template:Pie chart: Reply). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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)[reply]

@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)[reply]
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)[reply]

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)[reply]

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)[reply]
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)[reply]