universal-adaptive-bars 0.0.6 → 0.1.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/README.md CHANGED
@@ -7,24 +7,27 @@ A highly customizable, interactive, and drill-down capable Bar Chart library for
7
7
 
8
8
  📖 **Read the Story**: [Universal Adaptive Bars: The Smart Cross-Platform Charting Library You’ve Been Waiting For](https://sammeddoshi.medium.com/universal-adaptive-bars-the-smart-cross-platform-charting-library-youve-been-waiting-for-80501b0c0e3b)
9
9
 
10
- ## New in v0.0.6 🚀
11
- - **Calendar Jump**: Selecting a date in the calendar now "jumps" to that date (scrolling the view) instead of filtering data, preserving your ability to navigate back and forth.
12
- - **Smart Stacked Radius**: Stacked bars now intelligently apply rounded corners only to the top and bottom segments for a polished UI.
13
- - **Improved Alignment**: Perfect X-axis alignment for both standard and stacked bars.
10
+ ## New in v0.1.0 🚀
11
+ - **Horizontal Layouts**: Flip the chart horizontally using `layout="horizontal"`. Works automatically on Web and Native.
12
+ - **Grouped Variant**: Introducing side-by-side grouped charts for multi-value datasets using `variant="grouped"`.
13
+ - **Zero-Day Auto Fill**: Setting `missingDataStrategy="zero"` automatically detects and inserts missing dates/months so your timelines flow continuously without skips.
14
+ - **Annotations**: Feed an array of `annotations={[{ value: 50, label: "Target" }]}` to draw persistent threshold lines across the chart.
15
+ - **Value Formatters**: Pass `valueFormatter={(val) => '$' + val}` to format the Y-axis and labels automatically.
14
16
 
15
17
  ## Features
16
18
 
17
19
  - 📅 **Time-based Drill Down**: Navigate seamlessly continuously from **Year** -> **Month** -> **Week** -> **Day**.
20
+ - 📐 **Multiple Layouts**: Toggle between **vertical** and **horizontal** layout rendering instantly.
18
21
  - 🎨 **Deep Customization**: Full control over colors, grid, axis, and bar styling via the `theme` prop.
19
- - 📱 **React Native Support**: First-class support for Mobile via `react-native-svg`.
20
- - 🥞 **Stacked Bars**: Support for multi-value data keys (Histogram style).
22
+ - 📱 **React Native Support**: First-class support for Mobile via `react-native-svg` (100% parity with Web).
23
+ - 🥞 **Variants**: Support for `stacked` & `grouped` bars for multi-value data keys (Histogram style).
21
24
  - ♿ **Accessible**: ARIA support for Web and Accessibility Props for Native.
22
25
  - 🤖 **AI Ready**: Integrated interfaces for predictive analytics.
23
26
 
24
27
  ## Installation
25
28
 
26
29
  ```bash
27
- npm install universal-adaptive-bars date-fns d3-scale clsx tailwind-merge
30
+ npm install universal-adaptive-bars date-fns d3-scale
28
31
  # Peer Dependencies for React Native
29
32
  # npm install react-native-svg
30
33
  ```
@@ -45,14 +48,14 @@ function App() {
45
48
  <SmartBarChart
46
49
  data={data}
47
50
  view="month"
51
+ layout="vertical"
52
+ variant="grouped"
53
+ missingDataStrategy="zero"
54
+ valueFormatter={(val) => `$${val}`}
55
+ annotations={[{ value: 150, label: 'Goal', color: 'green' }]}
48
56
  dataKeys={{ label: 'label', value: 'value', date: 'date' }}
49
57
  axisLabels={{ x: 'Date', y: 'Revenue' }}
50
58
  height={400}
51
- theme={{
52
- background: '#fff',
53
- bar: { radius: 4, opacity: 1 },
54
- grid: { stroke: '#eee', visible: true }
55
- }}
56
59
  />
57
60
  );
58
61
  }
@@ -63,11 +66,10 @@ function App() {
63
66
  ```tsx
64
67
  import { SmartBarChartNative } from 'smart-bar-chart/native';
65
68
 
66
- // ... usage is identical to Web component
69
+ // ... usage is identical to Web component (Horizontal, Grouped, Zero-Day fully supported!)
67
70
  <SmartBarChartNative
68
71
  data={data}
69
- view="month"
70
- dataKeys={{ label: 'label', value: 'value', date: 'date' }}
72
+ ...
71
73
  />
72
74
  ```
73
75
 
@@ -78,9 +80,12 @@ import { SmartBarChartNative } from 'smart-bar-chart/native';
78
80
  | `data` | `RawDataPoint[]` | Array of data objects. |
79
81
  | `view` | `'day' \| 'week' \| 'month' \| 'year'` | Initial aggregation level. |
80
82
  | `dataKeys` | `{ label: string, value: string \| string[], date: string }` | Keys to map data fields. |
83
+ | `variant` | `'default' \| 'stacked' \| 'grouped'` | The style architecture. |
84
+ | `layout` | `'vertical' \| 'horizontal'` | Flipped orientation. |
85
+ | `missingDataStrategy` | `'skip' \| 'zero'` | Strategy to deal with timeline skips. |
86
+ | `annotations` | `Array<{ value, label?, color?, strokeDasharray? }>` | Draws horizontal/vertical threshold lines. |
87
+ | `valueFormatter` | `(value: number) => string` | Custom formatting function. |
81
88
  | `theme` | `ChartTheme` | Custom styling object. |
82
- | `onViewChange` | `(view: ChartView) => void` | Callback when drill-down occurs. |
83
- | `geminiConfig` | `{ apiKey: string, model: string }` | Configuration for AI predictions. |
84
89
 
85
90
  ## Customization (Theme)
86
91