Documentation
¶
Index ¶
- Variables
- func RenderPNGFromSVG(svg string, opts PNGOptions) ([]byte, error)
- type BackendAttemptError
- type BarChart
- type BarChartType
- type BarItem
- type BarTheme
- type ColumnBar
- type ColumnCard
- type ColumnChart
- type ColumnLegendPolicy
- type ColumnTheme
- type ColumnValueMode
- type DonutChart
- type DonutSlice
- type DonutTheme
- type FunnelChart
- type FunnelSection
- type FunnelTheme
- type FunnelValueMode
- type PNGBackend
- type PNGOptions
- type PNGRenderError
- type SpiderChart
- type SpiderDataset
- type SpiderTheme
- type SplineChart
- type SplineSeries
- type SplineTheme
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptySVG = errors.New("svg output is empty") ErrInvalidDimensions = errors.New("invalid output dimensions") )
Functions ¶
func RenderPNGFromSVG ¶
func RenderPNGFromSVG(svg string, opts PNGOptions) ([]byte, error)
Types ¶
type BackendAttemptError ¶
type BackendAttemptError struct {
Backend PNGBackend
Err error
}
type BarChart ¶
type BarChart struct {
Title string
Bars []BarItem
Width int
MinWidth int
Height int
Padding int
RowGap int
ValueMode BarChartType
Tipo BarChartType
Palette []string
ShowZeroAx bool
Theme BarTheme
}
BarChart renders horizontal bars for static reports (SVG/PNG).
func NewBarChart ¶
NewBarChart creates a BarChart with sensible defaults.
type BarChartType ¶
type BarChartType = ColumnValueMode
const ( BarTypePercent BarChartType = ValueModePercent BarTypeNumber BarChartType = ValueModeNumber )
type ColumnCard ¶
ColumnCard groups bars rendered in one panel of a column chart.
type ColumnChart ¶
type ColumnChart struct {
Title string
Cards []ColumnCard
Width int
MinWidth int
Height int
Padding int
CardGap int
ValueMode ColumnValueMode
LegendPolicy ColumnLegendPolicy
Palette []string
Theme ColumnTheme
}
ColumnChart renders grouped vertical bars for static reports (SVG/PNG).
func NewColumnChart ¶
func NewColumnChart(title string, cards []ColumnCard) *ColumnChart
NewColumnChart creates a ColumnChart with sensible defaults.
func (*ColumnChart) RenderPNG ¶
func (cc *ColumnChart) RenderPNG(opts PNGOptions) ([]byte, error)
func (*ColumnChart) RenderSVG ¶
func (cc *ColumnChart) RenderSVG() (string, error)
func (*ColumnChart) ToSVG ¶
func (cc *ColumnChart) ToSVG() string
ToSVG is deprecated and kept for compatibility with previous versions.
func (*ColumnChart) WritePNG ¶
func (cc *ColumnChart) WritePNG(path string, opts PNGOptions) error
func (*ColumnChart) WriteSVG ¶
func (cc *ColumnChart) WriteSVG(path string) error
type ColumnLegendPolicy ¶
type ColumnLegendPolicy string
const ( LegendAuto ColumnLegendPolicy = "auto" LegendAlways ColumnLegendPolicy = "always" LegendNever ColumnLegendPolicy = "never" )
type ColumnTheme ¶
type ColumnTheme string
const ( ColumnThemeLight ColumnTheme = "light" ColumnThemeDark ColumnTheme = "dark" )
type ColumnValueMode ¶
type ColumnValueMode string
const ( ValueModePercent ColumnValueMode = "percent" ValueModeNumber ColumnValueMode = "number" ValueModePercentColor ColumnValueMode = "percent_color" )
type DonutChart ¶
type DonutChart struct {
Title string
Slices []DonutSlice
Width int
Height int
Padding int
Palette []string
Theme DonutTheme
}
DonutChart renders donut/pie-like charts for static reports (SVG/PNG).
func NewDonutChart ¶
func NewDonutChart(title string, slices []DonutSlice) *DonutChart
NewDonutChart creates a DonutChart with sensible defaults.
func (*DonutChart) RenderPNG ¶
func (dc *DonutChart) RenderPNG(opts PNGOptions) ([]byte, error)
func (*DonutChart) RenderSVG ¶
func (dc *DonutChart) RenderSVG() (string, error)
func (*DonutChart) ToSVG ¶
func (dc *DonutChart) ToSVG() string
ToSVG is deprecated and kept for compatibility with previous versions.
func (*DonutChart) WritePNG ¶
func (dc *DonutChart) WritePNG(path string, opts PNGOptions) error
func (*DonutChart) WriteSVG ¶
func (dc *DonutChart) WriteSVG(path string) error
type DonutSlice ¶
DonutSlice represents one segment of a donut chart.
type DonutTheme ¶
type DonutTheme string
const ( DonutThemeLight DonutTheme = "light" DonutThemeDark DonutTheme = "dark" )
type FunnelChart ¶ added in v0.1.4
type FunnelChart struct {
Title string
Sections []FunnelSection
Width int
Height int
Padding int
Palette []string
Theme FunnelTheme
ValueMode FunnelValueMode
ShowLegendConnect bool
}
FunnelChart renders stacked trapezoid funnel sections (SVG/PNG).
func NewFunnelChart ¶ added in v0.1.4
func NewFunnelChart(title string, sections []FunnelSection) *FunnelChart
NewFunnelChart creates a FunnelChart with sensible defaults.
func (*FunnelChart) RenderPNG ¶ added in v0.1.4
func (fc *FunnelChart) RenderPNG(opts PNGOptions) ([]byte, error)
func (*FunnelChart) RenderSVG ¶ added in v0.1.4
func (fc *FunnelChart) RenderSVG() (string, error)
func (*FunnelChart) ToSVG ¶ added in v0.1.4
func (fc *FunnelChart) ToSVG() string
ToSVG is deprecated and kept for compatibility with previous versions.
func (*FunnelChart) WritePNG ¶ added in v0.1.4
func (fc *FunnelChart) WritePNG(path string, opts PNGOptions) error
func (*FunnelChart) WriteSVG ¶ added in v0.1.4
func (fc *FunnelChart) WriteSVG(path string) error
type FunnelSection ¶ added in v0.1.4
FunnelSection represents one stage of a funnel chart.
type FunnelTheme ¶ added in v0.1.4
type FunnelTheme string
const ( FunnelThemeLight FunnelTheme = "light" FunnelThemeDark FunnelTheme = "dark" )
type FunnelValueMode ¶ added in v0.1.4
type FunnelValueMode string
const ( FunnelValueFloat FunnelValueMode = "float" FunnelValueInteger FunnelValueMode = "integer" )
type PNGBackend ¶
type PNGBackend string
const ( PNGBackendAuto PNGBackend = "auto" PNGBackendRSVG PNGBackend = "rsvg" PNGBackendCanvas PNGBackend = "canvas" )
type PNGOptions ¶
type PNGOptions struct {
Width int
Height int
Scale float64
Background string
Backend PNGBackend
}
type PNGRenderError ¶
type PNGRenderError struct {
Attempts []BackendAttemptError
}
func (*PNGRenderError) Error ¶
func (e *PNGRenderError) Error() string
func (*PNGRenderError) Unwrap ¶
func (e *PNGRenderError) Unwrap() error
Unwrap returns the first backend error to enable errors.Is/errors.As checks.
type SpiderChart ¶
type SpiderChart struct {
Title string
Labels []string
Datasets []SpiderDataset
Max *float64
Levels int
Size int
Padding int
Theme SpiderTheme
}
SpiderChart renders a radar/spider chart for static reports (SVG/PNG).
func NewSpiderChart ¶
func NewSpiderChart(labels []string, datasets []SpiderDataset) *SpiderChart
NewSpiderChart creates a SpiderChart with sensible defaults.
func (*SpiderChart) RenderPNG ¶
func (sc *SpiderChart) RenderPNG(opts PNGOptions) ([]byte, error)
func (*SpiderChart) RenderSVG ¶
func (sc *SpiderChart) RenderSVG() (string, error)
func (*SpiderChart) ToSVG ¶
func (sc *SpiderChart) ToSVG() string
ToSVG is deprecated and kept for compatibility with previous versions.
func (*SpiderChart) WritePNG ¶
func (sc *SpiderChart) WritePNG(path string, opts PNGOptions) error
func (*SpiderChart) WriteSVG ¶
func (sc *SpiderChart) WriteSVG(path string) error
type SpiderDataset ¶
SpiderDataset defines one series on the radar/spider chart.
type SpiderTheme ¶
type SpiderTheme string
const ( SpiderThemeLight SpiderTheme = "light" SpiderThemeDark SpiderTheme = "dark" )
type SplineChart ¶
type SplineChart struct {
Title string
Labels []string
Series []SplineSeries
Width int
Height int
Padding int
Max *float64
Palette []string
Theme SplineTheme
ShowPoints bool
}
SplineChart renders smoothed line charts with area under the curve (SVG/PNG).
func NewSplineChart ¶
func NewSplineChart(title string, labels []string, series []SplineSeries) *SplineChart
NewSplineChart creates a SplineChart with sensible defaults.
func (*SplineChart) RenderPNG ¶
func (sc *SplineChart) RenderPNG(opts PNGOptions) ([]byte, error)
func (*SplineChart) RenderSVG ¶
func (sc *SplineChart) RenderSVG() (string, error)
func (*SplineChart) ToSVG ¶
func (sc *SplineChart) ToSVG() string
ToSVG is deprecated and kept for compatibility with previous versions.
func (*SplineChart) WritePNG ¶
func (sc *SplineChart) WritePNG(path string, opts PNGOptions) error
func (*SplineChart) WriteSVG ¶
func (sc *SplineChart) WriteSVG(path string) error
type SplineSeries ¶
SplineSeries defines one line/area dataset on a spline chart.
type SplineTheme ¶
type SplineTheme string
const ( SplineThemeLight SplineTheme = "light" SplineThemeDark SplineTheme = "dark" )





