Clojure wrapper around XChart, a small library for rendering charts/plots.

Maintenance fork of hyPiRion/clj-xchart, ported to XChart 4.x / Clojure 1.12 and published to Clojars as
net.clojars.savya/clj-xchart.
The constructors cover XChart 4.0.3's full chart-type set:
The keyword-based styling covers these items:
Existing constructors and keyword-based styling stay compatible.
Leiningen/Boot:
[net.clojars.savya/clj-xchart "0.5.0"]
deps.edn:
net.clojars.savya/clj-xchart {:mvn/version "0.5.0"}
The examples page shows many examples, and the tutorial covers basic usage. For more advanced customisation, see the render options page.
(require '[com.hypirion.clj-xchart :as c])
(-> (c/xy-chart {"y = x" {:x [1 2 3] :y [1 2 3]}
"y = 2x" {:x [1 2 3] :y [2 4 6]}})
(c/spit "chart.png"))
Charts with mutable XChart series can be updated in place with
(c/update-series! chart series-name data). It accepts the same data shapes as
add-series!, and replaces the existing series data rather than appending it.
This is supported for XY, category, horizontal-bar, bubble, pie, box, OHLC, and
heat-map charts. Category updates must provide the chart's existing categories
in the same order; mismatches throw ex-info so cross-series alignment is not
silently broken. Bubble charts created with bubble-chart scale sizes before
adding them; updates expect those already-scaled bubble sizes because XChart
does not retain the original scaling parameters. XChart 4.0.4 has no in-place
update operation for dial or radar charts, so calls for those chart types throw
ex-info.
The Clojure namespace is still com.hypirion.clj-xchart, so existing require
forms keep working; only the Clojars coordinate changed.
XChart 4.x changed its API: the vector-graphics export, the styler hierarchy,
and the pie "annotations", which are now "labels". This fork follows those
changes. The clj-xchart keyword-based API stays the same, so charts that use
earlier com.hypirion/clj-xchart releases still render. See CHANGELOG.md for
details.
Copyright © 2016 Jean Niklas L'orange.
Maintenance fork (2026) by Savyasachi, original: https://github.com/hyPiRion/clj-xchart. Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version, preserving the original project's license.
Can you improve this documentation? These fine people already did:
Savyasachi & Jean Niklas L'orangeEdit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |