mintwaterfall 0.8.6

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 (38) hide show
  1. package/CHANGELOG.md +223 -0
  2. package/CONTRIBUTING.md +199 -0
  3. package/README.md +363 -0
  4. package/dist/index.d.ts +149 -0
  5. package/dist/mintwaterfall.cjs.js +7978 -0
  6. package/dist/mintwaterfall.esm.js +7907 -0
  7. package/dist/mintwaterfall.min.js +7 -0
  8. package/dist/mintwaterfall.umd.js +7978 -0
  9. package/index.d.ts +149 -0
  10. package/package.json +126 -0
  11. package/src/enterprise/enterprise-core.js +0 -0
  12. package/src/enterprise/enterprise-feature-template.js +0 -0
  13. package/src/enterprise/feature-registry.js +0 -0
  14. package/src/enterprise/features/breakdown.js +0 -0
  15. package/src/features/breakdown.js +0 -0
  16. package/src/features/conditional-formatting.js +0 -0
  17. package/src/index.js +111 -0
  18. package/src/mintwaterfall-accessibility.ts +680 -0
  19. package/src/mintwaterfall-advanced-data.ts +1034 -0
  20. package/src/mintwaterfall-advanced-interactions.ts +649 -0
  21. package/src/mintwaterfall-advanced-performance.ts +582 -0
  22. package/src/mintwaterfall-animations.ts +595 -0
  23. package/src/mintwaterfall-brush.ts +471 -0
  24. package/src/mintwaterfall-chart-core.ts +296 -0
  25. package/src/mintwaterfall-chart.ts +1915 -0
  26. package/src/mintwaterfall-data.ts +1100 -0
  27. package/src/mintwaterfall-export.ts +475 -0
  28. package/src/mintwaterfall-hierarchical-layouts.ts +724 -0
  29. package/src/mintwaterfall-layouts.ts +647 -0
  30. package/src/mintwaterfall-performance.ts +573 -0
  31. package/src/mintwaterfall-scales.ts +437 -0
  32. package/src/mintwaterfall-shapes.ts +385 -0
  33. package/src/mintwaterfall-statistics.ts +821 -0
  34. package/src/mintwaterfall-themes.ts +391 -0
  35. package/src/mintwaterfall-tooltip.ts +450 -0
  36. package/src/mintwaterfall-zoom.ts +399 -0
  37. package/src/types/js-modules.d.ts +25 -0
  38. package/src/utils/compatibility-layer.js +0 -0
package/README.md ADDED
@@ -0,0 +1,363 @@
1
+ # MintWaterfall v0.8.6
2
+
3
+ [![CI](https://github.com/coredds/MintWaterfall/actions/workflows/basic-checks.yml/badge.svg?branch=main)](https://github.com/coredds/MintWaterfall/actions/workflows/basic-checks.yml)
4
+ [![Security Audit](https://github.com/coredds/MintWaterfall/actions/workflows/security.yml/badge.svg)](https://github.com/coredds/MintWaterfall/actions/workflows/security.yml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Version](https://img.shields.io/badge/version-0.8.6-blue.svg)](https://github.com/coredds/MintWaterfall/releases)
7
+ [![codecov](https://codecov.io/gh/coredds/MintWaterfall/branch/main/graph/badge.svg)](https://codecov.io/gh/coredds/MintWaterfall)
8
+
9
+ A comprehensive TypeScript waterfall chart library built on D3.js v7. Features advanced data processing, statistical analysis, interactive visualizations, and enterprise-grade performance with complete type safety.
10
+
11
+ **[Live Demo](https://coredds.github.io/MintWaterfall/mintwaterfall-example.html)**
12
+
13
+ ## Features
14
+
15
+ ### Core Visualization
16
+ - **Dual Chart Modes**: Traditional waterfall and stacked visualization
17
+ - **Interactive Elements**: Drag interactions, enhanced hover detection, force simulation
18
+ - **Advanced Animations**: Smooth transitions with customizable duration and easing
19
+ - **Export Capabilities**: SVG, PNG, JSON, CSV with high-resolution support
20
+ - **Accessibility**: WCAG 2.1 compliant with keyboard navigation and screen reader support
21
+
22
+ ### Statistical Analysis
23
+ - **Comprehensive Statistics**: Mean, median, variance, quartiles, outlier detection
24
+ - **Trend Analysis**: Linear regression with confidence intervals and forecasting
25
+ - **Data Quality Assessment**: Completeness, validity, accuracy metrics with recommendations
26
+ - **Variance Analysis**: ANOVA-style analysis with between/within group variance
27
+
28
+ ### Advanced Data Processing
29
+ - **D3.js Integration**: Native support for grouping, rollup, cross-tabulation, and indexing
30
+ - **Multi-dimensional Operations**: Complex data transformations and aggregations
31
+ - **Temporal Processing**: Time-series aggregation with configurable intervals
32
+ - **Financial Analysis**: Revenue breakdown, variance analysis, period comparisons
33
+
34
+ ### Performance & Architecture
35
+ - **TypeScript**: Complete type safety with strict checking across 20+ modules
36
+ - **Optimized Build**: 4 bundle formats (ESM, UMD, CJS, Minified) with external D3 dependencies
37
+ - **Test Coverage**: 338 tests across 18 test suites with 26.5% overall coverage
38
+ - **Production Ready**: Robust error handling, edge case management, and performance optimization
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ npm install mintwaterfall
44
+ ```
45
+
46
+ **CDN:**
47
+ ```html
48
+ <script src="https://d3js.org/d3.v7.min.js"></script>
49
+ <script src="https://unpkg.com/mintwaterfall@latest/dist/mintwaterfall.min.js"></script>
50
+ ```
51
+
52
+ **ES Modules:**
53
+ ```javascript
54
+ import { waterfallChart, createDataProcessor, createStatisticalSystem } from 'mintwaterfall';
55
+ import * as d3 from 'd3';
56
+ ```
57
+
58
+ ## Quick Start
59
+
60
+ ```javascript
61
+ const data = [
62
+ {
63
+ label: "Q1 Revenue",
64
+ stacks: [{ value: 45000, color: "#3498db", label: "$45K" }],
65
+ category: "revenue"
66
+ },
67
+ {
68
+ label: "Q2 Growth",
69
+ stacks: [{ value: 30000, color: "#2ecc71", label: "$30K" }],
70
+ category: "revenue"
71
+ },
72
+ {
73
+ label: "Expenses",
74
+ stacks: [{ value: -15000, color: "#e74c3c", label: "-$15K" }],
75
+ category: "expenses"
76
+ }
77
+ ];
78
+
79
+ const chart = waterfallChart()
80
+ .width(800)
81
+ .height(400)
82
+ .showTotal(true)
83
+ .theme('corporate')
84
+ .enableAccessibility(true);
85
+
86
+ d3.select('#chart')
87
+ .datum(data)
88
+ .call(chart);
89
+ ```
90
+
91
+ ## Advanced Features
92
+
93
+ ### Statistical Analysis
94
+ ```javascript
95
+ import { createStatisticalSystem } from 'mintwaterfall';
96
+
97
+ const stats = createStatisticalSystem();
98
+
99
+ // Comprehensive statistical summary
100
+ const summary = stats.calculateSummary([10, 20, 30, 40, 50]);
101
+ // Returns: { mean, median, mode, variance, quartiles, percentiles }
102
+
103
+ // Outlier detection with IQR method
104
+ const outliers = stats.detectOutliers(data, labels);
105
+ // Returns: { outliers, cleanData, method, threshold, statistics }
106
+
107
+ // Trend analysis with forecasting
108
+ const trend = stats.analyzeTrend([{x: 1, y: 10}, {x: 2, y: 20}]);
109
+ // Returns: { slope, intercept, correlation, rSquared, forecast }
110
+
111
+ // Data quality assessment
112
+ const quality = stats.assessDataQuality(rawData);
113
+ // Returns: { completeness, validity, accuracy, issues, recommendations }
114
+ ```
115
+
116
+ ### Interactive Systems
117
+ ```javascript
118
+ import { createAdvancedInteractionSystem } from 'mintwaterfall';
119
+
120
+ const interactions = createAdvancedInteractionSystem(container, data);
121
+
122
+ // Enable drag interactions with constraints
123
+ interactions.enableDrag({
124
+ enabled: true,
125
+ axis: 'vertical',
126
+ constraints: { minValue: -100, maxValue: 100 }
127
+ });
128
+
129
+ // Enhanced hover detection with Voronoi diagrams
130
+ interactions.enableEnhancedHover({
131
+ enabled: true,
132
+ extent: [[0, 0], [800, 400]]
133
+ });
134
+
135
+ // Force simulation for dynamic layouts
136
+ interactions.startForceSimulation({
137
+ enabled: true,
138
+ forces: { collision: true, positioning: true },
139
+ strength: { collision: 0.7, positioning: 0.5 }
140
+ });
141
+ ```
142
+
143
+ ### Advanced Data Processing
144
+ ```javascript
145
+ import { createAdvancedDataProcessor } from 'mintwaterfall';
146
+
147
+ const processor = createAdvancedDataProcessor();
148
+
149
+ // Multi-dimensional grouping
150
+ const grouped = processor.groupBy(salesData, d => d.region);
151
+
152
+ // Data rollup with custom reducers
153
+ const aggregated = processor.rollupBy(
154
+ salesData,
155
+ values => d3.sum(values, d => d.revenue),
156
+ d => d.category
157
+ );
158
+
159
+ // Cross-tabulation for dimensional analysis
160
+ const crossTab = processor.crossTabulate(
161
+ categories, quarters,
162
+ (cat, quarter) => ({ category: cat, quarter, key: `${cat}-${quarter}` })
163
+ );
164
+
165
+ // Time-based aggregation
166
+ const timeAggregated = processor.aggregateByTime(
167
+ timeSeriesData,
168
+ d => new Date(d.date),
169
+ d => d.value,
170
+ 'month'
171
+ );
172
+ ```
173
+
174
+ ## Configuration API
175
+
176
+ ### Chart Configuration
177
+ ```javascript
178
+ chart
179
+ .width(800) // Chart dimensions
180
+ .height(400)
181
+ .margin({top: 20, right: 30, bottom: 40, left: 50})
182
+ .showTotal(true) // Display total bar
183
+ .stacked(false) // Toggle chart mode
184
+ .barPadding(0.1) // Bar spacing
185
+ .duration(750) // Animation duration
186
+ .theme('corporate') // Theme selection
187
+ .enableAccessibility(true) // WCAG compliance
188
+ ```
189
+
190
+ ### Accessibility Features
191
+ ```javascript
192
+ import { createAccessibilitySystem } from 'mintwaterfall';
193
+
194
+ const a11y = createAccessibilitySystem();
195
+
196
+ // Create accessible chart descriptions
197
+ const descriptionId = a11y.createChartDescription(container, data, {
198
+ title: "Quarterly Revenue Analysis",
199
+ summary: "Shows revenue trends across four quarters"
200
+ });
201
+
202
+ // Validate color contrast
203
+ const contrast = a11y.validateColorContrast('#3498db', '#ffffff');
204
+ // Returns: { ratio, passesAA, passesAAA, level }
205
+
206
+ // Handle keyboard navigation
207
+ a11y.handleChartKeydown(keyEvent, data, config);
208
+ ```
209
+
210
+ ### Event Handling
211
+ ```javascript
212
+ chart.on("barClick", (event, d) => {
213
+ console.log("Clicked:", d.label, d.value);
214
+ });
215
+
216
+ chart.on("brushEnd", (selection) => {
217
+ console.log("Selected range:", selection);
218
+ });
219
+
220
+ // Advanced interaction events
221
+ interactions.on('dragStart', (event) => {
222
+ console.log('Drag started:', event);
223
+ });
224
+
225
+ interactions.on('hoverEnter', (data) => {
226
+ console.log('Hover detected:', data);
227
+ });
228
+ ```
229
+
230
+ ## Data Formats
231
+
232
+ ### Basic Waterfall Data
233
+ ```javascript
234
+ const waterfallData = [{
235
+ label: "Category Name",
236
+ stacks: [
237
+ { value: 100, color: "#3498db", label: "Positive" },
238
+ { value: -25, color: "#e74c3c", label: "Negative" }
239
+ ],
240
+ category: "revenue"
241
+ }];
242
+ ```
243
+
244
+ ### Advanced Processing Data
245
+ ```javascript
246
+ const businessData = [
247
+ {
248
+ region: 'North',
249
+ product: 'Widget',
250
+ revenue: 100000,
251
+ date: '2024-01-15',
252
+ category: 'sales'
253
+ },
254
+ {
255
+ region: 'South',
256
+ product: 'Gadget',
257
+ revenue: 85000,
258
+ date: '2024-01-20',
259
+ category: 'sales'
260
+ }
261
+ ];
262
+ ```
263
+
264
+ ## Themes
265
+
266
+ Available themes: `default`, `dark`, `corporate`, `accessible`, `colorful`, `financial`, `professional`
267
+
268
+ ```javascript
269
+ chart.theme('corporate');
270
+
271
+ // Custom theme configuration
272
+ chart.themeConfig({
273
+ background: '#ffffff',
274
+ colors: ['#3498db', '#2ecc71', '#e74c3c'],
275
+ text: '#2c3e50',
276
+ grid: '#ecf0f1'
277
+ });
278
+ ```
279
+
280
+ ## Development
281
+
282
+ ### Setup
283
+ ```bash
284
+ git clone https://github.com/coredds/MintWaterfall.git
285
+ cd MintWaterfall
286
+ npm install
287
+ ```
288
+
289
+ ### Commands
290
+ ```bash
291
+ npm test # Run full test suite (338 tests)
292
+ npm run test:core # Run core functionality tests (136 tests)
293
+ npm run test:fast # Run tests with parallel execution
294
+ npm run lint # ESLint code quality checks
295
+ npm run build # Production build (4 bundle formats)
296
+ npm start # Development server (localhost:8080)
297
+ ```
298
+
299
+ ### Build Output
300
+ - `dist/mintwaterfall.esm.js` - ES Module bundle
301
+ - `dist/mintwaterfall.umd.js` - UMD bundle for browsers
302
+ - `dist/mintwaterfall.min.js` - Minified production bundle
303
+ - `dist/mintwaterfall.cjs.js` - CommonJS bundle for Node.js
304
+ - `dist/index.d.ts` - TypeScript definitions
305
+
306
+ ### Test Coverage
307
+ - **338 total tests** across 18 test suites (100% pass rate)
308
+ - **26.5% overall coverage** with high-value test focus
309
+ - **Statistical Analysis: 89.6% coverage** (27 tests)
310
+ - **Advanced Interactions: 42.4% coverage** (28 tests)
311
+ - **Advanced Data Processing: 25.9% coverage** (28 tests)
312
+ - **Critical Integration Tests: 21 tests** for regression prevention
313
+
314
+ ### Performance Metrics
315
+ - **Build time: 5.8 seconds** (optimized Rollup configuration)
316
+ - **Test execution: 7.2 seconds** (full suite with coverage)
317
+ - **Bundle sizes optimized** with external D3 dependencies
318
+ - **Memory efficient** algorithms for large datasets
319
+
320
+ ## Browser Compatibility
321
+
322
+ **Requirements**: ES6 Modules, D3.js v7+, SVG support
323
+ **Tested**: Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
324
+
325
+ ## Architecture
326
+
327
+ ### Module Structure
328
+ - **Core Chart**: `mintwaterfall-chart.ts` - Main chart component
329
+ - **Data Processing**: `mintwaterfall-data.ts` - Data transformation utilities
330
+ - **Advanced Data**: `mintwaterfall-advanced-data.ts` - D3 integration and complex operations
331
+ - **Statistics**: `mintwaterfall-statistics.ts` - Statistical analysis functions
332
+ - **Interactions**: `mintwaterfall-advanced-interactions.ts` - Drag, hover, force simulation
333
+ - **Accessibility**: `mintwaterfall-accessibility.ts` - WCAG compliance features
334
+ - **Animations**: `mintwaterfall-animations.ts` - Transition and animation system
335
+ - **Themes**: `mintwaterfall-themes.ts` - Theme management
336
+ - **Export**: `mintwaterfall-export.ts` - Export functionality
337
+ - **Performance**: `mintwaterfall-performance.ts` - Optimization utilities
338
+
339
+ ## Recent Updates
340
+
341
+ ### v0.8.6 (Current)
342
+ - Complete statistical analysis system with 89.6% test coverage
343
+ - Advanced interaction system with drag, hover, and force simulation
344
+ - Comprehensive data processing with D3.js integration
345
+ - Full accessibility compliance with WCAG 2.1 support
346
+ - 338 tests across 18 test suites with 100% pass rate
347
+ - Optimized build pipeline with 5.8-second build times
348
+ - TypeScript strict mode with complete type definitions
349
+
350
+ ## Contributing
351
+
352
+ Contributions welcome. Requirements:
353
+ - TypeScript with strict type checking
354
+ - D3.js v7+ compatibility
355
+ - Comprehensive test coverage for new features
356
+ - ESLint compliance (no errors, minimal warnings)
357
+ - Updated documentation and examples
358
+
359
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
360
+
361
+ ## License
362
+
363
+ MIT License - see [LICENSE](LICENSE) file for details.
@@ -0,0 +1,149 @@
1
+ // TypeScript definitions for MintWaterfall v0.6.0
2
+ // Project: https://github.com/your-username/mintwaterfall
3
+ // Definitions by: MintWaterfall Team
4
+
5
+ export interface StackData {
6
+ value: number;
7
+ color: string;
8
+ label: string;
9
+ }
10
+
11
+ export interface ChartData {
12
+ label: string;
13
+ stacks: StackData[];
14
+ }
15
+
16
+ export interface WaterfallChart {
17
+ // Core configuration methods
18
+ width(): number;
19
+ width(value: number): WaterfallChart;
20
+
21
+ height(): number;
22
+ height(value: number): WaterfallChart;
23
+
24
+ margin(): { top: number; right: number; bottom: number; left: number };
25
+ margin(value: { top: number; right: number; bottom: number; left: number }): WaterfallChart;
26
+
27
+ // Data and display options
28
+ stacked(): boolean;
29
+ stacked(value: boolean): WaterfallChart;
30
+
31
+ showTotal(): boolean;
32
+ showTotal(value: boolean): WaterfallChart;
33
+
34
+ totalLabel(): string;
35
+ totalLabel(value: string): WaterfallChart;
36
+
37
+ totalColor(): string;
38
+ totalColor(value: string): WaterfallChart;
39
+
40
+ // Animation and transitions
41
+ duration(): number;
42
+ duration(value: number): WaterfallChart;
43
+
44
+ ease(): any; // d3.EasingFunction
45
+ ease(value: any): WaterfallChart;
46
+
47
+ // Interactive Features
48
+ accessibility(): boolean;
49
+ accessibility(value: boolean): WaterfallChart;
50
+
51
+ tooltips(): boolean;
52
+ tooltips(value: boolean): WaterfallChart;
53
+
54
+ tooltipConfig(): any;
55
+ tooltipConfig(value: any): WaterfallChart;
56
+
57
+ export(format?: string, options?: any): any;
58
+ exportConfig(): any;
59
+ exportConfig(value: any): WaterfallChart;
60
+
61
+ // Enhanced features
62
+ enableBrush(): boolean;
63
+ enableBrush(value: boolean): WaterfallChart;
64
+
65
+ staggeredAnimations(): boolean;
66
+ staggeredAnimations(value: boolean): WaterfallChart;
67
+
68
+ staggerDelay(): number;
69
+ staggerDelay(value: number): WaterfallChart;
70
+
71
+ scaleType(): string;
72
+ scaleType(value: string): WaterfallChart;
73
+
74
+ // Zoom and pan functionality
75
+ zoom(): boolean;
76
+ zoom(value: boolean): WaterfallChart;
77
+
78
+ zoomConfig(): any;
79
+ zoomConfig(value: any): WaterfallChart;
80
+
81
+ // Event handling
82
+ on(event: string, handler: BarEventHandler): WaterfallChart;
83
+ on(event: string, handler: null): WaterfallChart;
84
+
85
+ // Rendering
86
+ (selection: any): void; // d3.Selection
87
+ }
88
+
89
+ export interface BarEventHandler {
90
+ (event: Event, data: ChartData): void;
91
+ }
92
+
93
+ // Main chart factory function
94
+ export declare function waterfallChart(): WaterfallChart;
95
+
96
+ // Theme system
97
+ export declare const themes: {
98
+ [key: string]: {
99
+ colors: string[];
100
+ totalColor: string;
101
+ backgroundColor?: string;
102
+ textColor?: string;
103
+ };
104
+ };
105
+
106
+ export declare function applyTheme(themeName: string): any;
107
+
108
+ // Data processing utilities
109
+ export declare const dataProcessor: {
110
+ processData(data: ChartData[]): any;
111
+ calculateTotals(data: ChartData[]): number[];
112
+ sortData(data: ChartData[], sortBy: string, order: 'ascending' | 'descending'): ChartData[];
113
+ normalizeValues(data: ChartData[], maxValue: number): ChartData[];
114
+ filterData(data: ChartData[], predicate: (item: ChartData) => boolean): ChartData[];
115
+ aggregateData(data: ChartData[], groupBy: string): ChartData[];
116
+ };
117
+
118
+ // Animation system
119
+ export declare const animationSystem: {
120
+ createStaggeredAnimation(selection: any, delay: number): any;
121
+ createBounceAnimation(selection: any): any;
122
+ createElasticAnimation(selection: any): any;
123
+ respectsReducedMotion(): boolean;
124
+ };
125
+
126
+ // Interactive Features
127
+ export declare function createAccessibilitySystem(): any;
128
+ export declare function createTooltipSystem(): any;
129
+ export declare function createExportSystem(): any;
130
+ export declare function createZoomSystem(): any;
131
+
132
+ export declare const accessibilitySystem: any;
133
+ export declare const tooltip: any;
134
+ export declare const exportSystem: any;
135
+ export declare const zoomSystem: any;
136
+
137
+ // Utility functions
138
+ export declare function makeChartAccessible(chart: any, data: ChartData[]): void;
139
+ export declare function createChartTooltip(config?: any): any;
140
+ export declare function addExportToChart(chart: any, data: ChartData[]): void;
141
+ export declare function createZoomControls(): any;
142
+ export declare function addZoomToChart(chart: any, options?: any): any;
143
+
144
+ // Enhanced features
145
+ export declare const brushSystem: any;
146
+ export declare const scaleSystem: any;
147
+
148
+ // Version
149
+ export declare const version: string;