Documentation
¶
Overview ¶
Package chart provides braille chart rendering functionality
This package implements high-resolution braille chart rendering for terminal displays. It creates split-axis charts with upload data below and download data above a central axis, using Unicode braille characters for detailed visualization.
Package chart provides data management functionality for braille charts ¶
Package chart provides rendering functionality for braille charts ¶
Package chart provides scaling functionality for braille charts ¶
Package chart provides gradient and styling functionality for braille charts ¶
Package chart provides braille chart rendering functionality
Index ¶
- Constants
- type BrailleChart
- func (bc *BrailleChart) AddDataPoint(upload, download uint64)
- func (bc *BrailleChart) CycleScalingMode() ScalingMode
- func (bc *BrailleChart) CycleTimeScale() TimeScale
- func (bc *BrailleChart) GetDataLength() int
- func (bc *BrailleChart) GetMaxValue() uint64
- func (bc *BrailleChart) GetScalingMode() ScalingMode
- func (bc *BrailleChart) GetScalingModeName() string
- func (bc *BrailleChart) GetTimeScale() TimeScale
- func (bc *BrailleChart) GetTimeScaleMaxPoints() int
- func (bc *BrailleChart) GetTimeScaleName() string
- func (bc *BrailleChart) GetTimeScaleSeconds() int
- func (bc *BrailleChart) GetWidth() int
- func (bc *BrailleChart) IsOverlayMode() bool
- func (bc *BrailleChart) Render() string
- func (bc *BrailleChart) Reset()
- func (bc *BrailleChart) SetHeight(height int)
- func (bc *BrailleChart) SetMaxPoints(maxPoints int)
- func (bc *BrailleChart) SetOverlayMode(enabled bool)
- func (bc *BrailleChart) SetScalingMode(mode ScalingMode)
- func (bc *BrailleChart) SetTimeScale(timeScale TimeScale)
- func (bc *BrailleChart) SetWidth(width int)
- func (bc *BrailleChart) ToggleOverlayMode()
- type ColorGradient
- type DataPoint
- type ScalingMode
- type TimeScale
Constants ¶
const ( // Chart configuration constants MinChartHeight = 8 // Minimum chart height in rows )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrailleChart ¶
type BrailleChart struct {
// contains filtered or unexported fields
}
BrailleChart creates beautiful braille-based charts for terminal display
func NewBrailleChart ¶
func NewBrailleChart(maxPoints int) *BrailleChart
NewBrailleChart creates a new braille chart
func (*BrailleChart) AddDataPoint ¶
func (bc *BrailleChart) AddDataPoint(upload, download uint64)
AddDataPoint adds a new data point to the chart
func (*BrailleChart) CycleScalingMode ¶ added in v1.3.0
func (bc *BrailleChart) CycleScalingMode() ScalingMode
CycleScalingMode cycles through available scaling modes
func (*BrailleChart) CycleTimeScale ¶ added in v1.4.0
func (bc *BrailleChart) CycleTimeScale() TimeScale
CycleTimeScale cycles through available time scales
func (*BrailleChart) GetDataLength ¶
func (bc *BrailleChart) GetDataLength() int
GetDataLength returns the number of data points currently stored
func (*BrailleChart) GetMaxValue ¶
func (bc *BrailleChart) GetMaxValue() uint64
GetMaxValue returns the current maximum value for scaling
func (*BrailleChart) GetScalingMode ¶ added in v1.3.0
func (bc *BrailleChart) GetScalingMode() ScalingMode
GetScalingMode returns the current scaling mode
func (*BrailleChart) GetScalingModeName ¶ added in v1.3.0
func (bc *BrailleChart) GetScalingModeName() string
GetScalingModeName returns a human-readable name for the current scaling mode
func (*BrailleChart) GetTimeScale ¶ added in v1.4.0
func (bc *BrailleChart) GetTimeScale() TimeScale
GetTimeScale returns the current time scale
func (*BrailleChart) GetTimeScaleMaxPoints ¶ added in v1.4.0
func (bc *BrailleChart) GetTimeScaleMaxPoints() int
GetTimeScaleMaxPoints calculates the maximum data points needed for the current time scale Given that data is collected every 500ms (0.5 seconds), we need 2 points per second
func (*BrailleChart) GetTimeScaleName ¶ added in v1.4.0
func (bc *BrailleChart) GetTimeScaleName() string
GetTimeScaleName returns a human-readable name for the current time scale
func (*BrailleChart) GetTimeScaleSeconds ¶ added in v1.4.0
func (bc *BrailleChart) GetTimeScaleSeconds() int
GetTimeScaleSeconds returns the number of seconds for the current time scale
func (*BrailleChart) GetWidth ¶ added in v1.4.0
func (bc *BrailleChart) GetWidth() int
GetWidth returns the chart width
func (*BrailleChart) IsOverlayMode ¶ added in v1.1.0
func (bc *BrailleChart) IsOverlayMode() bool
IsOverlayMode returns true if overlay mode is enabled
func (*BrailleChart) Render ¶
func (bc *BrailleChart) Render() string
Render renders the braille chart as a string
func (*BrailleChart) Reset ¶
func (bc *BrailleChart) Reset()
Reset clears all data points and resets the chart
func (*BrailleChart) SetHeight ¶
func (bc *BrailleChart) SetHeight(height int)
SetHeight sets the chart height
func (*BrailleChart) SetMaxPoints ¶ added in v1.2.1
func (bc *BrailleChart) SetMaxPoints(maxPoints int)
SetMaxPoints updates the maximum number of data points to maintain If reducing the limit, excess data is trimmed from the beginning
func (*BrailleChart) SetOverlayMode ¶ added in v1.1.0
func (bc *BrailleChart) SetOverlayMode(enabled bool)
SetOverlayMode sets the display mode
func (*BrailleChart) SetScalingMode ¶ added in v1.3.0
func (bc *BrailleChart) SetScalingMode(mode ScalingMode)
SetScalingMode sets the scaling mode for the chart
func (*BrailleChart) SetTimeScale ¶ added in v1.4.0
func (bc *BrailleChart) SetTimeScale(timeScale TimeScale)
SetTimeScale sets the time scale directly (for debugging)
func (*BrailleChart) SetWidth ¶
func (bc *BrailleChart) SetWidth(width int)
SetWidth sets the chart width
func (*BrailleChart) ToggleOverlayMode ¶ added in v1.1.0
func (bc *BrailleChart) ToggleOverlayMode()
ToggleOverlayMode toggles between split axis and overlay mode
type ColorGradient ¶ added in v1.3.0
ColorGradient represents a color gradient configuration
type ScalingMode ¶ added in v1.3.0
type ScalingMode int
ScalingMode defines how the chart scales data
const ( ScalingLinear ScalingMode = iota ScalingLogarithmic ScalingSquareRoot )
type TimeScale ¶ added in v1.4.0
type TimeScale int
TimeScale defines the time window for data display
const ( TimeScale1Min TimeScale = iota // 1 minute (60 seconds) TimeScale3Min // 3 minutes (180 seconds) TimeScale5Min // 5 minutes (300 seconds) TimeScale10Min // 10 minutes (600 seconds) TimeScale15Min // 15 minutes (900 seconds) TimeScale30Min // 30 minutes (1800 seconds) TimeScale60Min // 60 minutes (3600 seconds) )