-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 57b04b2
Showing
577 changed files
with
203,828 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Test | ||
on: [push, pull_request] | ||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Test | ||
run: | | ||
CGO_ENABLED=0 TIMEOUT=10m go test -v -timeout=2h ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/*.svg | ||
|
||
*-orig.svg | ||
*.png | ||
*.jpg | ||
*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015-2024 Kenneth Shaw | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# echartsgoja | ||
|
||
`echartsgoja` renders [Apache ECharts][echarts-examples] as SVGs using the | ||
[`goja`][goja] JavaScript runtime. Developed for use by [`usql`][usql] for | ||
rendering charts. | ||
|
||
[Overview][] | [TODO][] | [About][] | ||
|
||
[Overview]: #overview "Overview" | ||
[TODO]: #todo "TODO" | ||
[About]: #about "About" | ||
|
||
[![Unit Tests][echartsgoja-ci-status]][echartsgoja-ci] | ||
[![Go Reference][goref-echartsgoja-status]][goref-echartsgoja] | ||
[![Discord Discussion][discord-status]][discord] | ||
|
||
[echartsgoja-ci]: https://github.com/xo/echartsgoja/actions/workflows/test.yml | ||
[echartsgoja-ci-status]: https://github.com/xo/echartsgoja/actions/workflows/test.yml/badge.svg | ||
[goref-echartsgoja]: https://pkg.go.dev/github.com/xo/echartsgoja | ||
[goref-echartsgoja-status]: https://pkg.go.dev/badge/github.com/xo/echartsgoja.svg | ||
[discord]: https://discord.gg/yJKEzc7prt "Discord Discussion" | ||
[discord-status]: https://img.shields.io/discord/829150509658013727.svg?label=Discord&logo=Discord&colorB=7289da&style=flat-square "Discord Discussion" | ||
|
||
## Overview | ||
|
||
Install in the usual Go fashion: | ||
|
||
```sh | ||
$ go get github.com/xo/echartsgoja@latest | ||
``` | ||
|
||
Then use like the following: | ||
|
||
```go | ||
package echartsgoja_test | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"os" | ||
|
||
"github.com/xo/echartsgoja" | ||
) | ||
|
||
func Example() { | ||
echarts := echartsgoja.New() | ||
svg, err := echarts.RenderOptions(context.Background(), simpleOpts) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
if err := os.WriteFile("simple.svg", []byte(svg), 0o644); err != nil { | ||
log.Fatal(err) | ||
} | ||
// Output: | ||
} | ||
|
||
const simpleOpts = `{ | ||
"xAxis": { | ||
"type": "category", | ||
"boundaryGap": false, | ||
"data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] | ||
}, | ||
"yAxis": { | ||
"type": "value" | ||
}, | ||
"series": [{ | ||
"data": [820, 932, 901, 934, 1290, 1330, 1320], | ||
"type": "line", | ||
"areaStyle": {} | ||
}] | ||
}` | ||
``` | ||
|
||
## TODO | ||
|
||
- Rewrite as native Go | ||
|
||
## About | ||
|
||
`echartsgoja` was written primarily to support these projects: | ||
|
||
- [usql][usql] - a universal command-line interface for SQL databases | ||
|
||
Users of this package may find the [`github.com/xo/resvg`][resvg] package | ||
helpful in rendering generated SVGs. | ||
|
||
[echarts-examples]: https://echarts.apache.org/examples/en/index.html | ||
[usql]: https://github.com/xo/usql | ||
[resvg]: https://github.com/xo/resvg | ||
[goja]: https://github.com/dop251/goja |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.