@datarailsshared/dr_renderer 1.2.365 → 1.2.366
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +2 -2
- package/package.json +1 -1
- package/src/dr-renderer-helpers.js +7 -0
- package/src/dr_pivottable.js +63 -14
- package/src/highcharts_renderer.js +1378 -1087
- package/src/novix_renderer.js +13 -11
- package/src/pivottable.js +28 -4
- package/tests/dr-renderer-helpers.test.js +34 -0
- package/tests/highcharts_renderer.test.js +5386 -14
- package/tests/mock/add-in-dynamic-ranges.json +133 -0
- package/tests/mock/add-in-functions.json +412 -0
- package/tests/mock/add-in-tables.json +347 -0
- package/tests/mock/tables.json +2258 -0
- package/tests/mock/widgets.json +411 -0
@@ -1,3 +1,11 @@
|
|
1
|
+
const helpers = require('./dr-renderer-helpers');
|
2
|
+
|
3
|
+
const mobileBrowserRegex = new RegExp([
|
4
|
+
'(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)',
|
5
|
+
'|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/',
|
6
|
+
'|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino',
|
7
|
+
].join(''), 'i');
|
8
|
+
|
1
9
|
const SERIES_CLASSNAMES = {
|
2
10
|
WATERFALL_BREAKDOWN: 'waterfallBreakdown',
|
3
11
|
WATERFALL_WALKTHROUGH: 'waterfallWalkthrough',
|
@@ -6,27 +14,157 @@ const SERIES_CLASSNAMES = {
|
|
6
14
|
};
|
7
15
|
|
8
16
|
const EMPTY_ROW_N_KEYS = [[]];
|
17
|
+
|
9
18
|
const NULL_VALUE = '[null]';
|
10
19
|
|
20
|
+
const CHART_COLORS = {
|
21
|
+
BACKGROUND: '#fff',
|
22
|
+
TEXT: '#151a41',
|
23
|
+
LABEL: '#cfd7dd',
|
24
|
+
LABEL_SECOND: '#85889c',
|
25
|
+
DRILL_UP_FILL: '#eef3f6',
|
26
|
+
DRILL_BUTTON_COLOR_FILL: 'white',
|
27
|
+
DRILL_BUTTON_COLOR: '#333333',
|
28
|
+
DRILL_BUTTON_COLOR_HOVER: '#6D6E6F',
|
29
|
+
PLOT_BORDER: '#606063',
|
30
|
+
MINOR_GRID_LINE: '#505053',
|
31
|
+
TICK_COLOR: '#666',
|
32
|
+
LABELS_OLD: '#D7D7D8',
|
33
|
+
DATA_LABELS: '#B0B0B3',
|
34
|
+
CONTRAST_TEXT: '#F0F0F3',
|
35
|
+
LEGEND_BACKGROUND: 'rgba(0, 0, 0, 0.5)',
|
36
|
+
MASK: 'rgba(255,255,255,0.3)',
|
37
|
+
};
|
38
|
+
|
39
|
+
const CHART_TYPES = {
|
40
|
+
LINE_CHART: 'line-chart',
|
41
|
+
LINE_CHART_SMOOTH: 'line-chart-smooth',
|
42
|
+
COLUMN_CHART: 'column-chart',
|
43
|
+
COLUMN_CHART_STACKED: 'column-chart-stacked',
|
44
|
+
COMBO_CHART: 'combo-chart',
|
45
|
+
COMBO_COLUMN_CHART: 'combo-column-chart',
|
46
|
+
COMBO_STACKED_CHART: 'combo-stacked-chart',
|
47
|
+
BAR_CHART: 'bar-chart',
|
48
|
+
BAR_CHART_STACKED: 'bar-chart-stacked',
|
49
|
+
SCATTER_CHART: 'scatter-chart',
|
50
|
+
AREA_CHART: 'area-chart',
|
51
|
+
AREA_CHART_SMOOTH: 'area-chart-smooth',
|
52
|
+
TABLE_ONLY: 'table_only',
|
53
|
+
POLYGON_CHART: 'polygon-chart',
|
54
|
+
PIE_CHART: 'pie-chart',
|
55
|
+
PIE_CHART_DRILLDOWN: 'pie-chart-drilldown',
|
56
|
+
GAUGE_SOLID_CHART: 'gauge-solid-chart',
|
57
|
+
GAUGE_CHART: 'gauge-chart',
|
58
|
+
KPI_WIDGET: 'kpi-widget',
|
59
|
+
TEXT_WIDGET: 'text-widget',
|
60
|
+
WATERFALL_BREAKDOWN: 'waterfall-chart-breakdown',
|
61
|
+
WATERFALL_WALKTHROUGH: 'waterfall-chart-walkthrough',
|
62
|
+
PUBLISHED_ITEM: 'published_item',
|
63
|
+
RICH_TEXT: 'rich_text',
|
64
|
+
EXCEL_VIEWER: 'excel_viewer',
|
65
|
+
}
|
66
|
+
|
67
|
+
const HIGHCHARTS_CONSTANTS = {
|
68
|
+
delimer: ' , ',
|
69
|
+
DRILL_BUTTON_FONT_SIZE: '14px',
|
70
|
+
MAX_ROWS_FOR_AUTO_REFRESH: 100000,
|
71
|
+
MAX_ROWS_FOR_SHOW_RESULTS: 10000,
|
72
|
+
DR_OTHERS_KEY: 'DR_Others',
|
73
|
+
VIRTUAL_FIELDS: {
|
74
|
+
WATERFALL_VARIANCE: 'DR_WATERFALL_BREAKDOWN_VARIANCE',
|
75
|
+
},
|
76
|
+
waterfallConstants: {
|
77
|
+
[CHART_TYPES.WATERFALL_BREAKDOWN]: {
|
78
|
+
minCategoriesCount: 2
|
79
|
+
},
|
80
|
+
[CHART_TYPES.WATERFALL_WALKTHROUGH]: {
|
81
|
+
minCategoriesCount: 2,
|
82
|
+
maxCategoriesCount: 10,
|
83
|
+
}
|
84
|
+
},
|
85
|
+
CHART_TYPES: CHART_TYPES,
|
86
|
+
MAX_SELECTED_ITEMS_IN_LABEL: 20,
|
87
|
+
MAX_SELECTED_ITEMS_CHARECHTERS_IN_LABEL: 50,
|
88
|
+
}
|
89
|
+
|
90
|
+
const SUBOPTIONS_FONTS = [
|
91
|
+
'Arial',
|
92
|
+
'Arial Black',
|
93
|
+
'Comic Sans MS',
|
94
|
+
'Courier New',
|
95
|
+
'Helvetica',
|
96
|
+
'Impact',
|
97
|
+
'Nunito Sans',
|
98
|
+
'Tahoma',
|
99
|
+
'Times New Roman',
|
100
|
+
'Verdana',
|
101
|
+
'Poppins'
|
102
|
+
];
|
103
|
+
|
104
|
+
const HIGHCHARTS_FONT_FAMILY = 'Poppins';
|
105
|
+
|
106
|
+
const HIGHCHARTS_FONT_FAMILY_CSS = 'Poppins, sans-serif';
|
107
|
+
|
108
|
+
const TOOLTIP_DEFAULT_SETTINGS = {
|
109
|
+
FONT_COLOR: '#545a6b',
|
110
|
+
FONT_SIZE: '12',
|
111
|
+
FONT_FAMILY: HIGHCHARTS_FONT_FAMILY,
|
112
|
+
};
|
113
|
+
|
114
|
+
const TOOLTIP_DEFAULT_OPTIONS = {
|
115
|
+
borderColor: CHART_COLORS.BACKGROUND,
|
116
|
+
shadow: {
|
117
|
+
color: '#9199b4',
|
118
|
+
width: 10,
|
119
|
+
opacity: 0.05
|
120
|
+
},
|
121
|
+
style: {
|
122
|
+
fontSize: TOOLTIP_DEFAULT_SETTINGS.FONT_SIZE,
|
123
|
+
fontFamily: TOOLTIP_DEFAULT_SETTINGS.FONT_FAMILY,
|
124
|
+
color: TOOLTIP_DEFAULT_SETTINGS.FONT_COLOR,
|
125
|
+
},
|
126
|
+
enabled: true,
|
127
|
+
};
|
128
|
+
|
129
|
+
const LABEL_DEFAULT_SETTINGS = {
|
130
|
+
FONT_COLOR: CHART_COLORS.TEXT,
|
131
|
+
FONT_SIZE: '11',
|
132
|
+
FONT_FAMILY: HIGHCHARTS_FONT_FAMILY,
|
133
|
+
};
|
134
|
+
|
135
|
+
const LABEL_DEFAULT_OPTIONS = {
|
136
|
+
style: {
|
137
|
+
fontSize: LABEL_DEFAULT_SETTINGS.FONT_SIZE,
|
138
|
+
fontFamily: LABEL_DEFAULT_SETTINGS.FONT_FAMILY,
|
139
|
+
fontWeight: 'normal',
|
140
|
+
},
|
141
|
+
color: LABEL_DEFAULT_SETTINGS.FONT_COLOR,
|
142
|
+
};
|
143
|
+
|
144
|
+
const CHART_AXIS_DEFAULT_LABEL = 'Axis (Category)';
|
145
|
+
|
146
|
+
const CHART_LEGEND_DEFAULT_LABEL = 'Legend (Series)';
|
147
|
+
|
148
|
+
const FEATURES = {
|
149
|
+
ENABLE_NEW_WIDGET_VALUE_FORMATTING: 'enable_new_widget_value_formatting',
|
150
|
+
ENABLE_SERVER_TOTALS_CALCULATION: 'enable_server_totals_calculation',
|
151
|
+
FORMAT_AXIS: 'use_default_table_format_for_axis',
|
152
|
+
FORMAT_DATES_AS_OTHER_AXIS_TYPES: 'format_dates_as_other_axis_types',
|
153
|
+
MULTIPLE_DIMENSION_TAGS: 'multiple_dimension_tags',
|
154
|
+
USE_NEW_SCENARIO_TAG: 'use_new_scenario_tag',
|
155
|
+
ENABLE_SERVER_WIDGET_DATA_SORTING: 'enable_server_widget_data_sorting',
|
156
|
+
}
|
157
|
+
|
158
|
+
const TICKS_COUNT = 5;
|
159
|
+
|
11
160
|
let getHighchartsRenderer = function ($, document, Highcharts, default_colors, highchartsRenderer,
|
12
161
|
DataFormatter, lodash, moment_lib, isNewAngular) {
|
13
162
|
|
163
|
+
/** Highcharts initial configuration section **/
|
14
164
|
if(!lodash){
|
15
165
|
lodash = _;
|
16
166
|
}
|
17
167
|
|
18
|
-
// TODO: always true. remove
|
19
|
-
let useNewUx = true;
|
20
|
-
let useTotalsCalculation = false;
|
21
|
-
let disableAnimation = false;
|
22
|
-
if (document.ReportHippo && document.ReportHippo && document.ReportHippo.user) {
|
23
|
-
useTotalsCalculation = lodash.includes(document.ReportHippo.user.features, 'enable_server_totals_calculation');
|
24
|
-
disableAnimation = document.ReportHippo.user.organization && document.ReportHippo.user.organization.settings && document.ReportHippo.user.organization.settings.disable_animation
|
25
|
-
}
|
26
|
-
const textColor = "#151a41";
|
27
|
-
const chartLabelColor = "#cfd7dd";
|
28
|
-
const HIGHCHARTS_FONT_FAMILY = 'Poppins';
|
29
|
-
|
30
168
|
if(!Highcharts){
|
31
169
|
Highcharts = {
|
32
170
|
opt: {},
|
@@ -36,13 +174,59 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
36
174
|
}
|
37
175
|
}
|
38
176
|
|
177
|
+
// remove highcharts tooltip from the dom instead of hiding if option is passed
|
178
|
+
Highcharts.wrap(Highcharts.Tooltip.prototype, 'hide', function(proceed, delay) {
|
179
|
+
if (!this.options.destroyWhenHiding) {
|
180
|
+
proceed.call(this, delay);
|
181
|
+
} else {
|
182
|
+
Highcharts.clearTimeout(this.hideTimer);
|
183
|
+
delay = Highcharts.pick(delay, this.options.hideDelay);
|
184
|
+
this.hideTimer = Highcharts.syncTimeout(() => {
|
185
|
+
this.destroy();
|
186
|
+
}, delay);
|
187
|
+
}
|
188
|
+
});
|
189
|
+
|
39
190
|
if(!moment_lib){
|
40
191
|
moment_lib = moment;
|
41
192
|
}
|
42
193
|
|
43
|
-
if(!highchartsRenderer){
|
194
|
+
if (!highchartsRenderer) {
|
44
195
|
highchartsRenderer = {};
|
45
196
|
}
|
197
|
+
lodash.assign(highchartsRenderer, HIGHCHARTS_CONSTANTS);
|
198
|
+
|
199
|
+
highchartsRenderer.useTotalsCalculation = false;
|
200
|
+
highchartsRenderer.enabledNewWidgetValueFormatting = false;
|
201
|
+
let disableAnimation = false;
|
202
|
+
|
203
|
+
highchartsRenderer.hasFeature = function(featureFlagKey) {
|
204
|
+
return lodash.includes(lodash.get(document, 'ReportHippo.user.features', []), featureFlagKey);
|
205
|
+
}
|
206
|
+
|
207
|
+
if (!!lodash.get(document, 'ReportHippo.user')) {
|
208
|
+
highchartsRenderer.useTotalsCalculation = highchartsRenderer.hasFeature(FEATURES.ENABLE_SERVER_TOTALS_CALCULATION);
|
209
|
+
disableAnimation = document.ReportHippo.user.organization && document.ReportHippo.user.organization.settings && document.ReportHippo.user.organization.settings.disable_animation
|
210
|
+
highchartsRenderer.enabledNewWidgetValueFormatting = highchartsRenderer.hasFeature(FEATURES.ENABLE_NEW_WIDGET_VALUE_FORMATTING);
|
211
|
+
highchartsRenderer.isSortingOnBackendEnabled = highchartsRenderer.hasFeature(FEATURES.ENABLE_SERVER_WIDGET_DATA_SORTING);
|
212
|
+
}
|
213
|
+
|
214
|
+
// fix issue of use tootip.stickOnContact with tooltip.outside , source: https://github.com/highcharts/highcharts/pull/15960
|
215
|
+
// TODO: remove it after it is fixed in highcharts library new version
|
216
|
+
if (lodash.get(Highcharts, 'Pointer')) {
|
217
|
+
Highcharts.Pointer.prototype.onContainerMouseLeave = function (e) {
|
218
|
+
|
219
|
+
const {charts, pick, Pointer} = Highcharts;
|
220
|
+
const chart = charts[pick(Pointer.hoverChartIndex, -1)];
|
221
|
+
|
222
|
+
e = this.normalize(e);
|
223
|
+
|
224
|
+
if (chart && e.relatedTarget && !this.inClass(e.relatedTarget, 'highcharts-tooltip')) {
|
225
|
+
chart.pointer.reset();
|
226
|
+
chart.pointer.chartPosition = void 0;
|
227
|
+
}
|
228
|
+
}
|
229
|
+
}
|
46
230
|
|
47
231
|
// in lib it will not work
|
48
232
|
highchartsRenderer.elem1 = document.createElement('textarea');
|
@@ -54,133 +238,104 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
54
238
|
highchartsRenderer.variance_color = default_colors.variance_color;
|
55
239
|
}
|
56
240
|
|
57
|
-
const mobileBrowserRegex = new RegExp([
|
58
|
-
'(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)',
|
59
|
-
'|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/',
|
60
|
-
'|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino',
|
61
|
-
].join(''), 'i');
|
62
241
|
highchartsRenderer.isMobile = mobileBrowserRegex.test(navigator.userAgent);
|
63
242
|
|
64
|
-
highchartsRenderer.CHART_TYPES = {
|
65
|
-
LINE_CHART: 'line-chart',
|
66
|
-
LINE_CHART_SMOOTH: 'line-chart-smooth',
|
67
|
-
COLUMN_CHART: 'column-chart',
|
68
|
-
COLUMN_CHART_STACKED: 'column-chart-stacked',
|
69
|
-
COMBO_CHART: 'combo-chart',
|
70
|
-
COMBO_COLUMN_CHART: 'combo-column-chart',
|
71
|
-
COMBO_STACKED_CHART: 'combo-stacked-chart',
|
72
|
-
BAR_CHART: 'bar-chart',
|
73
|
-
BAR_CHART_STACKED: 'bar-chart-stacked',
|
74
|
-
SCATTER_CHART: 'scatter-chart',
|
75
|
-
AREA_CHART: 'area-chart',
|
76
|
-
AREA_CHART_SMOOTH: 'area-chart-smooth',
|
77
|
-
TABLE_ONLY: 'table_only',
|
78
|
-
POLYGON_CHART: 'polygon-chart',
|
79
|
-
PIE_CHART: 'pie-chart',
|
80
|
-
PIE_CHART_DRILLDOWN: 'pie-chart-drilldown',
|
81
|
-
GAUGE_SOLID_CHART: 'gauge-solid-chart',
|
82
|
-
GAUGE_CHART: 'gauge-chart',
|
83
|
-
KPI_WIDGET: 'kpi-widget',
|
84
|
-
TEXT_WIDGET: 'text-widget',
|
85
|
-
WATERFALL_BREAKDOWN: 'waterfall-chart-breakdown',
|
86
|
-
WATERFALL_WALKTHROUGH: 'waterfall-chart-walkthrough',
|
87
|
-
PUBLISHED_ITEM: 'published_item',
|
88
|
-
RICH_TEXT: 'rich_text',
|
89
|
-
EXCEL_VIEWER: 'excel_viewer',
|
90
|
-
};
|
91
|
-
|
92
|
-
highchartsRenderer.VIRTUAL_FIELDS = {
|
93
|
-
WATERFALL_VARIANCE: 'DR_WATERFALL_BREAKDOWN_VARIANCE',
|
94
|
-
};
|
95
|
-
|
96
|
-
highchartsRenderer.DR_OTHERS_KEY = 'DR_Others';
|
97
|
-
|
98
243
|
highchartsRenderer.highcharts_theme = {
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
244
|
+
colors: highchartsRenderer.defaults_colors,
|
245
|
+
chart: {
|
246
|
+
backgroundColor: CHART_COLORS.BACKGROUND,
|
247
|
+
plotBorderColor: CHART_COLORS.PLOT_BORDER,
|
248
|
+
style: {
|
249
|
+
fontFamily: HIGHCHARTS_FONT_FAMILY_CSS,
|
250
|
+
color: CHART_COLORS.TEXT
|
106
251
|
}
|
107
252
|
},
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
253
|
+
title: {
|
254
|
+
align: 'left',
|
255
|
+
style: {
|
256
|
+
fontWeight: 'bold'
|
112
257
|
}
|
113
258
|
},
|
114
|
-
|
115
|
-
|
259
|
+
subtitle: {
|
260
|
+
align: 'left'
|
116
261
|
},
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
262
|
+
xAxis: {
|
263
|
+
gridLineWidth: 1,
|
264
|
+
gridLineColor: CHART_COLORS.LABEL ,
|
265
|
+
labels: {
|
266
|
+
style: {
|
267
|
+
fontFamily: HIGHCHARTS_FONT_FAMILY_CSS,
|
268
|
+
color: CHART_COLORS.TEXT,
|
269
|
+
'font-size': '10px',
|
270
|
+
'font-weight': "bold"
|
124
271
|
}
|
125
272
|
},
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
273
|
+
lineColor: CHART_COLORS.LABEL,
|
274
|
+
minorGridLineColor: CHART_COLORS.MINOR_GRID_LINE,
|
275
|
+
tickColor: CHART_COLORS.LABEL,
|
276
|
+
tickWidth: 1,
|
277
|
+
title: {
|
278
|
+
style: {
|
279
|
+
fontFamily: HIGHCHARTS_FONT_FAMILY_CSS,
|
280
|
+
color: CHART_COLORS.LABEL_SECOND,
|
281
|
+
'font-size': '12px',
|
282
|
+
'font-weight': 'bold'
|
133
283
|
}
|
134
284
|
}
|
135
285
|
},
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
286
|
+
yAxis: {
|
287
|
+
gridLineColor: CHART_COLORS.LABEL,
|
288
|
+
labels: {
|
289
|
+
style: {
|
290
|
+
fontFamily: HIGHCHARTS_FONT_FAMILY_CSS,
|
291
|
+
'font-size': '10px',
|
292
|
+
color: CHART_COLORS.LABEL_SECOND
|
142
293
|
}
|
143
294
|
},
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
295
|
+
lineColor: CHART_COLORS.LABEL,
|
296
|
+
minorGridLineColor: CHART_COLORS.MINOR_GRID_LINE,
|
297
|
+
tickColor: CHART_COLORS.LABEL,
|
298
|
+
tickWidth: 1,
|
299
|
+
title: {
|
300
|
+
style: {
|
301
|
+
fontFamily: HIGHCHARTS_FONT_FAMILY_CSS,
|
302
|
+
color: CHART_COLORS.LABEL_SECOND,
|
303
|
+
'font-size': '12px',
|
304
|
+
'font-weight': 'bold'
|
151
305
|
}
|
152
306
|
}
|
153
307
|
},
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
308
|
+
tooltip: {
|
309
|
+
backgroundColor: CHART_COLORS.BACKGROUND,
|
310
|
+
style: {
|
311
|
+
color: CHART_COLORS.TEXT
|
158
312
|
}
|
159
313
|
},
|
160
|
-
|
161
|
-
|
162
|
-
|
314
|
+
legend: {
|
315
|
+
itemStyle: {
|
316
|
+
color: CHART_COLORS.TEXT,
|
317
|
+
fontWeight: 'normal'
|
163
318
|
},
|
164
|
-
|
165
|
-
|
319
|
+
itemHiddenStyle: {
|
320
|
+
color: CHART_COLORS.PLOT_BORDER
|
166
321
|
}
|
167
322
|
},
|
168
|
-
|
169
|
-
|
170
|
-
|
323
|
+
credits: {
|
324
|
+
style: {
|
325
|
+
color: CHART_COLORS.TICK_COLOR
|
171
326
|
}
|
172
327
|
},
|
173
|
-
|
174
|
-
|
175
|
-
|
328
|
+
labels: {
|
329
|
+
style: {
|
330
|
+
color: CHART_COLORS.LABELS_OLD
|
176
331
|
}
|
177
332
|
},
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
333
|
+
legendBackgroundColor: CHART_COLORS.LEGEND_BACKGROUND,
|
334
|
+
background2: CHART_COLORS.BACKGROUND,
|
335
|
+
dataLabelsColor: CHART_COLORS.DATA_LABELS,
|
336
|
+
textColor: CHART_COLORS.TEXT,
|
337
|
+
contrastTextColor: CHART_COLORS.CONTRAST_TEXT,
|
338
|
+
maskColor: CHART_COLORS.MASK,
|
184
339
|
lang: {
|
185
340
|
decimalPoint: '.',
|
186
341
|
drillUpText: '< Back'
|
@@ -191,70 +346,30 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
191
346
|
height: 20
|
192
347
|
}
|
193
348
|
},
|
194
|
-
exporting: {
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
highchartsRenderer.highcharts_theme.xAxis.gridLineColor = chartLabelColor;
|
201
|
-
highchartsRenderer.highcharts_theme.xAxis.lineColor = chartLabelColor;
|
202
|
-
highchartsRenderer.highcharts_theme.xAxis.tickColor = chartLabelColor;
|
203
|
-
highchartsRenderer.highcharts_theme.xAxis.labels.style = {
|
204
|
-
"fontFamily": "Poppins, sans-serif",
|
205
|
-
"color": textColor,
|
206
|
-
"font-size": "10px",
|
207
|
-
"font-weight": "bold"
|
208
|
-
};
|
209
|
-
highchartsRenderer.highcharts_theme.xAxis.title.style = {
|
210
|
-
"fontFamily": "Poppins, sans-serif",
|
211
|
-
"color": "#85889c",
|
212
|
-
"font-size": "12px",
|
213
|
-
"font-weight": "bold"
|
214
|
-
};
|
215
|
-
|
216
|
-
highchartsRenderer.highcharts_theme.yAxis.gridLineColor = chartLabelColor;
|
217
|
-
highchartsRenderer.highcharts_theme.yAxis.lineColor = chartLabelColor;
|
218
|
-
highchartsRenderer.highcharts_theme.yAxis.tickColor = chartLabelColor;
|
219
|
-
highchartsRenderer.highcharts_theme.yAxis.labels.style = {
|
220
|
-
"fontFamily": "Poppins, sans-serif",
|
221
|
-
"font-size": "10px",
|
222
|
-
"color": "#85889c"
|
223
|
-
};
|
224
|
-
highchartsRenderer.highcharts_theme.yAxis.title.style = {
|
225
|
-
"fontFamily": "Poppins, sans-serif",
|
226
|
-
"color": "#85889c",
|
227
|
-
"font-size": "12px",
|
228
|
-
"font-weight": "bold"
|
229
|
-
};
|
230
|
-
|
231
|
-
highchartsRenderer.highcharts_theme.tooltip.backgroundColor = "#fff";
|
232
|
-
highchartsRenderer.highcharts_theme.tooltip.style.color = textColor;
|
233
|
-
highchartsRenderer.highcharts_theme.legend.itemStyle.color = textColor;
|
234
|
-
highchartsRenderer.highcharts_theme.legend.itemStyle.fontWeight = 'normal';
|
235
|
-
highchartsRenderer.highcharts_theme.drilldown = {
|
349
|
+
exporting: {
|
350
|
+
enabled: false,
|
351
|
+
sourceWidth: 900
|
352
|
+
},
|
353
|
+
drilldown: {
|
236
354
|
activeAxisLabelStyle: {
|
237
|
-
color:
|
355
|
+
color: CHART_COLORS.TEXT
|
238
356
|
},
|
239
357
|
activeDataLabelStyle: {
|
240
358
|
textDecoration: 'none',
|
241
359
|
}
|
242
360
|
}
|
243
|
-
}
|
361
|
+
};
|
244
362
|
|
245
363
|
Highcharts.setOptions(highchartsRenderer.highcharts_theme);
|
246
364
|
|
365
|
+
/** End of 'Highcharts initial configuration section' **/
|
366
|
+
|
247
367
|
highchartsRenderer.filterFloat = function (value) {
|
248
368
|
if (/^(\-|\+)?([0-9]+(\.[0-9]+)?|Infinity)$/.test(value))
|
249
369
|
return Number(value);
|
250
370
|
return null;
|
251
371
|
};
|
252
372
|
|
253
|
-
highchartsRenderer.delimer = ' , ';
|
254
|
-
|
255
|
-
highchartsRenderer.MAX_ROWS_FOR_AUTO_REFRESH = 100000;
|
256
|
-
highchartsRenderer.MAX_ROWS_FOR_SHOW_RESULTS = 10000;
|
257
|
-
|
258
373
|
highchartsRenderer.setColors = function (colors) {
|
259
374
|
highchartsRenderer.highcharts_theme.colors = colors;
|
260
375
|
Highcharts.setOptions(highchartsRenderer.highcharts_theme);
|
@@ -287,7 +402,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
287
402
|
filtOb.is_excluded = false;
|
288
403
|
} else if (value.excludes) {
|
289
404
|
filtOb.is_excluded = true;
|
290
|
-
filtOb.values = value.excludes
|
405
|
+
filtOb.values = value.excludes;
|
291
406
|
} else {
|
292
407
|
filtOb.is_excluded = false;
|
293
408
|
filtOb.values = value.includes || null;
|
@@ -302,8 +417,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
302
417
|
|
303
418
|
highchartsRenderer.decodeFunc = function (str) {
|
304
419
|
if (str && typeof (str) == 'string') {
|
305
|
-
if (!str || str == '')
|
306
|
-
return '';
|
307
420
|
highchartsRenderer.elem1.innerHTML = str;
|
308
421
|
return highchartsRenderer.elem1.value;
|
309
422
|
}
|
@@ -325,8 +438,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
325
438
|
|
326
439
|
highchartsRenderer.createDashboardFilterObject = function (value) {
|
327
440
|
var filtOb = {};
|
328
|
-
if (value.datetypevalues && value.datetypevalues.datetype
|
329
|
-
filtOb.values = value.datetypevalues
|
441
|
+
if (value.datetypevalues && value.datetypevalues.datetype !== 'list') {
|
442
|
+
filtOb.values = value.datetypevalues;
|
330
443
|
filtOb.is_excluded = false;
|
331
444
|
} else if (value.excludes) {
|
332
445
|
filtOb.is_excluded = true;
|
@@ -369,7 +482,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
369
482
|
if (chartElement.highcharts) {
|
370
483
|
chart = chartElement.highcharts();
|
371
484
|
} else {
|
372
|
-
const
|
485
|
+
const graphIdString = graph_id.split('_')[1];
|
486
|
+
const graphId = Number(graphIdString) || graphIdString;
|
373
487
|
chart = lodash.find(Highcharts.charts, function(value) {
|
374
488
|
return value.options.widgetId === graphId;
|
375
489
|
});
|
@@ -377,15 +491,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
377
491
|
|
378
492
|
if (!chart) return;
|
379
493
|
|
380
|
-
/*if(chart.title && chart.title.textStr){
|
381
|
-
png_name = chart.title.textStr
|
382
|
-
}else{
|
383
|
-
png_name = 'chart'
|
384
|
-
}*/
|
385
|
-
|
386
494
|
if (type === 'png') {
|
387
495
|
chart.exportChartLocal({
|
388
|
-
//type: 'application/png',
|
389
496
|
filename: title
|
390
497
|
});
|
391
498
|
}
|
@@ -429,7 +536,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
429
536
|
var topSlot = '';
|
430
537
|
if (labelOpts.show_percentage_in_labels) {
|
431
538
|
rightSlot = `(${(this.point.percentage).toFixed(2)}%)`;
|
432
|
-
if (labelOpts.show_value_in_labels && value)
|
539
|
+
if (labelOpts.show_value_in_labels && value) {
|
540
|
+
topSlot = `${value}<br>`;
|
541
|
+
}
|
433
542
|
} else if (labelOpts.show_value_in_labels && value) {
|
434
543
|
rightSlot = value;
|
435
544
|
}
|
@@ -467,12 +576,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
467
576
|
|
468
577
|
const labelOptions = lodash.get(opts.chartOptions, 'label') || lodash.get(opts.chartOptions, 'label_pie');
|
469
578
|
const othersName = opts.total_value_options ? highchartsRenderer.getOthersName(opts) : undefined;
|
470
|
-
const drOthersInAxis = highchartsRenderer.getDrOthersInAxisState(pivotData, othersName);
|
579
|
+
const drOthersInAxis = pivotData ? highchartsRenderer.getDrOthersInAxisState(pivotData, othersName) : {};
|
471
580
|
|
472
581
|
var func = function () {
|
473
582
|
var value = parseFloat(this.y);
|
474
583
|
if (pivotData) {
|
475
|
-
let series_name = (this
|
584
|
+
let series_name = highchartsRenderer.getSeriesNameInFormatterContext(this, pivotData);
|
476
585
|
var rows = series_name.split(highchartsRenderer.delimer);
|
477
586
|
|
478
587
|
if (is_drill_down_pie && highchartsRenderer.selfStartsWith(series_name, "Series ")) {
|
@@ -485,7 +594,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
485
594
|
rows = [];
|
486
595
|
}
|
487
596
|
|
488
|
-
var cols =
|
597
|
+
var cols = highchartsRenderer.getColsInFormatterContext(this, pivotData);
|
489
598
|
if (typeof (cols) == 'object' && cols.name) {
|
490
599
|
cols = cols.name;
|
491
600
|
}
|
@@ -559,7 +668,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
559
668
|
// do nothing
|
560
669
|
}
|
561
670
|
}
|
562
|
-
return $.pivotUtilities.getFormattedNumber(value, null, opts);
|
671
|
+
return $.pivotUtilities.getFormattedNumber(value, null, opts).replace(/\u00A0/g, " ");
|
563
672
|
};
|
564
673
|
return func;
|
565
674
|
};
|
@@ -601,6 +710,32 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
601
710
|
return func;
|
602
711
|
};
|
603
712
|
|
713
|
+
highchartsRenderer.customFormatterTooltipInsights = function(pivotData, opts) {
|
714
|
+
return {
|
715
|
+
useHTML: true,
|
716
|
+
outside: true,
|
717
|
+
backgroundColor: 'transparent',
|
718
|
+
borderWidth: 0,
|
719
|
+
borderRadius: 0,
|
720
|
+
shadow: false,
|
721
|
+
shape: 'square',
|
722
|
+
padding: 0,
|
723
|
+
stickOnContact: true,
|
724
|
+
hideDelay: 1500,
|
725
|
+
destroyWhenHiding: true,
|
726
|
+
formatter: function () {
|
727
|
+
const rowKey = pivotData.rowAttrs.length ? lodash.get(this.point, 'series.name') || "" : "";
|
728
|
+
const colKey = lodash.get(this.point, 'name') || this.x.name[0] || "";
|
729
|
+
const insight = pivotData.getInsight(colKey, rowKey) || {};
|
730
|
+
setTimeout(() => {
|
731
|
+
var aggr = highchartsRenderer.defaultFormatterToTooltip(pivotData, opts);
|
732
|
+
const formatted_value_to_return = aggr.bind(this)();
|
733
|
+
opts.insightsTooltipFunc(lodash.merge(lodash.cloneDeep(this), { formatted_value_to_return }, insight));
|
734
|
+
});
|
735
|
+
}
|
736
|
+
}
|
737
|
+
}
|
738
|
+
|
604
739
|
highchartsRenderer.defaultFormatterToTooltip = function (pivotData, opts, is_drill_down_pie) {
|
605
740
|
var variant_name = null;
|
606
741
|
var variant_name_default_name = null;
|
@@ -608,7 +743,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
608
743
|
variant_name = opts.chartOptions.delta_column.name.replace('_', '');
|
609
744
|
variant_name_default_name = opts.chartOptions.delta_column.name;
|
610
745
|
}
|
611
|
-
|
612
746
|
const tooltipOptions = lodash.get(opts, 'chartOptions.tooltips');
|
613
747
|
|
614
748
|
let percentageLabels = {
|
@@ -620,7 +754,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
620
754
|
}
|
621
755
|
|
622
756
|
const othersName = opts.total_value_options ? highchartsRenderer.getOthersName(opts) : undefined;
|
623
|
-
const drOthersInAxis = highchartsRenderer.getDrOthersInAxisState(pivotData, othersName);
|
757
|
+
const drOthersInAxis = pivotData ? highchartsRenderer.getDrOthersInAxisState(pivotData, othersName) : {};
|
624
758
|
|
625
759
|
var func = function () {
|
626
760
|
const isWaterfallBreakdown = this.series.options.className === SERIES_CLASSNAMES.WATERFALL_BREAKDOWN;
|
@@ -629,7 +763,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
629
763
|
|
630
764
|
var y = parseFloat(this.y);
|
631
765
|
if (pivotData) {
|
632
|
-
let series_name = (this
|
766
|
+
let series_name = highchartsRenderer.getSeriesNameInFormatterContext(this, pivotData);
|
633
767
|
var rows = series_name.split(highchartsRenderer.delimer);
|
634
768
|
if (is_drill_down_pie && highchartsRenderer.selfStartsWith(series_name,"Series ")) {
|
635
769
|
rows = [];
|
@@ -640,7 +774,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
640
774
|
rows = [];
|
641
775
|
}
|
642
776
|
|
643
|
-
var cols =
|
777
|
+
var cols = highchartsRenderer.getColsInFormatterContext(this, pivotData);
|
644
778
|
if (!cols && is_drill_down_pie) {
|
645
779
|
cols = this.name;
|
646
780
|
}
|
@@ -662,11 +796,20 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
662
796
|
rows = temp;
|
663
797
|
}
|
664
798
|
|
799
|
+
const colNameToDisplay = lodash.cloneDeep(
|
800
|
+
lodash.get(this, 'point.options.colsForTotal')
|
801
|
+
? isWaterfallWalkthrough
|
802
|
+
? this.key
|
803
|
+
: cols[0]
|
804
|
+
: highchartsRenderer.isFormattingAxisFeatureOn() && lodash.get(this, 'point.name') || cols
|
805
|
+
);
|
806
|
+
|
665
807
|
highchartsRenderer.replaceDrOthersKeys(cols, rows, drOthersInAxis, othersName);
|
666
808
|
|
667
809
|
var category_text = `<span style="font-weight: bold;">
|
668
|
-
${
|
810
|
+
${ colNameToDisplay } ${ isWaterfallBreakdown ? ': ' : ' ' }
|
669
811
|
</span>`;
|
812
|
+
|
670
813
|
if (this.category) {
|
671
814
|
category_text = '';
|
672
815
|
}
|
@@ -876,20 +1019,20 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
876
1019
|
},
|
877
1020
|
theme: {
|
878
1021
|
fill: 'white',
|
879
|
-
color:
|
1022
|
+
color: CHART_COLORS.LABEL_SECOND,
|
880
1023
|
'stroke-width': 1,
|
881
|
-
stroke:
|
1024
|
+
stroke: CHART_COLORS.LABEL_SECOND,
|
882
1025
|
r: 3,
|
883
1026
|
states: {
|
884
1027
|
hover: {
|
885
|
-
fill:
|
886
|
-
stroke:
|
887
|
-
color:
|
1028
|
+
fill: CHART_COLORS.DRILL_UP_FILL,
|
1029
|
+
stroke: CHART_COLORS.LABEL_SECOND,
|
1030
|
+
color: CHART_COLORS.LABEL_SECOND
|
888
1031
|
},
|
889
1032
|
select: {
|
890
|
-
stroke:
|
891
|
-
fill:
|
892
|
-
color:
|
1033
|
+
stroke: CHART_COLORS.LABEL_SECOND,
|
1034
|
+
fill: CHART_COLORS.DRILL_UP_FILL,
|
1035
|
+
color: CHART_COLORS.LABEL_SECOND
|
893
1036
|
}
|
894
1037
|
}
|
895
1038
|
},
|
@@ -901,8 +1044,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
901
1044
|
chartOptions.yAxis && chartOptions.yAxis.title && (chartOptions.yAxis.title.text || chartOptions.yAxis.title.autoylabel) ? -60 : -40;
|
902
1045
|
const y = isPieChart ? 27 :
|
903
1046
|
chartOptions.xAxis && chartOptions.xAxis.title && (chartOptions.xAxis.title.text || chartOptions.xAxis.title.autoxlabel) ? 65 : 43;
|
1047
|
+
chartOptions.chart.spacingBottom = lodash.get(chartOptions, 'xAxis.title') ? 34 : 30;
|
904
1048
|
chartOptions.drilldown.breadcrumbs = {
|
905
|
-
formatter: () => '
|
1049
|
+
formatter: () => 'Back',
|
906
1050
|
showFullPath: false,
|
907
1051
|
position: {
|
908
1052
|
align: 'left',
|
@@ -911,23 +1055,21 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
911
1055
|
y: y,
|
912
1056
|
},
|
913
1057
|
floating: true,
|
1058
|
+
position: { align: 'left', x: 12, y: 6, verticalAlign: 'bottom' },
|
1059
|
+
relativeTo: 'spacingBox',
|
914
1060
|
buttonTheme: {
|
915
|
-
fill:
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
padding: 3,
|
1061
|
+
fill: CHART_COLORS.DRILL_BUTTON_COLOR_FILL,
|
1062
|
+
style: {
|
1063
|
+
fontSize: HIGHCHARTS_CONSTANTS.DRILL_BUTTON_FONT_SIZE,
|
1064
|
+
color: CHART_COLORS.DRILL_BUTTON_COLOR,
|
1065
|
+
},
|
921
1066
|
states: {
|
922
1067
|
hover: {
|
923
|
-
fill:
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
stroke: '#85889c',
|
929
|
-
fill: '#eef3f6',
|
930
|
-
color: '#85889c'
|
1068
|
+
fill: CHART_COLORS.DRILL_BUTTON_COLOR_FILL,
|
1069
|
+
style: {
|
1070
|
+
fontSize: HIGHCHARTS_CONSTANTS.DRILL_BUTTON_FONT_SIZE,
|
1071
|
+
color: CHART_COLORS.DRILL_BUTTON_COLOR_HOVER,
|
1072
|
+
}
|
931
1073
|
}
|
932
1074
|
}
|
933
1075
|
},
|
@@ -946,7 +1088,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
946
1088
|
if (chartOptions.series) {
|
947
1089
|
for (var i = 0; i < chartOptions.series.length; i++) {
|
948
1090
|
seriesDataLength += chartOptions.series[i].data ? chartOptions.series[i].data.length : 0;
|
949
|
-
if (seriesDataLength >
|
1091
|
+
if (seriesDataLength > 1000) {
|
950
1092
|
toMatch = true;
|
951
1093
|
break;
|
952
1094
|
}
|
@@ -1045,17 +1187,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1045
1187
|
let squareXSum = 0;
|
1046
1188
|
ob.data = [];
|
1047
1189
|
if (row_n_value && row_n_value.length > 0) {
|
1048
|
-
ob.
|
1190
|
+
ob.initialName = row_n_value.join(highchartsRenderer.delimer)
|
1049
1191
|
.replace(highchartsRenderer.DR_OTHERS_KEY, othersName);
|
1192
|
+
ob.name = highchartsRenderer.getFormattedRowKey(ob.initialName, pivotData);
|
1050
1193
|
}
|
1051
1194
|
lodash.forEach(col_n_keys, function (col_n_value, index) {
|
1052
1195
|
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
1053
1196
|
var val = agg.value();
|
1054
1197
|
|
1055
|
-
if (col_n_value[0] === highchartsRenderer.DR_OTHERS_KEY) {
|
1056
|
-
col_n_value[0] = othersName;
|
1057
|
-
}
|
1058
|
-
|
1059
1198
|
if (isUniqueVals && agg.uniq)
|
1060
1199
|
val = agg.uniq.join('<br>');
|
1061
1200
|
|
@@ -1078,7 +1217,28 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1078
1217
|
xySum += Number(val) * (index + 1);
|
1079
1218
|
ySum += Number(val);
|
1080
1219
|
squareXSum += (index + 1) * (index + 1);
|
1081
|
-
|
1220
|
+
|
1221
|
+
let key = col_n_value;
|
1222
|
+
if (lodash.isArray(col_n_value)) {
|
1223
|
+
key = lodash.replace(
|
1224
|
+
lodash.join(
|
1225
|
+
lodash.filter(col_n_value, value => !!value),
|
1226
|
+
highchartsRenderer.delimer
|
1227
|
+
),
|
1228
|
+
highchartsRenderer.DR_OTHERS_KEY,
|
1229
|
+
othersName
|
1230
|
+
);
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
ob.data.push(
|
1234
|
+
key
|
1235
|
+
? {
|
1236
|
+
y: val,
|
1237
|
+
initialName: lodash.unescape(key),
|
1238
|
+
name: highchartsRenderer.getFormattedColKey(lodash.unescape(key), pivotData),
|
1239
|
+
}
|
1240
|
+
: val
|
1241
|
+
);
|
1082
1242
|
});
|
1083
1243
|
|
1084
1244
|
if (colors && colors[i]) {
|
@@ -1112,6 +1272,18 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1112
1272
|
|
1113
1273
|
i++;
|
1114
1274
|
});
|
1275
|
+
|
1276
|
+
if (lodash.get(chartOptions, 'xAxis.categories')) {
|
1277
|
+
lodash.forEach(chartOptions.xAxis.categories, (col_n_value, index) => {
|
1278
|
+
if (lodash.isArray(col_n_value)) {
|
1279
|
+
chartOptions.xAxis.categories[index] = lodash.map(
|
1280
|
+
lodash.filter(col_n_value, value => !!value),
|
1281
|
+
value => lodash.replace(value, highchartsRenderer.DR_OTHERS_KEY, othersName)
|
1282
|
+
);
|
1283
|
+
}
|
1284
|
+
});
|
1285
|
+
}
|
1286
|
+
|
1115
1287
|
const ethalonSeries = chart_series[chart_series.length - 1];
|
1116
1288
|
|
1117
1289
|
if (has_delta && additionOptions && additionOptions.delta_column.only_variant) {
|
@@ -1198,8 +1370,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1198
1370
|
var ob = {};
|
1199
1371
|
ob.data = [];
|
1200
1372
|
if (row_n_value && row_n_value.length > 0) {
|
1201
|
-
ob.
|
1373
|
+
ob.initialName = lodash.unescape(row_n_value.join(highchartsRenderer.delimer)
|
1202
1374
|
.replace(highchartsRenderer.DR_OTHERS_KEY, othersName));
|
1375
|
+
ob.name = highchartsRenderer.getFormattedRowKey(ob.initialName, pivotData);
|
1203
1376
|
}
|
1204
1377
|
|
1205
1378
|
ob.dataLabels = {
|
@@ -1236,15 +1409,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1236
1409
|
if (lodash.isArray(col_n_value)) {
|
1237
1410
|
key = col_n_value[0];
|
1238
1411
|
}
|
1239
|
-
tmoobj.
|
1412
|
+
tmoobj.initialName = lodash.unescape(key);
|
1240
1413
|
|
1241
|
-
if (tmoobj.
|
1242
|
-
tmoobj.
|
1414
|
+
if (tmoobj.initialName) {
|
1415
|
+
tmoobj.initialName = tmoobj.initialName.replace(highchartsRenderer.DR_OTHERS_KEY, othersName);
|
1243
1416
|
}
|
1244
1417
|
|
1245
|
-
if (lodash.isEmpty(String(tmoobj.
|
1246
|
-
tmoobj.
|
1418
|
+
if (lodash.isEmpty(String(tmoobj.initialName))) {
|
1419
|
+
tmoobj.initialName = "[blank]";
|
1247
1420
|
}
|
1421
|
+
tmoobj.name = highchartsRenderer.getFormattedColKey(tmoobj.initialName, pivotData);
|
1422
|
+
|
1248
1423
|
tmoobj.y = val;
|
1249
1424
|
if (!isNotDrilldown)
|
1250
1425
|
tmoobj.drilldown = true;
|
@@ -1339,6 +1514,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1339
1514
|
totalSeries.color = colors[i];
|
1340
1515
|
}
|
1341
1516
|
|
1517
|
+
|
1342
1518
|
col_n_keys.forEach(columnKey => {
|
1343
1519
|
let key = columnKey;
|
1344
1520
|
let totalKey = columnKey;
|
@@ -1369,6 +1545,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1369
1545
|
const chart_series = [];
|
1370
1546
|
const row_n_keys = pivotData.getRowKeys();
|
1371
1547
|
const col_n_keys = pivotData.getColKeys();
|
1548
|
+
const rows_by_cols = pivotData.rowKeysByCols;
|
1372
1549
|
|
1373
1550
|
let resultObject = {
|
1374
1551
|
data: [],
|
@@ -1387,17 +1564,20 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1387
1564
|
lodash.forEach(col_n_keys, function(col_n_value, col_index) {
|
1388
1565
|
|
1389
1566
|
const totalColumnValue = pivotData.getAggregator([], col_n_value).value();
|
1567
|
+
const totalName = lodash.unescape(col_n_value).replace(highchartsRenderer.DR_OTHERS_KEY, highchartsRenderer.getOthersName(opts));
|
1390
1568
|
resultObject.data.push({
|
1391
1569
|
y: totalColumnValue,
|
1392
|
-
name:
|
1393
|
-
|
1570
|
+
name: highchartsRenderer.getFormattedColKey(totalName, pivotData),
|
1571
|
+
initialName: totalName,
|
1394
1572
|
isSum: !!col_index,
|
1395
1573
|
isTotal: true,
|
1396
1574
|
color: colorOptions.total,
|
1397
1575
|
});
|
1398
1576
|
|
1399
1577
|
if (col_index !== col_n_keys.length - 1) {
|
1400
|
-
|
1578
|
+
|
1579
|
+
const rowKeys = rows_by_cols ? rows_by_cols[col_index] : row_n_keys;
|
1580
|
+
lodash.forEach(rowKeys, function (row_n_value) {
|
1401
1581
|
const agg = pivotData.getAggregator(row_n_value, col_n_value);
|
1402
1582
|
let val = agg.value();
|
1403
1583
|
|
@@ -1405,18 +1585,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1405
1585
|
if (val) {
|
1406
1586
|
const tmoobj = {};
|
1407
1587
|
const key = lodash.isArray(row_n_value) ? row_n_value[0] : row_n_value;
|
1408
|
-
tmoobj.
|
1588
|
+
tmoobj.initialName = lodash.unescape(key);
|
1409
1589
|
|
1410
|
-
if (tmoobj.
|
1411
|
-
tmoobj.
|
1590
|
+
if (tmoobj.initialName) {
|
1591
|
+
tmoobj.initialName = tmoobj.initialName
|
1412
1592
|
.replace(highchartsRenderer.DR_OTHERS_KEY, highchartsRenderer.getOthersName(opts));
|
1413
1593
|
}
|
1414
1594
|
|
1415
|
-
if (lodash.isEmpty(String(tmoobj.
|
1416
|
-
tmoobj.
|
1595
|
+
if (lodash.isEmpty(String(tmoobj.initialName))) {
|
1596
|
+
tmoobj.initialName = lodash.unescape(col_n_value);
|
1417
1597
|
tmoobj.visible = false;
|
1418
1598
|
}
|
1419
1599
|
|
1600
|
+
tmoobj.name = highchartsRenderer.getFormattedRowKey(tmoobj.initialName, pivotData);
|
1420
1601
|
tmoobj.y = val;
|
1421
1602
|
tmoobj.colKeys = [lodash.unescape(col_n_value), lodash.unescape(col_n_keys[col_index + 1])];
|
1422
1603
|
resultObject.data.push(tmoobj);
|
@@ -1470,10 +1651,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1470
1651
|
lodash.forEach(waterfallOptions.values.walkthrough, function(value, index) {
|
1471
1652
|
|
1472
1653
|
let keys = [];
|
1473
|
-
if (value.trend === 'total') {
|
1654
|
+
if (value.trend === 'total' || highchartsRenderer.isFormattingDatesAsOtherAxisTypes()) {
|
1474
1655
|
keys = value.key;
|
1475
1656
|
} else {
|
1476
|
-
|
1657
|
+
lodash.forEach(value.key, (item) => {
|
1477
1658
|
const findKeyByValue = lodash.find(
|
1478
1659
|
Object.keys(pivotData.dateValuesDictionary || {}),
|
1479
1660
|
key => pivotData.dateValuesDictionary[key] === item
|
@@ -1503,7 +1684,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1503
1684
|
increase: '#20A452',
|
1504
1685
|
};
|
1505
1686
|
|
1506
|
-
|
1687
|
+
let initialName = value.trend === 'total' ? value.formattedKey || value.key[0] : keys.join(highchartsRenderer.delimer);
|
1688
|
+
initialName = lodash.replace(
|
1689
|
+
lodash.unescape(initialName), highchartsRenderer.DR_OTHERS_KEY, highchartsRenderer.getOthersName(opts)
|
1690
|
+
)
|
1691
|
+
let name = value.trend === 'total' ? initialName : highchartsRenderer.getFormattedColKey(initialName, pivotData);
|
1692
|
+
|
1507
1693
|
let color = '';
|
1508
1694
|
|
1509
1695
|
if (!lodash.get(waterfallOptions, 'colors', {}) && value.color) {
|
@@ -1515,18 +1701,18 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1515
1701
|
? lodash.get(waterfallOptions, 'colors', {}).increase || baseColor.increase
|
1516
1702
|
: lodash.get(waterfallOptions, 'colors', {}).decrease || baseColor.decrease;
|
1517
1703
|
}
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
}
|
1704
|
+
if (val !== 0) {
|
1705
|
+
resultObject.data.push({
|
1706
|
+
y: val,
|
1707
|
+
name,
|
1708
|
+
initialName,
|
1709
|
+
totalIndex: value.trend === 'total' ? index : undefined,
|
1710
|
+
isSum: value.trend === 'total',
|
1711
|
+
isTotal: value.trend === 'total',
|
1712
|
+
color,
|
1713
|
+
colsForTotal: value.trend === 'total' ? keys : null,
|
1714
|
+
});
|
1715
|
+
}
|
1530
1716
|
});
|
1531
1717
|
chart_series.push(resultObject);
|
1532
1718
|
chart_series.push(
|
@@ -1565,6 +1751,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1565
1751
|
highchartsRenderer.getVariantSeries = function (series, delta_column_options) {
|
1566
1752
|
const varianceColor = delta_column_options.color || highchartsRenderer.variance_color || Highcharts.getOptions().colors[7];
|
1567
1753
|
series.name = delta_column_options.name.replace('_', '');
|
1754
|
+
series.initialName = series.name;
|
1568
1755
|
series.color = varianceColor;
|
1569
1756
|
|
1570
1757
|
if (delta_column_options.point_click_event) {
|
@@ -1606,11 +1793,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1606
1793
|
series.dataLabels = {y: -8};
|
1607
1794
|
}
|
1608
1795
|
series.marker = {
|
1609
|
-
lineWidth:
|
1796
|
+
lineWidth: 0,
|
1610
1797
|
enabled: true,
|
1611
|
-
radius:
|
1798
|
+
radius: 8,
|
1612
1799
|
lineColor: varianceColor,
|
1613
|
-
fillColor:
|
1800
|
+
fillColor: varianceColor,
|
1614
1801
|
symbol: 'circle',
|
1615
1802
|
states: {
|
1616
1803
|
select: {
|
@@ -1618,25 +1805,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1618
1805
|
fillColor: '#00FF2D',
|
1619
1806
|
lineColor: '#008816',
|
1620
1807
|
lineWidth: 5,
|
1808
|
+
},
|
1809
|
+
hover: {
|
1810
|
+
enabled: false,
|
1811
|
+
lineWidthPlus: 0
|
1621
1812
|
}
|
1622
1813
|
}
|
1623
1814
|
};
|
1624
|
-
|
1625
|
-
series.marker.lineWidth = 0;
|
1626
|
-
series.marker.radius = 8;
|
1627
|
-
series.marker.fillColor = varianceColor;
|
1628
|
-
series.marker.states.hover = {
|
1629
|
-
enabled: false
|
1630
|
-
};
|
1631
|
-
}
|
1632
|
-
|
1633
|
-
series.states = {
|
1634
|
-
hover: {
|
1635
|
-
lineWidthPlus: 0
|
1636
|
-
}
|
1637
|
-
};
|
1638
|
-
}
|
1639
|
-
else if (delta_column_options.chart == 'area') {
|
1815
|
+
} else if (delta_column_options.chart == 'area') {
|
1640
1816
|
series.color = varianceColor;
|
1641
1817
|
series.type = 'area'
|
1642
1818
|
} else if (delta_column_options.chart == 'areaspline') {
|
@@ -1673,15 +1849,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1673
1849
|
|
1674
1850
|
var ob = {};
|
1675
1851
|
// check string contains hebrew
|
1676
|
-
ob.
|
1852
|
+
ob.initialName = (/[\u0590-\u05FF]/).test(key) ? ('\u200E' + key) : key;
|
1677
1853
|
if (lodash.isEmpty(String(ob.name))) {
|
1678
|
-
ob.
|
1854
|
+
ob.initialName = "[blank]";
|
1679
1855
|
}
|
1680
1856
|
|
1681
|
-
if (ob.
|
1682
|
-
ob.
|
1857
|
+
if (ob.initialName === highchartsRenderer.DR_OTHERS_KEY) {
|
1858
|
+
ob.initialName = othersName;
|
1683
1859
|
}
|
1684
1860
|
|
1861
|
+
ob.name = highchartsRenderer.getFormattedColKey(ob.initialName, pivotData);
|
1862
|
+
|
1685
1863
|
ob.y = val;
|
1686
1864
|
if (!isNaN(key))
|
1687
1865
|
key = Number(key)
|
@@ -1713,7 +1891,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1713
1891
|
var col_n = col_n_value[0];
|
1714
1892
|
if (col_n != undefined) {
|
1715
1893
|
col_ob.id = !isNaN(col_n) ? Number(col_n) : col_n;
|
1716
|
-
col_ob.
|
1894
|
+
col_ob.initialName = col_n === highchartsRenderer.DR_OTHERS_KEY ? othersName : col_n;
|
1895
|
+
col_ob.name = highchartsRenderer.getFormattedColKey(col_ob.initialName, pivotData);
|
1717
1896
|
col_ob.data = [];
|
1718
1897
|
lodash.forEach(row_n_keys, function (row_n_value) {
|
1719
1898
|
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
@@ -1728,8 +1907,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1728
1907
|
// }
|
1729
1908
|
}
|
1730
1909
|
|
1731
|
-
const
|
1732
|
-
|
1910
|
+
const row_initial_name = row_n_value[0] === highchartsRenderer.DR_OTHERS_KEY ? othersName : row_n_value[0];
|
1911
|
+
const row_name = highchartsRenderer.getFormattedRowKey(row_initial_name, pivotData);
|
1912
|
+
col_ob.data.push({
|
1913
|
+
name: row_name,
|
1914
|
+
initialName: row_initial_name,
|
1915
|
+
y: val
|
1916
|
+
});
|
1733
1917
|
}
|
1734
1918
|
});
|
1735
1919
|
if (col_ob.data.length) {
|
@@ -1804,7 +1988,32 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1804
1988
|
color: varianceColor
|
1805
1989
|
}
|
1806
1990
|
},
|
1807
|
-
opposite: true
|
1991
|
+
opposite: true,
|
1992
|
+
tickPositioner: function () {
|
1993
|
+
const primaryAxisTicksCount = this.chart.yAxis[0].tickPositions.length;
|
1994
|
+
const minFromSettings = parseInt(lodash.get(opts, 'comboOptions.secondaryAxisSettings.min'));
|
1995
|
+
const maxFromSettings = parseInt(lodash.get(opts, 'comboOptions.secondaryAxisSettings.max'));
|
1996
|
+
let secondaryAxisMin = !isNaN(minFromSettings) ? minFromSettings : this.tickPositions[0];
|
1997
|
+
let secondaryAxisMax = !isNaN(maxFromSettings) ? maxFromSettings : this.tickPositions[this.tickPositions.length - 1];
|
1998
|
+
|
1999
|
+
if (secondaryAxisMin >= secondaryAxisMax) {
|
2000
|
+
if (isNaN(minFromSettings)) {
|
2001
|
+
secondaryAxisMin = secondaryAxisMax - Math.pow(10, secondaryAxisMax.toString().length - 1);
|
2002
|
+
}
|
2003
|
+
if (isNaN(maxFromSettings)) {
|
2004
|
+
secondaryAxisMax = secondaryAxisMin + Math.pow(10, secondaryAxisMin.toString().length - 1);
|
2005
|
+
}
|
2006
|
+
}
|
2007
|
+
|
2008
|
+
const step = (secondaryAxisMax - secondaryAxisMin) / (primaryAxisTicksCount - 1);
|
2009
|
+
const tickPositions = [secondaryAxisMin, secondaryAxisMax];
|
2010
|
+
for (let i = 1; i < primaryAxisTicksCount - 1; i++) {
|
2011
|
+
tickPositions.splice(i, 0, parseFloat((secondaryAxisMin + step * i).toFixed(2)));
|
2012
|
+
}
|
2013
|
+
return tickPositions;
|
2014
|
+
},
|
2015
|
+
gridLineWidth: 0,
|
2016
|
+
tickWidth: 0,
|
1808
2017
|
}
|
1809
2018
|
highchartsRenderer.setYAxisMinMax(chartOptions.yAxis[1], opts.comboOptions.secondaryAxisSettings);
|
1810
2019
|
};
|
@@ -1868,9 +2077,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1868
2077
|
|
1869
2078
|
lodash.forEach(col_n_keys, function (key) {
|
1870
2079
|
var ob = {};
|
1871
|
-
ob.
|
1872
|
-
if (lodash.isEmpty(String(ob.
|
1873
|
-
ob.
|
2080
|
+
ob.initialName = key;
|
2081
|
+
if (lodash.isEmpty(String(ob.initialName))) {
|
2082
|
+
ob.initialName = "[blank]";
|
1874
2083
|
}
|
1875
2084
|
if (row_n_keys && row_n_keys.length > 0) {
|
1876
2085
|
agg = pivotData.getAggregator(row_n_keys[0], key); // tale first row
|
@@ -1878,6 +2087,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1878
2087
|
agg = pivotData.getAggregator([], key);
|
1879
2088
|
}
|
1880
2089
|
ob.y = agg.value();
|
2090
|
+
ob.name = highchartsRenderer.getFormattedColKey(ob.initialName, pivotData);
|
1881
2091
|
pie_series.push(ob);
|
1882
2092
|
});
|
1883
2093
|
|
@@ -1982,7 +2192,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1982
2192
|
}
|
1983
2193
|
};
|
1984
2194
|
|
1985
|
-
chartOptions.xAxis = {
|
2195
|
+
chartOptions.xAxis = {
|
2196
|
+
categories: highchartsRenderer.getFormattedColKeys(pivotData, null),
|
2197
|
+
};
|
1986
2198
|
chartOptions.series = highchartsRenderer.ptCreateBasicLineSeries(pivotData, null, true, null, null, opts, chartOptions);
|
1987
2199
|
|
1988
2200
|
var total = [];
|
@@ -2097,7 +2309,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2097
2309
|
backgroundColor: {
|
2098
2310
|
linearGradient: {x1: 0, y1: 0, x2: 0, y2: 1},
|
2099
2311
|
stops: [
|
2100
|
-
[0,
|
2312
|
+
[0, CHART_COLORS.BACKGROUND],
|
2101
2313
|
[1, '#333']
|
2102
2314
|
]
|
2103
2315
|
},
|
@@ -2108,7 +2320,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2108
2320
|
linearGradient: {x1: 0, y1: 0, x2: 0, y2: 1},
|
2109
2321
|
stops: [
|
2110
2322
|
[0, '#333'],
|
2111
|
-
[1,
|
2323
|
+
[1, CHART_COLORS.BACKGROUND]
|
2112
2324
|
]
|
2113
2325
|
},
|
2114
2326
|
borderWidth: 1,
|
@@ -2124,7 +2336,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2124
2336
|
};
|
2125
2337
|
|
2126
2338
|
|
2127
|
-
chartOptions.xAxis = {
|
2339
|
+
chartOptions.xAxis = {
|
2340
|
+
categories: highchartsRenderer.getFormattedColKeys(pivotData, null),
|
2341
|
+
};
|
2128
2342
|
chartOptions.series = highchartsRenderer.ptCreateBasicLineSeries(pivotData, null, true, null, null, opts, chartOptions);
|
2129
2343
|
|
2130
2344
|
var total = [];
|
@@ -2160,12 +2374,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2160
2374
|
minorTickWidth: 1,
|
2161
2375
|
minorTickLength: 10,
|
2162
2376
|
minorTickPosition: 'inside',
|
2163
|
-
minorTickColor:
|
2377
|
+
minorTickColor: CHART_COLORS.TICK_COLOR,
|
2164
2378
|
tickPixelInterval: 30,
|
2165
2379
|
tickWidth: 2,
|
2166
2380
|
tickPosition: 'inside',
|
2167
2381
|
tickLength: 10,
|
2168
|
-
tickColor:
|
2382
|
+
tickColor: CHART_COLORS.TICK_COLOR,
|
2169
2383
|
labels: {
|
2170
2384
|
step: 2,
|
2171
2385
|
rotation: 'auto'
|
@@ -2390,6 +2604,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2390
2604
|
highchartsRenderer.ptRenderBasicLine = function (pivotData, opts) {
|
2391
2605
|
var chartOptions = {};
|
2392
2606
|
var rowAttrs = pivotData.rowAttrs;
|
2607
|
+
var colAttrs = pivotData.colAttrs;
|
2393
2608
|
|
2394
2609
|
var additionOptions = opts.chartOptions ? opts.chartOptions : highchartsRenderer.getDefaultValueForChart('line-chart');
|
2395
2610
|
|
@@ -2450,16 +2665,23 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2450
2665
|
};
|
2451
2666
|
}
|
2452
2667
|
|
2453
|
-
chartOptions.
|
2454
|
-
|
2455
|
-
|
2456
|
-
}
|
2668
|
+
if (lodash.get(chartOptions, 'plotOptions.series.point.events')) {
|
2669
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
2670
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
2671
|
+
}
|
2672
|
+
|
2673
|
+
chartOptions.tooltip = opts.insightsTooltipFunc
|
2674
|
+
? highchartsRenderer.customFormatterTooltipInsights(pivotData, opts)
|
2675
|
+
: {
|
2676
|
+
formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
|
2677
|
+
valueDecimals: 2,
|
2678
|
+
};
|
2457
2679
|
|
2458
2680
|
chartOptions.xAxis = {
|
2459
|
-
categories:
|
2681
|
+
categories: highchartsRenderer.getFormattedColKeys(pivotData, null),
|
2460
2682
|
title: {
|
2461
2683
|
text: additionOptions && additionOptions.axisX ? additionOptions.axisX.name : '',
|
2462
|
-
}
|
2684
|
+
},
|
2463
2685
|
};
|
2464
2686
|
chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
|
2465
2687
|
chartOptions.series = highchartsRenderer.ptCreateBasicLineSeries(pivotData, null, null, null, additionOptions, opts, chartOptions);
|
@@ -2529,13 +2751,18 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2529
2751
|
};
|
2530
2752
|
}
|
2531
2753
|
|
2754
|
+
if (lodash.get(chartOptions, 'plotOptions.series.point.events')) {
|
2755
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
2756
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
2757
|
+
}
|
2758
|
+
|
2532
2759
|
chartOptions.tooltip = {
|
2533
2760
|
formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
|
2534
2761
|
valueDecimals: 2,
|
2535
2762
|
};
|
2536
2763
|
|
2537
2764
|
chartOptions.xAxis = {
|
2538
|
-
categories:
|
2765
|
+
categories: highchartsRenderer.getFormattedColKeys(pivotData, null),
|
2539
2766
|
title: {
|
2540
2767
|
text: additionOptions && additionOptions.axisX ? additionOptions.axisX.name : '',
|
2541
2768
|
}
|
@@ -2621,6 +2848,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2621
2848
|
};
|
2622
2849
|
}
|
2623
2850
|
|
2851
|
+
if (lodash.get(chartOptions, 'plotOptions.series.point.events')) {
|
2852
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
2853
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
2854
|
+
}
|
2855
|
+
|
2624
2856
|
chartOptions.tooltip = {
|
2625
2857
|
formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
|
2626
2858
|
valueDecimals: 2,
|
@@ -2631,7 +2863,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2631
2863
|
}
|
2632
2864
|
|
2633
2865
|
chartOptions.xAxis = {
|
2634
|
-
categories:
|
2866
|
+
categories: highchartsRenderer.getFormattedColKeys(pivotData, null),
|
2635
2867
|
title: {
|
2636
2868
|
text: additionOptions && additionOptions.axisX ? additionOptions.axisX.name : '',
|
2637
2869
|
}
|
@@ -2679,7 +2911,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2679
2911
|
}
|
2680
2912
|
|
2681
2913
|
chartOptions.xAxis = {
|
2682
|
-
categories:
|
2914
|
+
categories: highchartsRenderer.getFormattedColKeys(pivotData, null),
|
2683
2915
|
tickmarkPlacement: 'on',
|
2684
2916
|
title: {
|
2685
2917
|
text: additionOptions && additionOptions.axisX ? additionOptions.axisX.name : '',
|
@@ -2693,11 +2925,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2693
2925
|
chartOptions.plotOptions = {
|
2694
2926
|
[type === 'area-chart' ? 'area' : 'areaspline']: {
|
2695
2927
|
stacking: 'normal',
|
2696
|
-
lineColor:
|
2928
|
+
lineColor: CHART_COLORS.TICK_COLOR,
|
2697
2929
|
lineWidth: 1,
|
2698
2930
|
marker: {
|
2699
2931
|
lineWidth: 1,
|
2700
|
-
lineColor:
|
2932
|
+
lineColor: CHART_COLORS.TICK_COLOR
|
2701
2933
|
}
|
2702
2934
|
},
|
2703
2935
|
series: {
|
@@ -2780,7 +3012,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2780
3012
|
}
|
2781
3013
|
|
2782
3014
|
chartOptions.xAxis = {
|
2783
|
-
categories:
|
3015
|
+
categories: highchartsRenderer.getFormattedColKeys(pivotData, null),
|
2784
3016
|
tickmarkPlacement: 'on',
|
2785
3017
|
title: {
|
2786
3018
|
text: additionOptions && additionOptions.axisX ? additionOptions.axisX.name : '',
|
@@ -2805,6 +3037,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2805
3037
|
zoomType: additionOptions && additionOptions.chart && additionOptions.chart.zoom_type ? additionOptions.chart.zoom_type : 'None',
|
2806
3038
|
events: {
|
2807
3039
|
'drilldown': function (e) {
|
3040
|
+
highchartsRenderer.modifyEventPointForDrilldown(e, pivotData);
|
2808
3041
|
if (drilldownFunc)
|
2809
3042
|
drilldownFunc(e, this, "drilldown");
|
2810
3043
|
|
@@ -2855,10 +3088,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2855
3088
|
highchartsRenderer.setYAxisMinMax(chartOptions.yAxis, additionOptions.axisY);
|
2856
3089
|
}
|
2857
3090
|
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
2861
|
-
|
3091
|
+
|
3092
|
+
chartOptions.tooltip = opts.insightsTooltipFunc
|
3093
|
+
? highchartsRenderer.customFormatterTooltipInsights(pivotData, opts)
|
3094
|
+
: {
|
3095
|
+
formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
|
3096
|
+
valueDecimals: 2,
|
3097
|
+
};
|
2862
3098
|
|
2863
3099
|
highchartsRenderer.handleGridLines(additionOptions, chartOptions);
|
2864
3100
|
|
@@ -2898,6 +3134,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2898
3134
|
};
|
2899
3135
|
}
|
2900
3136
|
|
3137
|
+
if (lodash.get(chartOptions, 'plotOptions.series.point.events')) {
|
3138
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
3139
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
3140
|
+
}
|
3141
|
+
|
2901
3142
|
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, rowAttrs.length, false);
|
2902
3143
|
|
2903
3144
|
chartOptions.drilldown = highchartsRenderer.getDataLabelsStylesForDrillDown(additionOptions);
|
@@ -2915,6 +3156,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2915
3156
|
zoomType: 'x',
|
2916
3157
|
events: {
|
2917
3158
|
'drilldown': function (e) {
|
3159
|
+
highchartsRenderer.modifyEventPointForDrilldown(e, pivotData);
|
2918
3160
|
if (drilldownFunc)
|
2919
3161
|
drilldownFunc(e, this, "drilldown");
|
2920
3162
|
|
@@ -2990,9 +3232,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
2990
3232
|
|
2991
3233
|
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, rowAttrs.length, false);
|
2992
3234
|
|
2993
|
-
chartOptions.tooltip =
|
2994
|
-
|
2995
|
-
|
3235
|
+
chartOptions.tooltip = opts.insightsTooltipFunc
|
3236
|
+
? highchartsRenderer.customFormatterTooltipInsights(pivotData, opts)
|
3237
|
+
: {
|
3238
|
+
formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
|
3239
|
+
valueDecimals: 2,
|
3240
|
+
};
|
2996
3241
|
|
2997
3242
|
if (additionOptions && additionOptions.chart) {
|
2998
3243
|
chartOptions.colors = highchartsRenderer.getColorsWithOffset(additionOptions.chart.colors_offset);
|
@@ -3030,6 +3275,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3030
3275
|
}
|
3031
3276
|
};
|
3032
3277
|
}
|
3278
|
+
|
3279
|
+
if (lodash.get(chartOptions, 'plotOptions.series.point.events')) {
|
3280
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
3281
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
3282
|
+
}
|
3283
|
+
|
3033
3284
|
chartOptions.xAxis = {
|
3034
3285
|
type: 'category',
|
3035
3286
|
crosshair: true,
|
@@ -3063,6 +3314,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3063
3314
|
type: 'column',
|
3064
3315
|
events: {
|
3065
3316
|
'drilldown': function (e) {
|
3317
|
+
highchartsRenderer.modifyEventPointForDrilldown(e, pivotData);
|
3066
3318
|
if (drilldownFunc)
|
3067
3319
|
drilldownFunc(e, this, "drilldown");
|
3068
3320
|
|
@@ -3125,7 +3377,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3125
3377
|
},
|
3126
3378
|
};
|
3127
3379
|
|
3128
|
-
chartOptions.xAxis = {
|
3380
|
+
chartOptions.xAxis = {
|
3381
|
+
type: 'category',
|
3382
|
+
};
|
3129
3383
|
chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
|
3130
3384
|
chartOptions.series = highchartsRenderer.ptCreateSeriesToDrillDownChart(pivotData, chartOptions, additionOptions, opts);
|
3131
3385
|
//if (drilldownFunc)
|
@@ -3163,20 +3417,22 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3163
3417
|
if (additionOptions) {
|
3164
3418
|
highchartsRenderer.setYAxisMinMax(chartOptions.yAxis, additionOptions.axisY);
|
3165
3419
|
}
|
3166
|
-
chartOptions.tooltip =
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3420
|
+
chartOptions.tooltip = opts.insightsTooltipFunc
|
3421
|
+
? highchartsRenderer.customFormatterTooltipInsights(pivotData, opts)
|
3422
|
+
: {
|
3423
|
+
formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
|
3424
|
+
valueDecimals: 2,
|
3425
|
+
};
|
3170
3426
|
|
3171
3427
|
if (additionOptions && additionOptions.chart) {
|
3172
3428
|
chartOptions.colors = highchartsRenderer.getColorsWithOffset(additionOptions.chart.colors_offset);
|
3173
3429
|
}
|
3174
3430
|
chartOptions.xAxis = {
|
3175
|
-
categories:
|
3431
|
+
categories: highchartsRenderer.getFormattedColKeys(pivotData, null),
|
3176
3432
|
crosshair: true,
|
3177
3433
|
title: {
|
3178
3434
|
text: additionOptions && additionOptions.axisX ? additionOptions.axisX.name : ''
|
3179
|
-
}
|
3435
|
+
},
|
3180
3436
|
};
|
3181
3437
|
chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
|
3182
3438
|
chartOptions.series = highchartsRenderer.ptCreateBasicLineSeries(pivotData, null, null, null, null, opts, chartOptions);
|
@@ -3211,6 +3467,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3211
3467
|
}
|
3212
3468
|
};
|
3213
3469
|
}
|
3470
|
+
|
3471
|
+
if (lodash.get(chartOptions, 'plotOptions.series.point.events')) {
|
3472
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
3473
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
3474
|
+
}
|
3475
|
+
|
3214
3476
|
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, rowAttrs.length, false);
|
3215
3477
|
|
3216
3478
|
return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
|
@@ -3249,10 +3511,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3249
3511
|
}
|
3250
3512
|
return "";
|
3251
3513
|
},
|
3252
|
-
style:
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3514
|
+
style: lodash.merge(
|
3515
|
+
LABEL_DEFAULT_OPTIONS.style,
|
3516
|
+
{
|
3517
|
+
color: lodash.get(additionOptions, `${ highchartsRenderer.getLabelOptionKey(additionOptions) }.font_color`)
|
3518
|
+
|| LABEL_DEFAULT_OPTIONS.color,
|
3519
|
+
},
|
3520
|
+
highchartsRenderer.getDataLabelsStyle(additionOptions)
|
3521
|
+
),
|
3256
3522
|
},
|
3257
3523
|
labels: {
|
3258
3524
|
formatter: highchartsRenderer.defaultValueLabelsFormatter(pivotData, opts)
|
@@ -3262,12 +3528,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3262
3528
|
highchartsRenderer.setYAxisMinMax(chartOptions.yAxis, additionOptions.axisY);
|
3263
3529
|
}
|
3264
3530
|
|
3265
|
-
|
3266
|
-
|
3531
|
+
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, rowAttrs.length, false);
|
3532
|
+
chartOptions.legend.reversed = true;
|
3267
3533
|
|
3268
|
-
chartOptions.tooltip =
|
3269
|
-
|
3270
|
-
|
3534
|
+
chartOptions.tooltip = opts.insightsTooltipFunc
|
3535
|
+
? highchartsRenderer.customFormatterTooltipInsights(pivotData, opts)
|
3536
|
+
: {
|
3537
|
+
formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts)
|
3538
|
+
};
|
3271
3539
|
|
3272
3540
|
if (additionOptions && additionOptions.chart) {
|
3273
3541
|
chartOptions.colors = highchartsRenderer.getColorsWithOffset(additionOptions.chart.colors_offset);
|
@@ -3289,11 +3557,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3289
3557
|
};
|
3290
3558
|
}
|
3291
3559
|
|
3560
|
+
if (lodash.get(chartOptions, 'plotOptions.series.point.events')) {
|
3561
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
3562
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
3563
|
+
}
|
3564
|
+
|
3292
3565
|
chartOptions.xAxis = {
|
3293
|
-
categories:
|
3566
|
+
categories: highchartsRenderer.getFormattedColKeys(pivotData, null),
|
3294
3567
|
title: {
|
3295
3568
|
text: additionOptions && additionOptions.axisX ? additionOptions.axisX.name : ''
|
3296
|
-
}
|
3569
|
+
},
|
3297
3570
|
};
|
3298
3571
|
chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
|
3299
3572
|
chartOptions.series = highchartsRenderer.ptCreateBasicLineSeries(pivotData, null, null, null, null, opts, chartOptions);
|
@@ -3398,11 +3671,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3398
3671
|
};
|
3399
3672
|
}
|
3400
3673
|
|
3674
|
+
if (lodash.get(chartOptions, 'plotOptions.series.point.events')) {
|
3675
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
3676
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
3677
|
+
}
|
3678
|
+
|
3401
3679
|
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
|
3402
3680
|
chartOptions.legend.useHTML = true;
|
3403
3681
|
chartOptions.legend.labelFormatter = function() {
|
3404
3682
|
const name = this.name;
|
3405
|
-
const findTotal =
|
3683
|
+
const findTotal = lodash.find(this.options.data, {isTotal: true});
|
3406
3684
|
const color = lodash.get(findTotal, 'color') ? findTotal.color : this.color;
|
3407
3685
|
return `<span style="margin: 5px; vertical-align: middle; display:inline-block; background-color: ${color};
|
3408
3686
|
width: 12px; height: 12px; border-radius: 50%"></span>
|
@@ -3513,12 +3791,18 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3513
3791
|
}
|
3514
3792
|
};
|
3515
3793
|
}
|
3794
|
+
|
3795
|
+
if (lodash.get(chartOptions, 'plotOptions.series.point.events')) {
|
3796
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
3797
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
3798
|
+
}
|
3799
|
+
|
3516
3800
|
if (waterfallOptions.colors) {
|
3517
3801
|
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
|
3518
3802
|
chartOptions.legend.useHTML = true;
|
3519
3803
|
chartOptions.legend.labelFormatter = function() {
|
3520
3804
|
const name = this.options.className ? 'Total': this.name;
|
3521
|
-
const findTotal =
|
3805
|
+
const findTotal = lodash.find(this.options.data, {isTotal: true});
|
3522
3806
|
const color = lodash.get(findTotal, 'color') ? findTotal.color : this.color;
|
3523
3807
|
return '<span style="margin: 5px; vertical-align: middle; display:inline-block; background-color: '+ color + '; width: 12px; height: 12px; border-radius: 50%"></span><span style="color: #000; display: inline-block; margin: 5px; vertical-align: middle;">' + name + '</span>';
|
3524
3808
|
}
|
@@ -3684,6 +3968,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3684
3968
|
calculated_formats: calculated_info.formats,
|
3685
3969
|
isChangeable: false,
|
3686
3970
|
push: function (record) {
|
3971
|
+
if (highchartsRenderer.enabledNewWidgetValueFormatting) {
|
3972
|
+
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
3973
|
+
}
|
3974
|
+
|
3687
3975
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
3688
3976
|
this.data_types = this.data_types.concat(record['data_types']);
|
3689
3977
|
this.data_types = lodash.uniq(this.data_types);
|
@@ -3702,7 +3990,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3702
3990
|
this.ignoreValue = true;
|
3703
3991
|
}
|
3704
3992
|
|
3705
|
-
if (useTotalsCalculation && !isNaN(parseFloat(record[attr]))) {
|
3993
|
+
if (highchartsRenderer.useTotalsCalculation && !isNaN(parseFloat(record[attr]))) {
|
3706
3994
|
return this.sum = parseFloat(record[attr]);
|
3707
3995
|
} else if (!isNaN(parseFloat(record[attr]))) {
|
3708
3996
|
return this.sum += parseFloat(record[attr]);
|
@@ -3728,7 +4016,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3728
4016
|
number_format = 'General';
|
3729
4017
|
}
|
3730
4018
|
|
3731
|
-
if (this.widget_values_format) {
|
4019
|
+
if (this.widget_values_format && highchartsRenderer.isUsingWidgetValuesFormat(data, render_options, widget_values_format)) {
|
3732
4020
|
number_format = this.widget_values_format;
|
3733
4021
|
}
|
3734
4022
|
|
@@ -3836,7 +4124,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3836
4124
|
}
|
3837
4125
|
}
|
3838
4126
|
var val = parseFloat(record[attr]);
|
4127
|
+
|
3839
4128
|
if (!isNaN(val)) {
|
4129
|
+
if (highchartsRenderer.enabledNewWidgetValueFormatting) {
|
4130
|
+
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
4131
|
+
}
|
3840
4132
|
|
3841
4133
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
3842
4134
|
this.data_types = this.data_types.concat(record['data_types']);
|
@@ -3856,7 +4148,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3856
4148
|
this.ignoreValue = true;
|
3857
4149
|
}
|
3858
4150
|
|
3859
|
-
if (useTotalsCalculation) {
|
4151
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
3860
4152
|
return this.sum = val;
|
3861
4153
|
} else {
|
3862
4154
|
return this.sum += val;
|
@@ -3883,13 +4175,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3883
4175
|
number_format = 'General';
|
3884
4176
|
}
|
3885
4177
|
|
3886
|
-
if (this.widget_values_format) {
|
4178
|
+
if (this.widget_values_format && highchartsRenderer.isUsingWidgetValuesFormat(data, render_options, widget_values_format)) {
|
3887
4179
|
number_format = this.widget_values_format;
|
3888
4180
|
}
|
3889
4181
|
|
3890
4182
|
number_format = highchartsRenderer.getCalculatedValueFormat(this.calculated_formats, rowKey, colKey) || number_format;
|
3891
|
-
|
3892
4183
|
var formated_value = highchartsRenderer.formatValue('n', number_format, x)
|
4184
|
+
|
3893
4185
|
if (formated_value && formated_value.hasOwnProperty('value') && formated_value.value != null) {
|
3894
4186
|
return formated_value.value;
|
3895
4187
|
} else {
|
@@ -3927,6 +4219,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3927
4219
|
var ref, x;
|
3928
4220
|
x = parseFloat(record[attr]);
|
3929
4221
|
if (!isNaN(x)) {
|
4222
|
+
if (highchartsRenderer.enabledNewWidgetValueFormatting) {
|
4223
|
+
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
4224
|
+
}
|
4225
|
+
|
3930
4226
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
3931
4227
|
this.data_types = this.data_types.concat(record['data_types']);
|
3932
4228
|
this.data_types = lodash.uniq(this.data_types);
|
@@ -3944,7 +4240,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3944
4240
|
if (highchartsRenderer.ignoreIfCalculatedValue(data, rowKey, colKey, record, calculated_info.associated_fields, render_options, is_graph)) {
|
3945
4241
|
this.ignoreValue = true;
|
3946
4242
|
}
|
3947
|
-
if (useTotalsCalculation) {
|
4243
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
3948
4244
|
return this.val = x;
|
3949
4245
|
} else {
|
3950
4246
|
return this.val = Math.min(x, (ref = this.val) != null ? ref : x);
|
@@ -3969,7 +4265,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3969
4265
|
number_format = 'General';
|
3970
4266
|
}
|
3971
4267
|
|
3972
|
-
if (this.widget_values_format) {
|
4268
|
+
if (this.widget_values_format && highchartsRenderer.isUsingWidgetValuesFormat(data, render_options, widget_values_format)) {
|
3973
4269
|
number_format = this.widget_values_format;
|
3974
4270
|
}
|
3975
4271
|
|
@@ -4013,6 +4309,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4013
4309
|
var ref, x;
|
4014
4310
|
x = parseFloat(record[attr]);
|
4015
4311
|
if (!isNaN(x)) {
|
4312
|
+
if (highchartsRenderer.enabledNewWidgetValueFormatting) {
|
4313
|
+
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
4314
|
+
}
|
4315
|
+
|
4016
4316
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
4017
4317
|
this.data_types = this.data_types.concat(record['data_types']);
|
4018
4318
|
this.data_types = lodash.uniq(this.data_types);
|
@@ -4031,11 +4331,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4031
4331
|
this.ignoreValue = true;
|
4032
4332
|
}
|
4033
4333
|
|
4034
|
-
if (useTotalsCalculation) {
|
4334
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
4035
4335
|
return this.val = x;
|
4036
4336
|
} else {
|
4037
|
-
return this.val = Math.
|
4038
|
-
}
|
4337
|
+
return this.val = Math.max(x, (ref = this.val) != null ? ref : x);
|
4338
|
+
}
|
4339
|
+
}
|
4039
4340
|
},
|
4040
4341
|
value: function () {
|
4041
4342
|
if (this.ignoreValue) {
|
@@ -4055,7 +4356,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4055
4356
|
number_format = 'General';
|
4056
4357
|
}
|
4057
4358
|
|
4058
|
-
if (this.widget_values_format) {
|
4359
|
+
if (this.widget_values_format && highchartsRenderer.isUsingWidgetValuesFormat(data, render_options, widget_values_format)) {
|
4059
4360
|
number_format = this.widget_values_format;
|
4060
4361
|
}
|
4061
4362
|
|
@@ -4100,6 +4401,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4100
4401
|
var ref, x;
|
4101
4402
|
x = parseFloat(record[attr]);
|
4102
4403
|
if (!isNaN(x)) {
|
4404
|
+
if (highchartsRenderer.enabledNewWidgetValueFormatting) {
|
4405
|
+
record.formats = highchartsRenderer.getRecordFormats(render_options, record['DR_Values']);
|
4406
|
+
}
|
4407
|
+
|
4103
4408
|
if (record.hasOwnProperty('data_types') && $.isArray(record['data_types'])) {
|
4104
4409
|
this.data_types = this.data_types.concat(record['data_types']);
|
4105
4410
|
this.data_types = lodash.uniq(this.data_types);
|
@@ -4119,7 +4424,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4119
4424
|
}
|
4120
4425
|
|
4121
4426
|
|
4122
|
-
if (useTotalsCalculation) {
|
4427
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
4123
4428
|
this.sum = parseFloat(x);
|
4124
4429
|
} else {
|
4125
4430
|
this.sum += parseFloat(x);
|
@@ -4132,7 +4437,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4132
4437
|
if (this.ignoreValue) {
|
4133
4438
|
return null;
|
4134
4439
|
}
|
4135
|
-
if (useTotalsCalculation) {
|
4440
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
4136
4441
|
return this.sum;
|
4137
4442
|
}
|
4138
4443
|
return this.sum / this.len;
|
@@ -4149,7 +4454,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4149
4454
|
number_format = 'General';
|
4150
4455
|
}
|
4151
4456
|
|
4152
|
-
if (this.widget_values_format) {
|
4457
|
+
if (this.widget_values_format && highchartsRenderer.isUsingWidgetValuesFormat(data, render_options, widget_values_format)) {
|
4153
4458
|
number_format = this.widget_values_format;
|
4154
4459
|
}
|
4155
4460
|
|
@@ -4168,224 +4473,38 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4168
4473
|
};
|
4169
4474
|
};
|
4170
4475
|
|
4171
|
-
highchartsRenderer.
|
4172
|
-
|
4173
|
-
|
4174
|
-
|
4175
|
-
|
4176
|
-
|
4177
|
-
|
4178
|
-
|
4179
|
-
flatKey = colKeys[i].join($.pivotUtilities.delim);
|
4180
|
-
if (colTotals[flatKey])
|
4181
|
-
colTotalsWithoutSubTotals[flatKey] = colTotals[flatKey];
|
4182
|
-
}
|
4183
|
-
|
4184
|
-
var filterFunc = highchartsRenderer.getTotalsFilter(totalFilters.type, totalFilters.value, totalFilters.is_absolute, colTotalsWithoutSubTotals)
|
4185
|
-
for (var j in colKeys) {
|
4186
|
-
var totalVal = pivotData.getAggregator([], colKeys[j]).value();
|
4187
|
-
if (filterFunc(totalVal)) {
|
4188
|
-
colIndexesToFilter.push(j)
|
4476
|
+
highchartsRenderer.getAxis = function (axis, opts, farceIsTable = false) {
|
4477
|
+
let is_transpose = lodash.get(opts, 'rendererOptions.chartOptions.table_options.transpose_table', false);
|
4478
|
+
let is_table = opts.isTable;
|
4479
|
+
if (is_transpose && (is_table || farceIsTable)) {
|
4480
|
+
if (axis == 'col_total') {
|
4481
|
+
return 'row_total';
|
4482
|
+
} else {
|
4483
|
+
return 'col_total';
|
4189
4484
|
}
|
4190
4485
|
}
|
4486
|
+
return axis;
|
4487
|
+
};
|
4191
4488
|
|
4192
|
-
|
4193
|
-
|
4194
|
-
|
4195
|
-
|
4196
|
-
keyAttListToFilter.push(pivotData.colKeys[key])
|
4197
|
-
}
|
4489
|
+
highchartsRenderer.sanitizeOptions = function (opts) {
|
4490
|
+
if (opts && opts.rendererOptions) {
|
4491
|
+
if (opts.rendererOptions.chart_title) {
|
4492
|
+
opts.rendererOptions.chart_title = highchartsRenderer.decodeFunc(opts.rendererOptions.chart_title);
|
4198
4493
|
}
|
4199
4494
|
}
|
4200
|
-
return keyAttListToFilter;
|
4201
|
-
};
|
4202
|
-
|
4203
|
-
highchartsRenderer.createTotalRowFiltersArr = function (rowKeys, rowTotals, totalFilters, pivotData) {
|
4204
|
-
var rowIndexesToFilter = [];
|
4205
|
-
if (!totalFilters || !totalFilters.type)
|
4206
|
-
return rowIndexesToFilter;
|
4207
4495
|
|
4208
|
-
|
4209
|
-
|
4210
|
-
for (i in rowKeys) {
|
4211
|
-
flatKey = rowKeys[i].join($.pivotUtilities.delim);
|
4212
|
-
if (rowTotals[flatKey])
|
4213
|
-
rowTotalsWithoutSubTotals[flatKey] = rowTotals[flatKey];
|
4496
|
+
if (opts && opts.chartOptions && opts.chartOptions.subtitle) {
|
4497
|
+
opts.chartOptions.subtitle.subtitle = highchartsRenderer.decodeFunc(opts.chartOptions.subtitle.subtitle);
|
4214
4498
|
}
|
4215
4499
|
|
4216
|
-
|
4217
|
-
|
4218
|
-
var totalVal = pivotData.getAggregator(rowKeys[j], []).value();
|
4219
|
-
if (filterFunc(totalVal)) {
|
4220
|
-
rowIndexesToFilter.push(j)
|
4221
|
-
}
|
4500
|
+
if (opts && opts.rendererOptions && opts.rendererOptions.chartOptions && opts.rendererOptions.chartOptions.subtitle) {
|
4501
|
+
opts.rendererOptions.chartOptions.subtitle.subtitle = highchartsRenderer.decodeFunc(opts.rendererOptions.chartOptions.subtitle.subtitle);
|
4222
4502
|
}
|
4223
4503
|
|
4224
|
-
let keyAttListToFilter = [];
|
4225
|
-
for (var attr in pivotData.rowAttrs) {
|
4226
|
-
for (var key in pivotData.rowKeys) {
|
4227
|
-
if ($.inArray(key, rowIndexesToFilter) >= 0) {
|
4228
|
-
keyAttListToFilter.push(pivotData.rowKeys[key])
|
4229
|
-
}
|
4230
|
-
}
|
4231
|
-
}
|
4232
|
-
return keyAttListToFilter;
|
4233
4504
|
};
|
4234
4505
|
|
4235
|
-
highchartsRenderer.
|
4236
|
-
|
4237
|
-
switch (type) {
|
4238
|
-
case "filter_above":
|
4239
|
-
if (is_absolute)
|
4240
|
-
filter = (a) => Math.abs(a) <= vals[0];
|
4241
|
-
else
|
4242
|
-
filter = (a) => a <= vals[0];
|
4243
|
-
break;
|
4244
|
-
case "filter_below":
|
4245
|
-
if (is_absolute)
|
4246
|
-
filter = (a) => Math.abs(a) >= vals[0];
|
4247
|
-
else
|
4248
|
-
filter = (a) => a >= vals[0];
|
4249
|
-
break;
|
4250
|
-
case "filter_between":
|
4251
|
-
if (is_absolute)
|
4252
|
-
filter = (a) => Math.abs(a) <= vals[0] || Math.abs(a) >= vals[1];
|
4253
|
-
else
|
4254
|
-
filter = (a) => a <= vals[0] || a >= vals[1];
|
4255
|
-
break;
|
4256
|
-
case "filter_out_of_range":
|
4257
|
-
if (is_absolute)
|
4258
|
-
filter = (a) => Math.abs(a) >= vals[0] && Math.abs(a) <= vals[1];
|
4259
|
-
else
|
4260
|
-
filter = (a) => a >= vals[0] && a <= vals[1];
|
4261
|
-
break;
|
4262
|
-
case "filter_top_x":
|
4263
|
-
var topx;
|
4264
|
-
if (is_absolute)
|
4265
|
-
topx = lodash.map(totals, (x) => Math.abs(x.value())).filter((v, i, a) => a.indexOf(v) === i).sort((a, b) => b - a).slice(0, vals[0]).pop();
|
4266
|
-
else
|
4267
|
-
topx = lodash.map(totals, (x) => x.value()).filter((v, i, a) => a.indexOf(v) === i).sort((a, b) => b - a).slice(0, vals[0]).pop();
|
4268
|
-
|
4269
|
-
if (topx != undefined) {
|
4270
|
-
if (is_absolute)
|
4271
|
-
filter = (a) => Math.abs(a) < topx;
|
4272
|
-
else
|
4273
|
-
filter = (a) => a < topx;
|
4274
|
-
}
|
4275
|
-
break;
|
4276
|
-
case "filter_bottom_x":
|
4277
|
-
var bottomx;
|
4278
|
-
if (is_absolute)
|
4279
|
-
bottomx = lodash.map(totals, (x) => Math.abs(x.value())).filter((v, i, a) => a.indexOf(v) === i).sort((a, b) => a - b).slice(0, vals[0]).pop();
|
4280
|
-
else
|
4281
|
-
bottomx = lodash.map(totals, (x) => x.value()).filter((v, i, a) => a.indexOf(v) === i).sort((a, b) => a - b).slice(0, vals[0]).pop();
|
4282
|
-
|
4283
|
-
if (bottomx != undefined) {
|
4284
|
-
if (is_absolute)
|
4285
|
-
filter = (a) => Math.abs(a) > bottomx;
|
4286
|
-
else
|
4287
|
-
filter = (a) => a > bottomx;
|
4288
|
-
}
|
4289
|
-
break;
|
4290
|
-
case "filter_smallest":
|
4291
|
-
const smallest_sumOfFields = lodash.reduce(totals, (acc, curr) => acc += curr.sum, 0);
|
4292
|
-
const smallest = Math.floor((smallest_sumOfFields * vals[0])/100);
|
4293
|
-
|
4294
|
-
if (is_absolute)
|
4295
|
-
filter = (a) => Math.abs(a) > smallest;
|
4296
|
-
else
|
4297
|
-
filter = (a) => a > smallest;
|
4298
|
-
break;
|
4299
|
-
case "filter_largest":
|
4300
|
-
const largest_sumOfFields = lodash.reduce(totals, (acc, curr) => acc += curr.sum, 0);
|
4301
|
-
const largest = Math.floor((largest_sumOfFields * vals[0])/100);
|
4302
|
-
|
4303
|
-
if (is_absolute)
|
4304
|
-
filter = (a) => Math.abs(a) < largest;
|
4305
|
-
else
|
4306
|
-
filter = (a) => a < largest;
|
4307
|
-
break;
|
4308
|
-
case "filter_out_zero":
|
4309
|
-
if (is_absolute)
|
4310
|
-
filter = (a) => Math.abs(a) == 0;
|
4311
|
-
else
|
4312
|
-
filter = (a) => a == 0;
|
4313
|
-
break;
|
4314
|
-
default:
|
4315
|
-
|
4316
|
-
}
|
4317
|
-
return filter;
|
4318
|
-
};
|
4319
|
-
|
4320
|
-
highchartsRenderer.getAxis = function (axis, opts, farceIsTable = false) {
|
4321
|
-
let is_transpose = lodash.get(opts, 'rendererOptions.chartOptions.table_options.transpose_table', false);
|
4322
|
-
let is_table = opts.isTable;
|
4323
|
-
if (is_transpose && (is_table || farceIsTable)) {
|
4324
|
-
if (axis == 'col_total') {
|
4325
|
-
return 'row_total';
|
4326
|
-
} else {
|
4327
|
-
return 'col_total';
|
4328
|
-
}
|
4329
|
-
}
|
4330
|
-
return axis;
|
4331
|
-
};
|
4332
|
-
|
4333
|
-
highchartsRenderer.generateFilteredResult = function (totalFilters, optsFiltered, rowData, opts, pivotData) {
|
4334
|
-
let keyAttListToFilter;
|
4335
|
-
let axis = highchartsRenderer.getAxis(totalFilters.filter_options.axis, opts);
|
4336
|
-
|
4337
|
-
if (axis == 'col_total') {
|
4338
|
-
keyAttListToFilter = highchartsRenderer.createTotalColFiltersArr(pivotData.colKeys, pivotData.colTotals, totalFilters.filter_options, pivotData);
|
4339
|
-
return highchartsRenderer.generateFilteredResultForRowAndCol(keyAttListToFilter, optsFiltered, pivotData.colAttrs, rowData, opts, pivotData);
|
4340
|
-
} else if (axis == 'row_total') {
|
4341
|
-
keyAttListToFilter = highchartsRenderer.createTotalRowFiltersArr(pivotData.rowKeys, pivotData.rowTotals, totalFilters.filter_options, pivotData);
|
4342
|
-
return highchartsRenderer.generateFilteredResultForRowAndCol(keyAttListToFilter, optsFiltered, pivotData.rowAttrs, rowData, opts, pivotData);
|
4343
|
-
} else {
|
4344
|
-
return opts.renderer(pivotData, opts.rendererOptions);
|
4345
|
-
}
|
4346
|
-
};
|
4347
|
-
|
4348
|
-
highchartsRenderer.generateFilteredResultForRowAndCol = function (keyAttListToFilter, optsFiltered, attrs, rowData, opts, pivotData) {
|
4349
|
-
let pivotDataFiltered = pivotData;
|
4350
|
-
if (!lodash.isEmpty(keyAttListToFilter)) {
|
4351
|
-
var myfilter = function (rec) {
|
4352
|
-
for (var i in keyAttListToFilter) {
|
4353
|
-
var allsame = true;
|
4354
|
-
var find_one = lodash.find(attrs, function (val, j) {
|
4355
|
-
return ((rec[val] != keyAttListToFilter[i][j]) && !(!rec[val] && keyAttListToFilter[i][j] == "null"))
|
4356
|
-
});
|
4357
|
-
if (find_one == undefined) {
|
4358
|
-
return false;
|
4359
|
-
}
|
4360
|
-
}
|
4361
|
-
return true;
|
4362
|
-
}
|
4363
|
-
optsFiltered.filter = myfilter;
|
4364
|
-
|
4365
|
-
pivotDataFiltered = $.pivotUtilities.getPivotDataModel(rowData, optsFiltered);
|
4366
|
-
}
|
4367
|
-
return opts.renderer(pivotDataFiltered, opts.rendererOptions);
|
4368
|
-
};
|
4369
|
-
|
4370
|
-
highchartsRenderer.sanitizeOptions = function (opts) {
|
4371
|
-
if (opts && opts.rendererOptions) {
|
4372
|
-
if (opts.rendererOptions.chart_title) {
|
4373
|
-
opts.rendererOptions.chart_title = highchartsRenderer.decodeFunc(opts.rendererOptions.chart_title);
|
4374
|
-
}
|
4375
|
-
}
|
4376
|
-
|
4377
|
-
if (opts && opts.chartOptions && opts.chartOptions.subtitle) {
|
4378
|
-
opts.chartOptions.subtitle.subtitle = highchartsRenderer.decodeFunc(opts.chartOptions.subtitle.subtitle);
|
4379
|
-
}
|
4380
|
-
|
4381
|
-
if (opts && opts.rendererOptions && opts.rendererOptions.chartOptions && opts.rendererOptions.chartOptions.subtitle) {
|
4382
|
-
opts.rendererOptions.chartOptions.subtitle.subtitle = highchartsRenderer.decodeFunc(opts.rendererOptions.chartOptions.subtitle.subtitle);
|
4383
|
-
}
|
4384
|
-
|
4385
|
-
};
|
4386
|
-
|
4387
|
-
highchartsRenderer.getIconsForTotalOptions = function (options, axis) {
|
4388
|
-
let tr_axis = axis;
|
4506
|
+
highchartsRenderer.getIconsForTotalOptions = function (options, axis) {
|
4507
|
+
let tr_axis = axis;
|
4389
4508
|
|
4390
4509
|
let ret_str = '';
|
4391
4510
|
if (options && options.total_value_options && options.total_value_options.filter_options && options.total_value_options.filter_options.axis == tr_axis) {
|
@@ -4396,72 +4515,42 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4396
4515
|
return ret_str;
|
4397
4516
|
};
|
4398
4517
|
|
4399
|
-
highchartsRenderer.
|
4400
|
-
let rowAttrs, rowKeys, colKeys, colAttrs;
|
4401
|
-
rowAttrs = pivotData.rowAttrs;
|
4402
|
-
rowKeys = pivotData.rowKeys;
|
4403
|
-
colKeys = pivotData.colKeys;
|
4404
|
-
colAttrs = pivotData.colAttrs;
|
4405
|
-
|
4406
|
-
|
4407
|
-
if (!colAttrs || colAttrs.length == 0) {
|
4408
|
-
return null;
|
4409
|
-
}
|
4410
|
-
|
4518
|
+
highchartsRenderer.getSortingByValueOrderList = function (pivotData, sortingOptions, keysArray, attrs, fieldIndex, widget) {
|
4411
4519
|
let values_names_arr = [];
|
4412
|
-
let keysArray = sortingOptions.field ? rowKeys : colKeys;
|
4413
|
-
|
4414
4520
|
lodash.forEach(keysArray, function (val) {
|
4415
|
-
|
4416
|
-
|
4417
|
-
|
4418
|
-
|
4419
|
-
if (
|
4420
|
-
|
4421
|
-
|
4422
|
-
|
4423
|
-
|
4424
|
-
|
4425
|
-
|
4426
|
-
|
4427
|
-
|
4428
|
-
// ORDERING
|
4429
|
-
let sorting_vector = ['asc'];
|
4430
|
-
if (sortingOptions && sortingOptions.type == 'largestToSmallest') {
|
4431
|
-
sorting_vector = ['desc'];
|
4432
|
-
}
|
4433
|
-
values_names_arr = lodash.orderBy(values_names_arr, ['value'], sorting_vector);
|
4434
|
-
|
4435
|
-
// map only names
|
4436
|
-
let attr_sorted_values = lodash.map(values_names_arr, 'name');
|
4437
|
-
return {name: sortingOptions.field ? rowAttrs[0] : colAttrs[0], values: attr_sorted_values};
|
4438
|
-
};
|
4521
|
+
const firstArray = [];
|
4522
|
+
const secondArray = val.slice(0, fieldIndex + 1);
|
4523
|
+
|
4524
|
+
let valueForComparison;
|
4525
|
+
if (sortingOptions.sort_by === 'variance') {
|
4526
|
+
const varianceConfig = widget.options.chartOptions.delta_column;
|
4527
|
+
const data = pivotData.input;
|
4528
|
+
const varianceField = varianceConfig.field === 'category' ? widget.cols[0] : widget.rows[0];
|
4529
|
+
const varianceRowsForCurrentKey = lodash.filter(data, row =>
|
4530
|
+
row[varianceField.name] === varianceConfig.name
|
4531
|
+
&& lodash.every(secondArray, (item, index) => row[attrs[index]] === item)
|
4532
|
+
);
|
4439
4533
|
|
4440
|
-
|
4441
|
-
|
4442
|
-
|
4443
|
-
rowKeys = pivotData.rowKeys;
|
4444
|
-
colKeys = pivotData.colKeys;
|
4445
|
-
colAttrs = pivotData.colAttrs;
|
4534
|
+
valueForComparison = lodash.reduce(varianceRowsForCurrentKey, (a, d) => a + d[widget.vals[0].name], 0);
|
4535
|
+
} else {
|
4536
|
+
let getAggregatorParams = [firstArray, secondArray];
|
4446
4537
|
|
4447
|
-
|
4448
|
-
|
4449
|
-
|
4538
|
+
if (lodash.includes(pivotData.rowAttrs, attrs[fieldIndex])) {
|
4539
|
+
getAggregatorParams = lodash.reverse(getAggregatorParams);
|
4540
|
+
}
|
4450
4541
|
|
4451
|
-
|
4452
|
-
let keysArray = sortingOptions.field ? colKeys : rowKeys;
|
4542
|
+
let aggregator_subtotal = pivotData.getAggregator(...getAggregatorParams);
|
4453
4543
|
|
4454
|
-
|
4455
|
-
|
4456
|
-
|
4457
|
-
|
4544
|
+
if (aggregator_subtotal) {
|
4545
|
+
valueForComparison = aggregator_subtotal.value();
|
4546
|
+
}
|
4547
|
+
}
|
4458
4548
|
|
4459
|
-
if (
|
4460
|
-
|
4461
|
-
|
4462
|
-
value_subtotal = Math.abs(value_subtotal);
|
4549
|
+
if (!lodash.isNil(valueForComparison)) {
|
4550
|
+
if (sortingOptions && sortingOptions.is_absolute && !isNaN(parseFloat(valueForComparison))) {
|
4551
|
+
valueForComparison = Math.abs(valueForComparison);
|
4463
4552
|
}
|
4464
|
-
values_names_arr.push({name:
|
4553
|
+
values_names_arr.push({name: secondArray.join(','), value: valueForComparison});
|
4465
4554
|
}
|
4466
4555
|
});
|
4467
4556
|
|
@@ -4473,36 +4562,33 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4473
4562
|
values_names_arr = lodash.orderBy(values_names_arr, ['value'], sorting_vector);
|
4474
4563
|
|
4475
4564
|
// map only names
|
4476
|
-
|
4477
|
-
return {name: sortingOptions.field ? colAttrs[0] : rowAttrs[0], values: attr_sorted_values};
|
4565
|
+
return lodash.map(values_names_arr, 'name');
|
4478
4566
|
};
|
4479
4567
|
|
4480
|
-
highchartsRenderer.generateSortingFunctionByValues = function (
|
4481
|
-
let new_map;
|
4482
|
-
let axis = highchartsRenderer.getAxis(sortingOptions.axis, opts);
|
4483
|
-
if (axis == 'col_total') {
|
4484
|
-
new_map = highchartsRenderer.getNewAttrSortingForCol(pivotData, sortingOptions);
|
4485
|
-
} else if (axis == 'row_total') {
|
4486
|
-
new_map = highchartsRenderer.getNewAttrSortingForRow(pivotData, sortingOptions);
|
4487
|
-
}
|
4488
|
-
|
4568
|
+
highchartsRenderer.generateSortingFunctionByValues = function (sortByValueSettings, pivotData, opts, widget) {
|
4489
4569
|
let old_sorters_function = opts.sorters;
|
4490
4570
|
if (!old_sorters_function) {
|
4491
4571
|
old_sorters_function = function () {
|
4492
4572
|
};
|
4493
4573
|
}
|
4494
|
-
|
4495
|
-
|
4496
|
-
|
4497
|
-
|
4498
|
-
|
4499
|
-
|
4500
|
-
|
4501
|
-
|
4574
|
+
return function (attr) {
|
4575
|
+
const sortingOptions = lodash.find(sortByValueSettings, fieldSorting => fieldSorting.name === attr);
|
4576
|
+
if (sortingOptions) {
|
4577
|
+
const axis = highchartsRenderer.getAxis(_.includes(pivotData.colAttrs, attr) ? 'col_total' : 'row_total', opts);
|
4578
|
+
const isColumnSort = axis === 'col_total';
|
4579
|
+
const fieldIndex = lodash.findIndex(isColumnSort ? pivotData.colAttrs : pivotData.rowAttrs, name => name === attr);
|
4580
|
+
const orderedNamesList = highchartsRenderer.getSortingByValueOrderList(
|
4581
|
+
pivotData,
|
4582
|
+
sortingOptions.sorting,
|
4583
|
+
pivotData[isColumnSort ? 'colKeys' : 'rowKeys'],
|
4584
|
+
pivotData[isColumnSort ? 'colAttrs' : 'rowAttrs'],
|
4585
|
+
fieldIndex,
|
4586
|
+
widget
|
4587
|
+
);
|
4588
|
+
return $.pivotUtilities.sortAs(orderedNamesList);
|
4589
|
+
} else {
|
4590
|
+
return old_sorters_function(attr);
|
4502
4591
|
}
|
4503
|
-
return new_sorters_function;
|
4504
|
-
} else {
|
4505
|
-
return old_sorters_function;
|
4506
4592
|
}
|
4507
4593
|
};
|
4508
4594
|
|
@@ -4604,17 +4690,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4604
4690
|
}
|
4605
4691
|
};
|
4606
4692
|
|
4607
|
-
highchartsRenderer.waterfallConstants = {
|
4608
|
-
[highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN]: {
|
4609
|
-
minCategoriesCount: 2,
|
4610
|
-
maxCategoriesCount: 5,
|
4611
|
-
},
|
4612
|
-
[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
|
4613
|
-
minCategoriesCount: 2,
|
4614
|
-
maxCategoriesCount: 10,
|
4615
|
-
}
|
4616
|
-
};
|
4617
|
-
|
4618
4693
|
highchartsRenderer.rhPivotView = function (rowData, options, isTable = false, widget = null) {
|
4619
4694
|
if (!rowData || !rowData) {
|
4620
4695
|
if (options.onlyOptions) {
|
@@ -4645,15 +4720,20 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4645
4720
|
(category) => category.trend !== 'total'
|
4646
4721
|
);
|
4647
4722
|
}
|
4648
|
-
|
4649
|
-
|
4723
|
+
if (uniqueCategories && ((maxCategories && uniqueCategories.length > maxCategories)
|
4724
|
+
|| (minCategories && uniqueCategories.length < minCategories))) {
|
4650
4725
|
options.error_has_occurred = true;
|
4726
|
+
const breakdownText = `Please adjust your dashboard's reference date or filter selections as \
|
4727
|
+
the quantity of data doesn't match the limit of at least ${ minCategories } values.`;
|
4728
|
+
const walkthroughText = `Please adjust your dashboard's reference date and filter selections as \
|
4729
|
+
the quantity of data doesn't match the chart's ${ minCategories }-${ maxCategories } value limit.`;
|
4730
|
+
|
4651
4731
|
options.error_params = {
|
4652
4732
|
title: 'Data Conflict',
|
4653
|
-
text:
|
4654
|
-
the quantity of data doesn't match the chart's ${ minCategories }-${ maxCategories } value limit.`,
|
4733
|
+
text: isBreakdown ? breakdownText : walkthroughText,
|
4655
4734
|
class: uniqueCategories.length < minCategories ? 'waterfall-nodata' : 'waterfall-too-much-data',
|
4656
4735
|
}
|
4736
|
+
|
4657
4737
|
return highchartsRenderer.getNoDataResult(options.rendererOptions, true);
|
4658
4738
|
}
|
4659
4739
|
}
|
@@ -4711,7 +4791,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4711
4791
|
optsFiltered = $.extend(defaults, opts);
|
4712
4792
|
result = null;
|
4713
4793
|
try {
|
4794
|
+
const isTranspose = lodash.get(opts, 'rendererOptions.chartOptions.table_options.transpose_table', false);
|
4795
|
+
opts.getFormattedColKeys = isTranspose ? highchartsRenderer.getFormattedRowKeys : highchartsRenderer.getFormattedColKeys;
|
4796
|
+
opts.getFormattedRowKeys = isTranspose ? highchartsRenderer.getFormattedColKeys : highchartsRenderer.getFormattedRowKeys;
|
4797
|
+
|
4714
4798
|
pivotData = $.pivotUtilities.getPivotDataModel(rowData, opts);
|
4799
|
+
pivotData.sortByValueAttrs = [];
|
4715
4800
|
try {
|
4716
4801
|
if (options && options.onlyOptions) {
|
4717
4802
|
if (!opts.rendererOptions) {
|
@@ -4719,12 +4804,24 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4719
4804
|
}
|
4720
4805
|
opts.rendererOptions.onlyOptions = true;
|
4721
4806
|
}
|
4722
|
-
|
4723
|
-
if (
|
4724
|
-
|
4725
|
-
|
4726
|
-
|
4727
|
-
|
4807
|
+
|
4808
|
+
if (!highchartsRenderer.sortHasBeenDoneOnBE(lodash.get(widget, 'pivot.keysObject'))) {
|
4809
|
+
const sortByValueSettings = lodash.filter(
|
4810
|
+
lodash.get(widget, 'options.sortingFields', []),
|
4811
|
+
sortingField => lodash.includes(['field_values', 'variance'], lodash.get(sortingField, 'sorting.sort_by'))
|
4812
|
+
);
|
4813
|
+
|
4814
|
+
if (sortByValueSettings.length) {
|
4815
|
+
pivotData.sortByValueAttrs = lodash.map(sortByValueSettings, fieldSorting => fieldSorting.name);
|
4816
|
+
let new_sorting_function = highchartsRenderer.generateSortingFunctionByValues(sortByValueSettings, pivotData, opts, widget);
|
4817
|
+
opts.sorters = new_sorting_function;
|
4818
|
+
optsFiltered.sorters = new_sorting_function;
|
4819
|
+
pivotData.sorters = new_sorting_function;
|
4820
|
+
|
4821
|
+
if (lodash.isObject(lodash.get(widget, 'pivot'))) {
|
4822
|
+
widget.pivot.sorters = new_sorting_function;
|
4823
|
+
}
|
4824
|
+
}
|
4728
4825
|
}
|
4729
4826
|
|
4730
4827
|
result = opts.renderer(pivotData, opts.rendererOptions);
|
@@ -4738,6 +4835,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4738
4835
|
result = {};
|
4739
4836
|
}
|
4740
4837
|
}
|
4838
|
+
|
4839
|
+
if (lodash.isObject(lodash.get(widget, 'pivot'))) {
|
4840
|
+
widget.pivot.sortByValueAttrs = pivotData.sortByValueAttrs;
|
4841
|
+
}
|
4741
4842
|
} catch (_error) {
|
4742
4843
|
e = _error;
|
4743
4844
|
if (typeof console !== "undefined" && console !== null) {
|
@@ -4748,6 +4849,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4748
4849
|
result = {};
|
4749
4850
|
}
|
4750
4851
|
}
|
4852
|
+
|
4751
4853
|
return result;
|
4752
4854
|
};
|
4753
4855
|
|
@@ -4772,12 +4874,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4772
4874
|
if (!pivotOptions) {
|
4773
4875
|
return;
|
4774
4876
|
}
|
4877
|
+
|
4775
4878
|
var subopts = {
|
4776
4879
|
sorters: pivotOptions ? pivotOptions.sorters : null,
|
4880
|
+
sortByValueAttrs: pivotOptions ? pivotOptions.sortByValueAttrs : null,
|
4777
4881
|
cols: lodash.map(pivotOptions.axisArray, 'name'),
|
4778
4882
|
rows: lodash.map(pivotOptions.legendArray, 'name'),
|
4883
|
+
colFormats: highchartsRenderer.getTableFormatInfosForWidgetFields(widget, pivotOptions, widget.cols),
|
4884
|
+
rowFormats: highchartsRenderer.getTableFormatInfosForWidgetFields(widget, pivotOptions, widget.rows),
|
4779
4885
|
rendererOptions: widget.options,
|
4780
4886
|
dateValuesDictionary: pivotOptions ? pivotOptions.dateValuesDictionary : null,
|
4887
|
+
keysObject: pivotOptions ? pivotOptions.keysObject : null,
|
4781
4888
|
};
|
4782
4889
|
|
4783
4890
|
if (!subopts.rendererOptions) {
|
@@ -4860,7 +4967,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4860
4967
|
return 'Q' + q + " " + dateObj.getFullYear();
|
4861
4968
|
};
|
4862
4969
|
|
4863
|
-
highchartsRenderer.
|
4970
|
+
highchartsRenderer.returnRawDataWeekValue = function (d) {
|
4864
4971
|
// Copy date so don't modify original
|
4865
4972
|
d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
|
4866
4973
|
// get Thursday of the year and get year of week
|
@@ -4892,10 +4999,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4892
4999
|
return "W" + weekNo;
|
4893
5000
|
}
|
4894
5001
|
|
4895
|
-
highchartsRenderer.returnRawDataWeekValue = function (dateObj) {
|
4896
|
-
return highchartsRenderer.getWeekNumber(dateObj);
|
4897
|
-
};
|
4898
|
-
|
4899
5002
|
highchartsRenderer.check_values_not_for_convert = function (currentgraph, field_name) {
|
4900
5003
|
let vals_not_convert = [];
|
4901
5004
|
if (lodash.has(currentgraph, "options.chartOptions.delta_column") && currentgraph.options.chartOptions.delta_column) {
|
@@ -4934,7 +5037,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4934
5037
|
})
|
4935
5038
|
};
|
4936
5039
|
|
4937
|
-
highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert) {
|
5040
|
+
highchartsRenderer.returnRawDataValue = function (type, value, format, field_name, vals_not_for_convert, isFormattingNumbers) {
|
4938
5041
|
if (vals_not_for_convert && vals_not_for_convert.length && lodash.includes(vals_not_for_convert, value)) {
|
4939
5042
|
return value;
|
4940
5043
|
}
|
@@ -4955,7 +5058,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4955
5058
|
}
|
4956
5059
|
|
4957
5060
|
if (typeof (value) != 'number') {
|
4958
|
-
const drAdditionalField =
|
5061
|
+
const drAdditionalField = lodash.find($.pivotUtilities.additionalFieldsList, {key: value});
|
4959
5062
|
if (drAdditionalField && drAdditionalField.key)
|
4960
5063
|
return drAdditionalField.key;
|
4961
5064
|
|
@@ -4985,13 +5088,25 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4985
5088
|
format = format.replace('yyyy', 'YYYY');
|
4986
5089
|
format = format.replace('yy', 'YY');
|
4987
5090
|
format = lodash.replace(format, /h/g, 'H');
|
4988
|
-
|
5091
|
+
|
5092
|
+
const timeframe = highchartsRenderer.getTimeframeByFormat(format);
|
5093
|
+
const fiscalYearMonthsModifier = highchartsRenderer.getFiscalYearMonthModifier();
|
5094
|
+
|
5095
|
+
let date = moment_lib(tryParse).utcOffset(0);
|
5096
|
+
if (lodash.includes(['quarter', 'year'], timeframe)) {
|
5097
|
+
date = date.subtract(fiscalYearMonthsModifier, 'M');
|
5098
|
+
}
|
5099
|
+
|
5100
|
+
return date.format(format) + "";
|
4989
5101
|
} else {
|
4990
5102
|
return 'Wrong date format';
|
4991
5103
|
}
|
4992
5104
|
} else {
|
5105
|
+
const isFormatting = highchartsRenderer.isFormattingAxisFeatureOn() && isFormattingNumbers && format && !isNaN(value);
|
4993
5106
|
if (value === null || value === '[null]') {
|
4994
5107
|
return '[null]';
|
5108
|
+
} else if (isFormatting) {
|
5109
|
+
return highchartsRenderer.formatValue('n', format, value).value;
|
4995
5110
|
}
|
4996
5111
|
}
|
4997
5112
|
|
@@ -5031,7 +5146,18 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5031
5146
|
};
|
5032
5147
|
|
5033
5148
|
highchartsRenderer.isSystemField = function (field) {
|
5034
|
-
|
5149
|
+
const dynamicSystemFields = [];
|
5150
|
+
|
5151
|
+
const areMultipleAndScenarioTags = highchartsRenderer.hasFeature(FEATURES.MULTIPLE_DIMENSION_TAGS)
|
5152
|
+
&& highchartsRenderer.hasFeature(FEATURES.USE_NEW_SCENARIO_TAG);
|
5153
|
+
|
5154
|
+
if (areMultipleAndScenarioTags) {
|
5155
|
+
dynamicSystemFields.push('Scenario', 'Budget Cycle');
|
5156
|
+
}
|
5157
|
+
|
5158
|
+
const regexDelimer = '|';
|
5159
|
+
const dynamicSystemFieldsRegex = dynamicSystemFields.length ? dynamicSystemFields.join(regexDelimer) + regexDelimer : '';
|
5160
|
+
var regex = new RegExp(`^(${dynamicSystemFieldsRegex}Calc_Model_Name|Calc_Model_ID|Parent_Name|Parent_Id|FileBox_ID|FileBox_Name|DataMapper_Name|Doc_ID|Doc_version|Label|Submission_Date|User|table_id|Latest_In_Dim|Tab_name|CP_Name|DT_.+|VT_.+|System_.+)$`, "m");
|
5035
5161
|
|
5036
5162
|
return (field.category && field.category.includes("")) || regex.test(field.name)
|
5037
5163
|
};
|
@@ -5216,7 +5342,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5216
5342
|
options.chartOptions = lodash.merge(defaultOptions, options.chartOptions);
|
5217
5343
|
};
|
5218
5344
|
|
5219
|
-
highchartsRenderer.addPivotOptions = function (selectedTemplateWOData, widgetOptions, drilldownFunction, drillDownListFunction) {
|
5345
|
+
highchartsRenderer.addPivotOptions = function (selectedTemplateWOData, widgetOptions, drilldownFunction, drillDownListFunction, insightsTooltipFunction, trackUserInsightsTooltipFunction) {
|
5220
5346
|
// Check if not rendered data, than it will render
|
5221
5347
|
|
5222
5348
|
var fields = highchartsRenderer.objectCopyJsonMethod(selectedTemplateWOData.fields);
|
@@ -5226,6 +5352,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5226
5352
|
var valuesFields = [];
|
5227
5353
|
var drilldownFunc = drilldownFunction;
|
5228
5354
|
var drillDownListFunc = drillDownListFunction;
|
5355
|
+
var insightsTooltipFunc = insightsTooltipFunction;
|
5356
|
+
var trackUserInsightsTooltipFunc = trackUserInsightsTooltipFunction;
|
5229
5357
|
|
5230
5358
|
// fill value fields
|
5231
5359
|
lodash.forEach(widgetOptions.vals, function (valObj) {
|
@@ -5280,7 +5408,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5280
5408
|
widgetOptions.pivot.valuesArray = valuesFields;
|
5281
5409
|
widgetOptions.pivot.chartType = widgetOptions.chart_type;
|
5282
5410
|
widgetOptions.pivot.chartOptions = widgetOptions.options;
|
5283
|
-
widgetOptions.pivot.chartRender = highchartsRenderer.getChartRendererFunction(widgetOptions.pivot.chartType, drilldownFunc, drillDownListFunc);
|
5411
|
+
widgetOptions.pivot.chartRender = highchartsRenderer.getChartRendererFunction(widgetOptions.pivot.chartType, drilldownFunc, drillDownListFunc, insightsTooltipFunc, trackUserInsightsTooltipFunc);
|
5284
5412
|
|
5285
5413
|
// TODO: remove this logic after BE sort is implemented
|
5286
5414
|
// it is required to do sort by totals for comparative analysis - we need to change deltas if columns swaped vice versa
|
@@ -5424,7 +5552,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5424
5552
|
dynamicRangeOptions.pivot.calculatedValues = highchartsRenderer.objectCopyJsonMethod(dynamicRangeOptions.calculated_values || []);
|
5425
5553
|
}
|
5426
5554
|
|
5427
|
-
highchartsRenderer.addTemplateDataToCalcModel = function (selectedTemplate, calcModelOptions, calcModelPredefinedField) {
|
5555
|
+
highchartsRenderer.addTemplateDataToCalcModel = function (selectedTemplate, calcModelOptions, calcModelPredefinedField, isInputStep) {
|
5428
5556
|
highchartsRenderer.setWidgetFieldsToTemplate(selectedTemplate);
|
5429
5557
|
const fields = highchartsRenderer.objectCopyJsonMethod(selectedTemplate.fields);
|
5430
5558
|
const predefinedField = lodash.cloneDeep(calcModelPredefinedField);
|
@@ -5504,18 +5632,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5504
5632
|
const fieldOb = lodash.find(fields, { id: filterObj.id });
|
5505
5633
|
if (!fieldOb) return;
|
5506
5634
|
|
5507
|
-
|
5508
|
-
|
5509
|
-
|
5510
|
-
|
5511
|
-
filterObj.
|
5512
|
-
|
5513
|
-
|
5514
|
-
fieldOb.includes = filterObj.includes;
|
5515
|
-
fieldOb.values = filterObj.values;
|
5516
|
-
|
5517
|
-
if (filterObj.allow_nulls && fieldOb) {
|
5518
|
-
fieldOb.allow_nulls = filterObj.allow_nulls;
|
5635
|
+
if (filterObj.is_exclude) {
|
5636
|
+
filterObj.excludes = filterObj.values && lodash.map(filterObj.values, highchartsRenderer.decodeFunc);
|
5637
|
+
fieldOb.excludes = filterObj.excludes;
|
5638
|
+
} else {
|
5639
|
+
filterObj.includes = filterObj.values && lodash.map(filterObj.values, highchartsRenderer.decodeFunc);
|
5640
|
+
fieldOb.includes = filterObj.includes;
|
5519
5641
|
}
|
5520
5642
|
});
|
5521
5643
|
|
@@ -5540,12 +5662,18 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5540
5662
|
/**
|
5541
5663
|
* We can have several common fields, so we should ignore deleting during fillData
|
5542
5664
|
* */
|
5543
|
-
const commonFieldsId =
|
5544
|
-
|
5545
|
-
|
5546
|
-
|
5547
|
-
|
5548
|
-
const
|
5665
|
+
const commonFieldsId = isInputStep
|
5666
|
+
? [scenarioField && scenarioField.id]
|
5667
|
+
: [scenarioField && scenarioField.id, reportingMonthField && reportingMonthField.id, lodash.get(storedDataTypeFields, '[0].id', undefined)];
|
5668
|
+
|
5669
|
+
// for Input step
|
5670
|
+
const filterFields = isInputStep ? fillData(filters, commonFieldsId) : [];
|
5671
|
+
const valueFields = isInputStep ? fillData(storedAggFields, commonFieldsId) : [];
|
5672
|
+
|
5673
|
+
// for Output step
|
5674
|
+
const dateFields = !isInputStep ? fillData(storedDateFields, commonFieldsId) : [];
|
5675
|
+
const dataTypeFields = !isInputStep ? fillData(storedDataTypeFields, commonFieldsId) : [];
|
5676
|
+
const dataSeriesFields = !isInputStep ? fillData(storedGroupByFields, commonFieldsId) : [];
|
5549
5677
|
|
5550
5678
|
lodash.remove(fields, _field => lodash.includes(commonFieldsId, _field.id));
|
5551
5679
|
|
@@ -5572,21 +5700,20 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5572
5700
|
|
5573
5701
|
lodash.forEach(functionOptions.filters, function (filterObj) {
|
5574
5702
|
fieldOb = lodash.find(fields, {id: filterObj.field});
|
5575
|
-
if (fieldOb && filterObj.values && filterObj.values.datetype && filterObj.values.datetype
|
5703
|
+
if (fieldOb && filterObj.values && filterObj.values.datetype && filterObj.values.datetype === 'list') {
|
5576
5704
|
filterObj.values = filterObj.values.val
|
5577
|
-
} else if (fieldOb && filterObj.values && filterObj.values.datetype && filterObj.values.datetype
|
5705
|
+
} else if (fieldOb && filterObj.values && filterObj.values.datetype && filterObj.values.datetype !== 'list') {
|
5578
5706
|
fieldOb.values = filterObj.values;
|
5579
5707
|
} else if (fieldOb && filterObj.values && filterObj.values.type === 'advanced') {
|
5580
5708
|
fieldOb.values = filterObj.values;
|
5581
5709
|
}
|
5582
5710
|
|
5583
5711
|
if (fieldOb && filterObj.values && filterObj.values instanceof Array) {
|
5584
|
-
if (filterObj.is_excluded
|
5712
|
+
if (filterObj.is_excluded) {
|
5585
5713
|
fieldOb.excludes = filterObj.values;
|
5586
5714
|
} else {
|
5587
5715
|
fieldOb.includes = filterObj.values;
|
5588
5716
|
}
|
5589
|
-
//includes[fieldOb.name] = highchartsRenderer.getOnlyIncludedOfField(fieldOb);
|
5590
5717
|
}
|
5591
5718
|
if (filterObj.show_in_graph && fieldOb) {
|
5592
5719
|
fieldOb.show_in_graph = filterObj.show_in_graph
|
@@ -5752,7 +5879,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5752
5879
|
widgetOptions.pivot.legendArray = legendFields;
|
5753
5880
|
widgetOptions.pivot.valuesArray = valuesFields;
|
5754
5881
|
widgetOptions.pivot.filtersArray = filterFields;
|
5755
|
-
//widgetOptions.pivot.filter = filterFn;
|
5756
5882
|
widgetOptions.pivot.filterIncludes = includes;
|
5757
5883
|
widgetOptions.pivot.chartType = widgetOptions.chart_type;
|
5758
5884
|
widgetOptions.pivot.chartOptions = widgetOptions.options;
|
@@ -5810,7 +5936,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5810
5936
|
return toReturn;
|
5811
5937
|
};
|
5812
5938
|
|
5813
|
-
highchartsRenderer.getChartRendererFunction = function (newChartType, drilldownFunc, drillDownListFunc) {
|
5939
|
+
highchartsRenderer.getChartRendererFunction = function (newChartType, drilldownFunc, drillDownListFunc, insightsTooltipFunc, trackUserInsightsTooltipFunc) {
|
5814
5940
|
var fnToReturn = null;
|
5815
5941
|
|
5816
5942
|
if (newChartType == highchartsRenderer.richTextSubType.type) {
|
@@ -5837,7 +5963,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5837
5963
|
if (!opt) {
|
5838
5964
|
opt = {};
|
5839
5965
|
}
|
5840
|
-
opt.drillDownListFunc =
|
5966
|
+
opt.drillDownListFunc = (e) => {
|
5967
|
+
highchartsRenderer.modifyEventPointForDrilldown(e, pivotData);
|
5968
|
+
drillDownListFunc(e);
|
5969
|
+
};
|
5970
|
+
opt.insightsTooltipFunc = insightsTooltipFunc;
|
5971
|
+
opt.trackUserInsightsTooltipFunc = trackUserInsightsTooltipFunc;
|
5841
5972
|
} else {
|
5842
5973
|
opt.drillDownListFunc = null;
|
5843
5974
|
}
|
@@ -5979,63 +6110,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5979
6110
|
return key
|
5980
6111
|
};
|
5981
6112
|
|
5982
|
-
const fontSizeValues = lodash.map(new Array(19), (item, index) => {
|
5983
|
-
const fontValue = index + 6;
|
5984
|
-
return {label: fontValue, value: fontValue}
|
5985
|
-
})
|
5986
|
-
const fonts = [
|
5987
|
-
'Arial',
|
5988
|
-
'Arial Black',
|
5989
|
-
'Comic Sans MS',
|
5990
|
-
'Courier New',
|
5991
|
-
'Helvetica',
|
5992
|
-
'Impact',
|
5993
|
-
'Nunito Sans',
|
5994
|
-
'Tahoma',
|
5995
|
-
'Times New Roman',
|
5996
|
-
'Verdana',
|
5997
|
-
'Poppins'
|
5998
|
-
];
|
5999
|
-
|
6000
|
-
const TOOLTIP_DEFAULT_SETTINGS = {
|
6001
|
-
FONT_COLOR: '#545a6b',
|
6002
|
-
FONT_SIZE: '12',
|
6003
|
-
FONT_FAMILY: HIGHCHARTS_FONT_FAMILY,
|
6004
|
-
};
|
6005
|
-
|
6006
|
-
const TOOLTIP_DEFAULT_OPTIONS = {
|
6007
|
-
borderColor: '#fff',
|
6008
|
-
shadow: {
|
6009
|
-
color: '#9199b4',
|
6010
|
-
width: 10,
|
6011
|
-
opacity: 0.05
|
6012
|
-
},
|
6013
|
-
style: {
|
6014
|
-
fontSize: TOOLTIP_DEFAULT_SETTINGS.FONT_SIZE,
|
6015
|
-
fontFamily: TOOLTIP_DEFAULT_SETTINGS.FONT_FAMILY,
|
6016
|
-
color: TOOLTIP_DEFAULT_SETTINGS.FONT_COLOR,
|
6017
|
-
},
|
6018
|
-
enabled: true,
|
6019
|
-
};
|
6020
|
-
|
6021
|
-
const LABEL_DEFAULT_SETTINGS = {
|
6022
|
-
FONT_COLOR: textColor,
|
6023
|
-
FONT_SIZE: '11',
|
6024
|
-
FONT_FAMILY: HIGHCHARTS_FONT_FAMILY,
|
6025
|
-
};
|
6026
|
-
|
6027
|
-
const LABEL_DEFAULT_OPTIONS = {
|
6028
|
-
style: {
|
6029
|
-
fontSize: LABEL_DEFAULT_SETTINGS.FONT_SIZE,
|
6030
|
-
fontFamily: LABEL_DEFAULT_SETTINGS.FONT_FAMILY,
|
6031
|
-
fontWeight: 'normal',
|
6032
|
-
},
|
6033
|
-
color: LABEL_DEFAULT_SETTINGS.FONT_COLOR,
|
6034
|
-
};
|
6035
|
-
|
6036
|
-
const CHART_AXIS_DEFAULT_LABEL = 'Axis (Category)';
|
6037
|
-
const CHART_LEGEND_DEFAULT_LABEL = 'Legend (Series)';
|
6038
|
-
|
6039
6113
|
highchartsRenderer.getDefaultValueForSubOptions = function (type, existing_options) {
|
6040
6114
|
var valToReturn = {};
|
6041
6115
|
var option = highchartsRenderer.suboptions[type] || lodash.find(highchartsRenderer.suboptions, suboption => suboption.category_type === type);
|
@@ -6056,7 +6130,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6056
6130
|
return valToReturn;
|
6057
6131
|
};
|
6058
6132
|
|
6059
|
-
|
6060
6133
|
highchartsRenderer.getChartAxisLabel = function(type) {
|
6061
6134
|
return highchartsRenderer.chartsTypesInfo[type] ? highchartsRenderer.chartsTypesInfo[type].axisName : CHART_AXIS_DEFAULT_LABEL;
|
6062
6135
|
};
|
@@ -6067,6 +6140,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6067
6140
|
|
6068
6141
|
highchartsRenderer.widgetPlaceholders = lodash.assign({}, $.pivotUtilities.errorHandling.placeholders);
|
6069
6142
|
|
6143
|
+
const suboptionsFontSizeValues = (lodash.map(lodash.fill(new Array(19), null), function (item, index) {
|
6144
|
+
const fontValue = index + 6;
|
6145
|
+
return { label: fontValue, value: fontValue }
|
6146
|
+
}));
|
6147
|
+
|
6070
6148
|
highchartsRenderer.suboptions = {
|
6071
6149
|
'widget_library': {
|
6072
6150
|
is_hidden: true,
|
@@ -6221,14 +6299,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6221
6299
|
element_type: 'select',
|
6222
6300
|
value_name: 'columns_font_style',
|
6223
6301
|
element_label: 'Font style',
|
6224
|
-
element_options:
|
6302
|
+
element_options: SUBOPTIONS_FONTS,
|
6225
6303
|
default_value: 'Poppins'
|
6226
6304
|
},
|
6227
6305
|
{
|
6228
6306
|
element_type: 'select',
|
6229
6307
|
value_name: 'columns_font_size',
|
6230
6308
|
element_label: 'Font size',
|
6231
|
-
element_options:
|
6309
|
+
element_options: suboptionsFontSizeValues,
|
6232
6310
|
default_value: '10'
|
6233
6311
|
},
|
6234
6312
|
{
|
@@ -6250,14 +6328,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6250
6328
|
element_type: 'select',
|
6251
6329
|
value_name: 'rows_font_style',
|
6252
6330
|
element_label: 'Font style',
|
6253
|
-
element_options:
|
6331
|
+
element_options: SUBOPTIONS_FONTS,
|
6254
6332
|
default_value: 'Poppins'
|
6255
6333
|
},
|
6256
6334
|
{
|
6257
6335
|
element_type: 'select',
|
6258
6336
|
value_name: 'rows_font_size',
|
6259
6337
|
element_label: 'Font size',
|
6260
|
-
element_options:
|
6338
|
+
element_options: suboptionsFontSizeValues,
|
6261
6339
|
default_value: '10'
|
6262
6340
|
},
|
6263
6341
|
{
|
@@ -6279,14 +6357,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6279
6357
|
element_type: 'select',
|
6280
6358
|
value_name: 'values_font_style',
|
6281
6359
|
element_label: 'Font style',
|
6282
|
-
element_options:
|
6360
|
+
element_options: SUBOPTIONS_FONTS,
|
6283
6361
|
default_value: 'Poppins'
|
6284
6362
|
},
|
6285
6363
|
{
|
6286
6364
|
element_type: 'select',
|
6287
6365
|
value_name: 'values_font_size',
|
6288
6366
|
element_label: 'Font size',
|
6289
|
-
element_options:
|
6367
|
+
element_options: suboptionsFontSizeValues,
|
6290
6368
|
default_value: '10'
|
6291
6369
|
},
|
6292
6370
|
{
|
@@ -6308,14 +6386,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6308
6386
|
element_type: 'select',
|
6309
6387
|
value_name: 'totals_font_style',
|
6310
6388
|
element_label: 'Font style',
|
6311
|
-
element_options:
|
6389
|
+
element_options: SUBOPTIONS_FONTS,
|
6312
6390
|
default_value: 'Poppins'
|
6313
6391
|
},
|
6314
6392
|
{
|
6315
6393
|
element_type: 'select',
|
6316
6394
|
value_name: 'totals_font_size',
|
6317
6395
|
element_label: 'Font size',
|
6318
|
-
element_options:
|
6396
|
+
element_options: suboptionsFontSizeValues,
|
6319
6397
|
default_value: '10'
|
6320
6398
|
},
|
6321
6399
|
{
|
@@ -6432,6 +6510,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6432
6510
|
value_name: 'eliminate_calc_totals',
|
6433
6511
|
default_value: false
|
6434
6512
|
},
|
6513
|
+
{
|
6514
|
+
element_type: 'checkbox',
|
6515
|
+
element_label: 'Show data in dashboard if more than 1000 rows',
|
6516
|
+
value_name: 'show_more_than_thousand_rows',
|
6517
|
+
default_value: false,
|
6518
|
+
showFn: chartType => chartType === highchartsRenderer.CHART_TYPES.TABLE_ONLY,
|
6519
|
+
disabled_fn: (value) => !!value.use_handsOnTable
|
6520
|
+
},
|
6435
6521
|
]
|
6436
6522
|
},
|
6437
6523
|
'value': {
|
@@ -6584,14 +6670,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6584
6670
|
element_type: 'select',
|
6585
6671
|
value_name: 'font_style',
|
6586
6672
|
element_label: 'Font style',
|
6587
|
-
element_options:
|
6673
|
+
element_options: SUBOPTIONS_FONTS,
|
6588
6674
|
default_value: LABEL_DEFAULT_SETTINGS.FONT_FAMILY,
|
6589
6675
|
},
|
6590
6676
|
{
|
6591
6677
|
element_type: 'select',
|
6592
6678
|
value_name: 'font_size',
|
6593
6679
|
element_label: 'Font size',
|
6594
|
-
element_options:
|
6680
|
+
element_options: suboptionsFontSizeValues,
|
6595
6681
|
default_value: LABEL_DEFAULT_SETTINGS.FONT_SIZE,
|
6596
6682
|
},
|
6597
6683
|
{
|
@@ -6662,14 +6748,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6662
6748
|
element_type: 'select',
|
6663
6749
|
value_name: 'font_style',
|
6664
6750
|
element_label: 'Font style',
|
6665
|
-
element_options:
|
6751
|
+
element_options: SUBOPTIONS_FONTS,
|
6666
6752
|
default_value: LABEL_DEFAULT_SETTINGS.FONT_FAMILY,
|
6667
6753
|
},
|
6668
6754
|
{
|
6669
6755
|
element_type: 'select',
|
6670
6756
|
value_name: 'font_size',
|
6671
6757
|
element_label: 'Font size',
|
6672
|
-
element_options:
|
6758
|
+
element_options: suboptionsFontSizeValues,
|
6673
6759
|
default_value: LABEL_DEFAULT_SETTINGS.FONT_SIZE,
|
6674
6760
|
},
|
6675
6761
|
{
|
@@ -6739,14 +6825,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6739
6825
|
element_type: 'select',
|
6740
6826
|
value_name: 'font_style',
|
6741
6827
|
element_label: 'Font style',
|
6742
|
-
element_options:
|
6828
|
+
element_options: SUBOPTIONS_FONTS,
|
6743
6829
|
default_value: LABEL_DEFAULT_SETTINGS.FONT_FAMILY,
|
6744
6830
|
},
|
6745
6831
|
{
|
6746
6832
|
element_type: 'select',
|
6747
6833
|
value_name: 'font_size',
|
6748
6834
|
element_label: 'Font size',
|
6749
|
-
element_options:
|
6835
|
+
element_options: suboptionsFontSizeValues,
|
6750
6836
|
default_value: LABEL_DEFAULT_SETTINGS.FONT_SIZE,
|
6751
6837
|
},
|
6752
6838
|
{
|
@@ -6908,14 +6994,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6908
6994
|
element_type: 'select',
|
6909
6995
|
value_name: 'font_style',
|
6910
6996
|
element_label: 'Font style',
|
6911
|
-
element_options:
|
6997
|
+
element_options: SUBOPTIONS_FONTS,
|
6912
6998
|
default_value: TOOLTIP_DEFAULT_SETTINGS.FONT_FAMILY,
|
6913
6999
|
},
|
6914
7000
|
{
|
6915
7001
|
element_type: 'select',
|
6916
7002
|
value_name: 'font_size',
|
6917
7003
|
element_label: 'Font size',
|
6918
|
-
element_options:
|
7004
|
+
element_options: suboptionsFontSizeValues,
|
6919
7005
|
default_value: TOOLTIP_DEFAULT_SETTINGS.FONT_SIZE,
|
6920
7006
|
},
|
6921
7007
|
{
|
@@ -6998,14 +7084,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6998
7084
|
element_type: 'select',
|
6999
7085
|
value_name: 'font_style',
|
7000
7086
|
element_label: 'Font style',
|
7001
|
-
element_options:
|
7087
|
+
element_options: SUBOPTIONS_FONTS,
|
7002
7088
|
default_value: TOOLTIP_DEFAULT_SETTINGS.FONT_FAMILY,
|
7003
7089
|
},
|
7004
7090
|
{
|
7005
7091
|
element_type: 'select',
|
7006
7092
|
value_name: 'font_size',
|
7007
7093
|
element_label: 'Font size',
|
7008
|
-
element_options:
|
7094
|
+
element_options: suboptionsFontSizeValues,
|
7009
7095
|
default_value: TOOLTIP_DEFAULT_SETTINGS.FONT_SIZE,
|
7010
7096
|
},
|
7011
7097
|
{
|
@@ -7110,18 +7196,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
7110
7196
|
value_name: 'is_percentage',
|
7111
7197
|
default_value: false,
|
7112
7198
|
hidden: true,
|
7113
|
-
}, {
|
7114
|
-
element_type: 'checkbox',
|
7115
|
-
element_label: 'Sort by variance',
|
7116
|
-
value_name: 'sort_by_variance',
|
7117
|
-
default_value: false,
|
7118
|
-
hidden: true
|
7119
|
-
}, {
|
7120
|
-
element_type: 'checkbox',
|
7121
|
-
element_label: 'Sort by absolute variance',
|
7122
|
-
value_name: 'sort_by_absolute_variance',
|
7123
|
-
default_value: false,
|
7124
|
-
hidden: true
|
7125
7199
|
}]
|
7126
7200
|
},
|
7127
7201
|
'delta_column_for_drill_down': {
|
@@ -7188,18 +7262,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
7188
7262
|
value_name: 'is_percentage',
|
7189
7263
|
default_value: false,
|
7190
7264
|
hidden: true,
|
7191
|
-
}, {
|
7192
|
-
element_type: 'checkbox',
|
7193
|
-
element_label: 'Sort by variance',
|
7194
|
-
value_name: 'sort_by_variance',
|
7195
|
-
default_value: false,
|
7196
|
-
hidden: true
|
7197
|
-
}, {
|
7198
|
-
element_type: 'checkbox',
|
7199
|
-
element_label: 'Sort by absolute variance',
|
7200
|
-
value_name: 'sort_by_absolute_variance',
|
7201
|
-
default_value: false,
|
7202
|
-
hidden: true
|
7203
7265
|
}, {
|
7204
7266
|
element_type: 'checkbox',
|
7205
7267
|
element_label: 'Filter zero values',
|
@@ -7494,8 +7556,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
7494
7556
|
},
|
7495
7557
|
};
|
7496
7558
|
|
7497
|
-
highchartsRenderer.chartsData =
|
7498
|
-
[
|
7559
|
+
highchartsRenderer.chartsData = [
|
7499
7560
|
{
|
7500
7561
|
type: 'line',
|
7501
7562
|
name: 'Line',
|
@@ -7979,10 +8040,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
7979
8040
|
suboptions: []
|
7980
8041
|
};
|
7981
8042
|
|
7982
|
-
highchartsRenderer.
|
7983
|
-
highchartsRenderer.MAX_SELECTED_ITEMS_CHARECHTERS_IN_LABEL = 50;
|
7984
|
-
|
7985
|
-
highchartsRenderer.getFilterLabel = function (fieldFilter, showTemplateName) {
|
8043
|
+
highchartsRenderer.getFilterLabel = function (fieldFilter, showTemplateName, isFormattingNumbers) {
|
7986
8044
|
var displayname;
|
7987
8045
|
if (fieldFilter.new_name)
|
7988
8046
|
displayname = fieldFilter.new_name.replace('RH_DIM_', '');
|
@@ -8005,7 +8063,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8005
8063
|
var tooltip = '';
|
8006
8064
|
var all_vals = [];
|
8007
8065
|
if (fieldFilter.type == 'Date') {
|
8008
|
-
all_vals = [];
|
8009
8066
|
var invertValueFormatMap = lodash.invert(fieldFilter.valueFormatMap);
|
8010
8067
|
lodash.forEach(fieldFilter.includes, function (val) {
|
8011
8068
|
if (invertValueFormatMap && invertValueFormatMap[val]) {
|
@@ -8015,6 +8072,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8015
8072
|
}
|
8016
8073
|
all_vals.push(val);
|
8017
8074
|
});
|
8075
|
+
} else if (isFormattingNumbers && highchartsRenderer.isFormattingAxisFeatureOn()) {
|
8076
|
+
all_vals = lodash.map(lodash.cloneDeep(fieldFilter.includes), val =>
|
8077
|
+
highchartsRenderer.returnRawDataValue(fieldFilter.type, val, fieldFilter.format || '', null, null, true) + ""
|
8078
|
+
);
|
8018
8079
|
} else {
|
8019
8080
|
all_vals = lodash.clone(fieldFilter.includes);
|
8020
8081
|
}
|
@@ -8107,8 +8168,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8107
8168
|
};
|
8108
8169
|
}
|
8109
8170
|
} else {
|
8110
|
-
if (fieldFilter && fieldFilter.type && fieldFilter.type === 'Date'
|
8111
|
-
&& fieldFilter.datetypevalues && fieldFilter.datetypevalues) {
|
8171
|
+
if (fieldFilter && fieldFilter.type && fieldFilter.type === 'Date' && fieldFilter.datetypevalues) {
|
8112
8172
|
if (fieldFilter.datetypevalues.datetype === "frame") {
|
8113
8173
|
displayname += ` (${fieldFilter.datetypevalues.val.timeframe})`;
|
8114
8174
|
} else if (fieldFilter.datetypevalues.datetype === "range") {
|
@@ -8120,7 +8180,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8120
8180
|
// range timestamps currently are set presupposing that user selects UTC dates,
|
8121
8181
|
// that is why for consistency we also should show in filters values which user selected
|
8122
8182
|
// and not local dates, that can differ
|
8123
|
-
|
8183
|
+
lodash.forEach(Object.keys(dates), key => {
|
8124
8184
|
const dateConfiguration = dates[key];
|
8125
8185
|
const timestamp = dateConfiguration.timestamp;
|
8126
8186
|
if (timestamp) {
|
@@ -8186,7 +8246,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8186
8246
|
highchartsRenderer.getDashboardOverrideValues = function (data_model, graph, local_current_dashboard) {
|
8187
8247
|
let overrideValues = [];
|
8188
8248
|
|
8189
|
-
if (!local_current_dashboard
|
8249
|
+
if (!local_current_dashboard) {
|
8190
8250
|
local_current_dashboard = data_model.current_dashboard;
|
8191
8251
|
}
|
8192
8252
|
|
@@ -8262,11 +8322,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8262
8322
|
local_current_dashboard = data_model.current_dashboard;
|
8263
8323
|
}
|
8264
8324
|
|
8265
|
-
if (local_current_dashboard.date_tags.length > 0) {
|
8325
|
+
if (local_current_dashboard.date_tags && local_current_dashboard.date_tags.length > 0) {
|
8266
8326
|
return 'date_tags';
|
8267
8327
|
}
|
8268
8328
|
|
8269
|
-
if (local_current_dashboard.plan_tags.length > 0) {
|
8329
|
+
if (local_current_dashboard.plan_tags && local_current_dashboard.plan_tags.length > 0) {
|
8270
8330
|
return 'plan_tags';
|
8271
8331
|
}
|
8272
8332
|
};
|
@@ -8292,7 +8352,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8292
8352
|
};
|
8293
8353
|
|
8294
8354
|
highchartsRenderer.getDashboardApplyScenarios = function (data_model, graph, local_current_dashboard) {
|
8295
|
-
if (
|
8355
|
+
if (local_current_dashboard == undefined) {
|
8296
8356
|
local_current_dashboard = data_model.current_dashboard;
|
8297
8357
|
}
|
8298
8358
|
|
@@ -8318,7 +8378,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8318
8378
|
};
|
8319
8379
|
|
8320
8380
|
highchartsRenderer.isDate = function (date) {
|
8321
|
-
return
|
8381
|
+
return new Date(date) !== "Invalid Date" && !isNaN(new Date(date));
|
8322
8382
|
};
|
8323
8383
|
|
8324
8384
|
highchartsRenderer.isDateFormat = function (datestr, format) {
|
@@ -8326,11 +8386,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8326
8386
|
};
|
8327
8387
|
|
8328
8388
|
highchartsRenderer.containsIgnoreCase = function (str, it) {
|
8329
|
-
return str.toLowerCase().indexOf(it) != -1;
|
8389
|
+
return str.toLowerCase().indexOf(it.toLowerCase()) != -1;
|
8330
8390
|
};
|
8331
8391
|
|
8332
8392
|
highchartsRenderer.createDateTypeFromValue = function (fieldnametoFilter, format, colName) {
|
8333
|
-
|
8393
|
+
|
8394
|
+
const fiscalYearMonthsModifier = highchartsRenderer.getFiscalYearMonthModifier();
|
8334
8395
|
|
8335
8396
|
if (format) {
|
8336
8397
|
format = format.replace(/y/g, 'Y');
|
@@ -8339,83 +8400,86 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8339
8400
|
format = 'MMM YYYY';
|
8340
8401
|
}
|
8341
8402
|
|
8342
|
-
|
8403
|
+
const range = { datetype: "range", val: { todate: 0, fromdate: 0 } };
|
8404
|
+
const timeframe = highchartsRenderer.getTimeframeByFormat(format);
|
8343
8405
|
|
8344
|
-
|
8345
|
-
|
8346
|
-
|
8347
|
-
|
8406
|
+
const isFormattedDate = format && highchartsRenderer.isDateFormat(fieldnametoFilter, format);
|
8407
|
+
if (isFormattedDate || highchartsRenderer.isDate(fieldnametoFilter)) {
|
8408
|
+
const initialDateString = fieldnametoFilter;
|
8409
|
+
if (isFormattedDate) {
|
8348
8410
|
fieldnametoFilter = moment_lib(fieldnametoFilter, format, true).toISOString();
|
8349
8411
|
}
|
8350
|
-
|
8351
|
-
|
8352
|
-
|
8353
|
-
|
8354
|
-
var timeframe = 'day';
|
8355
|
-
if (format && highchartsRenderer.containsIgnoreCase(format, 'q'))
|
8356
|
-
timeframe = 'quarter';
|
8357
|
-
else if (format && !highchartsRenderer.containsIgnoreCase(format, 'dd') && !highchartsRenderer.containsIgnoreCase(format, 'mm') && highchartsRenderer.containsIgnoreCase(format, 'yy'))
|
8358
|
-
timeframe = 'year';
|
8359
|
-
else if (format && !highchartsRenderer.containsIgnoreCase(format, 'dd') && highchartsRenderer.containsIgnoreCase(format, 'mm') && highchartsRenderer.containsIgnoreCase(format, 'yy'))
|
8360
|
-
timeframe = 'month';
|
8361
|
-
switch (timeframe) {
|
8362
|
-
case 'day':
|
8363
|
-
range.val.fromdate = Math.round(Date.UTC(
|
8364
|
-
dt.getFullYear(),
|
8365
|
-
dt.getMonth(),
|
8366
|
-
dt.getDate(),
|
8367
|
-
0,
|
8368
|
-
0,
|
8369
|
-
0
|
8370
|
-
) / 1000);
|
8371
|
-
range.val.todate = range.val.fromdate + 60 * 60 * 24 - 1;
|
8372
|
-
return range;
|
8373
|
-
break;
|
8374
|
-
case 'month':
|
8375
|
-
range.val.fromdate = Math.round(
|
8376
|
-
Date.UTC(
|
8412
|
+
const dt = new Date(fieldnametoFilter);
|
8413
|
+
switch (timeframe) {
|
8414
|
+
case 'day':
|
8415
|
+
range.val.fromdate = Math.round(Date.UTC(
|
8377
8416
|
dt.getFullYear(),
|
8378
8417
|
dt.getMonth(),
|
8418
|
+
dt.getDate(),
|
8419
|
+
0,
|
8420
|
+
0,
|
8421
|
+
0
|
8422
|
+
) / 1000);
|
8423
|
+
range.val.todate = range.val.fromdate + 60 * 60 * 24 - 1;
|
8424
|
+
return range;
|
8425
|
+
case 'month':
|
8426
|
+
range.val.fromdate = Math.round(
|
8427
|
+
Date.UTC(
|
8428
|
+
dt.getFullYear(),
|
8429
|
+
dt.getMonth(),
|
8430
|
+
1,
|
8431
|
+
0, 0, 0, 0
|
8432
|
+
) / 1000)
|
8433
|
+
let lastDay = new Date(dt.getFullYear(), dt.getMonth() + 1, 0);
|
8434
|
+
range.val.todate = Math.round(
|
8435
|
+
Date.UTC(
|
8436
|
+
lastDay.getFullYear(),
|
8437
|
+
lastDay.getMonth(),
|
8438
|
+
lastDay.getDate(),
|
8439
|
+
23,
|
8440
|
+
59,
|
8441
|
+
59) / 1000)
|
8442
|
+
return range;
|
8443
|
+
case 'year':
|
8444
|
+
range.val.fromdate = Math.round(Date.UTC(
|
8445
|
+
dt.getFullYear(),
|
8446
|
+
fiscalYearMonthsModifier || dt.getMonth(),
|
8379
8447
|
1,
|
8380
8448
|
0, 0, 0, 0
|
8449
|
+
) / 1000);
|
8450
|
+
|
8451
|
+
let lastDay2 = new Date(dt.getFullYear() + 1, fiscalYearMonthsModifier || 0, 0);
|
8452
|
+
range.val.todate = Math.round(Date.UTC(
|
8453
|
+
lastDay2.getFullYear(),
|
8454
|
+
lastDay2.getMonth(),
|
8455
|
+
lastDay2.getDate(),
|
8456
|
+
23, 59, 59
|
8381
8457
|
) / 1000)
|
8382
|
-
|
8383
|
-
|
8384
|
-
|
8385
|
-
|
8386
|
-
|
8387
|
-
|
8388
|
-
|
8389
|
-
|
8390
|
-
|
8391
|
-
|
8392
|
-
|
8393
|
-
|
8394
|
-
|
8395
|
-
|
8396
|
-
|
8397
|
-
|
8398
|
-
|
8399
|
-
|
8400
|
-
|
8401
|
-
|
8402
|
-
|
8403
|
-
|
8404
|
-
lastDay2.getMonth(),
|
8405
|
-
lastDay2.getDate(),
|
8406
|
-
23, 59, 59
|
8407
|
-
) / 1000)
|
8408
|
-
return range;
|
8409
|
-
break;
|
8410
|
-
case 'quarter':
|
8411
|
-
const utcDate = moment_lib.utc(initialDateString, format, true);
|
8412
|
-
range.val.fromdate = utcDate.startOf(timeframe).unix();
|
8413
|
-
range.val.todate = utcDate.endOf(timeframe).unix();
|
8414
|
-
return range;
|
8415
|
-
default:
|
8416
|
-
return "";
|
8458
|
+
return range;
|
8459
|
+
case 'quarter':
|
8460
|
+
const utcDate = moment_lib.utc(initialDateString, format, true);
|
8461
|
+
range.val.fromdate = lodash.cloneDeep(utcDate).startOf(timeframe).add(fiscalYearMonthsModifier, 'M').unix();
|
8462
|
+
range.val.todate = lodash.cloneDeep(utcDate).endOf(timeframe).add(fiscalYearMonthsModifier, 'M').endOf('M').unix();
|
8463
|
+
return range;
|
8464
|
+
default:
|
8465
|
+
return "";
|
8466
|
+
}
|
8467
|
+
} else if (!lodash.isNaN(fieldnametoFilter)) {
|
8468
|
+
const utcDate = moment_lib.unix(fieldnametoFilter).utc();
|
8469
|
+
const fromDateMoment = lodash.cloneDeep(utcDate).startOf(timeframe);
|
8470
|
+
const toDateMoment = lodash.cloneDeep(utcDate).endOf(timeframe);
|
8471
|
+
|
8472
|
+
if (lodash.includes(['year', 'quarter'], timeframe)) {
|
8473
|
+
fromDateMoment.add(fiscalYearMonthsModifier, 'M');
|
8474
|
+
toDateMoment.add(fiscalYearMonthsModifier, 'M').endOf('M');
|
8475
|
+
}
|
8476
|
+
|
8477
|
+
range.val.fromdate = fromDateMoment.unix();
|
8478
|
+
range.val.todate = toDateMoment.unix();
|
8479
|
+
return range;
|
8417
8480
|
}
|
8418
8481
|
|
8482
|
+
return {};
|
8419
8483
|
};
|
8420
8484
|
|
8421
8485
|
highchartsRenderer.createDateFromString = function (dateString, format) {
|
@@ -8429,6 +8493,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8429
8493
|
}
|
8430
8494
|
|
8431
8495
|
highchartsRenderer.prepareDrillDownFilters = function (r_keys, c_keys, widget) {
|
8496
|
+
const isFormattingDatesAsOtherAxisTypes = highchartsRenderer.isFormattingDatesAsOtherAxisTypes();
|
8432
8497
|
let row_key = r_keys;
|
8433
8498
|
let col_key = c_keys;
|
8434
8499
|
if (widget.options &&
|
@@ -8446,16 +8511,18 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8446
8511
|
const labels = [];
|
8447
8512
|
colFilter.values = [];
|
8448
8513
|
lodash.forEach(col_key, function (col_value) {
|
8514
|
+
let label = col_value;
|
8449
8515
|
if (widget.cols[0].type === 'Date' && col_value !== NULL_VALUE) {
|
8450
|
-
|
8451
|
-
|
8452
|
-
highchartsRenderer.getDateFieldFormat(widget, widget.cols[0])
|
8453
|
-
);
|
8516
|
+
const format = highchartsRenderer.getDateFieldFormat(widget, widget.cols[0]);
|
8517
|
+
let date = isFormattingDatesAsOtherAxisTypes ? +col_value : highchartsRenderer.createDateFromString(col_value, format);
|
8454
8518
|
colFilter.values.push(date);
|
8519
|
+
label = isFormattingDatesAsOtherAxisTypes
|
8520
|
+
? highchartsRenderer.returnRawDataValue(widget.cols[0].type, +col_value, format, widget.cols[0].name)
|
8521
|
+
: col_value;
|
8455
8522
|
} else {
|
8456
8523
|
colFilter.values.push(col_value);
|
8457
8524
|
}
|
8458
|
-
labels.push(
|
8525
|
+
labels.push(label);
|
8459
8526
|
});
|
8460
8527
|
colFilter.value_to_show = labels.join(', ');
|
8461
8528
|
filters.push(colFilter);
|
@@ -8473,16 +8540,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8473
8540
|
if (widget && widget.cols[index]) {
|
8474
8541
|
let temp = highchartsRenderer.createFilterObject(widget.cols[index]);
|
8475
8542
|
if (widget.cols[index].type === 'Date' && col_value !== NULL_VALUE) {
|
8476
|
-
|
8477
|
-
|
8478
|
-
highchartsRenderer.getDateFieldFormat(widget, widget.cols[index])
|
8479
|
-
);
|
8543
|
+
const format = highchartsRenderer.getDateFieldFormat(widget, widget.cols[index]);
|
8544
|
+
let datetrange = highchartsRenderer.createDateTypeFromValue(col_value, format);
|
8480
8545
|
|
8481
8546
|
if ($.isEmptyObject(datetrange)) {
|
8482
8547
|
return;
|
8483
8548
|
}
|
8484
8549
|
temp.values = datetrange;
|
8485
|
-
temp.values.label =
|
8550
|
+
temp.values.label = isFormattingDatesAsOtherAxisTypes
|
8551
|
+
? highchartsRenderer.returnRawDataValue(widget.cols[index].type, +col_value, format, widget.cols[index].name)
|
8552
|
+
: col_value;
|
8486
8553
|
} else {
|
8487
8554
|
temp.values = [col_value];
|
8488
8555
|
}
|
@@ -8505,7 +8572,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8505
8572
|
return;
|
8506
8573
|
}
|
8507
8574
|
temp.values = datetrange;
|
8508
|
-
temp.values.label =
|
8575
|
+
temp.values.label = isFormattingDatesAsOtherAxisTypes
|
8576
|
+
? highchartsRenderer.returnRawDataValue(widget.rows[index].type, +row_value, format, widget.rows[index].name)
|
8577
|
+
: row_value;
|
8509
8578
|
} else {
|
8510
8579
|
temp.values = [row_value];
|
8511
8580
|
}
|
@@ -8555,6 +8624,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8555
8624
|
};
|
8556
8625
|
|
8557
8626
|
highchartsRenderer.prepareDrillDownGraphFilters = function (r_key, c_key, widget) {
|
8627
|
+
const isFormattingDatesAsOtherAxisTypes = highchartsRenderer.isFormattingDatesAsOtherAxisTypes();
|
8558
8628
|
let rowKey = r_key;
|
8559
8629
|
let colKey = c_key;
|
8560
8630
|
let widgetOptions = typeof widget.options === 'string' ? JSON.parse(widget.options) : widget.options;
|
@@ -8568,16 +8638,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8568
8638
|
let filter = lodash.find(filters, {name: widget.rows[i].name});
|
8569
8639
|
if (filter) {
|
8570
8640
|
filter.is_excluded = false;
|
8571
|
-
filter.values = widget.rows[i].type === 'Date' && rowKey[i] !== NULL_VALUE
|
8572
|
-
highchartsRenderer.createDateTypeFromValue(
|
8573
|
-
|
8641
|
+
filter.values = widget.rows[i].type === 'Date' && rowKey[i] !== NULL_VALUE
|
8642
|
+
? highchartsRenderer.createDateTypeFromValue(
|
8643
|
+
rowKey[i],
|
8644
|
+
highchartsRenderer.getDateFieldFormat(widget, widget.rows[i])
|
8645
|
+
)
|
8646
|
+
: [rowKey[i]];
|
8574
8647
|
} else {
|
8575
8648
|
filters.push(highchartsRenderer.createDrillDownFilterObject(widget, widget.rows[i], rowKey[i]))
|
8576
8649
|
}
|
8577
8650
|
}
|
8578
8651
|
|
8579
8652
|
if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
|
8580
|
-
let filter = lodash.find(filters,
|
8653
|
+
let filter = lodash.find(filters, (f) => f.name === widget.cols[0].name || f.field === widget.cols[0].id);
|
8581
8654
|
if (filter) {
|
8582
8655
|
filter.is_excluded = false;
|
8583
8656
|
} else {
|
@@ -8587,12 +8660,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8587
8660
|
filter.values = [];
|
8588
8661
|
for (let i = 0; i < colKey.length; i++) {
|
8589
8662
|
filter.values.push(
|
8590
|
-
widget.cols[0].type === 'Date' && colKey[i] !== NULL_VALUE
|
8663
|
+
widget.cols[0].type === 'Date' && colKey[i] !== NULL_VALUE && !isFormattingDatesAsOtherAxisTypes
|
8591
8664
|
? highchartsRenderer.createDateFromString(
|
8592
8665
|
colKey[i],
|
8593
8666
|
highchartsRenderer.getDateFieldFormat(widget, widget.cols[0])
|
8594
8667
|
)
|
8595
|
-
: colKey[i]
|
8668
|
+
: +colKey[i]
|
8596
8669
|
);
|
8597
8670
|
}
|
8598
8671
|
} else if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH) {
|
@@ -8615,9 +8688,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8615
8688
|
let filter = lodash.find(filters, {name: widget.cols[i].name});
|
8616
8689
|
if (filter) {
|
8617
8690
|
filter.is_excluded = false;
|
8618
|
-
filter.values = widget.cols[i].type === 'Date' && colKey[i] !== NULL_VALUE
|
8619
|
-
highchartsRenderer.createDateTypeFromValue(
|
8620
|
-
|
8691
|
+
filter.values = widget.cols[i].type === 'Date' && colKey[i] !== NULL_VALUE
|
8692
|
+
? highchartsRenderer.createDateTypeFromValue(
|
8693
|
+
colKey[i],
|
8694
|
+
highchartsRenderer.getDateFieldFormat(widget, widget.cols[i])
|
8695
|
+
)
|
8696
|
+
: [colKey[i]];
|
8621
8697
|
} else {
|
8622
8698
|
filters.push(highchartsRenderer.createDrillDownFilterObject(widget, widget.cols[i], colKey[i]))
|
8623
8699
|
}
|
@@ -8637,7 +8713,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8637
8713
|
filtOb.field = field.id;
|
8638
8714
|
filtOb.name = highchartsRenderer.decodeFunc(field.name);
|
8639
8715
|
if (field.type === 'Date' && value !== NULL_VALUE) {
|
8640
|
-
filtOb.values = highchartsRenderer.createDateTypeFromValue(
|
8716
|
+
filtOb.values = highchartsRenderer.createDateTypeFromValue(
|
8717
|
+
value,
|
8718
|
+
highchartsRenderer.getDateFieldFormat(widget, field)
|
8719
|
+
);
|
8641
8720
|
}
|
8642
8721
|
|
8643
8722
|
return filtOb;
|
@@ -8647,7 +8726,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8647
8726
|
return $.pivotUtilities.getPivotTableFormula(rowData, opts, func, axisFields, legendFields, aggregationDefaults, utils);
|
8648
8727
|
};
|
8649
8728
|
|
8650
|
-
|
8651
8729
|
// widget Renderer
|
8652
8730
|
highchartsRenderer.updateSelectedOverrideValues = function (widget, override_values, res) {
|
8653
8731
|
if (override_values && override_values.length > 0) {
|
@@ -8695,7 +8773,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8695
8773
|
};
|
8696
8774
|
|
8697
8775
|
highchartsRenderer.setNewFieldNames = function (res) {
|
8698
|
-
if (useTotalsCalculation) {
|
8776
|
+
if (highchartsRenderer.useTotalsCalculation) {
|
8699
8777
|
return res;
|
8700
8778
|
}
|
8701
8779
|
|
@@ -8709,6 +8787,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8709
8787
|
};
|
8710
8788
|
|
8711
8789
|
highchartsRenderer.getWidgetDataSorters = function (res, widget, defaultDateFormat) {
|
8790
|
+
const isFormattingDatesAsOtherAxisTypes = highchartsRenderer.isFormattingDatesAsOtherAxisTypes();
|
8791
|
+
let sorters;
|
8792
|
+
|
8712
8793
|
if ($.pivotUtilities && !$.pivotUtilities.additionalFieldsList) {
|
8713
8794
|
$.pivotUtilities.additionalFieldsList = [
|
8714
8795
|
{key: 'DR_Average', name: 'DR_Average'},
|
@@ -8716,212 +8797,202 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8716
8797
|
];
|
8717
8798
|
}
|
8718
8799
|
|
8719
|
-
|
8800
|
+
let datesFields = [];
|
8720
8801
|
datesFields = lodash.filter(widget.rows, element => element.type == 'Date');
|
8721
8802
|
datesFields = datesFields.concat(lodash.filter(widget.cols, element => element.type == 'Date'));
|
8722
8803
|
|
8723
8804
|
const isCustomSorting = widget.options.sortingFields && Array.isArray(widget.options.sortingFields) && widget.options.sortingFields.length > 0;
|
8724
8805
|
if (isCustomSorting) {
|
8725
8806
|
lodash.forEach(datesFields, function (field) {
|
8726
|
-
const fieldToSort = lodash.find(
|
8807
|
+
const fieldToSort = lodash.find(
|
8808
|
+
widget.options.sortingFields, element => element.id === field.id && lodash.get(element, 'sorting.sort_by') === 'field_items'
|
8809
|
+
);
|
8727
8810
|
field.sorting = fieldToSort ? fieldToSort.sorting : field.sorting;
|
8728
8811
|
});
|
8729
8812
|
}
|
8730
8813
|
|
8731
8814
|
datesFields = lodash.map(datesFields, function (row) {
|
8732
|
-
return {
|
8733
|
-
|
8734
|
-
|
8735
|
-
|
8736
|
-
|
8737
|
-
|
8738
|
-
|
8815
|
+
return {
|
8816
|
+
"format": isFormattingDatesAsOtherAxisTypes ? null : highchartsRenderer.getDateFieldFormat(widget, row),
|
8817
|
+
"name": row.name,
|
8818
|
+
"type": row.type,
|
8819
|
+
"values": [],
|
8820
|
+
"sorting": row.sorting
|
8821
|
+
} //'MMM - yyyy' format
|
8739
8822
|
});
|
8740
8823
|
|
8824
|
+
if (!isFormattingDatesAsOtherAxisTypes) {
|
8825
|
+
lodash.forEach(datesFields, function (row) {
|
8826
|
+
row.val_not_convert = highchartsRenderer.check_values_not_for_convert(widget, row.name);
|
8827
|
+
});
|
8828
|
+
}
|
8829
|
+
|
8741
8830
|
if (datesFields.length > 0) {
|
8742
|
-
|
8831
|
+
const invertedDateStringMap = {};
|
8832
|
+
lodash.forEach(res, function (element) {
|
8743
8833
|
for (var i in datesFields) {
|
8744
8834
|
if (element.hasOwnProperty(datesFields[i].name)) {
|
8745
8835
|
datesFields[i].values.push(element[datesFields[i].name]);
|
8746
|
-
|
8747
|
-
|
8748
|
-
|
8749
|
-
|
8750
|
-
|
8751
|
-
|
8752
|
-
|
8836
|
+
|
8837
|
+
if (!isFormattingDatesAsOtherAxisTypes) {
|
8838
|
+
const dateStringValue = highchartsRenderer.returnRawDataValue(
|
8839
|
+
datesFields[i].type, element[datesFields[i].name],
|
8840
|
+
defaultDateFormat ? defaultDateFormat : datesFields[i].format,
|
8841
|
+
datesFields[i].name, datesFields[i].val_not_convert);
|
8842
|
+
if (widget.pivot) {
|
8843
|
+
if (!widget.pivot.dateValuesDictionary) {
|
8844
|
+
widget.pivot.dateValuesDictionary = {}
|
8845
|
+
}
|
8846
|
+
widget.pivot.dateValuesDictionary[dateStringValue] = element[datesFields[i].name];
|
8847
|
+
invertedDateStringMap[element[datesFields[i].name]] = dateStringValue;
|
8753
8848
|
}
|
8754
|
-
|
8849
|
+
element[datesFields[i].name] = dateStringValue;
|
8755
8850
|
}
|
8756
|
-
element[datesFields[i].name] = dateStringValue;
|
8757
8851
|
}
|
8758
8852
|
}
|
8759
8853
|
});
|
8854
|
+
|
8855
|
+
if (highchartsRenderer.sortHasBeenDoneOnBE(lodash.get(widget, 'pivot.keysObject')) && !isFormattingDatesAsOtherAxisTypes) {
|
8856
|
+
lodash.forEach(['col_keys', 'row_keys'], (keysListName, index) => {
|
8857
|
+
const widgetFields = index ? widget.rows : widget.cols;
|
8858
|
+
const uniqueFormattedKeysList = [];
|
8859
|
+
lodash.forEach(widget.pivot.keysObject[keysListName], subKeysList => {
|
8860
|
+
lodash.forEach(subKeysList, (key, index) => {
|
8861
|
+
if (widgetFields[index] && widgetFields[index].type === 'Date') {
|
8862
|
+
subKeysList[index] = invertedDateStringMap[key] || key;
|
8863
|
+
}
|
8864
|
+
});
|
8865
|
+
if (!lodash.find(uniqueFormattedKeysList, formattedSubKeys => lodash.isEqual(formattedSubKeys, subKeysList))) {
|
8866
|
+
uniqueFormattedKeysList.push(subKeysList);
|
8867
|
+
}
|
8868
|
+
});
|
8869
|
+
widget.pivot.keysObject[keysListName] = uniqueFormattedKeysList;
|
8870
|
+
});
|
8871
|
+
}
|
8760
8872
|
}
|
8761
|
-
lodash.forEach(datesFields, function (row) {
|
8762
|
-
row.values = lodash.uniq(row.values);
|
8763
8873
|
|
8764
|
-
|
8765
|
-
|
8766
|
-
|
8767
|
-
|
8768
|
-
|
8874
|
+
if (!highchartsRenderer.sortHasBeenDoneOnBE(lodash.get(widget, 'pivot.keysObject'))) {
|
8875
|
+
|
8876
|
+
lodash.forEach(datesFields, function (row) {
|
8877
|
+
row.values = lodash.uniq(row.values);
|
8878
|
+
|
8879
|
+
const isTimestampDateField = row.type === 'Date' && lodash.some(row.values, value => typeof value ==='number');
|
8880
|
+
if (isTimestampDateField) {
|
8881
|
+
const nullValueIndex = row.values.indexOf(NULL_VALUE);
|
8882
|
+
if (~nullValueIndex) {
|
8883
|
+
row.values.splice(nullValueIndex, 1);
|
8884
|
+
}
|
8885
|
+
row.values = row.values.sort((a, b) => a - b);
|
8886
|
+
if (~nullValueIndex) {
|
8887
|
+
row.values.push(NULL_VALUE);
|
8888
|
+
}
|
8889
|
+
} else {
|
8890
|
+
row.values = row.values.sort();
|
8769
8891
|
}
|
8770
|
-
|
8771
|
-
if (
|
8772
|
-
row.values.
|
8892
|
+
|
8893
|
+
if (row.sorting && row.sorting.type == "largestToSmallest") {
|
8894
|
+
row.values = lodash.reverse(row.values);
|
8773
8895
|
}
|
8774
|
-
|
8775
|
-
row.values = row.values.sort();
|
8776
|
-
}
|
8777
|
-
|
8778
|
-
if (row.sorting && row.sorting.type == "largestToSmallest") {
|
8779
|
-
row.values = lodash.reverse(row.values);
|
8780
|
-
}
|
8781
|
-
delete row.sorting;
|
8782
|
-
row.values = lodash.map(row.values, function (val) {
|
8783
|
-
return highchartsRenderer.returnRawDataValue(row.type, val, row.format, row.name, row.val_not_convert) + "";
|
8784
|
-
})
|
8785
|
-
|
8786
|
-
});
|
8896
|
+
delete row.sorting;
|
8787
8897
|
|
8788
|
-
|
8789
|
-
|
8790
|
-
|
8898
|
+
if (!isFormattingDatesAsOtherAxisTypes) {
|
8899
|
+
row.values = lodash.map(row.values, function (val) {
|
8900
|
+
return highchartsRenderer.returnRawDataValue(row.type, val, row.format, row.name, row.val_not_convert) + "";
|
8901
|
+
});
|
8902
|
+
}
|
8903
|
+
});
|
8791
8904
|
|
8792
|
-
|
8905
|
+
/* date string */
|
8906
|
+
var rowsAndCols = [];
|
8907
|
+
rowsAndCols = widget.rows.concat(widget.cols);
|
8908
|
+
|
8909
|
+
if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
|
8910
|
+
|
8911
|
+
// if it is breakdown widget - redefine sorting according to breakdown_options
|
8912
|
+
// TODO: remove this when BE sort will be implemented (FE subtickets for story DR-18469)
|
8913
|
+
const isTwoColumnComparisonWidget = lodash.get(widget, 'options.breakdown_options.values.totals', []).length === 2;
|
8914
|
+
lodash.forEach(rowsAndCols, function (field) {
|
8915
|
+
const waterfallFieldType = field.id === widget.cols[0].id ? 'totals' : 'breakdown';
|
8916
|
+
if (waterfallFieldType !== 'totals' || isTwoColumnComparisonWidget) {
|
8917
|
+
field.sorting = {
|
8918
|
+
type: 'CustomOrder',
|
8919
|
+
values: lodash.map(
|
8920
|
+
widget.options.breakdown_options.values[waterfallFieldType],
|
8921
|
+
value => value.key
|
8922
|
+
),
|
8923
|
+
};
|
8924
|
+
} else {
|
8925
|
+
field.sorting = null;
|
8926
|
+
}
|
8927
|
+
});
|
8928
|
+
} else if (isCustomSorting) {
|
8929
|
+
lodash.forEach(rowsAndCols, function (field) {
|
8930
|
+
const fieldToSort = lodash.find(
|
8931
|
+
widget.options.sortingFields, element => element.id === field.id && lodash.get(element, 'sorting.sort_by') === 'field_items'
|
8932
|
+
);
|
8933
|
+
field.sorting = fieldToSort ? fieldToSort.sorting : field.sorting;
|
8934
|
+
});
|
8935
|
+
}
|
8793
8936
|
|
8794
|
-
// if it is breakdown widget - redefine sorting according to breakdown_options
|
8795
|
-
// TODO: remove this when BE sort will be implemented
|
8796
8937
|
lodash.forEach(rowsAndCols, function (field) {
|
8797
|
-
|
8798
|
-
|
8799
|
-
|
8800
|
-
|
8801
|
-
|
8802
|
-
|
8803
|
-
|
8804
|
-
|
8805
|
-
|
8806
|
-
|
8807
|
-
|
8808
|
-
|
8809
|
-
|
8810
|
-
|
8811
|
-
|
8812
|
-
|
8813
|
-
lodash.forEach(rowsAndCols, function (field) {
|
8814
|
-
if (field.sorting && (field.sorting.type == "DateString" || field.sorting.type == "largestToSmallest")) {
|
8815
|
-
var find_field = lodash.find(datesFields, {name: field.name});
|
8816
|
-
if (find_field) {
|
8817
|
-
if (find_field.type != 'Date')
|
8818
|
-
find_field.sorting = field.sorting;
|
8819
|
-
} else {
|
8938
|
+
if (field.sorting && (field.sorting.type == "DateString" || field.sorting.type == "largestToSmallest")) {
|
8939
|
+
var find_field = lodash.find(datesFields, {name: field.name});
|
8940
|
+
if (find_field) {
|
8941
|
+
if (find_field.type != 'Date')
|
8942
|
+
find_field.sorting = field.sorting;
|
8943
|
+
} else {
|
8944
|
+
datesFields.push({
|
8945
|
+
"format": field.format,
|
8946
|
+
"name": field.name,
|
8947
|
+
"type": field.type,
|
8948
|
+
"values": [],
|
8949
|
+
"sorting": field.sorting,
|
8950
|
+
});
|
8951
|
+
}
|
8952
|
+
} else if (field.sorting && field.sorting.type == "CustomOrder" && field.sorting.values) {
|
8820
8953
|
datesFields.push({
|
8821
8954
|
"format": field.format,
|
8822
8955
|
"name": field.name,
|
8823
8956
|
"type": field.type,
|
8824
|
-
"values":
|
8825
|
-
"sorting": field.sorting,
|
8957
|
+
"values": field.sorting.values
|
8826
8958
|
});
|
8827
8959
|
}
|
8828
|
-
} else if (field.sorting && field.sorting.type == "CustomOrder" && field.sorting.values) {
|
8829
|
-
datesFields.push({
|
8830
|
-
"format": field.format,
|
8831
|
-
"name": field.name,
|
8832
|
-
"type": field.type,
|
8833
|
-
"values": field.sorting.values
|
8834
|
-
});
|
8835
|
-
}
|
8836
|
-
});
|
8837
|
-
|
8838
|
-
if (widget.vals && widget.vals.length > 1) {
|
8839
|
-
datesFields.push({name: "DR_Values", values: lodash.map(widget.vals, 'name')});
|
8840
|
-
}
|
8841
|
-
|
8842
|
-
/****** END *******/
|
8843
|
-
|
8844
|
-
if (lodash.has(widget, "options.chartOptions.delta_column") &&
|
8845
|
-
widget.options.chartOptions.delta_column.field != '' &&
|
8846
|
-
(widget.options.chartOptions.delta_column.sort_by_variance ||
|
8847
|
-
widget.options.chartOptions.delta_column.sort_by_absolute_variance) &&
|
8848
|
-
widget.rows.length > 0 &&
|
8849
|
-
widget.cols.length > 0 &&
|
8850
|
-
widget.vals.length
|
8851
|
-
) {
|
8852
|
-
let variance_config = widget.options.chartOptions.delta_column;
|
8853
|
-
let val_field = widget.vals[0];
|
8854
|
-
let field_for_sorting = null;
|
8855
|
-
let field_with_variant = null;
|
8856
|
-
if (variance_config.field == "series") {
|
8857
|
-
field_for_sorting = widget.cols[0];
|
8858
|
-
field_with_variant = widget.rows[0];
|
8859
|
-
} else if (variance_config.field == "category") {
|
8860
|
-
field_for_sorting = widget.rows[0];
|
8861
|
-
field_with_variant = widget.cols[0];
|
8862
|
-
}
|
8863
|
-
|
8864
|
-
let data_sorted = lodash.filter(data, function (data_row) {
|
8865
|
-
return data_row[field_with_variant.name] == variance_config.name && data_row[field_for_sorting.name] != undefined;
|
8866
8960
|
});
|
8867
8961
|
|
8868
|
-
|
8869
|
-
|
8870
|
-
if (widget.options.chartOptions.delta_column.sort_by_absolute_variance) {
|
8871
|
-
data_sorted = lodash.sortBy(data_sorted, function (o) {
|
8872
|
-
if (sorting_variance === 'desc') {
|
8873
|
-
return Math.abs(o[val_field.name]) * -1;
|
8874
|
-
}
|
8875
|
-
|
8876
|
-
return Math.abs(o[val_field.name]) * 1;
|
8877
|
-
});
|
8878
|
-
} else {
|
8879
|
-
data_sorted = lodash.orderBy(data_sorted, [val_field.name], [sorting_variance]);
|
8962
|
+
if (widget.vals && widget.vals.length > 1) {
|
8963
|
+
datesFields.push({name: "DR_Values", values: lodash.map(widget.vals, 'name')});
|
8880
8964
|
}
|
8965
|
+
|
8966
|
+
/****** END *******/
|
8881
8967
|
|
8882
|
-
|
8883
|
-
|
8884
|
-
|
8885
|
-
|
8886
|
-
values_for_sort = lodash.uniq(values_for_sort);
|
8887
|
-
|
8888
|
-
if (values_for_sort.length > 0) {
|
8889
|
-
let field = lodash.find(datesFields, {name: field_for_sorting.name});
|
8968
|
+
// TODO: Remove. sortingValues looks like lagacy which is not in use neither in webclient nor in renderer
|
8969
|
+
if (widget.options && widget.options.sortingValues) {
|
8970
|
+
var field = lodash.find(datesFields, {name: widget.options.sortingValues.field});
|
8890
8971
|
if (field) {
|
8891
|
-
field.values =
|
8972
|
+
field.values = widget.options.sortingValues.values;
|
8892
8973
|
field.sorting = null;
|
8893
8974
|
} else {
|
8894
|
-
datesFields.push({
|
8975
|
+
datesFields.push({
|
8976
|
+
name: widget.options.sortingValues.field,
|
8977
|
+
values: widget.options.sortingValues.values
|
8978
|
+
});
|
8895
8979
|
}
|
8896
8980
|
}
|
8897
|
-
|
8898
|
-
|
8899
|
-
|
8900
|
-
|
8901
|
-
|
8902
|
-
|
8903
|
-
|
8904
|
-
|
8905
|
-
|
8906
|
-
|
8907
|
-
|
8981
|
+
sorters = function (attr) {
|
8982
|
+
var field = lodash.find(datesFields, {name: attr});
|
8983
|
+
if (field)
|
8984
|
+
if (field.sorting && field.sorting.type == "DateString") {
|
8985
|
+
return $.pivotUtilities.sortDateStrings(field.sorting.month_order);
|
8986
|
+
} else if (field.sorting && field.sorting.type == "largestToSmallest") {
|
8987
|
+
if (field.sorting.is_absolute)
|
8988
|
+
return $.pivotUtilities.largeToSmallSortByAbsolute;
|
8989
|
+
return $.pivotUtilities.largeToSmallSort;
|
8990
|
+
} else {
|
8991
|
+
return $.pivotUtilities.sortAs(field.values);
|
8992
|
+
}
|
8993
|
+
};
|
8908
8994
|
}
|
8909
8995
|
|
8910
|
-
let sorters = function (attr) {
|
8911
|
-
var field = lodash.find(datesFields, {name: attr});
|
8912
|
-
if (field)
|
8913
|
-
if (field.sorting && field.sorting.type == "DateString") {
|
8914
|
-
return $.pivotUtilities.sortDateStrings(field.sorting.month_order);
|
8915
|
-
} else if (field.sorting && field.sorting.type == "largestToSmallest") {
|
8916
|
-
if (field.sorting.is_absolute)
|
8917
|
-
return $.pivotUtilities.largeToSmallSortByAbsolute;
|
8918
|
-
|
8919
|
-
return $.pivotUtilities.largeToSmallSort;
|
8920
|
-
} else {
|
8921
|
-
return $.pivotUtilities.sortAs(field.values);
|
8922
|
-
}
|
8923
|
-
};
|
8924
|
-
|
8925
8996
|
return sorters;
|
8926
8997
|
};
|
8927
8998
|
|
@@ -8940,6 +9011,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8940
9011
|
|
8941
9012
|
//highchartsRenderer.getGraphOptions(scope.data, override_values, res, scope.dataModel.templatesWithOutData, scope.openDrillDownList, drillDownFunction)
|
8942
9013
|
highchartsRenderer.getGraphOptions = function (widget_obj, override_values, row_data, templates, openDrillDownListFunction, drillDownFunction) {
|
9014
|
+
|
9015
|
+
let keysObject;
|
9016
|
+
if (highchartsRenderer.isSortingOnBackendEnabled) {
|
9017
|
+
keysObject = row_data.pop();
|
9018
|
+
}
|
9019
|
+
|
8943
9020
|
let res = highchartsRenderer.updateSelectedOverrideValues(widget_obj, override_values, row_data);
|
8944
9021
|
res = highchartsRenderer.convertUniqueDateValues(widget_obj, templates, res);
|
8945
9022
|
|
@@ -8949,11 +9026,21 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8949
9026
|
res = highchartsRenderer.addTotalsToWalkthroughRowData(widget_obj, res);
|
8950
9027
|
}
|
8951
9028
|
|
9029
|
+
res = highchartsRenderer.fixIncompatibleCalculatedValuesTotals(widget_obj, res);
|
9030
|
+
|
8952
9031
|
let pivot = {};
|
8953
9032
|
|
9033
|
+
if (highchartsRenderer.sortHasBeenDoneOnBE(keysObject)) {
|
9034
|
+
pivot.keysObject = keysObject;
|
9035
|
+
}
|
9036
|
+
|
8954
9037
|
let templateNoData = lodash.find(templates, {id: widget_obj.template_id});
|
8955
9038
|
if (templateNoData) {
|
8956
9039
|
|
9040
|
+
lodash.forEach(templateNoData.fields, field => {
|
9041
|
+
field.name = highchartsRenderer.decodeFunc(field.name);
|
9042
|
+
});
|
9043
|
+
|
8957
9044
|
// we need to assign this before calling getWidgetDataSorters method
|
8958
9045
|
// other way we won't get dateValuesDictionary
|
8959
9046
|
// preserved condition templateNoData == true - not to interfere with further logic
|
@@ -8987,6 +9074,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8987
9074
|
subopts.onlyOptions = true;
|
8988
9075
|
}
|
8989
9076
|
|
9077
|
+
subopts.keysObject = keysObject;
|
9078
|
+
|
8990
9079
|
let hc_options = highchartsRenderer.rhPivotView(res, subopts, is_table, widget_obj);
|
8991
9080
|
|
8992
9081
|
return hc_options;
|
@@ -9085,7 +9174,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9085
9174
|
}
|
9086
9175
|
|
9087
9176
|
highchartsRenderer.getOptionsForLegends = function (additionOptions, rowAttrsLength, isLine, isPie) {
|
9088
|
-
const topPosition =
|
9177
|
+
const topPosition = {
|
9089
9178
|
enabled: rowAttrsLength > 0,
|
9090
9179
|
align: 'left',
|
9091
9180
|
verticalAlign: 'top',
|
@@ -9096,27 +9185,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9096
9185
|
x: -3,
|
9097
9186
|
y: isNewAngular ? -10 : -26,
|
9098
9187
|
layout: "horizontal"
|
9099
|
-
} : {
|
9100
|
-
enabled: rowAttrsLength > 0,
|
9101
|
-
align: 'left',
|
9102
|
-
verticalAlign: 'top',
|
9103
|
-
itemMarginTop: 4,
|
9104
|
-
maxHeight: 37,
|
9105
|
-
layout: "horizontal",
|
9106
|
-
padding: 0
|
9107
9188
|
};
|
9108
|
-
const bottomPosition =
|
9109
|
-
enabled: rowAttrsLength > 0,
|
9110
|
-
maxHeight: 37,
|
9111
|
-
itemMarginTop: 2,
|
9112
|
-
padding: 0
|
9113
|
-
} : {
|
9189
|
+
const bottomPosition = {
|
9114
9190
|
enabled: rowAttrsLength > 0,
|
9115
9191
|
maxHeight: 37,
|
9116
9192
|
itemMarginTop: 2,
|
9117
9193
|
padding: 0
|
9118
9194
|
};
|
9119
|
-
const rightPosition =
|
9195
|
+
const rightPosition = {
|
9120
9196
|
enabled: rowAttrsLength > 0,
|
9121
9197
|
layout: 'vertical',
|
9122
9198
|
align: 'right',
|
@@ -9124,15 +9200,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9124
9200
|
borderWidth: 0,
|
9125
9201
|
itemMarginTop: 10,
|
9126
9202
|
y: additionOptions.hideChartHeader ? -25 : (additionOptions.subtitle && additionOptions.subtitle.subtitle ? 30 : 13)
|
9127
|
-
} : {
|
9128
|
-
layout: 'vertical',
|
9129
|
-
align: 'right',
|
9130
|
-
verticalAlign: 'middle',
|
9131
|
-
borderWidth: 0,
|
9132
|
-
itemMarginTop: 2,
|
9133
|
-
enabled: rowAttrsLength > 0
|
9134
9203
|
};
|
9135
|
-
const leftPosition =
|
9204
|
+
const leftPosition = {
|
9136
9205
|
enabled: rowAttrsLength > 0,
|
9137
9206
|
layout: 'vertical',
|
9138
9207
|
align: 'left',
|
@@ -9140,13 +9209,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9140
9209
|
borderWidth: 0,
|
9141
9210
|
itemMarginTop: 10,
|
9142
9211
|
y: additionOptions.hideChartHeader ? -25 : (additionOptions.subtitle && additionOptions.subtitle.subtitle ? 30 : 13)
|
9143
|
-
} : {
|
9144
|
-
enabled: rowAttrsLength > 0,
|
9145
|
-
layout: 'vertical',
|
9146
|
-
align: 'left',
|
9147
|
-
verticalAlign: 'middle',
|
9148
|
-
borderWidth: 0,
|
9149
|
-
itemMarginTop: 2,
|
9150
9212
|
};
|
9151
9213
|
const none = {
|
9152
9214
|
enabled: false,
|
@@ -9170,14 +9232,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9170
9232
|
return none;
|
9171
9233
|
}
|
9172
9234
|
} else if (isLine) {
|
9173
|
-
return
|
9235
|
+
return leftPosition;
|
9174
9236
|
} else if (isPie) {
|
9175
|
-
return
|
9237
|
+
return rightPosition;
|
9176
9238
|
}
|
9177
9239
|
|
9178
|
-
|
9240
|
+
return topPosition;
|
9241
|
+
}
|
9242
|
+
highchartsRenderer.setStaticTicksAmount = function (yAxis) {
|
9243
|
+
yAxis.tickAmount = TICKS_COUNT;
|
9179
9244
|
}
|
9180
|
-
|
9181
9245
|
highchartsRenderer.setYAxisMinMax = function (yAxis, axisYOptions) {
|
9182
9246
|
if (!axisYOptions) {
|
9183
9247
|
return;
|
@@ -9187,11 +9251,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9187
9251
|
const maxNumber = parseInt(axisYOptions.max);
|
9188
9252
|
yAxis.min = !isNaN(minNumber) ? minNumber : null;
|
9189
9253
|
yAxis.max = !isNaN(maxNumber) ? maxNumber : null;
|
9254
|
+
if (minNumber || maxNumber) {
|
9255
|
+
highchartsRenderer.setStaticTicksAmount(yAxis);
|
9256
|
+
}
|
9190
9257
|
}
|
9191
9258
|
|
9192
9259
|
highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
|
9193
9260
|
const aggregationConfig = widget.options && widget.options.date_aggregation_configs
|
9194
|
-
?
|
9261
|
+
? lodash.find(widget.options.date_aggregation_configs, { field_id: dateField.id })
|
9195
9262
|
: null;
|
9196
9263
|
|
9197
9264
|
if (aggregationConfig && aggregationConfig.aggregate_by && aggregationConfig.is_formatting_by_aggregation_method) {
|
@@ -9256,17 +9323,19 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9256
9323
|
|
9257
9324
|
// if it is not total value - then add it as rowData data row and sum it up
|
9258
9325
|
// else - add total with calculated sum as new rowData data row (totals do not initially exist in BE response)
|
9259
|
-
if (value.trend !== 'total') {
|
9326
|
+
if (value && value.trend !== 'total') {
|
9260
9327
|
const rowIndex = lodash.findIndex(rowData, (responseRow) =>
|
9261
9328
|
lodash.every(categoryFields, (field, fieldKey) => responseRow[field.name] === value.key[fieldKey])
|
9262
9329
|
);
|
9263
|
-
|
9264
|
-
|
9265
|
-
|
9330
|
+
if (rowIndex >= 0) {
|
9331
|
+
modifiedRowData.push(rowData[rowIndex]);
|
9332
|
+
sum += rowData[rowIndex][valueField.name];
|
9333
|
+
rowData.splice(rowIndex, 1);
|
9334
|
+
}
|
9266
9335
|
} else {
|
9267
9336
|
const totalRow = {};
|
9268
|
-
|
9269
|
-
totalRow[field.name] = value.key[fieldKey];
|
9337
|
+
lodash.forEach(categoryFields, (field, fieldKey) => {
|
9338
|
+
totalRow[field.name] = value && value.key && value.key[fieldKey];
|
9270
9339
|
});
|
9271
9340
|
totalRow[valueField.name] = sum;
|
9272
9341
|
modifiedRowData.push(totalRow);
|
@@ -9287,10 +9356,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9287
9356
|
filter.values.push(colValue);
|
9288
9357
|
});
|
9289
9358
|
} else {
|
9359
|
+
const format = highchartsRenderer.getDateFieldFormat(widget, field);
|
9290
9360
|
filter.values = field.type === 'Date' && colKey !== NULL_VALUE
|
9291
|
-
? highchartsRenderer.createDateTypeFromValue(colKey,
|
9361
|
+
? highchartsRenderer.createDateTypeFromValue(colKey, format)
|
9292
9362
|
: [colKey];
|
9293
|
-
filter.value_to_show =
|
9363
|
+
filter.value_to_show = field.type === 'Date' && highchartsRenderer.isFormattingDatesAsOtherAxisTypes()
|
9364
|
+
? highchartsRenderer.returnRawDataValue(field.type, +colKey, format, field.name)
|
9365
|
+
: colKey;
|
9294
9366
|
}
|
9295
9367
|
}
|
9296
9368
|
|
@@ -9323,6 +9395,225 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9323
9395
|
});
|
9324
9396
|
}
|
9325
9397
|
|
9398
|
+
highchartsRenderer.getFiscalYearMonthModifier = function() {
|
9399
|
+
return lodash.get(document, 'ReportHippo.user.organization.fiscal_year_starts_from', 1) - 1;
|
9400
|
+
}
|
9401
|
+
|
9402
|
+
highchartsRenderer.getTimeframeByFormat = function(format) {
|
9403
|
+
if (format && highchartsRenderer.containsIgnoreCase(format, 'q'))
|
9404
|
+
return 'quarter';
|
9405
|
+
else if (format && !highchartsRenderer.containsIgnoreCase(format, 'dd') && !highchartsRenderer.containsIgnoreCase(format, 'mm') && highchartsRenderer.containsIgnoreCase(format, 'yy'))
|
9406
|
+
return 'year';
|
9407
|
+
else if (format && !highchartsRenderer.containsIgnoreCase(format, 'dd') && highchartsRenderer.containsIgnoreCase(format, 'mm') && highchartsRenderer.containsIgnoreCase(format, 'yy'))
|
9408
|
+
return 'month';
|
9409
|
+
else {
|
9410
|
+
return 'day';
|
9411
|
+
}
|
9412
|
+
}
|
9413
|
+
|
9414
|
+
// Check if chart has multiple values
|
9415
|
+
highchartsRenderer.isChartWithMultiValues = function(pivotData) {
|
9416
|
+
return lodash.get(pivotData, 'rowAttrs[0]') === 'DR_Values';
|
9417
|
+
}
|
9418
|
+
|
9419
|
+
highchartsRenderer.checkFormats = function(render_options, widget_values_format) {
|
9420
|
+
let isSecondaryAxis = false;
|
9421
|
+
let formats = [];
|
9422
|
+
if (render_options && render_options.comboOptions && render_options.comboOptions.seriesOptions) {
|
9423
|
+
isSecondaryAxis = lodash.some(render_options.comboOptions.seriesOptions, series => series.secondaryAxis);
|
9424
|
+
formats = lodash.map(render_options.comboOptions.seriesOptions, series => series.format);
|
9425
|
+
}
|
9426
|
+
const isCustomFormat = !lodash.includes(formats, widget_values_format);
|
9427
|
+
|
9428
|
+
return { isSecondaryAxis, isCustomFormat }
|
9429
|
+
}
|
9430
|
+
|
9431
|
+
highchartsRenderer.getRecordFormats = function(render_options, recordName) {
|
9432
|
+
let formats = [];
|
9433
|
+
if (render_options && render_options.comboOptions && render_options.comboOptions.seriesOptions) {
|
9434
|
+
formats = render_options.comboOptions.seriesOptions
|
9435
|
+
.filter(series => series.series === recordName)
|
9436
|
+
.map(series => series.format);
|
9437
|
+
}
|
9438
|
+
return formats;
|
9439
|
+
}
|
9440
|
+
|
9441
|
+
// Will be FALSE when all 4 conditions true: 1. User applies SecondaryAxis 2. Format on 'format editor panel' is same as any Value field table format
|
9442
|
+
// 3. Chart has more than one value fields in Values block 4. enable_new_widget_value_formatting is turned ON
|
9443
|
+
// In that case we apply for both value fields their format from the table
|
9444
|
+
// In all other cases we are applying format from editor panel to both of them (specification: DR-20955)
|
9445
|
+
highchartsRenderer.isUsingWidgetValuesFormat = function (pivotData, render_options, widget_values_format) {
|
9446
|
+
const { isSecondaryAxis, isCustomFormat } = highchartsRenderer.checkFormats(render_options, widget_values_format);
|
9447
|
+
return !highchartsRenderer.enabledNewWidgetValueFormatting || !highchartsRenderer.isChartWithMultiValues(pivotData) || !isSecondaryAxis || isCustomFormat;
|
9448
|
+
}
|
9449
|
+
|
9450
|
+
highchartsRenderer.isFormattingNumberAxis = function (pivotData) {
|
9451
|
+
return highchartsRenderer.isFormattingAxisFeatureOn() && pivotData.isFormattingAxisLabels;
|
9452
|
+
}
|
9453
|
+
|
9454
|
+
highchartsRenderer.isFormattingDatesAsOtherAxisTypes = function () {
|
9455
|
+
return highchartsRenderer.isFormattingAxisFeatureOn() && highchartsRenderer.hasFeature(FEATURES.FORMAT_DATES_AS_OTHER_AXIS_TYPES);
|
9456
|
+
}
|
9457
|
+
|
9458
|
+
highchartsRenderer.isFormattingAxisFeatureOn = function () {
|
9459
|
+
return highchartsRenderer.hasFeature(FEATURES.FORMAT_AXIS);
|
9460
|
+
}
|
9461
|
+
|
9462
|
+
highchartsRenderer.sortHasBeenDoneOnBE = function (keysObject) {
|
9463
|
+
return highchartsRenderer.isSortingOnBackendEnabled && helpers.backendSortingKeysAreNotEmpty(keysObject);
|
9464
|
+
}
|
9465
|
+
|
9466
|
+
// Method for getting formatted kyes for Axis (cols, rows)
|
9467
|
+
highchartsRenderer.getFormattedKey = function (initialKey, pivotData, type) {
|
9468
|
+
const isFlatKey = lodash.isString(initialKey) || lodash.isNumber(initialKey);
|
9469
|
+
if (isFlatKey || lodash.isArray(initialKey)) {
|
9470
|
+
let values = isFlatKey ? initialKey.toString().split(highchartsRenderer.delimer) : lodash.cloneDeep(initialKey);
|
9471
|
+
if (values) {
|
9472
|
+
lodash.forEach(values, (value, key) => {
|
9473
|
+
const formatInfo = pivotData[type][key] || {};
|
9474
|
+
const valueToFloat = parseFloat(value);
|
9475
|
+
const isDate = formatInfo.type === 'Date';
|
9476
|
+
const isDateFormatting = isDate && highchartsRenderer.isFormattingDatesAsOtherAxisTypes();
|
9477
|
+
const isNumberFormatting = !isDate && formatInfo.format && highchartsRenderer.isFormattingNumberAxis(pivotData);
|
9478
|
+
const isApplyingFormat = !isNaN(valueToFloat) && (isNumberFormatting || isDateFormatting);
|
9479
|
+
if (isApplyingFormat) {
|
9480
|
+
values[key] = highchartsRenderer.returnRawDataValue(
|
9481
|
+
formatInfo.type,
|
9482
|
+
valueToFloat,
|
9483
|
+
formatInfo.format,
|
9484
|
+
formatInfo.name,
|
9485
|
+
formatInfo.val_not_convert,
|
9486
|
+
true
|
9487
|
+
);
|
9488
|
+
}
|
9489
|
+
});
|
9490
|
+
return isFlatKey ? values.join(highchartsRenderer.delimer) : values;
|
9491
|
+
}
|
9492
|
+
}
|
9493
|
+
return initialKey;
|
9494
|
+
}
|
9495
|
+
|
9496
|
+
highchartsRenderer.getFormattedColKey = function (initialValue, pivotData) {
|
9497
|
+
return highchartsRenderer.getFormattedKey(initialValue, pivotData, 'colFormats')
|
9498
|
+
}
|
9499
|
+
|
9500
|
+
highchartsRenderer.getFormattedRowKey = function (initialValue, pivotData) {
|
9501
|
+
return highchartsRenderer.getFormattedKey(initialValue, pivotData, 'rowFormats')
|
9502
|
+
}
|
9503
|
+
|
9504
|
+
highchartsRenderer.getFormattedKeys = function(pivotData, isCols, keys) {
|
9505
|
+
keys = keys || (isCols ? pivotData.getColKeys() : pivotData.getRowKeys());
|
9506
|
+
return highchartsRenderer.isFormattingAxisFeatureOn()
|
9507
|
+
? lodash.map(keys, key => highchartsRenderer.getFormattedKey(key, pivotData, isCols ? 'colFormats' : 'rowFormats'))
|
9508
|
+
: keys;
|
9509
|
+
}
|
9510
|
+
|
9511
|
+
highchartsRenderer.getFormattedColKeys = function(pivotData, keys) {
|
9512
|
+
return highchartsRenderer.getFormattedKeys(pivotData, true, keys);
|
9513
|
+
}
|
9514
|
+
|
9515
|
+
highchartsRenderer.getFormattedRowKeys = function(pivotData, keys) {
|
9516
|
+
return highchartsRenderer.getFormattedKeys(pivotData, false, keys);
|
9517
|
+
}
|
9518
|
+
|
9519
|
+
highchartsRenderer.modifyEventPointForDrilldown = function(e, pivotData) {
|
9520
|
+
if (!highchartsRenderer.isFormattingAxisFeatureOn()) {
|
9521
|
+
return;
|
9522
|
+
}
|
9523
|
+
e.point = lodash.cloneDeep(e.point);
|
9524
|
+
e.point.name = e.point.initialName;
|
9525
|
+
e.point.series.name = lodash.get(e.point.series, 'userOptions.initialName', e.point.series.name);
|
9526
|
+
lodash.set(e, 'point.category.userOptions', e.point.initialName.toString().split(highchartsRenderer.delimer));
|
9527
|
+
}
|
9528
|
+
|
9529
|
+
highchartsRenderer.getSeriesNameInFormatterContext = function(context, pivotData) {
|
9530
|
+
return ((highchartsRenderer.isFormattingAxisFeatureOn() && lodash.get(context, 'series.userOptions.initialName')) || context.series.name || '') + "";
|
9531
|
+
}
|
9532
|
+
|
9533
|
+
highchartsRenderer.getColsInFormatterContext = function(context, pivotData) {
|
9534
|
+
return lodash.get(context, 'point.options.colsForTotal')
|
9535
|
+
|| highchartsRenderer.isFormattingAxisFeatureOn() && (lodash.get(context, 'point.initialName') || lodash.get(context, 'options.initialName'))
|
9536
|
+
|| context.key;
|
9537
|
+
}
|
9538
|
+
|
9539
|
+
highchartsRenderer.getTableFormatInfosForWidgetFields = function(widget, pivotOptions, fields) {
|
9540
|
+
return lodash.map(fields, field => ({
|
9541
|
+
type: field.type,
|
9542
|
+
name: field.name,
|
9543
|
+
format: field.type === 'Date'
|
9544
|
+
? highchartsRenderer.getDateFieldFormat(widget, field) || pivotOptions.defaultDateFormat
|
9545
|
+
: highchartsRenderer.decodeFunc(field.format),
|
9546
|
+
val_not_convert: highchartsRenderer.check_values_not_for_convert(widget, field.name),
|
9547
|
+
}));
|
9548
|
+
}
|
9549
|
+
|
9550
|
+
// We are receiving not correct format for subtotals from BE for now - so we modyfing the response
|
9551
|
+
// in order to transform it to acceptable one. It is complex to fix currently on BE side.
|
9552
|
+
// TODO: remove it when fixed on BE side
|
9553
|
+
highchartsRenderer.fixIncompatibleCalculatedValuesTotals = function(widget, res) {
|
9554
|
+
|
9555
|
+
// if it is FE side calculation or empty response - just return unmodified
|
9556
|
+
if (!highchartsRenderer.useTotalsCalculation || !lodash.get(res, 'length')) return res;
|
9557
|
+
|
9558
|
+
const calculatedValuesInValsCount = lodash.filter(
|
9559
|
+
widget.calculated_values, calcVal => lodash.some(widget.vals, { field: calcVal.field })
|
9560
|
+
).length;
|
9561
|
+
|
9562
|
+
// do transformations only if widget has calculated in values
|
9563
|
+
if (calculatedValuesInValsCount) {
|
9564
|
+
const fieldWithDrValuesNames = lodash.reduce(
|
9565
|
+
widget.calculated_values,
|
9566
|
+
(fieldNames, calcVal) => {
|
9567
|
+
const fieldName = lodash.get(lodash.find(widget.vals, { field: calcVal.field }), 'name');
|
9568
|
+
return fieldName ? lodash.concat(fieldNames, [fieldName]) : fieldNames;
|
9569
|
+
},
|
9570
|
+
[]
|
9571
|
+
);
|
9572
|
+
|
9573
|
+
const existingRecords = [];
|
9574
|
+
lodash.forEach(res, (record) => {
|
9575
|
+
|
9576
|
+
// example: replace record { Type: "Discount", City: "Brest", DR_Values: "Normal 1", Amount: 52585.14 }
|
9577
|
+
// with { Type: "Discount", City: "Brest", DR_Values: "Normal 1", value: 52585.14 }
|
9578
|
+
if (widget.vals.length > 1 && !widget.rows.length) {
|
9579
|
+
const valueFieldNameFound = lodash.find(fieldWithDrValuesNames, name => record[name]);
|
9580
|
+
if (valueFieldNameFound) {
|
9581
|
+
record.value = record[valueFieldNameFound];
|
9582
|
+
delete record[valueFieldNameFound];
|
9583
|
+
}
|
9584
|
+
}
|
9585
|
+
|
9586
|
+
// in response from BE we have currently improper column subtotals:
|
9587
|
+
// they returned with 'DR_Values' not empty - same as for regular cell values
|
9588
|
+
// so we have two records with same column values and can't define which is subtotal
|
9589
|
+
const isSameColValuesWasBefore = lodash.some(existingRecords, existingRecord =>
|
9590
|
+
lodash.every(
|
9591
|
+
lodash.concat(['DR_Values'], lodash.map(widget.cols, 'name')), fieldName => existingRecord[fieldName] === record[fieldName]
|
9592
|
+
)
|
9593
|
+
);
|
9594
|
+
const isNoRowValues = lodash.every(widget.rows, field => typeof record[field.name] === 'undefined');
|
9595
|
+
const isSubtotal = isSameColValuesWasBefore && isNoRowValues;
|
9596
|
+
|
9597
|
+
// we need to remove DR_Values for response records which suppose to be subtotals
|
9598
|
+
if (isSubtotal) {
|
9599
|
+
delete record.DR_Values;
|
9600
|
+
}
|
9601
|
+
|
9602
|
+
existingRecords.push(record);
|
9603
|
+
});
|
9604
|
+
|
9605
|
+
// Another BE issue - it is not returning correct subtotals for case we have more than one calculated values
|
9606
|
+
// It is just not counting sum there. So we remove it in order not to show improper values
|
9607
|
+
if ((calculatedValuesInValsCount > 1 || calculatedValuesInValsCount && widget.vals.length > 1) && !widget.rows.length) {
|
9608
|
+
res = lodash.filter(res, record => {
|
9609
|
+
const isColsTotal = typeof record['DR_Values'] === 'undefined';
|
9610
|
+
return !isColsTotal;
|
9611
|
+
})
|
9612
|
+
}
|
9613
|
+
}
|
9614
|
+
return res;
|
9615
|
+
}
|
9616
|
+
|
9326
9617
|
return highchartsRenderer;
|
9327
9618
|
};
|
9328
9619
|
|