Documentation
¶
Overview ¶
Package dashboard provides HTML dashboard generation for PRISM maturity models.
Index ¶
- func GetMaturityBulletCSS() string
- func GetMaturityBulletCSSStyled() string
- func MaturityLevel(value float64) string
- func MaturityStatus(level float64) string
- func MaturityStatusEmoji(level float64) string
- type Axis
- type ChartConfig
- type Dashboard
- type DataSource
- type Encode
- type FormatOptions
- type Generator
- type Grid
- type HTMLOptions
- type Layout
- type Legend
- type LevelThreshold
- type Mark
- type MaturityBullet
- func NewMaturityBullet(title, subtitle string, currentLevel, targetLevel float64) MaturityBullet
- func NewMaturityBulletWithDetails(title string, currentLevel, targetLevel, actualValue float64, ...) MaturityBullet
- func NewMaturityBulletWithProjection(title, subtitle string, currentLevel, projectedLevel, targetLevel float64) MaturityBullet
- type MaturityBulletData
- type MetricConfig
- type Position
- type Style
- type TableColumn
- type TableConfig
- type TextConfig
- type Theme
- type ThresholdValue
- type Tooltip
- type Widget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMaturityBulletCSS ¶
func GetMaturityBulletCSS() string
GetMaturityBulletCSS returns CSS for maturity-colored bullet charts. D3 sorts ranges descending: s0=highest(M5), s1=middle(M4), s2=lowest(M1-3). Zone colors: M5 = green (right), M4 = yellow (middle), M1-M3 = red (left).
func GetMaturityBulletCSSStyled ¶
func GetMaturityBulletCSSStyled() string
GetMaturityBulletCSSStyled returns CSS with the style tags included.
func MaturityLevel ¶
MaturityLevel returns the maturity level label (M1-M5) for a numeric value.
func MaturityStatus ¶
MaturityStatus returns the status (green/yellow/red) for a maturity level.
func MaturityStatusEmoji ¶
MaturityStatusEmoji returns an emoji indicator for a maturity level.
Types ¶
type Axis ¶
type Axis struct {
ID string `json:"id"`
Type string `json:"type"`
Position string `json:"position"`
Name string `json:"name,omitempty"`
Min *float64 `json:"min,omitempty"`
Max *float64 `json:"max,omitempty"`
}
Axis defines a chart axis.
type ChartConfig ¶
type ChartConfig struct {
Marks []Mark `json:"marks"`
Axes []Axis `json:"axes,omitempty"`
Grid *Grid `json:"grid,omitempty"`
Legend *Legend `json:"legend,omitempty"`
Tooltip *Tooltip `json:"tooltip,omitempty"`
}
ChartConfig configures a chart widget (ChartIR subset).
type Dashboard ¶
type Dashboard struct {
Schema string `json:"$schema,omitempty"`
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Layout Layout `json:"layout"`
DataSources []DataSource `json:"dataSources"`
Widgets []Widget `json:"widgets"`
Theme *Theme `json:"theme,omitempty"`
}
Dashboard represents a Dashforge-compatible dashboard.
func (*Dashboard) ToHTML ¶
func (d *Dashboard) ToHTML(opts HTMLOptions) (string, error)
ToHTML returns the dashboard as an HTML string.
type DataSource ¶
type DataSource struct {
ID string `json:"id"`
Type string `json:"type"`
Data json.RawMessage `json:"data,omitempty"`
URL string `json:"url,omitempty"`
Format string `json:"format,omitempty"`
}
DataSource defines a data source for widgets.
type Encode ¶
type Encode struct {
X string `json:"x,omitempty"`
Y string `json:"y,omitempty"`
Value string `json:"value,omitempty"`
Name string `json:"name,omitempty"`
}
Encode maps data to visual channels.
type FormatOptions ¶
type FormatOptions struct {
Decimals int `json:"decimals,omitempty"`
Prefix string `json:"prefix,omitempty"`
Suffix string `json:"suffix,omitempty"`
}
FormatOptions defines number formatting.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator creates dashboards from maturity specs.
func NewGenerator ¶
NewGenerator creates a dashboard generator for a maturity spec.
func (*Generator) GenerateMaturityBullets ¶
func (g *Generator) GenerateMaturityBullets() *MaturityBulletData
GenerateMaturityBullets creates bullet chart data for all domains.
func (*Generator) WithStateDocument ¶
func (g *Generator) WithStateDocument(doc *prism.PRISMDocument) *Generator
WithStateDocument adds a PRISM Maturity State document for state tracking. When set, state is read from this document instead of the legacy assessments.
type Grid ¶
type Grid struct {
Left string `json:"left,omitempty"`
Right string `json:"right,omitempty"`
Top string `json:"top,omitempty"`
Bottom string `json:"bottom,omitempty"`
ContainLabel bool `json:"containLabel,omitempty"`
}
Grid defines chart container positioning.
type HTMLOptions ¶
type HTMLOptions struct {
EmbedData bool // Embed data in HTML instead of external JSON
Title string // Page title override
Theme string // "light" or "dark"
}
HTMLOptions configures HTML output.
func DefaultHTMLOptions ¶
func DefaultHTMLOptions() HTMLOptions
DefaultHTMLOptions returns default HTML options.
type Layout ¶
type Layout struct {
Type string `json:"type"`
Columns int `json:"columns"`
RowHeight int `json:"rowHeight"`
Gap int `json:"gap"`
Padding int `json:"padding"`
}
Layout defines the dashboard grid layout.
type LevelThreshold ¶
type LevelThreshold struct {
Level int `json:"level"` // Maturity level (1-5)
Operator string `json:"operator,omitempty"` // >=, <=, ==, etc.
Value float64 `json:"value"` // Threshold value
ValueStr string `json:"valueStr,omitempty"` // Formatted value with unit
}
LevelThreshold defines the threshold for a specific maturity level.
type Mark ¶
type Mark struct {
ID string `json:"id"`
Geometry string `json:"geometry"`
Encode Encode `json:"encode"`
Style *Style `json:"style,omitempty"`
Stack string `json:"stack,omitempty"`
Name string `json:"name,omitempty"`
}
Mark represents a chart series.
type MaturityBullet ¶
type MaturityBullet struct {
Title string `json:"title,omitempty"`
Subtitle string `json:"subtitle,omitempty"`
Ranges []float64 `json:"ranges,omitempty"` // Zone boundaries [M3, M4, M5]
Measures []float64 `json:"measures,omitempty"` // Current maturity level(s)
Markers []float64 `json:"markers,omitempty"` // Target level(s)
ActualValue string `json:"actualValue,omitempty"` // Actual SLI value with unit (e.g., "65%", "120ms")
Thresholds []LevelThreshold `json:"thresholds,omitempty"` // Thresholds for each maturity level
}
MaturityBullet represents a D3 bullet chart for maturity visualization. Ranges are configured for M1-M3 (red), M4 (yellow), M5 (green) zones.
func NewMaturityBullet ¶
func NewMaturityBullet(title, subtitle string, currentLevel, targetLevel float64) MaturityBullet
NewMaturityBullet creates a bullet chart for a maturity metric. currentLevel is the actual achieved level (0-5). targetLevel is the target level (0-5), use 0 for no target marker.
func NewMaturityBulletWithDetails ¶
func NewMaturityBulletWithDetails(title string, currentLevel, targetLevel, actualValue float64, unit, qualitativeState string, thresholds []LevelThreshold) MaturityBullet
NewMaturityBulletWithDetails creates a bullet chart with actual SLI value and thresholds.
func NewMaturityBulletWithProjection ¶
func NewMaturityBulletWithProjection(title, subtitle string, currentLevel, projectedLevel, targetLevel float64) MaturityBullet
NewMaturityBulletWithProjection creates a bullet chart with current and projected levels.
type MaturityBulletData ¶
type MaturityBulletData struct {
Bullets []MaturityBullet `json:"bullets"`
}
MaturityBulletData holds a collection of maturity bullet charts.
func (*MaturityBulletData) ToJSON ¶
func (d *MaturityBulletData) ToJSON() ([]byte, error)
ToJSON returns the bullet data as JSON for JavaScript consumption.
type MetricConfig ¶
type MetricConfig struct {
ValueField string `json:"valueField"`
Format string `json:"format"`
FormatOptions *FormatOptions `json:"formatOptions,omitempty"`
Thresholds []ThresholdValue `json:"thresholds,omitempty"`
Subtitle string `json:"subtitle,omitempty"`
}
MetricConfig configures a metric widget.
type Style ¶
type Style struct {
Color string `json:"color,omitempty"`
BorderRadius any `json:"borderRadius,omitempty"`
BarWidth any `json:"barWidth,omitempty"`
Opacity *float64 `json:"opacity,omitempty"`
}
Style defines visual styling for marks.
type TableColumn ¶
type TableColumn struct {
Field string `json:"field"`
Header string `json:"header"`
Width string `json:"width,omitempty"`
Align string `json:"align,omitempty"`
Format string `json:"format,omitempty"`
}
TableColumn defines a table column.
type TableConfig ¶
type TableConfig struct {
Columns []TableColumn `json:"columns"`
Sortable bool `json:"sortable,omitempty"`
Striped bool `json:"striped,omitempty"`
}
TableConfig configures a table widget.
type TextConfig ¶
type TextConfig struct {
Content string `json:"content"`
Format string `json:"format,omitempty"`
Variables bool `json:"variables,omitempty"`
}
TextConfig configures a text widget.
type Theme ¶
type Theme struct {
Mode string `json:"mode"`
PrimaryColor string `json:"primaryColor"`
BackgroundColor string `json:"backgroundColor,omitempty"`
}
Theme defines dashboard visual styling.
type ThresholdValue ¶
ThresholdValue defines a color threshold.