Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prabdeb/go-google-chart
Go utility for converting JSON data type to Google Chart structure so that DataTable can understand
https://github.com/prabdeb/go-google-chart
go golang google-charts
Last synced: about 1 month ago
JSON representation
Go utility for converting JSON data type to Google Chart structure so that DataTable can understand
- Host: GitHub
- URL: https://github.com/prabdeb/go-google-chart
- Owner: prabdeb
- License: apache-2.0
- Created: 2018-11-13T04:44:47.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-13T05:04:16.000Z (about 6 years ago)
- Last Synced: 2024-06-20T12:52:11.918Z (6 months ago)
- Topics: go, golang, google-charts
- Language: Go
- Size: 6.84 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-google-chart
Go utility for converting JSON data type to [Google Chart](https://google-developers.appspot.com/chart
) structure so that DataTable can understand.This utility export the types needed for creating
[Data Parameters](https://developers.google.com/chart/interactive/docs/reference#dataparam) needed to draw the chart## Examples
1. Import Chart
```go
import (
GoogleChart "github.com/prabdeb/go-google-chart"
)
```2. Initiate the chart object with Columns
```go
zooData := GoogleChart.Chart{
Cols: []GoogleChart.ColsType{
GoogleChart.ColsType{
Label: "Animals",
Type: "string",
},
GoogleChart.ColsType{
Label: "Count",
Type: "number",
},
},
}
```3. Insert into Rows
```go
for animal, count := range zooDatabase["zoo_name"].(map[string]interface{}) {
zooData.Rows = append(zooData.Rows, GoogleChart.RowType{
C: []GoogleChart.RowCType{
GoogleChart.RowCType{
V: animal,
},
GoogleChart.RowCType{
V: count,
},
},
})
}
```