Skip to content

Commit

Permalink
Merge pull request #12 from xyctruth/feature/optimize
Browse files Browse the repository at this point in the history
ui optimize
  • Loading branch information
xyctruth authored Dec 22, 2021
2 parents 2db55ca + 86ec872 commit dacfad6
Show file tree
Hide file tree
Showing 3 changed files with 620 additions and 9 deletions.
1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.0",
"scripts": {
"dev": "vite",
"start": "npm run dev --base_api_url=https://api.profiling.jia-huang.com",
"build": "vite build",
"preview": "vite preview"
},
Expand Down
30 changes: 21 additions & 9 deletions ui/src/view/index/components/chart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@
nextTick(() => {
var unit = ""
const baseSetting = {
type: "line",
lineStyle: {
type: "scatter",
showSymbol: false,
sampling: 'lttb',
showAllSymbol: false,
symbolSize: 10,
emphasis: {
width: 3,
focus: 'series',
},
showSymbol: false,
}
const chartOptions = {
animation: false, // 关闭加载动画
legend: {
type: 'scroll',
orient: 'vertical',
Expand All @@ -81,6 +87,7 @@
end: 100,
type: "slider",
show: true,
realtime: false, // 是否实时刷新
},
title: {
text: title,
Expand All @@ -103,7 +110,14 @@
},
tooltip: {
show: true,
trigger: 'axis',
confine: true,
trigger: 'item',
axisPointer: {
animation: false
},
formatter: (params) => {
return formatTooltip(params, unit)
},
},
series: []
}
Expand All @@ -117,12 +131,9 @@
...baseSetting,
name: meta.TargetName,
data: [],
emphasis: {
focus: 'series'
},
}
for (const p of meta.ProfileMetas) {
if (unit){
if (!unit){
unit = p.SampleTypeUnit
}
let label = moment(p.Timestamp).format('YYYY-MM-DD HH:mm:ss')
Expand All @@ -142,7 +153,8 @@
chart = echarts.init(canvas.value, null, {
devicePixelRatio: window.devicePixelRatio || 2,
width,
height
height,
useDirtyRect: true,
});
chart.on('click', function (params) {
window.open(`${baseConfig.reqUrl}/api/pprof/ui/${params.data.sourceData.ProfileID}?si=${title}`)
Expand Down
Loading

0 comments on commit dacfad6

Please sign in to comment.