https://github.com/narsil/gohighcharts
Library to display graphics using highcharts on a local server. Supports dynamic data through channels.
https://github.com/narsil/gohighcharts
Last synced: 3 months ago
JSON representation
Library to display graphics using highcharts on a local server. Supports dynamic data through channels.
- Host: GitHub
- URL: https://github.com/narsil/gohighcharts
- Owner: Narsil
- License: mit
- Created: 2013-08-26T16:40:16.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2018-02-28T10:03:25.000Z (over 7 years ago)
- Last Synced: 2025-01-24T00:31:52.580Z (4 months ago)
- Language: Go
- Size: 88.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
gohighcharts
============Library to display graphics using highcharts on a local server. Supports dynamic data through channels.
Installing
==========Within your project run
```bash
// Download the sources
go get github.com/Narsil/gohighcharts// Get the static files that will be used by the server
git clone https://github.com/Narsil/gohighcharts.git
cp -r gohighcharts/{tmpl,static} .
rm -rf gohighcharts
```Usage
=====Simple Chart Example
--------------------```go
options := map[string]interface{}{
"series": []interface{}{
map[string]interface{}{
"name": "MyData",
"data": []int{1, 2, 3},
},
},
"chart": map[string]interface{}{
"type": "line",
},
}
NewChart("/chart/", options)
```Then simply visit `http://localhost:8080/chart/` to see you chart.
Dynamic Chart
-------------When using a dynamic chart
```go
package mainimport (
highcharts "github.com/Narsil/gohighcharts"
)func main(){
data := make(chan interface{})
options := map[string]interface{}{
"series": []interface{}{
map[string]interface{}{
"name": "Dynamic chart",
"data": []int{},
},
},
"chart": map[string]interface{}{
"type": "line",
},
}
highcharts.NewDynamicChart("/dynamic/", options, data)
go func(){
for i := 0; i < 10; i++{
data<-i
time.Sleep(i * 1e9)
}
}()
}
```And visit `http://localhost:8080/dyamic/`.