Energy services and rejected energy by sector, 2024
Transportation turned a fifth of its energy into energy services, the least of four sectors. Bars stacked with stack: normalize show each split.
{
"mark": {
"type": "bar",
"orient": "horizontal"
},
"data": [
{
"sector": "Residential",
"outcome": "Energy services",
"quads": 7.3
},
{
"sector": "Residential",
"outcome": "Rejected energy",
"quads": 3.93
},
{
"sector": "Commercial",
"outcome": "Energy services",
"quads": 6.17
},
{
"sector": "Commercial",
"outcome": "Rejected energy",
"quads": 3.32
},
{
"sector": "Industrial",
"outcome": "Energy services",
"quads": 12.93
},
{
"sector": "Industrial",
"outcome": "Rejected energy",
"quads": 13.46
},
{
"sector": "Transportation",
"outcome": "Energy services",
"quads": 5.94
},
{
"sector": "Transportation",
"outcome": "Rejected energy",
"quads": 22.35
}
],
"encoding": {
"x": {
"field": "quads",
"type": "quantitative",
"stack": "normalize",
"axis": {
"title": "Share of the sector's energy",
"format": ".0%",
"grid": true
}
},
"y": {
"field": "sector",
"type": "nominal",
"sort": null
},
"color": {
"field": "outcome",
"type": "nominal",
"scale": {
"domain": [
"Energy services",
"Rejected energy"
],
"range": [
"#0e7490",
"#7a858f"
]
}
}
},
"labels": false,
"chrome": {
"title": "Transportation turned 21% of its energy into energy services, the least of four sectors",
"subtitle": "Energy used by each end-use sector, 2024, split by what became of it"
}
}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": "bar",
"orient": "horizontal"
},
"encoding": {
"x": {
"field": "quads",
"type": "quantitative",
"stack": "normalize",
"axis": {
"title": "Share of the sector's energy",
"format": ".0%",
"grid": true
}
},
"y": {
"field": "sector",
"type": "nominal",
"sort": null
},
"color": {
"field": "outcome",
"type": "nominal",
"scale": {
"domain": [
"Energy services",
"Rejected energy"
],
"range": [
"#0e7490",
"#7a858f"
]
}
}
},
"labels": false,
"chrome": {
"title": "Transportation turned 21% of its energy into energy services, the least of four sectors",
"subtitle": "Energy used by each end-use sector, 2024, split by what became of it"
}
};
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 = [/* 8 rows, as in the Spec tab; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "bar",
"orient": "horizontal"
},
"encoding": {
"x": {
"field": "quads",
"type": "quantitative",
"stack": "normalize",
"axis": {
"title": "Share of the sector's energy",
"format": ".0%",
"grid": true
}
},
"y": {
"field": "sector",
"type": "nominal",
"sort": null
},
"color": {
"field": "outcome",
"type": "nominal",
"scale": {
"domain": [
"Energy services",
"Rejected energy"
],
"range": [
"#0e7490",
"#7a858f"
]
}
}
},
"labels": false,
"chrome": {
"title": "Transportation turned 21% of its energy into energy services, the least of four sectors",
"subtitle": "Energy used by each end-use sector, 2024, split by what became of it"
}
};
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": "bar",
"orient": "horizontal"
},
"encoding": {
"x": {
"field": "quads",
"type": "quantitative",
"stack": "normalize",
"axis": {
"title": "Share of the sector's energy",
"format": ".0%",
"grid": true
}
},
"y": {
"field": "sector",
"type": "nominal",
"sort": null
},
"color": {
"field": "outcome",
"type": "nominal",
"scale": {
"domain": [
"Energy services",
"Rejected energy"
],
"range": [
"#0e7490",
"#7a858f"
]
}
}
},
"labels": false,
"chrome": {
"title": "Transportation turned 21% of its energy into energy services, the least of four sectors",
"subtitle": "Energy used by each end-use sector, 2024, split by what became of it"
}
};
</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 = [/* 8 rows, as in the Spec tab; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "bar",
"orient": "horizontal"
},
"encoding": {
"x": {
"field": "quads",
"type": "quantitative",
"stack": "normalize",
"axis": {
"title": "Share of the sector's energy",
"format": ".0%",
"grid": true
}
},
"y": {
"field": "sector",
"type": "nominal",
"sort": null
},
"color": {
"field": "outcome",
"type": "nominal",
"scale": {
"domain": [
"Energy services",
"Rejected energy"
],
"range": [
"#0e7490",
"#7a858f"
]
}
}
},
"labels": false,
"chrome": {
"title": "Transportation turned 21% of its energy into energy services, the least of four sectors",
"subtitle": "Energy used by each end-use sector, 2024, split by what became of it"
}
};
</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": "bar",
"orient": "horizontal"
},
"encoding": {
"x": {
"field": "quads",
"type": "quantitative",
"stack": "normalize",
"axis": {
"title": "Share of the sector's energy",
"format": ".0%",
"grid": true
}
},
"y": {
"field": "sector",
"type": "nominal",
"sort": null
},
"color": {
"field": "outcome",
"type": "nominal",
"scale": {
"domain": [
"Energy services",
"Rejected energy"
],
"range": [
"#0e7490",
"#7a858f"
]
}
}
},
"labels": false,
"chrome": {
"title": "Transportation turned 21% of its energy into energy services, the least of four sectors",
"subtitle": "Energy used by each end-use sector, 2024, split by what became of it"
}
};
</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 = [/* 8 rows, as in the Spec tab; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "bar",
"orient": "horizontal"
},
"encoding": {
"x": {
"field": "quads",
"type": "quantitative",
"stack": "normalize",
"axis": {
"title": "Share of the sector's energy",
"format": ".0%",
"grid": true
}
},
"y": {
"field": "sector",
"type": "nominal",
"sort": null
},
"color": {
"field": "outcome",
"type": "nominal",
"scale": {
"domain": [
"Energy services",
"Rejected energy"
],
"range": [
"#0e7490",
"#7a858f"
]
}
}
},
"labels": false,
"chrome": {
"title": "Transportation turned 21% of its energy into energy services, the least of four sectors",
"subtitle": "Energy used by each end-use sector, 2024, split by what became of it"
}
};
</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": "bar",
"orient": "horizontal"
},
"encoding": {
"x": {
"field": "quads",
"type": "quantitative",
"stack": "normalize",
"axis": {
"title": "Share of the sector's energy",
"format": ".0%",
"grid": true
}
},
"y": {
"field": "sector",
"type": "nominal",
"sort": null
},
"color": {
"field": "outcome",
"type": "nominal",
"scale": {
"domain": [
"Energy services",
"Rejected energy"
],
"range": [
"#0e7490",
"#7a858f"
]
}
}
},
"labels": false,
"chrome": {
"title": "Transportation turned 21% of its energy into energy services, the least of four sectors",
"subtitle": "Energy used by each end-use sector, 2024, split by what became of it"
}
};
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 = [/* 8 rows, as in the Spec tab; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "bar",
"orient": "horizontal"
},
"encoding": {
"x": {
"field": "quads",
"type": "quantitative",
"stack": "normalize",
"axis": {
"title": "Share of the sector's energy",
"format": ".0%",
"grid": true
}
},
"y": {
"field": "sector",
"type": "nominal",
"sort": null
},
"color": {
"field": "outcome",
"type": "nominal",
"scale": {
"domain": [
"Energy services",
"Rejected energy"
],
"range": [
"#0e7490",
"#7a858f"
]
}
}
},
"labels": false,
"chrome": {
"title": "Transportation turned 21% of its energy into energy services, the least of four sectors",
"subtitle": "Energy used by each end-use sector, 2024, split by what became of it"
}
};
const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);