func WithAddr(addr string) Option {
	return func(c *config) {
		c.ListenAddr = addr
		c.LinkAddr = addr
	}
}
WithAddr sets the listening address and link address
package viewer
import (
	"bytes"
	"context"
	"fmt"
	"net/http"
	"runtime"
	"strconv"
	"text/template"
	"time"
	"github.com/go-echarts/go-echarts/v2/charts"
	"github.com/go-echarts/go-echarts/v2/opts"
	"github.com/go-echarts/go-echarts/v2/types"
)
type Metrics struct {
	Values []float64 `json:"values"`
	Time   string    `json:"time"`
}
type config struct {
	Interval   int
	MaxPoints  int
	Template   string
	ListenAddr string
	LinkAddr   string
	TimeFormat string
	Theme      Theme
}
type Theme string
const (
	ThemeWesteros Theme = types.ThemeWesteros
	ThemeMacarons Theme = types.ThemeMacarons
)
const (
	DefaultTemplate = `
$(function () { setInterval({{ .ViewID }}_sync, {{ .Interval }}); });
function {{ .ViewID }}_sync() {
    $.ajax({
        type: "GET",
        url: "http://{{ .Addr }}/debug/statsview/view/{{ .Route }}",
        dataType: "json",
        success: function (result) {
            let opt = goecharts_{{ .ViewID }}.getOption();
            let x = opt.xAxis[0].data;
            x.push(result.time);
            if (x.length > {{ .MaxPoints }}) {
                x = x.slice(1);
            }
            opt.xAxis[0].data = x;
            for (let i = 0; i < result.values.length; i++) {
                let y = opt.series[i].data;
                y.push({ value: result.values[i] });
                if (y.length > {{ .MaxPoints }}) {
                    y = y.slice(1);
                }
                opt.series[i].data = y;
                goecharts_{{ .ViewID }}.setOption(opt);
            }
        }
    });
}`
	DefaultMaxPoints  = 30
	DefaultTimeFormat = "15:04:05"
	DefaultInterval   = 2000
	DefaultAddr       = "localhost:18066"
	DefaultTheme      = ThemeMacarons
)
var defaultCfg = &config{
	Interval:   DefaultInterval,
	MaxPoints:  DefaultMaxPoints,
	Template:   DefaultTemplate,
	ListenAddr: DefaultAddr,
	LinkAddr:   DefaultAddr,
	TimeFormat: DefaultTimeFormat,
	Theme:      DefaultTheme,
}
type Option func(c *config)
func Addr() string {
	return defaultCfg.ListenAddr
}
func LinkAddr() string {
	return defaultCfg.LinkAddr
}
func Interval() int {
	return defaultCfg.Interval
}
func WithInterval(interval int) Option {
	return func(c *config) {
		c.Interval = interval
	}
}
func WithMaxPoints(n int) Option {
	return func(c *config) {
		c.MaxPoints = n
	}
}
func WithTemplate(t string) Option {
	return func(c *config) {
		c.Template = t
	}
}