@datarailsshared/dr_renderer 1.2.276 → 1.2.278
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 +18 -3
- package/src/highcharts_renderer.js +23 -21
package/package.json
CHANGED
package/src/dr_pivottable.js
CHANGED
|
@@ -149,6 +149,9 @@ let initDRPivotTable = function($, window, document) {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
DRPivotData.prototype.processRecord = function(record, useTotalsCalculation) {
|
|
152
|
+
const insight = record.insight;
|
|
153
|
+
delete record.insight;
|
|
154
|
+
|
|
152
155
|
if (useTotalsCalculation) {
|
|
153
156
|
if (!this.notFirst) {
|
|
154
157
|
this.keysLength = _.filter(_.keys(record), key => !_.includes(['data_types', 'formats', 'values_formats'], key)).length - 1;
|
|
@@ -213,13 +216,12 @@ let initDRPivotTable = function($, window, document) {
|
|
|
213
216
|
this.tree[flatRowKey][flatColKey].push(record);
|
|
214
217
|
}
|
|
215
218
|
|
|
216
|
-
if (flatRowKey || flatColKey) {
|
|
219
|
+
if (insight && (flatRowKey || flatColKey)) {
|
|
217
220
|
this.insights.push({
|
|
218
221
|
colKey: flatColKey,
|
|
219
222
|
rowKey: flatRowKey,
|
|
220
|
-
insight:
|
|
223
|
+
insight: insight,
|
|
221
224
|
});
|
|
222
|
-
delete record.insight;
|
|
223
225
|
}
|
|
224
226
|
|
|
225
227
|
return;
|
|
@@ -245,6 +247,19 @@ let initDRPivotTable = function($, window, document) {
|
|
|
245
247
|
};
|
|
246
248
|
})(this));
|
|
247
249
|
|
|
250
|
+
if (insight) {
|
|
251
|
+
const flatRowKeyForInsight = rowKey.join(delim);
|
|
252
|
+
const flatColKeyForInsight = colKey.join(delim);
|
|
253
|
+
|
|
254
|
+
if (flatRowKeyForInsight || flatColKeyForInsight) {
|
|
255
|
+
this.insights.push({
|
|
256
|
+
colKey: flatColKeyForInsight,
|
|
257
|
+
rowKey: flatRowKeyForInsight,
|
|
258
|
+
insight: insight,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
248
263
|
m = rowKey.length - 1;
|
|
249
264
|
n = colKey.length - 1;
|
|
250
265
|
if (m < 0 || n < 0) {
|
|
@@ -2528,8 +2528,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2528
2528
|
};
|
|
2529
2529
|
}
|
|
2530
2530
|
|
|
2531
|
-
chartOptions.plotOptions.series.point.events.mouseOver = opts.
|
|
2532
|
-
chartOptions.plotOptions.series.point.events.mouseOut = opts.
|
|
2531
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
|
2532
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
|
2533
2533
|
|
|
2534
2534
|
if(colAttrs.length > 1 || !opts.insightsTooltipFunc) {
|
|
2535
2535
|
chartOptions.tooltip = {
|
|
@@ -2614,8 +2614,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2614
2614
|
};
|
|
2615
2615
|
}
|
|
2616
2616
|
|
|
2617
|
-
chartOptions.plotOptions.series.point.events.mouseOver = opts.
|
|
2618
|
-
chartOptions.plotOptions.series.point.events.mouseOut = opts.
|
|
2617
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
|
2618
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
|
2619
2619
|
|
|
2620
2620
|
chartOptions.tooltip = {
|
|
2621
2621
|
formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
|
|
@@ -2709,8 +2709,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2709
2709
|
};
|
|
2710
2710
|
}
|
|
2711
2711
|
|
|
2712
|
-
chartOptions.plotOptions.series.point.events.mouseOver = opts.
|
|
2713
|
-
chartOptions.plotOptions.series.point.events.mouseOut = opts.
|
|
2712
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
|
2713
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
|
2714
2714
|
|
|
2715
2715
|
chartOptions.tooltip = {
|
|
2716
2716
|
formatter: highchartsRenderer.defaultFormatterToTooltip(pivotData, opts),
|
|
@@ -2991,8 +2991,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2991
2991
|
}
|
|
2992
2992
|
};
|
|
2993
2993
|
}
|
|
2994
|
-
chartOptions.plotOptions.series.point.events.mouseOver = opts.
|
|
2995
|
-
chartOptions.plotOptions.series.point.events.mouseOut = opts.
|
|
2994
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
|
2995
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
|
2996
2996
|
|
|
2997
2997
|
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, rowAttrs.length, false);
|
|
2998
2998
|
|
|
@@ -3127,8 +3127,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3127
3127
|
};
|
|
3128
3128
|
}
|
|
3129
3129
|
|
|
3130
|
-
chartOptions.plotOptions.series.point.events.mouseOver = opts.
|
|
3131
|
-
chartOptions.plotOptions.series.point.events.mouseOut = opts.
|
|
3130
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
|
3131
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
|
3132
3132
|
|
|
3133
3133
|
chartOptions.xAxis = {
|
|
3134
3134
|
type: 'category',
|
|
@@ -3312,8 +3312,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3312
3312
|
};
|
|
3313
3313
|
}
|
|
3314
3314
|
|
|
3315
|
-
chartOptions.plotOptions.series.point.events.mouseOver = opts.
|
|
3316
|
-
chartOptions.plotOptions.series.point.events.mouseOut = opts.
|
|
3315
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
|
3316
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
|
3317
3317
|
|
|
3318
3318
|
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, rowAttrs.length, false);
|
|
3319
3319
|
|
|
@@ -3393,8 +3393,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3393
3393
|
};
|
|
3394
3394
|
}
|
|
3395
3395
|
|
|
3396
|
-
chartOptions.plotOptions.series.point.events.mouseOver = opts.
|
|
3397
|
-
chartOptions.plotOptions.series.point.events.mouseOut = opts.
|
|
3396
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
|
3397
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
|
3398
3398
|
|
|
3399
3399
|
chartOptions.xAxis = {
|
|
3400
3400
|
categories: pivotData.getColKeys(),
|
|
@@ -3505,8 +3505,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3505
3505
|
};
|
|
3506
3506
|
}
|
|
3507
3507
|
|
|
3508
|
-
chartOptions.plotOptions.series.point.events.mouseOver = opts.
|
|
3509
|
-
chartOptions.plotOptions.series.point.events.mouseOut = opts.
|
|
3508
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
|
3509
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
|
3510
3510
|
|
|
3511
3511
|
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
|
|
3512
3512
|
chartOptions.legend.useHTML = true;
|
|
@@ -3624,8 +3624,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3624
3624
|
};
|
|
3625
3625
|
}
|
|
3626
3626
|
|
|
3627
|
-
chartOptions.plotOptions.series.point.events.mouseOver = opts.
|
|
3628
|
-
chartOptions.plotOptions.series.point.events.mouseOut = opts.
|
|
3627
|
+
chartOptions.plotOptions.series.point.events.mouseOver = opts.trackUserInsightsTooltipFunc;
|
|
3628
|
+
chartOptions.plotOptions.series.point.events.mouseOut = opts.trackUserInsightsTooltipFunc;
|
|
3629
3629
|
|
|
3630
3630
|
if (waterfallOptions.colors) {
|
|
3631
3631
|
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
|
|
@@ -5133,7 +5133,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5133
5133
|
options.chartOptions = lodash.merge(defaultOptions, options.chartOptions);
|
|
5134
5134
|
};
|
|
5135
5135
|
|
|
5136
|
-
highchartsRenderer.addPivotOptions = function (selectedTemplateWOData, widgetOptions, drilldownFunction, drillDownListFunction, insightsTooltipFunction) {
|
|
5136
|
+
highchartsRenderer.addPivotOptions = function (selectedTemplateWOData, widgetOptions, drilldownFunction, drillDownListFunction, insightsTooltipFunction, trackUserInsightsTooltipFunction) {
|
|
5137
5137
|
// Check if not rendered data, than it will render
|
|
5138
5138
|
|
|
5139
5139
|
var fields = highchartsRenderer.objectCopyJsonMethod(selectedTemplateWOData.fields);
|
|
@@ -5144,6 +5144,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5144
5144
|
var drilldownFunc = drilldownFunction;
|
|
5145
5145
|
var drillDownListFunc = drillDownListFunction;
|
|
5146
5146
|
var insightsTooltipFunc = insightsTooltipFunction;
|
|
5147
|
+
var trackUserInsightsTooltipFunc = trackUserInsightsTooltipFunction;
|
|
5147
5148
|
|
|
5148
5149
|
// fill value fields
|
|
5149
5150
|
lodash.forEach(widgetOptions.vals, function (valObj) {
|
|
@@ -5198,7 +5199,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5198
5199
|
widgetOptions.pivot.valuesArray = valuesFields;
|
|
5199
5200
|
widgetOptions.pivot.chartType = widgetOptions.chart_type;
|
|
5200
5201
|
widgetOptions.pivot.chartOptions = widgetOptions.options;
|
|
5201
|
-
widgetOptions.pivot.chartRender = highchartsRenderer.getChartRendererFunction(widgetOptions.pivot.chartType, drilldownFunc, drillDownListFunc, insightsTooltipFunc);
|
|
5202
|
+
widgetOptions.pivot.chartRender = highchartsRenderer.getChartRendererFunction(widgetOptions.pivot.chartType, drilldownFunc, drillDownListFunc, insightsTooltipFunc, trackUserInsightsTooltipFunc);
|
|
5202
5203
|
|
|
5203
5204
|
// TODO: remove this logic after BE sort is implemented
|
|
5204
5205
|
// it is required to do sort by totals for comparative analysis - we need to change deltas if columns swaped vice versa
|
|
@@ -5728,7 +5729,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5728
5729
|
return toReturn;
|
|
5729
5730
|
};
|
|
5730
5731
|
|
|
5731
|
-
highchartsRenderer.getChartRendererFunction = function (newChartType, drilldownFunc, drillDownListFunc, insightsTooltipFunc) {
|
|
5732
|
+
highchartsRenderer.getChartRendererFunction = function (newChartType, drilldownFunc, drillDownListFunc, insightsTooltipFunc, trackUserInsightsTooltipFunc) {
|
|
5732
5733
|
var fnToReturn = null;
|
|
5733
5734
|
|
|
5734
5735
|
if (newChartType == highchartsRenderer.richTextSubType.type) {
|
|
@@ -5757,6 +5758,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
5757
5758
|
}
|
|
5758
5759
|
opt.drillDownListFunc = drillDownListFunc;
|
|
5759
5760
|
opt.insightsTooltipFunc = insightsTooltipFunc;
|
|
5761
|
+
opt.trackUserInsightsTooltipFunc = trackUserInsightsTooltipFunc;
|
|
5760
5762
|
} else {
|
|
5761
5763
|
opt.drillDownListFunc = null;
|
|
5762
5764
|
}
|