@datarailsshared/dr_renderer 1.2.434 → 1.2.437

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.434",
3
+ "version": "1.2.437",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -350,7 +350,7 @@ var DataFormatterImpl = function () {
350
350
 
351
351
  n = this.roundDecimals(n, decimals).toString().split('.');
352
352
  var integerPart = n[0];
353
- var decimalPart = n[1] || 0;
353
+ var decimalPart = String(n[1] || 0).padEnd(decimals, '0');
354
354
 
355
355
  return this.applyNumberPattern(integerPart, patternIntegerPart) + this.locale.decimalSeparator + this.applyNumberPattern(decimalPart, patternDecimalPart, n[1] && n[1][0] == '0' ? '' : 'right');
356
356
  }
@@ -1,4 +1,5 @@
1
1
  const helpers = require('./dr-renderer-helpers');
2
+ const seriesPointStylesHelper= require('./seriesPointStyles-helper')
2
3
 
3
4
  const mobileBrowserRegex = new RegExp([
4
5
  '(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)',
@@ -2530,6 +2531,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2530
2531
 
2531
2532
  chartOptions.series = highchartsRenderer.ptCreateSeriesToDrillDownChart(pivotData, chartOptions, additionOptions, opts);
2532
2533
  chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, 1, false, true);
2534
+ chartOptions.drilldown = highchartsRenderer.getDataLabelsStylesForDrillDown(additionOptions);
2533
2535
  if (drilldownFunc)
2534
2536
  chartOptions.drilldown = {}
2535
2537
  else if (!pivotData.isDrillDownDisabled)
@@ -2641,6 +2643,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2641
2643
  chartOptions.series = highchartsRenderer.ptCreateBasicLineSeries(pivotData, null, null, null, additionOptions, opts, chartOptions);
2642
2644
 
2643
2645
  highchartsRenderer.handleGridLines(additionOptions, chartOptions)
2646
+ if (opts.selectedPoint) {
2647
+ seriesPointStylesHelper.setInitialPointStyles(opts, chartOptions.series);
2648
+ }
2644
2649
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
2645
2650
  };
2646
2651
 
@@ -2722,6 +2727,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2722
2727
  chartOptions.series = highchartsRenderer.ptCreateBasicLineSeries(pivotData, colors, null, null, additionOptions, opts, chartOptions);
2723
2728
 
2724
2729
  highchartsRenderer.handleGridLines(additionOptions, chartOptions)
2730
+ if (opts.selectedPoint) {
2731
+ seriesPointStylesHelper.setInitialPointStyles(opts, chartOptions.series);
2732
+ }
2725
2733
 
2726
2734
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
2727
2735
  };
@@ -2816,6 +2824,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2816
2824
  chartOptions.series = highchartsRenderer.ptCreateBasicLineSeries(pivotData, null, null, null, additionOptions, opts, chartOptions);
2817
2825
 
2818
2826
  highchartsRenderer.handleGridLines(additionOptions, chartOptions);
2827
+ if (opts.selectedPoint) {
2828
+ seriesPointStylesHelper.setInitialPointStyles(opts, chartOptions.series);
2829
+ }
2819
2830
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
2820
2831
  };
2821
2832
 
@@ -2900,6 +2911,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2900
2911
 
2901
2912
  chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, rowAttrs.length, false);
2902
2913
 
2914
+ if (opts.selectedPoint) {
2915
+ seriesPointStylesHelper.setInitialPointStyles(opts, chartOptions.series);
2916
+ }
2903
2917
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
2904
2918
  };
2905
2919
 
@@ -2991,7 +3005,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
2991
3005
  drilldownFunc(e, this, "drillup");
2992
3006
 
2993
3007
  }
2994
-
2995
3008
  }
2996
3009
  };
2997
3010
  if (disableAnimation) {
@@ -3066,8 +3079,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3066
3079
  }
3067
3080
  }
3068
3081
  };
3069
-
3070
3082
  if (opts.drillDownListFunc) {
3083
+ chartOptions.plotOptions.series = {
3084
+ animation: !disableAnimation,
3085
+ };
3071
3086
  chartOptions.plotOptions.series.cursor = 'pointer';
3072
3087
  chartOptions.plotOptions.series.point = {
3073
3088
  events: {
@@ -3076,6 +3091,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3076
3091
  };
3077
3092
  }
3078
3093
  chartOptions.plotOptions.series = highchartsRenderer.getDataLabelsOptions(additionOptions, chartOptions.plotOptions.series);
3094
+
3095
+ if (opts.selectedPoint) {
3096
+ seriesPointStylesHelper.setInitialPointStyles(opts, chartOptions.series);
3097
+ }
3079
3098
  chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, rowAttrs.length, false);
3080
3099
 
3081
3100
  chartOptions.drilldown = highchartsRenderer.getDataLabelsStylesForDrillDown(additionOptions);
@@ -3220,6 +3239,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3220
3239
  }
3221
3240
  chartOptions.series = highchartsRenderer.ptCreateColumnSeries(pivotData, chartOptions.colors, null, true, true, additionOptions, opts, chartOptions, chartType);
3222
3241
  //chartOptions.drilldown = {}
3242
+ if (opts.selectedPoint) {
3243
+ seriesPointStylesHelper.setInitialPointStyles(opts, chartOptions.series);
3244
+ }
3223
3245
 
3224
3246
  highchartsRenderer.handleGridLines(additionOptions, chartOptions)
3225
3247
 
@@ -3386,9 +3408,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3386
3408
  }
3387
3409
  };
3388
3410
  }
3389
-
3390
3411
  chartOptions.legend = highchartsRenderer.getOptionsForLegends(additionOptions, rowAttrs.length, false);
3391
-
3412
+ if (opts.selectedPoint) {
3413
+ seriesPointStylesHelper.setInitialPointStyles(opts, chartOptions.series);
3414
+ }
3392
3415
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
3393
3416
  };
3394
3417
 
@@ -3478,6 +3501,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3478
3501
  chartOptions = highchartsRenderer.prepareAxisX(chartOptions, additionOptions, pivotData.getColKeys());
3479
3502
  chartOptions.series = highchartsRenderer.ptCreateBasicLineSeries(pivotData, null, null, null, null, opts, chartOptions);
3480
3503
 
3504
+ if (opts.selectedPoint) {
3505
+ seriesPointStylesHelper.setInitialPointStyles(opts, chartOptions.series);
3506
+ }
3481
3507
  highchartsRenderer.handleGridLines(additionOptions, chartOptions)
3482
3508
 
3483
3509
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
@@ -3600,6 +3626,9 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3600
3626
  formatter: highchartsRenderer.getBreakdownXAxisLabelFormatter(chartOptions.series),
3601
3627
  };
3602
3628
 
3629
+ if (opts.selectedPoint) {
3630
+ seriesPointStylesHelper.setInitialPointStyles(opts, chartOptions.series);
3631
+ }
3603
3632
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
3604
3633
  };
3605
3634
 
@@ -3716,6 +3745,10 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
3716
3745
  }
3717
3746
  }
3718
3747
 
3748
+ if (opts.selectedPoint) {
3749
+ seriesPointStylesHelper.setInitialPointStyles(opts, chartOptions.series);
3750
+ }
3751
+
3719
3752
  return highchartsRenderer.ptCreateElementAndDraw(chartOptions, opts);
3720
3753
  }
3721
3754
 
@@ -5933,22 +5966,28 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
5933
5966
  if (fnToReturn == null)
5934
5967
  fnToReturn = highchartsRenderer.ptRenderBasicLine;
5935
5968
 
5936
- var fnunctionToReturn = function (pivotData, opt) {
5969
+ return function(pivotData, opt) {
5937
5970
  if (drillDownListFunc) {
5938
5971
  if (!opt) {
5939
5972
  opt = {};
5940
5973
  }
5941
- opt.drillDownListFunc = (e) => {
5942
- highchartsRenderer.modifyEventPointForDrilldown(e);
5943
- drillDownListFunc(e);
5944
- };
5974
+ if (opt.isUpdatingPointStylesOnClick) {
5975
+ opt.drillDownListFunc = (e) => {
5976
+ seriesPointStylesHelper.setSeriesPointStylesOnClick(e);
5977
+ highchartsRenderer.modifyEventPointForDrilldown(e);
5978
+ drillDownListFunc(e);
5979
+ };
5980
+ } else {
5981
+ opt.drillDownListFunc = (e) => {
5982
+ highchartsRenderer.modifyEventPointForDrilldown(e);
5983
+ drillDownListFunc(e);
5984
+ };
5985
+ }
5945
5986
  } else {
5946
5987
  opt.drillDownListFunc = null;
5947
5988
  }
5948
- return fnToReturn(pivotData, opt, drilldownFunc, newChartType); //todo pass drilldownFunc
5989
+ return fnToReturn(pivotData, opt, drilldownFunc, newChartType);
5949
5990
  };
5950
-
5951
- return fnunctionToReturn;
5952
5991
  };
5953
5992
 
5954
5993
  highchartsRenderer.getAggregatorFunctionById = function (aggrigatorId) {
@@ -0,0 +1,43 @@
1
+ function getSeriesPointStyles(isSelected) {
2
+ return {
3
+ opacity: isSelected ? 1 : 0.1,
4
+ marker: {
5
+ enabled: true,
6
+ radius: isSelected ? 8 : 3,
7
+ },
8
+ dataLabels: {
9
+ style: {
10
+ fontWeight: isSelected ? "bold" : "normal",
11
+ },
12
+ },
13
+ };
14
+ }
15
+
16
+ function setSeriesPointStylesOnClick(e) {
17
+ const selectedPoint = e.point;
18
+ e.point.series.chart.series.forEach((series) =>
19
+ series.points.forEach((point) => {
20
+ point.update(getSeriesPointStyles(point === selectedPoint), false);
21
+ })
22
+ );
23
+ e.point.series.chart.redraw();
24
+ }
25
+
26
+ function setInitialPointStyles(opts, series) {
27
+ series.forEach((series) => {
28
+ if (Array.isArray(series.data)) {
29
+ series.data.forEach((item) => {
30
+ const isSelected =
31
+ item && opts.selectedPoint &&
32
+ item.initialName === opts.selectedPoint.initialName &&
33
+ item.y === opts.selectedPoint.y;
34
+ item = Object.assign(item, getSeriesPointStyles(isSelected));
35
+ });
36
+ }
37
+ });
38
+ }
39
+
40
+ module.exports = {
41
+ setSeriesPointStylesOnClick,
42
+ setInitialPointStyles,
43
+ };
@@ -1,6 +1,7 @@
1
1
  import drRendererHelpers from '../src/dr-renderer-helpers';
2
2
 
3
3
  describe('dr-renderer-helpers', () => {
4
+
4
5
  describe('backendSortingKeysAreNotEmpty', () => {
5
6
  it('should return true if keys are not empty', () => {
6
7
  const keys = {
@@ -2376,14 +2376,14 @@ describe('highcharts_renderer', () => {
2376
2376
 
2377
2377
  it('Should return widget format if it\'s graph', () => {
2378
2378
  aggregatorObject.widget_values_format = '\"$\"#,###.###';
2379
- expect(aggregatorObject.format(2, false)).toBe('$2.0');
2379
+ expect(aggregatorObject.format(2, false)).toBe('$2.000');
2380
2380
  });
2381
2381
 
2382
2382
  it('Should return widget format if it\'s only_formats', () => {
2383
2383
  aggregator = highchartsRenderer.rhPivotAggregatorUniqValues(arg, widget_values_format, false, render_options, calculated_info);
2384
2384
  aggregatorObject = aggregator({}, '', '');
2385
2385
  aggregatorObject.widget_values_format = '\"$\"#,###.###';
2386
- expect(aggregatorObject.format(2, true)).toBe('$2.0');
2386
+ expect(aggregatorObject.format(2, true)).toBe('$2.000');
2387
2387
  });
2388
2388
 
2389
2389
  it('Should return uniq values if it\'s table and not only_formats', () => {
@@ -4731,7 +4731,7 @@ describe('highcharts_renderer', () => {
4731
4731
  };
4732
4732
  const type = 'colFormats';
4733
4733
  const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
4734
- expect(formattedKey).toEqual(['$1000.0']);
4734
+ expect(formattedKey).toEqual(['$1000.00']);
4735
4735
  });
4736
4736
 
4737
4737
  it('should return properly formatted rowKey as array', () => {
@@ -4743,7 +4743,7 @@ describe('highcharts_renderer', () => {
4743
4743
  };
4744
4744
  const type = 'rowFormats';
4745
4745
  const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
4746
- expect(formattedKey).toEqual(['$1000.0']);
4746
+ expect(formattedKey).toEqual(['$1000.00']);
4747
4747
  });
4748
4748
 
4749
4749
  it('should return properly formatted colKey as string', () => {
@@ -4755,7 +4755,7 @@ describe('highcharts_renderer', () => {
4755
4755
  };
4756
4756
  const type = 'colFormats';
4757
4757
  const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
4758
- expect(formattedKey).toEqual('$1000.0');
4758
+ expect(formattedKey).toEqual('$1000.00');
4759
4759
  });
4760
4760
 
4761
4761
  it('should return properly formatted rowKey as string', () => {
@@ -4767,7 +4767,7 @@ describe('highcharts_renderer', () => {
4767
4767
  };
4768
4768
  const type = 'rowFormats';
4769
4769
  const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
4770
- expect(formattedKey).toEqual('$1000.0');
4770
+ expect(formattedKey).toEqual('$1000.00');
4771
4771
  });
4772
4772
 
4773
4773
  it('should return formatted multivalue colKey as string', () => {
@@ -4778,7 +4778,7 @@ describe('highcharts_renderer', () => {
4778
4778
  };
4779
4779
  const type = 'colFormats';
4780
4780
  const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
4781
- expect(formattedKey).toEqual('$1000.0 , ₪2000.0');
4781
+ expect(formattedKey).toEqual('$1000.00 , ₪2000.00');
4782
4782
  });
4783
4783
 
4784
4784
  it('should return formatted multivalue colKey as array', () => {
@@ -4789,7 +4789,7 @@ describe('highcharts_renderer', () => {
4789
4789
  };
4790
4790
  const type = 'colFormats';
4791
4791
  const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
4792
- expect(formattedKey).toEqual(['$1000.0', '₪2000.0']);
4792
+ expect(formattedKey).toEqual(['$1000.00', '₪2000.00']);
4793
4793
  });
4794
4794
 
4795
4795
  it('should return not formatted second value (test as array)', () => {
@@ -4800,7 +4800,7 @@ describe('highcharts_renderer', () => {
4800
4800
  };
4801
4801
  const type = 'colFormats';
4802
4802
  const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
4803
- expect(formattedKey).toEqual(['$1000.0', '2000']);
4803
+ expect(formattedKey).toEqual(['$1000.00', '2000']);
4804
4804
  });
4805
4805
 
4806
4806
  it('should return not formatted first value (test as array)', () => {
@@ -4811,7 +4811,7 @@ describe('highcharts_renderer', () => {
4811
4811
  };
4812
4812
  const type = 'colFormats';
4813
4813
  const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
4814
- expect(formattedKey).toEqual(['1000', '$2000.0']);
4814
+ expect(formattedKey).toEqual(['1000', '$2000.00']);
4815
4815
  });
4816
4816
 
4817
4817
  describe('formatting Dates', () => {
@@ -4906,7 +4906,7 @@ describe('highcharts_renderer', () => {
4906
4906
  const isCols = true;
4907
4907
  const formattedKeys = highchartsRenderer.getFormattedKeys(pivotData, isCols, null);
4908
4908
  expect(formattedKeys).toEqual(
4909
- [['$1.0', '₪11.0'], ['$2.0', '₪32.0'], ['[null]', '₪43.0'], ['$5.0', '₪54.0'], ['Others', '₪33.0'], ['$6.0', '₪98.0']]
4909
+ [['$1.00', '₪11.00'], ['$2.00', '₪32.00'], ['[null]', '₪43.00'], ['$5.00', '₪54.00'], ['Others', '₪33.00'], ['$6.00', '₪98.00']]
4910
4910
  );
4911
4911
  });
4912
4912
 
@@ -4915,7 +4915,7 @@ describe('highcharts_renderer', () => {
4915
4915
  const isCols = true;
4916
4916
  const formattedKeys = highchartsRenderer.getFormattedKeys(pivotData, isCols, null);
4917
4917
  expect(formattedKeys).toEqual(
4918
- [['1', '₪11.0'], ['2', '₪32.0'], ['[null]', '₪43.0'], ['5', '₪54.0'], ['Others', '₪33.0'], ['6', '₪98.0']]
4918
+ [['1', '₪11.00'], ['2', '₪32.00'], ['[null]', '₪43.00'], ['5', '₪54.00'], ['Others', '₪33.00'], ['6', '₪98.00']]
4919
4919
  );
4920
4920
  });
4921
4921
 
@@ -4924,7 +4924,7 @@ describe('highcharts_renderer', () => {
4924
4924
  const isCols = true;
4925
4925
  const formattedKeys = highchartsRenderer.getFormattedKeys(pivotData, isCols, null);
4926
4926
  expect(formattedKeys).toEqual(
4927
- [['$1.0', '11'], ['$2.0', '32'], ['[null]', '43'], ['$5.0', '54'], ['Others', '33'], ['$6.0', '98']]
4927
+ [['$1.00', '11'], ['$2.00', '32'], ['[null]', '43'], ['$5.00', '54'], ['Others', '33'], ['$6.00', '98']]
4928
4928
  );
4929
4929
  });
4930
4930
 
@@ -4933,7 +4933,7 @@ describe('highcharts_renderer', () => {
4933
4933
  const isCols = false;
4934
4934
  const formattedKeys = highchartsRenderer.getFormattedKeys(pivotData, isCols, null);
4935
4935
  expect(formattedKeys).toEqual(
4936
- [['$1.0', '₪11.0'], ['$2.0', '₪32.0'], ['[null]', '₪43.0'], ['$5.0', '₪54.0'], ['Others', '₪33.0'], ['$6.0', '₪98.0']]
4936
+ [['$1.00', '₪11.00'], ['$2.00', '₪32.00'], ['[null]', '₪43.00'], ['$5.00', '₪54.00'], ['Others', '₪33.00'], ['$6.00', '₪98.00']]
4937
4937
  );
4938
4938
  });
4939
4939
 
@@ -4942,7 +4942,7 @@ describe('highcharts_renderer', () => {
4942
4942
  const isCols = false;
4943
4943
  const formattedKeys = highchartsRenderer.getFormattedKeys(pivotData, isCols, null);
4944
4944
  expect(formattedKeys).toEqual(
4945
- [['1', '₪11.0'], ['2', '₪32.0'], ['[null]', '₪43.0'], ['5', '₪54.0'], ['Others', '₪33.0'], ['6', '₪98.0']]
4945
+ [['1', '₪11.00'], ['2', '₪32.00'], ['[null]', '₪43.00'], ['5', '₪54.00'], ['Others', '₪33.00'], ['6', '₪98.00']]
4946
4946
  );
4947
4947
  });
4948
4948
 
@@ -4951,7 +4951,7 @@ describe('highcharts_renderer', () => {
4951
4951
  const isCols = false;
4952
4952
  const formattedKeys = highchartsRenderer.getFormattedKeys(pivotData, isCols, null);
4953
4953
  expect(formattedKeys).toEqual(
4954
- [['$1.0', '11'], ['$2.0', '32'], ['[null]', '43'], ['$5.0', '54'], ['Others', '33'], ['$6.0', '98']]
4954
+ [['$1.00', '11'], ['$2.00', '32'], ['[null]', '43'], ['$5.00', '54'], ['Others', '33'], ['$6.00', '98']]
4955
4955
  );
4956
4956
  });
4957
4957
  });
@@ -5390,11 +5390,11 @@ describe('highcharts_renderer', () => {
5390
5390
  const formatCases = [
5391
5391
  {
5392
5392
  format: '$"#,###.##',
5393
- expected: '$12,345.0'
5393
+ expected: '$12,345.00'
5394
5394
  },
5395
5395
  {
5396
5396
  format: '%"#,###.##',
5397
- expected: '%1,234,500.0'
5397
+ expected: '%1,234,500.00'
5398
5398
  },
5399
5399
  {
5400
5400
  format: '#,###',
@@ -5429,7 +5429,7 @@ describe('highcharts_renderer', () => {
5429
5429
  const tooltipHtml = tooltipFunction.call(displayTooltipContext);
5430
5430
 
5431
5431
  expect(tooltipHtml).toEqual(
5432
- '<br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$12,345.0</span>'
5432
+ '<br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$12,345.00</span>'
5433
5433
  );
5434
5434
  });
5435
5435
 
@@ -5443,7 +5443,7 @@ describe('highcharts_renderer', () => {
5443
5443
  expect(tooltipHtml).toEqual(
5444
5444
  `<span style="font-weight: bold;">
5445
5445
  col 1
5446
- </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$12,345.0</span>`
5446
+ </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$12,345.00</span>`
5447
5447
  + '<br/>% Out of Axis (Category): 10%'
5448
5448
  );
5449
5449
  });
@@ -5458,7 +5458,7 @@ describe('highcharts_renderer', () => {
5458
5458
  expect(tooltipHtml).toEqual(
5459
5459
  `<span style="font-weight: bold;">
5460
5460
  col 1
5461
- </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$12,345.0</span>`
5461
+ </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$12,345.00</span>`
5462
5462
  + '<br/>% Out of Legend (Series): 1%'
5463
5463
  );
5464
5464
  });
@@ -5474,7 +5474,7 @@ describe('highcharts_renderer', () => {
5474
5474
  expect(tooltipHtml).toEqual(
5475
5475
  `<span style="font-weight: bold;">
5476
5476
  col 1
5477
- </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$12,345.0</span>`
5477
+ </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$12,345.00</span>`
5478
5478
  + '<br/>% Out of Axis (Category): 10%, % Out of Legend (Series): 1%'
5479
5479
  );
5480
5480
  });
@@ -5494,7 +5494,7 @@ describe('highcharts_renderer', () => {
5494
5494
  expect(tooltipHtml).toEqual(
5495
5495
  `<span style="font-weight: bold;">
5496
5496
  col 1
5497
- </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$12,345.0</span>`
5497
+ </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$12,345.00</span>`
5498
5498
  + '<br/>% Out of X-AXIS: 10%, % Out of DATA-SERIES: 1%'
5499
5499
  );
5500
5500
  });
@@ -5510,7 +5510,7 @@ describe('highcharts_renderer', () => {
5510
5510
  expect(tooltipHtml).toEqual(
5511
5511
  `<span style="font-weight: bold;">
5512
5512
  col 1,col 2
5513
- </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$54,321.0</span>`
5513
+ </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$54,321.00</span>`
5514
5514
  );
5515
5515
  });
5516
5516
 
@@ -5525,7 +5525,7 @@ describe('highcharts_renderer', () => {
5525
5525
  expect(tooltipHtml).toEqual(
5526
5526
  `<span style="font-weight: bold;">
5527
5527
  col 1
5528
- </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1 , row 2</span>: <span>\u200E$11,111.0</span>`
5528
+ </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1 , row 2</span>: <span>\u200E$11,111.00</span>`
5529
5529
  );
5530
5530
  });
5531
5531
 
@@ -5539,7 +5539,7 @@ describe('highcharts_renderer', () => {
5539
5539
  expect(tooltipHtml).toEqual(
5540
5540
  `<span style="font-weight: bold;">
5541
5541
  ${ othersName }
5542
- </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$99,999.0</span>`
5542
+ </span><br/><span style="font-weight: bold; color: green;">\u200Erow 1</span>: <span>\u200E$99,999.00</span>`
5543
5543
  );
5544
5544
  });
5545
5545
 
@@ -5569,7 +5569,7 @@ describe('highcharts_renderer', () => {
5569
5569
  expect(tooltipHtml).toEqual(
5570
5570
  `<span style="font-weight: bold;">
5571
5571
  row 1 :
5572
- </span><span>\u200E$12,345.0</span>`
5572
+ </span><span>\u200E$12,345.00</span>`
5573
5573
  );
5574
5574
  });
5575
5575
 
@@ -5599,7 +5599,7 @@ describe('highcharts_renderer', () => {
5599
5599
  expect(tooltipHtml).toEqual(
5600
5600
  `<span style="font-weight: bold;">
5601
5601
  col 1 :
5602
- </span><span>\u200E$88,888.0</span>`
5602
+ </span><span>\u200E$88,888.00</span>`
5603
5603
  );
5604
5604
  });
5605
5605
 
@@ -5631,7 +5631,7 @@ describe('highcharts_renderer', () => {
5631
5631
  expect(tooltipHtml).toEqual(
5632
5632
  `<span style="font-weight: bold;">
5633
5633
  Total 1
5634
- </span>: <span>\u200E$100.0</span>`
5634
+ </span>: <span>\u200E$100.00</span>`
5635
5635
  );
5636
5636
  });
5637
5637
 
@@ -5653,7 +5653,7 @@ describe('highcharts_renderer', () => {
5653
5653
  highchartsRenderer.defaultFormatterToTooltip(pivotDataMock, optsMock, isForDrilldownPie);
5654
5654
  const tooltipHtml = tooltipFunction.call(displayTooltipContext);
5655
5655
 
5656
- expect(tooltipHtml).toEqual('<span>\u200E$123,450.0</span>');
5656
+ expect(tooltipHtml).toEqual('<span>\u200E$123,450.00</span>');
5657
5657
  });
5658
5658
 
5659
5659
  it('should return proper tooltip html (for trendline point)', () => {
@@ -5675,7 +5675,7 @@ describe('highcharts_renderer', () => {
5675
5675
 
5676
5676
  expect(tooltipHtml).toEqual(`<span style="font-weight: bold;">
5677
5677
  col 1
5678
- </span><br/><span style="font-weight: bold; color: green;">\u200ETrend Line</span>: <span>\u200E$55,555.0</span>`
5678
+ </span><br/><span style="font-weight: bold; color: green;">\u200ETrend Line</span>: <span>\u200E$55,555.00</span>`
5679
5679
  );
5680
5680
  });
5681
5681
  });
@@ -0,0 +1,114 @@
1
+ import seriesPointStylesHelper from '../src/seriesPointStyles-helper';
2
+
3
+ describe('setSeriesPointStylesOnClick', () => {
4
+ it('should update point styles on click and update other points to non-selected styles on click', () => {
5
+ const selectedPoint = {
6
+ update: jest.fn(),
7
+ series: {
8
+ chart: {
9
+ series: [{ points: [] }],
10
+ redraw: jest.fn()
11
+ }
12
+ }
13
+ };
14
+
15
+ const otherPoint = {
16
+ update: jest.fn(),
17
+ series: selectedPoint.series
18
+ };
19
+
20
+ selectedPoint.series.chart.series[0].points.push(selectedPoint, otherPoint);
21
+
22
+ const mockEvent = { point: selectedPoint };
23
+
24
+ seriesPointStylesHelper.setSeriesPointStylesOnClick(mockEvent);
25
+
26
+ expect(selectedPoint.update).toHaveBeenCalledWith(
27
+ {
28
+ opacity: 1,
29
+ marker: {
30
+ enabled: true,
31
+ radius: 8
32
+ },
33
+ dataLabels: {
34
+ style: {
35
+ fontWeight: 'bold'
36
+ }
37
+ }
38
+ },
39
+ false
40
+ );
41
+ expect(otherPoint.update).toHaveBeenCalledWith(
42
+ {
43
+ opacity: 0.1,
44
+ marker: {
45
+ enabled: true,
46
+ radius: 3
47
+ },
48
+ dataLabels: {
49
+ style: {
50
+ fontWeight: 'normal'
51
+ }
52
+ }
53
+ },
54
+ false
55
+ );
56
+ expect(selectedPoint.series.chart.redraw).toHaveBeenCalled();
57
+ });
58
+ });
59
+
60
+ describe('setInitialPointStyles', () => {
61
+ it('should set initial point styles based on selection', () => {
62
+ const opts = { selectedPoint: { initialName: 'point1', y: 10 } };
63
+ const mockPoint = { initialName: 'point1', y: 10 };
64
+ const mockSeries = { data: [mockPoint] };
65
+ const series = [mockSeries];
66
+
67
+ seriesPointStylesHelper.setInitialPointStyles(opts, series);
68
+
69
+ expect(mockPoint).toEqual(
70
+ Object.assign(
71
+ mockPoint,
72
+ {
73
+ opacity: 1,
74
+ marker: {
75
+ enabled: true,
76
+ radius: 8
77
+ },
78
+ dataLabels: {
79
+ style: {
80
+ fontWeight: 'bold'
81
+ }
82
+ }
83
+ }
84
+ )
85
+ );
86
+ });
87
+
88
+ it('should not set styles if point is not selected', () => {
89
+ const opts = { selectedPoint: { initialName: 'point1', y: 10 } };
90
+ const mockPoint = { initialName: 'point2', y: 20 };
91
+ const mockSeries = { data: [mockPoint] };
92
+ const series = [mockSeries];
93
+
94
+ seriesPointStylesHelper.setInitialPointStyles(opts, series);
95
+
96
+ expect(mockPoint).toEqual(
97
+ Object.assign(
98
+ mockPoint,
99
+ {
100
+ opacity: 0.1,
101
+ marker: {
102
+ enabled: true,
103
+ radius: 3
104
+ },
105
+ dataLabels: {
106
+ style: {
107
+ fontWeight: 'normal'
108
+ }
109
+ }
110
+ }
111
+ )
112
+ );
113
+ });
114
+ });