Passed
Push — master ( 384962...a2213c )
by Benjamin
26:55 queued 19:06
created

Analytics.reports.BaseChart.extend.initChart   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 1
eloc 14
nc 1
nop 0
dl 0
loc 20
rs 9.7
c 3
b 0
f 0
1
/** global: Analytics */
2
/** global: google */
3
/**
4
 * Pie
5
 */
6
Analytics.reports.Pie = Analytics.reports.BaseChart.extend(
7
    {
8
        initChart: function() {
9
            this.base();
10
11
            var $reportTitle = $('<div class="subtitle" />').prependTo(this.$chart),
12
                $period = $('<div class="period" />').appendTo($reportTitle),
13
                $view = $('<div class="view" />').appendTo($reportTitle),
14
                $title = $('<div class="title" />').prependTo(this.$chart);
15
16
            $view.html(this.data.view);
17
            $title.html(this.data.dimension);
18
            $period.html(this.data.metric + " " + this.data.periodLabel);
19
20
            this.dataTable = Analytics.Utils.responseToDataTable(this.data.chart, this.localeDefinition);
21
            this.chartOptions = Analytics.ChartOptions.pie();
22
            this.chart = new google.visualization.PieChart(this.$graph.get(0));
23
24
            this.chartOptions.height = this.$graph.height();
25
26
            this.addChartReadyListener();
27
        }
28
    });
29