@datarailsshared/dr_renderer 1.2.36 → 1.2.38

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.36",
3
+ "version": "1.2.38",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -30,7 +30,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
30
30
  // in lib it will not work
31
31
  highchartsRenderer.elem1 = document.createElement('textarea');
32
32
 
33
- highchartsRenderer.defaults_colors = default_colors;
33
+ if (lodash.isArray(default_colors)) {
34
+ highchartsRenderer.defaults_colors = default_colors;
35
+ } else {
36
+ highchartsRenderer.defaults_colors = default_colors.colors;
37
+ highchartsRenderer.variance_color = default_colors.variance_color;
38
+ }
34
39
 
35
40
  highchartsRenderer.highcharts_theme = {
36
41
  "colors": highchartsRenderer.defaults_colors,
@@ -1044,7 +1049,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1044
1049
  };
1045
1050
 
1046
1051
  highchartsRenderer.getVariantSeries = function (series, delta_column_options) {
1047
- const varianceColor = delta_column_options.color ? delta_column_options.color : Highcharts.getOptions().colors[7];
1052
+ const varianceColor = delta_column_options.color || highchartsRenderer.variance_color || Highcharts.getOptions().colors[7];
1048
1053
  series.name = delta_column_options.name.replace('_', '');
1049
1054
  series.color = varianceColor;
1050
1055
 
@@ -1403,10 +1408,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1403
1408
  var __ret = highchartsRenderer.getSingleValueAgg(gaugeopts, aggfunc, base);
1404
1409
  aggfunc = __ret.aggfunc;
1405
1410
  base = __ret.base;
1406
- if (total.length > 0)
1411
+ var aggregator = pivotData.getAggregator([], []);
1412
+ if (total.length > 0) {
1407
1413
  value = total.reduce(aggfunc, base);
1414
+ } else {
1415
+ value = aggregator.value();
1416
+ }
1408
1417
  var gauge_series = [value]
1409
- var aggregator = pivotData.getAggregator([], []);
1410
1418
  var valuef = lodash.isNumber(value) ? aggregator.format(value, true) : value;
1411
1419
 
1412
1420
  chartOptions.yAxis = {
@@ -1541,13 +1549,14 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1541
1549
  aggfunc = __ret.aggfunc;
1542
1550
  base = __ret.base;
1543
1551
 
1552
+ var aggregator = pivotData.getAggregator([], []);
1544
1553
  if (total.length > 0) {
1545
-
1546
1554
  value = total.reduce(aggfunc, base);
1555
+ } else {
1556
+ value = aggregator.value();
1547
1557
  }
1548
1558
  var gauge_series = [value]
1549
1559
 
1550
- var aggregator = pivotData.getAggregator([], []);
1551
1560
  var valuef = lodash.isNumber(value) ? aggregator.format(value, true) : value;
1552
1561
 
1553
1562
  chartOptions.yAxis = {
@@ -1635,8 +1644,12 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1635
1644
  aggfunc = __ret.aggfunc;
1636
1645
  base = __ret.base;
1637
1646
 
1638
- if (total.length > 0)
1647
+ var aggregator = pivotData.getAggregator([], []);
1648
+ if (total.length > 0) {
1639
1649
  value = total.reduce(aggfunc, base);
1650
+ } else {
1651
+ value = aggregator.value();
1652
+ }
1640
1653
 
1641
1654
  chartOptions.title = kpioptions.hideChartHeader ? null : {
1642
1655
  text: kpioptions.name.name,
@@ -1649,8 +1662,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1649
1662
 
1650
1663
  }
1651
1664
 
1652
- var aggregator = pivotData.getAggregator([], []);
1653
-
1654
1665
  value = lodash.isNumber(value) ? aggregator.format(value, true) : value;
1655
1666
  chartOptions.subtitle = {
1656
1667
  text: value,
@@ -1951,7 +1962,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1951
1962
  labels_formatter = highchartsRenderer.persantageValueLabelsFormatter(pivotData, opts);
1952
1963
  }
1953
1964
 
1954
- const varianceColor = additionOptions.delta_column.color ? additionOptions.delta_column.color : Highcharts.getOptions().colors[7];
1965
+ const varianceColor = additionOptions.delta_column.color || highchartsRenderer.variance_color || Highcharts.getOptions().colors[7];
1955
1966
  chartOptions.yAxis[1] = {
1956
1967
  title: {
1957
1968
  text: additionOptions.delta_column.name.replace('_', ''),
@@ -5515,7 +5526,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5515
5526
  label: 'Stacked Bar',
5516
5527
  title: 'Good for explaining part-to-whole comparisons across a given category.',
5517
5528
  description: 'For example, compare between sales-rep contributions to the total Revenue in different regions.',
5518
- axisName: 'Y - Axis Categories',
5529
+ axisName: 'Y - Axis',
5519
5530
  legendName: 'Data series',
5520
5531
  startedMessage: 'To get started, drag one field to the y-axis section, and one field to the value section. Best practice: add one field to the Categories section too.',
5521
5532
  axisTooltipTitle: 'Drag one or more fields here to create your y-axis.',