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.
type Graph ¶
type Graph interface {
// Packages returns the Google javascript packages this graph depends on
Packages() []string
// WriteCode writes the code within the drawCharts() function that draws
// this graph. name is the id of the div tag where this graph will go.
// When Emit or MustEmit calls this, it provides a w that also implements
// io.ByteWriter and io.StringWriter.
WriteCode(name string, w io.Writer) error
}
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.
Click to show internal directories.
Click to hide internal directories.