Features · mark

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.

Units rose in Q2.Units rose in Q2.unitsaccent40455055Q1Q2
{
  "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.

LibraryStatusOptionVerificationSource
Chart.jspartialgrep: Scriptablescriptable optionsgrep · weakchart.js/dist/types/index.d.ts:23
RechartspartialCelltypes · strongrecharts/types/component/Cell.d.ts:25
Apache EChartsnativevisualMappiecewise visualMaptypes · strongecharts/types/dist/shared.d.ts:12590
HighchartsnativeplotOptions.series.zones, plotOptions.series.negativeColortypes · stronghighcharts/options/series.d.ts:1393
Plotly.jspartialtrace.marker.colorscaletypes · strongplot-schema.json#traces.{bar,barpolar,funnel,histogram,icicle,quiver,…}.attributes.marker.colorscale
NivopartialBar.colorsfunctiontypes · strong@nivo/bar/dist/types/types.d.ts:170
VictorypartialVictoryBar.styletypes · strongvictory-bar/lib/victory-bar.d.ts:15
visxpartialBar.filltypes · strong@types/react/index.d.ts:3798
ApexChartsnativeplotOptions.bar.colors.rangestypes · strongapexcharts/types/apexcharts.d.ts:3126
Tremor (npm)none—absence · absence—
Observable Plotpartialgrep: fillgrep · weak@observablehq/plot/src/symbol.d.ts:5
Vega-Litenativegrep: conditionconditional encodinggrep · weak1203: "$ref"
AG Chartspartialgrep: itemStylergrep · weakag-charts-types/dist/types/src/presets/quadrant/quadrantOptions.d.ts:8
amCharts 5nativegrep: heatRulesgrep · weak@amcharts/amcharts5/.internal/plugins/json/Serializer.d.ts:58
Google Chartspartialgrep: stylegrep · weak@types/google.visualization/index.d.ts:403
uPlotpartialgrep: fillgrep · weak303: export type Fill = CSSStyleDeclaration['background'] | ((self
TradingView Lightweight ChartsnativeBaselineSeriesbaseline series colours above/belowtypes · stronglightweight-charts/dist/typings.d.ts:7
MUI X Chartsnativegrep: colorMapgrep · weak@mui/x-charts/ChartsYAxis/useAxisTicksProps.d.ts:36
Mermaid (chart-ish diagrams only)none—absence · absence—
AntV G2partialgrep: colorgrep · weak@antv/g2/lib/index.d.ts:43