const formatter = function(this: any) { const userOpt = this.points[0].series.userOptions; return `
${ userOpt.tipHead ? userOpt.tipHead(this) : `` } ${ userOpt.tipBody ? userOpt.tipBody(this) : this.points.map((val: any) => ( ` ` )).join('') }
${userOpt.th || '时间'}${this.x}
${val.series.name} ${val.y}${val.series.userOptions.after || ''}
`; } // 自定义tip需要带自己的信息 const formatter2 = function(this: any) { const { userOptions } = this.points[0].series; const isFunc = typeof userOptions.tipFormatter === 'function'; return `
${userOptions.th || '时间'} ${this.x}
${(isFunc ? userOptions.tipFormatter(this) : userOptions.tipFormatter) || ''}
${ this.points.map((val: any) => ( `${val.series.name} ${val.y}${val.series.userOptions.after || ''}` )).join('') }
`; } export { formatter, formatter2 };