https://github.com/fusioncharts/fusionexport-go-client
Language SDK for FusionExport which enables exporting of charts & dashboards through Golang.
https://github.com/fusioncharts/fusionexport-go-client
fusionexport
Last synced: about 11 hours ago
JSON representation
Language SDK for FusionExport which enables exporting of charts & dashboards through Golang.
- Host: GitHub
- URL: https://github.com/fusioncharts/fusionexport-go-client
- Owner: fusioncharts
- Created: 2017-12-01T10:44:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-25T06:27:22.000Z (about 7 years ago)
- Last Synced: 2025-01-04T04:47:45.392Z (6 months ago)
- Topics: fusionexport
- Language: Go
- Size: 502 KB
- Stars: 4
- Watchers: 11
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FusionExport Go Client
This is a Go export client for FusionExport. It communicates with FusionExport through the socket protocol and does the export.
## Installation
To install the Go package, simply use Go get:
```
go get github.com/fusioncharts/fusionexport-go-client
```## Usage
To require this into your project:
```go
import "github.com/fusioncharts/fusionexport-go-client"
```## Getting Started
Let’s start with a simple chart export. For exporting a single chart, save the chartConfig in a JSON file. The config should be inside an array.
```go
// Exporting a chartpackage main
import (
"fmt""github.com/fusioncharts/fusionexport-go-client"
)// Called when export is done
func onDone(outFileBag []FusionExport.OutFileBag, err error) {
check(err)
FusionExport.SaveExportedFiles(outFileBag)
}// Called on each export state change
func onStateChange(event FusionExport.ExportEvent) {
fmt.Println("[" + event.Reporter + "] " + event.CustomMsg)
}func main() {
// Instantiate ExportConfig and add the required configurations
exportConfig := FusionExport.NewExportConfig()exportConfig.Set("chartConfig", "example/resources/single.json")
// Instantiate ExportManager
exportManager := FusionExport.NewExportManager()
// Call the Export() method with the export config and the respective callbacks
exportManager.Export(exportConfig, onDone, onStateChange)
}func check(e error) {
if e != nil {
panic(e)
}
}
```## API Reference
You can find the full reference [here](https://www.fusioncharts.com/dev/exporting-charts/using-fusionexport/sdk-api-reference/golang.html).