Bug 17282 - Ability to create charts for SQL reports
Summary: Ability to create charts for SQL reports
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: master
Hardware: All All
: P5 - low new feature (vote)
Target Milestone: ---
Assignee: Alex Arnaud
QA Contact: Josef Moravec
URL:
Whiteboard:
Keywords: Academy, Manual, release-notes-needed
: 13219 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-09-09 09:09 UTC by Alex Arnaud
Modified: 2018-11-12 08:32 UTC (History)
12 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
Adds a form under report's result that allows to configure and draw a chart (pie, bar, line and combination).


Attachments
Bug 17282 - Ability to create charts for SQL reports (340.54 KB, patch)
2016-09-09 09:47 UTC, Alex Arnaud
Details | Diff | Splinter Review
[SIGNED-OFF]Bug 17282: Ability to create charts for SQL reports (340.63 KB, patch)
2016-09-09 14:59 UTC, Héctor Eduardo Castro Avalos
Details | Diff | Splinter Review
Bug 17282: (follow-up) Use drop-down menu for download chart instead (2.15 KB, patch)
2016-09-09 15:28 UTC, Héctor Eduardo Castro Avalos
Details | Diff | Splinter Review
Bug 17282: (follow-up) Use drop-down menu for download chart instead (2.19 KB, patch)
2016-09-12 07:09 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282 - Fix QA comments: (5.70 KB, patch)
2016-09-15 12:24 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282 - Fix QA comments: (5.82 KB, patch)
2016-09-15 13:36 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282 - Ability to exclude the last line in report results (1.93 KB, patch)
2016-09-15 14:31 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: Ability to create charts for SQL reports (340.67 KB, patch)
2016-09-16 09:05 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 17282: (follow-up) Use drop-down menu for download chart instead (2.25 KB, patch)
2016-09-16 09:05 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 17282 - Fix QA comments: (5.88 KB, patch)
2016-09-16 09:05 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 17282 - Ability to exclude the last line in report results (1.98 KB, patch)
2016-09-16 09:06 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 17282: Use fieldset.rows (3.04 KB, patch)
2016-09-28 10:10 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17282: Remove use of onclick (2.04 KB, patch)
2016-09-28 10:10 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17282 - Fix QA comments - Add a loading message, - prevent JS error when report fails, - fix (bootstrap 3 ?) displaying problems (7.49 KB, patch)
2017-04-21 14:21 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: Ability to create charts for SQL reports (340.77 KB, patch)
2017-05-19 08:32 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: (follow-up) Use drop-down menu for download chart instead (2.26 KB, patch)
2017-05-19 08:32 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282 - Fix QA comments: (5.88 KB, patch)
2017-05-19 08:32 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282 - Ability to exclude the last line in report results (1.98 KB, patch)
2017-05-19 08:32 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: Use fieldset.rows (3.04 KB, patch)
2017-05-19 08:32 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: Remove use of onclick (2.04 KB, patch)
2017-05-19 08:32 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282 - Fix QA comments - Add a loading message, - prevent JS error when report fails, - fix (bootstrap 3 ?) displaying problems (7.49 KB, patch)
2017-05-19 08:32 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: Ability to create charts for SQL reports (340.77 KB, patch)
2017-09-20 07:41 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: (follow-up) Use drop-down menu for download chart instead (2.26 KB, patch)
2017-09-20 07:41 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282 - Fix QA comments: (5.88 KB, patch)
2017-09-20 07:42 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282 - Ability to exclude the last line in report results (1.98 KB, patch)
2017-09-20 07:42 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: Use fieldset.rows (3.04 KB, patch)
2017-09-20 07:42 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: Remove use of onclick (2.04 KB, patch)
2017-09-20 07:42 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282 - Fix QA comments - Add a loading message, - prevent JS error when report fails, - fix (bootstrap 3 ?) displaying problems (7.48 KB, patch)
2017-09-20 07:42 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282 - Add information about the new Javascript libraries in the about page - fix a QA warning - Move chart settings on top and make them hidden by default - Add options to get all results (7.83 KB, patch)
2017-11-16 08:18 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282 - Fix QA comments - Add a loading message, - prevent JS error when report fails, - fix (bootstrap 3 ?) displaying problems (7.50 KB, patch)
2017-12-01 12:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17282 - Add information about the new Javascript libraries in the about page - fix a QA warning - Move chart settings on top and make them hidden by default - Add options to get all results (7.86 KB, patch)
2017-12-01 12:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17282 - Add information about the new Javascript libraries in the about page - fix a QA warning - Move chart settings on top and make them hidden by default - Add options to get all results (8.04 KB, patch)
2017-12-05 04:49 UTC, Dilan Johnpullé
Details | Diff | Splinter Review
Bug 17282: Ability to create charts for SQL reports (437.16 KB, patch)
2018-09-20 15:40 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: Ability to create charts for SQL reports (437.21 KB, patch)
2018-09-21 12:18 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 17282: Ability to create charts for SQL reports (350.80 KB, patch)
2018-09-24 13:12 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: [DO NOT PUSH] provide staff-global.css (86.67 KB, patch)
2018-09-24 13:13 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: add template's variable filters (8.22 KB, patch)
2018-09-24 13:13 UTC, Alex Arnaud
Details | Diff | Splinter Review
Bug 17282: Ability to create charts for SQL reports (350.98 KB, patch)
2018-09-24 14:24 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 17282: [DO NOT PUSH] provide staff-global.css (86.85 KB, patch)
2018-09-24 14:24 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 17282: add template's variable filters (8.40 KB, patch)
2018-09-24 14:24 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 17282: Ability to create charts for SQL reports (350.85 KB, patch)
2018-09-24 19:14 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 17282: [DO NOT PUSH] provide staff-global.css (86.77 KB, patch)
2018-09-24 19:14 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 17282: add template's variable filters (8.32 KB, patch)
2018-09-24 19:14 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Arnaud 2016-09-09 09:09:09 UTC
Add a form under report's result that allow to configure and draw a chart (pie, bar, line and combination).
Comment 1 Alex Arnaud 2016-09-09 09:47:27 UTC Comment hidden (obsolete)
Comment 2 Héctor Eduardo Castro Avalos 2016-09-09 14:59:28 UTC
Created attachment 55442 [details] [review]
[SIGNED-OFF]Bug 17282: Ability to create charts for SQL reports

Add a form under report's result that allow to configure and draw a
chart (pie, bar, line and combination).

Pie: Usefull only for a two-column report's result

bar: Horizontal: Can be horizontal or vertical (check/uncheck
horizontal checkbox),
     Group: allows to group columns (stacked bar chart),
     Line: show some columns as line in a bar chart (combination)

line: line chart :)

This patch adds 2 new js libraries: d3js and c3js:
  - c3.min.css
  - c3.min.js
  - d3.min.js

Test plan:
 - Apply this patch,
 - make reports,
 - draw charts,
 - that's all

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised
Comment 3 Héctor Eduardo Castro Avalos 2016-09-09 15:25:33 UTC
Could be better if we can only use the dropdown menu to download the chart.
I propose this patch, if you think that is bad idea, please make it obsolete.
Comment 4 Héctor Eduardo Castro Avalos 2016-09-09 15:28:07 UTC Comment hidden (obsolete)
Comment 5 Alex Arnaud 2016-09-12 07:09:59 UTC
Created attachment 55480 [details] [review]
Bug 17282: (follow-up) Use drop-down menu for download chart instead

To Test
1) Execute a report
2) Click in drop-down menu "Download" shows only three options
3) Draw a chart
4) Click again in drop-down menu "Download" shows a new option "Download chart"

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>
Comment 6 Jonathan Druart 2016-09-13 11:31:46 UTC
QA comments:
1/ Would it be possible to add a "loading please wait" when processing the graph?
2/ Execute a report which raises an error, you will get a JS error: 
3/ If I delete a column, the scrollbar goes to the top
4/ I can delete all the columns and click on "draw", nothing happens. It should not bz possible to delete the first column I'd say.
5/ With the following query:
SELECT i.homebranch, h.branchcode, monthname(h.reservedate) AS month, 
       year(h.reservedate) AS year, count(*) 
FROM old_reserves h
LEFT JOIN items i USING (itemnumber)
WHERE h.branchcode != i.homebranch AND year(h.reservedate) = '2015' 
GROUP BY month(h.reservedate), h.branchcode

With chart type: "Pie", x column: "month" and y: "count(*)", I get the following JS error:
  TypeError: columns[index] is undefined

Marked as Failed QA.
Comment 7 Alex Arnaud 2016-09-14 08:32:44 UTC
(In reply to Jonathan Druart from comment #6)

> 2/ Execute a report which raises an error, you will get a JS error: 

Have you an exemple of report that raise error ?
Comment 8 Jonathan Druart 2016-09-14 09:42:59 UTC
(In reply to Alex Arnaud from comment #7)
> (In reply to Jonathan Druart from comment #6)
> 
> > 2/ Execute a report which raises an error, you will get a JS error: 
> 
> Have you an exemple of report that raise error ?

SELECT itemtype, count(*) FROM items group by itemtype;
should do the trick
Comment 9 Alex Arnaud 2016-09-15 12:24:20 UTC Comment hidden (obsolete)
Comment 10 Alex Arnaud 2016-09-15 13:36:10 UTC
Created attachment 55586 [details] [review]
Bug 17282 - Fix QA comments:

- Don't scroll to the top when deleting a column,
  - prevents to delete all columns,
  - better handling of headers/results deleting
Comment 11 Alex Arnaud 2016-09-15 14:31:50 UTC
Created attachment 55588 [details] [review]
Bug 17282 - Ability to exclude the last line in report results

This patch add a checkbox (exclude last line). This is useful
when this last is the result of a sql rollup which is the sum
of each column and make the chart not consistent
Comment 12 Josef Moravec 2016-09-16 09:05:20 UTC
Created attachment 55604 [details] [review]
Bug 17282: Ability to create charts for SQL reports

Add a form under report's result that allow to configure and draw a
chart (pie, bar, line and combination).

Pie: Usefull only for a two-column report's result

bar: Horizontal: Can be horizontal or vertical (check/uncheck
horizontal checkbox),
     Group: allows to group columns (stacked bar chart),
     Line: show some columns as line in a bar chart (combination)

line: line chart :)

This patch adds 2 new js libraries: d3js and c3js:
  - c3.min.css
  - c3.min.js
  - d3.min.js

Test plan:
 - Apply this patch,
 - make reports,
 - draw charts,
 - that's all

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 13 Josef Moravec 2016-09-16 09:05:30 UTC
Created attachment 55605 [details] [review]
Bug 17282: (follow-up) Use drop-down menu for download chart instead

To Test
1) Execute a report
2) Click in drop-down menu "Download" shows only three options
3) Draw a chart
4) Click again in drop-down menu "Download" shows a new option "Download chart"

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 14 Josef Moravec 2016-09-16 09:05:39 UTC
Created attachment 55606 [details] [review]
Bug 17282 - Fix QA comments:

- Don't scroll to the top when deleting a column,
  - prevents to delete all columns,
  - better handling of headers/results deleting

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 15 Josef Moravec 2016-09-16 09:06:27 UTC
Created attachment 55607 [details] [review]
Bug 17282 - Ability to exclude the last line in report results

This patch add a checkbox (exclude last line). This is useful
when this last is the result of a sql rollup which is the sum
of each column and make the chart not consistent

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 16 Alex Arnaud 2016-09-19 07:43:52 UTC
Currently, graphs are built using the data of the page (Because this the only available variable in the template). For reports with paging, this means that all data are not took in account. I'm wondering if we should not make that possible. How ? Get all data with an AJAX call during making the graph ? It seems to be a big work to AJAXify this part of the code. 

Feedback are welcome
Comment 17 Jonathan Druart 2016-09-20 08:32:20 UTC
(In reply to Alex Arnaud from comment #16)
> Currently, graphs are built using the data of the page (Because this the
> only available variable in the template). For reports with paging, this
> means that all data are not took in account. I'm wondering if we should not
> make that possible. How ? Get all data with an AJAX call during making the
> graph ? It seems to be a big work to AJAXify this part of the code. 
> 
> Feedback are welcome

It seems reasonable, for a first version, to built the graph with the data displayed on the page.
But it would be nice to tell the user how it works with a small info box.
Comment 18 Katrin Fischer 2016-09-26 05:11:07 UTC
> It seems reasonable, for a first version, to built the graph with the data
> displayed on the page.
> But it would be nice to tell the user how it works with a small info box.

+1
Comment 19 Jonathan Druart 2016-09-28 10:09:03 UTC
(In reply to Jonathan Druart from comment #6)

Some of the comments from comment 6 have not been fixed!
Comment 20 Jonathan Druart 2016-09-28 10:10:06 UTC Comment hidden (obsolete)
Comment 21 Jonathan Druart 2016-09-28 10:10:10 UTC Comment hidden (obsolete)
Comment 22 Alex Arnaud 2017-04-21 14:21:23 UTC Comment hidden (obsolete)
Comment 23 Marc Véron 2017-04-21 20:54:17 UTC
Looking forward to this feature!
Wanted to test but first patch does not apply on newest master (lot of commits today).

automatischer Merge von koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
KONFLIKT (Inhalt): Merge-Konflikt in koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
automatischer Merge von koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc
KONFLIKT (hinzufügen/hinzufügen): Merge-Konflikt in koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc
Comment 24 Alex Arnaud 2017-05-19 08:32:18 UTC Comment hidden (obsolete)
Comment 25 Alex Arnaud 2017-05-19 08:32:26 UTC Comment hidden (obsolete)
Comment 26 Alex Arnaud 2017-05-19 08:32:31 UTC Comment hidden (obsolete)
Comment 27 Alex Arnaud 2017-05-19 08:32:38 UTC Comment hidden (obsolete)
Comment 28 Alex Arnaud 2017-05-19 08:32:45 UTC Comment hidden (obsolete)
Comment 29 Alex Arnaud 2017-05-19 08:32:50 UTC Comment hidden (obsolete)
Comment 30 Alex Arnaud 2017-05-19 08:32:55 UTC Comment hidden (obsolete)
Comment 31 Josef Moravec 2017-05-22 10:48:02 UTC
Could you please rebase?
I am getting 

fatal: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt).

on the last patch.
Comment 32 Alex Arnaud 2017-09-20 07:41:42 UTC
Created attachment 67225 [details] [review]
Bug 17282: Ability to create charts for SQL reports

Add a form under report's result that allow to configure and draw a
chart (pie, bar, line and combination).

Pie: Usefull only for a two-column report's result

bar: Horizontal: Can be horizontal or vertical (check/uncheck
horizontal checkbox),
     Group: allows to group columns (stacked bar chart),
     Line: show some columns as line in a bar chart (combination)

line: line chart :)

This patch adds 2 new js libraries: d3js and c3js:
  - c3.min.css
  - c3.min.js
  - d3.min.js

Test plan:
 - Apply this patch,
 - make reports,
 - draw charts,
 - that's all

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 33 Alex Arnaud 2017-09-20 07:41:54 UTC
Created attachment 67226 [details] [review]
Bug 17282: (follow-up) Use drop-down menu for download chart instead

To Test
1) Execute a report
2) Click in drop-down menu "Download" shows only three options
3) Draw a chart
4) Click again in drop-down menu "Download" shows a new option "Download chart"

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 34 Alex Arnaud 2017-09-20 07:42:02 UTC
Created attachment 67227 [details] [review]
Bug 17282 - Fix QA comments:

- Don't scroll to the top when deleting a column,
  - prevents to delete all columns,
  - better handling of headers/results deleting

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 35 Alex Arnaud 2017-09-20 07:42:10 UTC
Created attachment 67228 [details] [review]
Bug 17282 - Ability to exclude the last line in report results

This patch add a checkbox (exclude last line). This is useful
when this last is the result of a sql rollup which is the sum
of each column and make the chart not consistent

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 36 Alex Arnaud 2017-09-20 07:42:17 UTC
Created attachment 67229 [details] [review]
Bug 17282: Use fieldset.rows
Comment 37 Alex Arnaud 2017-09-20 07:42:25 UTC
Created attachment 67230 [details] [review]
Bug 17282: Remove use of onclick
Comment 38 Alex Arnaud 2017-09-20 07:42:32 UTC
Created attachment 67231 [details] [review]
Bug 17282 - Fix QA comments - Add a loading message, - prevent JS error when report fails, - fix (bootstrap 3 ?) displaying problems
Comment 39 Katrin Fischer 2017-10-08 10:23:35 UTC
Hi Alex,

very cool feature! 

Some small things to fix:

- Add information about the new Javascript libraries to the about page with the license etc.

- QA tools - just make it "" instead.
   FAIL	koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
   FAIL	  forbidden patterns
		forbidden pattern: simple-quote string (line 966)

- Maybe it would be nicer to display the settings on top, activated by a new button in the toolbar. What do you think? 
At the moment the problem I see that a lot of libraries like to print that page for a quick overview and the new settings will print on an extra page at the bottom. Also if the table is long, you have to scroll down quite a bit.

Deadlines are close now, I will try to come back to this fast.
Comment 40 Alex Arnaud 2017-11-16 08:18:31 UTC
Created attachment 69174 [details] [review]
Bug 17282 - Add information about the new Javascript libraries in the about page  - fix a QA warning  - Move chart settings on top and make them hidden by default  - Add options to get all results
Comment 41 Jonathan Druart 2017-12-01 12:59:00 UTC
Created attachment 69429 [details] [review]
Bug 17282 - Fix QA comments - Add a loading message, - prevent JS error when report fails, - fix (bootstrap 3 ?) displaying problems
Comment 42 Jonathan Druart 2017-12-01 12:59:09 UTC
Created attachment 69430 [details] [review]
Bug 17282 - Add information about the new Javascript libraries in the about page - fix a QA warning - Move chart settings on top and make them hidden by default - Add options to get all results
Comment 43 Jonathan Druart 2017-12-01 12:59:39 UTC
Last 2 patches fix conflict on staff-global.css
Comment 44 Dilan Johnpullé 2017-12-05 04:49:35 UTC
Created attachment 69493 [details] [review]
Bug 17282 - Add information about the new Javascript libraries in the about page - fix a QA warning - Move chart settings on top and make them hidden by default - Add options to get all results

Patch applies and functions as expected when following test plan.
Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>
Comment 45 Katrin Fischer 2018-02-12 20:30:33 UTC
*** Bug 13219 has been marked as a duplicate of this bug. ***
Comment 46 Katrin Fischer 2018-03-12 13:17:17 UTC
Patch doesn't apply, can you please rebase?
Comment 47 Alex Arnaud 2018-09-20 15:40:08 UTC
Created attachment 79182 [details] [review]
Bug 17282: Ability to create charts for SQL reports

Add a form under report's result that allow to configure and draw a
chart (pie, bar, line and combination).

Pie: Usefull only for a two-column report's result

bar: Horizontal: Can be horizontal or vertical (check/uncheck
horizontal checkbox),
     Group: allows to group columns (stacked bar chart),
     Line: show some columns as line in a bar chart (combination)

line: line chart :)

This patch adds 2 new js libraries: d3js and c3js:
  - c3.min.css
  - c3.min.js
  - d3.min.js

Test plan:
- Apply this patch,
- execute a report,
- click on show chart settings button (in the tool bar),
- draw chart (click on draw button),
- check the chart

Features:
- Include all rows (ignore pagination),
- Download the chart (svg),
- Choose x column and y columns,
- Exclude last line (Rollup)
Comment 48 Michal Denar 2018-09-21 12:18:43 UTC
Created attachment 79230 [details] [review]
Bug 17282: Ability to create charts for SQL reports

Add a form under report's result that allow to configure and draw a
chart (pie, bar, line and combination).

Pie: Usefull only for a two-column report's result

bar: Horizontal: Can be horizontal or vertical (check/uncheck
horizontal checkbox),
     Group: allows to group columns (stacked bar chart),
     Line: show some columns as line in a bar chart (combination)

line: line chart :)

This patch adds 2 new js libraries: d3js and c3js:
  - c3.min.css
  - c3.min.js
  - d3.min.js

Test plan:
- Apply this patch,
- execute a report,
- click on show chart settings button (in the tool bar),
- draw chart (click on draw button),
- check the chart

Features:
- Include all rows (ignore pagination),
- Download the chart (svg),
- Choose x column and y columns,
- Exclude last line (Rollup)

Signed-off-by: Michal Denare <black23@gmail.com>
Comment 49 Michal Denar 2018-09-21 12:19:35 UTC
Nice feature, I really love it.

Thank You ...


Mike
Comment 50 Josef Moravec 2018-09-24 09:27:33 UTC
I started to testing 21393 with this one, so my QA tools are on steroids now ;)

Few comments
1) Missing filters:

FAIL	koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc
   FAIL	  filters
		missing_filter at line 26 (                        <option value="[% header.cell %]">[% header.cell %]</option>)
		missing_filter at line 46 (                            <a class="chart-column-delete" href="#" data-column="[% column %]">)
		missing_filter at line 72 (                                        <option value="[% i %]">[% i %]</option>)
		missing_filter at line 47 (                                <img src="[% interface %]/[% theme %]/img/x.png" alt="Delete" />)
		missing_filter at line 24 (                    <option value="[% supposed_x %]" selected>[% supposed_x %]</option>)
		missing_filter at line 70 (                                        <option value="[% i %]" selected>[% i %]</option>)
		missing_filter at line 56 (                                        <option value="[% h.cell %]" selected>[% h.cell %]</option>)
		missing_filter at line 52 (                            <select id="y_[% column %]" name="y">)
		missing_filter at line 58 (                                        <option value="[% h.cell %]">[% h.cell %]</option>)
		missing_filter at line 43 (                    <fieldset class="chart-column-conf" id="column_[% column %]" style="display: inline !important;">)
		missing_filter at line 66 (                            <label for="group_[% column %]">Group:</label>)
		missing_filter at line 81 (                            <input class="column-line" id="column-line" name="[% header.cell %]" type="checkbox">)
		missing_filter at line 67 (                            <select id="group_[% column %]" name="group">)
		missing_filter at line 45 (                            Column [% column %])
		missing_filter at line 94 (    [% header_row.unshift(item) %])
		missing_filter at line 51 (                            <label for="y_[% column %]" >y:</label>)
		missing_filter at line 80 (                            <label for="line_[% column %]">line:</label>)
		missing_filter at line 53 (                                <option value="[% supposed_x %]" selected>[% supposed_x %]</option>)

 FAIL	koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
   FAIL	  filters
		missing_filter at line 1108 (                    $('#chart').prepend('<div style="font-size: 1rem; text-align: center;">' + "[% name %]" + '</div>');)
		missing_filter at line 1058 (                        results = [% results.json %])
		missing_filter at line 1055 (                        results = [% allresults.json %])
		missing_filter at line 1051 (                    headers = [% header_row.json %];)

2) Could you please split the patch? At least staff-global.css should not be in main patch, as it is generated by RM and here should be only for ease the testing.
Comment 51 Alex Arnaud 2018-09-24 13:12:39 UTC
Created attachment 79308 [details] [review]
Bug 17282: Ability to create charts for SQL reports

Add a form under report's result that allow to configure and draw a
chart (pie, bar, line and combination).

Pie: Usefull only for a two-column report's result

bar: Horizontal: Can be horizontal or vertical (check/uncheck
horizontal checkbox),
     Group: allows to group columns (stacked bar chart),
     Line: show some columns as line in a bar chart (combination)

line: line chart :)

This patch adds 2 new js libraries: d3js and c3js:
  - c3.min.css
  - c3.min.js
  - d3.min.js

Test plan:
- Apply this patch,
- execute a report,
- click on show chart settings button (in the tool bar),
- draw chart (click on draw button),
- check the chart

Features:
- Include all rows (ignore pagination),
- Download the chart (svg),
- Choose x column and y columns,
- Exclude last line (Rollup)

Signed-off-by: Michal Denare <black23@gmail.com>
Comment 52 Alex Arnaud 2018-09-24 13:13:07 UTC
Created attachment 79309 [details] [review]
Bug 17282: [DO NOT PUSH] provide staff-global.css
Comment 53 Alex Arnaud 2018-09-24 13:13:29 UTC
Created attachment 79310 [details] [review]
Bug 17282: add template's variable filters
Comment 54 Michal Denar 2018-09-24 14:24:38 UTC
Created attachment 79311 [details] [review]
Bug 17282: Ability to create charts for SQL reports

Add a form under report's result that allow to configure and draw a
chart (pie, bar, line and combination).

Pie: Usefull only for a two-column report's result

bar: Horizontal: Can be horizontal or vertical (check/uncheck
horizontal checkbox),
     Group: allows to group columns (stacked bar chart),
     Line: show some columns as line in a bar chart (combination)

line: line chart :)

This patch adds 2 new js libraries: d3js and c3js:
  - c3.min.css
  - c3.min.js
  - d3.min.js

Test plan:
- Apply this patch,
- execute a report,
- click on show chart settings button (in the tool bar),
- draw chart (click on draw button),
- check the chart

Features:
- Include all rows (ignore pagination),
- Download the chart (svg),
- Choose x column and y columns,
- Exclude last line (Rollup)

Signed-off-by: Michal Denare <black23@gmail.com>
Signed-off-by: Michal Denar <black23ěgmail.com>

Signed-off-by: Your Full Name <your_email>
Comment 55 Michal Denar 2018-09-24 14:24:44 UTC
Created attachment 79312 [details] [review]
Bug 17282: [DO NOT PUSH] provide staff-global.css

Signed-off-by: Michal Denar <black23ěgmail.com>

Signed-off-by: Your Full Name <your_email>
Comment 56 Michal Denar 2018-09-24 14:24:50 UTC
Created attachment 79313 [details] [review]
Bug 17282: add template's variable filters

Signed-off-by: Michal Denar <black23ěgmail.com>

Signed-off-by: Your Full Name <your_email>
Comment 57 Michal Denar 2018-09-24 14:27:34 UTC
Sorry I've no idea what default name and email was added :-(
Comment 58 Katrin Fischer 2018-09-24 17:01:04 UTC
Hi Michal, how did you sign off? I notice there is this line in your patches today: Signed-off-by: Your Full Name <your_email>, but also a correct sign-off line: Signed-off-by: Michal Denar <black23ěgmail.com>
Comment 59 Martin Renvoize 2018-09-24 17:42:36 UTC
Shouldn't that ě also be an @ sign in the signoff too?
Comment 60 Josef Moravec 2018-09-24 19:14:00 UTC
Created attachment 79337 [details] [review]
Bug 17282: Ability to create charts for SQL reports

Add a form under report's result that allow to configure and draw a
chart (pie, bar, line and combination).

Pie: Usefull only for a two-column report's result

bar: Horizontal: Can be horizontal or vertical (check/uncheck
horizontal checkbox),
     Group: allows to group columns (stacked bar chart),
     Line: show some columns as line in a bar chart (combination)

line: line chart :)

This patch adds 2 new js libraries: d3js and c3js:
  - c3.min.css
  - c3.min.js
  - d3.min.js

Test plan:
- Apply this patch,
- execute a report,
- click on show chart settings button (in the tool bar),
- draw chart (click on draw button),
- check the chart

Features:
- Include all rows (ignore pagination),
- Download the chart (svg),
- Choose x column and y columns,
- Exclude last line (Rollup)

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 61 Josef Moravec 2018-09-24 19:14:07 UTC
Created attachment 79338 [details] [review]
Bug 17282: [DO NOT PUSH] provide staff-global.css

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 62 Josef Moravec 2018-09-24 19:14:14 UTC
Created attachment 79339 [details] [review]
Bug 17282: add template's variable filters

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 63 Nick Clemens 2018-09-26 19:20:04 UTC
This is very cool.

I think some of the lines in chart.inc need filters? They are not failing the test but want to make sure before pushing.
Comment 64 Jonathan Druart 2018-09-29 16:24:11 UTC
(In reply to Nick Clemens from comment #63)
> I think some of the lines in chart.inc need filters? They are not failing
> the test but want to make sure before pushing.

Which ones? Did you see the last patch?
Comment 65 Nick Clemens 2018-10-01 13:38:05 UTC
(In reply to Jonathan Druart from comment #64)
> (In reply to Nick Clemens from comment #63)
> > I think some of the lines in chart.inc need filters? They are not failing
> > the test but want to make sure before pushing.
> 
> Which ones? Did you see the last patch?

/me is embarassed, my bad
Comment 66 Nick Clemens 2018-10-01 16:42:21 UTC
Awesome work all!

Pushed to master for 18.11
Comment 67 Martin Renvoize 2018-10-08 07:54:04 UTC
Great enhancement, won't be backported to 18.05.x series.
Comment 68 Martin Renvoize 2018-10-26 17:09:13 UTC
Be great to have some release notes text for this.. highlight it a bit during 18.11 release.