Graflume · Alpha

Ternary · Basic implementation · Common features

Compare the relative shares of three non-negative components inside triangular coordinates. Start with only the required data and family encoding. Expand the code to run the same example. Use the tabs to compare header, tooltip, theme, legend, highlight, callout, selection, view controls, and accessibility one feature at a time.

Chart family · Advanced families

Ternary

Compare the relative shares of three non-negative components inside triangular coordinates.

Quick API
ternary()
Browser snapshot
graflume/complete
mark
ternary
Presets
1

Basic implementation

The smallest runnable chart

Start with only the required data and family encoding. Expand the code to run the same example.

Basic example

Compare the relative shares of three non-negative components inside triangular coordinates.

StatusLoading

  • minimal-implementation
Graflume.ternary() Canvas 2D
Control help

Zoom and pan inspect the rendered surface without changing data axes or values. When playback controls are available, they move through real steps in the order each unique value first appears in the source data.

Use Tab to reach a control and Enter or Space to activate it. With the chart focused, use plus and minus to zoom and arrow keys to pan.

Auto placement compares perimeter candidates and avoids the plot, legend, and other callouts when possible. Explicit placement is preserved with only necessary safety correction. Callout text wraps safely inside the bubble. Long unbroken tokens are visually shortened within the line budget, while the complete source text remains available to assistive technology.

Loading

Browser API · Portable schema

Browser API

Graflume.ternary()

const data = [
  {
    "a": 70,
    "b": 18,
    "c": 12,
    "series": "Balanced blend"
  },
  {
    "a": 65.5,
    "b": 25.53,
    "c": 8.97,
    "series": "Balanced blend"
  },
  {
    "a": 61,
    "b": 30.12,
    "c": 8.88,
    "series": "Balanced blend"
  },
  {
    "a": 56.5,
    "b": 30.28,
    "c": 13.22,
    "series": "Balanced blend"
  },
  {
    "a": 52,
    "b": 26.73,
    "c": 21.27,
    "series": "Balanced blend"
  },
  {
    "a": 47.5,
    "b": 22.02,
    "c": 30.48,
    "series": "Balanced blend"
  },
  {
    "a": 43,
    "b": 19.28,
    "c": 37.72,
    "series": "Balanced blend"
  },
  {
    "a": 38.5,
    "b": 20.68,
    "c": 40.82,
    "series": "Balanced blend"
  },
  {
    "a": 34,
    "b": 26.3,
    "c": 39.7,
    "series": "Balanced blend"
  },
  {
    "a": 29.5,
    "b": 34.16,
    "c": 36.34,
    "series": "Balanced blend"
  },
  {
    "a": 25,
    "b": 41.14,
    "c": 33.86,
    "series": "Balanced blend"
  },
  {
    "a": 20.5,
    "b": 44.58,
    "c": 34.92,
    "series": "Balanced blend"
  }
];

const options = {
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "c": "c",
      "series": "series"
    },
    "options": {
      "mode": "line"
    }
  },
  "width": "container",
  "x": {
    "field": "a",
    "title": "Component A (%)",
    "type": "quantitative"
  },
  "y": {
    "field": "b",
    "title": "Component B (%)",
    "type": "quantitative"
  }
};

Graflume.ternary('#chart', data, options);

Portable schema

ChartSpec 0.1 · options

{
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "c": "c",
      "series": "series"
    },
    "options": {
      "mode": "line"
    }
  },
  "width": "container",
  "x": {
    "field": "a",
    "title": "Component A (%)",
    "type": "quantitative"
  },
  "y": {
    "field": "b",
    "title": "Component B (%)",
    "type": "quantitative"
  }
}

Common features

Features shared by every chart

Use the tabs to compare header, tooltip, theme, legend, highlight, callout, selection, view controls, and accessibility one feature at a time. Hover over a data mark. On supported charts, move the pointer along the axis to see the nearest value. All exact values are available in the table below.

Header

Add a chart title and supporting description inside the visualization.

StatusLoading

  • header
Graflume.ternary() Canvas 2D
Control help

Zoom and pan inspect the rendered surface without changing data axes or values. When playback controls are available, they move through real steps in the order each unique value first appears in the source data.

Use Tab to reach a control and Enter or Space to activate it. With the chart focused, use plus and minus to zoom and arrow keys to pan.

Auto placement compares perimeter candidates and avoids the plot, legend, and other callouts when possible. Explicit placement is preserved with only necessary safety correction. Callout text wraps safely inside the bubble. Long unbroken tokens are visually shortened within the line budget, while the complete source text remains available to assistive technology.

Loading

Browser API · Portable schema

Browser API

Graflume.ternary()

const data = [
  {
    "a": 70,
    "b": 18,
    "c": 12,
    "series": "Balanced blend"
  },
  {
    "a": 65.5,
    "b": 25.53,
    "c": 8.97,
    "series": "Balanced blend"
  },
  {
    "a": 61,
    "b": 30.12,
    "c": 8.88,
    "series": "Balanced blend"
  },
  {
    "a": 56.5,
    "b": 30.28,
    "c": 13.22,
    "series": "Balanced blend"
  },
  {
    "a": 52,
    "b": 26.73,
    "c": 21.27,
    "series": "Balanced blend"
  },
  {
    "a": 47.5,
    "b": 22.02,
    "c": 30.48,
    "series": "Balanced blend"
  },
  {
    "a": 43,
    "b": 19.28,
    "c": 37.72,
    "series": "Balanced blend"
  },
  {
    "a": 38.5,
    "b": 20.68,
    "c": 40.82,
    "series": "Balanced blend"
  },
  {
    "a": 34,
    "b": 26.3,
    "c": 39.7,
    "series": "Balanced blend"
  },
  {
    "a": 29.5,
    "b": 34.16,
    "c": 36.34,
    "series": "Balanced blend"
  },
  {
    "a": 25,
    "b": 41.14,
    "c": 33.86,
    "series": "Balanced blend"
  },
  {
    "a": 20.5,
    "b": 44.58,
    "c": 34.92,
    "series": "Balanced blend"
  }
];

const options = {
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "c": "c",
      "series": "series"
    },
    "options": {
      "mode": "line"
    }
  },
  "title": {
    "subtitle": "Ternary chart uses runnable data and options to demonstrate nonnegative component normalization; barycentric mapping.",
    "text": "Ternary"
  },
  "width": "container",
  "x": {
    "field": "a",
    "title": "Component A (%)",
    "type": "quantitative"
  },
  "y": {
    "field": "b",
    "title": "Component B (%)",
    "type": "quantitative"
  }
};

Graflume.ternary('#chart', data, options);

Portable schema

ChartSpec 0.1 · options

{
  "axes": {
    "x": false,
    "y": false
  },
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "c": "c",
      "series": "series"
    },
    "options": {
      "mode": "line"
    }
  },
  "title": {
    "subtitle": "Ternary chart uses runnable data and options to demonstrate nonnegative component normalization; barycentric mapping.",
    "text": "Ternary"
  },
  "width": "container",
  "x": {
    "field": "a",
    "title": "Component A (%)",
    "type": "quantitative"
  },
  "y": {
    "field": "b",
    "title": "Component B (%)",
    "type": "quantitative"
  }
}