@datarailsshared/dr_renderer 1.2.193-dragons → 1.2.195-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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarailsshared/dr_renderer",
3
- "version": "1.2.193-dragons",
3
+ "version": "1.2.195-dragons",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -1343,7 +1343,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1343
1343
  const colorOptions = opts.breakdown_options.colors;
1344
1344
  const chart_series = [];
1345
1345
  const row_n_keys = pivotData.getRowKeys();
1346
- const col_n_keys = lodash.map(lodash.keys(pivotData.colTotals), key => [key]);
1346
+ const col_n_keys = pivotData.getColKeys();
1347
1347
  const hasBreakdownValues = lodash.get(opts, 'breakdown_options.values.breakdown.length');
1348
1348
 
1349
1349
  let resultObject = {
@@ -1360,16 +1360,26 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1360
1360
  };
1361
1361
  resultObject = highchartsRenderer.getDataLabelsOptions(additionOptions, resultObject);
1362
1362
 
1363
- let previousTotalValue = 0;
1364
1363
  lodash.forEach(col_n_keys, function(col_n_value, col_index) {
1365
1364
 
1366
1365
  const totalColumnValue = pivotData.colTotals[col_n_value].sum;
1367
- if (col_index) {
1366
+ const nextTotalColumnKey = col_n_keys[col_index + 1];
1367
+ const nextTotalColumnValue = nextTotalColumnKey ? pivotData.colTotals[nextTotalColumnKey].sum : null;
1368
+ resultObject.data.push({
1369
+ y: totalColumnValue,
1370
+ name: lodash.unescape(col_n_value).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
1371
+ isSum: !!col_index,
1372
+ isTotal: true,
1373
+ color: colorOptions.total,
1374
+ });
1375
+
1376
+ if (col_index !== col_n_keys.length - 1) {
1368
1377
  lodash.forEach(row_n_keys, function (row_n_value) {
1369
1378
  const agg = pivotData.getAggregator(row_n_value, col_n_value);
1370
1379
  let val = hasBreakdownValues
1371
1380
  ? agg.value()
1372
- : totalColumnValue - previousTotalValue;
1381
+ : nextTotalColumnValue - totalColumnValue;
1382
+
1373
1383
  val = $.isNumeric(val) ? parseFloat(val) : 0;
1374
1384
  if (val) {
1375
1385
  const tmoobj = {};
@@ -1390,14 +1400,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1390
1400
  }
1391
1401
  });
1392
1402
  }
1393
- previousTotalValue = totalColumnValue;
1394
- resultObject.data.push({
1395
- y: totalColumnValue,
1396
- name: lodash.unescape(col_n_value).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
1397
- isSum: !!col_index,
1398
- isTotal: true,
1399
- color: colorOptions.total,
1400
- });
1401
1403
  });
1402
1404
 
1403
1405
  chart_series.push(resultObject);
@@ -3175,6 +3177,8 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3175
3177
  ? opts.chartOptions
3176
3178
  : highchartsRenderer.getDefaultValueForChart(highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN);
3177
3179
 
3180
+ pivotData.colKeys = lodash.map(lodash.keys(pivotData.colTotals), key => [key]);
3181
+
3178
3182
  chartOptions.chart = {
3179
3183
  type: 'waterfall',
3180
3184
  zoomType: additionOptions && additionOptions.chart && additionOptions.chart.zoom_type ? additionOptions.chart.zoom_type : 'None',
@@ -4356,15 +4360,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4356
4360
  );
4357
4361
 
4358
4362
  if (uniqueCategories && (uniqueCategories.length > maxCategories || uniqueCategories.length < minCategories )) {
4359
- const commonErrorSentence = `Please choose ${ minCategories }-${ maxCategories } items in the Category section.`
4360
4363
  options.error_has_occurred = true;
4361
4364
  options.error_params = {
4362
- title: uniqueCategories.length > maxCategories
4363
- ? `There is too much data. ${ commonErrorSentence }`
4364
- : `Not enough data. ${ commonErrorSentence }`,
4365
- text: '',
4366
- btnText: 'Edit Widget',
4367
- class: 'too-much-data',
4365
+ title: 'Data Conflict',
4366
+ text: `Please adjust your dashboard's reference date and filter selections as \
4367
+ the quantity of data doesn't match the chart's ${ minCategories }-${ maxCategories } value limit.`,
4368
+ class: 'nodata' ,
4368
4369
  }
4369
4370
  return highchartsRenderer.getNoDataResult(options.rendererOptions, true);
4370
4371
  }