Skip to content
OpenChart

How to chart a range of values

An average hides how far values spread. A range plot shows each month's low and high instead, and the post says when error bars or a histogram fit better.

JanFebMarAprMayJunJulAugSepOctNovDec051015202530Temperature (°C)Daily swings ranged from 5.6°C in December to 10.1°C in MayAverage daily low and high temperature by month, Central Park, 2023 (°C)JanFebMarAprMayJunJulAugSepOctNovDec051015202530Temperature (°C)Daily swings ranged from 5.6°C in December to 10.1°C in MayAverage daily low and high temperature by month, Central Park, 2023 (°C)
Central Park monthly temperature range, 2023. Source: NOAA GHCN Daily, Central Park (USW00094728).

Made with OpenChart. How to build this range chart

Collapsing a daily low and high into one average drops how wide temperatures swing over a day. In Central Park’s 2023 NOAA GHCN Daily observations, May averaged a midpoint of 17.1°C and October averaged 15.9°C, just over a degree apart.

Those midpoints hide a wide shift in daily temperature swings across the seasons. May carried the largest average daily swing of the year at 10.1°C, followed by April at 9.6°C, while December held within 5.6°C between its average low and high.

JanFebMarAprMayJunJulAugSepOctNovDec0510152025Temperature (°C)Monthly midpoints ran from 5.0°C in February to 26.1°C in JulyMidpoint of average daily low and high temperature by month, Central Park, 2023 (°C)JanFebMarAprMayJunJulAugSepOctNovDec0510152025Temperature (°C)Monthly midpoints ran from 5.0°C in February to 26.1°C in JulyMidpoint of average daily low and high temperature by month, Central Park, 2023 (°C)
Central Park monthly midpoint temperature, 2023. Source: NOAA GHCN Daily, Central Park (USW00094728).

Made with OpenChart. How to build this column chart

{
  "mark": {
    "type": "bar",
    "fill": "#0e7490"
  },
  "data": [
    {
      "month": "Jan",
      "midpoint": 6.4
    },
    {
      "month": "Feb",
      "midpoint": 5
    },
    {
      "month": "Mar",
      "midpoint": 7
    },
    {
      "month": "Apr",
      "midpoint": 14.2
    },
    {
      "month": "May",
      "midpoint": 17.1
    },
    {
      "month": "Jun",
      "midpoint": 21.1
    },
    {
      "month": "Jul",
      "midpoint": 26.1
    },
    {
      "month": "Aug",
      "midpoint": 23.9
    },
    {
      "month": "Sep",
      "midpoint": 20.8
    },
    {
      "month": "Oct",
      "midpoint": 15.9
    },
    {
      "month": "Nov",
      "midpoint": 8.2
    },
    {
      "month": "Dec",
      "midpoint": 7
    }
  ],
  "encoding": {
    "x": {
      "field": "month",
      "type": "nominal"
    },
    "y": {
      "field": "midpoint",
      "type": "quantitative",
      "axis": {
        "title": "Temperature (°C)"
      }
    }
  },
  "labels": false,
  "chrome": {
    "title": "Monthly midpoints ran from 5.0°C in February to 26.1°C in July",
    "subtitle": "Midpoint of average daily low and high temperature by month, Central Park, 2023 (°C)"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    }
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "bar",
    "fill": "#0e7490"
  },
  "encoding": {
    "x": {
      "field": "month",
      "type": "nominal"
    },
    "y": {
      "field": "midpoint",
      "type": "quantitative",
      "axis": {
        "title": "Temperature (°C)"
      }
    }
  },
  "labels": false,
  "chrome": {
    "title": "Monthly midpoints ran from 5.0°C in February to 26.1°C in July",
    "subtitle": "Midpoint of average daily low and high temperature by month, Central Park, 2023 (°C)"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    }
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "bar",
    "fill": "#0e7490"
  },
  "encoding": {
    "x": {
      "field": "month",
      "type": "nominal"
    },
    "y": {
      "field": "midpoint",
      "type": "quantitative",
      "axis": {
        "title": "Temperature (°C)"
      }
    }
  },
  "labels": false,
  "chrome": {
    "title": "Monthly midpoints ran from 5.0°C in February to 26.1°C in July",
    "subtitle": "Midpoint of average daily low and high temperature by month, Central Park, 2023 (°C)"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    }
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "bar",
    "fill": "#0e7490"
  },
  "encoding": {
    "x": {
      "field": "month",
      "type": "nominal"
    },
    "y": {
      "field": "midpoint",
      "type": "quantitative",
      "axis": {
        "title": "Temperature (°C)"
      }
    }
  },
  "labels": false,
  "chrome": {
    "title": "Monthly midpoints ran from 5.0°C in February to 26.1°C in July",
    "subtitle": "Midpoint of average daily low and high temperature by month, Central Park, 2023 (°C)"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    }
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "bar",
    "fill": "#0e7490"
  },
  "encoding": {
    "x": {
      "field": "month",
      "type": "nominal"
    },
    "y": {
      "field": "midpoint",
      "type": "quantitative",
      "axis": {
        "title": "Temperature (°C)"
      }
    }
  },
  "labels": false,
  "chrome": {
    "title": "Monthly midpoints ran from 5.0°C in February to 26.1°C in July",
    "subtitle": "Midpoint of average daily low and high temperature by month, Central Park, 2023 (°C)"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    }
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

A column chart of monthly midpoints traces the seasonal curve from February to July while hiding every day’s spread. March and December share the exact same 7.0°C midpoint, so their bars stand at identical heights even though March swings two degrees wider between morning and afternoon than December does.

Plotting average lows and average highs as two separate lines or paired columns puts both endpoints on the page, at the cost of extra visual work. To gauge how wide a month’s swing runs, a reader has to measure the empty gap between two marks and compare that white space from one month to the next.

Range plots

A vertical range plot draws one floating bar per month from the average daily low to the average daily high. Vertical position still tracks the seasonal climb into summer and drop into winter, while bar height encodes the daily spread directly as a solid span.

JanFebMarAprMayJunJulAugSepOctNovDec051015202530Temperature (°C)Daily swings ranged from 5.6°C in December to 10.1°C in MayAverage daily low and high temperature by month, Central Park, 2023 (°C)JanFebMarAprMayJunJulAugSepOctNovDec051015202530Temperature (°C)Daily swings ranged from 5.6°C in December to 10.1°C in MayAverage daily low and high temperature by month, Central Park, 2023 (°C)
Live example. Source: NOAA GHCN Daily, Central Park (USW00094728).

Made with OpenChart. How to build this range chart

{
  "mark": {
    "type": "range",
    "style": "bar",
    "fill": "#0e7490"
  },
  "data": [
    {
      "month": "Jan",
      "low": 3.5,
      "high": 9.3
    },
    {
      "month": "Feb",
      "low": 0.9,
      "high": 9.2
    },
    {
      "month": "Mar",
      "low": 3.2,
      "high": 10.8
    },
    {
      "month": "Apr",
      "low": 9.4,
      "high": 19
    },
    {
      "month": "May",
      "low": 12,
      "high": 22.1
    },
    {
      "month": "Jun",
      "low": 16.8,
      "high": 25.4
    },
    {
      "month": "Jul",
      "low": 22.1,
      "high": 30.2
    },
    {
      "month": "Aug",
      "low": 20.2,
      "high": 27.6
    },
    {
      "month": "Sep",
      "low": 17.3,
      "high": 24.3
    },
    {
      "month": "Oct",
      "low": 12.4,
      "high": 19.3
    },
    {
      "month": "Nov",
      "low": 4.5,
      "high": 11.8
    },
    {
      "month": "Dec",
      "low": 4.2,
      "high": 9.8
    }
  ],
  "encoding": {
    "x": {
      "field": "month",
      "type": "nominal"
    },
    "y": {
      "field": "low",
      "type": "quantitative",
      "title": "Avg low",
      "axis": {
        "title": "Temperature (°C)"
      }
    },
    "y2": {
      "field": "high",
      "type": "quantitative",
      "title": "Avg high"
    }
  },
  "chrome": {
    "title": "Daily swings ranged from 5.6°C in December to 10.1°C in May",
    "subtitle": "Average daily low and high temperature by month, Central Park, 2023 (°C)"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    }
  }
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "range",
    "style": "bar",
    "fill": "#0e7490"
  },
  "encoding": {
    "x": {
      "field": "month",
      "type": "nominal"
    },
    "y": {
      "field": "low",
      "type": "quantitative",
      "title": "Avg low",
      "axis": {
        "title": "Temperature (°C)"
      }
    },
    "y2": {
      "field": "high",
      "type": "quantitative",
      "title": "Avg high"
    }
  },
  "chrome": {
    "title": "Daily swings ranged from 5.6°C in December to 10.1°C in May",
    "subtitle": "Average daily low and high temperature by month, Central Park, 2023 (°C)"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    }
  }
};

export function Example() {
  return <Chart spec={spec} />;
}
<script setup lang="ts">
import { Chart } from "@opendata-ai/openchart-vue";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "range",
    "style": "bar",
    "fill": "#0e7490"
  },
  "encoding": {
    "x": {
      "field": "month",
      "type": "nominal"
    },
    "y": {
      "field": "low",
      "type": "quantitative",
      "title": "Avg low",
      "axis": {
        "title": "Temperature (°C)"
      }
    },
    "y2": {
      "field": "high",
      "type": "quantitative",
      "title": "Avg high"
    }
  },
  "chrome": {
    "title": "Daily swings ranged from 5.6°C in December to 10.1°C in May",
    "subtitle": "Average daily low and high temperature by month, Central Park, 2023 (°C)"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    }
  }
};
</script>

<template>
  <Chart :spec="spec" />
</template>
<script lang="ts">
import { Chart } from "@opendata-ai/openchart-svelte";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "range",
    "style": "bar",
    "fill": "#0e7490"
  },
  "encoding": {
    "x": {
      "field": "month",
      "type": "nominal"
    },
    "y": {
      "field": "low",
      "type": "quantitative",
      "title": "Avg low",
      "axis": {
        "title": "Temperature (°C)"
      }
    },
    "y2": {
      "field": "high",
      "type": "quantitative",
      "title": "Avg high"
    }
  },
  "chrome": {
    "title": "Daily swings ranged from 5.6°C in December to 10.1°C in May",
    "subtitle": "Average daily low and high temperature by month, Central Park, 2023 (°C)"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    }
  }
};
</script>

<Chart {spec} />
import { createChart } from "@opendata-ai/openchart-vanilla";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";

const data = [/* 12 rows, as in the Spec tab; Copy includes them */];

const spec: ChartSpec = {
  data,
  "mark": {
    "type": "range",
    "style": "bar",
    "fill": "#0e7490"
  },
  "encoding": {
    "x": {
      "field": "month",
      "type": "nominal"
    },
    "y": {
      "field": "low",
      "type": "quantitative",
      "title": "Avg low",
      "axis": {
        "title": "Temperature (°C)"
      }
    },
    "y2": {
      "field": "high",
      "type": "quantitative",
      "title": "Avg high"
    }
  },
  "chrome": {
    "title": "Daily swings ranged from 5.6°C in December to 10.1°C in May",
    "subtitle": "Average daily low and high temperature by month, Central Park, 2023 (°C)"
  },
  "overrides": {
    "compact": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    },
    "medium": {
      "encoding": {
        "x": {
          "axis": {
            "labelAngle": 0,
            "values": [
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"
            ]
          }
        }
      }
    }
  }
};

const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);

May’s bar stretches from 12.0°C to 22.1°C, while December’s sits compressed between 4.2°C and 9.8°C. February matches December’s afternoon warmth near 9°C yet drops almost to freezing overnight, giving it a much taller bar than its winter neighbors.

Floating bars fit ordered time buckets like months because a vertical layout preserves left-to-right calendar order while bar length encodes the daily span directly. When categories are unordered names such as countries or departments, orient the range horizontally so labels read without rotation on the left. When change between two specific periods matters, use a dumbbell or an arrow instead of a plain bar so start and end values remain distinguishable.

Error bars, distributions and averages

A range plot encodes observed endpoints, while error bars encode statistical uncertainty around an estimate. Use a range plot for measured pairs such as a month’s average low and high or a country’s before-and-after score. Use error bars for a confidence interval or standard error from a sample, where a center point marks the estimate and the whiskers show how far sampling noise could move it.

Both range plots and error bars hide the shape of the observations between their two endpoints. A month with steady daily swings can share the same average low and high as a month with mild weather interrupted by three sharp cold snaps. When skew or extreme outliers change the conclusion, plot the full distribution with a histogram or a beeswarm so the underlying observations stay visible.

A single average still works when the spread barely changes across categories or when a total is the whole question. Monthly web traffic totals or quarterly revenue figures need one bar per period, because the sum itself is the finding.

The spec

The Code button under the range chart opens its complete JSON spec with all 12 Central Park rows. Setting mark to { "type": "range", "style": "bar" } draws floating bars instead of the default dumbbell dots, and fill sets the bar color.

In encoding, x places each nominal month across the horizontal axis, while y binds low and y2 binds high on the same quantitative scale. Each endpoint channel takes its own title ("Avg low" and "Avg high") for tooltips and accessibility, while axis.title on y labels the shared temperature scale and chrome holds the chart’s headline and subtitle. On narrow screens, overrides lists every month as an axis value so all twelve labels stay upright.

To orient the chart horizontally, move the category field to y, put the two quantitative bounds on x and x2, and add a sort object on y to order rows by either endpoint. Switching style to "dumbbell" or "arrow" uses the same data shape and encoding.

Dumbbell, arrow, and horizontal bar variants of the range mark are covered in the range chart documentation.