Wiki source code of Chart Wizard
Last modified by Vincent Massol on 2024/02/26 17:56
Show last authors
author | version | line-number | content |
---|---|---|---|
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 | {{info}} | ||
19 | This part is now being implemented with the [[Client-side PDF Export design proposal>>Proposal.PDFExport]]. | ||
20 | {{/info}} | ||
21 | |||
22 | * Implement a simple generic wizard that can work for all chart macros (~{~{chart}}, ~{~{chartjs}}, ~{~{d3js}} or any future ones) | ||
23 | ** 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) | ||
24 | * Have the concept of Chart Templates, i.e. a script that generates the graph macro applied with wizard variables bound in the script context. | ||
25 | * Ability to add/remove/edit chart templates in the Admin UI - 3d | ||
26 | ** Note: a chart template is very generic and specifies the macro it uses to generate the chart at runtime | ||
27 | ** XClass so that chart extensions can contribute new chart templates. | ||
28 | * Provide a wizard with several tabs or steps | ||
29 | ** Tab 1: select the chart template + basic parameters such as size, padding, etc - 5d | ||
30 | *** Filterable template picker, each template has at least a description + type of chart | ||
31 | *** Show a preview based on demo data | ||
32 | ** 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 | ||
33 | *** Demo data | ||
34 | *** + Ability add lines and columns (ideally constrained by the chart type) | ||
35 | ** Tab 3: raw data (depends on first step) - 0.5d | ||
36 | *** displays the chart template applied to entered variables and allow the user to make changes. | ||
37 | * Introduce a new ~{~{chartwizard}} macro - 3d | ||
38 | ** Saves the chart wizard data (all fields), either as parameters or in the macro content | ||
39 | ** Note: also save the raw data IF the user has made modification to it | ||
40 | ** Note: the chart template used is also saved with its id | ||
41 | ** 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. | ||
42 | ** This allows customization by users if needed while allowing generated graphs to look the same across the wiki for the nominal case | ||
43 | * Add a WYSIWYG icon for starting the chart wizard - 0.5d | ||
44 | * When double clicking the ~{~{chartwizard}} in the WYSIWYG editor, call the chart wizard UI - 0.5d | ||
45 | ** Note that this should reuse the mechanism defined in SR2 (Citations) for binding a macro to a vm | ||
46 | * (option) Ability to copy paste excel cells in step/tab 2 of the wizard - 2d | ||
47 | ** Need HTML cleanup (similar to office import) | ||
48 | * (option) Have a blacklist of macros in the WYSIWYG Macro Dialog list - 0.5 day | ||
49 | ** To allow removing the ~{~{chartjs}} macro from being listed to force users to use the chart wizard | ||
50 | |||
51 | Total Cost: | ||
52 | |||
53 | * Main work: 14.5 days | ||
54 | * All options: 13.5 days | ||
55 | |||
56 | Unresolved questions: | ||
57 | |||
58 | * 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. | ||
59 | * Need minimal list of chart types and options in the wizard (or same as MW?) | ||
60 | * Not sure we can parse the full syntax from chart macros and not loose data when serializing back. Would that be acceptable? | ||
61 | * Is it really needed to be able to edit a generated graph? This makes it a lot more complex. |