in src/rule/bigData.tsx [37:74]
export function isBigDataInit(
chartName: string,
judgements: IBigData[],
dataSize: number,
width: number,
height: number,
mainAxis = 'x',
) {
if (!dataSize || !width || !height) {
return false;
}
let res = false;
judgements?.forEach((judgement: IBigData) => {
const { type, threshold, period = 'init', message } = judgement;
if (period === 'init') {
let isBigData = false;
if (type === BigDataJudgement.Length) {
const length = mainAxis === 'x' ? width ?? 0 : height ?? 0;
isBigData = length > 0 && length / dataSize < threshold;
} else if (type === BigDataJudgement.Area) {
isBigData = (height * width) / dataSize < threshold;
} else if (type === BigDataJudgement.Number) {
isBigData = dataSize > threshold;
} else if (type === BigDataJudgement.Polar) {
const radius = Math.min(height, width);
isBigData = radius < threshold;
}
res = res || isBigData;
if (isBigData && message) {
warn(chartName, message);
}
}
});
return res;
}