charts

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package charts provides HTML chart generation for metrics visualization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombinedReport

func CombinedReport(
	summary ReportSummary,
	cycleTimeData []metrics.CycleTimeResult,
	cycleTimePercentiles []float64,
	throughputData metrics.ThroughputResult,
	longestCTRows []LongestCycleTimeRow,
	forecastRows []ForecastRow,
	jiraBaseURL string,
	path string,
) error

CombinedReport renders a 2x2 HTML report with cycle time, throughput, longest CT, and forecast.

func CombinedTeamReport

func CombinedTeamReport(
	title string,
	summary ReportSummary,
	deploymentData metrics.ThroughputResult,
	deploymentFailures metrics.ThroughputResult,
	cycleTimeData []metrics.CycleTimeResult,
	cycleTimePercentiles []float64,
	throughputData metrics.ThroughputResult,
	longestCTRows []LongestCycleTimeRow,
	forecastRows []ForecastRow,
	jiraBaseURL string,
	snykSummary SnykSummary,
	snykWeeks []SnykIssueWeek,
	path string,
) error

CombinedTeamReport renders an HTML report combining GitHub deployment frequency, JIRA metrics, and Snyk vulnerability sections.

func CycleTimeScatter

func CycleTimeScatter(data []metrics.CycleTimeResult, percentiles []float64, cfg Config, path string) error

CycleTimeScatter creates an HTML scatter plot of cycle times.

func CycleTimeScatterHTML

func CycleTimeScatterHTML(data []metrics.CycleTimeResult, percentiles []float64, title string) (template.HTML, error)

CycleTimeScatterHTML returns a self-contained HTML fragment for the cycle time scatter chart.

func CycleTimeTrendFrom

func CycleTimeTrendFrom(results []metrics.CycleTimeResult) string

CycleTimeTrendFrom returns the trend direction from cycle time results sorted by end date.

func DeploymentFrequencyLine

func DeploymentFrequencyLine(data metrics.ThroughputResult, failures metrics.ThroughputResult, cfg Config, path string) error

DeploymentFrequencyLine creates an HTML page with a deployment frequency line chart.

func DeploymentFrequencyLineHTML

func DeploymentFrequencyLineHTML(data metrics.ThroughputResult, failures metrics.ThroughputResult, title string) (template.HTML, error)

DeploymentFrequencyLineHTML returns a self-contained HTML fragment for the deployment frequency line chart. failures may be an empty ThroughputResult if no failure data is available.

func DeploymentSummaryHTML

func DeploymentSummaryHTML(deployments metrics.ThroughputResult, failures metrics.ThroughputResult, weeks int) (template.HTML, error)

DeploymentSummaryHTML returns an HTML fragment summarising deploy frequency and failed pipelines.

func ForecastTable

func ForecastTable(rows []ForecastRow, jiraBaseURL, path string) error

ForecastTable creates an HTML table of epic forecasts.

func ForecastTableHTML

func ForecastTableHTML(rows []ForecastRow, title, jiraBaseURL string) (template.HTML, error)

ForecastTableHTML returns a self-contained HTML fragment for the forecast table.

func LongestCycleTimeTable

func LongestCycleTimeTable(rows []LongestCycleTimeRow, title, jiraBaseURL, path string) error

LongestCycleTimeTable creates an HTML table of longest cycle times.

func LongestCycleTimeTableHTML

func LongestCycleTimeTableHTML(rows []LongestCycleTimeRow, title, jiraBaseURL string) (template.HTML, error)

LongestCycleTimeTableHTML returns a self-contained HTML fragment for the CT table.

func OpenBrowser

func OpenBrowser(path string) error

OpenBrowser opens the given file path in the default browser.

func PeriodsTrendFrom

func PeriodsTrendFrom(periods []metrics.ThroughputPeriod) string

PeriodsTrendFrom returns the trend direction for a slice of throughput periods.

func ReportSummaryHTML

func ReportSummaryHTML(s ReportSummary) (template.HTML, error)

ReportSummaryHTML returns a self-contained HTML fragment for the summary bar.

func SLOWidgetSectionsHTML

func SLOWidgetSectionsHTML(sections []WidgetSection) (template.HTML, error)

SLOWidgetSectionsHTML returns an embeddable HTML fragment of SLO widget sections.

func SnykIssuesLine

func SnykIssuesLine(weeks []SnykIssueWeek, cfg Config, path string) error

SnykIssuesLine creates a multi-line HTML chart of Snyk issues by severity.

func SnykIssuesLineHTML

func SnykIssuesLineHTML(weeks []SnykIssueWeek, title string) (template.HTML, error)

SnykIssuesLineHTML returns a self-contained HTML fragment for the Snyk issues chart.

func SnykSectionReport

func SnykSectionReport(summary SnykSummary, weeks []SnykIssueWeek, title, path string) error

SnykSectionReport renders a standalone HTML page that matches the Snyk section in the combined team report — same template, same visual style.

func SnykSummaryHTML

func SnykSummaryHTML(s SnykSummary) (template.HTML, error)

SnykSummaryHTML returns a self-contained HTML fragment for the Snyk vulnerability summary bar.

func ThroughputLine

func ThroughputLine(data metrics.ThroughputResult, cfg Config, path string) error

ThroughputLine creates an HTML line chart of throughput over time.

func ThroughputLineHTML

func ThroughputLineHTML(data metrics.ThroughputResult, title string) (template.HTML, error)

ThroughputLineHTML returns a self-contained HTML fragment for the throughput line chart.

func WidgetPage

func WidgetPage(data WidgetPageData, path string) error

WidgetPage writes an HTML page of square status widgets to path.

Types

type Config

type Config struct {
	Title string
}

Config holds common chart configuration.

type DeploymentSummary

type DeploymentSummary struct {
	AvgDeployFreq      string
	AvgFailedPipelines string
	HasFailureData     bool
	DeployFreqTrend    string
	FailureTrend       string
	Weeks              int
}

DeploymentSummary holds pre-computed values for the GitHub deployment summary widget.

type ForecastRow

type ForecastRow struct {
	EpicKey    string
	Summary    string
	Completed  int
	Total      int
	Remaining  int
	Forecast50 string
	Forecast85 string
	Forecast95 string
}

ForecastRow holds data for one row in the forecast table.

type LongestCycleTimeRow

type LongestCycleTimeRow struct {
	Key        string
	Summary    string
	Days       string
	Started    string
	Completed  string
	Outlier    bool
	InProgress bool
}

LongestCycleTimeRow holds data for one row in the longest cycle time table.

type ReportSummary

type ReportSummary struct {
	AvgCycleTime    string
	AvgThroughput   string
	ActiveEpics     int
	Weeks           int
	CycleTimeTrend  string // "up", "down", "flat", or ""
	ThroughputTrend string
}

ReportSummary holds the key metrics displayed in the summary bar.

type SnykIssueWeek

type SnykIssueWeek struct {
	WeekStart        time.Time
	Total            int
	Fixable          int
	Unfixable        int
	IgnoredFixable   int
	IgnoredUnfixable int
}

SnykIssueWeek holds open vulnerability counts at the end of a week.

type SnykSummary

type SnykSummary struct {
	Critical         int
	High             int
	Medium           int
	Low              int
	Fixable          int
	Unfixable        int
	IgnoredFixable   int
	IgnoredUnfixable int
	// Fixable counts per severity level
	FixableCritical int
	FixableHigh     int
	FixableMedium   int
	FixableLow      int
	// Exploitable counts (Attacked or Proof of Concept exploit maturity level; ignored issues excluded from non-Ignored* fields)
	ExploitableCritical         int
	ExploitableHigh             int
	ExploitableMedium           int
	ExploitableLow              int
	ExploitableFixable          int
	ExploitableUnfixable        int
	ExploitableIgnoredFixable   int
	ExploitableIgnoredUnfixable int
	ExploitableTotal            int
}

SnykSummary holds aggregate vulnerability counts for the summary bar.

type Widget

type Widget struct {
	Name       string // displayed at the top of the widget
	Definition string // optional secondary line below the name (e.g. "SLI 99.88% / target 99.90%")
	Value      string // large number or short status text
	Label      string // small descriptive label below the value
	StateClass string // "widget-alerted" (red) or "widget-ok" (green)
}

Widget is a single square status tile in a widget grid page.

type WidgetPageData

type WidgetPageData struct {
	Title    string
	Subtitle string
	Sections []WidgetSection // optional grouped layout
	Widgets  []Widget        // flat layout (used when Sections is empty)
}

WidgetPageData holds the data for a full widget grid HTML page. Use Sections to group widgets under service/app headings; use Widgets for a flat list.

type WidgetSection

type WidgetSection struct {
	Title   string
	Widgets []Widget
}

WidgetSection is a labeled group of widgets within a widget page.

Jump to

Keyboard shortcuts

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