US energy use by source, 2024
Petroleum and natural gas supplied nearly three-quarters of US energy in 2024. The donut is an arc mark with innerRadius and a centerLabel.
{
"mark": {
"type": "arc",
"innerRadius": 64,
"centerLabel": {
"text": "74%",
"subtitle": "oil and gas"
}
},
"data": [
{
"source": "Petroleum",
"quads": 35.59
},
{
"source": "Natural gas",
"quads": 34.27
},
{
"source": "Nuclear",
"quads": 8.17
},
{
"source": "Coal",
"quads": 7.87
},
{
"source": "Biomass",
"quads": 5.11
},
{
"source": "Other",
"quads": 3.6
}
],
"encoding": {
"theta": {
"field": "quads",
"type": "quantitative"
},
"color": {
"field": "source",
"type": "nominal",
"scale": {
"domain": [
"Petroleum",
"Natural gas",
"Nuclear",
"Coal",
"Biomass",
"Other"
]
}
}
},
"labels": false,
"chrome": {
"title": "Petroleum and natural gas supplied 74% of the energy the US used in 2024",
"subtitle": "Primary energy by source, 2024 (quadrillion BTU)"
}
}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": "arc",
"innerRadius": 64,
"centerLabel": {
"text": "74%",
"subtitle": "oil and gas"
}
},
"encoding": {
"theta": {
"field": "quads",
"type": "quantitative"
},
"color": {
"field": "source",
"type": "nominal",
"scale": {
"domain": [
"Petroleum",
"Natural gas",
"Nuclear",
"Coal",
"Biomass",
"Other"
]
}
}
},
"labels": false,
"chrome": {
"title": "Petroleum and natural gas supplied 74% of the energy the US used in 2024",
"subtitle": "Primary energy by source, 2024 (quadrillion BTU)"
}
};
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 = [/* 6 rows, as in the Spec tab; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "arc",
"innerRadius": 64,
"centerLabel": {
"text": "74%",
"subtitle": "oil and gas"
}
},
"encoding": {
"theta": {
"field": "quads",
"type": "quantitative"
},
"color": {
"field": "source",
"type": "nominal",
"scale": {
"domain": [
"Petroleum",
"Natural gas",
"Nuclear",
"Coal",
"Biomass",
"Other"
]
}
}
},
"labels": false,
"chrome": {
"title": "Petroleum and natural gas supplied 74% of the energy the US used in 2024",
"subtitle": "Primary energy by source, 2024 (quadrillion BTU)"
}
};
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": "arc",
"innerRadius": 64,
"centerLabel": {
"text": "74%",
"subtitle": "oil and gas"
}
},
"encoding": {
"theta": {
"field": "quads",
"type": "quantitative"
},
"color": {
"field": "source",
"type": "nominal",
"scale": {
"domain": [
"Petroleum",
"Natural gas",
"Nuclear",
"Coal",
"Biomass",
"Other"
]
}
}
},
"labels": false,
"chrome": {
"title": "Petroleum and natural gas supplied 74% of the energy the US used in 2024",
"subtitle": "Primary energy by source, 2024 (quadrillion BTU)"
}
};
</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 = [/* 6 rows, as in the Spec tab; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "arc",
"innerRadius": 64,
"centerLabel": {
"text": "74%",
"subtitle": "oil and gas"
}
},
"encoding": {
"theta": {
"field": "quads",
"type": "quantitative"
},
"color": {
"field": "source",
"type": "nominal",
"scale": {
"domain": [
"Petroleum",
"Natural gas",
"Nuclear",
"Coal",
"Biomass",
"Other"
]
}
}
},
"labels": false,
"chrome": {
"title": "Petroleum and natural gas supplied 74% of the energy the US used in 2024",
"subtitle": "Primary energy by source, 2024 (quadrillion BTU)"
}
};
</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": "arc",
"innerRadius": 64,
"centerLabel": {
"text": "74%",
"subtitle": "oil and gas"
}
},
"encoding": {
"theta": {
"field": "quads",
"type": "quantitative"
},
"color": {
"field": "source",
"type": "nominal",
"scale": {
"domain": [
"Petroleum",
"Natural gas",
"Nuclear",
"Coal",
"Biomass",
"Other"
]
}
}
},
"labels": false,
"chrome": {
"title": "Petroleum and natural gas supplied 74% of the energy the US used in 2024",
"subtitle": "Primary energy by source, 2024 (quadrillion BTU)"
}
};
</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 = [/* 6 rows, as in the Spec tab; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "arc",
"innerRadius": 64,
"centerLabel": {
"text": "74%",
"subtitle": "oil and gas"
}
},
"encoding": {
"theta": {
"field": "quads",
"type": "quantitative"
},
"color": {
"field": "source",
"type": "nominal",
"scale": {
"domain": [
"Petroleum",
"Natural gas",
"Nuclear",
"Coal",
"Biomass",
"Other"
]
}
}
},
"labels": false,
"chrome": {
"title": "Petroleum and natural gas supplied 74% of the energy the US used in 2024",
"subtitle": "Primary energy by source, 2024 (quadrillion BTU)"
}
};
</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": "arc",
"innerRadius": 64,
"centerLabel": {
"text": "74%",
"subtitle": "oil and gas"
}
},
"encoding": {
"theta": {
"field": "quads",
"type": "quantitative"
},
"color": {
"field": "source",
"type": "nominal",
"scale": {
"domain": [
"Petroleum",
"Natural gas",
"Nuclear",
"Coal",
"Biomass",
"Other"
]
}
}
},
"labels": false,
"chrome": {
"title": "Petroleum and natural gas supplied 74% of the energy the US used in 2024",
"subtitle": "Primary energy by source, 2024 (quadrillion BTU)"
}
};
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 = [/* 6 rows, as in the Spec tab; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "arc",
"innerRadius": 64,
"centerLabel": {
"text": "74%",
"subtitle": "oil and gas"
}
},
"encoding": {
"theta": {
"field": "quads",
"type": "quantitative"
},
"color": {
"field": "source",
"type": "nominal",
"scale": {
"domain": [
"Petroleum",
"Natural gas",
"Nuclear",
"Coal",
"Biomass",
"Other"
]
}
}
},
"labels": false,
"chrome": {
"title": "Petroleum and natural gas supplied 74% of the energy the US used in 2024",
"subtitle": "Primary energy by source, 2024 (quadrillion BTU)"
}
};
const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);