Documentation
¶
Overview ¶
Package chart is a bar, line or area chart. The server draws the chart as SVG and renders the data as a table for a screen reader. The ChartCanvas island adds the tooltip, the highlight and keyboard focus.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ChartFixtures = gx.Fixtures[ChartProps]{ "Bar": {Id: "chart-bar", Title: "Visitors", Categories: months, Series: visitors}, "Line": {Id: "chart-line", Title: "Visitors", Kind: Line, Categories: months, Series: visitors}, "Area": {Id: "chart-area", Title: "Visitors", Kind: Area, Categories: months, Series: desktop}, "Year": {Id: "chart-year", Title: "Revenue", Categories: year, Series: revenue}, }
Functions ¶
func Chart ¶
func Chart(p ChartProps) gx.Node
func ChartCanvas ¶
func ChartCanvas(p ChartCanvasProps, opts ...gx.IslandOption) gx.Node
ChartCanvas renders the island of ChartCanvas.ts (REQ-ISL-01). The browser mounts it with the props as JSON. An option sets the time of the load.
Types ¶
type ChartCanvasProps ¶
type ChartCanvasProps struct {
// Categories are the labels of the horizontal axis.
Categories []string `json:"categories"`
// Series are the rows of numbers that the tooltip shows.
Series []Series `json:"series"`
// TooltipClass holds the classes of the tooltip. It is a Go constant, so
// the stylesheet build sees it.
TooltipClass string `json:"tooltipClass"`
}
ChartCanvasProps are the props of the island that adds the tooltip, the highlight and keyboard focus to the SVG of the server.
type ChartProps ¶
type ChartProps struct {
// Id is the id of the root element.
Id string
// Title is the caption of the chart and its accessible name.
Title string
// Kind sets the drawing: Bar, Line or Area.
Kind Kind
// Categories are the labels of the horizontal axis, in order.
Categories []string
// Series are the rows of numbers: one value for each category.
Series []Series
// Class adds classes to the root element.
Class string
// Attrs adds HTML attributes to the root element.
Attrs gx.Attrs
}