ScoreHistoryChartComponent

Timeline visualization showing how a finding’s evidence-weighted score has changed over time.

Overview

The ScoreHistoryChartComponent renders an SVG line chart displaying score history with interactive data points and bucket-colored bands.

Selector

<stella-score-history-chart />

Inputs

InputTypeDefaultDescription
historyScoreHistoryEntry[][]Array of historical score entries
widthnumber | 'auto''auto'Chart width in pixels
heightnumber200Chart height in pixels
showBandsbooleantrueShow bucket background bands
showGridbooleantrueShow horizontal grid lines
showRangeSelectorbooleanfalseShow date range filter controls

Outputs

OutputTypeDescription
pointHoverEventEmitter<ScoreHistoryEntry>Emits when hovering over a data point
pointClickEventEmitter<ScoreHistoryEntry>Emits when clicking a data point

History Entry Structure

interface ScoreHistoryEntry {
  score: number;               // 0-100
  bucket: ScoreBucket;
  policyDigest: string;        // SHA-256 of active policy
  calculatedAt: string;        // ISO 8601 timestamp
  trigger: ScoreChangeTrigger;
  changedFactors: string[];    // ['rch', 'rts', ...]
}

type ScoreChangeTrigger =
  | 'evidence_update'   // New evidence received
  | 'policy_change'     // Scoring policy modified
  | 'scheduled';        // Periodic recalculation

Chart Features

Bucket Bands

Colored background regions showing score thresholds:

Data Points

Interactive markers with trigger-type indicators:

Tooltips

Hover over any point to see:

Date Range Selector

When enabled, provides filtering options:

Usage Examples

Basic Usage

<stella-score-history-chart [history]="scoreHistory" />

Custom Dimensions

<stella-score-history-chart
  [history]="scoreHistory"
  [width]="600"
  [height]="250"
/>

Minimal Chart

<stella-score-history-chart
  [history]="scoreHistory"
  [showBands]="false"
  [showGrid]="false"
  [height]="150"
/>

With Date Range Selector

<stella-score-history-chart
  [history]="extendedHistory"
  [showRangeSelector]="true"
/>

Responsive Width

<div class="chart-container">
  <stella-score-history-chart
    [history]="scoreHistory"
    width="auto"
  />
</div>
.chart-container {
  width: 100%;
  min-width: 300px;
}

With Event Handlers

<stella-score-history-chart
  [history]="scoreHistory"
  (pointClick)="showEntryDetails($event)"
  (pointHover)="updateTooltip($event)"
/>
showEntryDetails(entry: ScoreHistoryEntry): void {
  console.log('Clicked entry:', entry);
  this.selectedEntry = entry;
}

updateTooltip(entry: ScoreHistoryEntry | null): void {
  this.hoveredEntry = entry;
}

Date Range Presets

PresetLabelFilter
7dLast 7 daysEntries from past week
30dLast 30 daysEntries from past month
90dLast 90 daysEntries from past quarter
1yLast yearEntries from past 12 months
allAll timeNo filtering
customCustom rangeUser-selected dates

Visualization Details

Line Chart

Grid Lines

Time Axis

Loading State

When history is empty or loading:

<stella-score-history-chart [history]="[]" />
<!-- Displays: "No history available" -->

Accessibility

Styling

stella-score-history-chart {
  --chart-line-color: #3b82f6;
  --chart-area-fill: rgba(59, 130, 246, 0.1);
  --chart-point-size: 6px;
  --chart-font-family: system-ui, sans-serif;
}

Performance