@datarailsshared/dr_renderer 1.2.250 → 1.2.252
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 +95 -15
package/package.json
CHANGED
|
@@ -1366,7 +1366,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1366
1366
|
className: SERIES_CLASSNAMES.WATERFALL_BREAKDOWN
|
|
1367
1367
|
};
|
|
1368
1368
|
resultObject = highchartsRenderer.getDataLabelsOptions(additionOptions, resultObject);
|
|
1369
|
-
|
|
1369
|
+
resultObject.name = pivotData.colAttrs[0];
|
|
1370
1370
|
lodash.forEach(col_n_keys, function(col_n_value, col_index) {
|
|
1371
1371
|
|
|
1372
1372
|
const totalColumnValue = pivotData.getAggregator([], col_n_value).value();
|
|
@@ -1415,6 +1415,20 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1415
1415
|
});
|
|
1416
1416
|
}
|
|
1417
1417
|
|
|
1418
|
+
chart_series.push(
|
|
1419
|
+
{
|
|
1420
|
+
name: 'Positive',
|
|
1421
|
+
visible: false,
|
|
1422
|
+
color: colorOptions.increase
|
|
1423
|
+
});
|
|
1424
|
+
|
|
1425
|
+
chart_series.push(
|
|
1426
|
+
{
|
|
1427
|
+
name: 'Negative',
|
|
1428
|
+
visible: false,
|
|
1429
|
+
color: colorOptions.decrease
|
|
1430
|
+
});
|
|
1431
|
+
|
|
1418
1432
|
return chart_series;
|
|
1419
1433
|
}
|
|
1420
1434
|
|
|
@@ -1480,6 +1494,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
1480
1494
|
resultObject.data.push({
|
|
1481
1495
|
y: val,
|
|
1482
1496
|
name: lodash.unescape(name).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
|
|
1497
|
+
totalIndex: value.trend === 'total' ? index : undefined,
|
|
1483
1498
|
isSum: value.trend === 'total',
|
|
1484
1499
|
isTotal: value.trend === 'total',
|
|
1485
1500
|
color,
|
|
@@ -3351,9 +3366,21 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
3351
3366
|
};
|
|
3352
3367
|
}
|
|
3353
3368
|
|
|
3354
|
-
chartOptions.legend =
|
|
3355
|
-
|
|
3356
|
-
|
|
3369
|
+
chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
|
|
3370
|
+
chartOptions.legend.useHTML = true;
|
|
3371
|
+
chartOptions.legend.labelFormatter = function() {
|
|
3372
|
+
const name = this.name;
|
|
3373
|
+
const findTotal = _.find(this.options.data, {isTotal: true});
|
|
3374
|
+
const color = lodash.get(findTotal, 'color') ? findTotal.color : this.color;
|
|
3375
|
+
return `<span style="margin: 5px; vertical-align: middle; display:inline-block; background-color: ${color};
|
|
3376
|
+
width: 12px; height: 12px; border-radius: 50%"></span>
|
|
3377
|
+
<span style="color: #000; display: inline-block; margin: 5px; vertical-align: middle;">${name}</span>`;
|
|
3378
|
+
}
|
|
3379
|
+
|
|
3380
|
+
chartOptions.legend.symbolPadding = 0;
|
|
3381
|
+
chartOptions.legend.symbolWidth = 0;
|
|
3382
|
+
chartOptions.legend.symbolHeight = 0;
|
|
3383
|
+
chartOptions.legend.squareSymbol = false;
|
|
3357
3384
|
|
|
3358
3385
|
chartOptions.xAxis.labels = {
|
|
3359
3386
|
formatter: highchartsRenderer.getBreakdownXAxisLabelFormatter(chartOptions.series),
|
|
@@ -7203,11 +7230,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7203
7230
|
};
|
|
7204
7231
|
|
|
7205
7232
|
highchartsRenderer.chartsTypesInfo = {
|
|
7233
|
+
'waterfall-chart': {
|
|
7234
|
+
name: 'Waterfall Chart',
|
|
7235
|
+
label: 'Waterfall Chart',
|
|
7236
|
+
title: 'Describe and explain changes in your financial outcomes.',
|
|
7237
|
+
},
|
|
7206
7238
|
[highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN]: {
|
|
7207
|
-
name: 'Breakdown Chart
|
|
7208
|
-
label: 'Breakdown Chart
|
|
7209
|
-
title: '
|
|
7210
|
-
description:
|
|
7239
|
+
name: 'Breakdown Chart',
|
|
7240
|
+
label: 'Breakdown Chart',
|
|
7241
|
+
title: 'Describe and explain changes in your financial outcomes.',
|
|
7242
|
+
description: `For example, describe the gaps between income and your gross profit or describe the \n
|
|
7243
|
+
gaps between last and current year total revenue, breakdown by locations.`,
|
|
7211
7244
|
titleInEditor: 'This chart displays the breakdown of variance between two or more total values.',
|
|
7212
7245
|
axisName: 'Category',
|
|
7213
7246
|
legendName: 'Breakdown',
|
|
@@ -7218,10 +7251,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7218
7251
|
legendTooltipDescription: 'The breakdown subdivides the chart by a category field for further analysis of what’s contributing to the increase or decrease.',
|
|
7219
7252
|
},
|
|
7220
7253
|
[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
|
|
7221
|
-
name: '
|
|
7222
|
-
label: '
|
|
7223
|
-
title: '
|
|
7224
|
-
|
|
7254
|
+
name: 'Walkthrough Chart',
|
|
7255
|
+
label: 'Walkthrough Chart',
|
|
7256
|
+
title: 'Describe and explain changes in your financial outcomes.',
|
|
7257
|
+
titleInEditor: 'TODO: add text',
|
|
7258
|
+
description: 'For example, describe the gaps between income and your gross profit.',
|
|
7225
7259
|
axisName: 'Category',
|
|
7226
7260
|
startedMessage: 'TODO: add text',
|
|
7227
7261
|
axisTooltipTitle: 'TODO: add text',
|
|
@@ -7885,7 +7919,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7885
7919
|
{
|
|
7886
7920
|
type: highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH,
|
|
7887
7921
|
name: highchartsRenderer.chartsTypesInfo[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH].name,
|
|
7888
|
-
class: 'google-visualization-charteditor-thumbs-
|
|
7922
|
+
class: 'google-visualization-charteditor-thumbs-walkthrough',
|
|
7889
7923
|
render: highchartsRenderer.ptRenderWaterfallWalkthrough,
|
|
7890
7924
|
suboptions: [
|
|
7891
7925
|
highchartsRenderer.suboptions["axisX"],
|
|
@@ -7897,8 +7931,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
7897
7931
|
highchartsRenderer.suboptions["negative_number_format"],
|
|
7898
7932
|
highchartsRenderer.suboptions["advanced"],
|
|
7899
7933
|
highchartsRenderer.suboptions["legends"],
|
|
7900
|
-
]
|
|
7901
|
-
hidden: true,
|
|
7934
|
+
]
|
|
7902
7935
|
},
|
|
7903
7936
|
]
|
|
7904
7937
|
},
|
|
@@ -8392,6 +8425,15 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8392
8425
|
});
|
|
8393
8426
|
colFilter.value_to_show = labels.join(', ');
|
|
8394
8427
|
filters.push(colFilter);
|
|
8428
|
+
} else if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH) {
|
|
8429
|
+
lodash.forEach(col_key, function (colKeyElement, index) {
|
|
8430
|
+
const field = lodash.get(widget, `cols[${ index }]`);
|
|
8431
|
+
if (field) {
|
|
8432
|
+
let filter = highchartsRenderer.createFilterObject(field);
|
|
8433
|
+
highchartsRenderer.buildFilterValuesFromWalkthroughColKey(widget, field, filter, colKeyElement);
|
|
8434
|
+
filters.push(filter);
|
|
8435
|
+
}
|
|
8436
|
+
});
|
|
8395
8437
|
} else {
|
|
8396
8438
|
lodash.forEach(col_key, function (col_value, index) {
|
|
8397
8439
|
if (widget && widget.cols[index]) {
|
|
@@ -8519,6 +8561,21 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
8519
8561
|
: colKey[i]
|
|
8520
8562
|
);
|
|
8521
8563
|
}
|
|
8564
|
+
} else if (widget.chart_type === highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH) {
|
|
8565
|
+
lodash.forEach(colKey, function (colKeyElement, index) {
|
|
8566
|
+
const field = lodash.get(widget, `cols[${ index }]`);
|
|
8567
|
+
if (field) {
|
|
8568
|
+
let filter = lodash.find(filters, {name: field.name});
|
|
8569
|
+
if (filter) {
|
|
8570
|
+
filter.is_excluded = false;
|
|
8571
|
+
} else {
|
|
8572
|
+
filter = highchartsRenderer.createDrillDownFilterObject(widget, field, colKeyElement);
|
|
8573
|
+
filters.push(filter);
|
|
8574
|
+
}
|
|
8575
|
+
filter.values = [];
|
|
8576
|
+
highchartsRenderer.buildFilterValuesFromWalkthroughColKey(widget, field, filter, colKeyElement);
|
|
8577
|
+
}
|
|
8578
|
+
});
|
|
8522
8579
|
} else {
|
|
8523
8580
|
for (let i = 0; i < colKey.length; i++) {
|
|
8524
8581
|
let filter = lodash.find(filters, {name: widget.cols[i].name});
|
|
@@ -9176,6 +9233,29 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
9176
9233
|
return lodash.concat(modifiedRowData, rowData);
|
|
9177
9234
|
}
|
|
9178
9235
|
|
|
9236
|
+
highchartsRenderer.buildFilterValuesFromWalkthroughColKey = function(widget, field, filter, colKey) {
|
|
9237
|
+
const isTotal = lodash.isArray(colKey);
|
|
9238
|
+
colKey = isTotal ? colKey : [colKey];
|
|
9239
|
+
|
|
9240
|
+
lodash.forEach(colKey, function (colValue) {
|
|
9241
|
+
let value = colValue;
|
|
9242
|
+
if (field.type === 'Date' && !isTotal) {
|
|
9243
|
+
value = highchartsRenderer.createDateFromString(
|
|
9244
|
+
value,
|
|
9245
|
+
highchartsRenderer.getDateFieldFormat(widget, field)
|
|
9246
|
+
);
|
|
9247
|
+
}
|
|
9248
|
+
if (!filter.values) {
|
|
9249
|
+
filter.values = [];
|
|
9250
|
+
}
|
|
9251
|
+
filter.values.push(value);
|
|
9252
|
+
|
|
9253
|
+
if (!isTotal) {
|
|
9254
|
+
filter.value_to_show = colKey[0];
|
|
9255
|
+
}
|
|
9256
|
+
});
|
|
9257
|
+
}
|
|
9258
|
+
|
|
9179
9259
|
return highchartsRenderer;
|
|
9180
9260
|
};
|
|
9181
9261
|
|