@@ -70,19 +70,31 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv
70
70
height : 250 ,
71
71
padding : [ 10 , 30 , 70 , 30 ]
72
72
} ) ;
73
+ var maxQps = 0 ;
74
+ for ( var i in metric . data ) {
75
+ var item = metric . data [ i ] ;
76
+ if ( item . passQps > maxQps ) {
77
+ maxQps = item . passQps ;
78
+ }
79
+ if ( item . blockQps > maxQps ) {
80
+ maxQps = item . blockQps ;
81
+ }
82
+ }
73
83
chart . source ( metric . data ) ;
74
84
chart . scale ( 'timestamp' , {
75
85
type : 'time' ,
76
86
mask : 'YYYY-MM-DD HH:mm:ss'
77
87
} ) ;
78
88
chart . scale ( 'passQps' , {
79
89
min : 0 ,
90
+ max : maxQps ,
80
91
fine : true ,
81
92
alias : 'p_qps'
82
93
// max: 10
83
94
} ) ;
84
95
chart . scale ( 'blockQps' , {
85
96
min : 0 ,
97
+ max : maxQps ,
86
98
fine : true ,
87
99
alias : 'b_qps' ,
88
100
} ) ;
@@ -105,7 +117,7 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv
105
117
textAlign : 'center' , // 文本对齐方向,可取值为: start center end
106
118
fill : '#404040' , // 文本的颜色
107
119
fontSize : '11' , // 文本大小
108
- textBaseline : 'top' , // 文本基准线,可取 top middle bottom,默认为middle
120
+ // textBaseline: 'top', // 文本基准线,可取 top middle bottom,默认为middle
109
121
} ,
110
122
autoRotate : false ,
111
123
formatter : function ( text , item , index ) {
@@ -115,9 +127,9 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv
115
127
} ) ;
116
128
chart . legend ( {
117
129
custom : true ,
130
+ position : 'bottom' ,
118
131
allowAllCanceled : true ,
119
132
itemFormatter : function ( val ) {
120
- // console.log('val=', val);
121
133
if ( 'passQps' === val ) {
122
134
return 'p_qps' ;
123
135
}
@@ -129,7 +141,7 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv
129
141
items : [
130
142
{ value : 'passQps' , marker : { symbol : 'hyphen' , stroke : 'green' , radius : 5 , lineWidth : 2 } } ,
131
143
{ value : 'blockQps' , marker : { symbol : 'hyphen' , stroke : 'blue' , radius : 5 , lineWidth : 2 } } ,
132
- // { value: 'rt', marker: {symbol: 'hyphen', stroke: 'gray', radius: 5, lineWidth: 2} },
144
+ //{ value: 'rt', marker: {symbol: 'hyphen', stroke: 'gray', radius: 5, lineWidth: 2} },
133
145
] ,
134
146
onClick : function ( ev ) {
135
147
const item = ev . item ;
@@ -150,7 +162,7 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv
150
162
} ) ;
151
163
chart . line ( ) . position ( 'timestamp*passQps' ) . size ( 1 ) . color ( 'green' ) . shape ( 'smooth' ) ;
152
164
chart . line ( ) . position ( 'timestamp*blockQps' ) . size ( 1 ) . color ( 'blue' ) . shape ( 'smooth' ) ;
153
- // chart.line().position('timestamp*rt').size(1).color('gray');
165
+ //chart.line().position('timestamp*rt').size(1).color('gray').shape('smooth ');
154
166
G2 . track ( false ) ;
155
167
chart . render ( ) ;
156
168
} ) ;
0 commit comments