google_graph

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: BSD-3-Clause Imports: 4 Imported by: 3

Documentation

Overview

package google_graph provides google bar graph and pie graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BarGraph

type BarGraph struct {
	// Palette consists of the RGB colors to use in the bar graph.
	// e.g []String{"FF0000", "00FF00", "0000FF"}
	Palette []string
	// a value of 10^Scale is one unit on bar graph.
	Scale int
}

BarGraph builds a link to a google bar graph.

func (*BarGraph) GraphURL

func (b *BarGraph) GraphURL(gd GraphData) *url.URL

GraphURL returns a link to a bar graph displaying particular graph data. GraphURL returns nil if given graph data of length 0.

func (*BarGraph) GraphURL2D

func (b *BarGraph) GraphURL2D(gd GraphData2D) *url.URL

GraphURL2D returns a link to a bar graph displaying particular graph data. GraphURL2D returns nil if given graph data of length 0 in either dimension.

type GraphData

type GraphData interface {
	// The number of data points.
	Len() int
	// The title
	Title() string
	// The label of the 0-based idx data point.
	Label(idx int) string
	// The value of the 0-based idx data point.
	Value(idx int) int64
}

GraphData represents a dataset to be graphed.

type GraphData2D

type GraphData2D interface {
	// The number of X data points
	XLen() int
	// The number of Y data points
	YLen() int
	// Return 0-based label for X axis
	XLabel(x int) string
	// Return 0-based label for Y axis
	YLabel(y int) string
	// Return value at (x, y)
	Value(x, y int) int64
}

GraphData2D represents a 2D dataset to be graphed.

type Grapher

type Grapher interface {
	GraphURL(gd GraphData) *url.URL
}

Grapher returns the URL for a graph of a dataset.

type Grapher2D

type Grapher2D interface {
	GraphURL2D(gd GraphData2D) *url.URL
}

Grapher2D returns the URL for a graph of a 2D dataset.

type PieGraph

type PieGraph struct {
	// Palette consists of the RGB colors to use in the pie graph.
	// e.g []String{"FF0000", "00FF00", "0000FF"}
	Palette []string
}

PieGraph builds a link to a google pie graph.

func (*PieGraph) GraphURL

func (p *PieGraph) GraphURL(gd GraphData) *url.URL

GraphURL returns a link to a pie graph displaying particular graph data. GraphURL returns nil if given graph data of length 0.

Jump to

Keyboard shortcuts

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