State unemployment rates, one dot per state
Seven states and DC had unemployment of 5% or more. The beeswarm mark gives each state its own dot, colored by a two-value band.
{
"mark": "beeswarm",
"data": "\u0000demo-fold:0",
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
},
"color": {
"field": "band",
"type": "nominal",
"scale": {
"domain": [
"5% or more",
"Under 5%"
],
"range": [
"#c2410c",
"#7a858f"
]
}
},
"tooltip": [
{
"field": "state",
"type": "nominal",
"title": "State"
},
{
"field": "rate",
"type": "quantitative",
"title": "Rate (%)",
"format": ".1f"
}
]
},
"chrome": {
"title": "Unemployment was 5% or more in seven states and DC",
"subtitle": "Each dot is one state or DC. Unemployment rate, seasonally adjusted, most recent month in the BLS release (%)"
}
}
{
"mark": "beeswarm",
"data": [
{
"state": "AL",
"rate": 2.7,
"band": "Under 5%"
},
{
"state": "AK",
"rate": 4.8,
"band": "Under 5%"
},
{
"state": "AZ",
"rate": 4.7,
"band": "Under 5%"
},
{
"state": "AR",
"rate": 4.2,
"band": "Under 5%"
},
{
"state": "CA",
"rate": 5.3,
"band": "5% or more"
},
{
"state": "CO",
"rate": 3.8,
"band": "Under 5%"
},
// … 45 more rows; Copy includes them
],
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
},
"color": {
"field": "band",
"type": "nominal",
"scale": {
"domain": [
"5% or more",
"Under 5%"
],
"range": [
"#c2410c",
"#7a858f"
]
}
},
"tooltip": [
{
"field": "state",
"type": "nominal",
"title": "State"
},
{
"field": "rate",
"type": "quantitative",
"title": "Rate (%)",
"format": ".1f"
}
]
},
"chrome": {
"title": "Unemployment was 5% or more in seven states and DC",
"subtitle": "Each dot is one state or DC. 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": "beeswarm",
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
},
"color": {
"field": "band",
"type": "nominal",
"scale": {
"domain": [
"5% or more",
"Under 5%"
],
"range": [
"#c2410c",
"#7a858f"
]
}
},
"tooltip": [
{
"field": "state",
"type": "nominal",
"title": "State"
},
{
"field": "rate",
"type": "quantitative",
"title": "Rate (%)",
"format": ".1f"
}
]
},
"chrome": {
"title": "Unemployment was 5% or more in seven states and DC",
"subtitle": "Each dot is one state or DC. 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": "beeswarm",
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
},
"color": {
"field": "band",
"type": "nominal",
"scale": {
"domain": [
"5% or more",
"Under 5%"
],
"range": [
"#c2410c",
"#7a858f"
]
}
},
"tooltip": [
{
"field": "state",
"type": "nominal",
"title": "State"
},
{
"field": "rate",
"type": "quantitative",
"title": "Rate (%)",
"format": ".1f"
}
]
},
"chrome": {
"title": "Unemployment was 5% or more in seven states and DC",
"subtitle": "Each dot is one state or DC. 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": "beeswarm",
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
},
"color": {
"field": "band",
"type": "nominal",
"scale": {
"domain": [
"5% or more",
"Under 5%"
],
"range": [
"#c2410c",
"#7a858f"
]
}
},
"tooltip": [
{
"field": "state",
"type": "nominal",
"title": "State"
},
{
"field": "rate",
"type": "quantitative",
"title": "Rate (%)",
"format": ".1f"
}
]
},
"chrome": {
"title": "Unemployment was 5% or more in seven states and DC",
"subtitle": "Each dot is one state or DC. 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": "beeswarm",
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
},
"color": {
"field": "band",
"type": "nominal",
"scale": {
"domain": [
"5% or more",
"Under 5%"
],
"range": [
"#c2410c",
"#7a858f"
]
}
},
"tooltip": [
{
"field": "state",
"type": "nominal",
"title": "State"
},
{
"field": "rate",
"type": "quantitative",
"title": "Rate (%)",
"format": ".1f"
}
]
},
"chrome": {
"title": "Unemployment was 5% or more in seven states and DC",
"subtitle": "Each dot is one state or DC. 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": "beeswarm",
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
},
"color": {
"field": "band",
"type": "nominal",
"scale": {
"domain": [
"5% or more",
"Under 5%"
],
"range": [
"#c2410c",
"#7a858f"
]
}
},
"tooltip": [
{
"field": "state",
"type": "nominal",
"title": "State"
},
{
"field": "rate",
"type": "quantitative",
"title": "Rate (%)",
"format": ".1f"
}
]
},
"chrome": {
"title": "Unemployment was 5% or more in seven states and DC",
"subtitle": "Each dot is one state or DC. 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": "beeswarm",
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
},
"color": {
"field": "band",
"type": "nominal",
"scale": {
"domain": [
"5% or more",
"Under 5%"
],
"range": [
"#c2410c",
"#7a858f"
]
}
},
"tooltip": [
{
"field": "state",
"type": "nominal",
"title": "State"
},
{
"field": "rate",
"type": "quantitative",
"title": "Rate (%)",
"format": ".1f"
}
]
},
"chrome": {
"title": "Unemployment was 5% or more in seven states and DC",
"subtitle": "Each dot is one state or DC. 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": "beeswarm",
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
},
"color": {
"field": "band",
"type": "nominal",
"scale": {
"domain": [
"5% or more",
"Under 5%"
],
"range": [
"#c2410c",
"#7a858f"
]
}
},
"tooltip": [
{
"field": "state",
"type": "nominal",
"title": "State"
},
{
"field": "rate",
"type": "quantitative",
"title": "Rate (%)",
"format": ".1f"
}
]
},
"chrome": {
"title": "Unemployment was 5% or more in seven states and DC",
"subtitle": "Each dot is one state or DC. 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": "beeswarm",
"encoding": {
"x": {
"field": "rate",
"type": "quantitative",
"axis": {
"title": "Unemployment rate",
"format": ".1f",
"labelSuffix": "%"
}
},
"color": {
"field": "band",
"type": "nominal",
"scale": {
"domain": [
"5% or more",
"Under 5%"
],
"range": [
"#c2410c",
"#7a858f"
]
}
},
"tooltip": [
{
"field": "state",
"type": "nominal",
"title": "State"
},
{
"field": "rate",
"type": "quantitative",
"title": "Rate (%)",
"format": ".1f"
}
]
},
"chrome": {
"title": "Unemployment was 5% or more in seven states and DC",
"subtitle": "Each dot is one state or DC. 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);