@datarailsshared/dr_renderer 1.2.339 → 1.2.341

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.339",
3
+ "version": "1.2.341",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -145,6 +145,8 @@ const FEATURES = {
145
145
  FORMAT_AXIS: 'use_default_table_format_for_axis',
146
146
  }
147
147
 
148
+ const TICKS_COUNT = 5;
149
+
148
150
  let getHighchartsRenderer = function ($, document, Highcharts, default_colors, highchartsRenderer,
149
151
  DataFormatter, lodash, moment_lib, isNewAngular) {
150
152
 
@@ -1157,7 +1159,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1157
1159
  if (row_n_value && row_n_value.length > 0) {
1158
1160
  ob.initialName = row_n_value.join(highchartsRenderer.delimer)
1159
1161
  .replace(highchartsRenderer.DR_OTHERS_KEY, othersName);
1160
- ob.name = highchartsRenderer.getFormattedRowKey(ob.initialName, pivotData);
1162
+ ob.name = highchartsRenderer.getFormattedRowKey(ob.initialName, pivotData);
1161
1163
  }
1162
1164
  lodash.forEach(col_n_keys, function (col_n_value, index) {
1163
1165
  var agg = pivotData.getAggregator(row_n_value, col_n_value);
@@ -1200,7 +1202,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1200
1202
 
1201
1203
  ob.data.push(
1202
1204
  key
1203
- ? {
1205
+ ? {
1204
1206
  y: val,
1205
1207
  initialName: lodash.unescape(key),
1206
1208
  name: highchartsRenderer.getFormattedColKey(lodash.unescape(key), pivotData),
@@ -1241,14 +1243,16 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1241
1243
  i++;
1242
1244
  });
1243
1245
 
1244
- lodash.forEach(col_n_keys, (col_n_value, index) => {
1245
- if (lodash.isArray(col_n_value)) {
1246
- col_n_keys[index] = lodash.map(
1247
- lodash.filter(col_n_value, value => !!value),
1248
- value => lodash.replace(value, highchartsRenderer.DR_OTHERS_KEY, othersName)
1249
- );
1250
- }
1251
- });
1246
+ if (lodash.get(chartOptions, 'xAxis.categories')) {
1247
+ lodash.forEach(chartOptions.xAxis.categories, (col_n_value, index) => {
1248
+ if (lodash.isArray(col_n_value)) {
1249
+ chartOptions.xAxis.categories[index] = lodash.map(
1250
+ lodash.filter(col_n_value, value => !!value),
1251
+ value => lodash.replace(value, highchartsRenderer.DR_OTHERS_KEY, othersName)
1252
+ );
1253
+ }
1254
+ });
1255
+ }
1252
1256
 
1253
1257
  const ethalonSeries = chart_series[chart_series.length - 1];
1254
1258
 
@@ -1661,7 +1665,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
1661
1665
 
1662
1666
  let initialName = value.trend === 'total' ? value.formattedKey || value.key[0] : keys.join(highchartsRenderer.delimer);
1663
1667
  let name = value.trend === 'total' ? initialName : highchartsRenderer.getFormattedColKey(initialName, pivotData);
1664
-
1668
+
1665
1669
  let color = '';
1666
1670
 
1667
1671
  if (!lodash.get(waterfallOptions, 'colors', {}) && value.color) {
@@ -4819,7 +4823,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
4819
4823
  result = {};
4820
4824
  }
4821
4825
  }
4822
-
4826
+
4823
4827
  return result;
4824
4828
  };
4825
4829
 
@@ -9123,7 +9127,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9123
9127
 
9124
9128
  return topPosition;
9125
9129
  }
9126
-
9130
+ highchartsRenderer.setStaticTicksAmount = function (yAxis) {
9131
+ yAxis.tickAmount = TICKS_COUNT;
9132
+ }
9127
9133
  highchartsRenderer.setYAxisMinMax = function (yAxis, axisYOptions) {
9128
9134
  if (!axisYOptions) {
9129
9135
  return;
@@ -9133,6 +9139,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9133
9139
  const maxNumber = parseInt(axisYOptions.max);
9134
9140
  yAxis.min = !isNaN(minNumber) ? minNumber : null;
9135
9141
  yAxis.max = !isNaN(maxNumber) ? maxNumber : null;
9142
+ if (minNumber || maxNumber) {
9143
+ highchartsRenderer.setStaticTicksAmount(yAxis);
9144
+ }
9136
9145
  }
9137
9146
 
9138
9147
  highchartsRenderer.getDateFieldFormat = function(widget, dateField) {
@@ -9385,7 +9394,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9385
9394
  }
9386
9395
 
9387
9396
  highchartsRenderer.getColsInFormatterContext = function(context, pivotData) {
9388
- return lodash.get(context, 'point.options.colsForTotal')
9397
+ return lodash.get(context, 'point.options.colsForTotal')
9389
9398
  || highchartsRenderer.isFormattingAxis(pivotData) && (lodash.get(context, 'point.initialName') || lodash.get(context, 'options.initialName'))
9390
9399
  || context.key;
9391
9400
  }