Documentation
¶
Overview ¶
Package viz provides visualization functions for vulnerability analysis data. It uses gonum/plot for generating charts and graphs.
Index ¶
- Variables
- func CreateBarChart(data []BarData, config BarChartConfig) (*plot.Plot, error)
- func CreateBoxPlot(categories []CategoryData, config BoxPlotConfig) (*plot.Plot, error)
- func CreateHistogram(scores []float64, config HistogramConfig) (*plot.Plot, error)
- func CreateScatterPlot(points []Point, config ScatterConfig) (*plot.Plot, error)
- func SavePlot(p *plot.Plot, filename string, width, height vg.Length) error
- type BarChartConfig
- type BarData
- type BoxPlotConfig
- type CategoryData
- type ConsensusTypeDistribution
- type EPSSPercentileBuckets
- type HistogramConfig
- type Point
- type ScatterConfig
- type SeverityDistribution
- type SummaryStats
Constants ¶
This section is empty.
Variables ¶
var ( ColorConsensus = color.RGBA{R: 76, G: 175, B: 80, A: 255} // Green ColorPartial = color.RGBA{R: 255, G: 193, B: 7, A: 255} // Amber ColorUnique = color.RGBA{R: 244, G: 67, B: 54, A: 255} // Red ColorDefault = color.RGBA{R: 33, G: 150, B: 243, A: 255} // Blue )
Colors for different categories
Functions ¶
func CreateBarChart ¶
func CreateBarChart(data []BarData, config BarChartConfig) (*plot.Plot, error)
CreateBarChart creates a bar chart.
func CreateBoxPlot ¶
func CreateBoxPlot(categories []CategoryData, config BoxPlotConfig) (*plot.Plot, error)
CreateBoxPlot creates a box plot comparing EPSS score distributions across categories.
func CreateHistogram ¶
func CreateHistogram(scores []float64, config HistogramConfig) (*plot.Plot, error)
CreateHistogram creates a histogram of EPSS scores.
func CreateScatterPlot ¶
func CreateScatterPlot(points []Point, config ScatterConfig) (*plot.Plot, error)
CreateScatterPlot creates a scatter plot.
Types ¶
type BarChartConfig ¶
type BarChartConfig struct {
Title string
XLabel string
YLabel string
Width vg.Length
Height vg.Length
FileName string
}
BarChartConfig configures bar chart generation.
func DefaultBarChartConfig ¶
func DefaultBarChartConfig() BarChartConfig
DefaultBarChartConfig returns default bar chart configuration.
type BarData ¶
BarData represents a single bar in a bar chart.
func CreateConsensusBarData ¶
func CreateConsensusBarData(dist ConsensusTypeDistribution) []BarData
CreateConsensusBarData prepares data for consensus type distribution.
func CreateEPSSBucketData ¶
func CreateEPSSBucketData(buckets EPSSPercentileBuckets) []BarData
CreateEPSSBucketData prepares data for EPSS bucket distribution.
func CreateSeverityPieData ¶
func CreateSeverityPieData(dist SeverityDistribution) []BarData
CreateSeverityPieData prepares data for severity distribution visualization.
type BoxPlotConfig ¶
type BoxPlotConfig struct {
Title string
YLabel string
Width vg.Length
Height vg.Length
FileName string
}
BoxPlotConfig configures box plot generation.
func DefaultBoxPlotConfig ¶
func DefaultBoxPlotConfig() BoxPlotConfig
DefaultBoxPlotConfig returns default box plot configuration.
type CategoryData ¶
CategoryData represents data for a single category.
type ConsensusTypeDistribution ¶
ConsensusTypeDistribution represents vulnerability counts by consensus type.
type EPSSPercentileBuckets ¶
type EPSSPercentileBuckets struct {
Low int // 0-25th percentile
Medium int // 25-50th percentile
High int // 50-75th percentile
Critical int // 75-100th percentile
}
EPSSPercentileBuckets groups EPSS scores into percentile buckets.
func BucketScores ¶
func BucketScores(scores []float64) EPSSPercentileBuckets
BucketScores groups EPSS scores into percentile buckets.
type HistogramConfig ¶
type HistogramConfig struct {
Title string
XLabel string
YLabel string
Bins int
Width vg.Length
Height vg.Length
FileName string
}
HistogramConfig configures histogram generation.
func DefaultHistogramConfig ¶
func DefaultHistogramConfig() HistogramConfig
DefaultHistogramConfig returns default histogram configuration.
type ScatterConfig ¶
type ScatterConfig struct {
Title string
XLabel string
YLabel string
Width vg.Length
Height vg.Length
FileName string
}
ScatterConfig configures scatter plot generation.
func DefaultScatterConfig ¶
func DefaultScatterConfig() ScatterConfig
DefaultScatterConfig returns default scatter plot configuration.
type SeverityDistribution ¶
SeverityDistribution represents vulnerability counts by severity.
type SummaryStats ¶
type SummaryStats struct {
TotalVulnerabilities int
UniqueVulnerabilities int
ConsensusCount int
PartialCount int
UniqueCount int
MeanEPSS float64
MedianEPSS float64
HighRiskCount int // EPSS > 0.5
CriticalRiskCount int // EPSS > 0.75
}
SummaryStats contains statistics for a report.
func CalculateSummaryStats ¶
func CalculateSummaryStats(epssScores []float64, consensus, partial, unique int) SummaryStats
CalculateSummaryStats calculates summary statistics from EPSS scores and consensus counts.