Documentation
¶
Overview ¶
Package charts provides high-level charting and graphing APIs.
This package builds on top of the layout and rendering engines to provide ready-to-use chart types with sensible defaults and extensive customization.
Chart Types:
- Line graphs (with area fill, gradients, markers)
- Bar charts (vertical, horizontal, stacked)
- Scatter plots (multiple series, custom markers)
- Heatmaps (linear and GitHub-style weeks view)
- Pie charts (with donut mode)
All charts can be rendered to:
- SVG (via render/svg/)
- Terminal (via render/terminal/)
- PNG/JPEG (via export/ from SVG)
Example - Time-series line chart:
data := []charts.TimeSeriesData{
{Date: time.Date(2024, 1, 1, 0, 0, 0, 0, time.UTC), Value: 100},
{Date: time.Date(2024, 1, 2, 0, 0, 0, 0, time.UTC), Value: 150},
}
config := charts.LineChartConfig{
Width: 800,
Height: 400,
Title: "Sales Over Time",
UseGradient: true,
}
svgChart := charts.RenderLineChart(data, config)
termChart := charts.RenderLineChartTerminal(data, config)
Example - Bar chart with design tokens:
data := []charts.DataPoint{
{Label: "Q1", Value: 100},
{Label: "Q2", Value: 150},
{Label: "Q3", Value: 120},
}
theme := design.MidnightTheme()
config := charts.BarChartConfig{
Width: 600,
Height: 400,
Colors: theme.Colors.Chart,
}
svgChart := charts.RenderBarChart(data, config)
This package uses:
- layout/ - For positioning chart elements
- render/svg/ or render/terminal/ - For output
- design/ (optional) - For consistent styling via design tokens
Index ¶
- Constants
- func AdjustColorForContribution(hexColor string, ratio float64) string
- func AutoParallelCoordinates(axisLabels []string, data [][]float64, width, height float64) string
- func CalculateStatCardHeight(hasTrendGraph bool, tokens *design.DesignTokens) int
- func ChordDiagramFromMatrix(entities []string, matrix [][]float64, width, height float64) string
- func CircularBarPlotFromValues(labels []string, values []float64, width, height float64) string
- func ColorBackground(c string, mode TerminalColorMode) string
- func ColorForeground(c string, mode TerminalColorMode) string
- func ColoredParallelCoordinates(axisLabels []string, data [][]float64, colors []string, width, height float64) string
- func ColorfulWordCloud(words []string, frequencies []float64, colors []string, width, height float64) string
- func GetBrailleCharacter(dots [8]bool) rune
- func InterpolateColorGradient(start, end string, steps int, mode TerminalColorMode) []string
- func MultiColorCircularBarPlot(labels []string, values []float64, colors []string, width, height float64) string
- func NormalizedRadarChart(axisLabels []string, seriesData map[string][]float64, width, height float64) string
- func RenderAreaChart(data AreaChartData, x, y int, width, height int, ...) string
- func RenderBarChart(data BarChartData, x, y int, width, height int, ...) string
- func RenderBollingerBands(data []CandlestickData, bands BollingerBands, xScale, yScale scales.Scale) string
- func RenderCandlestick(spec CandlestickSpec) string
- func RenderChordDiagram(spec ChordDiagramSpec) string
- func RenderCirclePacking(spec CirclePackingSpec) string
- func RenderCircularBarPlot(spec CircularBarPlotSpec) string
- func RenderConfidenceBands(spec ConfidenceBandSpec, xScale, yScale scales.Scale) string
- func RenderConnectedScatter(spec ConnectedScatterSpec) string
- func RenderCorrelogram(spec CorrelogramSpec) string
- func RenderDendrogram(spec DendrogramSpec) string
- func RenderDensityPlot(spec DensityPlotSpec) string
- func RenderErrorBars(spec ErrorBarSpec, xScale, yScale scales.Scale) string
- func RenderHeikinAshi(spec CandlestickSpec, haData []HeikinAshiData) string
- func RenderHistogram(spec HistogramSpec) string
- func RenderHorizontalBoxPlot(spec BoxPlotSpec) string
- func RenderIcicle(spec IcicleSpec) string
- func RenderLineGraph(data LineGraphData, x, y int, width, height int, ...) string
- func RenderLinearHeatmap(data HeatmapData, x, y int, width, height int, baseColorHex string, ...) string
- func RenderLollipop(spec LollipopSpec) string
- func RenderOHLC(spec OHLCSpec) string
- func RenderParallelCoordinates(spec ParallelCoordinatesSpec) string
- func RenderPieChart(data PieChartData, x, y int, width, height int, title string, ...) string
- func RenderRadarChart(spec RadarChartSpec) string
- func RenderRidgeline(spec RidgelineSpec) string
- func RenderSankey(spec SankeySpec) string
- func RenderScatterPlot(data ScatterPlotData, x, y int, width, height int, ...) string
- func RenderSimpleDensity(spec SimpleDensitySpec) string
- func RenderStackedArea(spec StackedAreaSpec) string
- func RenderStatCard(data StatCardData, x, y int, width, height int, ...) string
- func RenderStreamChart(spec StreamChartSpec) string
- func RenderSunburst(spec SunburstSpec) string
- func RenderTreemap(spec TreemapSpec) string
- func RenderVerticalBoxPlot(spec BoxPlotSpec) string
- func RenderViolinPlot(spec ViolinPlotSpec) string
- func RenderWeeksHeatmap(data HeatmapData, x, y int, width, height int, baseColorHex string, ...) string
- func RenderWordCloud(spec WordCloudSpec) string
- func RotatedWordCloud(words []string, frequencies []float64, width, height float64) string
- func SimpleDendrogram(labels []string, clusters [][]int, heights []float64, width, height float64) string
- func WordCloudFromFrequencies(words []string, frequencies []float64, width, height float64) string
- type AreaChartData
- type BarChartData
- type BarData
- type BollingerBands
- type Bounds
- type BoxPlotData
- type BoxPlotSpec
- type BoxPlotStats
- type BrailleCanvas
- func (c *BrailleCanvas) Clear()
- func (c *BrailleCanvas) DrawCurve(points []Point)
- func (c *BrailleCanvas) DrawLine(x0, y0, x1, y1 int)
- func (c *BrailleCanvas) DrawPoint(x, y int)
- func (c *BrailleCanvas) FillArea(points []Point, baselineY int)
- func (c *BrailleCanvas) Render() string
- func (c *BrailleCanvas) SetPixel(x, y int)
- type CandlestickData
- type CandlestickSpec
- type CapStyle
- type Card
- type ChordDiagramSpec
- type ChordEntity
- type ChordRelation
- type CirclePackingSpec
- type CircularBarPlotSpec
- type CircularBarPoint
- type ConfidenceBand
- type ConfidenceBandSpec
- type ConnectedScatterPoint
- type ConnectedScatterSeries
- type ConnectedScatterSpec
- type ContributionDay
- type CorrelationMatrix
- type CorrelogramSpec
- type DendrogramNode
- type DendrogramSpec
- type DensityPlotData
- type DensityPlotSpec
- type DensityPoint
- type ErrorBar
- type ErrorBarSpec
- type HeatmapData
- type HeikinAshiData
- type HistogramData
- type HistogramSpec
- type IcicleRect
- type IcicleSpec
- type LegendItem
- type LineGraphData
- type LollipopData
- type LollipopPoint
- type LollipopSpec
- type OHLCData
- type OHLCSpec
- type Output
- type PackedCircle
- type ParallelAxis
- type ParallelCoordinatesSpec
- type ParallelDataPoint
- type PieChartData
- type PieSlice
- type Point
- type RadarAxis
- type RadarChartSpec
- type RadarSeries
- type RenderConfig
- type Renderer
- type RidgelineData
- type RidgelineSpec
- type SVGOutput
- type SVGRenderer
- func (r *SVGRenderer) RenderAreaChart(data AreaChartData, bounds Bounds, config RenderConfig) Output
- func (r *SVGRenderer) RenderBarChart(data BarChartData, bounds Bounds, config RenderConfig) Output
- func (r *SVGRenderer) RenderHeatmap(data HeatmapData, bounds Bounds, config RenderConfig) Output
- func (r *SVGRenderer) RenderLineGraph(data LineGraphData, bounds Bounds, config RenderConfig) Output
- func (r *SVGRenderer) RenderScatterPlot(data ScatterPlotData, bounds Bounds, config RenderConfig) Output
- func (r *SVGRenderer) RenderStatCard(data StatCardData, bounds Bounds, config RenderConfig) Output
- type SankeyLink
- type SankeyNode
- type SankeySpec
- type ScatterPlotData
- type ScatterPoint
- type SimpleDensityData
- type SimpleDensitySpec
- type StackedAreaPoint
- type StackedAreaSeries
- type StackedAreaSpec
- type StatCardData
- type StreamChartSpec
- type StreamPoint
- type StreamSeries
- type SunburstArc
- type SunburstSpec
- type TerminalColorMode
- type TerminalOutput
- type TerminalRenderer
- func (r *TerminalRenderer) RenderAreaChart(data AreaChartData, bounds Bounds, config RenderConfig) Output
- func (r *TerminalRenderer) RenderBarChart(data BarChartData, bounds Bounds, config RenderConfig) Output
- func (r *TerminalRenderer) RenderHeatmap(data HeatmapData, bounds Bounds, config RenderConfig) Output
- func (r *TerminalRenderer) RenderLineGraph(data LineGraphData, bounds Bounds, config RenderConfig) Output
- func (r *TerminalRenderer) RenderScatterPlot(data ScatterPlotData, bounds Bounds, config RenderConfig) Output
- func (r *TerminalRenderer) RenderStatCard(data StatCardData, bounds Bounds, config RenderConfig) Output
- type TimeSeriesData
- type TreeNode
- type TreemapRect
- type TreemapSpec
- type ViolinPlotData
- type ViolinPlotSpec
- type ViolinStats
- type WordCloudSpec
- type WordCloudWord
Constants ¶
const ( LineGraphAspectRatio = 2.25 // 450px width / 200px height = 2.25:1 BarChartAspectRatio = 2.25 // 450px width / 200px height = 2.25:1 WeeksHeatmapAspectRatio = 3.89 // 700px width / 180px height ≈ 3.89:1 LinearHeatmapAspectRatio = 5.71 // 400px width / 70px height ≈ 5.71:1 )
Aspect ratios for different graph types These define the width-to-height ratio for graphs to maintain consistent sizing
Variables ¶
This section is empty.
Functions ¶
func AdjustColorForContribution ¶
AdjustColorForContribution adjusts a color's lightness based on contribution ratio Uses the color package's HSL functions to set absolute lightness
func AutoParallelCoordinates ¶ added in v1.1.0
AutoParallelCoordinates creates a parallel coordinates chart with automatic axis ranges data is a 2D slice where each row is a data point and columns are variables
func CalculateStatCardHeight ¶
func CalculateStatCardHeight(hasTrendGraph bool, tokens *design.DesignTokens) int
CalculateStatCardHeight calculates the height needed for a stat card If hasTrendGraph is true, includes space for the trend graph (15px)
func ChordDiagramFromMatrix ¶ added in v1.1.0
ChordDiagramFromMatrix creates a chord diagram from an adjacency matrix entities are the entity labels matrix is a square matrix where matrix[i][j] is the relationship from entity i to entity j
func CircularBarPlotFromValues ¶ added in v1.1.0
CircularBarPlotFromValues creates a circular barplot from simple value arrays
func ColorBackground ¶
func ColorBackground(c string, mode TerminalColorMode) string
ColorBackground returns ANSI escape code for background color
func ColorForeground ¶
func ColorForeground(c string, mode TerminalColorMode) string
ColorForeground returns ANSI escape code for foreground color
func ColoredParallelCoordinates ¶ added in v1.1.0
func ColoredParallelCoordinates(axisLabels []string, data [][]float64, colors []string, width, height float64) string
ColoredParallelCoordinates creates a parallel coordinates chart with color-coded lines colors should have the same length as data
func ColorfulWordCloud ¶ added in v1.1.0
func ColorfulWordCloud(words []string, frequencies []float64, colors []string, width, height float64) string
ColorfulWordCloud creates a word cloud with varied colors
func GetBrailleCharacter ¶
GetBrailleCharacter returns a single braille character for a given pattern
func InterpolateColorGradient ¶
func InterpolateColorGradient(start, end string, steps int, mode TerminalColorMode) []string
InterpolateColorGradient creates a gradient of ANSI color codes between two colors
func MultiColorCircularBarPlot ¶ added in v1.1.0
func MultiColorCircularBarPlot(labels []string, values []float64, colors []string, width, height float64) string
MultiColorCircularBarPlot creates a circular barplot with different colors
func NormalizedRadarChart ¶ added in v1.1.0
func NormalizedRadarChart(axisLabels []string, seriesData map[string][]float64, width, height float64) string
NormalizedRadarChart creates a radar chart where all axes have the same 0-100 scale
func RenderAreaChart ¶
func RenderAreaChart(data AreaChartData, x, y int, width, height int, designTokens *design.DesignTokens) string
RenderAreaChart renders an area chart using scales and axes
func RenderBarChart ¶
func RenderBarChart(data BarChartData, x, y int, width, height int, designTokens *design.DesignTokens) string
RenderBarChart renders a bar chart using scales and axes
func RenderBollingerBands ¶ added in v1.1.0
func RenderBollingerBands(data []CandlestickData, bands BollingerBands, xScale, yScale scales.Scale) string
RenderBollingerBands renders Bollinger Bands as path overlays
func RenderCandlestick ¶ added in v1.1.0
func RenderCandlestick(spec CandlestickSpec) string
RenderCandlestick renders a candlestick chart
func RenderChordDiagram ¶ added in v1.1.0
func RenderChordDiagram(spec ChordDiagramSpec) string
RenderChordDiagram generates an SVG chord diagram
func RenderCirclePacking ¶ added in v1.1.0
func RenderCirclePacking(spec CirclePackingSpec) string
RenderCirclePacking renders a circle packing visualization
func RenderCircularBarPlot ¶ added in v1.1.0
func RenderCircularBarPlot(spec CircularBarPlotSpec) string
RenderCircularBarPlot generates an SVG circular barplot
func RenderConfidenceBands ¶ added in v1.1.0
func RenderConfidenceBands(spec ConfidenceBandSpec, xScale, yScale scales.Scale) string
RenderConfidenceBands renders confidence interval bands
func RenderConnectedScatter ¶ added in v1.1.0
func RenderConnectedScatter(spec ConnectedScatterSpec) string
RenderConnectedScatter generates an SVG connected scatter plot
func RenderCorrelogram ¶ added in v1.1.0
func RenderCorrelogram(spec CorrelogramSpec) string
RenderCorrelogram generates an SVG correlogram (correlation matrix heatmap)
func RenderDendrogram ¶ added in v1.1.0
func RenderDendrogram(spec DendrogramSpec) string
RenderDendrogram generates an SVG dendrogram
func RenderDensityPlot ¶ added in v1.1.0
func RenderDensityPlot(spec DensityPlotSpec) string
RenderDensityPlot renders a density plot
func RenderErrorBars ¶ added in v1.1.0
func RenderErrorBars(spec ErrorBarSpec, xScale, yScale scales.Scale) string
RenderErrorBars renders error bars on a plot
func RenderHeikinAshi ¶ added in v1.1.0
func RenderHeikinAshi(spec CandlestickSpec, haData []HeikinAshiData) string
RenderHeikinAshi renders a Heikin-Ashi candlestick chart
func RenderHistogram ¶ added in v1.1.0
func RenderHistogram(spec HistogramSpec) string
RenderHistogram renders a histogram chart
func RenderHorizontalBoxPlot ¶ added in v1.1.0
func RenderHorizontalBoxPlot(spec BoxPlotSpec) string
RenderHorizontalBoxPlot renders a horizontal box plot
func RenderIcicle ¶ added in v1.1.0
func RenderIcicle(spec IcicleSpec) string
RenderIcicle renders an icicle (partition) chart
func RenderLineGraph ¶
func RenderLineGraph(data LineGraphData, x, y int, width, height int, designTokens *design.DesignTokens) string
RenderLineGraph renders a line graph using scales and axes
func RenderLinearHeatmap ¶
func RenderLinearHeatmap(data HeatmapData, x, y int, width, height int, baseColorHex string, designTokens *design.DesignTokens) string
RenderLinearHeatmap renders a linear (horizontal) heatmap
func RenderLollipop ¶ added in v1.1.0
func RenderLollipop(spec LollipopSpec) string
RenderLollipop generates an SVG lollipop chart
func RenderOHLC ¶ added in v1.1.0
RenderOHLC renders an OHLC (Open-High-Low-Close) chart
func RenderParallelCoordinates ¶ added in v1.1.0
func RenderParallelCoordinates(spec ParallelCoordinatesSpec) string
RenderParallelCoordinates generates an SVG parallel coordinates chart
func RenderPieChart ¶ added in v1.1.0
func RenderPieChart(data PieChartData, x, y int, width, height int, title string, donutMode, showLegend, showPercent bool) string
RenderPieChart generates an SVG pie or donut chart x, y: position offset (usually 0, 0 for standalone chart) width, height: dimensions of the chart title: optional chart title donutMode: if true, renders as donut with center hole showLegend: if true, shows legend with labels showPercent: if true, shows percentage labels on slices
func RenderRadarChart ¶ added in v1.1.0
func RenderRadarChart(spec RadarChartSpec) string
RenderRadarChart generates an SVG radar/spider chart
func RenderRidgeline ¶ added in v1.1.0
func RenderRidgeline(spec RidgelineSpec) string
RenderRidgeline renders a ridgeline (joy) plot
func RenderSankey ¶ added in v1.1.0
func RenderSankey(spec SankeySpec) string
RenderSankey generates an SVG Sankey diagram
func RenderScatterPlot ¶
func RenderScatterPlot(data ScatterPlotData, x, y int, width, height int, designTokens *design.DesignTokens) string
RenderScatterPlot renders a scatter plot using scales and axes
func RenderSimpleDensity ¶ added in v1.1.0
func RenderSimpleDensity(spec SimpleDensitySpec) string
RenderSimpleDensity renders a simple density plot using KDE
func RenderStackedArea ¶ added in v1.1.0
func RenderStackedArea(spec StackedAreaSpec) string
RenderStackedArea generates an SVG stacked area chart
func RenderStatCard ¶
func RenderStatCard(data StatCardData, x, y int, width, height int, designTokens *design.DesignTokens) string
RenderStatCard renders a statistics card
func RenderStreamChart ¶ added in v1.1.0
func RenderStreamChart(spec StreamChartSpec) string
RenderStreamChart generates an SVG streamchart
func RenderSunburst ¶ added in v1.1.0
func RenderSunburst(spec SunburstSpec) string
RenderSunburst renders a sunburst (radial partition) chart
func RenderTreemap ¶ added in v1.1.0
func RenderTreemap(spec TreemapSpec) string
RenderTreemap renders a treemap visualization using squarified algorithm
func RenderVerticalBoxPlot ¶ added in v1.1.0
func RenderVerticalBoxPlot(spec BoxPlotSpec) string
RenderVerticalBoxPlot renders a vertical box plot
func RenderViolinPlot ¶ added in v1.1.0
func RenderViolinPlot(spec ViolinPlotSpec) string
RenderViolinPlot renders a violin plot
func RenderWeeksHeatmap ¶
func RenderWeeksHeatmap(data HeatmapData, x, y int, width, height int, baseColorHex string, designTokens *design.DesignTokens) string
RenderWeeksHeatmap renders a GitHub-style weeks heatmap (grid of weeks)
func RenderWordCloud ¶ added in v1.1.0
func RenderWordCloud(spec WordCloudSpec) string
RenderWordCloud generates an SVG word cloud
func RotatedWordCloud ¶ added in v1.1.0
RotatedWordCloud creates a word cloud with some words rotated
func SimpleDendrogram ¶ added in v1.1.0
func SimpleDendrogram(labels []string, clusters [][]int, heights []float64, width, height float64) string
SimpleDendrogram creates a simple dendrogram from a list of clusters Each cluster is represented as a list of indices into the labels array Heights represent the distance at which clusters were merged
Types ¶
type AreaChartData ¶
type AreaChartData struct {
Points []TimeSeriesData
Color string
FillColor string
UseGradient bool // If true, use gradient fill
GradientID string // Optional custom gradient ID
ColorSpace color.GradientSpace // Color space for gradient interpolation
Label string
Smooth bool // If true, use smooth curves
Tension float64 // Curve tension (0-1), 0.3 recommended
BaselineY int // Y value for baseline (default: bottom of chart)
Stacked bool // For multiple series (future enhancement)
}
AreaChartData represents data for an area chart
type BarChartData ¶
BarChartData represents data for a bar chart
type BollingerBands ¶ added in v1.1.0
BollingerBands calculates Bollinger Bands for candlestick data
func CalculateBollingerBands ¶ added in v1.1.0
func CalculateBollingerBands(data []CandlestickData, period int, stdDev float64) BollingerBands
CalculateBollingerBands calculates Bollinger Bands
type BoxPlotData ¶ added in v1.1.0
type BoxPlotData struct {
Values []float64 // Raw data values
Label string // Category label
Color string // Box fill color
StrokeColor string // Box outline color
// Optional: Pre-calculated statistics (if nil, will be calculated)
Q1 *float64 // First quartile (25th percentile)
Median *float64 // Median (50th percentile)
Q3 *float64 // Third quartile (75th percentile)
Min *float64 // Minimum value (or lower whisker)
Max *float64 // Maximum value (or upper whisker)
Outliers []float64 // Optional: outlier values
}
BoxPlotData represents data for a box plot
type BoxPlotSpec ¶ added in v1.1.0
type BoxPlotSpec struct {
Data []*BoxPlotData
Width float64
Height float64
Horizontal bool // If true, render horizontal box plots
BoxWidth float64 // Width of each box (0 = auto)
ShowOutliers bool // If true, show outlier points
ShowMean bool // If true, show mean marker
ShowNotch bool // If true, show confidence interval notch
WhiskerMultiplier float64 // IQR multiplier for whiskers (default: 1.5)
// Axis configuration
XAxisLabel string
YAxisLabel string
ShowGrid bool
}
BoxPlotSpec configures box plot rendering
type BoxPlotStats ¶ added in v1.1.0
type BoxPlotStats struct {
Q1 float64
Median float64
Q3 float64
Min float64
Max float64
Mean float64
IQR float64
LowerFence float64
UpperFence float64
Outliers []float64
}
BoxPlotStats represents calculated box plot statistics
func CalculateBoxPlotStats ¶ added in v1.1.0
func CalculateBoxPlotStats(values []float64, whiskerMultiplier float64) BoxPlotStats
CalculateBoxPlotStats calculates box plot statistics from raw values
type BrailleCanvas ¶
BrailleCanvas represents a canvas for drawing with braille characters
func NewBrailleCanvas ¶
func NewBrailleCanvas(width, height int) *BrailleCanvas
NewBrailleCanvas creates a new braille canvas Each braille character represents 2x4 pixels, so canvas dimensions are multiplied
func (*BrailleCanvas) DrawCurve ¶
func (c *BrailleCanvas) DrawCurve(points []Point)
DrawCurve draws a smooth curve through multiple points
func (*BrailleCanvas) DrawLine ¶
func (c *BrailleCanvas) DrawLine(x0, y0, x1, y1 int)
DrawLine draws a line between two points using Bresenham's algorithm
func (*BrailleCanvas) DrawPoint ¶
func (c *BrailleCanvas) DrawPoint(x, y int)
DrawPoint draws a single point (useful for scatter plots)
func (*BrailleCanvas) FillArea ¶
func (c *BrailleCanvas) FillArea(points []Point, baselineY int)
FillArea fills the area under a curve (for area charts)
func (*BrailleCanvas) Render ¶
func (c *BrailleCanvas) Render() string
Render converts the canvas to a string of braille characters
func (*BrailleCanvas) SetPixel ¶
func (c *BrailleCanvas) SetPixel(x, y int)
SetPixel sets a pixel at the given coordinates
type CandlestickData ¶ added in v1.1.0
type CandlestickData struct {
X interface{} // Time or category (converted via x scale)
Open float64
High float64
Low float64
Close float64
Volume float64 // Optional volume data
}
CandlestickData represents a single candlestick data point
type CandlestickSpec ¶ added in v1.1.0
type CandlestickSpec struct {
Data []CandlestickData
Width float64
Height float64
XScale scales.Scale
YScale scales.Scale
CandleWidth float64 // Width of each candle body
WickWidth float64 // Width of wick line
RisingColor string // Color for rising candles (close > open)
FallingColor string // Color for falling candles (close < open)
ShowVolume bool // Show volume bars
VolumeHeight float64 // Height allocated for volume bars
VolumeColor string
VolumeOpacity float64
}
CandlestickSpec configures candlestick chart rendering
type Card ¶
type Card struct {
Width int
Height int
Title string
Icon string // Optional SVG icon content
Legends []LegendItem // Optional legend items for header end
DesignTokens *design.DesignTokens
MotionTokens *design.MotionTokens
}
Card represents a visual card container
type ChordDiagramSpec ¶ added in v1.1.0
type ChordDiagramSpec struct {
Entities []ChordEntity
Relations []ChordRelation
Width float64
Height float64
InnerRadius float64 // Inner radius for entity arcs (auto if 0)
ArcWidth float64 // Width of entity arcs (default: 20)
ArcPadding float64 // Padding between entity arcs in degrees (default: 2)
DefaultColor string // Default entity color
ShowLabels bool // Show entity labels
Title string
}
ChordDiagramSpec configures chord diagram rendering
type ChordEntity ¶ added in v1.1.0
ChordEntity represents an entity in the chord diagram
type ChordRelation ¶ added in v1.1.0
type ChordRelation struct {
Source string // Source entity ID
Target string // Target entity ID
Value float64 // Relationship strength (determines chord width)
}
ChordRelation represents a relationship between two entities
type CirclePackingSpec ¶ added in v1.1.0
type CirclePackingSpec struct {
Root *TreeNode
Width float64
Height float64
Padding float64 // Padding between circles
ShowLabels bool
ColorScheme []string
}
CirclePackingSpec configures circle packing rendering
type CircularBarPlotSpec ¶ added in v1.1.0
type CircularBarPlotSpec struct {
Data []CircularBarPoint
Width float64
Height float64
InnerRadius float64 // Inner radius (creates donut hole, 0 = start from center)
BarWidth float64 // Angular width of bars (0 = auto-calculate with gaps)
DefaultColor string // Default bar color
ShowLabels bool // Show value labels on bars
ShowAxisLabels bool // Show labels around the circle
Title string
StartAngle float64 // Starting angle in degrees (0 = top, clockwise)
}
CircularBarPlotSpec configures circular barplot rendering
type CircularBarPoint ¶ added in v1.1.0
CircularBarPoint represents a single bar in the circular barplot
type ConfidenceBand ¶ added in v1.1.0
type ConfidenceBand struct {
XValues []float64 // X positions (data coordinates)
YCenters []float64 // Center Y values
YLowerBounds []float64 // Lower bound Y values
YUpperBounds []float64 // Upper bound Y values
Color string // Fill color
Opacity float64 // Band opacity (0-1)
Label string // Optional label
}
ConfidenceBand represents a confidence interval band
type ConfidenceBandSpec ¶ added in v1.1.0
type ConfidenceBandSpec struct {
Bands []*ConfidenceBand
}
ConfidenceBandSpec configures confidence band rendering
type ConnectedScatterPoint ¶ added in v1.1.0
type ConnectedScatterPoint struct {
X float64
Y float64
Label string // Optional label for the point
Size float64 // Optional custom size for this point
Color string // Optional custom color for this point
}
ConnectedScatterPoint represents a point in a connected scatter plot
type ConnectedScatterSeries ¶ added in v1.1.0
type ConnectedScatterSeries struct {
Points []ConnectedScatterPoint
Label string // Series label for legend
Color string // Line and marker color
LineStyle string // "solid", "dashed", "dotted"
LineWidth float64 // Width of connecting line
MarkerType string // "circle", "square", "diamond", "triangle", "cross", "x"
MarkerSize float64 // Size of markers
}
ConnectedScatterSeries represents a series of connected points
type ConnectedScatterSpec ¶ added in v1.1.0
type ConnectedScatterSpec struct {
Series []*ConnectedScatterSeries
Width float64
Height float64
ShowGrid bool
ShowMarkers bool // If false, only lines are shown
ShowLines bool // If false, only markers are shown (regular scatter)
Title string
XAxisLabel string
YAxisLabel string
XAxisMin *float64 // Optional: force X axis min
XAxisMax *float64 // Optional: force X axis max
YAxisMin *float64 // Optional: force Y axis min
YAxisMax *float64 // Optional: force Y axis max
}
ConnectedScatterSpec configures connected scatter plot rendering
type ContributionDay ¶
ContributionDay represents a single day's contribution data
type CorrelationMatrix ¶ added in v1.1.0
type CorrelationMatrix struct {
Variables []string // Variable names
Matrix [][]float64 // Correlation values (must be square matrix)
}
CorrelationMatrix represents a correlation matrix
func CalculateCorrelationMatrix ¶ added in v1.1.0
func CalculateCorrelationMatrix(variables []string, data [][]float64) CorrelationMatrix
CalculateCorrelationMatrix computes Pearson correlation matrix from data data is a slice of variables, where each variable is a slice of values
type CorrelogramSpec ¶ added in v1.1.0
type CorrelogramSpec struct {
Data CorrelationMatrix
Width float64
Height float64
ShowValues bool // Show correlation values in cells
ShowDiagonal bool // Show diagonal (always 1.0)
TriangleMode string // "full", "upper", "lower"
ColorScheme string // "redblue", "bluered", "coolwarm"
Title string
CellPadding float64 // Padding between cells
}
CorrelogramSpec configures correlogram rendering
type DendrogramNode ¶ added in v1.1.0
type DendrogramNode struct {
Label string // Label for leaf nodes
Height float64 // Height (distance) at which this cluster was formed
Children []*DendrogramNode // Child nodes (empty for leaf nodes)
}
DendrogramNode represents a node in the dendrogram tree
type DendrogramSpec ¶ added in v1.1.0
type DendrogramSpec struct {
Root *DendrogramNode
Width float64
Height float64
Orientation string // "vertical", "horizontal" (default: vertical)
ShowLabels bool // Show leaf labels
ShowHeights bool // Show height scale
LineWidth float64 // Width of dendrogram lines (default: 2)
LineColor string // Color of dendrogram lines
Title string
}
DendrogramSpec configures dendrogram rendering
type DensityPlotData ¶ added in v1.1.0
type DensityPlotData struct {
Values []float64 // Raw data values
Color string // Line color
FillColor string // Optional fill color
Label string // Optional label
Bandwidth float64 // KDE bandwidth (0 = auto)
}
DensityPlotData represents data for a density plot
type DensityPlotSpec ¶ added in v1.1.0
type DensityPlotSpec struct {
Data []*DensityPlotData
Width float64
Height float64
ShowFill bool // If true, fill area under curve
Smooth bool // If true, use smooth curves
LineWidth float64 // Line width
// Axis configuration
XAxisLabel string
YAxisLabel string
}
DensityPlotSpec configures density plot rendering
type DensityPoint ¶ added in v1.1.0
DensityPoint represents a point in the density estimation
type ErrorBar ¶ added in v1.1.0
type ErrorBar struct {
X float64 // X position (data coordinates)
Y float64 // Y value (data coordinates)
ErrorLower float64 // Lower error (absolute value or relative)
ErrorUpper float64 // Upper error (absolute value or relative)
IsRelative bool // If true, errors are relative to Y; if false, absolute values
}
ErrorBar represents error bars for a data point
type ErrorBarSpec ¶ added in v1.1.0
type ErrorBarSpec struct {
Bars []ErrorBar
Color string
CapWidth float64 // Width of error bar caps (pixels)
CapStyle CapStyle
LineWidth float64
}
ErrorBarSpec configures error bar rendering
type HeatmapData ¶
type HeatmapData struct {
Days []ContributionDay
StartDate time.Time
EndDate time.Time
Type string // "linear" or "weeks" (GitHub-style grid)
}
HeatmapData represents data for a heatmap visualization
type HeikinAshiData ¶ added in v1.1.0
HeikinAshiData represents a single Heikin-Ashi candlestick
func CalculateHeikinAshi ¶ added in v1.1.0
func CalculateHeikinAshi(data []CandlestickData) []HeikinAshiData
CalculateHeikinAshi converts regular candlestick data to Heikin-Ashi
type HistogramData ¶ added in v1.1.0
type HistogramData struct {
Values []float64 // Raw data values
Color string // Bar fill color
Label string // Optional label
}
HistogramData represents data for a histogram
type HistogramSpec ¶ added in v1.1.0
type HistogramSpec struct {
Data *HistogramData
Width float64
Height float64
BinCount int // Number of bins (0 = auto)
BinSize float64 // Fixed bin size (0 = use BinCount)
Nice bool // If true, use nice round bin edges
ShowDensity bool // If true, normalize to show density instead of counts
BarGap float64 // Gap between bars (pixels)
// Axis configuration
XAxisLabel string
YAxisLabel string
}
HistogramSpec configures histogram rendering
type IcicleRect ¶ added in v1.1.0
IcicleRect represents a positioned rectangle in the icicle chart
type IcicleSpec ¶ added in v1.1.0
type IcicleSpec struct {
Root *TreeNode
Width float64
Height float64
Padding float64 // Padding between rectangles
Orientation string // "vertical" or "horizontal"
ShowLabels bool
ColorScheme []string
}
IcicleSpec configures icicle chart rendering
type LegendItem ¶
type LegendItem struct {
Color string
Label string
X int // Optional X position (if 0, will be auto-positioned)
}
LegendItem represents a legend item in the header
type LineGraphData ¶
type LineGraphData struct {
Points []TimeSeriesData
Color string
FillColor string
UseGradient bool // If true, use gradient fill instead of solid color
GradientID string // Optional custom gradient ID (auto-generated if empty)
ColorSpace color.GradientSpace // Color space for gradient interpolation
Label string
Smooth bool // If true, use smooth curves instead of straight lines
Tension float64 // Curve tension (0-1), only used if Smooth is true. 0.3 is recommended
MarkerType string // Marker type: "circle", "square", "diamond", "triangle", "dot", "" (none)
MarkerSize float64 // Size of markers in pixels (default: 3)
}
LineGraphData represents data for a line graph
type LollipopData ¶ added in v1.1.0
type LollipopData struct {
Values []LollipopPoint
Color string // Stem and circle color
}
LollipopData represents data for a lollipop chart
type LollipopPoint ¶ added in v1.1.0
type LollipopPoint struct {
Label string
Value float64
Color string // Optional: override default color
Radius float64 // Optional: custom circle size
}
LollipopPoint represents a single lollipop
type LollipopSpec ¶ added in v1.1.0
type LollipopSpec struct {
Data *LollipopData
Width float64
Height float64
Horizontal bool // If true, render horizontal lollipops
StemWidth float64 // Width of stem line (default: 2)
CircleSize float64 // Radius of circle (default: 6)
ShowLabels bool // Show value labels
ShowGrid bool // Show background grid
Title string
XAxisLabel string
YAxisLabel string
BaselineY float64 // Y value for baseline (default: 0)
}
LollipopSpec configures lollipop chart rendering
type OHLCData ¶ added in v1.1.0
type OHLCData struct {
X interface{} // Time or category
Open float64
High float64
Low float64
Close float64
}
OHLCData represents a single OHLC data point
type OHLCSpec ¶ added in v1.1.0
type OHLCSpec struct {
Data []OHLCData
Width float64
Height float64
XScale scales.Scale
YScale scales.Scale
TickWidth float64 // Width of open/close ticks
LineWidth float64 // Width of high-low line
RisingColor string
FallingColor string
}
OHLCSpec configures OHLC chart rendering
type Output ¶
type Output interface {
String() string
}
Output represents rendered visualization output
type PackedCircle ¶ added in v1.1.0
PackedCircle represents a positioned circle
type ParallelAxis ¶ added in v1.1.0
ParallelAxis represents an axis in parallel coordinates
type ParallelCoordinatesSpec ¶ added in v1.1.0
type ParallelCoordinatesSpec struct {
Axes []ParallelAxis // Axis definitions
Data []ParallelDataPoint // Data points
Width float64
Height float64
LineOpacity float64 // Opacity of lines (default: 0.6)
LineWidth float64 // Width of lines (default: 1.5)
DefaultColor string // Default line color
HighlightColor string // Color for highlighted lines
ShowAxesLabels bool // Show axis labels
ShowTicks bool // Show tick marks on axes
Title string
}
ParallelCoordinatesSpec configures parallel coordinates chart rendering
type ParallelDataPoint ¶ added in v1.1.0
type ParallelDataPoint struct {
Values []float64 // One value per axis
Label string // Optional label for this data point
Color string // Optional custom color
}
ParallelDataPoint represents a single observation across all axes
type PieChartData ¶ added in v1.1.0
type PieChartData struct {
Slices []PieSlice
Colors []string // Optional custom color palette (uses default if empty)
}
PieChartData represents data for a pie or donut chart
type RadarChartSpec ¶ added in v1.1.0
type RadarChartSpec struct {
Axes []RadarAxis // Axes definitions
Series []*RadarSeries // Data series
Width float64
Height float64
ShowGrid bool // Show concentric grid circles
GridLevels int // Number of grid levels (default: 5)
ShowLabels bool // Show axis labels
ShowValues bool // Show value labels on points
Title string
}
RadarChartSpec configures radar chart rendering
type RadarSeries ¶ added in v1.1.0
type RadarSeries struct {
Label string
Values []float64 // One value per axis
Color string
FillOpacity float64 // Opacity of filled area (0-1)
LineWidth float64
}
RadarSeries represents a series of values for radar chart
type RenderConfig ¶
type RenderConfig struct {
DesignTokens *design.DesignTokens
MotionTokens *design.MotionTokens
Color string
Theme string
}
RenderConfig contains configuration for rendering visualizations
type Renderer ¶
type Renderer interface {
RenderHeatmap(data HeatmapData, bounds Bounds, config RenderConfig) Output
RenderLineGraph(data LineGraphData, bounds Bounds, config RenderConfig) Output
RenderBarChart(data BarChartData, bounds Bounds, config RenderConfig) Output
RenderStatCard(data StatCardData, bounds Bounds, config RenderConfig) Output
RenderAreaChart(data AreaChartData, bounds Bounds, config RenderConfig) Output
RenderScatterPlot(data ScatterPlotData, bounds Bounds, config RenderConfig) Output
}
Renderer defines the interface for visualization rendering
type RidgelineData ¶ added in v1.1.0
type RidgelineData struct {
Values []float64 // Raw data values
Label string // Category label
Color string // Fill color
Bandwidth float64 // KDE bandwidth (0 = auto)
}
RidgelineData represents one ridge in a ridgeline plot
func RidgelineFromGroups ¶ added in v1.1.0
func RidgelineFromGroups(groups map[string][]float64, colors map[string]string) []*RidgelineData
RidgelineFromGroups creates ridgeline data from grouped data Useful for converting transforms.Group output to ridgeline format
type RidgelineSpec ¶ added in v1.1.0
type RidgelineSpec struct {
Data []*RidgelineData
Width float64
Height float64
Overlap float64 // Amount of overlap between ridges (0-1, default 0.5)
ShowFill bool // If true, fill ridges with color
LineWidth float64 // Line width
Reverse bool // If true, reverse order (top to bottom)
// Axis configuration
XAxisLabel string
ShowLabels bool // If true, show category labels on Y axis
}
RidgelineSpec configures ridgeline plot rendering
type SVGRenderer ¶
type SVGRenderer struct{}
SVGRenderer implements SVG rendering
func (*SVGRenderer) RenderAreaChart ¶
func (r *SVGRenderer) RenderAreaChart(data AreaChartData, bounds Bounds, config RenderConfig) Output
RenderAreaChart renders an area chart as SVG
func (*SVGRenderer) RenderBarChart ¶
func (r *SVGRenderer) RenderBarChart(data BarChartData, bounds Bounds, config RenderConfig) Output
RenderBarChart renders a bar chart as SVG
func (*SVGRenderer) RenderHeatmap ¶
func (r *SVGRenderer) RenderHeatmap(data HeatmapData, bounds Bounds, config RenderConfig) Output
RenderHeatmap renders a heatmap as SVG
func (*SVGRenderer) RenderLineGraph ¶
func (r *SVGRenderer) RenderLineGraph(data LineGraphData, bounds Bounds, config RenderConfig) Output
RenderLineGraph renders a line graph as SVG
func (*SVGRenderer) RenderScatterPlot ¶
func (r *SVGRenderer) RenderScatterPlot(data ScatterPlotData, bounds Bounds, config RenderConfig) Output
RenderScatterPlot renders a scatter plot as SVG
func (*SVGRenderer) RenderStatCard ¶
func (r *SVGRenderer) RenderStatCard(data StatCardData, bounds Bounds, config RenderConfig) Output
RenderStatCard renders a stat card as SVG
type SankeyLink ¶ added in v1.1.0
type SankeyLink struct {
Source string // Source node ID
Target string // Target node ID
Value float64 // Flow value (determines link width)
Color string // Optional custom color
}
SankeyLink represents a flow between two nodes
type SankeyNode ¶ added in v1.1.0
type SankeyNode struct {
ID string
Label string
Color string // Optional custom color
X float64 // Optional: manual X position (0-1 normalized, 0 = auto)
Y float64 // Optional: manual Y position (0-1 normalized, 0 = auto)
}
SankeyNode represents a node in the Sankey diagram
type SankeySpec ¶ added in v1.1.0
type SankeySpec struct {
Nodes []SankeyNode
Links []SankeyLink
Width float64
Height float64
NodeWidth float64 // Width of node rectangles (default: 15)
NodePadding float64 // Vertical padding between nodes (default: 10)
DefaultColor string // Default node color
ShowLabels bool // Show node labels
Title string
}
SankeySpec configures Sankey diagram rendering
type ScatterPlotData ¶
type ScatterPlotData struct {
Points []ScatterPoint
Color string
Label string
MarkerType string // Marker shape: "circle", "square", "diamond", "triangle", "cross", "x", "dot"
MarkerSize float64 // Size of markers in pixels
}
ScatterPlotData represents data for a scatter plot
type ScatterPoint ¶
type ScatterPoint struct {
Date time.Time
Value int
Size float64 // Optional: custom size for this point (0 = use default)
Label string // Optional: label for this specific point
}
ScatterPoint represents a single point in a scatter plot
type SimpleDensityData ¶ added in v1.1.0
type SimpleDensityData struct {
Values []float64
Label string
Color string
Bandwidth float64 // KDE bandwidth (0 = auto)
}
SimpleDensityData represents data for a single density curve
type SimpleDensitySpec ¶ added in v1.1.0
type SimpleDensitySpec struct {
Data []*SimpleDensityData
Width float64
Height float64
ShowFill bool
ShowRug bool // Show rug plot (data points on x-axis)
LineWidth float64
Title string
XAxisLabel string
YAxisLabel string
}
SimpleDensitySpec configures simple density plot rendering
type StackedAreaPoint ¶ added in v1.1.0
StackedAreaPoint represents a single X position with values for each series
type StackedAreaSeries ¶ added in v1.1.0
StackedAreaSeries represents metadata for a series
type StackedAreaSpec ¶ added in v1.1.0
type StackedAreaSpec struct {
Points []StackedAreaPoint // X positions with values for all series
Series []StackedAreaSeries // Metadata for each series (colors, labels)
Width float64
Height float64
ShowGrid bool
Smooth bool // Use smooth curves instead of straight lines
Title string
XAxisLabel string
YAxisLabel string
XAxisMin *float64 // Optional: force X axis min
XAxisMax *float64 // Optional: force X axis max
YAxisMin *float64 // Optional: force Y axis min (usually 0 for stacked)
YAxisMax *float64 // Optional: force Y axis max
}
StackedAreaSpec configures stacked area chart rendering
func StackedAreaFromSeries ¶ added in v1.1.0
func StackedAreaFromSeries(xValues []float64, seriesData [][]float64, seriesLabels []string, seriesColors []string) StackedAreaSpec
StackedAreaFromSeries is a helper to convert multiple simple series into stacked area format Each series is an array of values, and all series must have the same length
type StatCardData ¶
type StatCardData struct {
Title string
Value string
Subtitle string
Change int
ChangePct float64
Color string
TrendData []TimeSeriesData // Optional trend data for mini graph
TrendColor string // Primary color for trend (lighter)
TrendColor2 string // Secondary color for trend (darker)
Legend1 string // Label for first legend item
Legend2 string // Label for second legend item
}
StatCardData represents data for a statistics card
type StreamChartSpec ¶ added in v1.1.0
type StreamChartSpec struct {
Points []StreamPoint // X positions with values for all series
Series []StreamSeries // Metadata for each series (colors, labels)
Width float64
Height float64
Layout string // "center", "wiggle", "silhouette" (default: center)
Smooth bool // Use smooth curves
Title string
XAxisLabel string
ShowLegend bool
}
StreamChartSpec configures streamchart rendering
func StreamChartFromSeries ¶ added in v1.1.0
func StreamChartFromSeries(xValues []float64, seriesData [][]float64, seriesLabels []string, seriesColors []string) StreamChartSpec
StreamChartFromSeries is a helper to convert multiple simple series into streamchart format
type StreamPoint ¶ added in v1.1.0
StreamPoint represents a single X position with values for each series
type StreamSeries ¶ added in v1.1.0
StreamSeries represents metadata for a stream series
type SunburstArc ¶ added in v1.1.0
type SunburstArc struct {
InnerRadius float64
OuterRadius float64
StartAngle float64 // In radians
EndAngle float64 // In radians
Node *TreeNode
Depth int
}
SunburstArc represents an arc segment in the sunburst
type SunburstSpec ¶ added in v1.1.0
type SunburstSpec struct {
Root *TreeNode
Width float64
Height float64
InnerRadius float64 // Radius of center hole (0 for no hole)
ShowLabels bool
ColorScheme []string
StartAngle float64 // Starting angle in degrees (0 = top)
}
SunburstSpec configures sunburst chart rendering
type TerminalColorMode ¶
type TerminalColorMode int
TerminalColorMode represents the color capability of the terminal
const ( TerminalColorNone TerminalColorMode = iota TerminalColor16 // 16 colors TerminalColor256 // 256 colors TerminalColorTrue // 24-bit true color )
type TerminalOutput ¶
type TerminalOutput struct {
Content string
}
TerminalOutput wraps terminal output
func (TerminalOutput) String ¶
func (t TerminalOutput) String() string
type TerminalRenderer ¶
type TerminalRenderer struct{}
TerminalRenderer implements terminal-based rendering
func NewTerminalRenderer ¶
func NewTerminalRenderer() *TerminalRenderer
NewTerminalRenderer creates a new terminal renderer
func (*TerminalRenderer) RenderAreaChart ¶
func (r *TerminalRenderer) RenderAreaChart(data AreaChartData, bounds Bounds, config RenderConfig) Output
RenderAreaChart renders an area chart to terminal
func (*TerminalRenderer) RenderBarChart ¶
func (r *TerminalRenderer) RenderBarChart(data BarChartData, bounds Bounds, config RenderConfig) Output
RenderBarChart renders a bar chart to terminal
func (*TerminalRenderer) RenderHeatmap ¶
func (r *TerminalRenderer) RenderHeatmap(data HeatmapData, bounds Bounds, config RenderConfig) Output
RenderHeatmap renders a heatmap to terminal
func (*TerminalRenderer) RenderLineGraph ¶
func (r *TerminalRenderer) RenderLineGraph(data LineGraphData, bounds Bounds, config RenderConfig) Output
RenderLineGraph renders a line graph to terminal
func (*TerminalRenderer) RenderScatterPlot ¶
func (r *TerminalRenderer) RenderScatterPlot(data ScatterPlotData, bounds Bounds, config RenderConfig) Output
RenderScatterPlot renders a scatter plot to terminal
func (*TerminalRenderer) RenderStatCard ¶
func (r *TerminalRenderer) RenderStatCard(data StatCardData, bounds Bounds, config RenderConfig) Output
RenderStatCard renders a stat card to terminal
type TimeSeriesData ¶
TimeSeriesData represents data points over time
type TreeNode ¶ added in v1.1.0
type TreeNode struct {
Name string
Value float64 // Size/weight of this node
Children []*TreeNode // Child nodes (nil for leaf nodes)
Color string // Optional custom color
Metadata map[string]interface{} // Optional metadata
}
TreeNode represents a node in a hierarchical tree structure
func NewTreeNode ¶ added in v1.1.0
NewTreeNode creates a new tree node
type TreemapRect ¶ added in v1.1.0
TreemapRect represents a positioned rectangle in the treemap
type TreemapSpec ¶ added in v1.1.0
type TreemapSpec struct {
Root *TreeNode
Width float64
Height float64
Padding float64 // Padding between rectangles
ShowLabels bool
MinLabelSize float64 // Minimum rectangle size to show label
ColorScheme []string // Color palette
}
TreemapSpec configures treemap rendering
type ViolinPlotData ¶ added in v1.1.0
type ViolinPlotData struct {
Values []float64 // Raw data values
Label string // Category label
Color string // Fill color
StrokeColor string // Outline color
}
ViolinPlotData represents data for a violin plot
type ViolinPlotSpec ¶ added in v1.1.0
type ViolinPlotSpec struct {
Data []*ViolinPlotData
Width float64
Height float64
Bandwidth float64 // KDE bandwidth (0 = auto)
ShowBox bool // If true, show box plot inside violin
ShowMedian bool // If true, show median line
ShowMean bool // If true, show mean marker
ViolinWidth float64 // Maximum width of violin (0 = auto)
// Axis configuration
XAxisLabel string
YAxisLabel string
}
ViolinPlotSpec configures violin plot rendering
type ViolinStats ¶ added in v1.1.0
type ViolinStats struct {
Density []DensityPoint // KDE density points
Mean float64
Median float64
Q1 float64
Q3 float64
}
ViolinStats represents statistics for a violin plot
func CalculateViolinStats ¶ added in v1.1.0
func CalculateViolinStats(values []float64, bandwidth float64) ViolinStats
CalculateViolinStats calculates statistics and KDE for violin plot
type WordCloudSpec ¶ added in v1.1.0
type WordCloudSpec struct {
Words []WordCloudWord
Width float64
Height float64
MinFontSize float64 // Minimum font size (default: 12)
MaxFontSize float64 // Maximum font size (default: 72)
FontFamily string // Font family (default: sans-serif)
DefaultColor string // Default word color
Layout string // "spiral", "horizontal" (default: spiral)
Title string
}
WordCloudSpec configures wordcloud rendering
Source Files
¶
- areachart.go
- barchart.go
- boxplot.go
- candlestick.go
- chorddiagram.go
- circlepacking.go
- circularbarplot.go
- connectedscatter.go
- correlogram.go
- dendrogram.go
- densityplot.go
- doc.go
- errorbars.go
- heatmap.go
- helpers.go
- histogram.go
- icicle.go
- linegraph.go
- lollipop.go
- parallelcoordinates.go
- piechart.go
- radarchart.go
- renderer.go
- ridgeline.go
- sankey.go
- scatterplot.go
- stackedarea.go
- statcard.go
- streamchart.go
- sunburst.go
- terminal_ansi.go
- terminal_braille.go
- terminal_renderer.go
- treemap.go
- types.go
- violinplot.go
- wordcloud.go