@datarailsshared/dr_renderer 1.2.185-dragons → 1.2.187-dragons
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 +35 -50
package/package.json
CHANGED
|
@@ -1339,15 +1339,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1339
1339
|
return chart_series;
|
|
1340
1340
|
}
|
|
1341
1341
|
|
|
1342
|
-
highchartsRenderer.ptCreateWaterfallBreakdownSeries = function (pivotData,
|
|
1342
|
+
highchartsRenderer.ptCreateWaterfallBreakdownSeries = function (pivotData, additionOptions, opts) {
|
|
1343
1343
|
const colorOptions = opts.breakdown_options.colors;
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
if (row_n_keys.length === 0) {
|
|
1349
|
-
row_n_keys.push([]);
|
|
1350
|
-
}
|
|
1344
|
+
const chart_series = [];
|
|
1345
|
+
const row_n_keys = pivotData.getRowKeys();
|
|
1346
|
+
const col_n_keys = lodash.map(lodash.keys(pivotData.colTotals), key => [key]);
|
|
1347
|
+
const hasBreakdownValues = lodash.get(opts, 'breakdown_options.values.breakdown.length');
|
|
1351
1348
|
|
|
1352
1349
|
let resultObject = {
|
|
1353
1350
|
data: [],
|
|
@@ -1363,51 +1360,39 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1363
1360
|
};
|
|
1364
1361
|
resultObject = highchartsRenderer.getDataLabelsOptions(additionOptions, resultObject);
|
|
1365
1362
|
|
|
1366
|
-
|
|
1363
|
+
let previousTotalValue = 0;
|
|
1367
1364
|
lodash.forEach(col_n_keys, function(col_n_value, col_index) {
|
|
1368
|
-
breakdownValues.push([]);
|
|
1369
|
-
lodash.forEach(row_n_keys, function (row_n_value, row_index) {
|
|
1370
|
-
var agg = pivotData.getAggregator(row_n_value, col_n_value);
|
|
1371
|
-
var val = agg.value();
|
|
1372
|
-
|
|
1373
|
-
if (val != null && $.isNumeric(val)) {
|
|
1374
|
-
val = parseFloat(val);
|
|
1375
|
-
} else if (onlyNumbers) {
|
|
1376
|
-
val = NaN;
|
|
1377
|
-
} else {
|
|
1378
|
-
val = 0;
|
|
1379
|
-
}
|
|
1380
1365
|
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1366
|
+
const totalColumnValue = pivotData.colTotals[col_n_value].sum;
|
|
1367
|
+
if (col_index) {
|
|
1368
|
+
lodash.forEach(row_n_keys, function (row_n_value) {
|
|
1369
|
+
const agg = pivotData.getAggregator(row_n_value, col_n_value);
|
|
1370
|
+
let val = hasBreakdownValues
|
|
1371
|
+
? agg.value()
|
|
1372
|
+
: totalColumnValue - previousTotalValue;
|
|
1373
|
+
val = $.isNumeric(val) ? parseFloat(val) : 0;
|
|
1374
|
+
if (val) {
|
|
1375
|
+
const tmoobj = {};
|
|
1376
|
+
const key = lodash.isArray(row_n_value) ? row_n_value[0] : row_n_value;
|
|
1392
1377
|
tmoobj.name = lodash.unescape(key);
|
|
1393
|
-
|
|
1378
|
+
|
|
1394
1379
|
if (tmoobj.name) {
|
|
1395
1380
|
tmoobj.name = tmoobj.name.replace('DR_Others', highchartsRenderer.getOthersName(opts));
|
|
1396
1381
|
}
|
|
1397
|
-
|
|
1398
1382
|
if (lodash.isEmpty(String(tmoobj.name))) {
|
|
1399
1383
|
tmoobj.name = lodash.unescape(col_n_value);
|
|
1400
1384
|
tmoobj.visible = false;
|
|
1401
1385
|
}
|
|
1402
|
-
|
|
1386
|
+
|
|
1387
|
+
tmoobj.y = val;
|
|
1403
1388
|
tmoobj.colKeys = [lodash.unescape(col_n_keys[col_index - 1]), lodash.unescape(col_n_value)];
|
|
1404
1389
|
resultObject.data.push(tmoobj);
|
|
1405
1390
|
}
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
previousTotalValue = totalColumnValue;
|
|
1409
1394
|
resultObject.data.push({
|
|
1410
|
-
y:
|
|
1395
|
+
y: totalColumnValue,
|
|
1411
1396
|
name: lodash.unescape(col_n_value).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
|
|
1412
1397
|
isSum: !!col_index,
|
|
1413
1398
|
isTotal: true,
|
|
@@ -3240,7 +3225,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3240
3225
|
chartOptions.colors = opts.paletteOptions.dashboardPalette.colors;
|
|
3241
3226
|
}
|
|
3242
3227
|
chartOptions.series = highchartsRenderer
|
|
3243
|
-
.ptCreateWaterfallBreakdownSeries(pivotData,
|
|
3228
|
+
.ptCreateWaterfallBreakdownSeries(pivotData, additionOptions, opts);
|
|
3244
3229
|
|
|
3245
3230
|
chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
|
|
3246
3231
|
chartOptions.plotOptions = {
|
|
@@ -6794,15 +6779,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
6794
6779
|
|
|
6795
6780
|
highchartsRenderer.chartsTypesInfo = {
|
|
6796
6781
|
[highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN]: {
|
|
6797
|
-
name: '
|
|
6798
|
-
label: '
|
|
6799
|
-
title: '
|
|
6800
|
-
description: 'TODO: add text',
|
|
6782
|
+
name: 'Breakdown Chart ',
|
|
6783
|
+
label: 'Breakdown Chart ',
|
|
6784
|
+
title: 'This chart is used to show the breakdown of variance between two or more total values.',
|
|
6801
6785
|
axisName: 'Category',
|
|
6802
6786
|
legendName: 'Breakdown',
|
|
6803
6787
|
startedMessage: 'To get started, drag one field to the Category and one field to the Value section.',
|
|
6804
|
-
axisTooltipTitle: '
|
|
6805
|
-
|
|
6788
|
+
axisTooltipTitle: 'Drag one field to compare two to five items.',
|
|
6789
|
+
axisTooltipDescription: 'For example, Year over Year or two entities total income. If you are using date field, the chart will present YoY comparison by default.',
|
|
6790
|
+
legendTooltipTitle: 'Drag one field here to analyze the differences.',
|
|
6791
|
+
legendTooltipDescription: 'You can split the differences into 12 items. The rest of the items will be aggregated as “Other”.'
|
|
6806
6792
|
},
|
|
6807
6793
|
'combo-chart': {
|
|
6808
6794
|
name: 'Combo Chart ',
|
|
@@ -7439,13 +7425,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7439
7425
|
{
|
|
7440
7426
|
type: 'waterfall-chart',
|
|
7441
7427
|
name: 'Waterfall',
|
|
7442
|
-
|
|
7443
|
-
class: 'google-visualization-charteditor-mini-column',
|
|
7428
|
+
class: 'google-visualization-charteditor-mini-waterfall',
|
|
7444
7429
|
subtypes: [
|
|
7445
7430
|
{
|
|
7446
7431
|
type: highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN,
|
|
7447
7432
|
name: highchartsRenderer.chartsTypesInfo[highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN].name,
|
|
7448
|
-
class: 'google-visualization-charteditor-thumbs-
|
|
7433
|
+
class: 'google-visualization-charteditor-thumbs-breakdown',
|
|
7449
7434
|
render: highchartsRenderer.ptRenderWaterfallBreakdown,
|
|
7450
7435
|
suboptions: [
|
|
7451
7436
|
highchartsRenderer.suboptions["axisY"],
|
|
@@ -8668,7 +8653,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8668
8653
|
rows = [];
|
|
8669
8654
|
} else {
|
|
8670
8655
|
rows = cols;
|
|
8671
|
-
cols = [];
|
|
8656
|
+
cols = [point.colKeys[1]];
|
|
8672
8657
|
}
|
|
8673
8658
|
return { rows, cols };
|
|
8674
8659
|
}
|