Documentation
¶
Overview ¶
package google_jsgraph provides google javascript bar graph and pie graph.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BarGraph ¶
type BarGraph struct {
// The graph data
Data GraphData
// Palette consists of the RGB colors to use in the bar graph.
// e.g []String{"FF0000", "00FF00", "0000FF"}
Palette []string
}
BarGraph represents a bar graph.
func (*BarGraph) EmitPackages ¶
type Graph ¶
type Graph interface {
// Emits the package names this graph depends on to the packages map.
EmitPackages(packages map[string]struct{})
// Emits the the code within the drawCharts() function that draws this
// graph.
EmitCode(name string, sb *strings.Builder)
}
Graph represents a Google javascript graph
type GraphData ¶
type GraphData interface {
// The number of X data points
XLen() int
// The number of Y data points
YLen() int
// The title of the X labels
XTitle() string
// 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) float64
}
GraphData represents a dataset to be graphed.
type PieGraph ¶
type PieGraph struct {
// The graph data. YLen should be 1.
Data GraphData
// Optional: Palette consists of the RGB colors to use in the pie graph.
// e.g []String{"FF0000", "00FF00", "0000FF"}. If omitted, Google chooses
// the palette.
Palette []string
}
PieGraph represents a pie graph.
func (*PieGraph) EmitPackages ¶
Click to show internal directories.
Click to hide internal directories.