(params: TooltipParams[])
| 157 | * Candlestick series show O/H/L/C values with arrow and percentage change. |
| 158 | */ |
| 159 | export function formatTooltipAxis(params: TooltipParams[]): string { |
| 160 | if (params.length === 0) return ''; |
| 161 | |
| 162 | const xText = `x: ${formatNumber(params[0].value[0])}`; |
| 163 | const header = `<div style="margin:0 0 6px 0;font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap;">${escapeHtml( |
| 164 | xText, |
| 165 | )}</div>`; |
| 166 | |
| 167 | const rows = params |
| 168 | .map((p) => { |
| 169 | if (isCandlestickValue(p.value)) { |
| 170 | return formatCandlestickRowHtml(p); |
| 171 | } |
| 172 | return formatRowHtml(p, formatNumber(p.value[1])); |
| 173 | }) |
| 174 | .join('<div style="height:4px;"></div>'); |
| 175 | |
| 176 | return `${header}${rows}`; |
| 177 | } |
| 178 |
no test coverage detected