Template talk:Television ratings graph

Suggestions
I have modified the table found at Game of Thrones ratings to provide an example of the changes i am suggesting. I am not a template editor so i would like to ask 's and 's opinions on the following:
 * 1) Get rid of the "Ep." abbreviations by creating an "Episodes" header, as seen in other templates for series with more episodes per season (example Seinfeld ratings).
 * 2) Put the references inside the table, as seen in other tables (example award tables) and get rid of the text "Source: Nielsen Media Research [references]" below the table.
 * 3) Properly highlight the average ratings, as the italic text is confusing.
 * 4) It would also be good for readability purposes if we could add 1em left and right padding in the table headers.

One more suggestion for the graph. The default width should be calculated so that there is a 2px space between the bars. I have found through testing that the four following cases are true, when X is the total total number of episodes (including TBD ratings):
 * 1) If X is between 001 and 019, then the width should be equal to X*13+98
 * 2) If X is between 020 and 049, then the width should be equal to X*12+98
 * 3) If X is between 050 and 079, then the width should be equal to X*11+98
 * 4) If X is between 080 and 150, then the width should be equal to X*10+98

For example, a total of 67 episodes of Game of Thrones have aired, so according to case #3 the width of the graph, in order to have 2px space between the bars, should be 67*11+98 = 737+98 = 835. Case #4 stops at 150 episodes (1598px), because X=151 exceeds the width limit, currently set at 1600px. - Radiphus  15:12, 29 January 2018 (UTC)
 * Good suggestions; I'll look into it for you. --  Alex TW 17:44, 29 January 2018 (UTC)

Update: I have implemented some of these changes myself. I will wait for the ongoing discussion at WP:TV to conclude and then i 'll look for more ways to improve this template. - Radiphus  10:34, 17 August 2018 (UTC)

Mobile view problem
Today i realized that the pictorial graph does not appear in mobile view (see example: Rick and Morty ratings). I believe this is caused by a bug with EasyTimeline (see report: Phabricator). I am bringing this to your attention as i am hoping that some of you might be able to understand what this is about and perhaps figure out a solution so that this problem will not affect the template. Radiphus (talk) 19:08, 18 February 2019 (UTC)

Hyphen separator issue
The hyphen separator messes up with the editor, which causes the code coming after this template to be annoying to work with, as the editor thinks the ratings template isn't closed. Line 189 is where the code checks for, to support backwards compatibility, this should stay, but another option should be given, one that the editor can work with. Any recommendations on which it should be? --Gonnym (talk) 09:47, 2 June 2019 (UTC)

Problem
Please see Factor X (Portuguese TV series) which is currently showing "Lua error in Module:Television_ratings_graph at line 152: attempt to concatenate field '?' (a nil value)." I'm hoping you can fix either the article or the module. Johnuniq (talk) 02:25, 11 October 2019 (UTC)
 * , on it! -- / Alex /21  02:27, 11 October 2019 (UTC)
 * , ✅ The primary issue was in the article; it was that the template was using "–" (an en dash) instead of "-" (a hyphen). -- / Alex /21  02:34, 11 October 2019 (UTC)
 * Thanks. Johnuniq (talk) 02:40, 11 October 2019 (UTC)

Citation needed
This template applies citation needed without any way to specify a date to that template, which causes the article to be placed into Category:Articles with unsourced statements rather than an appropriate dated subcategory. Please fix. Thanks. Anomie⚔ 12:05, 24 October 2019 (UTC)
 * Ping Alex 21, who seems to maintain this template. Anomie⚔ 12:06, 24 October 2019 (UTC)
 * , done. -- / Alex /21  13:51, 24 October 2019 (UTC)
 * Thanks, although having it always use the current date somewhat defeats the purpose. There should be a parameter to the template, which I can have AnomieBOT add. Anomie⚔ 22:49, 26 October 2019 (UTC)

Issue with n/a entries
I was trying to edit the ratings graph for Breaking Bad and I noticed whenever I added "n/a" for episodes where ratings info is unavailable, it would remove entries from the end of the ratings graph. For example, there is 5 episodes in season 2 with no ratings info, so when I enter "n/a" instead of leaving it blank (as "TBD" is incorrect in this instance), there would only be 57 episodes displayed in the graph instead of all 62 episodes. What's the issue here? Thanks. Drovethrughosts (talk) 20:52, 13 March 2020 (UTC)
 * Hey, any chance you know what's going on here? I'm wondering if this is just an issue with Template:N/a. Do you have any insight? Thanks. Other examples are List of Hannibal episodes–one episode uses "n/a" for rating so the graph just shows 38 episodes not all 39 and List of Fargo episodes–when you leave the start and end date blank for season 4, the row for season 4 disappears. Drovethrughosts (talk) 12:18, 11 April 2020 (UTC)
 * , thanks for the ping; I've been on an editing hiatus until recently. I appear to have fixed the issue: "n/a" values just weren't being counted as actual entries, now they are. As for the Fargo issue, that's a Series overview issue - rows are only added when a start date is defined, so I've added to start4 to show the row. Cheers. -- / Alex /21  12:34, 11 April 2020 (UTC)
 * Thanks so much for the quick response and fix! Very much appreciated! Drovethrughosts (talk) 12:39, 11 April 2020 (UTC)

Change needed to conform with MOS:US
For MOS:US to be achievable (consistency within articles), the section of the script currently:


 * if args.country ~= nil and args.country ~= '' then
 * if args.country == "U.S." or args.country == "US" or args.country == "United States" then countryDisplayUS = 'U.S.'
 * elseif args.country == "U.K." or args.country == "UK" or args.country == "United Kingdom" then countryDisplayUK = 'UK'
 * else countryDisplayOther = args.country
 * end

needs amending to:

if args.country ~= nil and args.country ~= '' then
 * if args.country == "U.S." or args.country == "United States" then countryDisplayUS = 'U.S.'
 * elseif args.country == "US" then countryDisplayUS = 'US'
 * elseif args.country == "U.K." or args.country == "UK" or args.country == "United Kingdom" then countryDisplayUK = 'UK'
 * else countryDisplayOther = args.country
 * end

(the third line included simply for clarity)

Or maybe another country display type is needed here?

MapReader (talk) 08:45, 13 June 2020 (UTC)

Fix the rating
In the ratings table here, the y-axis shows up weirdly since all of the viewers per episode are almost equal,. I get three 0s, five 1s, five 2s, and one 3. Also can we get the option of not choosing a color if it is a 1 season series, having a default color show up and no color box next to season 1. CherryPie94 &#x1F352;&#x1f967; (talk) 20:58, 23 August 2020 (UTC)
 * , Working on it for you. Thanks for the post. -- / Alex /21  04:08, 24 August 2020 (UTC)
 * , thank you so much. I noticed another issue. In the table below, the viewership numbers are only available for seasons 2 because Nielsen did not provide the numbers until January 2018 in South Korea; so no data for season 1. The color I chose for season 2 doesn't show up on the graph, instead I get season 1's color. This needs fixing. CherryPie94  &#x1F352;&#x1f967; (talk) 18:21, 25 August 2020 (UTC)


 * , I had to file a report at Template talk:Graph:Chart, which was fixed at the graph module, and I added your initial default colour request. Taking a look at your second post. -- / Alex /21  23:50, 1 September 2020 (UTC)


 * , thank you so much and I'm sorry for asking too much, but can we name the seasons? It would be the best in the cases of long series, for example, When the_Camellia Blooms has 40 episodes and the table is very long stretching out of the page. If we could instead of having season 1, 2, 3, have the ability to renamed them to Ep.1-10 and then Ep.11-20, etc. it would really help. Maybe have the default be 1, 2, 3, but have parameters for season name if they don't want it 1, 2, 3. It would help in the table above, instead of having season 1 all empty, we can have it start from season 2 if we rename it. CherryPie94  &#x1F352;&#x1f967; (talk) 10:45, 2 September 2020 (UTC)
 * , no worries, happy to help! And luckily, that's already a thing: see List of Teen Wolf episodes. -- / Alex /21  11:01, 2 September 2020 (UTC)


 * , I was in the middle of making updates for the empty season row, but then I thought, why not just present the graph this way? There's no need for the Season 1 row at all. -- / Alex /21  02:13, 7 September 2020 (UTC)


 * Yes, I did when you told me I could do that in your last reply. CherryPie94  &#x1F352;&#x1f967; (talk) 11:27, 7 September 2020 (UTC)
 * , ah, okay, my apologies. I've only just come to realize that the missing season and the split season are basically the same situation. -- / Alex /21  13:32, 7 September 2020 (UTC)

Full stop
According to Featured list candidates/List of The Good Place episodes/archive1, "Audience measurement performed by Nielsen Media Research" is not a full sentence, therefore the full stop should be removed. Would this be able to be done? Thanks. Pamzeis (talk) 07:43, 19 May 2021 (UTC)
 * I removed the periods. Heartfox (talk) 15:40, 27 May 2021 (UTC)

Missing barlines
, I was creating a new table for Omniscient Interfering View and notice that there are 2 bar lines missing for the column Ep. 25 — 34 as it suppose to have 10 bars, not 8 bars, ie the last column always have missing 2 bar lines. I have the same problem for the subsequent charts for 2019 and 2020. I hope that this can be fixed. Thanks. Flipchip73 (talk) 13:27, 15 August 2021 (UTC)


 * Removed the averages, problem fixed. Averages are only meant to be used for rows when a full row represents a full season, else "skipping" them results in issues with displaying further episodes (like here). -- / Alex /21  14:00, 15 August 2021 (UTC)


 * , Ok. I guess this is the only workaround. Thanks. Flipchip73 (talk) 14:35, 15 August 2021 (UTC)

Special episodes that are stand-alone and not part of preceding or following series/season
It looks like the above is only possible by using the parameter number of the following series e.g. a special episode after series 6 would have to be coded as, even though it isn't series 7. That would lead to series 7 having to be coded as. If there's then another special followed by a series, the special would be  and series 8 would have to be coded as  Could the template be changed to handle special episodes like Series overview does? - X201 (talk) 10:46, 3 March 2022 (UTC)

Accessibility Issues
Hi, I currently have an episode list at WP:FLC. A reviewer brought up the fact that this template isn't screen reader friendly because "a few of the header cells" are missing scopes. I'm not fluent in LUA, is this something that can be easily fixed? The Doctor Who (talk) 20:02, 15 June 2024 (UTC)


 * The issue in this template has been . -MPGuy2824 (talk) 06:31, 24 June 2024 (UTC)