@datarailsshared/dr_renderer 1.5.90 → 1.5.100

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.5.90",
3
+ "version": "1.5.100",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -544,30 +544,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
544
544
  return chart_option;
545
545
  }
546
546
 
547
- /**
548
- * @deprecated For new angular just use hcInstance
549
- */
550
- highchartsRenderer.downloadFile = function (title, graph_id, type) {
551
- let chart = null;
552
-
553
- const chartElement = $('#' + graph_id).find('div.chart');
554
- if (chartElement.highcharts) {
555
- // old angular
556
- chart = chartElement.highcharts();
557
- }
558
-
559
- if (!chart) return;
560
-
561
- if (type === 'png') {
562
- chart.exportChartLocal({
563
- filename: title
564
- });
565
- }
566
- if (type === 'XLS') {
567
- chart.downloadXLS();
568
- }
569
- };
570
-
571
547
  //TODO No totals formatts
572
548
  highchartsRenderer.defaultValueLabelsFormatter = function (pivotData, opts, forcePercentage = false) {
573
549
  const deltaColumn = lodash.get(opts, 'chartOptions.delta_column', null);
@@ -9536,7 +9512,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
9536
9512
  lodash.forEach(values, (value, key) => {
9537
9513
  const formatInfo = pivotData[type][key] || {};
9538
9514
  const valueToFloat = parseFloat(value);
9539
- const isDate = formatInfo.type === 'Date' && (moment_lib(valueToFloat).isValid() || moment_lib(value).isValid());
9515
+ const isDate = formatInfo.type === 'Date' && (moment_lib(valueToFloat).isValid() || moment_lib(value, formatInfo.format).isValid());
9540
9516
  const isDateFormatting = isDate && highchartsRenderer.isFormattingDatesAsOtherAxisTypes();
9541
9517
  const isNumberFormatting = !isDate && formatInfo.format && highchartsRenderer.isFormattingNumberAxis(pivotData);
9542
9518
 
@@ -338,12 +338,6 @@ describe('highcharts_renderer', () => {
338
338
  });
339
339
  });
340
340
 
341
- describe('function downloadFile', () => {
342
- it('Old angular. No chart', () => {
343
- expect(highchartsRenderer.downloadFile('test', '2_2', 'png')).toEqual(undefined)
344
- });
345
- });
346
-
347
341
  describe('function defaultValueLabelsFormatter', () => {
348
342
  let funcContext;
349
343
 
@@ -5160,6 +5154,17 @@ describe('highcharts_renderer', () => {
5160
5154
  const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
5161
5155
  expect(formattedKey).toEqual(initialKey);
5162
5156
  });
5157
+
5158
+ it('should return formatted value when type is Date and value is a valid moment date (with valid format)', () => {
5159
+ const initialKey = ['Q4-20'];
5160
+ const pivotData = {
5161
+ colFormats: [{ format: "[Q]Q-YY", name: "Date", type: "Date" }],
5162
+ isFormattingAxisLabels: true,
5163
+ };
5164
+ const type = 'colFormats';
5165
+ const formattedKey = highchartsRenderer.getFormattedKey(initialKey, pivotData, type);
5166
+ expect(formattedKey).toEqual(initialKey);
5167
+ });
5163
5168
  });
5164
5169
  });
5165
5170
 
@@ -9395,5 +9400,4 @@ describe('highcharts_renderer', () => {
9395
9400
  expect(result).toEqual({ activeDataLabelStyle: { color: mockColor } });
9396
9401
  });
9397
9402
  });
9398
-
9399
9403
  });