Template talk:Composition bar

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
WikiProject iconElections and Referendums Template‑class
WikiProject iconThis template is within the scope of WikiProject Elections and Referendums, an ongoing effort to improve the quality of, expand upon and create new articles relating to elections, electoral reform and other aspects of democratic decision-making. For more information, visit our project page.
TemplateThis template does not require a rating on Wikipedia's content assessment scale.
WikiProject iconPolitics Template‑class
WikiProject iconThis template is within the scope of WikiProject Politics, a collaborative effort to improve the coverage of politics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
TemplateThis template does not require a rating on Wikipedia's content assessment scale.

Box alignment[edit]

The way I understand the problem, this template creates a line of text (of standard height) within a box, and the text within the box is positioned somewhat lower than text outside the box (to allow for space between the border of the box and the text within). The solution would be to change the box' alignment and have its top be somewhat higher than the surrounding text - enough to compensate for the space between the border of the box and the top of the text within the box. After some cursory tests, adding position:relative; top:-0.1em to the code for the box itself should resolve the issue. I'll implement that and check whether it works as intended when used within the political party infobox. Huon (talk) 17:32, 11 January 2015 (UTC)[reply]

Possibly top:-0.05em might be better, but I've left it at -0.1em for now. Huon (talk) 18:11, 11 January 2015 (UTC)[reply]
When viewed inside an info box such as at Party of the Swedes, the text is not perfectly centred top-to-bottom on my display. There's a lot more empty space at the bottom of the box than at the top. I think it's getting distorted because the line height of the template Infobox political party is 1.3 em. Therefore I am altering the template height to 1.3 em. See what you think -- Diannaa (talk) 22:43, 11 January 2015 (UTC)[reply]
why cant you restore the orginal version of before 21 december 2014? that was what i wanted to be helped by, and again this is not about party of the swedes alone many pages other pages got messed up after that, meybe its not the "/seats" template but the general infobox political party template Dannis243 (talk) 16:23, 12 January 2015 (UTC)[reply]

Nominated for deletion[edit]

Now nominated for deletion. Frietjes (talk) 18:25, 13 January 2015 (UTC)[reply]

See Template talk:Infobox political party#Layout for a discussion of proposed changes to the layout; if no one objects I'll implement them in a week or so, whether here or at {{composition bar}}. Huon (talk) 17:36, 18 January 2015 (UTC)[reply]

Color discussion[edit]

The color that appears in the bar graphs that are generated by this template and that give the upper and lower house seats in political iboxes is being discussed at Template talk:Democratic Party (United States)/meta/color, and a consensus is needed that requires a color that is WMF compliant and still meets democratic party standards. You are welcome to come and participate in the discussion. – Paine  08:53, 12 August 2015 (UTC)[reply]

Recent changes[edit]

To editor Alakzi: My first indication that changes to this template were made was on the other talk page, where the Comp bar boxes stretched across the whole page. I looked at a typical information box, and the changes there did not appear very constructive either. Did you test these changes in the sandbox? It seems to me they need more testing before they are ready to go live. And I further suggest that you come here to discuss this rather than indulging in an edit war! – Paine  11:00, 12 August 2015 (UTC)[reply]

It would be good to hear the results of your tests of the sandbox version. The results at Template:Composition bar/testcases do not seem to indicate that the changes are fully ready yet. – Paine  11:10, 12 August 2015 (UTC)[reply]
Could you please identify the issues? I don't see why the changes might not be ready. If you're referring to the border width and colour and text colour parameters, their removal was by choice; our templates aren't sponsored by Crayola. Alakzi (talk) 11:12, 12 August 2015 (UTC)[reply]
(edit conflict) Some of the bar graphs on the testcases page are going offscreen, and what's wrong with this picture?:
Democratic Party of Georgia
ChairpersonDuBose Porter
Senate leaderSteve Henson
House leaderStacey Abrams
HeadquartersAtlanta, GA
IdeologyLiberalism
Progressivism
Social liberalism
National affiliationDemocratic Party
ColorsBlue
Seats in the Upper House
18 / 56
Seats in the Lower House
60 / 180
Website
www.georgiademocrat.org
Perhaps the numbers should be below the bar graph or otherwise positioned? Other editors should be allowed to voice their opinions and concerns about these changes, Alakzi. – Paine  11:26, 12 August 2015 (UTC)[reply]
Wide bars will overrun the viewport; it is not an issue with the template, but with all wide bars. I've tested it in Firefox, Chrome, Safari and IE and see notrhing wrong with it. Could you please be more specific? Alakzi (talk) 11:34, 12 August 2015 (UTC)[reply]
Okay, I see what you mean, so the testcases do appear to be okay, and yet you haven't addressed the infobox issue, nor the vastly more important issue that other editors should be able to assess your changes before they go live. IF it were me or another editor making these changes and did so before YOU had a chance to even have a say in the matter, what would you do? – Paine  11:44, 12 August 2015 (UTC)[reply]
I'm sorry, I wasn't clear; "I've tested it in ..." was in reference to the infobox. I'd like to think that I'd have attempted to resolve any issues that might've cropped up without outright reverting an important accessibility fix. Or I might've reacted like you did - who knows? Alakzi (talk) 11:53, 12 August 2015 (UTC)[reply]
Btw, I see that you fixed the problem with the other talk page:

1.   – #3333FF – status quo background color

50 / 100
non-compliant

2.   – #34AAE0 – present background color

50 / 100
almost compliant

3.   – #49BFF5 – suggested background color

50 / 100
fully compliant

4.   – #B0CEFF – suggested background color

50 / 100
fully compliant
And I must admit that you've solved that problem with your edits. I won't object to going live and I won't revert if you choose to go live; however, I would still suggest that you be patient and wait to see how others respond to the sandbox changes. – Paine  11:51, 12 August 2015 (UTC)[reply]
The new composition bar with numbers above the bar has totally ruined the boxes use in my opinion. Not only does it look terrible, but it's also more messy and confusing to read (why would anyone want this?), particularly on "election result history" section, but also in infoboxes. Why was it even changed at all when the one we had before was very good? User2534 (talk) 10:32, 21 August 2015 (UTC)[reply]
To improve readability. And while the new way doesn't "look as cool" as before I agree, the tradeoff is that I do think the new way clearly makes the numbers more readable than burying the text inside the bar graphs like before. For example:
  • 50 / 100
  • 50 / 100
  • 50 / 100
  • 50 / 100
Definitely easier to read regardless of what bar color is chosen. Now the only issue may to figure out if the font (and fontsize) can be improved... --IJBall (contribstalk) 06:05, 23 August 2015 (UTC)[reply]
This was also discussed at some length on my talk page: User talk:Alakzi#Template:Composition bar. Alakzi (talk) 07:42, 23 August 2015 (UTC)[reply]

Colouring of bar with < 1%[edit]

I see in the page for the recent Canadian election (https://en.wikipedia.org/wiki/Canadian_federal_election,_2015#Summary_analysis) that the Green Party received 1 of 338 seats, but no strip of green appears in the Composition bar at all, even if I preview it using a width of 340 or 700 pixels. (one out of 338 is disappointing enough for them, but apparently reducing it to zero is adding insult to injury :-) I'm sorry, I'm not familiar with the deeper programming details of the Composition bar, but is it possible that the fraction 1/338 is being converted (truncated) to 0/100, resulting in the coloured bar with a width of zero? As a separate point, would it be possible to add an option to request some decimal points of precision on the percentage? (e.g., "0.3%") -LetMeLookItUp 19:19, 21 October 2015 (UTC) — Preceding unsigned comment added by LetMeLookItUp (talkcontribs)

LetMeLookItUp, I fixed the rounding of the percentage to zero, but the rendered bar width may not be visibly different from zero. Frietjes (talk) 17:23, 14 November 2015 (UTC)[reply]

Bring back the old seat bar[edit]

I was just casually looking through some Turkish politics articles, and noticed how they, like the Wikipedias in virtually all other languages, have not replaced the old seat bar with the current composition bar here on the English-language Wikipedia.

I never liked the new bar to begin with, and I think it was unnecessary to replace the old one with the current one. Why couldn't you instead just have the new one, in addition to the old one? One of the main reasons for my dislike of the new one is its inherent trait of expanding row size in tables. Just see how smooth the table in the Turkish wiki – with the old bars – looks: https://tr.wikipedia.org/wiki/2013_Kuzey_K%C4%B1br%C4%B1s_parlamento_se%C3%A7imleri

Then compare it to any table using the new bar; don't tell me they look half as good.

While I would personally prefer bringing back the old one and remove the new one entirely, I'd be happy with just having the old "infobox:political party/seats" back as an alternative, to use where it fits better.

Any thoughts?

Μαρκος Δ (talk) 11:24, 8 October 2016 (UTC)[reply]

Current version of the template is better for me than the old one but I would like only to move numbers in the bar or at least have them in one line/row because two lines/rows are not needed for most of tables that use this template (bold numbers and other old formatting is worse than current one, at least for me). --Obsuser (talk) 22:58, 12 October 2016 (UTC)[reply]
Yes, this is my main problem with it as well. Like I said, having the numbers outside the bar is my main problem with it, since it expands any cell that you put the bar in. If someone could change it, that would be great. Μαρκος Δ (talk) 18:37, 16 October 2016 (UTC)[reply]
And I think it would be useful that numbers are aligned to the right part of the bar in case we decide to move them in the bar itself (because the bar is usually less than half filled [from the left] + number alignment would be achieved in most cases [tens, hundreds etc. would align from right to left]); if numbers are moved so that we have one line but with numbers outside of the bar, it might be better to put them before / on the left side of the bar. --Obsuser (talk) 01:52, 17 October 2016 (UTC)[reply]
Four months have passed, and there have been no objections, or other responses in general. If there are still no objections by tomorrow, I will try and make the change myself. Μαρκος Δ (talk) 15:55, 12 February 2017 (UTC)[reply]

Template-protected edit request on 12 February 2017[edit]

I propose to bring back the old political party seats bar – either as a replacement of the current composition bar, or in addition to it – for practical and aesthetic reasons. The old bar looked like this. I have proposed it on the template talk page, and have only had a single reply, which was positive. Μαρκος Δ (talk) 14:59, 12 February 2017 (UTC)[reply]

Question: Recent talk notwithstanding, this would bring back the accessibility problems discussed in 2015. If cell height is the major concern, how about reducing the height of the bar instead? Matt Fitzpatrick (talk) 20:43, 12 February 2017 (UTC)[reply]
Proposal up in /sandbox (diff) (testcases). The sandbox version does not affect line height, so the inline version works again. It's also borderless, which is easier to read at small size. Do these changes look okay to everyone? Matt Fitzpatrick (talk) 21:51, 12 February 2017 (UTC)[reply]
That would definitely solve the height issue, yes, and I appreciate that you've taken the time to make that. However, my original issue with the "new" composition bar is that it replaced the old one completely, across Wikipedia. It should have just been created in addition to the old one, and not overridden it. The old bar, that I linked to, was perfectly suitable for most parties (and other purposes), whith the exception of those with extremely dark colors.
I think we have to remember that the composition bar is supposed to be a visual illustration of shares (seat shares etc.), and not just numbers. The new version, and even more so the thinner version you proposed above, weakens this. If the visual color illustration becomes too unimportant to the bar, one could just as well use plain numbers, and no template at all. Μαρκος Δ (talk) 08:12, 13 February 2017 (UTC)[reply]
Here's another try, based on the old version. Text-shadow to improve color contrast. Doesn't work in IE9 or older, though. Matt Fitzpatrick (talk) 14:43, 13 February 2017 (UTC)[reply]
That's excellent. It solves all the issues, both height, aesthetic and text contrast. Thank you! EDIT: Maybe add the darker frame/edge around it again though? If it's not too much to ask. I'm terrible with more advanced code. Μαρκος Δ (talk) 15:27, 13 February 2017 (UTC)[reply]
OK, got a border option working. Borderless by default is a matter of taste, borders look a little old-fashioned to me. But I could also make it bordered by default. Left a message at Template talk:Infobox political party#Composition bar style in case anyone there has feedback. Matt Fitzpatrick (talk) 04:48, 14 February 2017 (UTC)[reply]

I find the shadow around the numbers a bit too pronounced for my taste so I tried something else: before, after. Comments? Abjiklɐm (tɐlk) 14:16, 14 February 2017 (UTC)[reply]

I think they all look good, both the one you posted and Matt's later ones. But wouldn't it just be easier to use the original, but with a thin, black (#000) border around white (#fff) letters, to ensure maximum contrast, but nothing too disturbing to the eyes? Something like this but with a border around the letters (which I'm unable to do add – too inexperienced..), either black like I said, or the same color as the border around the entire bar? The latter is of course lighter. Μαρκος Δ (talk) 21:00, 14 February 2017 (UTC)[reply]
A 1px hard black shadow around white letters would be very similar to the 1px hard #111 shadow around #eee letters I had before. Good contrast, but jagged around the edges. I kind of like Abjiklem's approach better (and I may steal the idea for other websites!). The contrast could be increased by going from #111 with 2px blur radius to #000 with maybe a larger blur radius, like this. Matt Fitzpatrick (talk) 04:36, 15 February 2017 (UTC)[reply]
That last one looks good to me; it's comfortable to look at, smooth and with enough contrast. Though in my browser it appears as very horizontally thin/short. Is this intentional? I think it should be roughly the same length as the original, or at least longer than it is now. Personally, my only remaining issue after that would be the border, which I would still prefer to see re-implemented. Though, if you are both vehemently opposed, I'll conform to the consensus. Μαρκος Δ (talk) 16:16, 15 February 2017 (UTC)[reply]
The default appearance in the sandbox version is "auto" width — however wide it needs to be to fix the text — and no border, but both can be overriden by the same parameters as before. Matt Fitzpatrick (talk) 08:00, 18 February 2017 (UTC)[reply]
While I understand where that's coming from, I still think it should keep its old overall width in its default form, in order to guarantee the preservation of its appearance within tables and similar, where altering its width could affect other elements. Μαρκος Δ (talk) 20:34, 20 February 2017 (UTC)[reply]
OK, I looked at how the template's used, and the majority of uses seem to be in table cells, with all bars in a column expected to be equal width. So I've made the bar fill its container (width:100%) by default, which should work for uses in table cells. I'm avoiding fixed widths (width:100px or 10em, etc.) because those tend to be mobile-unfriendly. There'll be nicer ways to do widths once TemplateStyles are in. Matt Fitzpatrick (talk) 05:16, 23 February 2017 (UTC)[reply]

Comments on the 23 February 2017 edit by Matt Fitzpatrick[edit]

I do not understand the rationale behind this edit. But on functionality- and aesthetics-wise I really doubt the new composition bar is better than the old one. Firstly, the design of thick dark grey bar with bold white text is very awk and it totally steals away the attention from the other information in an article; Secondly, the number is now buried in the bar and it makes it more difficult to read the data - the most important information in the bar(!) when the height of the bar is cut half in which all the information has to be compressed into a small space; Thirdly, the the width of the bar is now not fixed by default and editor has to change to width every time and it is not user-friendly; Fourthly and most importantly, this template is used on approximately 4,900 pages and it raises wide concern if any changes are made and I think a longer discussion and broader consensus should be reached before any edit. Lmmnhn (talk) 11:22, 23 February 2017 (UTC)[reply]

I quite frankly agree. While I was the one to bring up the recent debate, the new design is not really what I had in mind. I agree with the above user on both the issue of how dark the new bar is, as well as the bar width. You just need to take a quick glance at this very article, to see that not having a fixed width is a bad idea -- they now span the entire page horizontally, and each and every one of them must be edited manually unless you add a fixed width to the template itself.
Regardless of how the new template turned out, I still firmly believe that the original design was the best one we've had. Very, very few articles are affected by the whole issue of having black letters against a dark political party color. If that issue ever arises, there's no need to use the party's official color code in every single bar. I would like to repeat my original request: keep this as the main composition bar, but bring back this as a separate one where it's fit for use. Μαρκος Δ (talk) 15:48, 23 February 2017 (UTC)[reply]
I agree, the older style was much smoother and less dull. I like Μαρκος Δ's idea of having two templates so that we could use whichever looks better for each instance. Kamalthebest (talk) 23:02, 23 February 2017 (UTC)[reply]
could someone please revert to the old template, the one just looks cheap and messy — Preceding unsigned comment added by 82.132.235.160 (talk) 00:33, 24 February 2017 (UTC)[reply]

I've reverted to the 2015 version, with the minor addition of role="img". And started a fork at Template:Composition bar compact. The 2015 version cannot do auto width, relative width, or even em width, however, fixed px width only. Fixed width may look okay on desktop, but it is an obstacle to mobile friendly design. I'd recommend checking how this template looks in tables on mobile and maybe reconsider relative width. Matt Fitzpatrick (talk) 04:51, 24 February 2017 (UTC)[reply]

Would you mind if I bring back the pre-2015 one as something like "Template:Composition bar classic" or whatever other name would suit it? Nobody ever presents any arguments against its revival here, but it's still never actually revived. Μαρκος Δ (talk) 10:20, 24 February 2017 (UTC)[reply]
That would be similar to {{composition bar compact}}, with the biggest differences being forced borders and forced fixed px width. This template sometimes appears in bordered table cells, making another border redundant. Fixed widths are mobile unfriendly. If it's just a matter of default colors or other small tweaks, why not edit {{composition bar compact}}, or call it with parameters? Matt Fitzpatrick (talk) 02:51, 25 February 2017 (UTC)[reply]
Wow, I was grouchy before my walk. Sorry about that. I'll fix up the compact version to look like how it used to be. And I thought of a way to fix the width and border problems while I was out, so don't worry about that. Matt Fitzpatrick (talk) 06:16, 25 February 2017 (UTC)[reply]
No worries. And I see you've made the edit to the compact version; it looks great! Thank you for all the effort and contributions you've made in this discussion. Μαρκος Δ (talk) 10:50, 25 February 2017 (UTC)[reply]
@Matt Fitzpatrick: Can I ask you why you added role="img" to an empty element? This role has a very explicit purpose that this use does not meet, see MDN docs. I think this edit should be reverted as this is not an image nor a group of images, and it does not have accessible label. stjn 18:59, 11 April 2024 (UTC)[reply]

New edits (AGAIN)[edit]

Can we please just revert back to the previous incarnation of this template, which has served us so well for so many years. This one not only has aesthetic flaws with the colour filling up the box starting inwards to the right, meaning that there are two, really annoying lines at the far left of the box, but also fails to serve the fundamental purpose of this template: to give a graphic representation of political party composition. Refer to the examples of the Australian Greens and how hard it has made the slight tinge of green to be seen in the first HoR seats box; also draw your attention to the current Socialist Alliance page and how it fails to show with colour any of the seats which they have won AT ALL, all due to this change. I hate to use this argument, but please, if it ain't broke, don't fix it. LeoC12 (talk) 12:32, 10 May 2017 (UTC)[reply]

Norwegian WP[edit]

Would anyone be interested in duplicating this template on Norwegian Wikipedia? The one we have is an eye sour. --Politikk (talk) 22:57, 21 December 2018 (UTC)[reply]

Bold Text[edit]

Is there a way to make the numbers bold or Italic? Micmicm (talk) 03:21, 9 November 2022 (UTC)[reply]