c3

package
v0.0.0-...-b425644 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Spline = "spline"
View Source
const TimeSeries = "timeseries"

columns: [

['x', '2013-01-01', '2013-01-02', '2013-01-03', '2013-01-04', '2013-01-05', '2013-01-06'],
// ['x', '20130101', '20130102', '20130103', '20130104', '20130105', '20130106'],
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 340, 200, 500, 250, 350]

]

Variables

This section is empty.

Functions

This section is empty.

Types

type Axis

type Axis struct {
	Min  *int     `json:"min,omitempty"`
	Max  *int     `json:"max,omitempty"`
	Type AxisType `json:"type,omitempty"` // timeseries
	Tick *Tick    `json:"tick,omitempty"`
}

type AxisType

type AxisType string

type Bar

type Bar struct {
	Width interface{} // "100 or { ration: 0.5 }
}

type Chart

type Chart struct {
	Width   int              `json:"-"`
	Height  int              `json:"-"`
	BindTo  string           `json:"bindto,omitempty"`
	Data    *Data            `json:"data,omitempty"`
	Donut   *Donut           `json:"donut,omitempty"`
	Axis    map[string]*Axis `json:"axis,omitempty"`
	Tooltip interface{}      `json:"tooltip,omitempty"`
	Bar     *Bar             `json:"bar,omitempty"`
}

func New

func New() *Chart

func NewTimeSeries

func NewTimeSeries(timeFormat string) *Chart

use "%Y-%m-%d %H:%M:%S"

func (*Chart) CSS

func (c *Chart) CSS() template.CSS

func (*Chart) ID

func (c *Chart) ID() (string, error)

func (*Chart) JS

func (c *Chart) JS() (template.JS, error)

func (*Chart) Push

func (cp *Chart) Push(k string, v interface{})

type Data

type Data struct {
	Columns [][]interface{} `json:"columns,omitempty"`
	X       string          `json:"x,omitempty"`
	XFormat string          `json:"xFormat,omitempty"`
	Type    Type            `json:"type,omitempty"` // spline, bar, pie
	Types   map[string]Type `json:"types,omitempty"`
	Groups  [][]string      `json:"groups,omitempty"` // which charts to stack, e.g. [['data1', 'data2']]
}

type Donut

type Donut struct {
	Title string `json:"title,omitempty"`
}

type Ratio

type Ratio struct {
	Ration float64 `json:"ration,omitempty"`
}

type Tick

type Tick struct {
	Format string `json:"format,omitempty"` // %Y-%m-%d
	Count  int    `json:"count,omitempty"`
}

type Type

type Type string //

spline, area, area-spline, bar, pie, donut, gauge (percentages)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL