Verlaufslinie
Eine Linie, deren Strichfarbe einem Farbverlauf folgt.
Diagramm ohne Website-Rahmen öffnen ↗
const options = {
chart: {
height: 380,
fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
type: "line",
toolbar: {
show: false
}
},
series: [
{
name: "Wind speed",
data: [15.8, 18.9, 18.2, 18.4, 20, 17.8, 15.7, 14.7, 13, 14.8, 12.5, 15.8, 16.7, 13.7, 15.6, 16.5, 17, 17.6, 17.2, 17.1, 14.8, 17.1, 19.7, 21.4]
}
],
xaxis: {
categories: ["0h", "1h", "2h", "3h", "4h", "5h", "6h", "7h", "8h", "9h", "10h", "11h", "12h", "13h", "14h", "15h", "16h", "17h", "18h", "19h", "20h", "21h", "22h", "23h"]
},
stroke: {
width: 5,
curve: "smooth"
},
fill: {
type: "gradient",
gradient: {
shade: "dark",
gradientToColors: ["#f59e0b"],
type: "horizontal",
stops: [0, 100]
}
},
colors: ["#2563eb"],
yaxis: {
title: {
text: "km/h"
}
},
title: {
text: "Wind speed over 24 hours"
},
theme: {
mode: "light",
preset: "coastal"
}
}
const chart = new WestCoastCharts(document.querySelector('#chart'), options)
chart.render()import WestCoastCharts from 'west-coast-charts'
const options = {
chart: {
height: 380,
fontFamily: "Inter, Geist, \"IBM Plex Sans\", system-ui, sans-serif",
type: "line",
toolbar: {
show: false
}
},
series: [
{
name: "Wind speed",
data: [15.8, 18.9, 18.2, 18.4, 20, 17.8, 15.7, 14.7, 13, 14.8, 12.5, 15.8, 16.7, 13.7, 15.6, 16.5, 17, 17.6, 17.2, 17.1, 14.8, 17.1, 19.7, 21.4]
}
],
xaxis: {
categories: ["0h", "1h", "2h", "3h", "4h", "5h", "6h", "7h", "8h", "9h", "10h", "11h", "12h", "13h", "14h", "15h", "16h", "17h", "18h", "19h", "20h", "21h", "22h", "23h"]
},
stroke: {
width: 5,
curve: "smooth"
},
fill: {
type: "gradient",
gradient: {
shade: "dark",
gradientToColors: ["#f59e0b"],
type: "horizontal",
stops: [0, 100]
}
},
colors: ["#2563eb"],
yaxis: {
title: {
text: "km/h"
}
},
title: {
text: "Wind speed over 24 hours"
},
theme: {
mode: "light",
preset: "coastal"
}
}
const chart = new WestCoastCharts(document.querySelector('#chart'), options)
await chart.render() Warten auf das Diagramm.
Open Data & agent view to read this chart through chart.describe().
Aus der laufenden Bibliothek über das optionale agent/describe -Modul gelesen. Text, Tabelle und JSON zeigen denselben Zustand. Ausschließlich Demonstrationsdaten.
$ wcc chart export line-gradient-line.json --out line-gradient-line.svg --with-table Public agent tools 0.2.3, tested with Library 1.1.5; available from the versioned GitHub release and npm. Speichern Sie zuerst eine JSON-Spezifikation und prüfen Sie vor dem Rendern die geladene Runtime und die unterstützten Module. Befehlsreferenz
Loading /gallery/line/gradient-line/index.md …