@moderneinc/react-charts 1.2.0-next.fe4657 → 1.3.0
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.
- package/dist/components/stacked-area-with-timeline/hooks/use-stacked-area-with-timeline.hook.d.ts +4 -3
- package/dist/components/stacked-area-with-timeline/utils/render-timeline-track.d.ts +3 -11
- package/dist/index.cjs +27 -122
- package/dist/index.d.ts +1 -3
- package/dist/index.js +8533 -24556
- package/dist/{components/stacked-area-chart/stacked-area-chart.constants.d.ts → theme/chart-palettes.d.ts} +4 -60
- package/dist/theme/timeline-defaults.d.ts +0 -8
- package/package.json +6 -16
- package/dist/components/morph-chart/index.d.ts +0 -2
- package/dist/components/morph-chart/utils/accordion-generator.d.ts +0 -102
- package/dist/components/morph-chart/utils/animation-utils.d.ts +0 -44
- package/dist/components/morph-chart/utils/arc-path-calculator.d.ts +0 -53
- package/dist/components/morph-chart/utils/morph-interpolator.d.ts +0 -96
- package/dist/components/morph-chart/utils/segment-transformer.d.ts +0 -70
- package/dist/components/morph-chart/utils/slinky-3d-generator.d.ts +0 -35
- package/dist/components/morph-chart/utils/svg-slinky-generator.d.ts +0 -25
- package/dist/components/stacked-area-chart/hooks/use-stacked-area-chart.hook.d.ts +0 -6
- package/dist/components/stacked-area-chart/stacked-area-chart.component.d.ts +0 -10
- package/dist/components/stacked-area-chart/stacked-area-chart.types.d.ts +0 -186
- package/dist/components/stacked-area-chart/utils/color.utils.d.ts +0 -4
- package/dist/components/stacked-area-with-timeline/index.d.ts +0 -4
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { BoxProps, StackProps, TypographyProps } from '@mui/material';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a single data point in the stacked area chart.
|
|
4
|
-
* Each property beyond timestamp represents a category value at that point in time.
|
|
5
|
-
*
|
|
6
|
-
* Example:
|
|
7
|
-
* {
|
|
8
|
-
* timestamp: 1704067200000,
|
|
9
|
-
* Complete: 120,
|
|
10
|
-
* Close: 45,
|
|
11
|
-
* Far: 30
|
|
12
|
-
* }
|
|
13
|
-
*/
|
|
14
|
-
export type StackedAreaDataPoint = {
|
|
15
|
-
timestamp: number;
|
|
16
|
-
[category: string]: number;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Defines a category (area) in the stacked area chart.
|
|
20
|
-
* The dataKey must match a property in StackedAreaDataPoint.
|
|
21
|
-
*/
|
|
22
|
-
export type StackedAreaCategory = {
|
|
23
|
-
/** Key matching the property name in data points */
|
|
24
|
-
dataKey: string;
|
|
25
|
-
/** Display label for the category */
|
|
26
|
-
label: string;
|
|
27
|
-
/** Color for this area (hex color or CSS color string) */
|
|
28
|
-
color: string;
|
|
29
|
-
/** Optional stroke width in pixels (default: 2) */
|
|
30
|
-
strokeWidth?: number;
|
|
31
|
-
/** Optional dash pattern for the stroke (e.g., '5 5' for dashed) */
|
|
32
|
-
strokeDasharray?: string;
|
|
33
|
-
/** Optional fill opacity (0-1, default: 0.7) */
|
|
34
|
-
fillOpacity?: number;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Defines a marker (vertical line) at a specific timestamp.
|
|
38
|
-
* Markers are useful for highlighting significant events like releases, deployments, or milestones.
|
|
39
|
-
*/
|
|
40
|
-
export type StackedAreaMarker = {
|
|
41
|
-
/** Timestamp where the marker should be placed on the X-axis */
|
|
42
|
-
timestamp: number;
|
|
43
|
-
/** Optional label to display on the marker */
|
|
44
|
-
label?: string;
|
|
45
|
-
/** Optional color for the marker line (default: from config) */
|
|
46
|
-
color?: string;
|
|
47
|
-
/** Optional stroke width in pixels (default: from config) */
|
|
48
|
-
strokeWidth?: number;
|
|
49
|
-
/** Optional dash pattern for the stroke (e.g., '5 5' for dashed) */
|
|
50
|
-
strokeDasharray?: string;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Slot props for customizing stacked area chart component styles
|
|
54
|
-
*/
|
|
55
|
-
export type StackedAreaChartSlotProps = {
|
|
56
|
-
/** Props for the outer container (Stack) */
|
|
57
|
-
container?: StackProps;
|
|
58
|
-
/** Props for the header container (Stack) */
|
|
59
|
-
header?: StackProps;
|
|
60
|
-
/** Props for the title Typography component */
|
|
61
|
-
title?: TypographyProps;
|
|
62
|
-
/** Props for the subtitle/description Typography component */
|
|
63
|
-
subtitle?: TypographyProps;
|
|
64
|
-
/** Props for the chart container (Box) */
|
|
65
|
-
chartContainer?: BoxProps;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Props for the StackedAreaChart component
|
|
69
|
-
*/
|
|
70
|
-
export type StackedAreaChartProps = {
|
|
71
|
-
/** Array of data points sorted by timestamp (ascending) */
|
|
72
|
-
data: StackedAreaDataPoint[];
|
|
73
|
-
/** Array of category definitions for the areas to display */
|
|
74
|
-
categories: StackedAreaCategory[];
|
|
75
|
-
/** Optional array of markers (vertical lines) to display at specific timestamps */
|
|
76
|
-
markers?: StackedAreaMarker[];
|
|
77
|
-
/** Optional title displayed above the chart */
|
|
78
|
-
title?: string;
|
|
79
|
-
/** Optional subtitle/description displayed below the title */
|
|
80
|
-
subtitle?: string;
|
|
81
|
-
/** Show the chart header (title and subtitle) */
|
|
82
|
-
showHeader?: boolean;
|
|
83
|
-
/** Height of the chart in pixels (default: 400) */
|
|
84
|
-
height?: number;
|
|
85
|
-
/** Width of the chart (default: '100%') */
|
|
86
|
-
width?: string | number;
|
|
87
|
-
/** Show the legend */
|
|
88
|
-
showLegend?: boolean;
|
|
89
|
-
/** Show the tooltip on hover */
|
|
90
|
-
showTooltip?: boolean;
|
|
91
|
-
/** Show X-axis labels */
|
|
92
|
-
showXAxis?: boolean;
|
|
93
|
-
/** Show Y-axis labels */
|
|
94
|
-
showYAxis?: boolean;
|
|
95
|
-
/** Show grid lines */
|
|
96
|
-
showGrid?: boolean;
|
|
97
|
-
/** Enable animations */
|
|
98
|
-
enableAnimation?: boolean;
|
|
99
|
-
/** Animation duration in milliseconds (default: 1500) */
|
|
100
|
-
animationDuration?: number;
|
|
101
|
-
/** Animation easing function (default: 'ease') */
|
|
102
|
-
animationEasing?: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear';
|
|
103
|
-
/** Custom date formatter for X-axis and tooltip */
|
|
104
|
-
formatDate?: (timestamp: number) => string;
|
|
105
|
-
/** Custom value formatter for Y-axis and tooltip */
|
|
106
|
-
formatValue?: (value: number) => string;
|
|
107
|
-
/** Custom tooltip formatter */
|
|
108
|
-
tooltipFormatter?: (value: number, name: string, props: unknown) => [string, string];
|
|
109
|
-
/** Props for customizing individual component slots */
|
|
110
|
-
slotProps?: StackedAreaChartSlotProps;
|
|
111
|
-
/** Margin around the chart (for axis labels) */
|
|
112
|
-
margin?: {
|
|
113
|
-
top?: number;
|
|
114
|
-
right?: number;
|
|
115
|
-
bottom?: number;
|
|
116
|
-
left?: number;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Curve type for the area paths
|
|
120
|
-
* - 'monotone': Smooth curves that preserve monotonicity
|
|
121
|
-
* - 'linear': Straight lines between points
|
|
122
|
-
* - 'step': Step function
|
|
123
|
-
* - 'stepBefore': Step function with vertical at start
|
|
124
|
-
* - 'stepAfter': Step function with vertical at end
|
|
125
|
-
*/
|
|
126
|
-
curveType?: 'monotone' | 'linear' | 'step' | 'stepBefore' | 'stepAfter';
|
|
127
|
-
/**
|
|
128
|
-
* Stack offset type
|
|
129
|
-
* - 'none': Stack normally
|
|
130
|
-
* - 'expand': Normalize to 0-100%
|
|
131
|
-
* - 'wiggle': Streamgraph layout
|
|
132
|
-
* - 'silhouette': Centered streamgraph
|
|
133
|
-
*/
|
|
134
|
-
stackOffset?: 'none' | 'expand' | 'wiggle' | 'silhouette';
|
|
135
|
-
/**
|
|
136
|
-
* External time domain control [minTimestamp, maxTimestamp]
|
|
137
|
-
* When provided, overrides automatic domain calculation and controls the X-axis range.
|
|
138
|
-
* Useful for synchronizing multiple charts to show the same time range.
|
|
139
|
-
*/
|
|
140
|
-
timeRange?: [number, number] | null;
|
|
141
|
-
/**
|
|
142
|
-
* Callback when user selects a time range via brush or other interaction
|
|
143
|
-
* Returns [startTimestamp, endTimestamp]
|
|
144
|
-
*/
|
|
145
|
-
onTimeRangeChange?: (range: [number, number]) => void;
|
|
146
|
-
/**
|
|
147
|
-
* Enable brush component for time range selection
|
|
148
|
-
* When enabled, displays a brush control below the chart that users can drag to select a time range.
|
|
149
|
-
* Triggers onTimeRangeChange callback when the brush is moved.
|
|
150
|
-
*/
|
|
151
|
-
enableBrush?: boolean;
|
|
152
|
-
/**
|
|
153
|
-
* Zoom to selection mode - When enabled, dragging to select a range
|
|
154
|
-
* will automatically rescale the chart to show only that range via the timeRange prop.
|
|
155
|
-
* Selection highlight only shows during drag.
|
|
156
|
-
*/
|
|
157
|
-
zoomToSelection?: boolean;
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* Props for the custom hook
|
|
161
|
-
*/
|
|
162
|
-
export type UseStackedAreaChartProps = {
|
|
163
|
-
data: StackedAreaDataPoint[];
|
|
164
|
-
categories: StackedAreaCategory[];
|
|
165
|
-
formatDate?: (timestamp: number) => string;
|
|
166
|
-
formatValue?: (value: number) => string;
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* Return type for the custom hook
|
|
170
|
-
*/
|
|
171
|
-
export type UseStackedAreaChartReturn = {
|
|
172
|
-
/** Validated and processed data */
|
|
173
|
-
processedData: StackedAreaDataPoint[];
|
|
174
|
-
/** Validated categories */
|
|
175
|
-
processedCategories: StackedAreaCategory[];
|
|
176
|
-
/** Minimum timestamp in data */
|
|
177
|
-
minTimestamp: number;
|
|
178
|
-
/** Maximum timestamp in data */
|
|
179
|
-
maxTimestamp: number;
|
|
180
|
-
/** Total value at each timestamp (sum of all categories) */
|
|
181
|
-
maxTotalValue: number;
|
|
182
|
-
/** Default date formatter */
|
|
183
|
-
dateFormatter: (timestamp: number) => string;
|
|
184
|
-
/** Default value formatter */
|
|
185
|
-
valueFormatter: (value: number) => string;
|
|
186
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { StackedAreaWithTimeline } from './stacked-area-with-timeline.component';
|
|
2
|
-
export type { HoveredData, HoveredTimelineEvent, StackedAreaDataPoint, StackedAreaWithTimelineProps, TimelineEvent } from './stacked-area-with-timeline.types';
|
|
3
|
-
export type { HoveredTimelineEvent as TimelineHoveredEvent, RenderTimelineTrackOptions, TimelineEvent as TimelineEventData } from './utils/render-timeline-track';
|
|
4
|
-
export { renderTimelineTrack } from './utils/render-timeline-track';
|