license and readme.
This commit is contained in:
parent
4bbc7978a2
commit
8f8bf3d32d
3 changed files with 77 additions and 0 deletions
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2016 William Charczuk.
|
||||||
|
|
||||||
|
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.
|
56
README.md
Normal file
56
README.md
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
go-chart
|
||||||
|
========
|
||||||
|
|
||||||
|
Package `chart` is a very simple golang native charting library that supports timeseries and continuous
|
||||||
|
line charts.
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
To install `chart` run the following:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> go get -u github.com/wcharczuk/go-chart
|
||||||
|
```
|
||||||
|
|
||||||
|
Most of the components are interchangeable so feel free to crib whatever you want.
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
![](https://raw.githubusercontent.com/wcharczuk/go-chart/master/images/goog_ltm.png)
|
||||||
|
|
||||||
|
|
||||||
|
The chart code to produce the above is as follows:
|
||||||
|
|
||||||
|
```go
|
||||||
|
// note this assumes that xvalues and yvalues
|
||||||
|
// have been pulled from a pricing service.
|
||||||
|
graph := chart.Chart{
|
||||||
|
Width: 1024,
|
||||||
|
Height: 400,
|
||||||
|
Axes: chart.Style{
|
||||||
|
Show: true,
|
||||||
|
},
|
||||||
|
FinalValueLabel: chart.Style{
|
||||||
|
Show: true,
|
||||||
|
},
|
||||||
|
Series: []chart.Series{
|
||||||
|
chart.TimeSeries{
|
||||||
|
XValues: xvalues,
|
||||||
|
YValues: yvalues,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
graph.Render(chart.PNG, buffer) //thats it!
|
||||||
|
```
|
||||||
|
|
||||||
|
The Key areas to note are that we have to explicitly turn on two features, the axes and the last value label.
|
||||||
|
|
||||||
|
# Design Philosophy
|
||||||
|
|
||||||
|
I wanted to make a charting library that used only native golang, that could be stood up on a server (i.e. it had built in fonts).
|
||||||
|
|
||||||
|
The goal with the API itself is to have the "zero value be useful", and to require the user to not code more than they absolutely needed.
|
||||||
|
|
||||||
|
# Contributions
|
||||||
|
|
||||||
|
This library is super early but contributions are welcome.
|
BIN
images/goog_ltm.png
Normal file
BIN
images/goog_ltm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
Loading…
Reference in a new issue