Skip to content

Instantly share code, notes, and snippets.

@oxmix
oxmix / mini-chart.js
Created October 18, 2023 22:49
Mini Chart in SVG Area Curve
const width = 300
const height = 50
const graph = [1, 2, 5, 0, 5, 0.2, 0.3, 0.4, 3, 9]
const peakVal = Math.max(...graph)
graph.unshift(0) // dot start
graph.push(0) // dot end
const part = width / (graph.length - 1)
const points = []
for (const i in graph) {