katucharts.js 0.2.20 → 0.2.22

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
@@ -112,11 +112,15 @@ KatuCharts.use(FinanceModule);
112
112
  | `areaspline` | Smooth filled area |
113
113
  | `column` | Vertical bars (stacked, grouped, or range) |
114
114
  | `bar` | Horizontal bars (inverted column) |
115
+ | `columnrange` | Columns spanning a low–high range per category |
116
+ | `arearange` | Filled band between low and high values |
117
+ | `areasplinerange` | Smooth filled band between low and high values |
115
118
  | `scatter` | Point cloud |
116
119
  | `bubble` | Scatter with Z-value as radius |
117
120
  | `heatmap` | 2D grid with color scale |
118
121
  | `boxplot` | Box-and-whisker distribution |
119
122
  | `waterfall` | Cumulative change visualization |
123
+ | `pictorial` | Stacked column whose fill is masked to a custom SVG silhouette (proportional gauge) |
120
124
 
121
125
  ### Core — Non-Cartesian
122
126
 
@@ -167,7 +171,6 @@ KatuCharts.use(FinanceModule);
167
171
  | `heikinashi` | Heikin-Ashi candlestick |
168
172
  | `hollowcandlestick` | Hollow candlestick |
169
173
  | `volume` | Trading volume bars |
170
- | `arearange` | Area between range boundaries |
171
174
  | `baseline` | Profit/loss from a baseline value |
172
175
  | `flags` | Event markers on a series |
173
176
  | `renko` | Fixed-move block chart |
@@ -409,10 +412,18 @@ Manually fires a chart event.
409
412
  text: 'Optional subtitle',
410
413
  align: 'center',
411
414
  style: { color: '#666666' }
415
+ },
416
+ caption: {
417
+ text: 'Source: World Bank, 2024', // source/footnote shown in a band at the bottom
418
+ align: 'left', // 'left' | 'center' | 'right'
419
+ style: { fontSize: '11px', color: '#666666' }
412
420
  }
413
421
  }
414
422
  ```
415
423
 
424
+ `caption` accepts the same options as `title`/`subtitle` and renders below the
425
+ plot. The text may contain inline HTML.
426
+
416
427
  ### xAxis / yAxis
417
428
 
418
429
  Both accept a single object or an array for multiple axes.
@@ -431,7 +442,7 @@ Both accept a single object or an array for multiple axes.
431
442
  | `tickLength` | `number` | `10` | Tick mark length |
432
443
  | `tickWidth` | `number` | `1` | Tick mark width |
433
444
  | `tickPosition` | `'inside' \| 'outside'` | `'outside'` | |
434
- | `gridLineWidth` | `number` | `1` | Grid line width |
445
+ | `gridLineWidth` | `number` | `0` | Grid line width (set `> 0` to show grid lines) |
435
446
  | `gridLineColor` | `string` | `'#e6e6e6'` | |
436
447
  | `gridLineDashStyle` | `string` | `'Solid'` | |
437
448
  | `lineWidth` | `number` | `1` | Axis line width |
@@ -480,8 +491,11 @@ Each object in the `series` array accepts these options:
480
491
  | `borderRadius` | `number` | `0` | Column corner radius |
481
492
  | `marker` | `object` | — | `{ enabled, symbol, radius, fillColor, lineWidth, lineColor }` |
482
493
  | `dataLabels` | `object` | — | `{ enabled, format, formatter, style, position }` |
483
- | `stacking` | `'normal' \| 'percent'` | — | Stack series |
494
+ | `stacking` | `'normal' \| 'percent'` | — | Stack series; positive and negative values diverge to opposite sides of the baseline |
484
495
  | `stack` | `string \| number` | — | Stack group identifier |
496
+ | `linkedTo` | `string \| ':previous' \| ':next'` | — | Bind to another series (id or relative); linked series share one legend entry and hover/highlight as a unit |
497
+ | `zIndex` | `number` | `0` | Paint order — higher draws on top |
498
+ | `paths` | `{ definition: string }[]` | — | SVG silhouette paths for the `pictorial` type, cycled per point |
485
499
  | `negativeColor` | `string` | — | Color for values below threshold |
486
500
  | `threshold` | `number \| null` | `0` | |
487
501
  | `zones` | `Zone[]` | — | `[{ value, color, fillColor, dashStyle }]` |
@@ -593,6 +607,7 @@ KatuCharts.chart('container', {
593
607
  |--------|------|---------|-------------|
594
608
  | `enabled` | `boolean` | `true` | |
595
609
  | `shared` | `boolean` | `false` | Show all series at the hovered X |
610
+ | `crosshairs` | `boolean \| [boolean, boolean]` | `false` | Show axis crosshairs at the hovered point; `true` for the x-axis, or `[x, y]` to control each axis |
596
611
  | `split` | `boolean` | `false` | Separate callout per series |
597
612
  | `useHTML` | `boolean` | `false` | Render tooltip content as HTML |
598
613
  | `followPointer` | `boolean` | `false` | Move with cursor |
@@ -104,8 +104,20 @@ export declare class Chart {
104
104
  private raiseplotLineLabels;
105
105
  private updateTooltipCategories;
106
106
  private updateAxesDomains;
107
+ /**
108
+ * Folds per-group positive and negative stack sums into a single absolute-
109
+ * height map per category, used as the denominator for percent stacking.
110
+ */
111
+ private buildAbsStackTotals;
107
112
  private renderAxes;
108
113
  private renderSeriesInstances;
114
+ /**
115
+ * Paints series in ascending `zIndex` order so a higher-zIndex series sits on
116
+ * top — e.g. a line (zIndex 1) over its linked area band (zIndex 0), instead
117
+ * of the band covering the line's markers. Stable for the all-default (0)
118
+ * case, so the original order is preserved when no zIndex is set.
119
+ */
120
+ private reorderSeriesByZIndex;
109
121
  private renderLegend;
110
122
  private setupReflow;
111
123
  private fireEvent;
@@ -22,4 +22,15 @@ export declare function stackKey(cfg: StackKeyConfig): string;
22
22
  * and returns `totals` so callers can fold several series into one map.
23
23
  */
24
24
  export declare function accumulateStackTotals(data: ReadonlyArray<StackPoint>, totals: Map<number | string, number>): Map<number | string, number>;
25
+ /**
26
+ * Accumulates each point's `y` into separate positive and negative running
27
+ * sums keyed by `x`. This is what enables diverging stacks (e.g. a population
28
+ * pyramid): positive values stack one way from the zero baseline and negative
29
+ * values the other, instead of being summed into a single signed total that
30
+ * collapses them onto the same side. For all-positive stacks the negative map
31
+ * stays empty, so the positive sums match the plain accumulator exactly.
32
+ */
33
+ export declare function accumulateSignedStackTotals(data: ReadonlyArray<StackPoint>, pos: Map<number | string, number>, neg: Map<number | string, number>): void;
34
+ /** Absolute stack height at `xKey` = positive sum + magnitude of negative sum. */
35
+ export declare function absStackTotal(xKey: number | string, pos: Map<number | string, number>, neg: Map<number | string, number>): number;
25
36
  export {};