heatmap

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package heatmap contains a widget that displays heat maps.

Index

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. The larger the value, the darker the color of the cell (from white to black).

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 New

func New(opts ...Option) (*HeatMap, error)

New returns a new HeatMap widget.

func (*HeatMap) ClearXLabels

func (hp *HeatMap) ClearXLabels()

ClearXLabels clear the X labels.

func (*HeatMap) ClearYLabels

func (hp *HeatMap) ClearYLabels()

ClearYLabels clear the Y labels.

func (*HeatMap) Draw

func (hp *HeatMap) Draw(cvs *canvas.Canvas, meta *widgetapi.Meta) error

Draw draws cells, X labels and Y labels as HeatMap. Implements widgetapi.Widget.Draw.

func (*HeatMap) Keyboard

func (*HeatMap) Keyboard(k *terminalapi.Keyboard, meta *widgetapi.EventMeta) error

Keyboard input isn't supported on the HeatMap widget.

func (*HeatMap) Mouse

func (*HeatMap) Mouse(m *terminalapi.Mouse, meta *widgetapi.EventMeta) error

Mouse input isn't supported on the HeatMap widget.

func (*HeatMap) Options

func (hp *HeatMap) Options() widgetapi.Options

Options implements widgetapi.Widget.Options.

func (*HeatMap) ValueCapacity

func (hp *HeatMap) ValueCapacity() int

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 CellWidth

func CellWidth(w int) Option

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 XLabelCellOpts

func XLabelCellOpts(co ...cell.Option) Option

XLabelCellOpts set the cell options for the labels on the X axis.

func YLabelCellOpts

func YLabelCellOpts(co ...cell.Option) Option

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL