View | Details | Raw Unified | Return to bug 17282
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css (+4 lines)
Lines 3137-3139 fieldset.rows + fieldset.action { Link Here
3137
table#ill-requests {
3137
table#ill-requests {
3138
    width: 100% !important;
3138
    width: 100% !important;
3139
}
3139
}
3140
3141
div#makechart ol li {
3142
    list-style: none;
3143
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc (-2 / +2 lines)
Lines 1-7 Link Here
1
<div id="makechart">
1
<div id="makechart">
2
    [% supposed_x = header_row.shift.cell %]
2
    [% supposed_x = header_row.shift.cell %]
3
3
4
    <fieldset class="rows">
4
    <fieldset>
5
        <legend>Draw a chart</legend>
5
        <legend>Draw a chart</legend>
6
        <ol>
6
        <ol>
7
            <li>
7
            <li>
Lines 80-86 Link Here
80
            </li>
80
            </li>
81
81
82
            <li>
82
            <li>
83
                <button id="draw-chart"  class="btn">Draw</button>
83
                <button id="draw-chart" class="btn btn-default">Draw</button>
84
            </li>
84
            </li>
85
        </ol>
85
        </ol>
86
    </fieldset>
86
    </fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-54 / +62 lines)
Lines 958-1025 canned reports and writing custom SQL reports.</p> Link Here
958
        $('#download-chart').hide();
958
        $('#download-chart').hide();
959
        var chart;
959
        var chart;
960
960
961
        $('#draw-chart').click(function() {
962
            var x_elements = $('select[name="x"]').val();
963
            var y_elements = [];
964
            var groups = [];
965
            var lines = [];
966
            var options = {};
967
968
            //var headers = [% header_row.json %];
969
            headers = [% header_row.json %];
970
            var results = [% results.json %]
971
972
            if ($('input[name="chart-exclude-last"]').prop('checked')) {
973
                results.splice(-1, 1);
974
            }
975
961
976
            $('select[name="y"]').each(function( index ) {
962
        [% UNLESS (errors) %]
977
                y_elements.push( $(this).val() );
963
            $('#draw-chart').click(function() {
978
            });
979
            $('select[name="group"]').each(function( index ) {
980
                groups.push( $(this).val() );
981
            });
982
            $('.column-line').each(function( index ) {
983
                if ($(this).prop('checked')) {
984
                    lines.push( $(this).attr('name') );
985
                }
986
            });
987
964
988
            // Remove deleted columns from headers and results.
965
                var btn_text = $("#draw-chart").html();
989
            var deleted_indexes = [];
966
                $("#draw-chart").html(_('Loading...'));
990
            var kept_headers = [];
967
991
            $.each(headers, function(index, value) {
968
                var x_elements = $('select[name="x"]').val();
992
                if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) {
969
                var y_elements = [];
993
                    // This header is neither a x element nor in y elements. Don't need it.
970
                var groups = [];
994
                    deleted_indexes.push(index);
971
                var lines = [];
995
                }
972
                var options = {};
996
                else {
973
997
                    kept_headers.push({cell: value.cell});
974
                //var headers = [% header_row.json %];
975
                headers = [% header_row.json %];
976
                var results = [% results.json %]
977
978
                if ($('input[name="chart-exclude-last"]').prop('checked')) {
979
                    results.splice(-1, 1);
998
                }
980
                }
999
            });
1000
981
1001
            // Remove coresponding cells.
982
                $('select[name="y"]').each(function( index ) {
1002
            var kept_results = [];
983
                    y_elements.push( $(this).val() );
1003
            $.each(results, function(index, value) {
984
                });
1004
                var line = {};
985
                $('select[name="group"]').each(function( index ) {
1005
                line['cells'] = [];
986
                    groups.push( $(this).val() );
1006
                $.each(value.cells, function(i, val) {
987
                });
1007
                    if ($.inArray(i, deleted_indexes) === -1) {
988
                $('.column-line').each(function( index ) {
1008
                        line['cells'].push({cell: val.cell});
989
                    if ($(this).prop('checked')) {
990
                        lines.push( $(this).attr('name') );
991
                    }
992
                });
993
994
                // Remove deleted columns from headers and results.
995
                var deleted_indexes = [];
996
                var kept_headers = [];
997
                $.each(headers, function(index, value) {
998
                    if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) {
999
                        // This header is neither a x element nor in y elements. Don't need it.
1000
                        deleted_indexes.push(index);
1001
                    }
1002
                    else {
1003
                        kept_headers.push({cell: value.cell});
1009
                    }
1004
                    }
1010
                });
1005
                });
1011
                kept_results.push(line);
1012
            });
1013
1006
1014
            options.type = $('select[name="chart-type"]').val();
1007
                // Remove coresponding cells.
1015
            options.horizontal = $('input[name="column-horizontal"]').prop('checked');
1008
                var kept_results = [];
1016
            options.lines = lines;
1009
                $.each(results, function(index, value) {
1010
                    var line = {};
1011
                    line['cells'] = [];
1012
                    $.each(value.cells, function(i, val) {
1013
                        if ($.inArray(i, deleted_indexes) === -1) {
1014
                            line['cells'].push({cell: val.cell});
1015
                        }
1016
                    });
1017
                    kept_results.push(line);
1018
                });
1017
1019
1020
                options.type = $('select[name="chart-type"]').val();
1021
                options.horizontal = $('input[name="column-horizontal"]').prop('checked');
1022
                options.lines = lines;
1018
1023
1019
            chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options);
1024
1020
            $('#chart').prepend('<div style="font-size: 1rem; text-align: center;">' + "[% name %]" + '</div>');
1025
                chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options);
1021
            $('#download-chart').show();
1026
                $('#chart').prepend('<div style="font-size: 1rem; text-align: center;">' + "[% name %]" + '</div>');
1022
        });
1027
                $('#download-chart').show();
1028
                $("#draw-chart").html(_(btn_text));
1029
                $("html, body").animate({ scrollTop: $(document).height() }, "slow");
1030
            });
1031
        [% END %]
1023
    });
1032
    });
1024
</script>
1033
</script>
1025
<h1>[% name %]</h1>
1034
<h1>[% name %]</h1>
1026
- 

Return to bug 17282