https://github.com/lukewilliamboswell/plume
Like a feather pen for drawing, but for charts
https://github.com/lukewilliamboswell/plume
roc-lang
Last synced: 3 months ago
JSON representation
Like a feather pen for drawing, but for charts
- Host: GitHub
- URL: https://github.com/lukewilliamboswell/plume
- Owner: lukewilliamboswell
- License: upl-1.0
- Created: 2025-01-01T08:44:35.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-01-24T04:37:25.000Z (4 months ago)
- Last Synced: 2025-01-24T05:18:18.940Z (4 months ago)
- Topics: roc-lang
- Language: HTML
- Homepage: https://lukewilliamboswell.github.io/plume/
- Size: 417 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- roc-awesome - lukewilliamboswell/plume
README
# Plume
A [roc](https://www.roc-lang.org) package for creating beautiful data-driven visualizations powered by [plotly.js](https://github.com/plotly/plotly.js)
## Status
Early development / Proof of Concept -- usable, and easy to extend... let me know if you would like to contribute. I made this to build some simple graphs for my routine budgeting process... and wanted to use roc and explore the API.
## Usage
```sh
$ roc simple.roc
```### Screenshot

### `simple.roc`
```roc
app [main!] {
cli: platform "<<>>",
plume: "<<>>",
}import cli.File
import cli.Cmd
import plume.Chart
import plume.Scatter
import plume.Marker
import plume.Line
import plume.Layout
import plume.Font
import plume.Title
import plume.Axis
import plume.Color exposing [rgba]main! = |_|
title_font = Font.new(
{
family: "Ringbearer",
size: 24,
style: Italic,
},
)?axis_font = Font.new(
{
family: "Courier New, monospace",
size: 18,
},
)?marker = Marker.new(
{
size: 15.0,
symbol: "diamond",
color: rgba(124, 56, 245, 255),
},
)?scatter : Scatter.Trace Str F64
scatter =
Scatter.new(
{
data: [
{ x: "Apples", y: 2.1, marker },
{ x: "Oranges", y: 3, marker },
{ x: "Bananas", y: 4, marker },
],
mode: "lines+markers",
line: Line.new(
{
width: 2.0,
color: rgba(124, 56, 245, 150),
dash: Dash,
},
),
},
)?chart =
Chart.empty
|> Chart.add_scatter_chart(scatter)
|> Chart.with_layout(
Layout.new(
{
title: Title.new({ text: "Fruit Sales", font: title_font }),
y_axis: Axis.new({ title: Title.new({ text: "Qty", font: axis_font }) }),
},
),
)File.write_utf8!(Chart.to_html(chart), "out.html")?
Cmd.exec!("open", ["out.html"])?
Ok({})
```## Examples
### Bar
[Source Code](examples/bar-chart.roc)

### Bubble
[Source Code](examples/bubble.roc)

### Donut
[Source Code](examples/donut.roc)

### Equation Cosine
[Source Code](examples/equation-cosine.roc)

### Equation Sine
[Source Code](examples/equation-sine.roc)

### Horizontal Bar
[Source Code](examples/horizontal-bar-chart.roc)

### Line
[Source Code](examples/line.roc)

### Pie
[Source Code](examples/pie.roc)

### Sankey
[Source Code](examples/sankey.roc)

### Scatter
[Source Code](examples/scatter.roc)
