barchart

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: LGPL-2.1 Imports: 6 Imported by: 0

Documentation

Overview

Package barchart provides BarChart — a simple labeled bar chart (horizontal bars only, with auto-scaling and value annotations).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bar

type Bar struct {
	Label string
	Value float64
	Attr  uint16 // 0 = use default
}

Bar is a labeled value.

type BarChart

type BarChart struct {
	views.Base

	Bars      []Bar
	ShowValue bool
	BarChar   rune
	BackChar  rune
	BarAttr   uint16
	BackAttr  uint16
	LabelAttr uint16
	ValueAttr uint16
}

BarChart renders a stack of horizontal bars filling a column block. Label is left-aligned, then the bar fills the remaining width proportional to Value / max(Values), then a numeric annotation.

func New

func New(bounds geom.Rect) *BarChart

New constructs a BarChart with no bars.

func (*BarChart) Draw

func (b *BarChart) Draw()

Draw paints the bars.

func (*BarChart) GetTypeID

func (b *BarChart) GetTypeID() string

GetTypeID for serial registry.

func (*BarChart) SetBars

func (b *BarChart) SetBars(bars []Bar)

SetBars replaces the data.

Jump to

Keyboard shortcuts

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