Module talk:Charts SVG
Background
[edit]This module was inspired by Template:SVG_Chart, which I thought I would Luafy, in order that I could understand both template structure and Lua. (I did not know that the original authors of that template has already begun their own luafication.) However this module has grown, and changed almost beyond recognition, though those familiar with that original will recognise some things in the structure. There are also some legacy parameters from SVG Charts that have little if any purpose now.
One important difference is that, once I decided to expand the available chart types beyond scatter/line, I abandoned the requirement that the data values in the SVG be the original data values supplied in the parameters. This led to considerable simplification of the code, and removal of the adjustments required (especially to text elements and line widths) for small data-value ranges.
To-Do
[edit]- complete the data-checking of the parameters
- for pie charts, add options to (a) specify a different start angle, and (b) specify a sweep direction
- Done. Parameters PieStartAngle and PieSweepDir added Innesw (talk) 11:51, 18 October 2016 (UTC)
- allow colors to be numbers in the colors table, and not have to be SVG color terms
- Done. Parameters for colors call checkColor() as they are transferred to the Parms[] table. Innesw (talk) 09:46, 27 March 2014 (UTC)
- stack negative Y values separately from positive
- Done. Also moved Total table from a 'global' to a local in calcStack Innesw (talk) 22:40, 25 March 2014 (UTC)
- the markers and fill patterns may be able to be entries in tables, rather than built programmatically. It makes doChecks() a bit simpler, but I'm not sure it's worth the trouble.
Colors
[edit]I'm open to suggestions on the default colors table. It was originally designed to (a) give good contrast between adjoining colors, (b) avoid adjacent reds and greens (for the R/G color-blind), and (c) when converted to grayscale, keep the contrast between adjoining 'colors'.
Flipped bar chart
[edit]Is there any way to flip a bar chart, so that they're horizontal instead of vertical columns? I'm looking to reproduce the below chart in SVG format. When ranking items, this is preferable to column charts, which suggest a quantitative x-axis (often time).
- I'll investigate the possibility of horizontal bar charts, at first thought it should not be too hard - but we will see!
- Have now made changes to allow horizontal bar charts. It was not nearly as straightforward as I had hoped. There are some other changes to parameters as well. Innesw (talk) 07:02, 3 May 2018 (UTC)