internal

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyYAxis

func ApplyYAxis[T any](chart Chart[T], name string, labels *[]string, min *float64, max *float64, splitNumber *int, formatter string, data ...insyra.IDataList) (bool, map[string]int, func(insyra.IDataList) []opts.LineData, func(insyra.IDataList) []float64)

ApplyYAxis builds Y-axis options, applies them to the provided chart, and returns isCategory and mapping (if any). It will also set caller's labels if a pointer is provided so callers get derived labels automatically.

func DefaultColors added in v0.2.13

func DefaultColors() []string

DefaultColors returns a carefully curated palette of 64 colors designed for data visualization. This palette is designed to be: - Comfortable and easy on the eyes - Aesthetically pleasing and timeless - Well-balanced across the color spectrum - Suitable for both light and dark backgrounds - Accessible with good contrast - Professional and modern

The colors are arranged in an interleaved pattern across 8 color families. This ensures that consecutive colors in the palette are visually distinct, making it easy to differentiate between adjacent data series in charts.

Color families: 1. Blues (trust, stability, professionalism) 2. Greens (growth, harmony, nature) 3. Purples (creativity, luxury, wisdom) 4. Reds/Pinks (energy, passion, warmth) 5. Oranges/Ambers (enthusiasm, confidence, vitality) 6. Teals/Cyans (balance, clarity, freshness) 7. Warm Neutrals (sophistication, elegance) 8. Cool Accents (diversity, interest, depth)

Arrangement: Colors are interleaved so that index 0 is from family 1, index 1 is from family 2, index 2 is from family 3, etc. This maximizes visual distinction between consecutive series.

func GenerateHTMLColorPreview added in v0.2.13

func GenerateHTMLColorPreview() string

GenerateHTMLColorPreview generates an HTML file content that displays all colors in a visually appealing grid format showing the interleaved arrangement.

func GetColor added in v0.2.13

func GetColor(index int) string

GetColor returns the color at the specified index from the default palette. If the index exceeds the palette size, it wraps around using modulo operation.

func GetColors added in v0.2.13

func GetColors(n int) []string

GetColors returns a slice of n colors from the default palette. If n exceeds the palette size, colors will repeat in a cyclic manner.

func PrintColorPalette added in v0.2.13

func PrintColorPalette()

PrintColorPalette prints all colors in the default palette with their hex codes and descriptions. Colors are displayed in their usage order (interleaved), showing how they appear when used in charts.

func PrintColorsByFamily added in v0.2.13

func PrintColorsByFamily()

PrintColorsByFamily prints colors organized by their color families. Useful for understanding the color system structure.

func SetBaseChartGlobalOptions

func SetBaseChartGlobalOptions[T any](chart Chart[T], config BaseChartConfig)

func SetShowLabels

func SetShowLabels[T any](chart Chart[T], showLabels bool, labelPos string, defaultLabelPos string)

Types

type BaseChartConfig

type BaseChartConfig struct {
	Width           string // Width of the chart (default "900px").
	Height          string // Height of the chart (default "500px").
	BackgroundColor string // Background color of the chart (default "white").
	Theme           string // Theme of the chart.
	Title           string // Title of the chart.
	Subtitle        string // Subtitle of the chart.
	TitlePos        string // Title position: "top" or "bottom".
	HideLegend      bool   // Whether to hide the legend.
	LegendPos       string // Legend position: "top" or "bottom".
}

type Chart

type Chart[T any] interface {
	SetGlobalOptions(...charts.GlobalOpts) T
	SetSeriesOptions(...charts.SeriesOpts)
	Render(w io.Writer) error
	RenderContent() []byte
}

Jump to

Keyboard shortcuts

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