| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/apache/htdocs/app/node_modules/vuetify/lib/components/VSparkline/helpers/ |
Upload File : |
export function genPoints(values, boundary) {
const {
minX,
maxX,
minY,
maxY
} = boundary;
const totalValues = values.length;
const maxValue = Math.max(...values);
const minValue = Math.min(...values);
const gridX = (maxX - minX) / (totalValues - 1);
const gridY = (maxY - minY) / (maxValue - minValue || 1);
return values.map((value, index) => {
return {
x: minX + index * gridX,
y: maxY - (value - minValue) * gridY,
value
};
});
}
export function genBars(values, boundary) {
const {
minX,
maxX,
minY,
maxY
} = boundary;
const totalValues = values.length;
let maxValue = Math.max(...values);
let minValue = Math.min(...values);
if (minValue > 0) minValue = 0;
if (maxValue < 0) maxValue = 0;
const gridX = maxX / totalValues;
const gridY = (maxY - minY) / (maxValue - minValue || 1);
const horizonY = maxY - Math.abs(minValue * gridY);
return values.map((value, index) => {
const height = Math.abs(gridY * value);
return {
x: minX + index * gridX,
y: horizonY - height + +(value < 0) * height,
height,
value
};
});
}
//# sourceMappingURL=core.js.map