Graflume · Alpha

Contour · Basic implementation · Common features

Represent a scalar grid with filled levels and deterministic contour lines. 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 · Specialized families

Contour

Represent a scalar grid with filled levels and deterministic contour lines.

Quick API
contour()
Browser snapshot
graflume/complete
mark
contour
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

Represent a scalar grid with filled levels and deterministic contour lines.

StatusLoading

  • minimal-implementation
Graflume.contour() 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.contour()

const data = [
  {
    "value": 19.342,
    "x": 0,
    "y": 0
  },
  {
    "value": 23.692,
    "x": 1,
    "y": 0
  },
  {
    "value": 30.375,
    "x": 2,
    "y": 0
  },
  {
    "value": 35.875,
    "x": 3,
    "y": 0
  },
  {
    "value": 35.843,
    "x": 4,
    "y": 0
  },
  {
    "value": 29.381,
    "x": 5,
    "y": 0
  },
  {
    "value": 19.872,
    "x": 6,
    "y": 0
  },
  {
    "value": 11.62,
    "x": 7,
    "y": 0
  },
  {
    "value": 6.6,
    "x": 8,
    "y": 0
  },
  {
    "value": 4.304,
    "x": 9,
    "y": 0
  },
  {
    "value": 3.445,
    "x": 10,
    "y": 0
  },
  {
    "value": 3.145,
    "x": 11,
    "y": 0
  },
  {
    "value": 26.5,
    "x": 0,
    "y": 1
  },
  {
    "value": 39.914,
    "x": 1,
    "y": 1
  },
  {
    "value": 53.905,
    "x": 2,
    "y": 1
  },
  {
    "value": 62.722,
    "x": 3,
    "y": 1
  },
  {
    "value": 60.939,
    "x": 4,
    "y": 1
  },
  {
    "value": 48.629,
    "x": 5,
    "y": 1
  },
  {
    "value": 32.011,
    "x": 6,
    "y": 1
  },
  {
    "value": 18.177,
    "x": 7,
    "y": 1
  },
  {
    "value": 10.033,
    "x": 8,
    "y": 1
  },
  {
    "value": 6.276,
    "x": 9,
    "y": 1
  },
  {
    "value": 4.575,
    "x": 10,
    "y": 1
  },
  {
    "value": 3.674,
    "x": 11,
    "y": 1
  },
  {
    "value": 23.721,
    "x": 0,
    "y": 2
  },
  {
    "value": 44.273,
    "x": 1,
    "y": 2
  },
  {
    "value": 68.463,
    "x": 2,
    "y": 2
  },
  {
    "value": 85.571,
    "x": 3,
    "y": 2
  },
  {
    "value": 85.778,
    "x": 4,
    "y": 2
  },
  {
    "value": 69.134,
    "x": 5,
    "y": 2
  },
  {
    "value": 45.848,
    "x": 6,
    "y": 2
  },
  {
    "value": 27.125,
    "x": 7,
    "y": 2
  },
  {
    "value": 16.847,
    "x": 8,
    "y": 2
  },
  {
    "value": 11.918,
    "x": 9,
    "y": 2
  },
  {
    "value": 8.491,
    "x": 10,
    "y": 2
  },
  {
    "value": 5.65,
    "x": 11,
    "y": 2
  },
  {
    "value": 20.436,
    "x": 0,
    "y": 3
  },
  {
    "value": 39.635,
    "x": 1,
    "y": 3
  },
  {
    "value": 64.15,
    "x": 2,
    "y": 3
  },
  {
    "value": 84.275,
    "x": 3,
    "y": 3
  },
  {
    "value": 89.407,
    "x": 4,
    "y": 3
  },
  {
    "value": 77.438,
    "x": 5,
    "y": 3
  },
  {
    "value": 57.334,
    "x": 6,
    "y": 3
  },
  {
    "value": 40.924,
    "x": 7,
    "y": 3
  },
  {
    "value": 32.23,
    "x": 8,
    "y": 3
  },
  {
    "value": 26.345,
    "x": 9,
    "y": 3
  },
  {
    "value": 18.692,
    "x": 10,
    "y": 3
  },
  {
    "value": 10.778,
    "x": 11,
    "y": 3
  },
  {
    "value": 16.946,
    "x": 0,
    "y": 4
  },
  {
    "value": 31.996,
    "x": 1,
    "y": 4
  },
  {
    "value": 50.804,
    "x": 2,
    "y": 4
  },
  {
    "value": 65.794,
    "x": 3,
    "y": 4
  },
  {
    "value": 69.629,
    "x": 4,
    "y": 4
  },
  {
    "value": 62.612,
    "x": 5,
    "y": 4
  },
  {
    "value": 53.611,
    "x": 6,
    "y": 4
  },
  {
    "value": 51.41,
    "x": 7,
    "y": 4
  },
  {
    "value": 54.19,
    "x": 8,
    "y": 4
  },
  {
    "value": 51.132,
    "x": 9,
    "y": 4
  },
  {
    "value": 37.392,
    "x": 10,
    "y": 4
  },
  {
    "value": 20.559,
    "x": 11,
    "y": 4
  },
  {
    "value": 12.113,
    "x": 0,
    "y": 5
  },
  {
    "value": 21.902,
    "x": 1,
    "y": 5
  },
  {
    "value": 34.001,
    "x": 2,
    "y": 5
  },
  {
    "value": 43.3,
    "x": 3,
    "y": 5
  },
  {
    "value": 45.061,
    "x": 4,
    "y": 5
  },
  {
    "value": 40.583,
    "x": 5,
    "y": 5
  },
  {
    "value": 38.468,
    "x": 6,
    "y": 5
  },
  {
    "value": 46.908,
    "x": 7,
    "y": 5
  },
  {
    "value": 61.621,
    "x": 8,
    "y": 5
  },
  {
    "value": 66.662,
    "x": 9,
    "y": 5
  },
  {
    "value": 53.82,
    "x": 10,
    "y": 5
  },
  {
    "value": 32.705,
    "x": 11,
    "y": 5
  },
  {
    "value": 7.715,
    "x": 0,
    "y": 6
  },
  {
    "value": 12.779,
    "x": 1,
    "y": 6
  },
  {
    "value": 19.035,
    "x": 2,
    "y": 6
  },
  {
    "value": 23.839,
    "x": 3,
    "y": 6
  },
  {
    "value": 24.834,
    "x": 4,
    "y": 6
  },
  {
    "value": 23.214,
    "x": 5,
    "y": 6
  },
  {
    "value": 24.759,
    "x": 6,
    "y": 6
  },
  {
    "value": 34.859,
    "x": 7,
    "y": 6
  },
  {
    "value": 49.474,
    "x": 8,
    "y": 6
  },
  {
    "value": 55.699,
    "x": 9,
    "y": 6
  },
  {
    "value": 47.461,
    "x": 10,
    "y": 6
  },
  {
    "value": 32.902,
    "x": 11,
    "y": 6
  },
  {
    "value": 4.928,
    "x": 0,
    "y": 7
  },
  {
    "value": 7,
    "x": 1,
    "y": 7
  },
  {
    "value": 9.559,
    "x": 2,
    "y": 7
  },
  {
    "value": 11.538,
    "x": 3,
    "y": 7
  },
  {
    "value": 12.049,
    "x": 4,
    "y": 7
  },
  {
    "value": 11.892,
    "x": 5,
    "y": 7
  },
  {
    "value": 14.112,
    "x": 6,
    "y": 7
  },
  {
    "value": 21.319,
    "x": 7,
    "y": 7
  },
  {
    "value": 30.492,
    "x": 8,
    "y": 7
  },
  {
    "value": 33.608,
    "x": 9,
    "y": 7
  },
  {
    "value": 27.669,
    "x": 10,
    "y": 7
  },
  {
    "value": 19.134,
    "x": 11,
    "y": 7
  }
];

const options = {
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "value": "value"
    }
  },
  "width": "container",
  "x": {
    "field": "x",
    "title": "Horizontal bin",
    "type": "quantitative"
  },
  "y": {
    "field": "y",
    "title": "Vertical bin",
    "type": "quantitative"
  }
};

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

Portable schema

ChartSpec 0.1 · options

{
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "value": "value"
    }
  },
  "width": "container",
  "x": {
    "field": "x",
    "title": "Horizontal bin",
    "type": "quantitative"
  },
  "y": {
    "field": "y",
    "title": "Vertical bin",
    "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.contour() 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.contour()

const data = [
  {
    "value": 19.342,
    "x": 0,
    "y": 0
  },
  {
    "value": 23.692,
    "x": 1,
    "y": 0
  },
  {
    "value": 30.375,
    "x": 2,
    "y": 0
  },
  {
    "value": 35.875,
    "x": 3,
    "y": 0
  },
  {
    "value": 35.843,
    "x": 4,
    "y": 0
  },
  {
    "value": 29.381,
    "x": 5,
    "y": 0
  },
  {
    "value": 19.872,
    "x": 6,
    "y": 0
  },
  {
    "value": 11.62,
    "x": 7,
    "y": 0
  },
  {
    "value": 6.6,
    "x": 8,
    "y": 0
  },
  {
    "value": 4.304,
    "x": 9,
    "y": 0
  },
  {
    "value": 3.445,
    "x": 10,
    "y": 0
  },
  {
    "value": 3.145,
    "x": 11,
    "y": 0
  },
  {
    "value": 26.5,
    "x": 0,
    "y": 1
  },
  {
    "value": 39.914,
    "x": 1,
    "y": 1
  },
  {
    "value": 53.905,
    "x": 2,
    "y": 1
  },
  {
    "value": 62.722,
    "x": 3,
    "y": 1
  },
  {
    "value": 60.939,
    "x": 4,
    "y": 1
  },
  {
    "value": 48.629,
    "x": 5,
    "y": 1
  },
  {
    "value": 32.011,
    "x": 6,
    "y": 1
  },
  {
    "value": 18.177,
    "x": 7,
    "y": 1
  },
  {
    "value": 10.033,
    "x": 8,
    "y": 1
  },
  {
    "value": 6.276,
    "x": 9,
    "y": 1
  },
  {
    "value": 4.575,
    "x": 10,
    "y": 1
  },
  {
    "value": 3.674,
    "x": 11,
    "y": 1
  },
  {
    "value": 23.721,
    "x": 0,
    "y": 2
  },
  {
    "value": 44.273,
    "x": 1,
    "y": 2
  },
  {
    "value": 68.463,
    "x": 2,
    "y": 2
  },
  {
    "value": 85.571,
    "x": 3,
    "y": 2
  },
  {
    "value": 85.778,
    "x": 4,
    "y": 2
  },
  {
    "value": 69.134,
    "x": 5,
    "y": 2
  },
  {
    "value": 45.848,
    "x": 6,
    "y": 2
  },
  {
    "value": 27.125,
    "x": 7,
    "y": 2
  },
  {
    "value": 16.847,
    "x": 8,
    "y": 2
  },
  {
    "value": 11.918,
    "x": 9,
    "y": 2
  },
  {
    "value": 8.491,
    "x": 10,
    "y": 2
  },
  {
    "value": 5.65,
    "x": 11,
    "y": 2
  },
  {
    "value": 20.436,
    "x": 0,
    "y": 3
  },
  {
    "value": 39.635,
    "x": 1,
    "y": 3
  },
  {
    "value": 64.15,
    "x": 2,
    "y": 3
  },
  {
    "value": 84.275,
    "x": 3,
    "y": 3
  },
  {
    "value": 89.407,
    "x": 4,
    "y": 3
  },
  {
    "value": 77.438,
    "x": 5,
    "y": 3
  },
  {
    "value": 57.334,
    "x": 6,
    "y": 3
  },
  {
    "value": 40.924,
    "x": 7,
    "y": 3
  },
  {
    "value": 32.23,
    "x": 8,
    "y": 3
  },
  {
    "value": 26.345,
    "x": 9,
    "y": 3
  },
  {
    "value": 18.692,
    "x": 10,
    "y": 3
  },
  {
    "value": 10.778,
    "x": 11,
    "y": 3
  },
  {
    "value": 16.946,
    "x": 0,
    "y": 4
  },
  {
    "value": 31.996,
    "x": 1,
    "y": 4
  },
  {
    "value": 50.804,
    "x": 2,
    "y": 4
  },
  {
    "value": 65.794,
    "x": 3,
    "y": 4
  },
  {
    "value": 69.629,
    "x": 4,
    "y": 4
  },
  {
    "value": 62.612,
    "x": 5,
    "y": 4
  },
  {
    "value": 53.611,
    "x": 6,
    "y": 4
  },
  {
    "value": 51.41,
    "x": 7,
    "y": 4
  },
  {
    "value": 54.19,
    "x": 8,
    "y": 4
  },
  {
    "value": 51.132,
    "x": 9,
    "y": 4
  },
  {
    "value": 37.392,
    "x": 10,
    "y": 4
  },
  {
    "value": 20.559,
    "x": 11,
    "y": 4
  },
  {
    "value": 12.113,
    "x": 0,
    "y": 5
  },
  {
    "value": 21.902,
    "x": 1,
    "y": 5
  },
  {
    "value": 34.001,
    "x": 2,
    "y": 5
  },
  {
    "value": 43.3,
    "x": 3,
    "y": 5
  },
  {
    "value": 45.061,
    "x": 4,
    "y": 5
  },
  {
    "value": 40.583,
    "x": 5,
    "y": 5
  },
  {
    "value": 38.468,
    "x": 6,
    "y": 5
  },
  {
    "value": 46.908,
    "x": 7,
    "y": 5
  },
  {
    "value": 61.621,
    "x": 8,
    "y": 5
  },
  {
    "value": 66.662,
    "x": 9,
    "y": 5
  },
  {
    "value": 53.82,
    "x": 10,
    "y": 5
  },
  {
    "value": 32.705,
    "x": 11,
    "y": 5
  },
  {
    "value": 7.715,
    "x": 0,
    "y": 6
  },
  {
    "value": 12.779,
    "x": 1,
    "y": 6
  },
  {
    "value": 19.035,
    "x": 2,
    "y": 6
  },
  {
    "value": 23.839,
    "x": 3,
    "y": 6
  },
  {
    "value": 24.834,
    "x": 4,
    "y": 6
  },
  {
    "value": 23.214,
    "x": 5,
    "y": 6
  },
  {
    "value": 24.759,
    "x": 6,
    "y": 6
  },
  {
    "value": 34.859,
    "x": 7,
    "y": 6
  },
  {
    "value": 49.474,
    "x": 8,
    "y": 6
  },
  {
    "value": 55.699,
    "x": 9,
    "y": 6
  },
  {
    "value": 47.461,
    "x": 10,
    "y": 6
  },
  {
    "value": 32.902,
    "x": 11,
    "y": 6
  },
  {
    "value": 4.928,
    "x": 0,
    "y": 7
  },
  {
    "value": 7,
    "x": 1,
    "y": 7
  },
  {
    "value": 9.559,
    "x": 2,
    "y": 7
  },
  {
    "value": 11.538,
    "x": 3,
    "y": 7
  },
  {
    "value": 12.049,
    "x": 4,
    "y": 7
  },
  {
    "value": 11.892,
    "x": 5,
    "y": 7
  },
  {
    "value": 14.112,
    "x": 6,
    "y": 7
  },
  {
    "value": 21.319,
    "x": 7,
    "y": 7
  },
  {
    "value": 30.492,
    "x": 8,
    "y": 7
  },
  {
    "value": 33.608,
    "x": 9,
    "y": 7
  },
  {
    "value": 27.669,
    "x": 10,
    "y": 7
  },
  {
    "value": 19.134,
    "x": 11,
    "y": 7
  }
];

const options = {
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "value": "value"
    }
  },
  "title": {
    "subtitle": "Contour chart uses runnable data and options to demonstrate deterministic regular-grid marching-squares isolines; explicit, linear and Type-7 quantile thresholds.",
    "text": "Contour"
  },
  "width": "container",
  "x": {
    "field": "x",
    "title": "Horizontal bin",
    "type": "quantitative"
  },
  "y": {
    "field": "y",
    "title": "Vertical bin",
    "type": "quantitative"
  }
};

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

Portable schema

ChartSpec 0.1 · options

{
  "height": 620,
  "locale": "en",
  "mark": {
    "fields": {
      "value": "value"
    }
  },
  "title": {
    "subtitle": "Contour chart uses runnable data and options to demonstrate deterministic regular-grid marching-squares isolines; explicit, linear and Type-7 quantile thresholds.",
    "text": "Contour"
  },
  "width": "container",
  "x": {
    "field": "x",
    "title": "Horizontal bin",
    "type": "quantitative"
  },
  "y": {
    "field": "y",
    "title": "Vertical bin",
    "type": "quantitative"
  }
}