Share of generation from six sources, one panel each, 2016 to 2023
Of six sources, only gas, wind and solar gained share. One encoding.facet channel splits the line into six panels on a shared y scale.
{
"mark": {
"type": "line",
"stroke": "#0e7490",
"strokeWidth": 2
},
"data": "\u0000demo-fold:0",
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y",
"tickCount": 3
}
},
"y": {
"field": "share",
"type": "quantitative",
"axis": {
"title": "Share of generation (%)",
"format": ".0f",
"grid": true
}
},
"facet": {
"field": "source",
"type": "nominal",
"columns": 3
}
},
"chrome": {
"title": "Of six sources, only gas, wind and solar gained share from 2016 to 2023",
"subtitle": "Share of US generation from six sources: coal, gas, nuclear, hydro, wind and solar, one panel per source on a shared scale (%)"
}
}
{
"mark": {
"type": "line",
"stroke": "#0e7490",
"strokeWidth": 2
},
"data": [
{
"year": "2016",
"source": "Coal",
"share": 31.2
},
{
"year": "2016",
"source": "Gas",
"share": 34.8
},
{
"year": "2016",
"source": "Nuclear",
"share": 20.3
},
{
"year": "2016",
"source": "Hydro",
"share": 6.6
},
{
"year": "2016",
"source": "Wind",
"share": 5.7
},
{
"year": "2016",
"source": "Solar",
"share": 1.4
},
// … 42 more rows; Copy includes them
],
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y",
"tickCount": 3
}
},
"y": {
"field": "share",
"type": "quantitative",
"axis": {
"title": "Share of generation (%)",
"format": ".0f",
"grid": true
}
},
"facet": {
"field": "source",
"type": "nominal",
"columns": 3
}
},
"chrome": {
"title": "Of six sources, only gas, wind and solar gained share from 2016 to 2023",
"subtitle": "Share of US generation from six sources: coal, gas, nuclear, hydro, wind and solar, one panel per source on a shared scale (%)"
}
}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": "line",
"stroke": "#0e7490",
"strokeWidth": 2
},
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y",
"tickCount": 3
}
},
"y": {
"field": "share",
"type": "quantitative",
"axis": {
"title": "Share of generation (%)",
"format": ".0f",
"grid": true
}
},
"facet": {
"field": "source",
"type": "nominal",
"columns": 3
}
},
"chrome": {
"title": "Of six sources, only gas, wind and solar gained share from 2016 to 2023",
"subtitle": "Share of US generation from six sources: coal, gas, nuclear, hydro, wind and solar, one panel per source on a shared scale (%)"
}
};
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 = [/* 48 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "line",
"stroke": "#0e7490",
"strokeWidth": 2
},
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y",
"tickCount": 3
}
},
"y": {
"field": "share",
"type": "quantitative",
"axis": {
"title": "Share of generation (%)",
"format": ".0f",
"grid": true
}
},
"facet": {
"field": "source",
"type": "nominal",
"columns": 3
}
},
"chrome": {
"title": "Of six sources, only gas, wind and solar gained share from 2016 to 2023",
"subtitle": "Share of US generation from six sources: coal, gas, nuclear, hydro, wind and solar, one panel per source on a shared scale (%)"
}
};
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": "line",
"stroke": "#0e7490",
"strokeWidth": 2
},
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y",
"tickCount": 3
}
},
"y": {
"field": "share",
"type": "quantitative",
"axis": {
"title": "Share of generation (%)",
"format": ".0f",
"grid": true
}
},
"facet": {
"field": "source",
"type": "nominal",
"columns": 3
}
},
"chrome": {
"title": "Of six sources, only gas, wind and solar gained share from 2016 to 2023",
"subtitle": "Share of US generation from six sources: coal, gas, nuclear, hydro, wind and solar, one panel per source on a shared scale (%)"
}
};
</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 = [/* 48 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "line",
"stroke": "#0e7490",
"strokeWidth": 2
},
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y",
"tickCount": 3
}
},
"y": {
"field": "share",
"type": "quantitative",
"axis": {
"title": "Share of generation (%)",
"format": ".0f",
"grid": true
}
},
"facet": {
"field": "source",
"type": "nominal",
"columns": 3
}
},
"chrome": {
"title": "Of six sources, only gas, wind and solar gained share from 2016 to 2023",
"subtitle": "Share of US generation from six sources: coal, gas, nuclear, hydro, wind and solar, one panel per source on a shared scale (%)"
}
};
</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": "line",
"stroke": "#0e7490",
"strokeWidth": 2
},
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y",
"tickCount": 3
}
},
"y": {
"field": "share",
"type": "quantitative",
"axis": {
"title": "Share of generation (%)",
"format": ".0f",
"grid": true
}
},
"facet": {
"field": "source",
"type": "nominal",
"columns": 3
}
},
"chrome": {
"title": "Of six sources, only gas, wind and solar gained share from 2016 to 2023",
"subtitle": "Share of US generation from six sources: coal, gas, nuclear, hydro, wind and solar, one panel per source on a shared scale (%)"
}
};
</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 = [/* 48 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "line",
"stroke": "#0e7490",
"strokeWidth": 2
},
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y",
"tickCount": 3
}
},
"y": {
"field": "share",
"type": "quantitative",
"axis": {
"title": "Share of generation (%)",
"format": ".0f",
"grid": true
}
},
"facet": {
"field": "source",
"type": "nominal",
"columns": 3
}
},
"chrome": {
"title": "Of six sources, only gas, wind and solar gained share from 2016 to 2023",
"subtitle": "Share of US generation from six sources: coal, gas, nuclear, hydro, wind and solar, one panel per source on a shared scale (%)"
}
};
</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": "line",
"stroke": "#0e7490",
"strokeWidth": 2
},
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y",
"tickCount": 3
}
},
"y": {
"field": "share",
"type": "quantitative",
"axis": {
"title": "Share of generation (%)",
"format": ".0f",
"grid": true
}
},
"facet": {
"field": "source",
"type": "nominal",
"columns": 3
}
},
"chrome": {
"title": "Of six sources, only gas, wind and solar gained share from 2016 to 2023",
"subtitle": "Share of US generation from six sources: coal, gas, nuclear, hydro, wind and solar, one panel per source on a shared scale (%)"
}
};
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 = [/* 48 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": {
"type": "line",
"stroke": "#0e7490",
"strokeWidth": 2
},
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y",
"tickCount": 3
}
},
"y": {
"field": "share",
"type": "quantitative",
"axis": {
"title": "Share of generation (%)",
"format": ".0f",
"grid": true
}
},
"facet": {
"field": "source",
"type": "nominal",
"columns": 3
}
},
"chrome": {
"title": "Of six sources, only gas, wind and solar gained share from 2016 to 2023",
"subtitle": "Share of US generation from six sources: coal, gas, nuclear, hydro, wind and solar, one panel per source on a shared scale (%)"
}
};
const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);