Show last authors
1 Spec:
2
3 Consolidate Chart.js and/or D3 macros into an easy to use macro that functions and feels like MediaWiki's Graph tool. A few basic chart types should be provided "pre-configured" but should also serve as a tool to allow users to leverage the full capability of these libraries (i.e. expose the code and allow editing). Secondary feature: ability to copy paste excel cells into step 2 of the wizard. Not necessarily printable but definitely exportable to PDF
4
5 Analysis & Cost
6
7 * (option) Modify PDF export feature to use client-side HTML(+CSS) DOM - 8d
8 ** Inject Export button from JS (JSX)
9 ** Take images for Canvas since it's not in the DOM
10 ** Send client-side HTML to XWiki Export Action
11 ** Need to handle protection as otherwise any arbitrary HTML could be sent to XWiki to transform into PDF
12 ** Modify XWiki Export Action to use this HTML instead of rendering from the document
13 ** Inline CSS within the HTML (for ex with https://www.npmjs.com/package/inline-css)
14 * (option) Handle multi page exports (spaces or wiki) - 3d
15 ** Provide a JS-based UI to select the pages to export
16 ** Use a hidden frame to load all the pages to export and get the HTML/CSS to send back
17
18 * Implement a simple generic wizard that can work for all chart macros (~{~{chart}}, ~{~{chartjs}}, ~{~{d3js}} or any future ones)
19 ** Have something like the old XWiki Charting Plugin wizard (https://extensions.xwiki.org/xwiki/bin/view/Extension/Charting%20Plugin) or the MW wizard (https://www.mediawiki.org/wiki/Extension:Graph/Demo)
20 * Have the concept of Chart Templates, i.e. a script that generates the graph macro applied with wizard variables bound in the script context.
21 * Ability to add/remove/edit chart templates in the Admin UI - 3d
22 ** Note: a chart template is very generic and specifies the macro it uses to generate the chart at runtime
23 ** XClass so that chart extensions can contribute new chart templates.
24 * Provide a wizard with several tabs or steps
25 ** Tab 1: select the chart template + basic parameters such as size, padding, etc - 5d
26 *** Filterable template picker, each template has at least a description + type of chart
27 *** Show a preview based on demo data
28 ** Tab 2: source. 2 main sources: spreadsheet like and a reference to a table in a wiki page somewhere (document reference + HTML id attribute for ex). - 2d
29 *** Demo data
30 *** + Ability add lines and columns (ideally constrained by the chart type)
31 ** Tab 3: raw data (depends on first step) - 0.5d
32 *** displays the chart template applied to entered variables and allow the user to make changes.
33 * Introduce a new ~{~{chartwizard}} macro - 3d
34 ** Saves the chart wizard data (all fields), either as parameters or in the macro content
35 ** Note: also save the raw data IF the user has made modification to it
36 ** Note: the chart template used is also saved with its id
37 ** At view time the ~{~{chartwizard}} macro applies the chart template with the provided data. If raw data has been provided by the user then use it instead of rendering the chart template.
38 ** This allows customization by users if needed while allowing generated graphs to look the same across the wiki for the nominal case
39 * Add a WYSIWYG icon for starting the chart wizard - 0.5d
40 * When double clicking the ~{~{chartwizard}} in the WYSIWYG editor, call the chart wizard UI - 0.5d
41 ** Note that this should reuse the mechanism defined in SR2 (Citations) for binding a macro to a vm
42 * (option) Ability to copy paste excel cells in step/tab 2 of the wizard - 2d
43 ** Need HTML cleanup (similar to office import)
44 * (option) Have a blacklist of macros in the WYSIWYG Macro Dialog list - 0.5 day
45 ** To allow removing the ~{~{chartjs}} macro from being listed to force users to use the chart wizard
46
47 Total Cost:
48
49 * Main work: 14.5 days
50 * All options: 13.5 days
51
52 Unresolved questions:
53
54 * Do charts need to be printable? If so then hard with JS-based solutions such as ChartJS or DSJS. Note that this is why our ~{~{chart}} macro is based on JFreeChart.
55 * Need minimal list of chart types and options in the wizard (or same as MW?)
56 * Not sure we can parse the full syntax from chart macros and not loose data when serializing back. Would that be acceptable?
57 * Is it really needed to be able to edit a generated graph? This makes it a lot more complex.

Get Connected