Conditional / threshold colouring
native
Colour by value threshold (negative red, above target green)
Matrix status native. Verification runtime · strong. ChartKit option: ChartKitChartSpecV1.mark.colorRules.
mark.colorRules recolours bar, line points, scatter, and pie. First match wins. Tokens negative, positive, and accent follow the theme. Probed by rendering.
Source: packages/core/src/generated/schema.ts:975
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": "units"
},
"a11y": {
"alt": "Units rose in Q2."
},
"size": {
"width": 640,
"height": 260
},
"mark": {
"colorRules": [
{
"color": "accent",
"gt": 0
}
]
}
}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: mark.color.conditional.md.
| Library | Status | Option | Verification | Source |
|---|---|---|---|---|
| Chart.js | partial | grep: Scriptablescriptable options | grep · weak | chart.js/dist/types/index.d.ts:23 |
| Recharts | partial | Cell | types · strong | recharts/types/component/Cell.d.ts:25 |
| Apache ECharts | native | visualMappiecewise visualMap | types · strong | echarts/types/dist/shared.d.ts:12590 |
| Highcharts | native | plotOptions.series.zones, plotOptions.series.negativeColor | types · strong | highcharts/options/series.d.ts:1393 |
| Plotly.js | partial | trace.marker.colorscale | types · strong | plot-schema.json#traces.{bar,barpolar,funnel,histogram,icicle,quiver,…}.attributes.marker.colorscale |
| Nivo | partial | Bar.colorsfunction | types · strong | @nivo/bar/dist/types/types.d.ts:170 |
| Victory | partial | VictoryBar.style | types · strong | victory-bar/lib/victory-bar.d.ts:15 |
| visx | partial | Bar.fill | types · strong | @types/react/index.d.ts:3798 |
| ApexCharts | native | plotOptions.bar.colors.ranges | types · strong | apexcharts/types/apexcharts.d.ts:3126 |
| Tremor (npm) | none | — | absence · absence | — |
| Observable Plot | partial | grep: fill | grep · weak | @observablehq/plot/src/symbol.d.ts:5 |
| Vega-Lite | native | grep: conditionconditional encoding | grep · weak | 1203: "$ref" |
| AG Charts | partial | grep: itemStyler | grep · weak | ag-charts-types/dist/types/src/presets/quadrant/quadrantOptions.d.ts:8 |
| amCharts 5 | native | grep: heatRules | grep · weak | @amcharts/amcharts5/.internal/plugins/json/Serializer.d.ts:58 |
| Google Charts | partial | grep: style | grep · weak | @types/google.visualization/index.d.ts:403 |
| uPlot | partial | grep: fill | grep · weak | 303: export type Fill = CSSStyleDeclaration['background'] | ((self |
| TradingView Lightweight Charts | native | BaselineSeriesbaseline series colours above/below | types · strong | lightweight-charts/dist/typings.d.ts:7 |
| MUI X Charts | native | grep: colorMap | grep · weak | @mui/x-charts/ChartsYAxis/useAxisTicksProps.d.ts:36 |
| Mermaid (chart-ish diagrams only) | none | — | absence · absence | — |
| AntV G2 | partial | grep: color | grep · weak | @antv/g2/lib/index.d.ts:43 |