app/vmui: properly calculate graph range for y axis

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2037
This commit is contained in:
Aliaksandr Valialkin 2022-01-18 22:21:51 +02:00
parent 5a77c86e97
commit 672fcba223
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
6 changed files with 11 additions and 9 deletions

View file

@ -1,12 +1,12 @@
{ {
"files": { "files": {
"main.css": "./static/css/main.79ff1ad2.css", "main.css": "./static/css/main.79ff1ad2.css",
"main.js": "./static/js/main.352e61b4.js", "main.js": "./static/js/main.c94cd6ac.js",
"static/js/27.cc1b69f7.chunk.js": "./static/js/27.cc1b69f7.chunk.js", "static/js/27.cc1b69f7.chunk.js": "./static/js/27.cc1b69f7.chunk.js",
"index.html": "./index.html" "index.html": "./index.html"
}, },
"entrypoints": [ "entrypoints": [
"static/css/main.79ff1ad2.css", "static/css/main.79ff1ad2.css",
"static/js/main.352e61b4.js" "static/js/main.c94cd6ac.js"
] ]
} }

View file

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="VM-UI is a metric explorer for Victoria Metrics"/><link rel="apple-touch-icon" href="./apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png"><link rel="manifest" href="./manifest.json"/><title>VM UI</title><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/><script defer="defer" src="./static/js/main.352e61b4.js"></script><link href="./static/css/main.79ff1ad2.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html> <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="VM-UI is a metric explorer for Victoria Metrics"/><link rel="apple-touch-icon" href="./apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="./favicon-32x32.png"><link rel="manifest" href="./manifest.json"/><title>VM UI</title><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"/><script defer="defer" src="./static/js/main.c94cd6ac.js"></script><link href="./static/css/main.79ff1ad2.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -20,9 +20,11 @@ export const getTimeSeries = (times: number[], defaultStep: number, period: Time
}; };
export const getMinMaxBuffer = (min: number, max: number): [number, number] => { export const getMinMaxBuffer = (min: number, max: number): [number, number] => {
const minCorrect = min || -1; const minCorrect = isNaN(min) ? -1 : min;
const maxCorrect = max || 1; const maxCorrect = isNaN(max) ? 1 : max;
return [minCorrect - (Math.abs(minCorrect) * 0.25), maxCorrect + (Math.abs(maxCorrect) * 0.25)]; const valueRange = Math.abs(maxCorrect - minCorrect) || Math.abs(minCorrect) || 1;
const padding = 0.02*valueRange;
return [minCorrect - padding, maxCorrect + padding];
}; };
export const getLimitsYAxis = (values: { [key: string]: number[] }): AxisRange => { export const getLimitsYAxis = (values: { [key: string]: number[] }): AxisRange => {