Documentation ¶
Overview ¶
Package linechart contains a widget that displays line charts.
Index ¶
- type LineChart
- func (lc *LineChart) Draw(cvs *canvas.Canvas) error
- func (lc *LineChart) Keyboard(k *terminalapi.Keyboard) error
- func (lc *LineChart) Mouse(m *terminalapi.Mouse) error
- func (lc *LineChart) Options() widgetapi.Options
- func (lc *LineChart) Series(label string, values []float64, opts ...SeriesOption) error
- type Option
- type SeriesOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LineChart ¶
type LineChart struct {
// contains filtered or unexported fields
}
LineChart draws line charts.
Each line chart has an identifying label and a set of values that are plotted.
The size of the two axes is determined from the values. The X axis will have a number of evenly distributed data points equal to the largest count of values among all the labeled line charts. The Y axis will be sized so that it can conveniently accommodate the largest value among all the labeled line charts. This determines the used scale.
Implements widgetapi.Widget. This object is thread-safe.
func (*LineChart) Keyboard ¶
func (lc *LineChart) Keyboard(k *terminalapi.Keyboard) error
Implements widgetapi.Widget.Keyboard.
func (*LineChart) Mouse ¶
func (lc *LineChart) Mouse(m *terminalapi.Mouse) error
Implements widgetapi.Widget.Mouse.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is used to provide options to New().
func AxesCellOpts ¶
AxesCellOpts set the cell options for the X and Y axes.
func XLabelCellOpts ¶
XLabelCellOpts set the cell options for the labels on the X axis.
func YLabelCellOpts ¶
YLabelCellOpts set the cell options for the labels on the Y axis.
type SeriesOption ¶
type SeriesOption interface {
// contains filtered or unexported methods
}
SeriesOption is used to provide options to Series.
func SeriesCellOpts ¶
func SeriesCellOpts(co ...cell.Option) SeriesOption
SeriesCellOpts sets the cell options for this series. Note that the braille canvas has resolution of 2x4 pixels per cell, but each cell can only have one set of cell options set. Meaning that where series share a cell, the last drawn series sets the cell options. Series are drawn in alphabetical order based on their name.
func SeriesXLabels ¶
func SeriesXLabels(labels map[int]string) SeriesOption
SeriesXLabels is used to provide custom labels for the X axis. The argument maps the positions in the provided series to the desired label. The labels are only used if they fit under the axis. Custom labels are property of the line chart, since there is only one X axis, providing multiple custom labels overwrites the previous value.
Directories ¶
Path | Synopsis |
---|---|
Package axes calculates the required layout and draws the X and Y axes of a line chart.
|
Package axes calculates the required layout and draws the X and Y axes of a line chart. |
Binary linechartdemo displays a linechart widget.
|
Binary linechartdemo displays a linechart widget. |