@datarailsshared/dr_renderer 1.2.69 → 1.2.73
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 +1 -1
- package/src/highcharts_renderer.js +10 -4
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
|
@@ -146,7 +146,7 @@ let initDRPivotTable = function($, window, document) {
|
|
|
146
146
|
DRPivotData.prototype.processRecord = function(record, useTotalsCalculation) {
|
|
147
147
|
if (useTotalsCalculation) {
|
|
148
148
|
if (!this.notFirst) {
|
|
149
|
-
this.keysLength = _.keys(record).length - 1;
|
|
149
|
+
this.keysLength = _.filter(_.keys(record), key => !['data_types', 'formats', 'values_formats'].includes(key)).length - 1;
|
|
150
150
|
this.notFirst = true;
|
|
151
151
|
}
|
|
152
152
|
let getRowAggregator = (function(_this) {
|
|
@@ -465,7 +465,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
465
465
|
rows = temp;
|
|
466
466
|
}
|
|
467
467
|
|
|
468
|
-
if (opts && opts.chartOptions && opts.chartOptions.label && opts.chartOptions.label.
|
|
468
|
+
if (opts && opts.chartOptions && opts.chartOptions.label && opts.chartOptions.label.percentage) {
|
|
469
|
+
return (Math.round((this.y / this.total) * 10000) / 100) + '%';
|
|
470
|
+
} else if (opts && opts.chartOptions && opts.chartOptions.label && opts.chartOptions.label.show_percentage) {
|
|
469
471
|
let aggrPercentages = pivotData.getAggregator(rows, [])
|
|
470
472
|
let total = aggrPercentages.value()
|
|
471
473
|
percentages = total ? ' (' + Math.round(value/total * 100) + '%)' : '';
|
|
@@ -917,6 +919,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
917
919
|
const n = col_n_keys.length;
|
|
918
920
|
const xSum = (1 + n) / 2 * n;
|
|
919
921
|
const trendSerieses = [];
|
|
922
|
+
const othersName = lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others';
|
|
920
923
|
|
|
921
924
|
lodash.forEach(row_n_keys, function (row_n_value) {
|
|
922
925
|
var ob = {};
|
|
@@ -925,7 +928,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
925
928
|
let squareXSum = 0;
|
|
926
929
|
ob.data = [];
|
|
927
930
|
if (row_n_value && row_n_value.length > 0) {
|
|
928
|
-
let othersName = lodash.get(opts, "total_value_options.filter_options.filteredOutFieldName") || 'Others';
|
|
929
931
|
ob.name = row_n_value.join(highchartsRenderer.delimer).replace('DR_Others', othersName);
|
|
930
932
|
}
|
|
931
933
|
|
|
@@ -933,6 +935,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
933
935
|
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
|
934
936
|
var val = agg.value();
|
|
935
937
|
|
|
938
|
+
if (col_n_value[0] === 'DR_Others') {
|
|
939
|
+
col_n_value[0] = othersName;
|
|
940
|
+
}
|
|
941
|
+
|
|
936
942
|
if (isUniqueVals && agg.uniq)
|
|
937
943
|
val = agg.uniq.join('<br>');
|
|
938
944
|
|
|
@@ -1105,8 +1111,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1105
1111
|
}
|
|
1106
1112
|
tmoobj.name = lodash.unescape(key);
|
|
1107
1113
|
|
|
1108
|
-
if (
|
|
1109
|
-
tmoobj.name =
|
|
1114
|
+
if (tmoobj.name) {
|
|
1115
|
+
tmoobj.name = tmoobj.name.replace('DR_Others', othersName);
|
|
1110
1116
|
}
|
|
1111
1117
|
|
|
1112
1118
|
if (lodash.isEmpty(String(tmoobj.name))) {
|