mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 23:45:59 +00:00
SYNC: hard limit for pie chart
This commit is contained in:
committed by
Diflow
parent
47d20928e0
commit
6304610713
@@ -25,6 +25,7 @@ export const ChartLimits = {
|
|||||||
VALID_VALUE_RATIO_LIMIT: 0.5, // limit for valid value ratio, y defs below this will not be used in auto-detect
|
VALID_VALUE_RATIO_LIMIT: 0.5, // limit for valid value ratio, y defs below this will not be used in auto-detect
|
||||||
PIE_RATIO_LIMIT: 0.05, // limit for other values in pie chart, if the value is below this, it will be grouped into "Other"
|
PIE_RATIO_LIMIT: 0.05, // limit for other values in pie chart, if the value is below this, it will be grouped into "Other"
|
||||||
PIE_COUNT_LIMIT: 10, // limit for number of pie chart slices, if the number of slices is above this, it will be grouped into "Other"
|
PIE_COUNT_LIMIT: 10, // limit for number of pie chart slices, if the number of slices is above this, it will be grouped into "Other"
|
||||||
|
MAX_PIE_COUNT_LIMIT: 50, // max pie limit
|
||||||
CHART_FILL_LIMIT: 10000, // limit for filled charts (time intervals), to avoid too many points
|
CHART_FILL_LIMIT: 10000, // limit for filled charts (time intervals), to avoid too many points
|
||||||
CHART_GROUP_LIMIT: 32, // limit for number of groups in a chart
|
CHART_GROUP_LIMIT: 32, // limit for number of groups in a chart
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -407,14 +407,17 @@ export class ChartProcessor {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
groupPieOtherBuckets(chart: ProcessedChart) {
|
groupPieOtherBuckets(chart: ProcessedChart) {
|
||||||
if (chart.definition.chartType !== 'pie') {
|
if (chart.definition.chartType != 'pie' && chart.definition.chartType != 'polarArea') {
|
||||||
return; // only for pie charts
|
return; // only for pie charts
|
||||||
}
|
}
|
||||||
const ratioLimit = chart.definition.pieRatioLimit ?? ChartLimits.PIE_RATIO_LIMIT;
|
const ratioLimit = chart.definition.pieRatioLimit ?? ChartLimits.PIE_RATIO_LIMIT;
|
||||||
const countLimit = chart.definition.pieCountLimit ?? ChartLimits.PIE_COUNT_LIMIT;
|
let countLimit = chart.definition.pieCountLimit ?? ChartLimits.PIE_COUNT_LIMIT;
|
||||||
if (ratioLimit == 0 && countLimit == 0) {
|
if (!countLimit || countLimit <= 1 || countLimit > ChartLimits.MAX_PIE_COUNT_LIMIT) {
|
||||||
return; // no grouping if limit is 0
|
countLimit = ChartLimits.MAX_PIE_COUNT_LIMIT; // limit to max pie count
|
||||||
}
|
}
|
||||||
|
// if (ratioLimit == 0 && countLimit == 0) {
|
||||||
|
// return; // no grouping if limit is 0
|
||||||
|
// }
|
||||||
const otherBucket: any = {};
|
const otherBucket: any = {};
|
||||||
let newBuckets: any = {};
|
let newBuckets: any = {};
|
||||||
const cardSum = _sum(Object.values(chart.buckets).map(bucket => computeChartBucketCardinality(bucket)));
|
const cardSum = _sum(Object.values(chart.buckets).map(bucket => computeChartBucketCardinality(bucket)));
|
||||||
|
|||||||
Reference in New Issue
Block a user