Compare commits
5 commits
wcharczuk-
...
main
Author | SHA1 | Date | |
---|---|---|---|
63f0be79dd | |||
1f6d76e8b5 | |||
cc8d36edd9 | |||
bd2b44aa38 | |||
|
b46667ea80 |
93 changed files with 227 additions and 173 deletions
1
LICENSE
1
LICENSE
|
@ -1,6 +1,7 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2016 William Charczuk.
|
Copyright (c) 2016 William Charczuk.
|
||||||
|
Copyright (c) 2024 Zeni Kim.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
21
README.md
21
README.md
|
@ -1,8 +1,9 @@
|
||||||
go-chart
|
go-chart
|
||||||
========
|
========
|
||||||
[![Continuous Integration](https://github.com/wcharczuk/go-chart/actions/workflows/ci.yml/badge.svg)](https://github.com/wcharczuk/go-chart/actions/workflows/ci.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/wcharczuk/go-chart)](https://goreportcard.com/report/github.com/wcharczuk/go-chart)
|
|
||||||
|
|
||||||
Package `chart` is a very simple golang native charting library that supports timeseries and continuous line charts.
|
This project starts from a full copy from [https://git.smarteching.com/zeni/go-chart](https://git.smarteching.com/zeni/go-chart). 28 Oct 2024.
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
Master should now be on the v3.x codebase, which overhauls the api significantly. Per usual, see `examples` for more information.
|
Master should now be on the v3.x codebase, which overhauls the api significantly. Per usual, see `examples` for more information.
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ Master should now be on the v3.x codebase, which overhauls the api significantly
|
||||||
To install `chart` run the following:
|
To install `chart` run the following:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
> go get github.com/wcharczuk/go-chart/v2@latest
|
> go get git.smarteching.com/zeni/go-chart/v2@latest
|
||||||
```
|
```
|
||||||
|
|
||||||
Most of the components are interchangeable so feel free to crib whatever you want.
|
Most of the components are interchangeable so feel free to crib whatever you want.
|
||||||
|
@ -20,27 +21,27 @@ Most of the components are interchangeable so feel free to crib whatever you wan
|
||||||
|
|
||||||
Spark Lines:
|
Spark Lines:
|
||||||
|
|
||||||
![](https://raw.githubusercontent.com/wcharczuk/go-chart/master/_images/tvix_ltm.png)
|
![](https://git.smarteching.com/zeni/go-chart/raw/branch/main/_images/tvix_ltm.png)
|
||||||
|
|
||||||
Single axis:
|
Single axis:
|
||||||
|
|
||||||
![](https://raw.githubusercontent.com/wcharczuk/go-chart/master/_images/goog_ltm.png)
|
![](https://git.smarteching.com/zeni/go-chart/raw/branch/main/_images/goog_ltm.png)
|
||||||
|
|
||||||
Two axis:
|
Two axis:
|
||||||
|
|
||||||
![](https://raw.githubusercontent.com/wcharczuk/go-chart/master/_images/two_axis.png)
|
![](https://git.smarteching.com/zeni/go-chart/raw/branch/main/_images/two_axis.png)
|
||||||
|
|
||||||
# Other Chart Types
|
# Other Chart Types
|
||||||
|
|
||||||
Pie Chart:
|
Pie Chart:
|
||||||
|
|
||||||
![](https://raw.githubusercontent.com/wcharczuk/go-chart/master/_images/pie_chart.png)
|
![](https://git.smarteching.com/zeni/go-chart/raw/branch/main/_images/pie_chart.png)
|
||||||
|
|
||||||
The code for this chart can be found in `examples/pie_chart/main.go`.
|
The code for this chart can be found in `examples/pie_chart/main.go`.
|
||||||
|
|
||||||
Stacked Bar:
|
Stacked Bar:
|
||||||
|
|
||||||
![](https://raw.githubusercontent.com/wcharczuk/go-chart/master/_images/stacked_bar.png)
|
![](https://git.smarteching.com/zeni/go-chart/raw/branch/main/_images/stacked_bar.png)
|
||||||
|
|
||||||
The code for this chart can be found in `examples/stacked_bar/main.go`.
|
The code for this chart can be found in `examples/stacked_bar/main.go`.
|
||||||
|
|
||||||
|
@ -48,6 +49,8 @@ The code for this chart can be found in `examples/stacked_bar/main.go`.
|
||||||
|
|
||||||
Actual chart configurations and examples can be found in the `./examples/` directory. They are simple CLI programs that write to `output.png` (they are also updated with `go generate`.
|
Actual chart configurations and examples can be found in the `./examples/` directory. They are simple CLI programs that write to `output.png` (they are also updated with `go generate`.
|
||||||
|
|
||||||
|
If folder ends in "web", has web servers, so start them with `go run main.go` then access `http://localhost:8080` to see the output.
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
Everything starts with the `chart.Chart` object. The bare minimum to draw a chart would be the following:
|
Everything starts with the `chart.Chart` object. The bare minimum to draw a chart would be the following:
|
||||||
|
@ -58,7 +61,7 @@ import (
|
||||||
...
|
...
|
||||||
"bytes"
|
"bytes"
|
||||||
...
|
...
|
||||||
"github.com/wcharczuk/go-chart/v2" //exposes "chart"
|
"git.smarteching.com/zeni/go-chart/v2" //exposes "chart"
|
||||||
)
|
)
|
||||||
|
|
||||||
graph := chart.Chart{
|
graph := chart.Chart{
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"image/color"
|
"image/color"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAnnotationSeriesMeasure(t *testing.T) {
|
func TestAnnotationSeriesMeasure(t *testing.T) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBarChartRender(t *testing.T) {
|
func TestBarChartRender(t *testing.T) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBollingerBandSeries(t *testing.T) {
|
func TestBollingerBandSeries(t *testing.T) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBoxClone(t *testing.T) {
|
func TestBoxClone(t *testing.T) {
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestChartGetDPI(t *testing.T) {
|
func TestChartGetDPI(t *testing.T) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package chart
|
package chart
|
||||||
|
|
||||||
import "github.com/wcharczuk/go-chart/v2/drawing"
|
import "git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ColorWhite is white.
|
// ColorWhite is white.
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConcatSeries(t *testing.T) {
|
func TestConcatSeries(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRangeTranslate(t *testing.T) {
|
func TestRangeTranslate(t *testing.T) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestContinuousSeries(t *testing.T) {
|
func TestContinuousSeries(t *testing.T) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDonutChart(t *testing.T) {
|
func TestDonutChart(t *testing.T) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
|
|
||||||
"image/color"
|
"image/color"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestColorFromHex(t *testing.T) {
|
func TestColorFromHex(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package drawing
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
type point struct {
|
type point struct {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
chart "github.com/wcharczuk/go-chart/v2"
|
chart "git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
chart "github.com/wcharczuk/go-chart/v2"
|
chart "git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
@ -5,8 +5,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
55
examples/bar_chart_web/main.go
Normal file
55
examples/bar_chart_web/main.go
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
//go:generate go run main.go
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func drawChart(res http.ResponseWriter, req *http.Request) {
|
||||||
|
graph := chart.BarChart{
|
||||||
|
Title: "Test Bar Chart",
|
||||||
|
Background: chart.Style{
|
||||||
|
Padding: chart.Box{
|
||||||
|
Top: 40,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Height: 512,
|
||||||
|
BarWidth: 60,
|
||||||
|
Bars: []chart.Value{
|
||||||
|
{Value: 5.25, Label: "Blue"},
|
||||||
|
{Value: 4.88, Label: "Green"},
|
||||||
|
{Value: 4.74, Label: "Gray"},
|
||||||
|
{Value: 3.22, Label: "Orange"},
|
||||||
|
{Value: 3, Label: "Test"},
|
||||||
|
{Value: 2.27, Label: "??"},
|
||||||
|
{Value: 1, Label: "!!"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
res.Header().Set("Content-Type", "image/png")
|
||||||
|
err := graph.Render(chart.PNG, res)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Error rendering chart: %v\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func port() string {
|
||||||
|
if len(os.Getenv("PORT")) > 0 {
|
||||||
|
return os.Getenv("PORT")
|
||||||
|
}
|
||||||
|
return "8080"
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
listenPort := fmt.Sprintf(":%s", port())
|
||||||
|
fmt.Printf("Listening on %s\n", listenPort)
|
||||||
|
http.HandleFunc("/", drawChart)
|
||||||
|
log.Fatal(http.ListenAndServe(listenPort, nil))
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func random(min, max float64) float64 {
|
func random(min, max float64) float64 {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Note: Additional examples on how to add Stylesheets are in the custom_stylesheets example
|
// Note: Additional examples on how to add Stylesheets are in the custom_stylesheets example
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,8 +5,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,8 +5,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const style = "svg .background { fill: white; }" +
|
const style = "svg .background { fill: white; }" +
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
chart "github.com/wcharczuk/go-chart/v2"
|
chart "git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
chart "github.com/wcharczuk/go-chart/v2"
|
chart "git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
55
examples/pie_chart_web/main.go
Normal file
55
examples/pie_chart_web/main.go
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func drawChart(res http.ResponseWriter, req *http.Request) {
|
||||||
|
pie := chart.PieChart{
|
||||||
|
Width: 512,
|
||||||
|
Height: 512,
|
||||||
|
Values: []chart.Value{
|
||||||
|
{Value: 5, Label: "Blue"},
|
||||||
|
{Value: 5, Label: "Green"},
|
||||||
|
{Value: 4, Label: "Gray"},
|
||||||
|
{Value: 4, Label: "Orange"},
|
||||||
|
{Value: 3, Label: "Deep Blue"},
|
||||||
|
{Value: 3, Label: "??"},
|
||||||
|
{Value: 1, Label: "!!"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
res.Header().Set("Content-Type", "image/png")
|
||||||
|
err := pie.Render(chart.PNG, res)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Error rendering pie chart: %v\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func drawChartRegression(res http.ResponseWriter, req *http.Request) {
|
||||||
|
pie := chart.PieChart{
|
||||||
|
Width: 512,
|
||||||
|
Height: 512,
|
||||||
|
Values: []chart.Value{
|
||||||
|
{Value: 5, Label: "Blue"},
|
||||||
|
{Value: 2, Label: "Two"},
|
||||||
|
{Value: 1, Label: "One"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
res.Header().Set("Content-Type", chart.ContentTypeSVG)
|
||||||
|
err := pie.Render(chart.SVG, res)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Error rendering pie chart: %v\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
http.HandleFunc("/", drawChart)
|
||||||
|
http.HandleFunc("/reg", drawChartRegression)
|
||||||
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
chart "github.com/wcharczuk/go-chart/v2"
|
chart "git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var lock sync.Mutex
|
var lock sync.Mutex
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
|
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func drawChart(res http.ResponseWriter, req *http.Request) {
|
func drawChart(res http.ResponseWriter, req *http.Request) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,8 +3,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -5,8 +5,8 @@ package main
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
chart "github.com/wcharczuk/go-chart/v2"
|
chart "git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func drawChart(res http.ResponseWriter, req *http.Request) {
|
func drawChart(res http.ResponseWriter, req *http.Request) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"git.smarteching.com/zeni/go-chart/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFirstValueAnnotation(t *testing.T) {
|
func TestFirstValueAnnotation(t *testing.T) {
|
||||||
|
|
2
font.go
2
font.go
|
@ -3,8 +3,8 @@ package chart
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"git.smarteching.com/zeni/go-chart/v2/roboto"
|
||||||
"github.com/golang/freetype/truetype"
|
"github.com/golang/freetype/truetype"
|
||||||
"github.com/wcharczuk/go-chart/v2/roboto"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
6
go.mod
6
go.mod
|
@ -1,8 +1,8 @@
|
||||||
module github.com/wcharczuk/go-chart/v2
|
module git.smarteching.com/zeni/go-chart/v2
|
||||||
|
|
||||||
go 1.15
|
go 1.23.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
||||||
golang.org/x/image v0.18.0
|
golang.org/x/image v0.21.0
|
||||||
)
|
)
|
||||||
|
|
64
go.sum
64
go.sum
|
@ -1,64 +1,4 @@
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
|
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
|
||||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
|
||||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
|
||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
|
||||||
golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
|
|
||||||
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
|
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
|
||||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
|
||||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
|
||||||
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
|
||||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
|
||||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
|
||||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
|
||||||
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
|
||||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
|
||||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
|
||||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
|
||||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
||||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
|
||||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
|
||||||
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
|
||||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
|
||||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
|
||||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
|
||||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
|
||||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
|
||||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
|
||||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
|
||||||
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
|
|
||||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGenerateGridLines(t *testing.T) {
|
func TestGenerateGridLines(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHistogramSeries(t *testing.T) {
|
func TestHistogramSeries(t *testing.T) {
|
||||||
|
|
2
jet.go
2
jet.go
|
@ -1,6 +1,6 @@
|
||||||
package chart
|
package chart
|
||||||
|
|
||||||
import "github.com/wcharczuk/go-chart/v2/drawing"
|
import "git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
|
|
||||||
// Jet is a color map provider based on matlab's jet color map.
|
// Jet is a color map provider based on matlab's jet color map.
|
||||||
func Jet(v, vmin, vmax float64) drawing.Color {
|
func Jet(v, vmin, vmax float64) drawing.Color {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLastValueAnnotationSeries(t *testing.T) {
|
func TestLastValueAnnotationSeries(t *testing.T) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package chart
|
package chart
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Legend returns a legend renderable function.
|
// Legend returns a legend renderable function.
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLegend(t *testing.T) {
|
func TestLegend(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLinearRegressionSeries(t *testing.T) {
|
func TestLinearRegressionSeries(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLogRangeTranslate(t *testing.T) {
|
func TestLogRangeTranslate(t *testing.T) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -3,7 +3,7 @@ package matrix
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNew(t *testing.T) {
|
func TestNew(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package matrix
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPoly(t *testing.T) {
|
func TestPoly(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPercentageDifferenceSeries(t *testing.T) {
|
func TestPercentageDifferenceSeries(t *testing.T) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPieChart(t *testing.T) {
|
func TestPieChart(t *testing.T) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/matrix"
|
"git.smarteching.com/zeni/go-chart/v2/matrix"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Interface Assertions.
|
// Interface Assertions.
|
||||||
|
|
|
@ -3,8 +3,8 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/matrix"
|
"git.smarteching.com/zeni/go-chart/v2/matrix"
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPolynomialRegression(t *testing.T) {
|
func TestPolynomialRegression(t *testing.T) {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
"github.com/golang/freetype/truetype"
|
"github.com/golang/freetype/truetype"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// PNG returns a new png/raster renderer.
|
// PNG returns a new png/raster renderer.
|
||||||
|
|
|
@ -3,8 +3,8 @@ package chart
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
"github.com/golang/freetype/truetype"
|
"github.com/golang/freetype/truetype"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Renderer represents the basic methods required to draw a chart.
|
// Renderer represents the basic methods required to draw a chart.
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSeqEach(t *testing.T) {
|
func TestSeqEach(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockValuesProvider struct {
|
type mockValuesProvider struct {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSplitCSV(t *testing.T) {
|
func TestSplitCSV(t *testing.T) {
|
||||||
|
|
2
style.go
2
style.go
|
@ -4,8 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
"github.com/golang/freetype/truetype"
|
"github.com/golang/freetype/truetype"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -3,9 +3,9 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
"github.com/golang/freetype/truetype"
|
"github.com/golang/freetype/truetype"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestStyleIsZero(t *testing.T) {
|
func TestStyleIsZero(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTextWrapWord(t *testing.T) {
|
func TestTextWrapWord(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGenerateContinuousTicks(t *testing.T) {
|
func TestGenerateContinuousTicks(t *testing.T) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTimeSeriesGetValue(t *testing.T) {
|
func TestTimeSeriesGetValue(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuffer(t *testing.T) {
|
func TestBuffer(t *testing.T) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTimeValueFormatterWithFormat(t *testing.T) {
|
func TestTimeValueFormatterWithFormat(t *testing.T) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package chart
|
package chart
|
||||||
|
|
||||||
import "github.com/wcharczuk/go-chart/v2/drawing"
|
import "git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
|
|
||||||
// ValuesProvider is a type that produces values.
|
// ValuesProvider is a type that produces values.
|
||||||
type ValuesProvider interface {
|
type ValuesProvider interface {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestValuesValues(t *testing.T) {
|
func TestValuesValues(t *testing.T) {
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
"golang.org/x/image/font"
|
"golang.org/x/image/font"
|
||||||
|
|
||||||
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
"github.com/golang/freetype/truetype"
|
"github.com/golang/freetype/truetype"
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SVG returns a new png/raster renderer.
|
// SVG returns a new png/raster renderer.
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/drawing"
|
"git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestVectorRendererPath(t *testing.T) {
|
func TestVectorRendererPath(t *testing.T) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package chart
|
package chart
|
||||||
|
|
||||||
import "github.com/wcharczuk/go-chart/v2/drawing"
|
import "git.smarteching.com/zeni/go-chart/v2/drawing"
|
||||||
|
|
||||||
var viridisColors = [256]drawing.Color{
|
var viridisColors = [256]drawing.Color{
|
||||||
{R: 0x44, G: 0x1, B: 0x54, A: 0xff},
|
{R: 0x44, G: 0x1, B: 0x54, A: 0xff},
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestXAxisGetTicks(t *testing.T) {
|
func TestXAxisGetTicks(t *testing.T) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package chart
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/wcharczuk/go-chart/v2/testutil"
|
"git.smarteching.com/zeni/go-chart/v2/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestYAxisGetTicks(t *testing.T) {
|
func TestYAxisGetTicks(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue