Jump to content

User:Nux/pie chart - todo

From Wikipedia, the free encyclopedia
[edit]
Wiki Type Link
enwiki css Template:Pie chart/styles.cssTemplate:Pie chart/sandbox/styles.cssdiff
tpl Template:Pie chartTemplate:Pie chart/sandboxdiff
mod Module:PiechartModule:Piechart/sandboxdiff
cases Template:Pie chart/testcases
plwiki css Template:Piechart/style.css (edycjahistoriaostatnia edycja)
tpl Template:Piechart (edycjahistoriaostatnia edycja)
mod Moduł:Piechart (edycjahistoriaostatnia edycja)
cases/tests Moduł:Piechart/test (edycjahistoriaostatnia edycja)

Tracing

[edit]

below 100 + 0.2below 100 + 0.4below 100 + 0.6below 100 + 0.8below 100 + 1.0below 100 + 1.5below 100 + 2.0below 100 + 2.5below 100 + 3.0below 100 + 3.5below 100 + 4.0below 100 + 4.5below 100 + 5.0below 100 + 5.5below 100 + 6.0below 100 + 6.5below 100 + 7.0below 100 + 7.5below 100 + 8.0below 100 + 8.5below 100 + 9.0below 100 + 9.5below 100 + 10.0

Pie chart 1.0

[edit]

Pie chart for pl.wiki and later for en.wiki.

PoC and some helpers: https://github.com/Eccenux/css-piechart

TODO / features:

  1. ✅ basic 2-element pie chart
    1. read json
    2. calculate value with -1
    3. generate html
    4. new css + tests
    5. provide dumb labels (just v%)
  2. ✅ colors in json
  3. ✅ 1st value >= 50%
  4. ✅ custom labels support
  5. ✅ pie size from 'meta' param (options json)
  6. ✅ pl formatting for numbers?
  7. ✅ support undefined value (instead of -1)
  8. ✅ undefined in any order
  9. ✅ scale values to 100% (autoscale)
  10. ✅ order values clockwise (not left/right)
  11. ✅ multi-cut pie
  12. ✅ sanitize user values
  13. ✅ auto colors
  14. ✅ function to get color by number (for custom legend)
  15. ✅ remember and show autoscaled data
  16. ✅ generate a legend
  17. ✅ simple legend positioning by (flex-)direction

Pie chart 2.0

[edit]

Integration with en:Template:Pie chart. Support for enumerated template parameters (i.e. value1..n, label1..n, color1..n).

Merge Talk: https://en.wikipedia.org/wiki/Wikipedia:Templates_for_discussion/Log/2025_January_30#c-Rjjiii-20250215200500-Nux-20250215163400

  1. ✅Support templates in colors
    1. ✅Example for PoC Template:Sandbox/Nux/enumParams/test
    2. ✅Prototype/PoC Module:Sandbox/Nux
    3. ✅Implement in sandbox.
  2. ✅Support both JSON and enum-params.
  3. ✅Proper support for other (compatibility, but without a formatting bug).
  4. ✅Remove {{Piechart/sandbox}} call and just invoke the module directly.
  5. ✅Allow passing custom meta JSON.
  6. ✅Replace Template:Pie chart/sandbox for easier testing and stuff...
  7. ✅Add more test cases
    1. ✅Remove Template:Pie chart/sandbox2 from cases
    2. ✅Side-by-side view of test cases (flex = shorter)
    3. ✅Simple cases for {{{thumb}}} param
    4. ✅Footer (expected not to be supported by sandbox template yet)
    5. ✅Numbers that are over 100 (autoscale; expected not to be supported by current template yet)
  8. ✅Re-think colors
  9. ✅Support numbers over 100
    1. ✅calculate sum before settings labels (sum > 100 => autoscale)
    2. ✅sum > 100 => use $v in labels
    3. ✅support setting $v in label1..n params
  10. ✅generate meta-JSON from classic params (similar function to parseEnumParams)
  11. ✅Support {{{footer}}}; used in e.g.:
  12. ✅Re-integrate with plwiki.
  13. ✅Finalize?
    1. ✅Replace Module:Piechart code with its sandbox.
    2. ✅Replace Template:Piechart code with its sandbox.
    3. ✅Docs update?
    4. ✅Merge
      1. Template:Piechart/sandbox/styles.cssTemplate:Piechart/styles.css (diff)
      2. Template:Pie chart/sandboxTemplate:Pie chart (+ Piechart/styles.css) (diff)
      3. ✅→ Template:Pie chart/styles.css (diff)
      4. Template:Pie chart (+ Pie chart/styles.css)
    5. (?) ✅Redirect Template:Piechart to Template:Pie chart

Hopes and dreams

[edit]
  1. legend2: customization
    1. (?) itemTpl support
      1. replace default item with tpl
      2. can I / should I sanitize it?
      3. support for $v, $d, $p
    2. (?) custom head
  2. (?) validation of input
    1. check if required values are present
    2. message showing whole entry, when entry is invalid
    3. pre-sanitize values?
    4. sane info when JSON fails? Maybe dump JSON and show example with quotes-n-all...
  3. (?) option to sort entries by value