@datarailsshared/dr_renderer 1.2.251 → 1.2.253

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.251",
3
+ "version": "1.2.253",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -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
 
@@ -1441,7 +1455,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1441
1455
  keys = value.key;
1442
1456
  } else {
1443
1457
  _.forEach(value.key, (item) => {
1444
- const findKeyByValue = Object.keys(pivotData.dateValuesDictionary || {}).find(key => pivotData.dateValuesDictionary[key] === item);
1458
+ const findKeyByValue = lodash.find(
1459
+ Object.keys(pivotData.dateValuesDictionary || {}),
1460
+ key => pivotData.dateValuesDictionary[key] === item
1461
+ );
1445
1462
  keys.push(findKeyByValue ? findKeyByValue : item);
1446
1463
  })
1447
1464
  }
@@ -1479,7 +1496,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1479
1496
 
1480
1497
  resultObject.data.push({
1481
1498
  y: val,
1482
- name: lodash.unescape(name).replace('DR_Others', highchartsRenderer.getOthersName(opts)),
1499
+ name: lodash.replace(lodash.unescape(name), 'DR_Others', highchartsRenderer.getOthersName(opts)),
1483
1500
  totalIndex: value.trend === 'total' ? index : undefined,
1484
1501
  isSum: value.trend === 'total',
1485
1502
  isTotal: value.trend === 'total',
@@ -3352,9 +3369,21 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3352
3369
  };
3353
3370
  }
3354
3371
 
3355
- chartOptions.legend = {
3356
- enabled: false
3357
- };
3372
+ chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 3, false);
3373
+ chartOptions.legend.useHTML = true;
3374
+ chartOptions.legend.labelFormatter = function() {
3375
+ const name = this.name;
3376
+ const findTotal = _.find(this.options.data, {isTotal: true});
3377
+ const color = lodash.get(findTotal, 'color') ? findTotal.color : this.color;
3378
+ return `<span style="margin: 5px; vertical-align: middle; display:inline-block; background-color: ${color};
3379
+ width: 12px; height: 12px; border-radius: 50%"></span>
3380
+ <span style="color: #000; display: inline-block; margin: 5px; vertical-align: middle;">${name}</span>`;
3381
+ }
3382
+
3383
+ chartOptions.legend.symbolPadding = 0;
3384
+ chartOptions.legend.symbolWidth = 0;
3385
+ chartOptions.legend.symbolHeight = 0;
3386
+ chartOptions.legend.squareSymbol = false;
3358
3387
 
3359
3388
  chartOptions.xAxis.labels = {
3360
3389
  formatter: highchartsRenderer.getBreakdownXAxisLabelFormatter(chartOptions.series),
@@ -7204,11 +7233,17 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7204
7233
  };
7205
7234
 
7206
7235
  highchartsRenderer.chartsTypesInfo = {
7236
+ 'waterfall-chart': {
7237
+ name: 'Waterfall Chart',
7238
+ label: 'Waterfall Chart',
7239
+ title: 'Describe and explain changes in your financial outcomes.',
7240
+ },
7207
7241
  [highchartsRenderer.CHART_TYPES.WATERFALL_BREAKDOWN]: {
7208
- name: 'Breakdown Chart ',
7209
- label: 'Breakdown Chart ',
7210
- title: 'Analyzes what’s contributing to the financial increase or decrease.',
7211
- description: 'For example, analyzes what’s contributing most to the difference in total revenue between last year and this year.',
7242
+ name: 'Breakdown Chart',
7243
+ label: 'Breakdown Chart',
7244
+ title: 'Describe and explain changes in your financial outcomes.',
7245
+ description: `For example, describe the gaps between income and your gross profit or describe the \n
7246
+ gaps between last and current year total revenue, breakdown by locations.`,
7212
7247
  titleInEditor: 'This chart displays the breakdown of variance between two or more total values.',
7213
7248
  axisName: 'Category',
7214
7249
  legendName: 'Breakdown',
@@ -7219,10 +7254,11 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7219
7254
  legendTooltipDescription: 'The breakdown subdivides the chart by a category field for further analysis of what’s contributing to the increase or decrease.',
7220
7255
  },
7221
7256
  [highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH]: {
7222
- name: 'Waterfall Walkthrough Chart ',
7223
- label: 'Waterfall Walkthrough Chart ',
7224
- title: 'TODO: add text',
7225
- description: 'TODO: add text',
7257
+ name: 'Walkthrough Chart',
7258
+ label: 'Walkthrough Chart',
7259
+ title: 'Describe and explain changes in your financial outcomes.',
7260
+ titleInEditor: 'TODO: add text',
7261
+ description: 'For example, describe the gaps between income and your gross profit.',
7226
7262
  axisName: 'Category',
7227
7263
  startedMessage: 'TODO: add text',
7228
7264
  axisTooltipTitle: 'TODO: add text',
@@ -7886,7 +7922,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7886
7922
  {
7887
7923
  type: highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH,
7888
7924
  name: highchartsRenderer.chartsTypesInfo[highchartsRenderer.CHART_TYPES.WATERFALL_WALKTHROUGH].name,
7889
- class: 'google-visualization-charteditor-thumbs-columnchart',
7925
+ class: 'google-visualization-charteditor-thumbs-walkthrough',
7890
7926
  render: highchartsRenderer.ptRenderWaterfallWalkthrough,
7891
7927
  suboptions: [
7892
7928
  highchartsRenderer.suboptions["axisX"],
@@ -7898,8 +7934,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
7898
7934
  highchartsRenderer.suboptions["negative_number_format"],
7899
7935
  highchartsRenderer.suboptions["advanced"],
7900
7936
  highchartsRenderer.suboptions["legends"],
7901
- ],
7902
- hidden: true,
7937
+ ]
7903
7938
  },
7904
7939
  ]
7905
7940
  },
@@ -8883,12 +8918,21 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
8883
8918
  }
8884
8919
 
8885
8920
  let pivot = {};
8921
+
8922
+ let templateNoData = lodash.find(templates, {id: widget_obj.template_id});
8923
+ if (templateNoData) {
8924
+
8925
+ // we need to assign this before calling getWidgetDataSorters method
8926
+ // other way we won't get dateValuesDictionary
8927
+ // preserved condition templateNoData == true - not to interfere with further logic
8928
+ widget_obj.pivot = pivot;
8929
+ }
8930
+
8886
8931
  pivot.sorters = highchartsRenderer.getWidgetDataSorters(res, widget_obj);
8887
8932
  pivot.rowData = res;
8888
8933
  widget_obj.options = highchartsRenderer.parseOptionsToObject(widget_obj.options);
8889
- let templateNoData = lodash.find(templates, {id: widget_obj.template_id});
8934
+
8890
8935
  if (templateNoData) {
8891
- widget_obj.pivot = pivot;
8892
8936
  let hasServerDrill = widget_obj.chart_type.indexOf("column-chart") > -1 && widget_obj.cols && widget_obj.cols.length >= 1;
8893
8937
  if (hasServerDrill)
8894
8938
  highchartsRenderer.addPivotOptions(templateNoData, widget_obj, drillDownFunction, openDrillDownListFunction);