Documentation
¶
Overview ¶
templ: version: v0.3.1020
Package bar renders accessible server-side SVG bar charts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Label string
Caption string
Title string
Labels []string
Series []Series
Stacked bool
Orientation Orientation
Geometry GeometryOptions
LabelPosition DataLabelPosition
Legend LegendOptions
ValueAxis ValueAxisOptions
Padding Padding
Width int
Height int
Style charttheme.Style
// Controls configures shared controls; Expand defaults on while fullscreen defaults off.
Controls chartcontrol.Options
// Export customizes or disables default SVG and PNG export.
Export *chartcontrol.ExportOptions
}
Config describes an SSR SVG categorical bar chart. Vertical is the default orientation. Horizontal charts include an adjacent exact-value table.
type DataLabelOptions ¶ added in v0.0.2
type DataLabelOptions struct {
Show bool
Format ValueFormat
}
DataLabelOptions controls exact labels rendered at individual bars.
type DataLabelPosition ¶ added in v0.0.2
type DataLabelPosition string
DataLabelPosition selects which end of a bar anchors visible value labels. End is the default: above vertical bars and after horizontal bars. Start anchors labels at the category-axis side without exposing physical renderer positions.
const ( // DataLabelPositionEnd anchors labels at the value end. DataLabelPositionEnd DataLabelPosition = "" // DataLabelPositionStart anchors labels at the category-axis side. DataLabelPositionStart DataLabelPosition = "start" )
type GeometryOptions ¶ added in v0.0.2
GeometryOptions controls bar thickness, group spacing, and value-end caps. Ratios use the renderer-neutral range 0..1; zero thickness selects automatic sizing. A nil gap selects automatic spacing while a pointer to zero removes the gap.
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance is a renderable server-side bar chart.
func (Instance) Kind ¶
func (Instance) Kind() chartcomponents.Kind
Kind identifies the component as a bar chart.
type LegendOptions ¶ added in v0.0.2
type LegendOptions struct {
Hidden bool
Placement LegendPlacement
Overlay bool
}
LegendOptions controls renderer-neutral legend visibility and placement.
type LegendPlacement ¶ added in v0.0.2
type LegendPlacement string
LegendPlacement selects horizontal legend placement.
const ( // LegendPlacementDefault preserves the renderer-neutral automatic placement. LegendPlacementDefault LegendPlacement = "" // LegendPlacementStart aligns the legend to the start edge. LegendPlacementStart LegendPlacement = "start" // LegendPlacementCenter centers the legend. LegendPlacementCenter LegendPlacement = "center" // LegendPlacementEnd aligns the legend to the end edge. LegendPlacementEnd LegendPlacement = "end" )
type Orientation ¶
type Orientation string
Orientation selects the categorical bar direction.
const ( // OrientationVertical keeps categories on the horizontal axis. OrientationVertical Orientation = "" // OrientationHorizontal keeps categories on the vertical axis. OrientationHorizontal Orientation = "horizontal" )
type Padding ¶
type Padding struct{ Top, Right, Bottom, Left int }
Padding controls chart inset in pixels. Its zero value keeps renderer defaults.
type ReferenceStyle ¶ added in v0.0.2
ReferenceStyle controls semantic presentation for one series' reference annotations. Color overrides the series token used by the rendered marks. Class is applied to the adjacent evidence row, allowing caller CSS without exposing renderer details.
type References ¶ added in v0.0.2
type References struct {
Average bool
Minimum bool
Maximum bool
MaximumLine bool
GlobalMaximum bool
PointPrefix string
Format ValueFormat
PointSize int
Style ReferenceStyle
}
References selects statistical annotations for one series. Average renders a reference line; Minimum and Maximum render reference points. Duplicate or disabled annotations are resolved deterministically from these booleans.
type Series ¶
type Series struct {
Name string
Values []float64
Labels DataLabelOptions
References References
}
Series is one named sequence of values aligned with Config.Labels.
type ValueAxisOptions ¶ added in v0.0.2
type ValueAxisOptions struct {
Hidden bool
}
ValueAxisOptions controls the numeric axis shared by the bar series.
type ValueFormat ¶ added in v0.0.2
type ValueFormat string
ValueFormat selects renderer-neutral formatting for reference annotation values.
const ( // ValueFormatDefault keeps the renderer's default numeric formatting. ValueFormatDefault ValueFormat = "" // ValueFormatHumanized rounds values to zero decimal places for compact labels. ValueFormatHumanized ValueFormat = "humanized" )