Global temperature above and below the 1951 to 1980 average
Every reading since 1970 is above the 1951 to 1980 average. A two-value color scale sets the cooler readings in blue and the warmer ones in red.
{
"mark": "bar",
"data": "\u0000demo-fold:0",
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y"
}
},
"y": {
"field": "anomaly",
"type": "quantitative",
"axis": {
"title": "Temperature anomaly (°C)",
"format": "+.1f"
}
},
"color": {
"field": "trend",
"type": "nominal",
"scale": {
"domain": [
"Cooler",
"Warmer"
],
"range": [
"#3b82c4",
"#d1495b"
]
}
}
},
"labels": {
"density": "none"
},
"annotations": [
{
"type": "refline",
"y": 0,
"style": "solid",
"strokeWidth": 1
}
],
"chrome": {
"title": "Every reading since 1970 is above the 1951–1980 average",
"subtitle": "Global surface temperature, difference from the 1951–1980 average, 1900 to 2025 (°C)"
}
}
{
"mark": "bar",
"data": [
{
"year": "1900",
"anomaly": -0.08,
"trend": "Cooler"
},
{
"year": "1910",
"anomaly": -0.43,
"trend": "Cooler"
},
{
"year": "1920",
"anomaly": -0.27,
"trend": "Cooler"
},
{
"year": "1930",
"anomaly": -0.16,
"trend": "Cooler"
},
{
"year": "1940",
"anomaly": 0.12,
"trend": "Warmer"
},
{
"year": "1950",
"anomaly": -0.17,
"trend": "Cooler"
},
// … 8 more rows; Copy includes them
],
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y"
}
},
"y": {
"field": "anomaly",
"type": "quantitative",
"axis": {
"title": "Temperature anomaly (°C)",
"format": "+.1f"
}
},
"color": {
"field": "trend",
"type": "nominal",
"scale": {
"domain": [
"Cooler",
"Warmer"
],
"range": [
"#3b82c4",
"#d1495b"
]
}
}
},
"labels": {
"density": "none"
},
"annotations": [
{
"type": "refline",
"y": 0,
"style": "solid",
"strokeWidth": 1
}
],
"chrome": {
"title": "Every reading since 1970 is above the 1951–1980 average",
"subtitle": "Global surface temperature, difference from the 1951–1980 average, 1900 to 2025 (°C)"
}
}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": "bar",
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y"
}
},
"y": {
"field": "anomaly",
"type": "quantitative",
"axis": {
"title": "Temperature anomaly (°C)",
"format": "+.1f"
}
},
"color": {
"field": "trend",
"type": "nominal",
"scale": {
"domain": [
"Cooler",
"Warmer"
],
"range": [
"#3b82c4",
"#d1495b"
]
}
}
},
"labels": {
"density": "none"
},
"annotations": [
{
"type": "refline",
"y": 0,
"style": "solid",
"strokeWidth": 1
}
],
"chrome": {
"title": "Every reading since 1970 is above the 1951–1980 average",
"subtitle": "Global surface temperature, difference from the 1951–1980 average, 1900 to 2025 (°C)"
}
};
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 = [/* 14 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": "bar",
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y"
}
},
"y": {
"field": "anomaly",
"type": "quantitative",
"axis": {
"title": "Temperature anomaly (°C)",
"format": "+.1f"
}
},
"color": {
"field": "trend",
"type": "nominal",
"scale": {
"domain": [
"Cooler",
"Warmer"
],
"range": [
"#3b82c4",
"#d1495b"
]
}
}
},
"labels": {
"density": "none"
},
"annotations": [
{
"type": "refline",
"y": 0,
"style": "solid",
"strokeWidth": 1
}
],
"chrome": {
"title": "Every reading since 1970 is above the 1951–1980 average",
"subtitle": "Global surface temperature, difference from the 1951–1980 average, 1900 to 2025 (°C)"
}
};
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": "bar",
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y"
}
},
"y": {
"field": "anomaly",
"type": "quantitative",
"axis": {
"title": "Temperature anomaly (°C)",
"format": "+.1f"
}
},
"color": {
"field": "trend",
"type": "nominal",
"scale": {
"domain": [
"Cooler",
"Warmer"
],
"range": [
"#3b82c4",
"#d1495b"
]
}
}
},
"labels": {
"density": "none"
},
"annotations": [
{
"type": "refline",
"y": 0,
"style": "solid",
"strokeWidth": 1
}
],
"chrome": {
"title": "Every reading since 1970 is above the 1951–1980 average",
"subtitle": "Global surface temperature, difference from the 1951–1980 average, 1900 to 2025 (°C)"
}
};
</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 = [/* 14 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": "bar",
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y"
}
},
"y": {
"field": "anomaly",
"type": "quantitative",
"axis": {
"title": "Temperature anomaly (°C)",
"format": "+.1f"
}
},
"color": {
"field": "trend",
"type": "nominal",
"scale": {
"domain": [
"Cooler",
"Warmer"
],
"range": [
"#3b82c4",
"#d1495b"
]
}
}
},
"labels": {
"density": "none"
},
"annotations": [
{
"type": "refline",
"y": 0,
"style": "solid",
"strokeWidth": 1
}
],
"chrome": {
"title": "Every reading since 1970 is above the 1951–1980 average",
"subtitle": "Global surface temperature, difference from the 1951–1980 average, 1900 to 2025 (°C)"
}
};
</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": "bar",
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y"
}
},
"y": {
"field": "anomaly",
"type": "quantitative",
"axis": {
"title": "Temperature anomaly (°C)",
"format": "+.1f"
}
},
"color": {
"field": "trend",
"type": "nominal",
"scale": {
"domain": [
"Cooler",
"Warmer"
],
"range": [
"#3b82c4",
"#d1495b"
]
}
}
},
"labels": {
"density": "none"
},
"annotations": [
{
"type": "refline",
"y": 0,
"style": "solid",
"strokeWidth": 1
}
],
"chrome": {
"title": "Every reading since 1970 is above the 1951–1980 average",
"subtitle": "Global surface temperature, difference from the 1951–1980 average, 1900 to 2025 (°C)"
}
};
</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 = [/* 14 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": "bar",
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y"
}
},
"y": {
"field": "anomaly",
"type": "quantitative",
"axis": {
"title": "Temperature anomaly (°C)",
"format": "+.1f"
}
},
"color": {
"field": "trend",
"type": "nominal",
"scale": {
"domain": [
"Cooler",
"Warmer"
],
"range": [
"#3b82c4",
"#d1495b"
]
}
}
},
"labels": {
"density": "none"
},
"annotations": [
{
"type": "refline",
"y": 0,
"style": "solid",
"strokeWidth": 1
}
],
"chrome": {
"title": "Every reading since 1970 is above the 1951–1980 average",
"subtitle": "Global surface temperature, difference from the 1951–1980 average, 1900 to 2025 (°C)"
}
};
</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": "bar",
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y"
}
},
"y": {
"field": "anomaly",
"type": "quantitative",
"axis": {
"title": "Temperature anomaly (°C)",
"format": "+.1f"
}
},
"color": {
"field": "trend",
"type": "nominal",
"scale": {
"domain": [
"Cooler",
"Warmer"
],
"range": [
"#3b82c4",
"#d1495b"
]
}
}
},
"labels": {
"density": "none"
},
"annotations": [
{
"type": "refline",
"y": 0,
"style": "solid",
"strokeWidth": 1
}
],
"chrome": {
"title": "Every reading since 1970 is above the 1951–1980 average",
"subtitle": "Global surface temperature, difference from the 1951–1980 average, 1900 to 2025 (°C)"
}
};
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 = [/* 14 rows; Copy includes them */];
const spec: ChartSpec = {
data,
"mark": "bar",
"encoding": {
"x": {
"field": "year",
"type": "temporal",
"axis": {
"format": "%Y"
}
},
"y": {
"field": "anomaly",
"type": "quantitative",
"axis": {
"title": "Temperature anomaly (°C)",
"format": "+.1f"
}
},
"color": {
"field": "trend",
"type": "nominal",
"scale": {
"domain": [
"Cooler",
"Warmer"
],
"range": [
"#3b82c4",
"#d1495b"
]
}
}
},
"labels": {
"density": "none"
},
"annotations": [
{
"type": "refline",
"y": 0,
"style": "solid",
"strokeWidth": 1
}
],
"chrome": {
"title": "Every reading since 1970 is above the 1951–1980 average",
"subtitle": "Global surface temperature, difference from the 1951–1980 average, 1900 to 2025 (°C)"
}
};
const container = document.getElementById("chart");
if (!container) throw new Error('Add <div id="chart"></div> to the page first.');
createChart(container, spec);