Documentation
¶
Overview ¶
Package heatmap contains a widget that displays heat maps.
Index ¶
- type HeatMap
- func (hp *HeatMap) ClearXLabels()
- func (hp *HeatMap) ClearYLabels()
- func (hp *HeatMap) Draw(cvs *canvas.Canvas, meta *widgetapi.Meta) error
- func (*HeatMap) Keyboard(k *terminalapi.Keyboard, meta *widgetapi.EventMeta) error
- func (*HeatMap) Mouse(m *terminalapi.Mouse, meta *widgetapi.EventMeta) error
- func (hp *HeatMap) Options() widgetapi.Options
- func (hp *HeatMap) ValueCapacity() int
- func (hp *HeatMap) Values(xLabels []string, yLabels []string, values [][]float64, opts ...Option) error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeatMap ¶
type HeatMap struct {
// contains filtered or unexported fields
}
HeatMap draws heat map charts.
Heatmap consists of several cells. Each cell represents a value. By default, larger values appear darker in a grayscale ramp. Call Palette to provide a custom low-to-high color ramp instead.
The two dimensions of the values (cells) array are determined by the length of the xLabels and yLabels arrays respectively.
HeatMap does not support mouse based zoom.
Implements widgetapi.Widget. This object is thread-safe.
func (*HeatMap) Draw ¶
Draw draws cells, X labels and Y labels as HeatMap. Implements widgetapi.Widget.Draw.
func (*HeatMap) ValueCapacity ¶
ValueCapacity returns the number of values that can fit into the canvas. This is essentially the number of available cells on the canvas as observed on the last call to draw. Returns zero if draw wasn't called.
Note that this capacity changes each time the terminal resizes, so there is no guarantee this remains the same next time Draw is called. Should be used as a hint only.
func (*HeatMap) Values ¶
func (hp *HeatMap) Values(xLabels []string, yLabels []string, values [][]float64, opts ...Option) error
Values sets the values to be displayed by the HeatMap.
Each value in values has a xLabel and a yLabel, which means len(yLabels) == len(values) and len(xLabels) == len(values[i]). But labels could be empty strings. When no labels are provided, labels will be "0", "1", "2"...
Each call to Values overwrites any previously provided values. Provided options override values set when New() was called.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is used to provide options.
func AxisCellOpts ¶ added in v0.21.0
AxisCellOpts sets the cell options for the Y-axis rule drawn beside the cells.
func CellWidth ¶
CellWidth set the width of cells (or grids) in the heat map, not the terminal cell. The default height of each cell (grid) is 1 and the width is 3.
func Palette ¶ added in v0.21.0
Palette sets a custom low-to-high color palette for heatmap cells.
When Palette isn't provided, the widget uses the original grayscale mapping. When colors are provided, lower values use earlier colors and higher values use later colors, preserving backward compatibility while allowing a more expressive look.
func SquareCells ¶ added in v0.21.0
func SquareCells() Option
SquareCells configures each heatmap value to use two terminal columns, which reads closer to a square cell on typical terminals where character cells are taller than they are wide.
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.
Directories
¶
| Path | Synopsis |
|---|---|
|
Binary heatmapdemo displays a heatmap widget.
|
Binary heatmapdemo displays a heatmap widget. |
|
internal
|
|
|
axes
Package axes calculates the required layout and draws the X and Y axes of a heat map.
|
Package axes calculates the required layout and draws the X and Y axes of a heat map. |