@datarailsshared/dr_renderer 1.3.24 → 1.3.26

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.3.24",
3
+ "version": "1.3.26",
4
4
  "description": "DataRails charts and tables renderer",
5
5
  "keywords": [
6
6
  "datarails",
@@ -87,7 +87,10 @@ function DrDonutChart(highchartsRenderer, pivotData, opts, drilldownFunc, disabl
87
87
  const series = chart.series[0];
88
88
 
89
89
  const aggTotal = pivotData.getAggregator([], []);
90
- const formattedValue = aggTotal.format(series.total, true);
90
+ const formattedValue =
91
+ additionOptions && additionOptions.customTotalValueFormatFn
92
+ ? additionOptions.customTotalValueFormatFn(series.total)
93
+ : aggTotal.format(series.total, true);
91
94
 
92
95
  if (totalLabel) {
93
96
  totalLabel.destroy();
@@ -124,7 +127,12 @@ function DrDonutChart(highchartsRenderer, pivotData, opts, drilldownFunc, disabl
124
127
  if (drilldownFunc) {
125
128
  chartConfig.drilldown = {};
126
129
  } else if (!pivotData.isDrillDownDisabled) {
127
- chartConfig.drilldown = highchartsRenderer.ptCreateDrillDownSeriesToDrilldownChart(pivotData, chartConfig, additionOptions, opts);
130
+ chartConfig.drilldown = highchartsRenderer.ptCreateDrillDownSeriesToDrilldownChart(
131
+ pivotData,
132
+ chartConfig,
133
+ additionOptions,
134
+ opts,
135
+ );
128
136
  } else {
129
137
  chartConfig.drilldown = highchartsRenderer.getDataLabelsStylesForDrillDown(additionOptions);
130
138
  }
@@ -80,8 +80,8 @@ function DrGaugeChart(pivotData, opts) {
80
80
  return DrGaugeChart.highchartsRenderer.getSingleValueAgg(opts, aggfunc, base);
81
81
  };
82
82
 
83
- this.isLeftQuarter = function (value, max = this.max) {
84
- return value < max / 2;
83
+ this.isLeftQuarter = function (value, max = this.max, min = this.min) {
84
+ return (value - min) < (max - min) / 2;
85
85
  };
86
86
 
87
87
  this.createPlotBands = function (options) {
@@ -115,15 +115,19 @@ describe("DrGaugeChart", () => {
115
115
 
116
116
  describe("isLeftQuarter", () => {
117
117
  it("should check in which quarter the chart value is", () => {
118
- expect(chart.isLeftQuarter(20, 100)).toBe(true);
119
- expect(chart.isLeftQuarter(20, 30)).toBe(false);
120
- expect(chart.isLeftQuarter(20, 20)).toBe(false);
121
- expect(chart.isLeftQuarter(100, 200)).toBe(false);
122
- expect(chart.isLeftQuarter(99, 200)).toBe(true);
118
+ expect(chart.isLeftQuarter(20, 100, 0)).toBe(true);
119
+ expect(chart.isLeftQuarter(20, 30, 0)).toBe(false);
120
+ expect(chart.isLeftQuarter(20, 20, 0)).toBe(false);
121
+ expect(chart.isLeftQuarter(100, 200, 0)).toBe(false);
122
+ expect(chart.isLeftQuarter(99, 200, 0)).toBe(true);
123
+
124
+ expect(chart.isLeftQuarter(59, 100, 20)).toBe(true);
125
+ expect(chart.isLeftQuarter(60, 100, 20)).toBe(false);
123
126
  });
124
127
 
125
- it("should use default #max parameter", () => {
128
+ it("should use default #max and #min parameters", () => {
126
129
  // Max = 180
130
+ // Min = 0
127
131
  expect(chart.isLeftQuarter(20)).toBe(true);
128
132
  expect(chart.isLeftQuarter(120)).toBe(false);
129
133
  });