@moderneinc/react-charts 1.2.0-next.2d0a72 → 1.2.0-next.313329

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/components/chrono-chart/chrono-chart.component.d.ts +10 -0
  2. package/dist/components/chrono-chart/chrono-chart.types.d.ts +118 -0
  3. package/dist/components/chrono-chart/components/category-table.component.d.ts +13 -0
  4. package/dist/components/chrono-chart/components/category-table.types.d.ts +42 -0
  5. package/dist/components/chrono-chart/utils/data-transformer.d.ts +41 -0
  6. package/dist/components/d3-stacked-area-chart/d3-stacked-area-chart.types.d.ts +21 -1
  7. package/dist/components/d3-stacked-area-chart/hooks/use-d3-stacked-area.hook.d.ts +7 -2
  8. package/dist/components/morph-chart/hooks/shared/computations.d.ts +12 -8
  9. package/dist/components/morph-chart/hooks/shared/types.d.ts +9 -5
  10. package/dist/components/morph-chart/hooks/use-morph-chart.hook.d.ts +45 -1
  11. package/dist/components/morph-chart/morph-chart.types.d.ts +22 -0
  12. package/dist/components/morph-chart/utils/accordion-generator.d.ts +102 -0
  13. package/dist/components/morph-chart/utils/area-renderer.d.ts +1 -0
  14. package/dist/components/morph-chart/utils/bar-renderer.d.ts +0 -9
  15. package/dist/components/morph-chart/utils/gsap-orchestrator.d.ts +55 -16
  16. package/dist/components/morph-chart/utils/parliament-renderer.d.ts +2 -0
  17. package/dist/components/morph-chart/utils/slinky-3d-generator.d.ts +35 -0
  18. package/dist/components/morph-chart/utils/svg-slinky-generator.d.ts +25 -0
  19. package/dist/components/timeline-chart/timeline-chart.types.d.ts +30 -0
  20. package/dist/index.cjs +84 -78
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +19340 -17737
  23. package/dist/theme/timeline-defaults.d.ts +33 -1
  24. package/package.json +6 -2
  25. package/dist/components/chrono-perspective-chart/chrono-perspective-chart.component.d.ts +0 -3
  26. package/dist/components/chrono-perspective-chart/chrono-perspective-chart.types.d.ts +0 -62
  27. package/dist/components/chrono-perspective-chart/components/category-table.component.d.ts +0 -3
  28. package/dist/components/chrono-perspective-chart/components/category-table.types.d.ts +0 -13
  29. package/dist/components/chrono-perspective-chart/utils/data-transformer.d.ts +0 -9
@@ -0,0 +1,10 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { ChronoChartProps } from './chrono-chart.types';
3
+ /**
4
+ * ChronoChart: A dual-mode time-series visualization component.
5
+ *
6
+ * Renders either a parliament diagram (point-in-time) or stacked area chart (historical)
7
+ * with smooth animated transitions between modes. Delegates rendering to MorphChart
8
+ * while managing mode logic, data transformation, and user interactions.
9
+ */
10
+ export declare const ChronoChart: FunctionComponent<ChronoChartProps>;
@@ -0,0 +1,118 @@
1
+ import { TimelineEvent } from '../timeline-chart/timeline-chart.types';
2
+ /**
3
+ * Represents a data category with visual styling and optional parliament-specific mappings.
4
+ */
5
+ export type ChronoCategory = {
6
+ /** Unique identifier for the category */
7
+ id: string;
8
+ /** Display label for the category */
9
+ label: string;
10
+ /** Color hex code (e.g., '#FF5733') */
11
+ color: string;
12
+ /** Optional dash pattern for the stroke (e.g., '5 5' for dashed lines) */
13
+ strokeDasharray?: string;
14
+ /** Parliament-specific configuration for special category rendering */
15
+ parliamentMapping?: {
16
+ /** Whether this category receives special visual treatment in parliament view */
17
+ isSpecialCategory: boolean;
18
+ /** Hatch pattern identifier for special categories */
19
+ hatchPattern?: string;
20
+ };
21
+ };
22
+ /**
23
+ * Complete dataset for the ChronoChart including time series, categories, and metadata.
24
+ */
25
+ export type ChronoData = {
26
+ /** Array of time-series data points, each containing a timestamp and category values */
27
+ timeSeries: Array<{
28
+ /** Unix timestamp or date number */
29
+ timestamp: number;
30
+ /** Map of category IDs to their numeric values at this timestamp */
31
+ values: Record<string, number>;
32
+ }>;
33
+ /** Category definitions with styling and metadata */
34
+ categories: ChronoCategory[];
35
+ /** Aggregate information about the dataset */
36
+ metadata: {
37
+ /** Total count across all categories */
38
+ total: number;
39
+ /** Counts for special categories (optional) */
40
+ specialCounts?: {
41
+ notApplicable: number;
42
+ noLst: number;
43
+ unavailable: number;
44
+ };
45
+ };
46
+ /** Optional timeline events to display alongside the historical view */
47
+ events?: TimelineEvent[];
48
+ };
49
+ /**
50
+ * Props for the ChronoChart component.
51
+ */
52
+ export type ChronoChartProps = {
53
+ /** Complete dataset to visualize */
54
+ data: ChronoData;
55
+ /**
56
+ * Index of the time series data point to display in point-in-time mode.
57
+ * - If set: Chart shows point-in-time view for data at this index
58
+ * - If undefined: Chart shows historical view (default)
59
+ * - If data.timeSeries.length === 1: Automatically shows point-in-time mode
60
+ *
61
+ * Note: Changing selectedIndex does NOT trigger animation. Animation only
62
+ * plays when toggling between point-in-time and historical modes.
63
+ */
64
+ selectedIndex?: number;
65
+ /** Chart title displayed at the top */
66
+ title?: string;
67
+ /** Chart subtitle displayed below the title */
68
+ subtitle?: string;
69
+ /** Whether to show the title/subtitle header section */
70
+ showHeader?: boolean;
71
+ /** Chart width in pixels (default: 900) */
72
+ width?: number;
73
+ /** Chart height in pixels (default: 600) */
74
+ height?: number;
75
+ /** Initial time range for the historical view [startTimestamp, endTimestamp] */
76
+ timeRange?: [number, number];
77
+ /** Callback when the time range changes (via brush or other interactions) */
78
+ onTimeRangeChange?: (range: [number, number]) => void;
79
+ /** Minimum allowed timestamp for time range selection (constrains brush selection) */
80
+ minAllowedTime?: number;
81
+ /** Maximum allowed timestamp for time range selection (constrains brush selection) */
82
+ maxAllowedTime?: number;
83
+ /** Enable brush selection for time range in historical mode */
84
+ enableBrush?: boolean;
85
+ /** Show the legend/category table */
86
+ showLegend?: boolean;
87
+ /** Enable tooltips on hover */
88
+ showTooltip?: boolean;
89
+ /** Show background grid lines */
90
+ showGrid?: boolean;
91
+ /** Enable animations when switching between modes */
92
+ enableAnimation?: boolean;
93
+ /** Duration of animations in milliseconds */
94
+ animationDuration?: number;
95
+ /**
96
+ * Disable the timeline in historical mode.
97
+ * By default, the timeline is always shown in historical mode, even when there are no events.
98
+ * Set this to true to hide the timeline.
99
+ * @default false
100
+ */
101
+ disableTimeline?: boolean;
102
+ /** Custom function to format timestamps for display */
103
+ formatDate?: (timestamp: number) => string;
104
+ /** Custom function to format numeric values for display */
105
+ formatValue?: (value: number) => string;
106
+ /** Callback when animation state changes (starting/stopping) */
107
+ onAnimationStateChange?: (isAnimating: boolean) => void;
108
+ /** Callback when the GSAP timeline is initialized */
109
+ onTimelineReady?: (timeline: unknown) => void;
110
+ /** Callback for animation progress updates */
111
+ onAnimationProgress?: (progress: number, stage: string) => void;
112
+ /**
113
+ * Color for brush selection overlay in historical mode.
114
+ * Used for both the selection area and drag handles.
115
+ * @default '#69b3a2'
116
+ */
117
+ brushColor?: string;
118
+ };
@@ -0,0 +1,13 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { CategoryTableProps } from './category-table.types';
3
+ /**
4
+ * CategoryTable displays a legend/data table for ChronoChart categories.
5
+ *
6
+ * The table adapts its columns based on the display mode:
7
+ * - Point-in-time: Shows current count and percentage for each category
8
+ * - Historical: Shows last value, maximum, and minimum across the time series
9
+ *
10
+ * Special categories (N/A, Data Missing, No LST) use hatch patterns instead of
11
+ * solid colors to distinguish them from regular data categories.
12
+ */
13
+ export declare const CategoryTable: FunctionComponent<CategoryTableProps>;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Type definitions for the CategoryTable component.
3
+ *
4
+ * The CategoryTable displays a legend/data table showing all categories with their
5
+ * values, percentages, and colors. It supports both point-in-time and historical modes.
6
+ */
7
+ /**
8
+ * Represents a single category row in the table.
9
+ */
10
+ export type CategoryTableItem = {
11
+ /** Unique identifier for the category */
12
+ id: string;
13
+ /** Display label for the category */
14
+ label: string;
15
+ /** Current value: "#" column in point-in-time mode OR "Last" column in historical mode */
16
+ value: number;
17
+ /** Percentage of total (displayed in point-in-time mode only) */
18
+ percentage: number;
19
+ /** Color hex code for the category's visual representation */
20
+ color: string;
21
+ /** Optional tooltip text providing additional context */
22
+ tooltip?: string;
23
+ /** Maximum value across time series (historical mode only) */
24
+ max?: number;
25
+ /** Minimum value across time series (historical mode only) */
26
+ min?: number;
27
+ };
28
+ /**
29
+ * Props for the CategoryTable component.
30
+ */
31
+ export type CategoryTableProps = {
32
+ /** Array of category items to display in the table */
33
+ categories: CategoryTableItem[];
34
+ /** Currently hovered category ID for highlighting, or null if none */
35
+ activeCategory: string | null;
36
+ /** Callback when user hovers over or leaves a category row */
37
+ onCategoryHover: (categoryId: string | null) => void;
38
+ /** Display mode affecting which columns are shown */
39
+ mode: 'point-in-time' | 'historical';
40
+ /** Whether the table is visible (affects opacity/display) */
41
+ visible?: boolean;
42
+ };
@@ -0,0 +1,41 @@
1
+ import { MorphChartCategory, MorphChartDataPoint } from '../../morph-chart/morph-chart.types';
2
+ import { ChronoData } from '../chrono-chart.types';
3
+ import { CategoryTableItem } from '../components/category-table.types';
4
+ /**
5
+ * Extracts the latest values from ChronoData and formats them for display in the category table.
6
+ *
7
+ * In point-in-time mode: Returns the latest value for each category
8
+ * In historical mode: Also includes min/max values across the time series
9
+ *
10
+ * @param data - The complete ChronoData dataset
11
+ * @param mode - Display mode affecting which values are included
12
+ * @returns Array of formatted category items with values, percentages, and metadata
13
+ */
14
+ export declare const extractLatestValues: (data: ChronoData, mode?: "point-in-time" | "historical") => CategoryTableItem[];
15
+ /**
16
+ * Transforms ChronoData format to MorphChart format for visualization.
17
+ *
18
+ * This conversion is necessary because ChronoChart uses its own data structure
19
+ * but delegates rendering to the MorphChart component.
20
+ *
21
+ * @param data - The ChronoData to transform
22
+ * @returns Object containing MorphChart-compatible data points and categories
23
+ * @throws Error if no data points are available
24
+ */
25
+ export declare const transformToMorphChart: (data: ChronoData) => {
26
+ data: MorphChartDataPoint[];
27
+ categories: MorphChartCategory[];
28
+ };
29
+ /**
30
+ * Validates the structure and integrity of ChronoData.
31
+ *
32
+ * Checks for:
33
+ * - Non-empty time series and categories
34
+ * - Required metadata fields
35
+ * - Proper timestamp ordering (ascending)
36
+ * - Category presence in data points
37
+ *
38
+ * @param data - The ChronoData to validate
39
+ * @throws Error with descriptive message if validation fails
40
+ */
41
+ export declare const validateChronoData: (data: ChronoData) => void;
@@ -11,6 +11,7 @@ export type D3StackedAreaCategory = {
11
11
  label: string;
12
12
  color: string;
13
13
  strokeWidth?: number;
14
+ strokeDasharray?: string;
14
15
  fillOpacity?: number;
15
16
  };
16
17
  export type D3StackedAreaChartProps = {
@@ -18,6 +19,16 @@ export type D3StackedAreaChartProps = {
18
19
  data: D3StackedAreaDataPoint[];
19
20
  /** Array of category definitions */
20
21
  categories: D3StackedAreaCategory[];
22
+ /** Chart title */
23
+ title?: string;
24
+ /** Chart subtitle */
25
+ subtitle?: string;
26
+ /** Show header (title and subtitle) */
27
+ showHeader?: boolean;
28
+ /** Show legend */
29
+ showLegend?: boolean;
30
+ /** Show tooltips on hover */
31
+ showTooltip?: boolean;
21
32
  /** Chart dimensions */
22
33
  width?: number;
23
34
  height?: number;
@@ -32,8 +43,12 @@ export type D3StackedAreaChartProps = {
32
43
  timeRange?: [number, number];
33
44
  /** Show grid lines */
34
45
  showGrid?: boolean;
35
- /** Show axes */
46
+ /** Show axes (deprecated: use showXAxis and showYAxis instead) */
36
47
  showAxes?: boolean;
48
+ /** Show X-axis */
49
+ showXAxis?: boolean;
50
+ /** Show Y-axis */
51
+ showYAxis?: boolean;
37
52
  /** Enable animations */
38
53
  enableAnimation?: boolean;
39
54
  /** Animation duration */
@@ -46,12 +61,17 @@ export type D3StackedAreaChartProps = {
46
61
  onTimeRangeChange?: (range: [number, number]) => void;
47
62
  /** Enable brush selection */
48
63
  enableBrush?: boolean;
64
+ /** Zoom to selection - when true, brush clears after selection and expects chart to zoom via timeRange update */
65
+ zoomToSelection?: boolean;
49
66
  /** Markers (vertical lines for events) */
50
67
  markers?: Array<{
51
68
  timestamp: number;
52
69
  label?: string;
53
70
  color?: string;
71
+ strokeDasharray?: string;
54
72
  }>;
73
+ /** Marker visibility mode: 'hover' shows only nearest marker on hover, 'always' shows all markers */
74
+ markerVisibilityMode?: 'always' | 'hover';
55
75
  /** Mode for morphing animation */
56
76
  morphMode?: 'area' | 'parliament' | 'morphing';
57
77
  /** Parliament layout data (for morphing) */
@@ -14,8 +14,10 @@ type UseD3StackedAreaProps = {
14
14
  };
15
15
  timeRange?: [number, number];
16
16
  showGrid?: boolean;
17
- showAxes?: boolean;
17
+ showXAxis?: boolean;
18
+ showYAxis?: boolean;
18
19
  enableBrush?: boolean;
20
+ zoomToSelection?: boolean;
19
21
  onTimeRangeChange?: (range: [number, number]) => void;
20
22
  formatDate?: (timestamp: number) => string;
21
23
  formatValue?: (value: number) => string;
@@ -23,7 +25,10 @@ type UseD3StackedAreaProps = {
23
25
  timestamp: number;
24
26
  label?: string;
25
27
  color?: string;
28
+ strokeDasharray?: string;
26
29
  }>;
30
+ markerVisibilityMode?: 'always' | 'hover';
31
+ onMarkerHoverChange?: (isHovering: boolean) => void;
27
32
  };
28
- export declare const useD3StackedArea: ({ containerRef, data, categories, width, height, margin, timeRange, showGrid, showAxes, enableBrush, onTimeRangeChange, formatDate, formatValue, markers }: UseD3StackedAreaProps) => void;
33
+ export declare const useD3StackedArea: ({ containerRef, data, categories, width, height, margin, timeRange, showGrid, showXAxis, showYAxis, enableBrush, zoomToSelection, onTimeRangeChange, formatDate, formatValue, markers, markerVisibilityMode, onMarkerHoverChange }: UseD3StackedAreaProps) => void;
29
34
  export {};
@@ -3,10 +3,12 @@ import { StageDurations } from './types';
3
3
  * Calculate stage durations from total animation duration
4
4
  *
5
5
  * Splits the total duration into proportional stages for smooth timing:
6
- * - 30% Seats to bar transformation
7
- * - 25% Bar slide to timeline + axes appear
8
- * - 25% Other bars grow from baseline
9
- * - 20% Bars morph to curved areas
6
+ * - 20% Seats transform to zig-zag lines (accordion shape)
7
+ * - 7% Lines collapse into vertical bar
8
+ * - 0.3% Pause to appreciate seat-to-bar transition
9
+ * - 22% Bar slide to timeline + axes appear
10
+ * - 22% Other bars grow from baseline
11
+ * - 28.7% Bars morph to curved areas
10
12
  *
11
13
  * @param totalDuration - Total animation duration in milliseconds
12
14
  * @returns Object with duration for each stage in milliseconds
@@ -15,10 +17,12 @@ import { StageDurations } from './types';
15
17
  * ```ts
16
18
  * const durations = calculateStageDurations(2000);
17
19
  * // {
18
- * // seatsToBar: 600, // 30%
19
- * // barSlideToTimeline: 500, // 25%
20
- * // axesAndBarsGrow: 500, // 25%
21
- * // barsToArea: 400 // 20%
20
+ * // seatsToLines: 400, // 20%
21
+ * // seatsToBar: 140, // 7%
22
+ * // crossFadePause: 6, // 0.3%
23
+ * // barSlideToTimeline: 440, // 22%
24
+ * // axesAndBarsGrow: 440, // 22%
25
+ * // barsToArea: 574 // 28.7%
22
26
  * // }
23
27
  * ```
24
28
  */
@@ -5,16 +5,20 @@
5
5
  * timing and duration calculations.
6
6
  */
7
7
  /**
8
- * Animation stage durations for parliament → area morph (4 stages)
8
+ * Animation stage durations for parliament → area morph (5 stages)
9
9
  * Calculated as fractions of total duration for smooth timing
10
10
  */
11
11
  export type StageDurations = {
12
- /** Frame 1→2: Seats directly transform to vertical bar (30% of total) */
12
+ /** Frame 0→1: Seats transform to zig-zag lines forming accordion (20% of total) */
13
+ seatsToLines: number;
14
+ /** Frame 1→2: Lines collapse into vertical bar (15% of total) */
13
15
  seatsToBar: number;
14
- /** Frame 2→3: Bar slides to timeline + axes/grid appear (25% of total) */
16
+ /** Pause after cross-fade to appreciate seat-to-bar transition (3% of total) */
17
+ crossFadePause: number;
18
+ /** Frame 2→3: Bar slides to timeline + axes/grid appear (22% of total) */
15
19
  barSlideToTimeline: number;
16
- /** Frame 3→4: Other bars grow from baseline (25% of total) */
20
+ /** Frame 3→4: Other bars grow from baseline (22% of total) */
17
21
  axesAndBarsGrow: number;
18
- /** Frame 4→5: Bars morph to curved area (20% of total) */
22
+ /** Frame 4→5: Bars morph to curved area (18% of total) */
19
23
  barsToArea: number;
20
24
  };
@@ -35,10 +35,54 @@ type UseMorphChartProps = {
35
35
  hoveredCategory?: string | null;
36
36
  maxSeats?: number;
37
37
  parliamentTimestamp?: number;
38
+ enableBrush?: boolean;
39
+ onTimeRangeChange?: (range: [number, number]) => void;
40
+ minAllowedTime?: number;
41
+ maxAllowedTime?: number;
42
+ showScaleIndicator?: boolean;
43
+ reposPerSeat?: number;
44
+ timelineEvents?: Array<{
45
+ timestamp: number;
46
+ eventName: string;
47
+ color?: string;
48
+ }>;
49
+ showTimeline?: boolean;
50
+ timelineHeight?: number;
51
+ timelineOffset?: number;
52
+ brushColor?: string;
38
53
  };
39
- export declare const useMorphChart: ({ containerRef, data, categories, mode, width, height, margin, timeRange, showGrid, showAxes, formatDate, formatValue, markers: _markers, arcAngle, parliamentRadius, seatSize, animationDuration, onMorphComplete, onAnimationStateChange, onTimelineReady, onAnimationProgress, onHoveredDataChange, hoveredCategory: externalHoveredCategory, maxSeats, parliamentTimestamp }: UseMorphChartProps) => {
54
+ export declare const useMorphChart: ({ containerRef, data, categories, mode, width, height, margin, timeRange, showGrid, showAxes, formatDate, formatValue, markers, arcAngle, parliamentRadius, seatSize, animationDuration, onMorphComplete, onAnimationStateChange, onTimelineReady, onAnimationProgress, onHoveredDataChange, hoveredCategory: externalHoveredCategory, maxSeats, parliamentTimestamp, enableBrush, onTimeRangeChange, minAllowedTime: minAllowedTimeConstraint, maxAllowedTime: maxAllowedTimeConstraint, showScaleIndicator, reposPerSeat, timelineEvents, showTimeline, timelineHeight, timelineOffset, brushColor }: UseMorphChartProps) => {
40
55
  isMorphing: boolean;
41
56
  currentMode: MorphMode;
42
57
  hoveredCategory: string | null;
58
+ scaleIndicatorOpacity: number;
59
+ visibleMarkers: {
60
+ timestamp: number;
61
+ label?: string;
62
+ color?: string;
63
+ x: number;
64
+ }[];
65
+ hoveredMarker: {
66
+ timestamp: number;
67
+ label?: string;
68
+ color?: string;
69
+ x: number;
70
+ } | null;
71
+ setHoveredMarker: import('react').Dispatch<import('react').SetStateAction<{
72
+ timestamp: number;
73
+ label?: string;
74
+ color?: string;
75
+ x: number;
76
+ } | null>>;
77
+ hoveredTimelineEvent: {
78
+ timestamp: number;
79
+ eventName: string;
80
+ x: number;
81
+ } | null;
82
+ setHoveredTimelineEvent: import('react').Dispatch<import('react').SetStateAction<{
83
+ timestamp: number;
84
+ eventName: string;
85
+ x: number;
86
+ } | null>>;
43
87
  };
44
88
  export {};
@@ -47,6 +47,10 @@ export type MorphChartProps = {
47
47
  enableBrush?: boolean;
48
48
  /** Callback when time range changes */
49
49
  onTimeRangeChange?: (range: [number, number]) => void;
50
+ /** Minimum allowed timestamp for time range selection (constrains brush selection) */
51
+ minAllowedTime?: number;
52
+ /** Maximum allowed timestamp for time range selection (constrains brush selection) */
53
+ maxAllowedTime?: number;
50
54
  /** Format date for axis */
51
55
  formatDate?: (timestamp: number) => string;
52
56
  /** Format value for axis */
@@ -94,6 +98,24 @@ export type MorphChartProps = {
94
98
  * If not provided, defaults to the rightmost (most recent) timestamp.
95
99
  */
96
100
  parliamentTimestamp?: number;
101
+ /** Timeline events to display below the x-axis (area mode only) */
102
+ timelineEvents?: Array<{
103
+ timestamp: number;
104
+ eventName: string;
105
+ color?: string;
106
+ }>;
107
+ /** Show timeline track (default: false) */
108
+ showTimeline?: boolean;
109
+ /** Timeline track height in pixels (default: 40) */
110
+ timelineHeight?: number;
111
+ /** Space between x-axis and timeline in pixels (default: 35) */
112
+ timelineOffset?: number;
113
+ /**
114
+ * Color for brush selection overlay.
115
+ * Used for both the selection area and drag handles.
116
+ * @default '#69b3a2'
117
+ */
118
+ brushColor?: string;
97
119
  };
98
120
  /**
99
121
  * Seat position in parliament layout
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Utility functions for generating accordion-style zig-zag lines
3
+ * Used in the seats-to-lines animation stage
4
+ */
5
+ export interface AccordionLinePoint {
6
+ x: number;
7
+ y: number;
8
+ category: string;
9
+ categoryIndex: number;
10
+ }
11
+ export interface AccordionLineConfig {
12
+ centerX: number;
13
+ centerY: number;
14
+ radius: number;
15
+ startAngle: number;
16
+ endAngle: number;
17
+ amplitude: number;
18
+ segments: number;
19
+ }
20
+ /**
21
+ * Generate zig-zag line points for a category's accordion section
22
+ *
23
+ * @param config - Configuration for the accordion line
24
+ * @returns Array of points forming the zig-zag pattern
25
+ */
26
+ export declare function generateAccordionLine(config: AccordionLineConfig): AccordionLinePoint[];
27
+ /**
28
+ * Generate accordion lines for all categories
29
+ *
30
+ * @param categories - Array of categories with their seat counts
31
+ * @param parliamentCenter - Center point of the parliament
32
+ * @param radius - Base radius of the parliament arc
33
+ * @param arcAngle - Total angle of the parliament arc (in radians)
34
+ * @returns Map of category to accordion line points
35
+ */
36
+ export declare function generateCategoryAccordionLines(categories: Array<{
37
+ name: string;
38
+ seatCount: number;
39
+ color: string;
40
+ }>, parliamentCenter: {
41
+ x: number;
42
+ y: number;
43
+ }, radius: number, arcAngle?: number): Map<string, AccordionLinePoint[]>;
44
+ /**
45
+ * Generate a single continuous accordion line for all categories
46
+ * Creates one connected slinky that spans the entire parliament arc
47
+ *
48
+ * @param categories - Array of categories with their seat counts
49
+ * @param parliamentCenter - Center point of the parliament
50
+ * @param radius - Base radius of the parliament arc
51
+ * @param arcAngle - Total angle of the parliament arc (in radians)
52
+ * @returns Single array of accordion line points with category info
53
+ */
54
+ export declare function generateContinuousAccordionLine(categories: Array<{
55
+ name: string;
56
+ seatCount: number;
57
+ color: string;
58
+ }>, parliamentCenter: {
59
+ x: number;
60
+ y: number;
61
+ }, radius: number, arcAngle?: number): AccordionLinePoint[];
62
+ /**
63
+ * Create SVG path string from accordion line points
64
+ *
65
+ * @param points - Array of accordion line points
66
+ * @param curved - Whether to use curved lines (true) or sharp zig-zags (false)
67
+ * @returns SVG path string
68
+ */
69
+ export declare function createAccordionPath(points: AccordionLinePoint[], curved?: boolean): string;
70
+ /**
71
+ * Calculate intermediate positions for accordion collapse animation with slinky physics
72
+ *
73
+ * @param linePoints - Original accordion line points
74
+ * @param targetX - Target X position (vertical bar location)
75
+ * @param targetY - Target Y position (vertical bar location)
76
+ * @param progress - Animation progress (0-1)
77
+ * @returns Interpolated points for current progress with wave motion
78
+ */
79
+ export declare function interpolateAccordionCollapse(linePoints: AccordionLinePoint[], targetX: number, targetY: number, progress: number): AccordionLinePoint[];
80
+ /**
81
+ * Generate multiple depth layers for slinky 3D effect
82
+ *
83
+ * @param config - Base configuration for accordion line
84
+ * @param numLayers - Number of layers to create (default 3)
85
+ * @returns Array of accordion line configurations with depth properties
86
+ */
87
+ export declare function generateLayeredAccordionLines(config: AccordionLineConfig, numLayers?: number): Array<{
88
+ points: AccordionLinePoint[];
89
+ depth: number;
90
+ opacity: number;
91
+ strokeWidth: number;
92
+ blur: number;
93
+ }>;
94
+ /**
95
+ * Generate a single vertical line path for collapsed state
96
+ *
97
+ * @param x - X position of the vertical line
98
+ * @param topY - Top Y position
99
+ * @param bottomY - Bottom Y position
100
+ * @returns SVG path string for vertical line
101
+ */
102
+ export declare function createVerticalLinePath(x: number, topY: number, bottomY: number): string;
@@ -4,6 +4,7 @@ interface AreaRenderOptions {
4
4
  xScale: (value: Date) => number;
5
5
  yScale: (value: number) => number;
6
6
  addClasses?: boolean;
7
+ instanceId?: string;
7
8
  }
8
9
  interface StackedDataPoint {
9
10
  data: {
@@ -1,5 +1,3 @@
1
- import { ScaleLinear, ScaleTime } from 'd3-scale';
2
- import { Selection } from 'd3-selection';
3
1
  import { MorphChartCategory } from '../morph-chart.types';
4
2
  export type StackedBarSegment = {
5
3
  timestamp: number;
@@ -11,13 +9,6 @@ export type StackedBarSegment = {
11
9
  color: string;
12
10
  isSpecialCategory: boolean;
13
11
  };
14
- /**
15
- * Render stacked bars for all timestamps
16
- * Creates rect elements that can be animated in height and width
17
- * Bars are rendered as a Riemann sum (touching each other with no gaps)
18
- */
19
- export declare function renderStackedBars(svg: Selection<SVGGElement, unknown, null, undefined>, stackedData: StackedBarSegment[], xScale: ScaleTime<number, number>, yScale: ScaleLinear<number, number>, _unusedBarWidth: number, // Keep for API compatibility but calculate dynamically
20
- _instanceId: string): void;
21
12
  /**
22
13
  * Generate stacked bar data from time series
23
14
  * Converts raw data into stacked segments for bar rendering