dbgate-datalib 6.5.5 → 6.5.6

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.
@@ -17,6 +17,7 @@ export declare const ChartLimits: {
17
17
  VALID_VALUE_RATIO_LIMIT: number;
18
18
  PIE_RATIO_LIMIT: number;
19
19
  PIE_COUNT_LIMIT: number;
20
+ MAX_PIE_COUNT_LIMIT: number;
20
21
  CHART_FILL_LIMIT: number;
21
22
  CHART_GROUP_LIMIT: number;
22
23
  };
@@ -16,6 +16,7 @@ exports.ChartLimits = {
16
16
  VALID_VALUE_RATIO_LIMIT: 0.5,
17
17
  PIE_RATIO_LIMIT: 0.05,
18
18
  PIE_COUNT_LIMIT: 10,
19
+ MAX_PIE_COUNT_LIMIT: 50,
19
20
  CHART_FILL_LIMIT: 10000,
20
21
  CHART_GROUP_LIMIT: 32, // limit for number of groups in a chart
21
22
  };
@@ -261,7 +261,7 @@ class ChartProcessor {
261
261
  this.availableColumns = Object.values(this.availableColumnsDict);
262
262
  for (const chart of this.chartsProcessing) {
263
263
  if (chart.errorMessage) {
264
- this.charts.push(chart);
264
+ this.charts.push(Object.assign(Object.assign({}, chart), { availableColumns: this.availableColumns }));
265
265
  continue;
266
266
  }
267
267
  let addedChart = chart;
@@ -315,14 +315,17 @@ class ChartProcessor {
315
315
  }
316
316
  groupPieOtherBuckets(chart) {
317
317
  var _a, _b, _c;
318
- if (chart.definition.chartType !== 'pie') {
318
+ if (chart.definition.chartType != 'pie' && chart.definition.chartType != 'polarArea') {
319
319
  return; // only for pie charts
320
320
  }
321
321
  const ratioLimit = (_a = chart.definition.pieRatioLimit) !== null && _a !== void 0 ? _a : chartDefinitions_1.ChartLimits.PIE_RATIO_LIMIT;
322
- const countLimit = (_b = chart.definition.pieCountLimit) !== null && _b !== void 0 ? _b : chartDefinitions_1.ChartLimits.PIE_COUNT_LIMIT;
323
- if (ratioLimit == 0 && countLimit == 0) {
324
- return; // no grouping if limit is 0
322
+ let countLimit = (_b = chart.definition.pieCountLimit) !== null && _b !== void 0 ? _b : chartDefinitions_1.ChartLimits.PIE_COUNT_LIMIT;
323
+ if (!countLimit || countLimit < 1 || countLimit > chartDefinitions_1.ChartLimits.MAX_PIE_COUNT_LIMIT) {
324
+ countLimit = chartDefinitions_1.ChartLimits.MAX_PIE_COUNT_LIMIT; // limit to max pie count
325
325
  }
326
+ // if (ratioLimit == 0 && countLimit == 0) {
327
+ // return; // no grouping if limit is 0
328
+ // }
326
329
  const otherBucket = {};
327
330
  let newBuckets = {};
328
331
  const cardSum = (0, sum_1.default)(Object.values(chart.buckets).map(bucket => (0, chartTools_1.computeChartBucketCardinality)(bucket)));
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "6.5.5",
2
+ "version": "6.5.6",
3
3
  "name": "dbgate-datalib",
4
4
  "main": "lib/index.js",
5
5
  "typings": "lib/index.d.ts",
@@ -15,14 +15,14 @@
15
15
  ],
16
16
  "dependencies": {
17
17
  "date-fns": "^4.1.0",
18
- "dbgate-filterparser": "^6.5.5",
19
- "dbgate-sqltree": "^6.5.5",
20
- "dbgate-tools": "^6.5.5",
18
+ "dbgate-filterparser": "^6.5.6",
19
+ "dbgate-sqltree": "^6.5.6",
20
+ "dbgate-tools": "^6.5.6",
21
21
  "uuid": "^3.4.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^13.7.0",
25
- "dbgate-types": "^6.5.5",
25
+ "dbgate-types": "^6.5.6",
26
26
  "jest": "^28.1.3",
27
27
  "ts-jest": "^28.0.7",
28
28
  "typescript": "^4.4.3"