@datarailsshared/dr_renderer 1.4.37 → 1.4.40
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
@@ -110,7 +110,7 @@ function DrDonutChart(highchartsRenderer, pivotData, opts, drilldownFunc, disabl
|
|
110
110
|
x="0"
|
111
111
|
style="font-size: ${series.center[2] / 16}px; fill: #6D6E6F;">
|
112
112
|
${(additionOptions.total_value_label && additionOptions.total_value_label.total_value_label_text) || 'Total'}
|
113
|
-
</tspan
|
113
|
+
</tspan>`
|
114
114
|
)
|
115
115
|
.css({
|
116
116
|
textAnchor: 'middle',
|
@@ -123,7 +123,7 @@ function DrDonutChart(highchartsRenderer, pivotData, opts, drilldownFunc, disabl
|
|
123
123
|
const x = series.center[0] + chart.plotLeft;
|
124
124
|
const y = chart.plotTop + series.center[1] - rect.height / 2;
|
125
125
|
|
126
|
-
totalLabel.attr({ x, y });
|
126
|
+
totalLabel.attr({ x: x, y: y });
|
127
127
|
};
|
128
128
|
|
129
129
|
this.setDrilldownConfig = function (chartConfig) {
|
@@ -134,7 +134,7 @@ function DrDonutChart(highchartsRenderer, pivotData, opts, drilldownFunc, disabl
|
|
134
134
|
pivotData,
|
135
135
|
chartConfig,
|
136
136
|
additionOptions,
|
137
|
-
opts
|
137
|
+
opts
|
138
138
|
);
|
139
139
|
} else {
|
140
140
|
chartConfig.drilldown = highchartsRenderer.getDataLabelsStylesForDrillDown(additionOptions);
|
@@ -61,12 +61,12 @@ function DrGaugeCategoriesSummaryChart(pivotData, opts) {
|
|
61
61
|
|
62
62
|
this.createPlotBands = function (options) {
|
63
63
|
const {
|
64
|
-
segments,
|
64
|
+
segments: segments,
|
65
65
|
goal: { value: goalValue },
|
66
|
-
gauge: { thickness },
|
66
|
+
gauge: { thickness: thickness },
|
67
67
|
} = options;
|
68
68
|
|
69
|
-
let bands =
|
69
|
+
let bands = _.map(segments, (item, index) => {
|
70
70
|
return {
|
71
71
|
from: item.from,
|
72
72
|
to: item.to,
|
@@ -120,7 +120,7 @@ function DrGaugeCategoriesSummaryChart(pivotData, opts) {
|
|
120
120
|
}
|
121
121
|
);
|
122
122
|
}
|
123
|
-
segmentsOutput =
|
123
|
+
segmentsOutput = _.filter(segmentsOutput,
|
124
124
|
(segment) => {
|
125
125
|
return segment.from !== segment.to;
|
126
126
|
}
|
@@ -133,8 +133,9 @@ function DrGaugeCategoriesSummaryChart(pivotData, opts) {
|
|
133
133
|
}
|
134
134
|
|
135
135
|
this.getCompletionPercentage = function (options) {
|
136
|
-
const
|
137
|
-
const
|
136
|
+
const completedSegment = _.find(options.segments, segment => !!segment.isCompletionParameter);
|
137
|
+
const countOfCompletedItems = completedSegment ? completedSegment.count : 0;
|
138
|
+
const totalCount = _.reduce(options.segments, (acc, segment) => acc + segment.count, 0);
|
138
139
|
if (totalCount === 0) {
|
139
140
|
return 0;
|
140
141
|
}
|
@@ -179,8 +180,7 @@ function DrGaugeCategoriesSummaryChart(pivotData, opts) {
|
|
179
180
|
|
180
181
|
|
181
182
|
this.getPaneDimensions = function (chart, options) {
|
182
|
-
const
|
183
|
-
const {offset} = options.gauge;
|
183
|
+
const offset = options.gauge.offset;
|
184
184
|
|
185
185
|
const offsetBottom = options.gauge.valueOffset[0] + options.gauge.valueOffset[2] + offset[2];
|
186
186
|
|
@@ -199,7 +199,7 @@ function DrGaugeCategoriesSummaryChart(pivotData, opts) {
|
|
199
199
|
const {radius, center} = this.getPaneDimensions(chart, options);
|
200
200
|
chart.pane[0].options.size = 2 * radius;
|
201
201
|
chart.pane[0].options.center = center;
|
202
|
-
chart.yAxis[0].options.plotBands
|
202
|
+
_.forEach(chart.yAxis[0].options.plotBands, (band) => {
|
203
203
|
band.outerRadius = radius - (options.gauge.tickLength - options.gauge.thickness) / 2;
|
204
204
|
});
|
205
205
|
};
|
@@ -241,16 +241,16 @@ function DrGaugeCategoriesSummaryChart(pivotData, opts) {
|
|
241
241
|
plotBorderWidth: 0,
|
242
242
|
plotShadow: false,
|
243
243
|
events: {
|
244
|
-
render: (
|
245
|
-
this.moveCustomElementsToFront(
|
244
|
+
render: (event) => {
|
245
|
+
this.moveCustomElementsToFront(event.target);
|
246
246
|
},
|
247
|
-
beforeRedraw: (
|
248
|
-
this.setPane(
|
249
|
-
this.updateCustomElements(
|
247
|
+
beforeRedraw: (event) => {
|
248
|
+
this.setPane(event.target, this.options);
|
249
|
+
this.updateCustomElements(event.target, this.options);
|
250
250
|
},
|
251
|
-
beforeRender: (
|
252
|
-
this.setPane(
|
253
|
-
this.setCustomElements(
|
251
|
+
beforeRender: (event) => {
|
252
|
+
this.setPane(event.target, this.options);
|
253
|
+
this.setCustomElements(event.target, this.options);
|
254
254
|
}
|
255
255
|
},
|
256
256
|
margin: [0, 0, 0, 0],
|
package/src/dr_pivottable.js
CHANGED
@@ -1526,7 +1526,7 @@ let initDRPivotTable = function($, window, document) {
|
|
1526
1526
|
if (opts.chartOptions.isSmartQueriesEnabled && flatRowKey.split(' , ').includes(DR_SCENARIO.Forecast)) {
|
1527
1527
|
const actualsRow = tree[flatRowKey.replace(DR_SCENARIO.Forecast, DR_SCENARIO.SQ_Actuals)] || {};
|
1528
1528
|
if (actualsRow && actualsRow[flatColKey]) {
|
1529
|
-
val += actualsRow[flatColKey]
|
1529
|
+
val += (actualsRow[flatColKey] && actualsRow[flatColKey].value()) || 0;
|
1530
1530
|
}
|
1531
1531
|
}
|
1532
1532
|
isColSubtotal = colHeader.children.length !== 0;
|
@@ -1572,7 +1572,7 @@ let initDRPivotTable = function($, window, document) {
|
|
1572
1572
|
|
1573
1573
|
val = totalAggregator.value();
|
1574
1574
|
if (opts.chartOptions.isSmartQueriesEnabled && flatRowKey.split(' , ').includes(DR_SCENARIO.Forecast)) {
|
1575
|
-
val += rowTotals[flatRowKey.replace(DR_SCENARIO.Forecast, DR_SCENARIO.SQ_Actuals)]
|
1575
|
+
val += _.get(rowTotals[flatRowKey.replace(DR_SCENARIO.Forecast, DR_SCENARIO.SQ_Actuals)], 'value', () => null)() || 0;
|
1576
1576
|
}
|
1577
1577
|
style = "pvtTotal rowTotal";
|
1578
1578
|
if (isRowSubtotal) {
|
@@ -64,6 +64,7 @@ const CHART_TYPES = {
|
|
64
64
|
GAUGE_CHART_DYNAMIC_GOAL: 'gauge-chart-dynamic-goal',
|
65
65
|
GAUGE_CHART_CATEGORIES_SUMMARY: 'gauge-chart-categories-summary',
|
66
66
|
KPI_WIDGET: 'kpi-widget',
|
67
|
+
SMART_KPI: 'smart-kpi',
|
67
68
|
TEXT_WIDGET: 'text-widget',
|
68
69
|
WATERFALL_BREAKDOWN: 'waterfall-chart-breakdown',
|
69
70
|
WATERFALL_WALKTHROUGH: 'waterfall-chart-walkthrough',
|
@@ -399,7 +400,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
399
400
|
|
400
401
|
const isChartTypeSupportedForSmartQuery = (type) => {
|
401
402
|
if (!type) return null;
|
402
|
-
return [
|
403
|
+
return lodash.includes([
|
403
404
|
'line',
|
404
405
|
'line-chart-forecast',
|
405
406
|
'spline',
|
@@ -409,7 +410,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
409
410
|
highchartsRenderer.CHART_TYPES.LINE_CHART_SMOOTH,
|
410
411
|
highchartsRenderer.CHART_TYPES.AREA_CHART,
|
411
412
|
highchartsRenderer.CHART_TYPES.AREA_CHART_SMOOTH,
|
412
|
-
]
|
413
|
+
], type);
|
413
414
|
};
|
414
415
|
|
415
416
|
|
@@ -7875,6 +7876,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
7875
7876
|
legendName: 'Data Series',
|
7876
7877
|
startedMessage: '',
|
7877
7878
|
},
|
7879
|
+
[highchartsRenderer.CHART_TYPES.SMART_KPI]: {
|
7880
|
+
name: 'Smart Kpi',
|
7881
|
+
label: 'Smart KPI',
|
7882
|
+
title: 'Present a single Key Performance Indicator.',
|
7883
|
+
axisName: 'X-Axis',
|
7884
|
+
legendName: 'Data Series',
|
7885
|
+
startedMessage: 'To get started, drag one field to the value section. Best practice: Drag one field to the filter section, and filter as required.',
|
7886
|
+
},
|
7878
7887
|
'kpi-widget': {
|
7879
7888
|
name: 'Kpi ',
|
7880
7889
|
label: 'KPI',
|
@@ -8341,6 +8350,23 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
8341
8350
|
highchartsRenderer.suboptions["negative_number_format"],
|
8342
8351
|
highchartsRenderer.suboptions["legends"],
|
8343
8352
|
]
|
8353
|
+
},
|
8354
|
+
{
|
8355
|
+
type: 'smart-kpi',
|
8356
|
+
hidden: true,
|
8357
|
+
name: highchartsRenderer.chartsTypesInfo['smart-kpi'].name,
|
8358
|
+
class: 'google-visualization-charteditor-thumbs-kpi',
|
8359
|
+
render: () => { throw new Error('Smart KPI widget is not implemented yet'); },
|
8360
|
+
suboptions: [
|
8361
|
+
highchartsRenderer.suboptions["value"],
|
8362
|
+
highchartsRenderer.suboptions["range"],
|
8363
|
+
highchartsRenderer.suboptions["widget_library"],
|
8364
|
+
highchartsRenderer.suboptions["name"],
|
8365
|
+
highchartsRenderer.suboptions["table_options_transpose"],
|
8366
|
+
highchartsRenderer.suboptions["table_design_options"],
|
8367
|
+
highchartsRenderer.suboptions["negative_number_format"],
|
8368
|
+
highchartsRenderer.suboptions["legends"],
|
8369
|
+
]
|
8344
8370
|
}]
|
8345
8371
|
},
|
8346
8372
|
{
|
@@ -11,7 +11,7 @@ function createSingleDataSeriesForForecast(chart_series, chartOptions, pivotData
|
|
11
11
|
const { actuals, forecast, smart_query } = chartOptions.chart;
|
12
12
|
const input = pivotData.input;
|
13
13
|
|
14
|
-
const hasSQActuals =
|
14
|
+
const hasSQActuals = lodash.some(input, item => lodash.includes(item.Scenario, DR_SCENARIO.SQ_Actuals));
|
15
15
|
chartOptions.isSmartQueriesEnabled = hasSQActuals;
|
16
16
|
if (!smart_query || !hasSQActuals) return null;
|
17
17
|
|
@@ -29,14 +29,14 @@ function buildChartSeriesFromPivotInputOnly(input, actuals, forecast, midMonthOf
|
|
29
29
|
item.Amount !== 0
|
30
30
|
);
|
31
31
|
|
32
|
-
const data =
|
32
|
+
const data = lodash.map(filtered, item => ({
|
33
33
|
y: item.Amount,
|
34
34
|
name: item['Reporting Month'],
|
35
35
|
initialName: item['Reporting Month'],
|
36
36
|
type: item.Scenario,
|
37
37
|
})).sort((a, b) => new Date(a.name) - new Date(b.name));
|
38
38
|
|
39
|
-
const sqCount =
|
39
|
+
const sqCount = lodash.filter(input, item => item.Scenario === DR_SCENARIO.SQ_Actuals).length;
|
40
40
|
|
41
41
|
return {
|
42
42
|
name,
|
@@ -55,21 +55,22 @@ function buildChartSeriesForMultipleSeriesCombinedLine(chart_series, input, actu
|
|
55
55
|
const series = chart_series[i];
|
56
56
|
if (!series || !series.data || !series.data.length) continue;
|
57
57
|
|
58
|
-
const data =
|
59
|
-
(item
|
58
|
+
const data = lodash.chain(input)
|
59
|
+
.filter(item => item['Scenario Cycle'] === series.name &&
|
60
|
+
(item['Scenario'] === DR_SCENARIO.SQ_Actuals || item['Scenario'] === DR_SCENARIO.Forecast))
|
60
61
|
.map(item => ({
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
}))
|
66
|
-
|
62
|
+
y: item.Amount,
|
63
|
+
name: item['Reporting Month'],
|
64
|
+
initialName: item['Reporting Month'],
|
65
|
+
type: item.Scenario,
|
66
|
+
}))
|
67
|
+
.value().sort((a, b) => new Date(a.name) - new Date(b.name));
|
67
68
|
if (!data.length) {
|
68
69
|
resultingSeries.push(series);
|
69
70
|
continue;
|
70
71
|
}
|
71
72
|
|
72
|
-
const sqCount =
|
73
|
+
const sqCount = lodash.filter(data, item => item.type === DR_SCENARIO.SQ_Actuals).length;
|
73
74
|
resultingSeries.push(
|
74
75
|
{
|
75
76
|
name: series.name,
|