State unemployment rates in half-point bins
Unemployment was under 4% in 22 states. The histogram mark counts the rates itself, and x.bin sets the half-point bins.
{
"mark": {
"type": "histogram",
"fill": "#0e7490"
},
"data": "\u0000demo-fold:0",
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"bin": {
"step": 0.5,
"extent": [
1.5,
6.5
]
},
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
}
},
"annotations": [
{
"type": "refline",
"x": 4,
"label": "4%",
"style": "dashed",
"stroke": "#7a858f"
}
],
"chrome": {
"title": "Unemployment was under 4% in 22 of the 50 states",
"subtitle": "Number of states and DC in each half-point band. Unemployment rate, seasonally adjusted, most recent month in the BLS release (%)"
}
}
{
"mark": {
"type": "histogram",
"fill": "#0e7490"
},
"data": [
{
"state": "AL",
"rate": 2.7
},
{
"state": "AK",
"rate": 4.8
},
{
"state": "AZ",
"rate": 4.7
},
{
"state": "AR",
"rate": 4.2
},
{
"state": "CA",
"rate": 5.3
},
{
"state": "CO",
"rate": 3.8
},
// … 45 more rows; Copy includes them
],
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"bin": {
"step": 0.5,
"extent": [
1.5,
6.5
]
},
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
}
},
"annotations": [
{
"type": "refline",
"x": 4,
"label": "4%",
"style": "dashed",
"stroke": "#7a858f"
}
],
"chrome": {
"title": "Unemployment was under 4% in 22 of the 50 states",
"subtitle": "Number of states and DC in each half-point band. Unemployment rate, seasonally adjusted, most recent month in the BLS release (%)"
}
}import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";
const data = "\u0000demo-fold:0";
const spec: ChartSpec = {
data,
"mark": {
"type": "histogram",
"fill": "#0e7490"
},
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"bin": {
"step": 0.5,
"extent": [
1.5,
6.5
]
},
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
}
},
"annotations": [
{
"type": "refline",
"x": 4,
"label": "4%",
"style": "dashed",
"stroke": "#7a858f"
}
],
"chrome": {
"title": "Unemployment was under 4% in 22 of the 50 states",
"subtitle": "Number of states and DC in each half-point band. Unemployment rate, seasonally adjusted, most recent month in the BLS release (%)"
}
};
export function Example() {
return <Chart spec={spec} />;
}
import { Chart } from "@opendata-ai/openchart-react";
import type { ChartSpec } from "@opendata-ai/openchart-core";
import "@opendata-ai/openchart-core/styles.css";
const data = [/* 51 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "histogram",
"fill": "#0e7490"
},
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"bin": {
"step": 0.5,
"extent": [
1.5,
6.5
]
},
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
}
},
"annotations": [
{
"type": "refline",
"x": 4,
"label": "4%",
"style": "dashed",
"stroke": "#7a858f"
}
],
"chrome": {
"title": "Unemployment was under 4% in 22 of the 50 states",
"subtitle": "Number of states and DC in each half-point band. Unemployment rate, seasonally adjusted, most recent month in the BLS release (%)"
}
};
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 = "\u0000demo-fold:0";
const spec: ChartSpec = {
data,
"mark": {
"type": "histogram",
"fill": "#0e7490"
},
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"bin": {
"step": 0.5,
"extent": [
1.5,
6.5
]
},
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
}
},
"annotations": [
{
"type": "refline",
"x": 4,
"label": "4%",
"style": "dashed",
"stroke": "#7a858f"
}
],
"chrome": {
"title": "Unemployment was under 4% in 22 of the 50 states",
"subtitle": "Number of states and DC in each half-point band. Unemployment rate, seasonally adjusted, most recent month in the BLS release (%)"
}
};
</script>
<template>
<Chart :spec="spec" />
</template>
<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 = [/* 51 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "histogram",
"fill": "#0e7490"
},
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"bin": {
"step": 0.5,
"extent": [
1.5,
6.5
]
},
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
}
},
"annotations": [
{
"type": "refline",
"x": 4,
"label": "4%",
"style": "dashed",
"stroke": "#7a858f"
}
],
"chrome": {
"title": "Unemployment was under 4% in 22 of the 50 states",
"subtitle": "Number of states and DC in each half-point band. Unemployment rate, seasonally adjusted, most recent month in the BLS release (%)"
}
};
</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 = "\u0000demo-fold:0";
const spec: ChartSpec = {
data,
"mark": {
"type": "histogram",
"fill": "#0e7490"
},
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"bin": {
"step": 0.5,
"extent": [
1.5,
6.5
]
},
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
}
},
"annotations": [
{
"type": "refline",
"x": 4,
"label": "4%",
"style": "dashed",
"stroke": "#7a858f"
}
],
"chrome": {
"title": "Unemployment was under 4% in 22 of the 50 states",
"subtitle": "Number of states and DC in each half-point band. Unemployment rate, seasonally adjusted, most recent month in the BLS release (%)"
}
};
</script>
<Chart {spec} />
<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 = [/* 51 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "histogram",
"fill": "#0e7490"
},
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"bin": {
"step": 0.5,
"extent": [
1.5,
6.5
]
},
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
}
},
"annotations": [
{
"type": "refline",
"x": 4,
"label": "4%",
"style": "dashed",
"stroke": "#7a858f"
}
],
"chrome": {
"title": "Unemployment was under 4% in 22 of the 50 states",
"subtitle": "Number of states and DC in each half-point band. Unemployment rate, seasonally adjusted, most recent month in the BLS release (%)"
}
};
</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 = "\u0000demo-fold:0";
const spec: ChartSpec = {
data,
"mark": {
"type": "histogram",
"fill": "#0e7490"
},
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"bin": {
"step": 0.5,
"extent": [
1.5,
6.5
]
},
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
}
},
"annotations": [
{
"type": "refline",
"x": 4,
"label": "4%",
"style": "dashed",
"stroke": "#7a858f"
}
],
"chrome": {
"title": "Unemployment was under 4% in 22 of the 50 states",
"subtitle": "Number of states and DC in each half-point band. Unemployment rate, seasonally adjusted, most recent month in the BLS release (%)"
}
};
const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, 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 = [/* 51 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "histogram",
"fill": "#0e7490"
},
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"bin": {
"step": 0.5,
"extent": [
1.5,
6.5
]
},
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
}
},
"annotations": [
{
"type": "refline",
"x": 4,
"label": "4%",
"style": "dashed",
"stroke": "#7a858f"
}
],
"chrome": {
"title": "Unemployment was under 4% in 22 of the 50 states",
"subtitle": "Number of states and DC in each half-point band. Unemployment rate, seasonally adjusted, most recent month in the BLS release (%)"
}
};
const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);