@datarailsshared/dr_renderer 1.2.328-dragons → 1.2.330
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/package.json +1 -1
- package/src/dr_pivottable.js +8 -5
- package/src/highcharts_renderer.js +124 -165
- package/src/pivottable.js +4 -17
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
@@ -199,11 +199,10 @@ let initDRPivotTable = function($, window, document) {
|
|
199
199
|
let flatColKey = colKey.join(delim);
|
200
200
|
|
201
201
|
if (this.keysLength === rowKey.length + colKey.length) {
|
202
|
-
|
203
|
-
if ((!this.isKeysSortingDoneOnBackendSide || isDrValuesRows) && !this.rowKeys.some(rKey => rKey.join(delim) === flatRowKey)) {
|
202
|
+
if (!this.rowKeys.some(rKey => rKey.join(delim) === flatRowKey)) {
|
204
203
|
this.rowKeys.push(rowKey);
|
205
204
|
}
|
206
|
-
if (!this.
|
205
|
+
if (!this.colKeys.some(cKey => cKey.join(delim) === flatColKey)) {
|
207
206
|
this.colKeys.push(colKey);
|
208
207
|
}
|
209
208
|
}
|
@@ -235,6 +234,7 @@ let initDRPivotTable = function($, window, document) {
|
|
235
234
|
insight: insight,
|
236
235
|
});
|
237
236
|
}
|
237
|
+
|
238
238
|
return;
|
239
239
|
}
|
240
240
|
|
@@ -512,8 +512,11 @@ let initDRPivotTable = function($, window, document) {
|
|
512
512
|
return resultsArr;
|
513
513
|
} else {
|
514
514
|
let tooMuch = false;
|
515
|
-
|
516
|
-
|
515
|
+
const show_more_than_thousand_rows = _.get(opts, 'chartOptions.table_options.show_more_than_thousand_rows', false);
|
516
|
+
if (pvtData &&
|
517
|
+
(pvtData.rowKeys.length > 1000 || pvtData.colKeys.length > 500) &&
|
518
|
+
(!opts.show_more_function_cols || !opts.show_more_function_cols) &&
|
519
|
+
!show_more_than_thousand_rows) {
|
517
520
|
pvtData.rowKeys = [];
|
518
521
|
pvtData.colKeys = [];
|
519
522
|
tooMuch = true;
|
@@ -1157,7 +1157,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1157
1157
|
ob.name = row_n_value.join(highchartsRenderer.delimer)
|
1158
1158
|
.replace(highchartsRenderer.DR_OTHERS_KEY, othersName);
|
1159
1159
|
}
|
1160
|
-
|
1161
1160
|
lodash.forEach(col_n_keys, function (col_n_value, index) {
|
1162
1161
|
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
1163
1162
|
var val = agg.value();
|
@@ -1399,7 +1398,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1399
1398
|
if (opts.trendLine) {
|
1400
1399
|
const a = ((ySum * squareXSum) - (xSum * xySum)) / ((n * squareXSum) - (xSum * xSum));
|
1401
1400
|
const b = ((n * xySum) - (xSum* ySum)) / ((n * squareXSum) - (xSum * xSum));
|
1402
|
-
|
1403
1401
|
const trendSeries = lodash.clone(chart_series[chart_series.length - 1]);
|
1404
1402
|
trendSeries.className = 'trendSeries';
|
1405
1403
|
trendSeries.name = highchartsRenderer.getTrendSeriesName(trendSeries);
|
@@ -1410,7 +1408,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1410
1408
|
if (colors && colors[i]) {
|
1411
1409
|
trendSeries.color = colors[i];
|
1412
1410
|
}
|
1413
|
-
|
1414
1411
|
trendSerieses.push(trendSeries);
|
1415
1412
|
}
|
1416
1413
|
i++;
|
@@ -1427,7 +1424,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1427
1424
|
}
|
1428
1425
|
|
1429
1426
|
let weights = { line: 2,spline: 3 ,area:-2, areaspline: -1, scatter:4, column: 1 };
|
1430
|
-
|
1431
1427
|
if (opts.comboOptions && lodash.includes(chartType,'combo') && !lodash.isEqual(row_n_keys, EMPTY_ROW_N_KEYS)) {
|
1432
1428
|
chart_series.forEach((series, seriesIndex) => {
|
1433
1429
|
const savedSeriesOption = lodash.find(opts.comboOptions.seriesOptions, {series: series.name});
|
@@ -1514,7 +1510,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1514
1510
|
const chart_series = [];
|
1515
1511
|
const row_n_keys = pivotData.getRowKeys();
|
1516
1512
|
const col_n_keys = pivotData.getColKeys();
|
1517
|
-
const rows_by_cols = pivotData.rowKeysByCols;
|
1518
1513
|
|
1519
1514
|
let resultObject = {
|
1520
1515
|
data: [],
|
@@ -1543,9 +1538,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1543
1538
|
});
|
1544
1539
|
|
1545
1540
|
if (col_index !== col_n_keys.length - 1) {
|
1546
|
-
|
1547
|
-
const rowKeys = rows_by_cols ? rows_by_cols[col_index] : row_n_keys;
|
1548
|
-
lodash.forEach(rowKeys, function (row_n_value) {
|
1541
|
+
lodash.forEach(row_n_keys, function (row_n_value) {
|
1549
1542
|
const agg = pivotData.getAggregator(row_n_value, col_n_value);
|
1550
1543
|
let val = agg.value();
|
1551
1544
|
|
@@ -4510,8 +4503,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4510
4503
|
const varianceConfig = widget.options.chartOptions.delta_column;
|
4511
4504
|
const data = pivotData.input;
|
4512
4505
|
const varianceField = varianceConfig.field === 'category' ? widget.cols[0] : widget.rows[0];
|
4513
|
-
const varianceRowsForCurrentKey = lodash.filter(data, row =>
|
4514
|
-
row[varianceField.name] === varianceConfig.name
|
4506
|
+
const varianceRowsForCurrentKey = lodash.filter(data, row =>
|
4507
|
+
row[varianceField.name] === varianceConfig.name
|
4515
4508
|
&& lodash.every(secondArray, (item, index) => row[attrs[index]] === item)
|
4516
4509
|
);
|
4517
4510
|
|
@@ -4522,7 +4515,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4522
4515
|
if (lodash.includes(pivotData.rowAttrs, attrs[fieldIndex])) {
|
4523
4516
|
getAggregatorParams = lodash.reverse(getAggregatorParams);
|
4524
4517
|
}
|
4525
|
-
|
4518
|
+
|
4526
4519
|
let aggregator_subtotal = pivotData.getAggregator(...getAggregatorParams);
|
4527
4520
|
|
4528
4521
|
if (aggregator_subtotal) {
|
@@ -4785,23 +4778,21 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4785
4778
|
opts.rendererOptions.onlyOptions = true;
|
4786
4779
|
}
|
4787
4780
|
|
4788
|
-
|
4789
|
-
|
4790
|
-
|
4791
|
-
|
4792
|
-
|
4793
|
-
|
4794
|
-
|
4795
|
-
|
4796
|
-
|
4797
|
-
|
4798
|
-
|
4799
|
-
pivotData.sorters = new_sorting_function;
|
4781
|
+
const sortByValueSettings = lodash.filter(
|
4782
|
+
lodash.get(widget, 'options.sortingFields', []),
|
4783
|
+
sortingField => lodash.includes(['field_values', 'variance'], lodash.get(sortingField, 'sorting.sort_by'))
|
4784
|
+
);
|
4785
|
+
|
4786
|
+
if (sortByValueSettings.length) {
|
4787
|
+
pivotData.sortByValueAttrs = lodash.map(sortByValueSettings, fieldSorting => fieldSorting.name);
|
4788
|
+
let new_sorting_function = highchartsRenderer.generateSortingFunctionByValues(sortByValueSettings, pivotData, opts, widget);
|
4789
|
+
opts.sorters = new_sorting_function;
|
4790
|
+
optsFiltered.sorters = new_sorting_function;
|
4791
|
+
pivotData.sorters = new_sorting_function;
|
4800
4792
|
|
4801
4793
|
if (lodash.isObject(lodash.get(widget, 'pivot'))) {
|
4802
4794
|
widget.pivot.sorters = new_sorting_function;
|
4803
4795
|
}
|
4804
|
-
}
|
4805
4796
|
}
|
4806
4797
|
|
4807
4798
|
result = opts.renderer(pivotData, opts.rendererOptions);
|
@@ -4860,7 +4851,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4860
4851
|
rows: lodash.map(pivotOptions.legendArray, 'name'),
|
4861
4852
|
rendererOptions: widget.options,
|
4862
4853
|
dateValuesDictionary: pivotOptions ? pivotOptions.dateValuesDictionary : null,
|
4863
|
-
keysObject: pivotOptions ? pivotOptions.keysObject : null,
|
4864
4854
|
};
|
4865
4855
|
|
4866
4856
|
if (!subopts.rendererOptions) {
|
@@ -6481,6 +6471,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
6481
6471
|
value_name: 'eliminate_calc_totals',
|
6482
6472
|
default_value: false
|
6483
6473
|
},
|
6474
|
+
{
|
6475
|
+
element_type: 'checkbox',
|
6476
|
+
element_label: 'Show data in dashboard if more than 1000 rows',
|
6477
|
+
value_name: 'show_more_than_thousand_rows',
|
6478
|
+
default_value: false,
|
6479
|
+
showFn: chartType => chartType === highchartsRenderer.CHART_TYPES.TABLE_ONLY,
|
6480
|
+
disabled_fn: (value) => !!value.use_handsOnTable
|
6481
|
+
},
|
6484
6482
|
]
|
6485
6483
|
},
|
6486
6484
|
'value': {
|
@@ -8596,7 +8594,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8596
8594
|
}
|
8597
8595
|
|
8598
8596
|
if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
|
8599
|
-
let filter = lodash.find(filters,
|
8597
|
+
let filter = lodash.find(filters, (f) => f.name === widget.cols[0].name || f.field === widget.cols[0].id);
|
8600
8598
|
if (filter) {
|
8601
8599
|
filter.is_excluded = false;
|
8602
8600
|
} else {
|
@@ -8727,8 +8725,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8727
8725
|
};
|
8728
8726
|
|
8729
8727
|
highchartsRenderer.getWidgetDataSorters = function (res, widget, defaultDateFormat) {
|
8730
|
-
let sorters;
|
8731
|
-
|
8732
8728
|
if ($.pivotUtilities && !$.pivotUtilities.additionalFieldsList) {
|
8733
8729
|
$.pivotUtilities.additionalFieldsList = [
|
8734
8730
|
{key: 'DR_Average', name: 'DR_Average'},
|
@@ -8736,7 +8732,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8736
8732
|
];
|
8737
8733
|
}
|
8738
8734
|
|
8739
|
-
|
8735
|
+
var datesFields = [];
|
8740
8736
|
datesFields = lodash.filter(widget.rows, element => element.type == 'Date');
|
8741
8737
|
datesFields = datesFields.concat(lodash.filter(widget.cols, element => element.type == 'Date'));
|
8742
8738
|
|
@@ -8754,13 +8750,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8754
8750
|
return { "format": highchartsRenderer.getDateFieldFormat(widget, row), "name": row.name, "type": row.type, "values": [], "sorting": row.sorting } //'MMM - yyyy' format
|
8755
8751
|
});
|
8756
8752
|
|
8753
|
+
var data = res;
|
8754
|
+
|
8757
8755
|
lodash.forEach(datesFields, function (row) {
|
8758
8756
|
row.val_not_convert = highchartsRenderer.check_values_not_for_convert(widget, row.name);
|
8759
8757
|
});
|
8760
8758
|
|
8761
8759
|
if (datesFields.length > 0) {
|
8762
|
-
|
8763
|
-
lodash.forEach(res, function (element) {
|
8760
|
+
lodash.forEach(data, function (element) {
|
8764
8761
|
for (var i in datesFields) {
|
8765
8762
|
if (element.hasOwnProperty(datesFields[i].name)) {
|
8766
8763
|
datesFields[i].values.push(element[datesFields[i].name]);
|
@@ -8773,147 +8770,125 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8773
8770
|
widget.pivot.dateValuesDictionary = {}
|
8774
8771
|
}
|
8775
8772
|
widget.pivot.dateValuesDictionary[dateStringValue] = element[datesFields[i].name];
|
8776
|
-
invertedDateStringMap[element[datesFields[i].name]] = dateStringValue;
|
8777
8773
|
}
|
8778
8774
|
element[datesFields[i].name] = dateStringValue;
|
8779
8775
|
}
|
8780
8776
|
}
|
8781
8777
|
});
|
8782
|
-
|
8783
|
-
if (highchartsRenderer.isSortingOnBackendEnabled() && widget.pivot?.keysObject) {
|
8784
|
-
lodash.forEach(['col_keys', 'row_keys'], (keysListName, index) => {
|
8785
|
-
const widgetFields = index ? widget.rows : widget.cols;
|
8786
|
-
const uniqueFormattedKeysList = [];
|
8787
|
-
lodash.forEach(widget.pivot.keysObject[keysListName], subKeysList => {
|
8788
|
-
lodash.forEach(subKeysList, (key, index) => {
|
8789
|
-
if (widgetFields[index].type === 'Date') {
|
8790
|
-
subKeysList[index] = invertedDateStringMap[key] || key;
|
8791
|
-
}
|
8792
|
-
});
|
8793
|
-
if (!lodash.find(uniqueFormattedKeysList, formattedSubKeys => lodash.isEqual(formattedSubKeys, subKeysList))) {
|
8794
|
-
uniqueFormattedKeysList.push(subKeysList);
|
8795
|
-
}
|
8796
|
-
});
|
8797
|
-
widget.pivot.keysObject[keysListName] = uniqueFormattedKeysList;
|
8798
|
-
});
|
8799
|
-
}
|
8800
8778
|
}
|
8779
|
+
lodash.forEach(datesFields, function (row) {
|
8780
|
+
row.values = lodash.uniq(row.values);
|
8801
8781
|
|
8802
|
-
|
8803
|
-
|
8804
|
-
|
8805
|
-
|
8806
|
-
|
8807
|
-
const isTimestampDateField = row.type === 'Date' && lodash.some(row.values, value => typeof value ==='number');
|
8808
|
-
if (isTimestampDateField) {
|
8809
|
-
const nullValueIndex = row.values.indexOf(NULL_VALUE);
|
8810
|
-
if (~nullValueIndex) {
|
8811
|
-
row.values.splice(nullValueIndex, 1);
|
8812
|
-
}
|
8813
|
-
row.values = row.values.sort((a, b) => a - b);
|
8814
|
-
if (~nullValueIndex) {
|
8815
|
-
row.values.push(NULL_VALUE);
|
8816
|
-
}
|
8817
|
-
} else {
|
8818
|
-
row.values = row.values.sort();
|
8782
|
+
const isTimestampDateField = row.type === 'Date' && lodash.some(row.values, value => typeof value ==='number');
|
8783
|
+
if (isTimestampDateField) {
|
8784
|
+
const nullValueIndex = row.values.indexOf(NULL_VALUE);
|
8785
|
+
if (~nullValueIndex) {
|
8786
|
+
row.values.splice(nullValueIndex, 1);
|
8819
8787
|
}
|
8820
|
-
|
8821
|
-
if (
|
8822
|
-
row.values
|
8788
|
+
row.values = row.values.sort((a, b) => a - b);
|
8789
|
+
if (~nullValueIndex) {
|
8790
|
+
row.values.push(NULL_VALUE);
|
8823
8791
|
}
|
8824
|
-
|
8825
|
-
row.values =
|
8826
|
-
|
8827
|
-
})
|
8828
|
-
|
8829
|
-
});
|
8792
|
+
} else {
|
8793
|
+
row.values = row.values.sort();
|
8794
|
+
}
|
8830
8795
|
|
8831
|
-
|
8832
|
-
|
8833
|
-
rowsAndCols = widget.rows.concat(widget.cols);
|
8834
|
-
|
8835
|
-
if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
|
8836
|
-
|
8837
|
-
// if it is breakdown widget - redefine sorting according to breakdown_options
|
8838
|
-
// TODO: remove this when BE sort will be implemented
|
8839
|
-
lodash.forEach(rowsAndCols, function (field) {
|
8840
|
-
const waterfallFieldType = field.id === widget.cols[0].id ? 'totals' : 'breakdown';
|
8841
|
-
field.sorting = {
|
8842
|
-
type: 'CustomOrder',
|
8843
|
-
values: lodash.map(
|
8844
|
-
widget.options.breakdown_options.values[waterfallFieldType],
|
8845
|
-
value => value.key
|
8846
|
-
),
|
8847
|
-
};
|
8848
|
-
});
|
8849
|
-
} else if (isCustomSorting) {
|
8850
|
-
lodash.forEach(rowsAndCols, function (field) {
|
8851
|
-
const fieldToSort = lodash.find(
|
8852
|
-
widget.options.sortingFields, element => element.id === field.id && lodash.get(element, 'sorting.sort_by') === 'field_items'
|
8853
|
-
);
|
8854
|
-
field.sorting = fieldToSort ? fieldToSort.sorting : field.sorting;
|
8855
|
-
});
|
8796
|
+
if (row.sorting && row.sorting.type == "largestToSmallest") {
|
8797
|
+
row.values = lodash.reverse(row.values);
|
8856
8798
|
}
|
8799
|
+
delete row.sorting;
|
8800
|
+
row.values = lodash.map(row.values, function (val) {
|
8801
|
+
return highchartsRenderer.returnRawDataValue(row.type, val, row.format, row.name, row.val_not_convert) + "";
|
8802
|
+
})
|
8803
|
+
|
8804
|
+
});
|
8805
|
+
|
8806
|
+
/* date string */
|
8807
|
+
var rowsAndCols = [];
|
8808
|
+
rowsAndCols = widget.rows.concat(widget.cols);
|
8857
8809
|
|
8810
|
+
if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN) {
|
8811
|
+
|
8812
|
+
// if it is breakdown widget - redefine sorting according to breakdown_options
|
8813
|
+
// TODO: remove this when BE sort will be implemented
|
8858
8814
|
lodash.forEach(rowsAndCols, function (field) {
|
8859
|
-
|
8860
|
-
|
8861
|
-
|
8862
|
-
|
8863
|
-
|
8864
|
-
|
8865
|
-
|
8866
|
-
|
8867
|
-
|
8868
|
-
|
8869
|
-
|
8870
|
-
|
8871
|
-
|
8872
|
-
|
8873
|
-
|
8815
|
+
const waterfallFieldType = field.id === widget.cols[0].id ? 'totals' : 'breakdown';
|
8816
|
+
field.sorting = {
|
8817
|
+
type: 'CustomOrder',
|
8818
|
+
values: lodash.map(
|
8819
|
+
widget.options.breakdown_options.values[waterfallFieldType],
|
8820
|
+
value => value.key
|
8821
|
+
),
|
8822
|
+
};
|
8823
|
+
});
|
8824
|
+
} else if (isCustomSorting) {
|
8825
|
+
lodash.forEach(rowsAndCols, function (field) {
|
8826
|
+
const fieldToSort = lodash.find(
|
8827
|
+
widget.options.sortingFields, element => element.id === field.id && lodash.get(element, 'sorting.sort_by') === 'field_items'
|
8828
|
+
);
|
8829
|
+
field.sorting = fieldToSort ? fieldToSort.sorting : field.sorting;
|
8830
|
+
});
|
8831
|
+
}
|
8832
|
+
|
8833
|
+
lodash.forEach(rowsAndCols, function (field) {
|
8834
|
+
if (field.sorting && (field.sorting.type == "DateString" || field.sorting.type == "largestToSmallest")) {
|
8835
|
+
var find_field = lodash.find(datesFields, {name: field.name});
|
8836
|
+
if (find_field) {
|
8837
|
+
if (find_field.type != 'Date')
|
8838
|
+
find_field.sorting = field.sorting;
|
8839
|
+
} else {
|
8874
8840
|
datesFields.push({
|
8875
8841
|
"format": field.format,
|
8876
8842
|
"name": field.name,
|
8877
8843
|
"type": field.type,
|
8878
|
-
"values":
|
8844
|
+
"values": [],
|
8845
|
+
"sorting": field.sorting,
|
8879
8846
|
});
|
8880
8847
|
}
|
8881
|
-
})
|
8848
|
+
} else if (field.sorting && field.sorting.type == "CustomOrder" && field.sorting.values) {
|
8849
|
+
datesFields.push({
|
8850
|
+
"format": field.format,
|
8851
|
+
"name": field.name,
|
8852
|
+
"type": field.type,
|
8853
|
+
"values": field.sorting.values
|
8854
|
+
});
|
8855
|
+
}
|
8856
|
+
});
|
8857
|
+
|
8858
|
+
if (widget.vals && widget.vals.length > 1) {
|
8859
|
+
datesFields.push({name: "DR_Values", values: lodash.map(widget.vals, 'name')});
|
8860
|
+
}
|
8882
8861
|
|
8883
|
-
|
8884
|
-
|
8862
|
+
/****** END *******/
|
8863
|
+
|
8864
|
+
// TODO: Remove. sortingValues looks like lagacy which is not in use neither in webclient nor in renderer
|
8865
|
+
if (widget.options && widget.options.sortingValues) {
|
8866
|
+
var field = lodash.find(datesFields, {name: widget.options.sortingValues.field});
|
8867
|
+
if (field) {
|
8868
|
+
field.values = widget.options.sortingValues.values;
|
8869
|
+
field.sorting = null;
|
8870
|
+
} else {
|
8871
|
+
datesFields.push({
|
8872
|
+
name: widget.options.sortingValues.field,
|
8873
|
+
values: widget.options.sortingValues.values
|
8874
|
+
});
|
8885
8875
|
}
|
8886
|
-
|
8887
|
-
|
8888
|
-
|
8889
|
-
|
8890
|
-
if (
|
8891
|
-
|
8892
|
-
|
8893
|
-
|
8894
|
-
field.sorting
|
8876
|
+
}
|
8877
|
+
|
8878
|
+
let sorters = function (attr) {
|
8879
|
+
var field = lodash.find(datesFields, {name: attr});
|
8880
|
+
if (field)
|
8881
|
+
if (field.sorting && field.sorting.type == "DateString") {
|
8882
|
+
return $.pivotUtilities.sortDateStrings(field.sorting.month_order);
|
8883
|
+
} else if (field.sorting && field.sorting.type == "largestToSmallest") {
|
8884
|
+
if (field.sorting.is_absolute)
|
8885
|
+
return $.pivotUtilities.largeToSmallSortByAbsolute;
|
8886
|
+
|
8887
|
+
return $.pivotUtilities.largeToSmallSort;
|
8895
8888
|
} else {
|
8896
|
-
|
8897
|
-
name: widget.options.sortingValues.field,
|
8898
|
-
values: widget.options.sortingValues.values
|
8899
|
-
});
|
8889
|
+
return $.pivotUtilities.sortAs(field.values);
|
8900
8890
|
}
|
8901
|
-
|
8902
|
-
sorters = function (attr) {
|
8903
|
-
var field = lodash.find(datesFields, {name: attr});
|
8904
|
-
if (field)
|
8905
|
-
if (field.sorting && field.sorting.type == "DateString") {
|
8906
|
-
return $.pivotUtilities.sortDateStrings(field.sorting.month_order);
|
8907
|
-
} else if (field.sorting && field.sorting.type == "largestToSmallest") {
|
8908
|
-
if (field.sorting.is_absolute)
|
8909
|
-
return $.pivotUtilities.largeToSmallSortByAbsolute;
|
8910
|
-
|
8911
|
-
return $.pivotUtilities.largeToSmallSort;
|
8912
|
-
} else {
|
8913
|
-
return $.pivotUtilities.sortAs(field.values);
|
8914
|
-
}
|
8915
|
-
};
|
8916
|
-
}
|
8891
|
+
};
|
8917
8892
|
|
8918
8893
|
return sorters;
|
8919
8894
|
};
|
@@ -8933,12 +8908,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8933
8908
|
|
8934
8909
|
//highchartsRenderer.getGraphOptions(scope.data, override_values, res, scope.dataModel.templatesWithOutData, scope.openDrillDownList, drillDownFunction)
|
8935
8910
|
highchartsRenderer.getGraphOptions = function (widget_obj, override_values, row_data, templates, openDrillDownListFunction, drillDownFunction) {
|
8936
|
-
|
8937
|
-
let keysObject;
|
8938
|
-
if (highchartsRenderer.isSortingOnBackendEnabled()) {
|
8939
|
-
keysObject = row_data.pop();
|
8940
|
-
}
|
8941
|
-
|
8942
8911
|
let res = highchartsRenderer.updateSelectedOverrideValues(widget_obj, override_values, row_data);
|
8943
8912
|
res = highchartsRenderer.convertUniqueDateValues(widget_obj, templates, res);
|
8944
8913
|
|
@@ -8950,10 +8919,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8950
8919
|
|
8951
8920
|
let pivot = {};
|
8952
8921
|
|
8953
|
-
if (highchartsRenderer.isSortingOnBackendEnabled()) {
|
8954
|
-
pivot.keysObject = keysObject;
|
8955
|
-
}
|
8956
|
-
|
8957
8922
|
let templateNoData = lodash.find(templates, {id: widget_obj.template_id});
|
8958
8923
|
if (templateNoData) {
|
8959
8924
|
|
@@ -8990,8 +8955,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8990
8955
|
subopts.onlyOptions = true;
|
8991
8956
|
}
|
8992
8957
|
|
8993
|
-
subopts.keysObject = keysObject;
|
8994
|
-
|
8995
8958
|
let hc_options = highchartsRenderer.rhPivotView(res, subopts, is_table, widget_obj);
|
8996
8959
|
|
8997
8960
|
return hc_options;
|
@@ -9346,10 +9309,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9346
9309
|
return highchartsRenderer.enabledNewWidgetValueFormatting && (isCustomFormat || !isSecondaryAxis);
|
9347
9310
|
}
|
9348
9311
|
|
9349
|
-
highchartsRenderer.isSortingOnBackendEnabled = function() {
|
9350
|
-
return lodash.includes(lodash.get(document, 'ReportHippo.user.features'), 'enable_server_widget_data_sorting');
|
9351
|
-
}
|
9352
|
-
|
9353
9312
|
return highchartsRenderer;
|
9354
9313
|
};
|
9355
9314
|
|
package/src/pivottable.js
CHANGED
@@ -686,17 +686,8 @@ let initPivotTable = function($, window, document) {
|
|
686
686
|
});
|
687
687
|
this.tree = {};
|
688
688
|
this.insights = [];
|
689
|
-
|
690
|
-
this.
|
691
|
-
if (this.isKeysSortingDoneOnBackendSide) {
|
692
|
-
this.rowKeys = opts.keysObject.row_keys;
|
693
|
-
this.colKeys = opts.keysObject.col_keys;
|
694
|
-
// TODO: add also for breakdown sort object when BE story is ready.
|
695
|
-
} else {
|
696
|
-
this.rowKeys = [];
|
697
|
-
this.colKeys = [];
|
698
|
-
}
|
699
|
-
|
689
|
+
this.rowKeys = [];
|
690
|
+
this.colKeys = [];
|
700
691
|
this.rowTotals = {};
|
701
692
|
this.colTotals = {};
|
702
693
|
this.allTotal = this.aggregator(this, [], []);
|
@@ -862,16 +853,12 @@ let initPivotTable = function($, window, document) {
|
|
862
853
|
};
|
863
854
|
|
864
855
|
PivotData.prototype.getColKeys = function() {
|
865
|
-
|
866
|
-
this.sortKeys();
|
867
|
-
}
|
856
|
+
this.sortKeys();
|
868
857
|
return this.colKeys;
|
869
858
|
};
|
870
859
|
|
871
860
|
PivotData.prototype.getRowKeys = function() {
|
872
|
-
|
873
|
-
this.sortKeys();
|
874
|
-
}
|
861
|
+
this.sortKeys();
|
875
862
|
return this.rowKeys;
|
876
863
|
};
|
877
864
|
|