@datarailsshared/dr_renderer 1.2.194-dragons → 1.2.196-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.194-dragons",
3
+ "version": "1.2.196-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',
@@ -8662,11 +8666,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8662
8666
  }
8663
8667
 
8664
8668
  highchartsRenderer.getBreakdownXAxisLabelFormatter = function(chartSeries) {
8665
- const styleForCategoryLabel = 'font-weight: 700; font-size: 12px;';
8666
- const styleForBreakdownLabel = 'font-weight: 600; color: #6f6f6f; font-size: 11px;';
8669
+ const styleForBreakdownLabel = 'font-weight: normal; color: #51566f;';
8667
8670
  return function() {
8668
8671
  const isTotal = lodash.some(chartSeries[0].data, point => point.name === this.value && point.isTotal);
8669
- return `<span style="${ isTotal ? styleForCategoryLabel : styleForBreakdownLabel }">${ this.value }</span>`;
8672
+ return `<span style="${ isTotal ? '' : styleForBreakdownLabel }">${ this.value }</span>`;
8670
8673
  }
8671
8674
  }
8672
8675