Completed
Push — master ( 2389d9...58d132 )
by Sam
02:47
created

$(document).ready   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 16
rs 9.4285
c 1
b 0
f 0
cc 2
nc 2
nop 0
1
(function () {
2
    $(document).ready(function () {
3
4
        $(".chart-wrapper").each(function () {
5
            var chartType = $(this).data("chart-type");
6
            if ( chartType === undefined ) {
7
                return false;
8
            }
9
            var data = $(this).data("chart-data");
10
            var labels = $(this).data("chart-labels");
11
            var $ctx = $("canvas", $(this));
12
            new Chart($ctx, {
0 ignored issues
show
Bug introduced by
The variable Chart seems to be never declared. If this is a global, consider adding a /** global: Chart */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Unused Code Best Practice introduced by
The object created with new Chart($ctx, {Identif...e))))),false,false)))}) is not used but discarded. Consider invoking another function instead of a constructor if you are doing this purely for side effects.
Loading history...
13
                type: chartType,
14
                data: {
15
                    labels: labels,
16
                    datasets: [ { data: data } ]
17
                }
18
            });
0 ignored issues
show
Best Practice introduced by
There is no return statement in this branch, but you do return something in other branches. Did you maybe miss it? If you do not want to return anything, consider adding return undefined; explicitly.
Loading history...
19
        });
20
21
    });
22
} )();
23