API Reference
Properties
| data: HistogramData | All resources and allocations (read-only). |
| sheet: HistogramSheet | The sheet (table) component (read-only). |
| events: ResourceHistogramEvents | Event emitters (read-only). |
| settings: ResourceHistogramSettings | Settings object — access theme and locale (read-only). |
| showThresholdLine: boolean | Show/hide the capacity threshold line. Default: true. |
| showGridLines: boolean | Show/hide grid lines on the chart. Default: true. |
| showTodayLine: boolean | Show/hide the today indicator line. Default: true. |
| displayMode: HistogramDisplayMode | Display mode: 'bar' or 'area'. Default: 'bar'. |
| viewMode: HistogramViewMode | View mode: 'resource' or 'aggregate'. Default: 'resource'. |
| markers: Marker[] | Timeline markers. |
| filter: HistogramResourceFilterFn | null | Active resource filter function. |
| barTooltip: HistogramBarTooltipFn | null | Custom tooltip function. Set to null for default tooltip. |
| projectTimeline: DateRange | Project start/end date bounds. |
| autoZoomToFit: boolean | Automatically zoom to fit when data is loaded. Default: true. |
| canUndo$: BehaviorSubject<boolean> | Whether undo is available (observable, read-only). |
| canRedo$: BehaviorSubject<boolean> | Whether redo is available (observable, read-only). |
Methods
| load(json: string): void | Load data from a JSON string. |
| save(): string | Serialize current state to a JSON string. |
| zoomIn(): boolean | Zoom in. Returns false if already at max zoom. |
| zoomOut(): boolean | Zoom out. Returns false if already at min zoom. |
| zoomToFit(): void | Fit the view to show all allocations. |
| scrollToDate(date: Date): void | Scroll the timeline to a specific date. |
| scrollToResource(resource: HistogramResource): void | Scroll to make a resource row visible. |
| goToProjectStart(): void | Scroll to the project start date. |
| undo(): void | Undo the last action. |
| redo(): void | Redo the last undone action. |
| addMarker(marker: Marker): void | Add a timeline marker. |
| removeMarker(marker: Marker): void | Remove a timeline marker. |
| clearMarkers(): void | Remove all timeline markers. |
| clearFilter(): void | Clear the active resource filter. |
| bindToGantt(gantt: GanttChartEngine): void | Bind to a Gantt Chart for live data synchronization. |
| unbindFromGantt(): void | Disconnect from a previously bound Gantt Chart. |
| saveColumns(): ColumnState[] | Save column layout (widths, order, visibility). |
| loadColumns(states: ColumnState[]): void | Restore column layout. |
| exportToImage(): Promise<Blob> | Export histogram as PNG. |
| exportToCsv(options?: HistogramCsvExportOptions): string | Export as CSV string. |
| exportToPdf(options?: HistogramPdfExportOptions): Promise<Blob> | Export as PDF (requires jspdf). |
| exportToExcel(options?: HistogramExcelExportOptions): Promise<Blob> | Export as Excel (requires exceljs). |
| destroy(): void | Destroy the histogram and release all DOM resources. Called automatically in framework wrappers. |
Events
Available via histogram.events. All events are RxJS Subjects.
| barClick$: Subject<HistogramBarClickArgs> | Emitted when a histogram bar/row is clicked. |
| barDblClick$: Subject<HistogramBarClickArgs> | Emitted when a histogram bar/row is double-clicked. |
| chartContextMenu$: Subject<HistogramChartContextMenuArgs> | Emitted on right-click on the chart area. |
| resourceHover$: Subject<HistogramResource | null> | Emitted when a resource row is hovered in the chart. Null when mouse leaves. |
| projectTimeline$: Subject<DateRange> | Emitted when the project timeline bounds change. |
| undone$: Subject<void> | Emitted when an undo is performed. |
| redone$: Subject<void> | Emitted when a redo is performed. |
Types & Enums
HistogramResource
| id: string | Unique identifier (read-only). |
| name: string | Display name. |
| maxCapacity: number | Maximum capacity in percent (100 = 1 FTE). Default: 100. |
| filtered: boolean | Whether excluded by the active filter (read-only). |
| changed$: Subject<HistogramResourceEventArgs> | Emitted when any property changes. |
| toAny(): any | Serialize to a plain object. |
| static fromAny(obj): HistogramResource | Create from a plain object. |
HistogramAllocation
| id: string | Unique identifier (read-only). |
| resourceId: string | ID of the resource this allocation belongs to. |
| name: string | Display name (typically the task name). |
| startTime: Date | Start date/time. |
| endTime: Date | End date/time. |
| capacity: number | Allocation capacity in percent (100 = full-time). |
| changed$: Subject<HistogramAllocationEventArgs> | Emitted when any property changes. |
| toAny(): any | Serialize to a plain object. |
| static fromAny(obj): HistogramAllocation | Create from a plain object. |
HistogramData
| resourcesLength: number | Total number of resources. |
| getResource(index): HistogramResource | Get a resource by index. |
| getResourceById(id): HistogramResource | null | Find a resource by ID. |
| createResource(id?): HistogramResource | Create a new resource instance (not yet added). |
| addResource(resource): void | Add a resource. |
| removeResource(resource): void | Remove a resource and all its allocations. |
| removeResourceById(id): boolean | Remove a resource by ID. Returns true if found. |
| assignResources(resources): void | Replace all resources. |
| allocationsLength: number | Total number of allocations. |
| getAllocation(index): HistogramAllocation | Get an allocation by index. |
| getAllocationById(id): HistogramAllocation | null | Find an allocation by ID. |
| getAllocationsForResource(resourceId): HistogramAllocation[] | Get all allocations for a resource. |
| createAllocation(resourceId, start, end, id?): HistogramAllocation | Create a new allocation instance (not yet added). |
| addAllocation(allocation): void | Add an allocation. |
| removeAllocation(allocation): void | Remove an allocation. |
| removeAllocationById(id): boolean | Remove an allocation by ID. Returns true if found. |
| assignAllocations(allocations): void | Replace all allocations. |
| clearAll(): void | Remove all resources and allocations. |
| getUtilization(resourceId, bucketStart, bucketEnd): number | Compute utilization for a resource in a time bucket. |
| getPeakUtilization(resourceId): number | Get peak utilization across all time. |
| getAggregateUtilization(bucketStart, bucketEnd): number | Compute aggregate utilization across all visible resources. |
| aggregateMaxCapacity: number | Total max capacity across all visible resources. |
| minStartTime: Date | null | Earliest allocation start time. |
| maxEndTime: Date | null | Latest allocation end time. |
| orderedResources: HistogramResource[] | Visible resources in order (filtered excluded). |
| filter: HistogramResourceFilterFn | null | Active resource filter function. |
HistogramBarClickArgs
| resource: HistogramResource | The clicked resource. |
| date: Date | The start date of the clicked time bucket. |
| utilization: number | Total utilization percentage in this bucket. |
HistogramChartContextMenuArgs
| resource: HistogramResource | null | The right-clicked resource, or null. |
| date: Date | The date at the click position. |
| area: 'header' | 'content' | Whether the click was on the header or content area. |
| mouseEvent: MouseEvent | The original browser mouse event. |
HistogramBarTooltipArgs
| resource: HistogramResource | The hovered resource. |
| date: Date | The start date of the hovered time bucket. |
| utilization: number | Total utilization percentage in this bucket. |
HistogramBarTooltipContent
| title: string | Tooltip title text. |
| lines: TooltipLine[] | Array of { name: string, value: string } pairs. |
HistogramBarTooltipFn
| (args: HistogramBarTooltipArgs) => HistogramBarTooltipContent | null | Custom tooltip function. Return null to suppress the tooltip. |
HistogramDisplayMode
| 'bar' | Bar chart display (default). |
| 'area' | Area chart display. |
HistogramViewMode
| 'resource' | Per-resource rows (default). |
| 'aggregate' | Combined single row showing total utilization. |
HistogramResourceFilterFn
| (resource: HistogramResource) => boolean | Return true to show the resource, false to hide it. |
HistogramCsvExportOptions
| delimiter?: ',' | ';' | '\t' | Column delimiter. Default: ','. |
| includeHeaders?: boolean | Include column headers. Default: true. |
HistogramExcelExportOptions
| allocationsSheetName?: string | Name of the allocations sheet. Default: 'Allocations'. |
| includeResourcesSheet?: boolean | Include a sheet with resources. Default: true. |
| includeFormatting?: boolean | Apply formatting (bold headers, column widths, frozen header). Default: true. |
HistogramPdfExportOptions
| orientation?: 'portrait' | 'landscape' | Page orientation. Default: 'landscape'. |
| pageSize?: 'a4' | 'letter' | 'legal' | Page size. Default: 'a4'. |
HistogramTheme
| extends BaseTheme | Inherits all base theme properties (sheet, chart, rowHeight, etc.). |
| histogram: HistogramStyle | Histogram-specific bar and area chart styling. |
ResourceHistogramSettings
| locale: TimelineKitLocale | Current locale (get/set). |
| theme: HistogramTheme | Current theme (get/set). |
| changed$: Subject<void> | Emitted when settings change. |