Template talk:Pie chart

Background color
Since the pie chart is shown in a thumb frame, which has #f9f9f9 as the background color, shouldn't File:Circle frame.svg have the same background color? — Edokter • Talk  • 12:08, 16 December 2010 (UTC)
 * Since this template is the only one using the image, I modified the image. — Edokter • Talk  • 12:20, 16 December 2010 (UTC)

Vertical start point?
Is it possible to have the start-point re-set to 0° instead of 90°? I find this almost useful as it is, but not quite. Fan |  talk  10:32, 30 August 2011 (UTC)

Zoom
If there anyway to widen the chart? Say with a 400px parameter, for example, or a zoom=200 (percent), where the current size is zoom=100? --RoyGoldsmith (talk) 16:01, 8 August 2012 (UTC)

Text wrap
I may be doing something wrong, but when I've tested this template it doesn't seem to allow the text to wrap around. This is obviously a problem when the objective is to embed the chart in the text, so any advice would be appreciated. CanadianJudoka (talk) 22:14, 8 September 2012 (UTC)


 * It's used at Breast cancer awareness, and it seems to text-wrap properly there. Can you give an example?  WhatamIdoing (talk) 19:37, 29 April 2013 (UTC)

"Scaling up" when total does not = 100
It would be nice if the chart automatically "scaled up" when the total does not quite equal 100% due to rounding by adding the same amount (%wise) to each portion. --JFH (talk) 16:34, 27 April 2013 (UTC)
 * Not possible I'm afraid. The template uses a fixed formula where the total needs to be 100, becuase those values are directly translated to CSS. Perhaps a Lua solution could be much more flexible. — Edokter  ( talk ) — 18:39, 27 April 2013 (UTC)

Broken on mobile browsers; Not backwards compatible
See. There should be support in m:Extension:EasyTimeline for this. We aren't even showing SVG's inline because we fear the client has no support. And SVG is more widely supported than CSS3. Wikipedia shouldn't be a CSS3 playground. --Ysangkok (talk) 11:36, 1 May 2013 (UTC)


 * Re:Mobile device. I used this template and noticed it works on mobile device when in WP "desktop view" but not in "mobile view". I.am.a.qwerty (talk) 13:17, 8 May 2014 (UTC)


 * Resolved now, see WP:VPT. 109.76.215.183 (talk) 11:24, 21 May 2014 (UTC)

iw cy
Tried using this pie chart on the Welsh Wiki, but to no avail! Can some one please take a look here. As you can see, there's a flaw somewhere. It works fine on the corresponding Wiki-en. Many thanks. Llywelyn2000 (talk) 07:36, 3 August 2013 (UTC)

Limit of 15 instead of 10 slices
I amended the first sentence of the template documentation that states "The labels and values of up to ten slices may be specified. All the parameters for six slices are included below; to include more slices, copy the code for one of the others, changing the digit at the end of each parameter name." In fact, pie-chart works with up to 15 different items, not 10. See example. Thought that's rather important to mention in section "Limitations". Of course, an increase to 20 slices would be appreciated;) – Cheers,  R fassbind  -talk   14:04, 27 April 2015 (UTC)

New extension available: GRAPH
See example and details on [Wikitech-l] GRAPH extension is now live everywhere!. Helder 12:24, 6 May 2015 (UTC)

Extension:Graph based template created
Template:PieChart provides a way to add a pie chart using extension:graph. The vega specification is in the template. You can add a pie chart now with


 * Ad Huikeshoven, there are over 700 transclusions of this template, so clearly people won't switch easily. Instead, I think this template should remain, but it should be modified to use the graph extension, thus keeping everyone happy :). The documentation should probably mention that there is another template available if needed, with more functionality. --Yurik (talk) 18:37, 29 December 2015 (UTC)
 * Thanks Yurik. Actually, I like the template style of Template:Pie chart better than of Graph:PieChart. There is some work to be done to create the Template:Pie chart legend style in combination with the graph extension pie chart. Including wiki links in legend text might be a challenge. Ad Huikeshoven (talk) 11:40, 31 December 2015 (UTC)

Sortable caption?
I wonder if the caption could be made sortable, by converting it to a table, if an option is selected. In the pie chart of numbers of speakers in, the Chinese varieties are sorted in the same order as they are mentioned in the text (perhaps from north to south?). As a result, you can't see at a glance which varieties are spoken more than others.

It would be nice if the template could generate a table like the one below, which would allow the entries in the pie chart to be ranked by name or value. — Eru·tuon 01:15, 18 September 2016 (UTC)


 * This seems an overly complex solution to a minute problem that will just disappear if you order by size to begin with. You don't need to follow the order of the prose, since it's not a tabular lineup of elements, so people will already have difficulty matching prose to the pie chart legend. —Th e DJ (talk • contribs) 05:31, 27 October 2016 (UTC)

Histogram
Can you make one of these templates for histograms with variable bin widths? So you specify the bin boundaries and the amount in each bin, and it plots so that the area of the box matches the amount in that bin.

Similar to https://en.wikipedia.org/wiki/File:Travel_time_histogram_total_n_Stata.png or https://commons.wikimedia.org/wiki/File:AkkaTechnologies_-_histogramme_des_ages_employes_2013.png

It's not easy to make these charts with typical plotting tools, and a lot of times this data is shown instead using pie charts, but pie charts are an inappropriate choice. — Preceding unsigned comment added by 71.167.64.138 (talk) 17:57, 17 December 2016 (UTC)

Square
Pie chart is square on mobile browser on sino-Tibetan. Pi day joke? Samples render ok on this page. Lollipop (talk) 02:44, 10 March 2018 (UTC) Lollipop (talk) 02:44, 10 March 2018 (UTC)

Conflict with Blackscreen gadget
This template conflicts with the blackscreen gadget. There is a thread about this at Village pump (technical). DuncanHill (talk) 13:37, 4 June 2018 (UTC)

This is still a problem on the mobile app when using an Android phone in Dark Mode. See Village pump (technical). -Apocheir (talk) 23:04, 25 September 2021 (UTC)


 * It's still a problem on desktop too. DuncanHill (talk) 23:12, 25 September 2021 (UTC)
 * Note, as reported on reddit, this is still an issue. On the corresponding Phabricator ticket, it was suggested that the problem could be fixed using the CSS . Opencooper (talk) 01:11, 19 July 2022 (UTC)
 * I applied that suggested change. —&#8239; The Earwig (talk) 05:13, 19 July 2022 (UTC)

Notice of discussion regarding this template
This template, and whether or not to change the display of the output, is being discussed here. Primefac (talk) 14:05, 7 September 2018 (UTC)

Remove IE6 support
Internet Explorer 6 only supports SSL, not TLS, whereas Wikimedia servers only support TLS, not SSL, over HTTPS connections. Wikimedia's use of HSTS means that it is not possible to view Wikipedia with an insecure HTTP-only connection, and the lack of overlap in protocol support between IE6 and the WMF means that attempting to view a WMF wiki with IE6 now results in a protocol error (and has for at least a year). Because of this, IE6 support in this template is now an unnecessary bit of cruft that should be removed. I am aware of the  class in MediaWiki:Common.css, and accompanying documentation on Template:Pie chart/doc, but I don't know if any code specifically in this template is dedicated to IE6 support. All of this should now be removed. 「 ディノ 奴 千？！ 」? · ☎ Dinoguy1000 04:49, 20 September 2018 (UTC)
 * Note: transborder class is also used in Template:Twitter Bird and Module:Plotter. -- WOSlinker (talk) 08:21, 20 September 2018 (UTC)
 * I could only find 4 uses of the class (Template:Twitter Bird, Module:Plotter, Module:Chart & Template:Pie chart/slice), so I've converted them all to inline styles instead rather than trying to workout if it all looks ok without that style. It can now be removed from Common.css. I'll wait a few days and then make the request. -- WOSlinker (talk) 18:37, 7 October 2018 (UTC)

colors
The changes you made tilted the entire color-scheme towards blue. As there was no consensus for this, I've reverted you. Per WP:BRD, please discuss. Chris Troutman ( talk ) 13:45, 10 November 2019 (UTC)
 * Yes,, I made the change in the spirit of WP:BRD. That colour scheme is the one adopted by graph and it's the D3 standard, recommended by Prof. Cynthia Brewer from Penn State University. There's a science and a method to it, which the current scheme seems to have none of. Guarapiranga (talk) 21:12, 10 November 2019 (UTC)
 * You could organize an RfC to establish wider consensus, but I don't like your color scheme; I don't care that there's a method to it. Chris Troutman  ( talk ) 21:29, 10 November 2019 (UTC)
 * To be more specific, the first value and the second value are too close in hue and initial values seem to skew heavy to winter palette. I would want to see more contrast. Chris Troutman  ( talk ) 00:51, 11 November 2019 (UTC)
 * Ok, ✅. Guarapiranga (talk) 05:59, 11 November 2019 (UTC)
 * Let's try that again…
 * Upon, 's suggestion, I'm calling for comment on adopting the aforementioned colour scheme in this template. Guarapiranga (talk) 20:59, 11 November 2019 (UTC)


 * Status quo Just to clarify, I disagree with Guarapiranga's implementation of D3 standard. Chris Troutman  ( talk ) 23:56, 11 November 2019 (UTC)
 * Insufficient information. We need to be able to see (on WP, not on some other site) the proposed scheme and how it compares to the earlier one. .  — SMcCandlish ☏ ¢ 😼  21:38, 12 November 2019 (UTC)
 * Here it was, . Guarapiranga (talk) 21:40, 12 November 2019 (UTC)
 * I must need coffee or something, but I'm seeing the same key/legend of boxes at the top in both cases, but a different first-example pie chart. Anyway, if this is about that chart, I think this may bear some additional research, and probably ask for it at WT:MOSACCESS.  While the longer-standing color scheme has clearer (verging on obnoxious) differences between the colors for fully-sighted people, I have a suspicion several of those colors are too close to each other in luminosity and contrast for people with color-blindness.  I would surmise that the replacement scheme has been tested in that regard (and this is why it's wanted), but I also agree that some of the tones are closer to each other than necessary. They're all a bit washed out.  Can't we come to a compromise between muddy and cartoonish?  — SMcCandlish ☏ ¢ 😼  22:57, 14 November 2019 (UTC)
 * Status quo The contrast makes it easier to read. Someone963852 (talk) 00:31, 14 November 2019 (UTC)
 * Confused - I cannot determine what the RFC is requesting.--Rpclod (talk) 00:47, 26 November 2019 (UTC)

With the greatest respect to everyone involved so far, but we'd need extraordinarily good reasons to keep the previous scheme. It's downright abysmal: it relies heavily on hue differences, which means it's bad for colour-blind people (sequential colours are not always contrastive: for example, the first two colours look too similar for readers with protanopia), and it's bad for printing (all but two of the colours are indistinguishable in greyscale). Furthermore, its use of strong saturated primary colours is ugly (particularly jarring is the juxtaposition of strong green and red, which are the first two colours in the list and so the ones most likely to take up the largest neighbouring chunks of the pie).

The old colour scheme would have been OK in the early days of the internet, but we really should do better now. A colour scheme needs to be accessible, it needs to display acceptably in a wide range of environments and it needs to be aesthetically pleasing.

The only reason I could think of for sticking to the old scheme is the possibility that editors might have somehow relied on the the default colours being what they are: either for colour symbolism, or when referring to the chart colours in the text outside the chart. The first scenario is extremely unlikely given the template setup, but the second one is plausible. How likely is it that there will be references to the colours within article text? I've had a look at a random selection of 15 articles that use the template and I couldn't spot any obvious such mentions. (Tellingly, of these 15 articles, only 2 were using the default colours).

I'll restore Guarapiranga' changes. Of the colour palettes at this is the one with the most robust contrast for sequential colours, so it's really good for this use. However, I would not object if any other suitable scheme is chosen instead. – Uanfala (talk) 00:21, 23 December 2019 (UTC)
 * Prefer change to 's or another scheme, since the ultrasaturated hues are indeed jarring, and since seems to have thought this through most thoroughly, so I defer to them. Whatever was/is decided, please keep the documentation in sync with the actual template, since right now the documentation has the proposed change while the live template does not, and that's not an okay combo. &#123;{u&#124;  Sdkb  }&#125;  talk 03:32, 9 August 2020 (UTC)
 * Oh yeah, I was about to implement a change at the time, but then got distracted and never quite found the time afterwards. I'll get around to doing it at some point, but if anyone wants to beat me to it, by all means go ahead. The colour schemes in the link above will probably tick all the boxes, the only trick is to find the one that's got the best contrast (incl. in grayscale etc.) between neighbouring colours. – Uanfala (talk) 16:23, 16 August 2020 (UTC)
 * , I'll leave it to you, since I wouldn't want to mess anything up. Thanks for your insights/work on this! &#123;{u&#124; Sdkb  }&#125;  talk 19:25, 16 August 2020 (UTC)

Discussion at Wikipedia:Village pump (technical) § Pie chart troubles
You are invited to join the discussion at Wikipedia:Village pump (technical) § Pie chart troubles. &#123;{u&#124; Sdkb  }&#125;  talk 08:21, 9 August 2020 (UTC)


 * @Jackmcbarn, as a follow-up to this, it looks like whatever needed to happen on the back end has now happened, so your prototype at the VPT discussion now works. Would the next step be to convert this template to use the graph extension? Someone brought up troubles in the #technical Discord channel earlier, so this might solve multiple concerns. Courtesy ping @Izno from Discord. &#123;{u&#124; Sdkb  }&#125;  talk 17:53, 4 July 2021 (UTC)
 * pls no ask instead (<3). Izno (talk) 17:56, 4 July 2021 (UTC)

BrewerColorLegends
Dear creators of templates, today I was working in my sandbox and I wanted to apply something like a color list. After a quick search in list of templates I found BrewerColorLegends. How can I add them to my pie chart, is it even possible? If not, is planned or is there a substitution for this kind of problem? With Regards, --A09090091 (talk) 09:53, 2 December 2020 (UTC)
 * if I understand you correctly, you're trying to customize the color scheme on a pie chart so that it will follow a ColorBrewer palette? To do that, you can use hex code (where N is the label number and the hex code is e.g. #000000). The documentation here explains most of it, although it's a little misaligned with the template's current behavior., , myself, and others are also having a discussion above about making that change to the template itself so that it'd be the default. Cheers, &#123;{u&#124; Sdkb  }&#125;  talk 10:35, 2 December 2020 (UTC)
 * I was so used to matplotlib and seaborn in Python frameworks. Must say it was simpler and as I got stopped by this I immediately asked for help. Thanks once again. You helped me so much. --A09090091 (talk) 11:59, 2 December 2020 (UTC)

Obtrusive white line at 180 and 270 degrees on Firefox (Desktop)
I am observing a white line at 180 and 270 degrees overlapping whatever color segment that exists,on Firefox browser 113.0.1 (64 bit) on Ubuntu 18.04, while the pie chart is proper on Google chrome Version 107.0.5304.87 (Official Build) (64-bit). (Please see the template page using Firefox browser.) Android version of Firefox is also displaying it properly. Is there any fix possible to the code? Arjunaraoc (talk) 01:36, 14 May 2023 (UTC)


 * Just popping in to say that I'm also experiencing this. Tried restarting my browser, updating Firefox, and restarting my laptop, but the lines remain. Dragon401k (talk) 04:29, 15 May 2023 (UTC)
 * @Dragon401k, I noticed that these lines some times do not appear, so the problem is intermittent. Arjunaraoc (talk) 01:29, 3 June 2023 (UTC)

Incorrect colors (at least) on Safari in iOS
Some people wrote about incorrect pie chart colors in the article Oulu. I noticed they wrote the comments with a mobile phone, so I checked the article on Safari 17.3 in iOS 17.3, and I noticed the same color issue. Here's a comparison of the correct and incorrect colors:

So, any idea what's causing this? --JAAqqO (talk) 17:02, 10 February 2024 (UTC)


 * I'm able to reproduce this bug in desktop Safari; as I make the page smaller, at some point the two dark blue divs that cover the right and bottom halves of the pie chart disappear. It's the same point that the table above the chart in the previous section starts to overflow its container. (1 2). On its surface, feels like maybe a Safari rendering bug, but haven't figured it out any further yet. —&#8239; The Earwig (talk) 22:52, 18 February 2024 (UTC)
 * @JAAqqO: I've made a small tweak, a bit ugly, that should fix this. —&#8239; The Earwig (talk) 00:06, 19 February 2024 (UTC)


 * Yes, that fixed it. Thank you. --JAAqqO (talk) 12:58, 19 February 2024 (UTC)

Default label placement on Pie chart
Why do have label placement on the bottom by default? Can't it be move to left or right?

Exotica24 (talk) 19:30, 28 April 2024 (UTC)
 * You might want to try Template:Piechart. -- Red rose64 &#x1f339; (talk) 22:26, 28 April 2024 (UTC)