@@ -85,7 +85,7 @@ function optionOf(
8585 xAxisData : string [ ] ,
8686 subtext : string ,
8787 timeFormat : timer . app . TimeFormat ,
88- [ focusData , totalData , timeData ] : number [ ] [ ]
88+ [ focusData , timeData ] : [ number [ ] , number [ ] ]
8989) {
9090 const textColor = getPrimaryTextColor ( )
9191 const secondaryTextColor = getSecondaryTextColor ( )
@@ -139,14 +139,6 @@ function optionOf(
139139 textStyle : { color : textColor } ,
140140 } ] ,
141141 series : [ {
142- // run time
143- name : t ( msg => msg . item . total ) ,
144- data : totalData ,
145- yAxisIndex : 0 ,
146- type : 'line' ,
147- smooth : true ,
148- tooltip : { formatter : ( params : any ) => formatTimeOfEchart ( params , timeFormat ) }
149- } , {
150142 name : t ( msg => msg . item . focus ) ,
151143 data : focusData ,
152144 yAxisIndex : 0 ,
@@ -208,23 +200,21 @@ async function processSubtitle(host: timer.app.trend.HostInfo) {
208200 return subtitle
209201}
210202
211- function processDataItems ( allDates : string [ ] , timeFormat : timer . app . TimeFormat , rows : timer . stat . Row [ ] ) : number [ ] [ ] {
203+ function processDataItems ( allDates : string [ ] , timeFormat : timer . app . TimeFormat , rows : timer . stat . Row [ ] ) : [ number [ ] , number [ ] ] {
212204 timeFormat = timeFormat || 'default'
213205 const millConverter = MILL_CONVERTERS [ timeFormat ]
214206 const focusData : number [ ] = [ ]
215- const totalData : number [ ] = [ ]
216207 const timeData : number [ ] = [ ]
217208
218- const dateInfoMap = { }
209+ const dateInfoMap : Record < string , timer . stat . Row > = { }
219210 rows . forEach ( row => dateInfoMap [ row . date ] = row )
220211
221212 allDates . forEach ( date => {
222- const row = dateInfoMap [ date ] || { }
223- focusData . push ( millConverter ( row . focus || 0 ) )
224- totalData . push ( millConverter ( row . total || 0 ) )
225- timeData . push ( row . time || 0 )
213+ const row = dateInfoMap [ date ]
214+ focusData . push ( millConverter ( row ?. focus || 0 ) )
215+ timeData . push ( row ?. time || 0 )
226216 } )
227- return [ focusData , totalData , timeData ]
217+ return [ focusData , timeData ]
228218}
229219
230220class ChartWrapper {
0 commit comments