rodloboz

rodloboz

Hi everyone! I’d like to share Fude (筆, “brush”), a charting library for Phoenix LiveView.

I built it for dashboards and reports where you want to turn Elixir data into a chart, but also give the chart enough context to tell a useful story: a title, a source, a note on a change, or a comparison between series.

A basic chart starts with data and the fields to draw:

<.chart
  id="revenue"
  chart={Fude.bar(@sales, x: :region, y: :revenue, title: "Revenue by region")}
/>

Here @sales can be a list of maps such as %{region: "North", revenue: 120}. When the assign changes, the chart updates in place and its marks animate to their new positions.

More than bars and lines

Fude includes area, scatter, pie, donut, histogram, heatmap, waterfall and funnel charts, along with sparklines, single-value indicators, and world and US maps. You can layer marks, add annotations, and split a chart into small multiples with shared scales.

Channels can also describe how to group or aggregate data:

Fude.line(orders,
  x: {:month, :placed_on},
  y: {:sum, :total},
  color: :channel,
  title: "Monthly revenue by channel"
)

For larger datasets, Fude.query/3 accepts an Ecto query and a repo. Supported aggregations and grouping run in the database, so the chart receives the groups rather than every row:

Order
|> Fude.query(Repo)
|> Fude.bar(x: :status, y: {:count, :id}, title: "Orders by status")

Interaction and live data

Charts have tooltips, keyboard navigation, screen reader descriptions, and a data table. Lines and areas show the series together at the pointer. You can also stream new rows into a rolling window with Fude.Live.append/5.

Saving, exporting and theming

Fude.Spec.dump/1 turns a chart definition into a versioned map that can be saved and loaded again. Charts can be exported as SVG or PNG in the browser; Fude.Export also produces Markdown, text, or HTML containing the chart’s words and data on the server. There are CSS variables for theming and support for dark mode and reduced motion.

Install

Fude requires Elixir 1.18+, Phoenix 1.7.14 or 1.8, and LiveView 1.1+. Ecto 3.13+ is needed for Ecto queries. Add the dependency:

{:fude, "~> 0.8"}

Then run:

mix deps.get
mix fude.install

The installer sets up the LiveView hook and stylesheet, and prints any manual steps needed. The JavaScript bundle is included in the package. Import Fude.Components in your web module’s html_helpers, and you’re ready to use <.chart>.

To try the gallery locally, clone the repo and run mix deps.get, mix fude.build, and mix dev, then visit http://localhost:4099.

I’d love to hear what you think. What kinds of charts or workflows would you like to see supported?

Where Next? Top

Trending in Announcing Top

mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
danschultzer
I’ve moved the strategies out of PowAssent and created a multi-provider framework for Elixir. This way the strategies can be used in any ...
New
gtcode
Aloha gang, There’s a new class of AI model out from TypeSafe. Jev is their flagship model. You can learn about it here: ...
New
danschultzer
I needed something like premailer for rails, and after searching, I decided to make an easy-to-use library to handle inline styles and co...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
AstonJ
With advancements in AI gathering pace and set to increasingly accelerate, perhaps it’s worth having an annual thread on the topic - feel...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews