Tooltip value formatting
native
Format numbers/dates in tooltips
Matrix status native. Verification render · strong. ChartKit option: ChartKitChartSpecV1.encoding.y.format.specifier, ChartKitChartSpecV1.tooltip.template.
A format preset, or {specifier} for .2f, ,.0f, $,.0f, .1%, .2e, +.1f, and s. tooltip.fields[].unit and tooltip.template with {x}, {name}, {value}, {unit}, and data field names. A d3-style string repairs to {specifier}. An unknown pattern is CK3058. A missing template token is CK3059.
Source: chartkit:packages/core/src/format.ts
ChartKit spec
Passed validate() during npm run matrix:refresh. The SVG is the server render.
{
"version": "1",
"type": "line",
"data": [
{
"quarter": "Q1",
"units": 40
},
{
"quarter": "Q2",
"units": 55
}
],
"encoding": {
"x": "quarter",
"y": {
"field": "units",
"format": {
"specifier": ",.0f"
}
}
},
"a11y": {
"alt": "Units rose in Q2."
},
"size": {
"width": 640,
"height": 260
},
"tooltip": {
"template": "{name} {value} {unit}",
"fields": [
{
"field": "units",
"format": {
"specifier": ",.0f"
},
"unit": "u"
}
]
}
}Other libraries
Option names are the paths recorded in the matrix. A grep-only cell names the identifier that matched, not a render test. Markdown copy: tooltip.format.md.
| Library | Status | Option | Verification | Source |
|---|---|---|---|---|
| Chart.js | native | grep: callbackstooltip.callbacks.label | grep · weak | chart.js/dist/types/index.d.ts:2681 |
| Recharts | native | Tooltip.formatter, Tooltip.labelFormatter | types · strong | recharts/types/component/DefaultTooltipContent.d.ts:41 |
| Apache ECharts | native | tooltip.valueFormatter, tooltip.formatter | types · strong | echarts/types/dist/shared.d.ts:8078 |
| Highcharts | native | tooltip.valueDecimals, tooltip.valuePrefix | types · strong | highcharts/highcharts.d.ts:107591 |
| Plotly.js | native | trace.hovertemplate | types · strong | plot-schema.json#traces.{bar,barpolar,box,candlestick,choropleth,choroplethmap,…}.attributes.hovertemplate |
| Nivo | native | Line.yFormat, Line.xFormat | types · strong | @nivo/line/dist/types/types.d.ts:133 |
| Victory | native | VictoryTooltiplabels function | types · strong | victory-tooltip/lib/victory-tooltip.d.ts:66 |
| visx | manual | Grouprender your own content | mechanism · weak | @visx/group/lib/Group.d.ts:15 |
| ApexCharts | native | tooltip.y.formatter | types · strong | apexcharts/types/apexcharts.d.ts:4816 |
| Tremor (npm) | native | LineChart.valueFormatter | types · strong | @tremor/react/dist/index.d.ts:60 |
| Observable Plot | native | grep: formattip format / channels | grep · weak | @observablehq/plot/src/scales.d.ts:349 |
| Vega-Lite | native | grep: format | grep · weak | 84: "description" |
| AG Charts | native | grep: renderer | grep · weak | ag-charts-enterprise/dist/types/src/license/licenseManager.d.ts:2 |
| amCharts 5 | native | grep: labelText | grep · weak | @amcharts/amcharts5/index.d.ts:72 |
| Google Charts | native | grep: formatNumberFormat formatters on DataTable | grep · weak | @types/google.visualization/index.d.ts:162 |
| uPlot | manual | Options.hooks | mechanism · weak | uplot/dist/uPlot.d.ts:394 |
| TradingView Lightweight Charts | none | — | absence · absence | — |
| MUI X Charts | native | grep: valueFormatter | grep · weak | @mui/x-charts/SparkLineChart/SparkLineChart.d.ts:43 |
| Mermaid (chart-ish diagrams only) | none | — | absence · absence | — |
| AntV G2 | native | grep: items | grep · weak | @antv/g2/lib/runtime/transform.d.ts:10 |