Skip to content

Commit 0045420

Browse files
committed
optimize monitor overview charts and add workload insights
1 parent f1fe1f2 commit 0045420

35 files changed

Lines changed: 2537 additions & 1290 deletions

packages/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"vue": "^3.2.13",
4747
"vue-clipboard3": "2.0.0",
4848
"vue-count-to": "1.0.13",
49+
"vue-echarts": "^6.7.3",
4950
"vue-i18n": "9",
5051
"vue-native-websocket-vue3": "^3.1.7",
5152
"vue-router": "^4.0.3",

packages/web/projects/vgpu/components/Detail.vue

Lines changed: 0 additions & 216 deletions
This file was deleted.

packages/web/projects/vgpu/components/config.js

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,28 +219,51 @@ export const getTopOptions = ({ core, memory }) => {
219219
};
220220
};
221221

222-
export const getLineOptions = ({ data = [], unit = '%' }) => {
222+
export const getLineOptions = ({ data = [], unit = '%', seriesName, animation = true }) => {
223223
return {
224+
animation,
224225
tooltip: {
225226
trigger: 'axis',
226227
axisPointer: {
227-
type: 'cross',
228+
type: 'line',
229+
lineStyle: {
230+
type: 'dashed',
231+
color: '#8A8A8A',
232+
},
228233
},
229234
formatter: function (params) {
230-
var res = params[0].name + '<br/>';
231-
for (var i = 0; i < params.length; i++) {
232-
res +=
233-
params[i].marker + (+params[i].value).toFixed(0) + ` ${unit}<br/>`;
235+
if (!Array.isArray(params) || params.length === 0) return '';
236+
237+
let result = `<div style="margin-bottom:5px;">${params[0]?.name ?? ''}</div>`;
238+
for (let i = 0; i < params.length; i++) {
239+
const item = params[i];
240+
const raw = Array.isArray(item?.value) ? item.value[item.value.length - 1] : item?.value;
241+
const num = Number(raw);
242+
const value = Number.isFinite(num) ? `${num.toFixed(1)} ${unit}` : '-';
243+
result += `
244+
<div style="display:flex;align-items:center;font-size:14px;line-height:22px;">
245+
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background-color:${item?.color || '#5B8FF9'};margin-right:5px;"></span>
246+
<span>${item?.seriesName || '-'}:&nbsp;</span>
247+
<span style="font-weight:bold;">${value}</span>
248+
</div>
249+
`;
234250
}
235-
return res;
251+
return result;
236252
},
237253
},
238254
grid: {
239-
top: 7, // 上边距
240-
bottom: 20, // 下边距
241-
left: '7%', // 左边距
242-
right: 10, // 右边距
255+
top: 20, // 上边距
256+
bottom: 30, // 下边距
257+
left: 30, // 左边距
258+
right: 30, // 右边距
243259
},
260+
dataZoom: [
261+
{
262+
type: 'inside',
263+
xAxisIndex: 0,
264+
filterMode: 'none',
265+
},
266+
],
244267
xAxis: {
245268
type: 'category',
246269
data: data.map((item) => timeParse(+item.timestamp)),
@@ -255,10 +278,19 @@ export const getLineOptions = ({ data = [], unit = '%' }) => {
255278
},
256279
series: [
257280
{
281+
name: seriesName || '',
258282
data: data.map((item) => {
259283
return item.value.toFixed(1);
260284
}),
261285
type: 'line',
286+
lineStyle: {
287+
width: 3,
288+
color: '#5B8FF9',
289+
},
290+
itemStyle: {
291+
color: '#5B8FF9',
292+
borderColor: '#5B8FF9',
293+
},
262294
},
263295
],
264296
};

0 commit comments

Comments
 (0)