@datarailsshared/dr_renderer 1.2.334 → 1.2.337
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
CHANGED
@@ -549,7 +549,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
549
549
|
var func = function () {
|
550
550
|
var value = parseFloat(this.y);
|
551
551
|
if (pivotData) {
|
552
|
-
let series_name = (this
|
552
|
+
let series_name = highchartsRenderer.getSeriesNameInFormatterContext(this);
|
553
553
|
var rows = series_name.split(highchartsRenderer.delimer);
|
554
554
|
|
555
555
|
if (is_drill_down_pie && highchartsRenderer.selfStartsWith(series_name, "Series ")) {
|
@@ -562,7 +562,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
562
562
|
rows = [];
|
563
563
|
}
|
564
564
|
|
565
|
-
var cols =
|
565
|
+
var cols = highchartsRenderer.getColsInFormatterContext(this);
|
566
566
|
if (typeof (cols) == 'object' && cols.name) {
|
567
567
|
cols = cols.name;
|
568
568
|
}
|
@@ -730,7 +730,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
730
730
|
|
731
731
|
var y = parseFloat(this.y);
|
732
732
|
if (pivotData) {
|
733
|
-
let series_name = (this
|
733
|
+
let series_name = highchartsRenderer.getSeriesNameInFormatterContext(this);
|
734
734
|
var rows = series_name.split(highchartsRenderer.delimer);
|
735
735
|
if (is_drill_down_pie && highchartsRenderer.selfStartsWith(series_name,"Series ")) {
|
736
736
|
rows = [];
|
@@ -741,7 +741,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
741
741
|
rows = [];
|
742
742
|
}
|
743
743
|
|
744
|
-
var cols =
|
744
|
+
var cols = highchartsRenderer.getColsInFormatterContext(this);
|
745
745
|
if (!cols && is_drill_down_pie) {
|
746
746
|
cols = this.name;
|
747
747
|
}
|
@@ -768,7 +768,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
768
768
|
? isWaterfallWalkthrough
|
769
769
|
? this.key
|
770
770
|
: cols[0]
|
771
|
-
: cols
|
771
|
+
: highchartsRenderer.isFormattingAxis() && lodash.get(this, 'point.name') || cols
|
772
772
|
);
|
773
773
|
|
774
774
|
highchartsRenderer.replaceDrOthersKeys(cols, rows, drOthersInAxis, othersName);
|
@@ -9376,9 +9376,20 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
9376
9376
|
}
|
9377
9377
|
e.point = lodash.cloneDeep(e.point);
|
9378
9378
|
e.point.name = e.point.initialName;
|
9379
|
+
e.point.series.name = lodash.get(e.point.series, 'userOptions.initialName', e.point.series.name);
|
9379
9380
|
lodash.set(e, 'point.category.userOptions', e.point.initialName.toString().split(highchartsRenderer.delimer));
|
9380
9381
|
}
|
9381
9382
|
|
9383
|
+
highchartsRenderer.getSeriesNameInFormatterContext = function(context) {
|
9384
|
+
return ((highchartsRenderer.isFormattingAxis() && lodash.get(context, 'series.userOptions.initialName')) || context.series.name || '') + "";
|
9385
|
+
}
|
9386
|
+
|
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'))
|
9390
|
+
|| context.key;
|
9391
|
+
}
|
9392
|
+
|
9382
9393
|
return highchartsRenderer;
|
9383
9394
|
};
|
9384
9395
|
|
@@ -5158,6 +5158,12 @@ describe('highcharts_renderer', () => {
|
|
5158
5158
|
category: {
|
5159
5159
|
userOptions: ['key4'],
|
5160
5160
|
},
|
5161
|
+
series: {
|
5162
|
+
name: 'key5',
|
5163
|
+
userOptions: {
|
5164
|
+
initialName: 'key6',
|
5165
|
+
}
|
5166
|
+
}
|
5161
5167
|
}
|
5162
5168
|
};
|
5163
5169
|
|
@@ -5171,6 +5177,7 @@ describe('highcharts_renderer', () => {
|
|
5171
5177
|
|
5172
5178
|
highchartsRenderer.modifyEventPointForDrilldown(e);
|
5173
5179
|
expect(e.point.name).toEqual(event.point.name);
|
5180
|
+
expect(e.point.series.name).toEqual(event.point.series.name);
|
5174
5181
|
expect(e.point.category.userOptions).toEqual(event.point.category.userOptions);
|
5175
5182
|
});
|
5176
5183
|
|
@@ -5180,7 +5187,121 @@ describe('highcharts_renderer', () => {
|
|
5180
5187
|
|
5181
5188
|
highchartsRenderer.modifyEventPointForDrilldown(e);
|
5182
5189
|
expect(e.point.name).toEqual(event.point.initialName);
|
5190
|
+
expect(e.point.series.name).toEqual(event.point.series.userOptions.initialName);
|
5183
5191
|
expect(e.point.category.userOptions).toEqual([event.point.initialName]);
|
5184
5192
|
});
|
5185
5193
|
});
|
5194
|
+
|
5195
|
+
describe('Function getSeriesNameInFormatterContext', () => {
|
5196
|
+
|
5197
|
+
const name1 = 'test series name';
|
5198
|
+
const name2 = 'test series name 2';
|
5199
|
+
|
5200
|
+
it('should return series.userOptions.initialName if it is present and axis formatting is on', () => {
|
5201
|
+
lodash.set(document, 'ReportHippo.user.features', ['use_default_table_format_for_axis']);
|
5202
|
+
const context = {
|
5203
|
+
series: {
|
5204
|
+
userOptions: {
|
5205
|
+
initialName: name1,
|
5206
|
+
},
|
5207
|
+
name: name2,
|
5208
|
+
}
|
5209
|
+
}
|
5210
|
+
expect(highchartsRenderer.getSeriesNameInFormatterContext(context)).toEqual(name1);
|
5211
|
+
});
|
5212
|
+
|
5213
|
+
it('should return series.name if axis formatting is on but series.userOptions.initialName is not present', () => {
|
5214
|
+
lodash.set(document, 'ReportHippo.user.features', ['use_default_table_format_for_axis']);
|
5215
|
+
const context = {
|
5216
|
+
series: {
|
5217
|
+
name: name2,
|
5218
|
+
}
|
5219
|
+
}
|
5220
|
+
expect(highchartsRenderer.getSeriesNameInFormatterContext(context)).toEqual(name2);
|
5221
|
+
});
|
5222
|
+
|
5223
|
+
it('should return series.name if series.userOptions.initialName is present but axis formatting is off', () => {
|
5224
|
+
lodash.set(document, 'ReportHippo.user.features', []);
|
5225
|
+
const context = {
|
5226
|
+
series: {
|
5227
|
+
userOptions: {
|
5228
|
+
initialName: name1,
|
5229
|
+
},
|
5230
|
+
name: name2,
|
5231
|
+
}
|
5232
|
+
}
|
5233
|
+
expect(highchartsRenderer.getSeriesNameInFormatterContext(context)).toEqual(name2);
|
5234
|
+
});
|
5235
|
+
});
|
5236
|
+
|
5237
|
+
describe('Function getColsInFormatterContext', () => {
|
5238
|
+
|
5239
|
+
const name1 = 'test series name 1';
|
5240
|
+
const name2 = 'test series name 2';
|
5241
|
+
const name3 = 'test series name 3';
|
5242
|
+
|
5243
|
+
it('should return point.options.colsForTotal if it is present', () => {
|
5244
|
+
const context = {
|
5245
|
+
point: {
|
5246
|
+
initialName: name1,
|
5247
|
+
options: {
|
5248
|
+
colsForTotal: name3
|
5249
|
+
}
|
5250
|
+
},
|
5251
|
+
key: name2,
|
5252
|
+
}
|
5253
|
+
|
5254
|
+
lodash.forEach(['use_default_table_format_for_axis'], [], features => {
|
5255
|
+
lodash.set(document, 'ReportHippo.user.features', features);
|
5256
|
+
expect(highchartsRenderer.getColsInFormatterContext(context)).toEqual(name3);
|
5257
|
+
});
|
5258
|
+
});
|
5259
|
+
|
5260
|
+
it('should return point.initialName if it is present and FF is on and colsForTotal is not present', () => {
|
5261
|
+
lodash.set(document, 'ReportHippo.user.features', ['use_default_table_format_for_axis']);
|
5262
|
+
const context = {
|
5263
|
+
point: {
|
5264
|
+
initialName: name1,
|
5265
|
+
},
|
5266
|
+
options: {
|
5267
|
+
initialName: name3,
|
5268
|
+
},
|
5269
|
+
key: name2,
|
5270
|
+
}
|
5271
|
+
expect(highchartsRenderer.getColsInFormatterContext(context)).toEqual(name1);
|
5272
|
+
});
|
5273
|
+
|
5274
|
+
it('should return context.key if FF is off and colsForTotal is not present', () => {
|
5275
|
+
lodash.set(document, 'ReportHippo.user.features', []);
|
5276
|
+
const context = {
|
5277
|
+
point: {
|
5278
|
+
initialName: name1,
|
5279
|
+
},
|
5280
|
+
options: {
|
5281
|
+
initialName: name3,
|
5282
|
+
},
|
5283
|
+
key: name2,
|
5284
|
+
}
|
5285
|
+
expect(highchartsRenderer.getColsInFormatterContext(context)).toEqual(name2);
|
5286
|
+
});
|
5287
|
+
|
5288
|
+
it('should return options.initialName if FF is on, colsForTotal is not present and point.initialName is not present', () => {
|
5289
|
+
lodash.set(document, 'ReportHippo.user.features', ['use_default_table_format_for_axis']);
|
5290
|
+
const context = {
|
5291
|
+
options: {
|
5292
|
+
initialName: name3,
|
5293
|
+
},
|
5294
|
+
key: name2,
|
5295
|
+
}
|
5296
|
+
expect(highchartsRenderer.getColsInFormatterContext(context)).toEqual(name3);
|
5297
|
+
});
|
5298
|
+
|
5299
|
+
it('should return context.key if FF is on, no colsForTotal a, no point.initialName no options.initialName', () => {
|
5300
|
+
lodash.set(document, 'ReportHippo.user.features', ['use_default_table_format_for_axis']);
|
5301
|
+
const context = {
|
5302
|
+
key: name2,
|
5303
|
+
}
|
5304
|
+
expect(highchartsRenderer.getColsInFormatterContext(context)).toEqual(name2);
|
5305
|
+
});
|
5306
|
+
});
|
5186
5307
|
});
|