Types Reference
All types below are exported from the root @datastripes/anomaly entry (and re-exported by every framework entry point: /react, /vue, /angular, and /elements).
DatastripesProps
The top-level props accepted by the React/Vue/Angular/Element wrappers for time-series anomaly detection.
ts
interface DatastripesProps {
data: Array<Record<string, any>> | string; // records, CSV text, or JSON array
view?: AnomalyViewPresentation; // 'composite' | 'chart' | 'table' | 'kpi' | 'model_details'
apiKey?: string; // licensing server API key
targetHost?: string; // override domain used for license checks
algorithm?: AnomalyAlgorithm;
columnMapping?: ColumnMappingOverride;
hyperparameters?: DetectionHyperparameters;
theme?: 'dark' | 'light';
height?: number | string;
className?: string;
customOptions?: DatastripesCustomOptions;
onDetectionComplete?: (result: AnomalyOutput) => void;
onLicenseChecked?: (status: LicenseValidationResult) => void;
onError?: (err: Error) => void;
}AnomalyAlgorithm
ts
type AnomalyAlgorithm =
| 'zscore' // global z-score
| 'rolling_zscore' // windowed/rolling z-score
| 'iqr' // interquartile range
| 'mad' // median absolute deviation (modified z-score)
| 'stl_residual' // STL-lite seasonal-trend residual decomposition
| 'ensemble'; // majority vote across all five methods aboveDetectionHyperparameters
ts
interface DetectionHyperparameters {
windowSize?: number; // rolling z-score window length, e.g. 20
zThreshold?: number; // z-score / rolling z-score / STL residual threshold, e.g. 3
iqrMultiplier?: number; // IQR whisker multiplier, e.g. 1.5
madThreshold?: number; // modified z-score threshold, e.g. 3.5
stlPeriod?: number; // seasonal period length, e.g. 7 for weekly
ensembleMinVotes?: number; // minimum methods that must agree, e.g. 2
}AnomalyOutput
The result of executeAnomalyDetection:
ts
interface AnomalyOutput {
algorithm: AnomalyAlgorithm;
points: AnomalyDataPoint[];
historicalCount: number;
truncatedCount: number;
metrics: AnomalyMetrics;
hyperparameters: DetectionHyperparameters;
algorithmComparison: AlgorithmComparisonItem[];
licenseStatus: LicenseValidationResult;
columnMapping: {
timeKey: string;
targetKey: string;
exogenousKeys: string[];
detectedTypes?: Record<string, 'datetime' | 'numeric' | 'categorical' | 'text'>;
};
}AnomalyDataPoint
ts
interface AnomalyDataPoint {
index: number;
timestamp: number;
dateStr: string;
value: number | null;
score: number; // anomaly score (higher = more anomalous)
isAnomaly: boolean;
severity: 'low' | 'medium' | 'high' | null;
baseline?: number | null; // expected value per the chosen method
upperBound?: number | null;
lowerBound?: number | null;
}LicenseValidationResult
Returned by checkLicense (see Licensing):
ts
interface LicenseValidationResult {
isValid: boolean;
licenseKey: string;
domain: string;
isHostMatch: boolean;
isExpired: boolean;
expiresAt: string | null;
plan: 'trial' | 'pro' | 'enterprise';
customerName?: string;
maxHistoricalRows: number;
canExport: boolean;
showWatermark: boolean;
tamperDetected: boolean;
hashDigest: string;
issuedAt?: string;
}ChartStyleOptions
Passed via customOptions.chart, controls the time-series chart:
ts
interface ChartStyleOptions {
renderMode?: 'line' | 'bar'; // 'line' (default): connected series + baseline band.
// 'bar': one bar per point, colored by anomaly severity.
historicalColor?: string;
anomalyColor?: string;
baselineColor?: string;
boundColor?: string;
gridColor?: string;
backgroundColor?: string;
textColor?: string;
lineWidth?: number;
barGapRatio?: number; // bar mode only, fraction of each slot left as gap (default 0.25)
showBaseline?: boolean;
showBounds?: boolean;
showGrid?: boolean;
showTooltips?: boolean;
yAxisFormat?: 'currency' | 'percent' | 'compact' | 'number';
yAxisPrefix?: string;
yAxisSuffix?: string;
}See Chart options for a visual comparison of line vs bar mode and Scatter anomaly detection for the bivariate (x, y) mode, which uses its own component and types instead of this one.
Other notable types
ColumnDiscoveryResult, ColumnMappingOverride, AnomalyMetrics, AlgorithmComparisonItem, KpiCardsOptions, HeaderToolbarOptions, DiagnosticTabsOptions, ExportOptions, DatastripesCustomOptions, all defined in packages/anomaly/src/types.ts and exported unchanged from @datastripes/anomaly.
Scatter (bivariate) detection types
A separate, parallel API for unordered (x, y) point clouds — see Scatter anomaly detection.
ts
interface ScatterDatastripesProps {
data: Array<Record<string, any>> | string;
apiKey?: string;
targetHost?: string;
columnMapping?: ScatterColumnMappingOverride; // { xKey?, yKey?, labelKey? }
hyperparameters?: ScatterHyperparameters; // { threshold?: number }
theme?: 'dark' | 'light';
height?: number | string;
className?: string;
onDetectionComplete?: (result: ScatterOutput) => void;
onLicenseChecked?: (status: LicenseValidationResult) => void;
onError?: (err: Error) => void;
}
interface ScatterDataPoint {
index: number;
label: string;
x: number;
y: number;
score: number; // Mahalanobis distance from the bivariate center
isAnomaly: boolean;
severity: 'low' | 'medium' | 'high' | null;
}
interface ScatterOutput {
points: ScatterDataPoint[];
historicalCount: number;
truncatedCount: number;
metrics: ScatterMetrics;
hyperparameters: ScatterHyperparameters;
centerX: number;
centerY: number;
licenseStatus: LicenseValidationResult;
columnMapping: { xKey: string; yKey: string; labelKey?: string };
}