@datarailsshared/dr_renderer 1.2.337 → 1.2.340
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/highcharts_renderer.js +32 -25
- package/src/pivottable.js +1 -0
- package/tests/highcharts_renderer.test.js +48 -14
package/package.json
CHANGED
@@ -145,6 +145,8 @@ const FEATURES = {
|
|
145
145
|
FORMAT_AXIS: 'use_default_table_format_for_axis',
|
146
146
|
}
|
147
147
|
|
148
|
+
const TICKS_COUNT = 5;
|
149
|
+
|
148
150
|
let getHighchartsRenderer = function ($, document, Highcharts, default_colors, highchartsRenderer,
|
149
151
|
DataFormatter, lodash, moment_lib, isNewAngular) {
|
150
152
|
|
@@ -549,7 +551,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
549
551
|
var func = function () {
|
550
552
|
var value = parseFloat(this.y);
|
551
553
|
if (pivotData) {
|
552
|
-
let series_name = highchartsRenderer.getSeriesNameInFormatterContext(this);
|
554
|
+
let series_name = highchartsRenderer.getSeriesNameInFormatterContext(this, pivotData);
|
553
555
|
var rows = series_name.split(highchartsRenderer.delimer);
|
554
556
|
|
555
557
|
if (is_drill_down_pie && highchartsRenderer.selfStartsWith(series_name, "Series ")) {
|
@@ -562,7 +564,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
562
564
|
rows = [];
|
563
565
|
}
|
564
566
|
|
565
|
-
var cols = highchartsRenderer.getColsInFormatterContext(this);
|
567
|
+
var cols = highchartsRenderer.getColsInFormatterContext(this, pivotData);
|
566
568
|
if (typeof (cols) == 'object' && cols.name) {
|
567
569
|
cols = cols.name;
|
568
570
|
}
|
@@ -730,7 +732,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
730
732
|
|
731
733
|
var y = parseFloat(this.y);
|
732
734
|
if (pivotData) {
|
733
|
-
let series_name = highchartsRenderer.getSeriesNameInFormatterContext(this);
|
735
|
+
let series_name = highchartsRenderer.getSeriesNameInFormatterContext(this, pivotData);
|
734
736
|
var rows = series_name.split(highchartsRenderer.delimer);
|
735
737
|
if (is_drill_down_pie && highchartsRenderer.selfStartsWith(series_name,"Series ")) {
|
736
738
|
rows = [];
|
@@ -741,7 +743,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
741
743
|
rows = [];
|
742
744
|
}
|
743
745
|
|
744
|
-
var cols = highchartsRenderer.getColsInFormatterContext(this);
|
746
|
+
var cols = highchartsRenderer.getColsInFormatterContext(this, pivotData);
|
745
747
|
if (!cols && is_drill_down_pie) {
|
746
748
|
cols = this.name;
|
747
749
|
}
|
@@ -768,7 +770,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
768
770
|
? isWaterfallWalkthrough
|
769
771
|
? this.key
|
770
772
|
: cols[0]
|
771
|
-
: highchartsRenderer.isFormattingAxis() && lodash.get(this, 'point.name') || cols
|
773
|
+
: highchartsRenderer.isFormattingAxis(pivotData) && lodash.get(this, 'point.name') || cols
|
772
774
|
);
|
773
775
|
|
774
776
|
highchartsRenderer.replaceDrOthersKeys(cols, rows, drOthersInAxis, othersName);
|
@@ -1157,7 +1159,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1157
1159
|
if (row_n_value && row_n_value.length > 0) {
|
1158
1160
|
ob.initialName = row_n_value.join(highchartsRenderer.delimer)
|
1159
1161
|
.replace(highchartsRenderer.DR_OTHERS_KEY, othersName);
|
1160
|
-
ob.name = highchartsRenderer.getFormattedRowKey(ob.initialName, pivotData);
|
1162
|
+
ob.name = highchartsRenderer.getFormattedRowKey(ob.initialName, pivotData);
|
1161
1163
|
}
|
1162
1164
|
lodash.forEach(col_n_keys, function (col_n_value, index) {
|
1163
1165
|
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
@@ -1200,7 +1202,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1200
1202
|
|
1201
1203
|
ob.data.push(
|
1202
1204
|
key
|
1203
|
-
? {
|
1205
|
+
? {
|
1204
1206
|
y: val,
|
1205
1207
|
initialName: lodash.unescape(key),
|
1206
1208
|
name: highchartsRenderer.getFormattedColKey(lodash.unescape(key), pivotData),
|
@@ -1661,7 +1663,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
1661
1663
|
|
1662
1664
|
let initialName = value.trend === 'total' ? value.formattedKey || value.key[0] : keys.join(highchartsRenderer.delimer);
|
1663
1665
|
let name = value.trend === 'total' ? initialName : highchartsRenderer.getFormattedColKey(initialName, pivotData);
|
1664
|
-
|
1666
|
+
|
1665
1667
|
let color = '';
|
1666
1668
|
|
1667
1669
|
if (!lodash.get(waterfallOptions, 'colors', {}) && value.color) {
|
@@ -3009,7 +3011,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3009
3011
|
zoomType: additionOptions && additionOptions.chart && additionOptions.chart.zoom_type ? additionOptions.chart.zoom_type : 'None',
|
3010
3012
|
events: {
|
3011
3013
|
'drilldown': function (e) {
|
3012
|
-
highchartsRenderer.modifyEventPointForDrilldown(e);
|
3014
|
+
highchartsRenderer.modifyEventPointForDrilldown(e, pivotData);
|
3013
3015
|
if (drilldownFunc)
|
3014
3016
|
drilldownFunc(e, this, "drilldown");
|
3015
3017
|
|
@@ -3128,7 +3130,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3128
3130
|
zoomType: 'x',
|
3129
3131
|
events: {
|
3130
3132
|
'drilldown': function (e) {
|
3131
|
-
highchartsRenderer.modifyEventPointForDrilldown(e);
|
3133
|
+
highchartsRenderer.modifyEventPointForDrilldown(e, pivotData);
|
3132
3134
|
if (drilldownFunc)
|
3133
3135
|
drilldownFunc(e, this, "drilldown");
|
3134
3136
|
|
@@ -3286,7 +3288,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
3286
3288
|
type: 'column',
|
3287
3289
|
events: {
|
3288
3290
|
'drilldown': function (e) {
|
3289
|
-
highchartsRenderer.modifyEventPointForDrilldown(e);
|
3291
|
+
highchartsRenderer.modifyEventPointForDrilldown(e, pivotData);
|
3290
3292
|
if (drilldownFunc)
|
3291
3293
|
drilldownFunc(e, this, "drilldown");
|
3292
3294
|
|
@@ -4819,7 +4821,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
4819
4821
|
result = {};
|
4820
4822
|
}
|
4821
4823
|
}
|
4822
|
-
|
4824
|
+
|
4823
4825
|
return result;
|
4824
4826
|
};
|
4825
4827
|
|
@@ -5930,7 +5932,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
5930
5932
|
opt = {};
|
5931
5933
|
}
|
5932
5934
|
opt.drillDownListFunc = (e) => {
|
5933
|
-
highchartsRenderer.modifyEventPointForDrilldown(e);
|
5935
|
+
highchartsRenderer.modifyEventPointForDrilldown(e, pivotData);
|
5934
5936
|
drillDownListFunc(e);
|
5935
5937
|
};
|
5936
5938
|
opt.insightsTooltipFunc = insightsTooltipFunc;
|
@@ -9123,7 +9125,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9123
9125
|
|
9124
9126
|
return topPosition;
|
9125
9127
|
}
|
9126
|
-
|
9128
|
+
highchartsRenderer.setStaticTicksAmount = function (yAxis) {
|
9129
|
+
yAxis.tickAmount = TICKS_COUNT;
|
9130
|
+
}
|
9127
9131
|
highchartsRenderer.setYAxisMinMax = function (yAxis, axisYOptions) {
|
9128
9132
|
if (!axisYOptions) {
|
9129
9133
|
return;
|
@@ -9133,6 +9137,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9133
9137
|
const maxNumber = parseInt(axisYOptions.max);
|
9134
9138
|
yAxis.min = !isNaN(minNumber) ? minNumber : null;
|
9135
9139
|
yAxis.max = !isNaN(maxNumber) ? maxNumber : null;
|
9140
|
+
if (minNumber || maxNumber) {
|
9141
|
+
highchartsRenderer.setStaticTicksAmount(yAxis);
|
9142
|
+
}
|
9136
9143
|
}
|
9137
9144
|
|
9138
9145
|
highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
|
@@ -9323,15 +9330,15 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9323
9330
|
return !highchartsRenderer.enabledNewWidgetValueFormatting || !highchartsRenderer.isChartWithMultiValues(pivotData) || !isSecondaryAxis || isCustomFormat;
|
9324
9331
|
}
|
9325
9332
|
|
9326
|
-
highchartsRenderer.isFormattingAxis = function () {
|
9327
|
-
return lodash.includes(lodash.get(document, 'ReportHippo.user.features', []), FEATURES.FORMAT_AXIS);
|
9333
|
+
highchartsRenderer.isFormattingAxis = function (pivotData) {
|
9334
|
+
return lodash.includes(lodash.get(document, 'ReportHippo.user.features', []), FEATURES.FORMAT_AXIS) && pivotData.isFormattingAxisLabels;
|
9328
9335
|
}
|
9329
9336
|
|
9330
9337
|
// Method for getting formatted kyes for Axis (cols, rows)
|
9331
9338
|
// TODO: Move here dates formatting from highchartsRenderer.getWidgetDataSorters. Ticket created: DR-22009
|
9332
9339
|
highchartsRenderer.getFormattedKey = function (initialKey, pivotData, type) {
|
9333
9340
|
const isFlatKey = lodash.isString(initialKey) || lodash.isNumber(initialKey);
|
9334
|
-
if (highchartsRenderer.isFormattingAxis() && (isFlatKey || lodash.isArray(initialKey))) {
|
9341
|
+
if (highchartsRenderer.isFormattingAxis(pivotData) && (isFlatKey || lodash.isArray(initialKey))) {
|
9335
9342
|
let values = isFlatKey ? initialKey.toString().split(highchartsRenderer.delimer) : lodash.cloneDeep(initialKey);
|
9336
9343
|
if (values) {
|
9337
9344
|
lodash.forEach(values, (value, key) => {
|
@@ -9357,7 +9364,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9357
9364
|
|
9358
9365
|
highchartsRenderer.getFormattedKeys = function(pivotData, isCols, keys) {
|
9359
9366
|
keys = keys || (isCols ? pivotData.getColKeys() : pivotData.getRowKeys());
|
9360
|
-
return highchartsRenderer.isFormattingAxis()
|
9367
|
+
return highchartsRenderer.isFormattingAxis(pivotData)
|
9361
9368
|
? lodash.map(keys, key => highchartsRenderer.getFormattedKey(key, pivotData, isCols ? 'colFormats' : 'rowFormats'))
|
9362
9369
|
: keys;
|
9363
9370
|
}
|
@@ -9370,8 +9377,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9370
9377
|
return highchartsRenderer.getFormattedKeys(pivotData, false, keys);
|
9371
9378
|
}
|
9372
9379
|
|
9373
|
-
highchartsRenderer.modifyEventPointForDrilldown = function(e) {
|
9374
|
-
if (!highchartsRenderer.isFormattingAxis()) {
|
9380
|
+
highchartsRenderer.modifyEventPointForDrilldown = function(e, pivotData) {
|
9381
|
+
if (!highchartsRenderer.isFormattingAxis(pivotData)) {
|
9375
9382
|
return;
|
9376
9383
|
}
|
9377
9384
|
e.point = lodash.cloneDeep(e.point);
|
@@ -9380,13 +9387,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9380
9387
|
lodash.set(e, 'point.category.userOptions', e.point.initialName.toString().split(highchartsRenderer.delimer));
|
9381
9388
|
}
|
9382
9389
|
|
9383
|
-
highchartsRenderer.getSeriesNameInFormatterContext = function(context) {
|
9384
|
-
return ((highchartsRenderer.isFormattingAxis() && lodash.get(context, 'series.userOptions.initialName')) || context.series.name || '') + "";
|
9390
|
+
highchartsRenderer.getSeriesNameInFormatterContext = function(context, pivotData) {
|
9391
|
+
return ((highchartsRenderer.isFormattingAxis(pivotData) && lodash.get(context, 'series.userOptions.initialName')) || context.series.name || '') + "";
|
9385
9392
|
}
|
9386
9393
|
|
9387
|
-
highchartsRenderer.getColsInFormatterContext = function(context) {
|
9388
|
-
return lodash.get(context, 'point.options.colsForTotal')
|
9389
|
-
|| highchartsRenderer.isFormattingAxis() && (lodash.get(context, 'point.initialName') || lodash.get(context, 'options.initialName'))
|
9394
|
+
highchartsRenderer.getColsInFormatterContext = function(context, pivotData) {
|
9395
|
+
return lodash.get(context, 'point.options.colsForTotal')
|
9396
|
+
|| highchartsRenderer.isFormattingAxis(pivotData) && (lodash.get(context, 'point.initialName') || lodash.get(context, 'options.initialName'))
|
9390
9397
|
|| context.key;
|
9391
9398
|
}
|
9392
9399
|
|
package/src/pivottable.js
CHANGED
@@ -696,6 +696,7 @@ let initPivotTable = function($, window, document) {
|
|
696
696
|
this.sortByValueAttrs = opts.sortByValueAttrs || [];
|
697
697
|
this.colFormats = opts.colFormats || [];
|
698
698
|
this.rowFormats = opts.rowFormats || [];
|
699
|
+
this.isFormattingAxisLabels = opts.rendererOptions && opts.rendererOptions.isFormattingAxisLabels;
|
699
700
|
this.getFormattedColKeys = (keys) => opts.getFormattedColKeys(this, keys);
|
700
701
|
this.getFormattedRowKeys = (keys) => opts.getFormattedRowKeys(this, keys);
|
701
702
|
|
@@ -4842,13 +4842,21 @@ describe('highcharts_renderer', () => {
|
|
4842
4842
|
|
4843
4843
|
describe('Function isFormattingAxis', () => {
|
4844
4844
|
it('should return true if FF is true', () => {
|
4845
|
+
const pivotData = { isFormattingAxisLabels: true };
|
4845
4846
|
lodash.set(document, 'ReportHippo.user.features', ['use_default_table_format_for_axis']);
|
4846
|
-
expect(highchartsRenderer.isFormattingAxis()).toEqual(true);
|
4847
|
+
expect(highchartsRenderer.isFormattingAxis(pivotData)).toEqual(true);
|
4847
4848
|
});
|
4848
4849
|
|
4849
4850
|
it('should return false if FF is false', () => {
|
4851
|
+
const pivotData = { isFormattingAxisLabels: true };
|
4850
4852
|
lodash.set(document, 'ReportHippo.user.features', []);
|
4851
|
-
expect(highchartsRenderer.isFormattingAxis()).toEqual(false);
|
4853
|
+
expect(highchartsRenderer.isFormattingAxis(pivotData)).toEqual(false);
|
4854
|
+
});
|
4855
|
+
|
4856
|
+
it('should return false if FF is true but isFormattingAxisLabels for chart is false', () => {
|
4857
|
+
const pivotData = { isFormattingAxisLabels: false };
|
4858
|
+
lodash.set(document, 'ReportHippo.user.features', []);
|
4859
|
+
expect(highchartsRenderer.isFormattingAxis(pivotData)).toEqual(false);
|
4852
4860
|
});
|
4853
4861
|
});
|
4854
4862
|
|
@@ -4863,6 +4871,7 @@ describe('highcharts_renderer', () => {
|
|
4863
4871
|
const pivotData = {
|
4864
4872
|
colFormats: ['$####.##', '₪####.##'],
|
4865
4873
|
rowFormats: ['€####.##', '£####.##'],
|
4874
|
+
isFormattingAxisLabels: true,
|
4866
4875
|
};
|
4867
4876
|
const type = 'colFormats';
|
4868
4877
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -4874,6 +4883,7 @@ describe('highcharts_renderer', () => {
|
|
4874
4883
|
const pivotData = {
|
4875
4884
|
colFormats: ['€####.##', '£####.##'],
|
4876
4885
|
rowFormats: ['$####.##', '₪####.##'],
|
4886
|
+
isFormattingAxisLabels: true,
|
4877
4887
|
};
|
4878
4888
|
const type = 'rowFormats';
|
4879
4889
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -4885,6 +4895,7 @@ describe('highcharts_renderer', () => {
|
|
4885
4895
|
const pivotData = {
|
4886
4896
|
colFormats: ['$####.##', '₪####.##'],
|
4887
4897
|
rowFormats: ['€####.##', '£####.##'],
|
4898
|
+
isFormattingAxisLabels: true,
|
4888
4899
|
};
|
4889
4900
|
const type = 'colFormats';
|
4890
4901
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -4896,6 +4907,7 @@ describe('highcharts_renderer', () => {
|
|
4896
4907
|
const pivotData = {
|
4897
4908
|
colFormats: ['€####.##', '£####.##'],
|
4898
4909
|
rowFormats: ['$####.##', '₪####.##'],
|
4910
|
+
isFormattingAxisLabels: true,
|
4899
4911
|
};
|
4900
4912
|
const type = 'rowFormats';
|
4901
4913
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -4906,6 +4918,7 @@ describe('highcharts_renderer', () => {
|
|
4906
4918
|
const initialKey = '1000 , 2000';
|
4907
4919
|
const pivotData = {
|
4908
4920
|
colFormats: ['$####.##', '₪####.##'],
|
4921
|
+
isFormattingAxisLabels: true,
|
4909
4922
|
};
|
4910
4923
|
const type = 'colFormats';
|
4911
4924
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -4916,6 +4929,7 @@ describe('highcharts_renderer', () => {
|
|
4916
4929
|
const initialKey = ['1000', '2000'];
|
4917
4930
|
const pivotData = {
|
4918
4931
|
colFormats: ['$####.##', '₪####.##'],
|
4932
|
+
isFormattingAxisLabels: true,
|
4919
4933
|
};
|
4920
4934
|
const type = 'colFormats';
|
4921
4935
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -4926,6 +4940,7 @@ describe('highcharts_renderer', () => {
|
|
4926
4940
|
const initialKey = ['1000', '2000'];
|
4927
4941
|
const pivotData = {
|
4928
4942
|
colFormats: ['$####.##', null],
|
4943
|
+
isFormattingAxisLabels: true,
|
4929
4944
|
};
|
4930
4945
|
const type = 'colFormats';
|
4931
4946
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -4936,6 +4951,7 @@ describe('highcharts_renderer', () => {
|
|
4936
4951
|
const initialKey = ['1000', '2000'];
|
4937
4952
|
const pivotData = {
|
4938
4953
|
colFormats: [null, '$####.##'],
|
4954
|
+
isFormattingAxisLabels: true,
|
4939
4955
|
};
|
4940
4956
|
const type = 'colFormats';
|
4941
4957
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -4953,6 +4969,7 @@ describe('highcharts_renderer', () => {
|
|
4953
4969
|
const pivotData = {
|
4954
4970
|
colFormats: ['$####.##', '₪####.##'],
|
4955
4971
|
rowFormats: ['€####.##', '£####.##'],
|
4972
|
+
isFormattingAxisLabels: true,
|
4956
4973
|
};
|
4957
4974
|
const type = 'colFormats';
|
4958
4975
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type,);
|
@@ -4964,6 +4981,7 @@ describe('highcharts_renderer', () => {
|
|
4964
4981
|
const pivotData = {
|
4965
4982
|
colFormats: ['€####.##', '£####.##'],
|
4966
4983
|
rowFormats: ['$####.##', '₪####.##'],
|
4984
|
+
isFormattingAxisLabels: true,
|
4967
4985
|
};
|
4968
4986
|
const type = 'rowFormats';
|
4969
4987
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -4975,6 +4993,7 @@ describe('highcharts_renderer', () => {
|
|
4975
4993
|
const pivotData = {
|
4976
4994
|
colFormats: ['$####.##', '₪####.##'],
|
4977
4995
|
rowFormats: ['€####.##', '£####.##'],
|
4996
|
+
isFormattingAxisLabels: true,
|
4978
4997
|
};
|
4979
4998
|
const type = 'colFormats';
|
4980
4999
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -4986,6 +5005,7 @@ describe('highcharts_renderer', () => {
|
|
4986
5005
|
const pivotData = {
|
4987
5006
|
colFormats: ['€####.##', '£####.##'],
|
4988
5007
|
rowFormats: ['$####.##', '₪####.##'],
|
5008
|
+
isFormattingAxisLabels: true,
|
4989
5009
|
};
|
4990
5010
|
const type = 'rowFormats';
|
4991
5011
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -4996,6 +5016,7 @@ describe('highcharts_renderer', () => {
|
|
4996
5016
|
const initialKey = '1000 , 2000';
|
4997
5017
|
const pivotData = {
|
4998
5018
|
colFormats: ['$####.##', '₪####.##'],
|
5019
|
+
isFormattingAxisLabels: true,
|
4999
5020
|
};
|
5000
5021
|
const type = 'colFormats';
|
5001
5022
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -5006,6 +5027,7 @@ describe('highcharts_renderer', () => {
|
|
5006
5027
|
const initialKey = ['1000', '2000'];
|
5007
5028
|
const pivotData = {
|
5008
5029
|
colFormats: ['$####.##', '₪####.##'],
|
5030
|
+
isFormattingAxisLabels: true,
|
5009
5031
|
};
|
5010
5032
|
const type = 'colFormats';
|
5011
5033
|
const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
|
@@ -5036,6 +5058,7 @@ describe('highcharts_renderer', () => {
|
|
5036
5058
|
const pivotData = {
|
5037
5059
|
getColKeys: () => testKeys,
|
5038
5060
|
getRowKeys: () => testKeys,
|
5061
|
+
isFormattingAxisLabels: true,
|
5039
5062
|
};
|
5040
5063
|
|
5041
5064
|
beforeEach(() => {
|
@@ -5167,6 +5190,10 @@ describe('highcharts_renderer', () => {
|
|
5167
5190
|
}
|
5168
5191
|
};
|
5169
5192
|
|
5193
|
+
const pivotData = {
|
5194
|
+
isFormattingAxisLabels: true,
|
5195
|
+
};
|
5196
|
+
|
5170
5197
|
beforeEach(() => {
|
5171
5198
|
spyOn(highchartsRenderer, 'getFormattedKeys').and.returnValue(null);
|
5172
5199
|
});
|
@@ -5175,7 +5202,7 @@ describe('highcharts_renderer', () => {
|
|
5175
5202
|
const e = lodash.cloneDeep(event);
|
5176
5203
|
lodash.set(document, 'ReportHippo.user.features', []);
|
5177
5204
|
|
5178
|
-
highchartsRenderer.modifyEventPointForDrilldown(e);
|
5205
|
+
highchartsRenderer.modifyEventPointForDrilldown(e, pivotData);
|
5179
5206
|
expect(e.point.name).toEqual(event.point.name);
|
5180
5207
|
expect(e.point.series.name).toEqual(event.point.series.name);
|
5181
5208
|
expect(e.point.category.userOptions).toEqual(event.point.category.userOptions);
|
@@ -5185,7 +5212,7 @@ describe('highcharts_renderer', () => {
|
|
5185
5212
|
const e = lodash.cloneDeep(event);
|
5186
5213
|
lodash.set(document, 'ReportHippo.user.features', ['use_default_table_format_for_axis']);
|
5187
5214
|
|
5188
|
-
highchartsRenderer.modifyEventPointForDrilldown(e);
|
5215
|
+
highchartsRenderer.modifyEventPointForDrilldown(e, pivotData);
|
5189
5216
|
expect(e.point.name).toEqual(event.point.initialName);
|
5190
5217
|
expect(e.point.series.name).toEqual(event.point.series.userOptions.initialName);
|
5191
5218
|
expect(e.point.category.userOptions).toEqual([event.point.initialName]);
|
@@ -5197,6 +5224,10 @@ describe('highcharts_renderer', () => {
|
|
5197
5224
|
const name1 = 'test series name';
|
5198
5225
|
const name2 = 'test series name 2';
|
5199
5226
|
|
5227
|
+
const pivotData = {
|
5228
|
+
isFormattingAxisLabels: true,
|
5229
|
+
};
|
5230
|
+
|
5200
5231
|
it('should return series.userOptions.initialName if it is present and axis formatting is on', () => {
|
5201
5232
|
lodash.set(document, 'ReportHippo.user.features', ['use_default_table_format_for_axis']);
|
5202
5233
|
const context = {
|
@@ -5207,7 +5238,7 @@ describe('highcharts_renderer', () => {
|
|
5207
5238
|
name: name2,
|
5208
5239
|
}
|
5209
5240
|
}
|
5210
|
-
expect(highchartsRenderer.getSeriesNameInFormatterContext(context)).toEqual(name1);
|
5241
|
+
expect(highchartsRenderer.getSeriesNameInFormatterContext(context, pivotData)).toEqual(name1);
|
5211
5242
|
});
|
5212
5243
|
|
5213
5244
|
it('should return series.name if axis formatting is on but series.userOptions.initialName is not present', () => {
|
@@ -5217,7 +5248,7 @@ describe('highcharts_renderer', () => {
|
|
5217
5248
|
name: name2,
|
5218
5249
|
}
|
5219
5250
|
}
|
5220
|
-
expect(highchartsRenderer.getSeriesNameInFormatterContext(context)).toEqual(name2);
|
5251
|
+
expect(highchartsRenderer.getSeriesNameInFormatterContext(context, pivotData)).toEqual(name2);
|
5221
5252
|
});
|
5222
5253
|
|
5223
5254
|
it('should return series.name if series.userOptions.initialName is present but axis formatting is off', () => {
|
@@ -5230,7 +5261,7 @@ describe('highcharts_renderer', () => {
|
|
5230
5261
|
name: name2,
|
5231
5262
|
}
|
5232
5263
|
}
|
5233
|
-
expect(highchartsRenderer.getSeriesNameInFormatterContext(context)).toEqual(name2);
|
5264
|
+
expect(highchartsRenderer.getSeriesNameInFormatterContext(context, pivotData)).toEqual(name2);
|
5234
5265
|
});
|
5235
5266
|
});
|
5236
5267
|
|
@@ -5238,7 +5269,10 @@ describe('highcharts_renderer', () => {
|
|
5238
5269
|
|
5239
5270
|
const name1 = 'test series name 1';
|
5240
5271
|
const name2 = 'test series name 2';
|
5241
|
-
const name3 = 'test series name 3';
|
5272
|
+
const name3 = 'test series name 3';
|
5273
|
+
const pivotData = {
|
5274
|
+
isFormattingAxisLabels: true,
|
5275
|
+
};
|
5242
5276
|
|
5243
5277
|
it('should return point.options.colsForTotal if it is present', () => {
|
5244
5278
|
const context = {
|
@@ -5253,7 +5287,7 @@ describe('highcharts_renderer', () => {
|
|
5253
5287
|
|
5254
5288
|
lodash.forEach(['use_default_table_format_for_axis'], [], features => {
|
5255
5289
|
lodash.set(document, 'ReportHippo.user.features', features);
|
5256
|
-
expect(highchartsRenderer.getColsInFormatterContext(context)).toEqual(name3);
|
5290
|
+
expect(highchartsRenderer.getColsInFormatterContext(context, pivotData)).toEqual(name3);
|
5257
5291
|
});
|
5258
5292
|
});
|
5259
5293
|
|
@@ -5268,7 +5302,7 @@ describe('highcharts_renderer', () => {
|
|
5268
5302
|
},
|
5269
5303
|
key: name2,
|
5270
5304
|
}
|
5271
|
-
expect(highchartsRenderer.getColsInFormatterContext(context)).toEqual(name1);
|
5305
|
+
expect(highchartsRenderer.getColsInFormatterContext(context, pivotData)).toEqual(name1);
|
5272
5306
|
});
|
5273
5307
|
|
5274
5308
|
it('should return context.key if FF is off and colsForTotal is not present', () => {
|
@@ -5281,8 +5315,8 @@ describe('highcharts_renderer', () => {
|
|
5281
5315
|
initialName: name3,
|
5282
5316
|
},
|
5283
5317
|
key: name2,
|
5284
|
-
}
|
5285
|
-
expect(highchartsRenderer.getColsInFormatterContext(context)).toEqual(name2);
|
5318
|
+
};
|
5319
|
+
expect(highchartsRenderer.getColsInFormatterContext(context, pivotData)).toEqual(name2);
|
5286
5320
|
});
|
5287
5321
|
|
5288
5322
|
it('should return options.initialName if FF is on, colsForTotal is not present and point.initialName is not present', () => {
|
@@ -5293,7 +5327,7 @@ describe('highcharts_renderer', () => {
|
|
5293
5327
|
},
|
5294
5328
|
key: name2,
|
5295
5329
|
}
|
5296
|
-
expect(highchartsRenderer.getColsInFormatterContext(context)).toEqual(name3);
|
5330
|
+
expect(highchartsRenderer.getColsInFormatterContext(context, pivotData)).toEqual(name3);
|
5297
5331
|
});
|
5298
5332
|
|
5299
5333
|
it('should return context.key if FF is on, no colsForTotal a, no point.initialName no options.initialName', () => {
|
@@ -5301,7 +5335,7 @@ describe('highcharts_renderer', () => {
|
|
5301
5335
|
const context = {
|
5302
5336
|
key: name2,
|
5303
5337
|
}
|
5304
|
-
expect(highchartsRenderer.getColsInFormatterContext(context)).toEqual(name2);
|
5338
|
+
expect(highchartsRenderer.getColsInFormatterContext(context, pivotData)).toEqual(name2);
|
5305
5339
|
});
|
5306
5340
|
});
|
5307
5341
|
});
|