Jump to content

Wikipedia talk:Graphs and charts

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Misleading stacked vertical bar graph is generating for the correct data

[edit]

Hi,

I believe there is some kind of issue/bug in the stacked vertical bar graph on Wikipedia.

Refer to below data, I can confirm that all the values are in % & correct. All the values are summing up to 100%. Still not all stacks are reaching to 100%. See the stacks for 1999, 2004, 2009 & 2019 years in the chart. If you can't see them with naked eyes then Zoom-in the webpage, you will see the difference in the mentioned stacks.

{{#invoke:Chart | bar-chart
| height = 360
| width = 850
| stack = 1
| group 1 = 43.11 : 34.86 : 27.42 : 26.6 : 38.96 : 19.73 : 40.42 : 63.84 : 29.37 : 16.13 : 2.69 : 1.57 : 6.7 : 15.68 : 16.48 : 2.78 : 0
| group 2 = 0 : 0 : 0 : 0 : 0 : 0 : 0 : 5.52 : 0 : 30.86 : 17.01 : 0 : 0 : 37.75 : 50.09 : 52.06 : 59.38
| group 3 = 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 13.08 : 7.86 : 22.58 : 14.08 : 22.83 : 37.83
| group 4 = 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 3.64 : 13.42 : 25.6 : 25.88 : 17.91 : 13.44 : 18.68 : 0
| group 5 = 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 57.34 : 11.0 : 59.83 : 2.23 : 0 : 0 : 0 : 0 : 0.14
| group 6 = 0 : 0 : 0 : 0 : 0 : 71.32 : 25.34 : 0 : 0 : 29.4 : 0 : 0 : 0 : 0 : 0 : 0 : 0
| group 7 = 0 : 14.60 : 18.88 : 24.26 : 19.1 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0
| group 8 = 0 : 50.54 : 29.62 : 28.24 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0
| group 9 = 22.58 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0
| group 10 = 13.24 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0
| group 11 = 0 : 0 : 18.12 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0
| group 12 = 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0.57 : 0.47 : 0 : 1.74 : 0.43 : 0.36 : 0
| group 13 = 0 : 0 : 5.96 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0
| group 14 = 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0 : 0.5 : 0
| group 15 = 21.07 : 0 : 0 : 20.9 : 41.94 : 8.95 : 34.24 : 30.64 : 13.29 : 08.75 : 6.48 : 58.05 : 59.56 : 4.54 : 5.48 : 3.65 : 2.65
| colors = {{party colour|Indian National Congress}} : {{party color|Bharatiya Janata Party}} : {{party color|Samajwadi Party}} : {{party color|Bahujan Samaj Party}} : {{party color|Janata Dal}} : {{party color|Janata Party}} : yellow : {{party color|Praja Socialist Party}} : maroon : black : purple : brown : gold : {{party color|Aam Aadmi Party}} : Gray
| group names = [[Indian National Congress|INC]] : [[Bharatiya Janata Party|BJP]] : [[Samajwadi Party|SP]] : [[Bahujan Samaj Party|BSP]] : [[Janata Dal|JD]] : [[Janata Party|JP]] : [[Bharatiya Jana Sangh|ABJS]] : [[Praja Socialist Party|PSP]] : [[Socialist Party|SLP]] : [[Kisan Mazdoor Praja Party|KMPP]] : [[Communist Party of India|CPI]] : [[Communist Party of India (Marxist–Leninist) Liberation|CPI-ML]] : [[Akhil Bharat Hindu Mahasabha|ABHM]] : [[Aam Aadmi Party|AAP]] : Independents
| units suffix = %
| x legends = 1952 : 1957 : 1962 : 1967 : 1971 : 1977 : 1980 : 1984 : 1989 : 1991 : 1996 : 1998 : 1999 : 2004 : 2009 : 2014 : 2019 
}}

See the chart below-

25
50
75
100
125
150
1952
1957
1962
1967
1971
1977
1980
1984
1989
1991
1996
1998
1999
2004
2009
2014
2019

PyneEditor (talk) 03:38, 26 April 2024 (UTC)[reply]

It could be a typical computer problem, not a chart problem. For computers decimal decimals are tricky things in a binary system, which leads to Round-off_errors.
One way to find out:
  • avoid decimals, multiply all your numbers by 100
  • does it now all add up to to 10,000?
Uwappa (talk) 19:13, 3 November 2024 (UTC)[reply]
This happens when summing fractions after rounding. A more extreme example is 160 categories, each accounting for 0.625% of the total. Rounded to 1%, their sum is 160%. In contrast, 80 categories of 1.25%, when rounded to 1% sum to only 80%. cmɢʟeeτaʟκ 01:47, 7 November 2024 (UTC)[reply]
There is no rounding error in the data of PyneEditor.
This is probably a general computer problem, the binary way of dealing with decimals, converting them to a2 + b4 + c8 + d16 + ... where a, b, c, d, ... can only be 0 or 1.
  • 0.5 is easy, that is 12. 0.5 in binary is 0.1.
  • 0.6 is impossible, that is 0.100110011001... (with 1001 repeating).
Uwappa (talk) 03:54, 7 November 2024 (UTC)[reply]

The Bar Box is not displayed on Wikipedia mobile app, but shown on web.

[edit]

The 'bar box' are showing on Wikipedia Web, but not visible on Wikipedia mobile app.

Any Specific reason?

Shouldn't it be blocked at both places or allowed at both places? PyneEditor (talk) 03:48, 26 April 2024 (UTC)[reply]

Progress?

[edit]

I've got an idea for a tool that would need charting and I'm trying to figure out how to proceed. I've read what's on phab and mw:Extension talk:Graph/Plans and have come away with the impression that there's no concrete plan to implement this. At least nothing with any kind of time estimate and thus I should be looking elsewhere for ways to implement the charting functionality. Is that a fair summary of the state of things? RoySmith (talk) 16:17, 3 November 2024 (UTC)[reply]

You may want to contact user:Cmglee for a tailored graph. For me, working with Cmglee was an absolute blast, brilliant fellow, speaks fluent SVG. Uwappa (talk) 19:03, 3 November 2024 (UTC)[reply]
Thanks for the compliment, but I won't have the time and resources to make graphs full-time.
Until the Graph extension is operational, may I recommend generating graphs with GNU Octave (free software compatible with MATLAB), exporting in SVG format, and uploading as standalone SVG files?
Does anyone know of an offline tool that converts Graph extension format to SVG directly?
Cheers, cmɢʟeeτaʟκ 17:16, 5 November 2024 (UTC)[reply]
Uwappa (talk) 03:45, 7 November 2024 (UTC)[reply]
I agree with the importance of supporting graphs and charts, especially for an encyclopedia. I don't know the WikiMedia tech stack, so I can only speak as a user. I see how GitHub handles this with Mermaid support in their pages, and that has been a boon for projects I work on there: It seems security concerns might be a non-issue with a restricted Mermaid execution environment, but needs developer work following this example. 99.8.218.249 (talk) 19:07, 6 February 2025 (UTC)[reply]

Microsoft Excel spreadsheets that automatically generate XML code for SVG charts

[edit]

My spreadsheets are not commercially viable products (they're totally text based), but they can quickly generate the basic SVG code for charts and are useful in many situations.

General concept above; examples below.
Warming stripes
(five examples compared)
... in a shape
Warming stripes bar chart
Bar chart
Pie chart
Variable-width bar chart
Line charts
Scatterplot
Radar chart

I've uploaded spreadsheets that automatically generate XML code for charts in SVG format.

Summary: You simply paste or enter your data into the spreadsheet, and specify image dimensions, number of grid lines, data ranges, font sizes, etc. The spreadsheets instantly and automatically generate a column of XML code. You simply copy and paste that code into a text editor and save as an ".svg" file. The spreadsheets produce lean SVG code, and should save you time in creating SVG charts. Though my original spreadsheets are written in Microsoft Excel, I've received reports that they also work if read into other spreadsheet programs.

Feedback and suggestions on my talk page are welcome. RCraig09 (talk) 23:41, 19 February 2021 (UTC)[reply]

Click HOW TO for detailed explanation.
Click HERE (else HERE) to download the spreadsheets.
Click here to see an example of how the spreadsheets work, internally.
  1. Warming stripes — Accepts a single dataset and converts to SVG code portraying Ed Hawkins' warming stripes graphics. User chooses vertical or horizontal stripes; normal or reverse data ordering; or from a variety of geometric shapes (updated 17 May 2023). . . . . Click here to see examples of warming stripes embedded in different shapes.
  2. Warming stripes bar chart — Accepts a single dataset and creates a conventional bar chart whose individual bars/columns are coloured according to Dr. Hawkins' warming stripes colour scheme. Alternate option: choose one colour for ascending bars and another colour for descending bars. (updated 28 August 2023)
  3. Line charts — Accepts up to six datasets. (updated 30 August 2023)
  4. Vertical bar charts (column charts) — Accepts up to six datasets. Toggle between clustered and stacked charts; user can adjust "Yfloor"—the Y level (usually=0) from which columns rise or fall; user chooses to keep or ignore negative input values. (updated 27 August 2023)
  5. Horizontal bar charts — Accepts up to six datasets. Toggle between clustered and stacked charts; user can adjust "Yfloor"—the value (usually=0) from which bars extend; user chooses to keep or ignore negative input values. (updated 27 August 2023)
  6. Scatter plots — Accepts up to five datasets. (updated 28 August 2023)
  7. Pie charts — Accepts a single dataset of up to 36 items. (updated 17 May 2023)
  8. Variable-width bar charts — Accepts up to six datasets; is like "Vertical bar charts", above, but user can choose different widths for different bars. (updated 27 August 2023)
  9. Radar charts — Accepts up to six datasets. (updated 6 May 2025)

RCraig09 (talk) 00:45, 11 November 2024 (UTC)[reply]

RCraig09. Thanks for your work. Can I use freeware Libreoffice Calc with these spreadsheets. I know Calc can read the .xlsx files:
https://drive.google.com/drive/folders/1edEeBNX55Eh1a8hSmzfmX9w7tbMx2uOz
But will using the files in Calc produce the desired result?
--Timeshifter (talk) 13:39, 11 November 2024 (UTC)[reply]
@Timeshifter: I don't know if the functionality of the Excel spreadsheet will translate. I remember that Excel's naming specific cells did not translate into Openoffice's spreadsheet, but I don't know if that exploded functionality. Since the spreadsheets have sample data already, you could simply download the specific spreadsheet(s) and see if they work in another spreadsheet program. —RCraig09 (talk) 18:11, 11 November 2024 (UTC)[reply]
@RCraig09: I downloaded this file:
LINE SVG v3.2 20230909 from Excel.xlsx
I opened it in LibreOffice Calc.
Copied the blue column to Notepad++
Changed extension to .svg
I opened it in Firefox, and I see a multi-line graph.
It is not exactly the same as this:
File:20200324 Global average temperature - NASA-GISS HadCrut NOAA Japan BerkeleyE.svg
Could you please install LibreOffice, and have a look yourself?:
https://www.libreoffice.org/download/download-libreoffice
I always install the latest stable version. --Timeshifter (talk) 21:47, 14 November 2024 (UTC)[reply]
@Timeshifter: I installed LibreOffice 24.8.3.2 and read the same Excel file. Visually, it renders exactly the same in Chrome 131.0.6778.86 as through Excel. I also get identical renderings in Firefox 128.4.0esr 64-bit. Is there a problem on your system? —RCraig09 (talk) 05:14, 24 November 2024 (UTC)[reply]
Oh, I see now! Wikimedia Commons is an updated version over the Excel file that you downloaded. I manually made changes to the svg file after pasting from the spreadsheet so it would be more presentable current. They should not be the same. —05:19, 24 November 2024 updated —RCraig09 (talk) 16:19, 24 November 2024 (UTC)[reply]

RCraig09. Thanks. I don't have the time or expertise to experiment with your spreadsheets in LibreOffice Calc. But I want to use them. So maybe you can add an "Approved for LibreOffice Calc" to each spreadsheet you have tested.

Also, which browser and OS you used. Does this matter? I ask, because it matters with the map template. It requires Firefox:

--Timeshifter (talk) 08:17, 24 November 2024 (UTC)[reply]

@Timeshifter: I will not be attempting the gargantuan task of stress-testing eight complex spreadsheets to be "approved" for other spreadsheet programs. I don't know of any browser- or OS-specific issues, but there are no guarantees. Separately, the "map" template you link above, is a completely different animal. —RCraig09 (talk) 16:19, 24 November 2024 (UTC)[reply]
@RCraig09: I just want to know if a particular preset spreadsheet gets the same results in both Excel and Libreoffice Calc. I haven't paid for Excel, and so I can't do this. I assume that if it works with the preset values in the spreadsheet, then the spreadsheet will work with values I substitute. Calc can read .xlsx files, and it can save in .xlsx, and so I am hoping this works. Because that allows more people to create these SVG files.
I'll take whatever test results you have time to do. And I will help tell others about this. LibreOffice Calc is the most popular freeware spreadsheet program as far as I know.
I am happy to hear that it is not browser or OS dependent. --Timeshifter (talk) 01:09, 25 November 2024 (UTC)[reply]
@Timeshifter: I don't know of any browser- or OS-specific issues; the only issues I can imagine would be if Calc somehow didn't understand a particular reference within the Excel sheet (like Excel's giving a particular cell a specific name). I haven't stress-tested in Calc, but the example we've talked about above is encouraging. Entering/pasting values into an xlsx file that's read into Libreoffice Calc (substituting for the "dummy" values that I've put into the xlsx files) and then pasting to an .svg file, will instantly let a person know if the SVG image results are basically as intended. Experimenting with dimensions, font size, grid lines, tick labels, etc. would be a Herculean task and I can't foresee my doing that since there has been little interest from others in using something that's text based and not a commercial-level product. —RCraig09 (talk) 01:51, 25 November 2024 (UTC)[reply]
I should add: there has been an ongoing problem within Wikimedia projects for some renderings involving text. It doesn't involve browsers or OSs. And my basic spreadsheets don't encounter those problems if you don't enhance the svg code manually, to insert bold or italic etc subsets of text strings. —RCraig09 (talk) 01:57, 25 November 2024 (UTC)[reply]

Charts on mobile view not work properly

[edit]

Hi, on mobile articles with charts are stuck and don't work as they should. This one for example: https://en.wikipedia.org/wiki/List_of_Falcon_9_and_Falcon_Heavy_launches

You can view charts continuing to shift the entire article instead of being inside a box Briskola (talk) 08:32, 7 March 2025 (UTC)[reply]