import { formatAbsNum } from './other'; const formatDate = (value: string) => { if ((value || '').indexOf('~') > -1) { value = value.split('~')[1]; } return value; }; const Base_tooltip_num = { zIndex: 100, shared: true, crosshairs: true, backgroundColor: null, borderWidth: 0, borderColor: 'rgba(31,41,71,.75)', borderRadius: 8, shadow: true, useHTML: true, formatter: function () { let s = '
' + ''; (this.points || []).forEach((item, ind) => { if (item.series.userOptions.hiddenTooltip) { return; } let domStr = '' + (ind === 0 ? '' + (ind === 0 ? ''; domStr += ''; s += domStr; }); s += '
时间' + formatDate(this.x) + '
' : '') + item.series.name + '' : '') + item.y.toLocaleString() + '
'; return s; }, style: { color: '#666', fontSize: '12px', }, }; // 百分比 const Base_tooltip_Pre = { zIndex: 100, shared: true, crosshairs: true, backgroundColor: null, borderWidth: 0, borderColor: '#1F2947', borderRadius: 8, shadow: true, useHTML: true, valueDecimals: 2, valueSuffix: '%', formatter: function () { let s = '
' + ''; (this.points || []).forEach((item, ind) => { if (item.series.userOptions.hiddenTooltip) { return; } let domStr = '' + (ind === 0 ? '' + (ind === 0 ? ''; domStr += ''; s += domStr; }); s += '
时间' + formatDate(this.x) + '
' : '') + item.series.name + '' : '') + formatAbsNum(item.y).toLocaleString() + '%
'; return s; }, style: { color: '#666666', fontSize: '12px', }, }; const Base_tooltip_BoxPlot = { zIndex: 100, shared: false, crosshairs: true, backgroundColor: null, borderWidth: 0, borderColor: '#1F2947', borderRadius: 8, shadow: true, useHTML: true, style: { color: '#fff', fontSize: '14px', }, formatter: function () { const { point, x } = this; let s: string = '
' + ''; let domStr = '' + ''; domStr += ''; s += domStr; } else if (point.series.userOptions.info) { const info = point.series.userOptions.info; s += formatDate(info.x); s += ''; let domStr = '' + ''; domStr += ''; s += domStr; } s += '
时间'; if ('hightrue' in point) { s += formatDate(x); s += '
' + point.series.name + '' + '最大值:' + point.hightrue.toLocaleString() + '
' + 'Q3:' + point.q3.toLocaleString() + '
' + '中位数:' + point.median.toLocaleString() + '
' + 'Q1:' + point.q1.toLocaleString() + '
' + '最小值:' + point.low.toLocaleString() + '
' + '
' + point.series.name + '' + '最大值:' + info.hightrue.toLocaleString() + '
' + 'Q3\t:' + info.q3.toLocaleString() + '
' + '中位数:' + info.median.toLocaleString() + '
' + 'Q1\t:' + info.q1.toLocaleString() + '
' + '最小值:' + info.low.toLocaleString() + '
' + '
'; return s; }, }; const Base_tooltip_Bubble = { zIndex: 100, shared: true, crosshairs: true, backgroundColor: null, borderWidth: 0, borderColor: '#1F2947', borderRadius: 8, shadow: true, useHTML: true, style: { color: '#fff', fontSize: '12px', }, formatter: function () { let s = '
' + '' + ''; let domStr = ''; domStr += ''; s += domStr; s += '
' + this.point.name + '' + this.point.z.toLocaleString() + '
'; return s; }, }; // 环比 const Base_tooltip_Chain = { zIndex: 100, shared: true, crosshairs: true, backgroundColor: null, borderWidth: 0, borderColor: 'rgba(31,41,71,.75)', borderRadius: 8, shadow: true, useHTML: true, formatter: function () { let s = '
' + ''; (this.points || []).forEach((item, ind) => { if (item.series.userOptions.hiddenTooltip) { return; } let domStr = '' + (ind === 0 ? '' + (ind === 0 ? '' + (ind === 0 ? '' + (ind === 0 ? ''; domStr += ''; s += domStr; }); s += '
时间' + formatDate(this.x) + '
' : '') + item.series.name + '' : '') + item.y.toLocaleString() + ',' + '' : '') + '环比 ' + '' : '') + (('r' in item.point && item.point.r !== null) ? (item.point.r.toFixed(2) + '%') : '--') + '
'; return s; }, style: { color: '#666', fontSize: '12px', }, }; // 环比 去% 改文案 const Base_tooltip_Chain_noper = { zIndex: 100, shared: true, crosshairs: true, backgroundColor: null, borderWidth: 0, borderColor: 'rgba(31,41,71,.75)', borderRadius: 8, shadow: true, useHTML: true, formatter: function () { let s = '
' + ''; (this.points || []).forEach((item, ind) => { if (item.series.userOptions.hiddenTooltip) { return; } let domStr = '' + (ind === 0 ? '' + (ind === 0 ? '' + (ind === 0 ? '' + (ind === 0 ? ''; domStr += ''; s += domStr; }); s += '
时间' + formatDate(this.x) + '
' : '') + item.series.name + '' : '') + item.y.toLocaleString() + ',' + '' : '') + '差值变化 ' + '' : '') + (('r' in item.point && item.point.r !== null) ? item.point.r : '--') + '
'; return s; }, style: { color: '#666', fontSize: '12px', }, }; // 百分比 环比 const Base_tooltip_Pre_Chain = { zIndex: 100, shared: true, crosshairs: true, backgroundColor: null, borderWidth: 0, borderColor: '#1F2947', borderRadius: 8, shadow: true, useHTML: true, valueDecimals: 2, valueSuffix: '%', formatter: function () { let s = '
' + ''; (this.points || []).forEach((item, ind) => { if (item.series.userOptions.hiddenTooltip) { return; } console.log('mmmm', item); let domStr = '' + (ind === 0 ? '' + (ind === 0 ? '' + '' + (ind === 0 ? '' + (ind === 0 ? '';; domStr += ''; s += domStr; }); s += '
时间' + formatDate(this.x) + '
' : '') + item.series.name + '' : '') + formatAbsNum(item.y).toLocaleString() + '%,' : '') + '环比 ' + '' : '') + (item.point.r !== null ? (Number(item.point.r.toFixed(2)) + '%') : '--') + '
'; return s; }, style: { color: '#666666', fontSize: '12px', }, }; // 百分比 差值变化 const Base_tooltip_Pre_Chain_chazhi = { zIndex: 100, shared: true, crosshairs: true, backgroundColor: null, borderWidth: 0, borderColor: '#1F2947', borderRadius: 8, shadow: true, useHTML: true, valueDecimals: 2, valueSuffix: '%', formatter: function () { let s = '
' + ''; (this.points || []).forEach((item, ind) => { if (item.series.userOptions.hiddenTooltip) { return; } console.log('mmmm', item); let domStr = '' + (ind === 0 ? '' + (ind === 0 ? '' + '' + (ind === 0 ? '' + (ind === 0 ? '';; domStr += ''; s += domStr; }); s += '
时间' + formatDate(this.x) + '
' : '') + item.series.name + '' : '') + formatAbsNum(item.y).toLocaleString() + '%,' : '') + '差值变化 ' + '' : '') + (item.point.r !== null ? (Number(item.point.r.toFixed(2)) + '%') : '--') + '
'; return s; }, style: { color: '#666666', fontSize: '12px', }, }; export { Base_tooltip_num, Base_tooltip_Pre, Base_tooltip_BoxPlot, Base_tooltip_Bubble, Base_tooltip_Chain,Base_tooltip_Chain_noper, Base_tooltip_Pre_Chain,Base_tooltip_Pre_Chain_chazhi };