https://github.com/rubiojr/echarts-risor
Data visualization module for Risor
https://github.com/rubiojr/echarts-risor
data-visualization risor
Last synced: about 1 year ago
JSON representation
Data visualization module for Risor
- Host: GitHub
- URL: https://github.com/rubiojr/echarts-risor
- Owner: rubiojr
- Created: 2025-05-01T15:04:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-01T15:44:10.000Z (about 1 year ago)
- Last Synced: 2025-05-01T16:40:59.640Z (about 1 year ago)
- Topics: data-visualization, risor
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Echarts
Risor module to create charts. Wraps https://github.com/go-echarts/go-echarts.
> [!NOTE]
> This module is not included with Risor.
The `echarts` module exposes a simple interface to create charts, powered by the great [go-echarts](https://github.com/go-echarts/go-echarts) library.
## Functions
### bar
```go filename="Function signature"
bar(file string, data map, opts map)
```
Creates a new bar chart.
```go copy filename="Example"
data := {
"serie A": [1, 2, 3],
"serie B": [3, 4, 5],
}
echarts.bar(
"bar.html",
data,
)
```
The `opts` argument may be a map containing any of the following keys:
| Name | Type | Description |
| ------ | ----------------------------- | ---------------------------------------- |
| title | string | The title of the chart |
| subtitle | string | The subtitle of the chart |
| xlabels | []string | The labels for the x-axis |
```go copy filename="Example"
data := {
"serie A": [1, 2, 3],
"serie B": [3, 4, 5],
}
echarts.bar(
"bar.html",
data,
{
title: "My awesome bar chart",
subtitle: "this is a subtitle",
xlabels: ["one", "two", "three"]
},
)
```
### line
```go filename="Function signature"
line(file string, data map, opts map)
```
Creates a new line chart.
```go copy filename="Example"
data := {
"serie A": [1, 2, 3],
"serie B": [3, 4, 5],
}
echarts.line(
"line.html",
data,
)
```
The `opts` argument may be a map containing any of the following keys:
| Name | Type | Description |
| ------ | ----------------------------- | ---------------------------------------- |
| title | string | The title of the chart |
| subtitle | string | The subtitle of the chart |
| xlabels | []string | The labels for the x-axis |
```go copy filename="Example"
data := {
"serie A": [1, 2, 3],
"serie B": [3, 4, 5],
}
echarts.line(
"line.html",
data,
{
title: "My awesome line chart",
subtitle: "this is a subtitle",
xlabels: ["one", "two", "three"]
},
)
```