-
Notifications
You must be signed in to change notification settings - Fork 1
/
fork-cms-5-0-analytics.diff
147 lines (129 loc) · 5.17 KB
/
fork-cms-5-0-analytics.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
From 66df1a3b0959291d45599bd1e670fc4674ad02d4 Mon Sep 17 00:00:00 2001
From: Jeroen Desloovere <[email protected]>
Date: Mon, 7 May 2018 15:49:54 +0200
Subject: [PATCH] Fix analytics
---
src/Backend/Core/Js/backend.js | 2 --
src/Backend/Modules/Analytics/Js/Analytics.js | 36 ++++++++++++---------------
2 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/src/Backend/Core/Js/backend.js b/src/Backend/Core/Js/backend.js
index aa6f514..da2f728 100644
--- a/src/Backend/Core/Js/backend.js
+++ b/src/Backend/Core/Js/backend.js
@@ -2010,8 +2010,6 @@ jsBackend.resizeFunctions = {
jsBackend.navigation.resize();
if (typeof jsBackend.analytics !== 'undefined'){
jsBackend.analytics.charts.init();
- jsBackend.analytics.chartDoubleMetricPerDay.init();
- jsBackend.analytics.chartPieChart.init();
}
return ticking = false;
};
diff --git a/src/Backend/Modules/Analytics/Js/Analytics.js b/src/Backend/Modules/Analytics/Js/Analytics.js
index 1d31aef..2b5e7b8 100644
--- a/src/Backend/Modules/Analytics/Js/Analytics.js
+++ b/src/Backend/Modules/Analytics/Js/Analytics.js
@@ -3,25 +3,18 @@
*/
jsBackend.analytics =
{
- chartPieChart: null,
- chartDoubleMetricPerDay: null,
- init: function()
- {
- // variables
- jsBackend.analytics.chartPieChart = $('#chartPieChart');
- jsBackend.analytics.chartDoubleMetricPerDay = $('#chartDoubleMetricPerDay');
-
- jsBackend.analytics.charts();
- jsBackend.analytics.chartPieChart();
- jsBackend.analytics.chartDoubleMetricPerDay();
- }
+ $chartPieChart: null,
+ $chartDoubleMetricPerDay: null
};
jsBackend.analytics.charts =
{
init: function()
{
- if (jsBackend.analytics.chartPieChart.length > 0 || jsBackend.analytics.chartDoubleMetricPerDay.length > 0)
+ jsBackend.analytics.$chartPieChart = $('#chartPieChart');
+ jsBackend.analytics.$chartDoubleMetricPerDay = $('#chartDoubleMetricPerDay');
+
+ if (jsBackend.analytics.$chartPieChart.length > 0 || jsBackend.analytics.$chartDoubleMetricPerDay.length > 0)
{
Highcharts.setOptions(
{
@@ -39,6 +32,9 @@ jsBackend.analytics.charts =
}
});
}
+
+ jsBackend.analytics.chartPieChart.init();
+ jsBackend.analytics.chartDoubleMetricPerDay.init();
}
};
@@ -48,7 +44,7 @@ jsBackend.analytics.chartPieChart =
init: function()
{
- if (jsBackend.analytics.chartPieChart.length > 0) { jsBackend.analytics.chartPieChart.create(); }
+ if (jsBackend.analytics.$chartPieChart.length > 0) { jsBackend.analytics.$chartPieChart.create(); }
},
// add new chart
@@ -71,9 +67,9 @@ jsBackend.analytics.chartPieChart =
});
});
- var containerWidth = jsBackend.analytics.chartPieChart.width();
+ var containerWidth = jsBackend.analytics.$chartPieChart.width();
- jsBackend.analytics.chartPieChart.chart = new Highcharts.Chart(
+ jsBackend.analytics.$chartPieChart.chart = new Highcharts.Chart(
{
chart: { renderTo: 'chartPieChart', height: 200, width: containerWidth, margin: [0, 160, 0, 0], backgroundColor:'transparent' },
credits: { enabled: false },
@@ -107,7 +103,7 @@ jsBackend.analytics.chartPieChart =
// destroy chart
destroy: function()
{
- jsBackend.analytics.chartPieChart.chart.destroy();
+ jsBackend.analytics.$chartPieChart.chart.destroy();
}
};
@@ -117,7 +113,7 @@ jsBackend.analytics.chartDoubleMetricPerDay =
init: function()
{
- if (jsBackend.analytics.chartDoubleMetricPerDay.length > 0) { jsBackend.analytics.chartDoubleMetricPerDay.create(); }
+ if (jsBackend.analytics.$chartDoubleMetricPerDay.length > 0) { jsBackend.analytics.chartDoubleMetricPerDay.create(); }
},
// add new chart
@@ -187,8 +183,8 @@ jsBackend.analytics.chartDoubleMetricPerDay =
// destroy chart
destroy: function()
{
- jsBackend.analytics.chartDoubleMetricPerDay.chart.destroy();
+ jsBackend.analytics.$chartDoubleMetricPerDay.chart.destroy();
}
};
-$(jsBackend.analytics.init);
+$(jsBackend.analytics.charts.init);
--
2.16.2
From b804ab0fb0989626c12587ca0bdc524cd9537697 Mon Sep 17 00:00:00 2001
From: Jeroen Desloovere <[email protected]>
Date: Mon, 7 May 2018 15:55:34 +0200
Subject: [PATCH] Fix chartPieChart.create
---
src/Backend/Modules/Analytics/Js/Analytics.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Backend/Modules/Analytics/Js/Analytics.js b/src/Backend/Modules/Analytics/Js/Analytics.js
index 2b5e7b8..6944286 100644
--- a/src/Backend/Modules/Analytics/Js/Analytics.js
+++ b/src/Backend/Modules/Analytics/Js/Analytics.js
@@ -44,7 +44,7 @@ jsBackend.analytics.chartPieChart =
init: function()
{
- if (jsBackend.analytics.$chartPieChart.length > 0) { jsBackend.analytics.$chartPieChart.create(); }
+ if (jsBackend.analytics.$chartPieChart.length > 0) { jsBackend.analytics.chartPieChart.create(); }
},
// add new chart
--
2.16.2