katucharts.js 0.2.1

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 (200) hide show
  1. package/LICENSE +106 -0
  2. package/README.md +1100 -0
  3. package/dist/__vite-optional-peer-dep_jspdf_katucharts-BDMct_Gn.js +4 -0
  4. package/dist/accessibility/A11yModule.d.ts +26 -0
  5. package/dist/axis/Axis.d.ts +140 -0
  6. package/dist/axis/AxisCoordinator.d.ts +38 -0
  7. package/dist/bio.d.ts +22 -0
  8. package/dist/components/Credits.d.ts +38 -0
  9. package/dist/components/Crosshair.d.ts +15 -0
  10. package/dist/components/DataLabels.d.ts +7 -0
  11. package/dist/components/ExportButton.d.ts +27 -0
  12. package/dist/components/Legend.d.ts +53 -0
  13. package/dist/components/TitleRenderer.d.ts +19 -0
  14. package/dist/components/Tooltip.d.ts +61 -0
  15. package/dist/core/Chart.d.ts +156 -0
  16. package/dist/core/EventBus.d.ts +14 -0
  17. package/dist/core/InteractionController.d.ts +62 -0
  18. package/dist/core/OptionsParser.d.ts +61 -0
  19. package/dist/core/Registry.d.ts +27 -0
  20. package/dist/core/SVGRenderer.d.ts +48 -0
  21. package/dist/core/ScrollablePlotOverlay.d.ts +31 -0
  22. package/dist/core/StackComputer.d.ts +25 -0
  23. package/dist/core/StateManager.d.ts +21 -0
  24. package/dist/core/UpdateScheduler.d.ts +28 -0
  25. package/dist/core/animationConstants.d.ts +20 -0
  26. package/dist/core/chartTypes.d.ts +46 -0
  27. package/dist/core/registerAll.d.ts +4 -0
  28. package/dist/core/registerBio.d.ts +4 -0
  29. package/dist/core/registerCore.d.ts +4 -0
  30. package/dist/core/registerFinance.d.ts +4 -0
  31. package/dist/core/registerFinancial.d.ts +4 -0
  32. package/dist/core/registerFlow.d.ts +4 -0
  33. package/dist/core/registerGeneral.d.ts +4 -0
  34. package/dist/datatable/DataTable.d.ts +162 -0
  35. package/dist/datatable/DataTableDefaults.d.ts +7 -0
  36. package/dist/datatable/api/TableApi.d.ts +35 -0
  37. package/dist/datatable/columns/ColumnDef.d.ts +16 -0
  38. package/dist/datatable/columns/ColumnManager.d.ts +31 -0
  39. package/dist/datatable/data/DataProcessor.d.ts +46 -0
  40. package/dist/datatable/data/DataSource.d.ts +26 -0
  41. package/dist/datatable/editing/CellEditor.d.ts +29 -0
  42. package/dist/datatable/export/TableExport.d.ts +23 -0
  43. package/dist/datatable/locales/en.d.ts +9 -0
  44. package/dist/datatable/locales/es.d.ts +6 -0
  45. package/dist/datatable/locales/index.d.ts +22 -0
  46. package/dist/datatable/locales/pt-BR.d.ts +6 -0
  47. package/dist/datatable/locales/resolveLocale.d.ts +16 -0
  48. package/dist/datatable/locales/zh.d.ts +6 -0
  49. package/dist/datatable/render/CellRenderer.d.ts +24 -0
  50. package/dist/datatable/render/HeaderRenderer.d.ts +51 -0
  51. package/dist/datatable/render/PaginationRenderer.d.ts +26 -0
  52. package/dist/datatable/render/SearchRenderer.d.ts +21 -0
  53. package/dist/datatable/render/TableRenderer.d.ts +81 -0
  54. package/dist/datatable/render/ToolbarRenderer.d.ts +34 -0
  55. package/dist/datatable/render/icons.d.ts +24 -0
  56. package/dist/datatable/render/popover.d.ts +15 -0
  57. package/dist/datatable/selection/SelectionManager.d.ts +29 -0
  58. package/dist/datatable/themes/TableTheme.d.ts +36 -0
  59. package/dist/datatable/themes/styleSheet.d.ts +16 -0
  60. package/dist/datatable.d.ts +19 -0
  61. package/dist/export/ChartExporter.d.ts +50 -0
  62. package/dist/export/Export.d.ts +76 -0
  63. package/dist/finance.d.ts +49 -0
  64. package/dist/index.d.ts +67 -0
  65. package/dist/indicators/Indicator.d.ts +23 -0
  66. package/dist/indicators/expandIndicators.d.ts +18 -0
  67. package/dist/indicators/moving-averages/DEMA.d.ts +10 -0
  68. package/dist/indicators/moving-averages/EMA.d.ts +12 -0
  69. package/dist/indicators/moving-averages/SMA.d.ts +11 -0
  70. package/dist/indicators/moving-averages/TEMA.d.ts +10 -0
  71. package/dist/indicators/moving-averages/WMA.d.ts +12 -0
  72. package/dist/indicators/oscillators/CCI.d.ts +11 -0
  73. package/dist/indicators/oscillators/MACD.d.ts +20 -0
  74. package/dist/indicators/oscillators/Momentum.d.ts +10 -0
  75. package/dist/indicators/oscillators/ROC.d.ts +10 -0
  76. package/dist/indicators/oscillators/RSI.d.ts +11 -0
  77. package/dist/indicators/oscillators/Stochastic.d.ts +20 -0
  78. package/dist/indicators/registry.d.ts +9 -0
  79. package/dist/indicators/trend/ADX.d.ts +11 -0
  80. package/dist/indicators/trend/IchimokuCloud.d.ts +14 -0
  81. package/dist/indicators/trend/PSAR.d.ts +11 -0
  82. package/dist/indicators/util.d.ts +8 -0
  83. package/dist/indicators/volatility/ATR.d.ts +11 -0
  84. package/dist/indicators/volatility/BollingerBands.d.ts +11 -0
  85. package/dist/indicators/volume/OBV.d.ts +11 -0
  86. package/dist/indicators/volume/VBP.d.ts +12 -0
  87. package/dist/indicators/volume/VWAP.d.ts +12 -0
  88. package/dist/interaction/Drilldown.d.ts +29 -0
  89. package/dist/interaction/HoverManager.d.ts +47 -0
  90. package/dist/interaction/Zoom.d.ts +68 -0
  91. package/dist/katucharts-bio.es.js +5861 -0
  92. package/dist/katucharts-bio.umd.js +1 -0
  93. package/dist/katucharts-datatable.es.js +3363 -0
  94. package/dist/katucharts-datatable.umd.js +296 -0
  95. package/dist/katucharts-finance.es.js +4364 -0
  96. package/dist/katucharts-finance.umd.js +1 -0
  97. package/dist/katucharts-react.es.js +35 -0
  98. package/dist/katucharts-react.umd.js +1 -0
  99. package/dist/katucharts.es.js +20531 -0
  100. package/dist/katucharts.umd.js +9 -0
  101. package/dist/layout/LayoutEngine.d.ts +44 -0
  102. package/dist/license/LicenseManager.d.ts +63 -0
  103. package/dist/options/defaults.d.ts +5 -0
  104. package/dist/react/KatuChartsReact.d.ts +16 -0
  105. package/dist/react.d.ts +2 -0
  106. package/dist/responsive/ResponsiveEngine.d.ts +15 -0
  107. package/dist/series/BaseSeries.d.ts +186 -0
  108. package/dist/series/bioinformatics/CircosChart.d.ts +4 -0
  109. package/dist/series/bioinformatics/ClusteredHeatmapChart.d.ts +22 -0
  110. package/dist/series/bioinformatics/ForestPlotChart.d.ts +21 -0
  111. package/dist/series/bioinformatics/KaplanMeierChart.d.ts +22 -0
  112. package/dist/series/bioinformatics/ManhattanChart.d.ts +34 -0
  113. package/dist/series/bioinformatics/PCoAChart.d.ts +22 -0
  114. package/dist/series/bioinformatics/PhyloTreeChart.d.ts +27 -0
  115. package/dist/series/bioinformatics/SequenceLogoChart.d.ts +21 -0
  116. package/dist/series/bioinformatics/ViolinChart.d.ts +23 -0
  117. package/dist/series/bioinformatics/VolcanoChart.d.ts +28 -0
  118. package/dist/series/bioinformatics/circos/CircosChart.d.ts +20 -0
  119. package/dist/series/bioinformatics/circos/CircosColorScales.d.ts +6 -0
  120. package/dist/series/bioinformatics/circos/CircosComparativeChart.d.ts +41 -0
  121. package/dist/series/bioinformatics/circos/CircosHeatmapChart.d.ts +31 -0
  122. package/dist/series/bioinformatics/circos/CircosLayoutEngine.d.ts +37 -0
  123. package/dist/series/bioinformatics/circos/CircosRules.d.ts +6 -0
  124. package/dist/series/bioinformatics/circos/CircosSpiralChart.d.ts +39 -0
  125. package/dist/series/bioinformatics/circos/CircosTypes.d.ts +131 -0
  126. package/dist/series/bioinformatics/circos/tracks/AreaTrackRenderer.d.ts +7 -0
  127. package/dist/series/bioinformatics/circos/tracks/ConnectorTrackRenderer.d.ts +7 -0
  128. package/dist/series/bioinformatics/circos/tracks/GlyphTrackRenderer.d.ts +7 -0
  129. package/dist/series/bioinformatics/circos/tracks/HeatmapTrackRenderer.d.ts +7 -0
  130. package/dist/series/bioinformatics/circos/tracks/HighlightTrackRenderer.d.ts +6 -0
  131. package/dist/series/bioinformatics/circos/tracks/HistogramTrackRenderer.d.ts +7 -0
  132. package/dist/series/bioinformatics/circos/tracks/LineTrackRenderer.d.ts +7 -0
  133. package/dist/series/bioinformatics/circos/tracks/LinkTrackRenderer.d.ts +8 -0
  134. package/dist/series/bioinformatics/circos/tracks/LollipopTrackRenderer.d.ts +9 -0
  135. package/dist/series/bioinformatics/circos/tracks/RibbonTrackRenderer.d.ts +9 -0
  136. package/dist/series/bioinformatics/circos/tracks/ScatterTrackRenderer.d.ts +7 -0
  137. package/dist/series/bioinformatics/circos/tracks/StackTrackRenderer.d.ts +7 -0
  138. package/dist/series/bioinformatics/circos/tracks/TextTrackRenderer.d.ts +8 -0
  139. package/dist/series/bioinformatics/circos/tracks/TileTrackRenderer.d.ts +7 -0
  140. package/dist/series/bioinformatics/circos/tracks/TrackAxesRenderer.d.ts +6 -0
  141. package/dist/series/bioinformatics/circos/tracks/TrackBackgroundRenderer.d.ts +5 -0
  142. package/dist/series/cartesian/AreaChart.d.ts +33 -0
  143. package/dist/series/cartesian/BoxPlotChart.d.ts +24 -0
  144. package/dist/series/cartesian/BubbleChart.d.ts +34 -0
  145. package/dist/series/cartesian/ColumnChart.d.ts +37 -0
  146. package/dist/series/cartesian/LineChart.d.ts +28 -0
  147. package/dist/series/cartesian/ScatterChart.d.ts +20 -0
  148. package/dist/series/cartesian/SplineChart.d.ts +9 -0
  149. package/dist/series/cartesian/WaterfallChart.d.ts +25 -0
  150. package/dist/series/financial/AreaRangeChart.d.ts +24 -0
  151. package/dist/series/financial/BaselineChart.d.ts +20 -0
  152. package/dist/series/financial/CandlestickChart.d.ts +55 -0
  153. package/dist/series/financial/ColumnRangeChart.d.ts +16 -0
  154. package/dist/series/financial/FlagsChart.d.ts +34 -0
  155. package/dist/series/financial/HeikinAshiChart.d.ts +11 -0
  156. package/dist/series/financial/HollowCandlestickChart.d.ts +17 -0
  157. package/dist/series/financial/KagiChart.d.ts +23 -0
  158. package/dist/series/financial/LineBreakChart.d.ts +23 -0
  159. package/dist/series/financial/PointAndFigureChart.d.ts +24 -0
  160. package/dist/series/financial/RenkoChart.d.ts +22 -0
  161. package/dist/series/financial/VBPChart.d.ts +18 -0
  162. package/dist/series/financial/VolumeChart.d.ts +15 -0
  163. package/dist/series/flow/DependencyWheelChart.d.ts +23 -0
  164. package/dist/series/flow/NetworkGraphChart.d.ts +18 -0
  165. package/dist/series/flow/SankeyChart.d.ts +24 -0
  166. package/dist/series/gauge/GaugeChart.d.ts +40 -0
  167. package/dist/series/heatmap/HeatmapChart.d.ts +18 -0
  168. package/dist/series/hierarchical/SunburstChart.d.ts +44 -0
  169. package/dist/series/hierarchical/TreegraphChart.d.ts +19 -0
  170. package/dist/series/hierarchical/TreemapChart.d.ts +20 -0
  171. package/dist/series/hierarchical/WordcloudChart.d.ts +19 -0
  172. package/dist/series/index.d.ts +45 -0
  173. package/dist/series/map/FlowmapChart.d.ts +33 -0
  174. package/dist/series/map/MapChart.d.ts +53 -0
  175. package/dist/series/map/MapPointChart.d.ts +26 -0
  176. package/dist/series/map/mapProjection.d.ts +46 -0
  177. package/dist/series/pie/PieChart.d.ts +53 -0
  178. package/dist/series/polar/PolarChart.d.ts +18 -0
  179. package/dist/series/race/BarRaceChart.d.ts +44 -0
  180. package/dist/series/timeline/TimelineChart.d.ts +23 -0
  181. package/dist/series/venn/VennChart.d.ts +28 -0
  182. package/dist/stock/DataGrouping.d.ts +21 -0
  183. package/dist/stock/Navigator.d.ts +25 -0
  184. package/dist/stock/RangeSelector.d.ts +9 -0
  185. package/dist/stock/StockController.d.ts +47 -0
  186. package/dist/stockcharts.d.ts +8 -0
  187. package/dist/streaming/StreamAdapter.d.ts +36 -0
  188. package/dist/types/datatable-options.d.ts +633 -0
  189. package/dist/types/options.d.ts +1333 -0
  190. package/dist/utils/CircularBuffer.d.ts +24 -0
  191. package/dist/utils/chartText.d.ts +18 -0
  192. package/dist/utils/color.d.ts +23 -0
  193. package/dist/utils/decimation.d.ts +19 -0
  194. package/dist/utils/deepMerge.d.ts +5 -0
  195. package/dist/utils/dom.d.ts +10 -0
  196. package/dist/utils/format.d.ts +42 -0
  197. package/dist/utils/index.d.ts +7 -0
  198. package/dist/utils/math.d.ts +6 -0
  199. package/dist/utils/throttle.d.ts +2 -0
  200. package/package.json +95 -0
@@ -0,0 +1,26 @@
1
+ import 'd3-transition';
2
+ import { BaseSeries } from '../BaseSeries';
3
+ import type { InternalSeriesConfig } from '../../types/options';
4
+ /**
5
+ * `mappoint` series — renders point markers (and optional data labels) at
6
+ * geographic `lat`/`lon` coordinates, projected through the *same* projection
7
+ * as the choropleth basemap so markers land exactly on top of it. Mirrors the
8
+ * The `mappoint` series type.
9
+ */
10
+ export declare class MapPointChart extends BaseSeries {
11
+ constructor(config: InternalSeriesConfig);
12
+ /**
13
+ * Resolves the map topology this series projects against: its own bridged
14
+ * `mapData` (from `chart.map`), or failing that the topology of a sibling
15
+ * map-family series in the same chart.
16
+ */
17
+ private resolveMapData;
18
+ render(): void;
19
+ private formatLabel;
20
+ getDataExtents(): {
21
+ xMin: number;
22
+ xMax: number;
23
+ yMin: number;
24
+ yMax: number;
25
+ };
26
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Shared geographic projection helpers for the map series family
3
+ * (`map`, `mappoint`, `flowmap`). Centralizing projection construction here
4
+ * guarantees that every map-family series in a chart resolves the *identical*
5
+ * projection from the same `mapData` + `plotArea`, so point markers and flow
6
+ * lines land exactly on top of the choropleth basemap.
7
+ */
8
+ import { type GeoProjection, type GeoPath } from 'd3-geo';
9
+ import type { PlotArea } from '../../types/options';
10
+ export declare const projectionMap: Record<string, () => GeoProjection>;
11
+ /**
12
+ * Normalizes `mapData` into a flat array of GeoJSON features. Accepts a
13
+ * GeoJSON FeatureCollection, a bare feature array, or a TopoJSON topology —
14
+ * TopoJSON is converted on the fly so the same `mapData` option works for
15
+ * either format. `objectName` selects the topology object (defaults to a
16
+ * `countries` object when present, otherwise the first one).
17
+ */
18
+ export declare function resolveFeatures(mapData: any, objectName?: string): any[];
19
+ /** True when the projection should be rendered as an interactive 3D globe. */
20
+ export declare function isGlobeProjection(projName: string, cfg?: any): boolean;
21
+ export interface ResolvedMapProjection {
22
+ projection: GeoProjection;
23
+ pathGen: GeoPath;
24
+ features: any[];
25
+ projName: string;
26
+ }
27
+ /**
28
+ * Builds the d3-geo projection + path generator for a map-family series from
29
+ * its `projection` config, fitting the supplied `mapData` to `plotArea`
30
+ * exactly as the choropleth basemap does. The result is deterministic for a
31
+ * given (mapData, projection, plotArea), so sibling series stay aligned.
32
+ */
33
+ export declare function createMapProjection(mapData: any, projectionCfg: any, plotArea: PlotArea, mapDataObject?: string): ResolvedMapProjection;
34
+ /**
35
+ * Reconfigures a projection into globe (orthographic) mode — centered, scaled
36
+ * to the plot radius and clipped to the visible hemisphere. Returns the radius
37
+ * so callers can size the ocean/atmosphere/specular layers consistently.
38
+ */
39
+ export declare function applyGlobeProjection(projection: GeoProjection, plotArea: PlotArea): number;
40
+ /**
41
+ * Resolves a single point's geographic coordinate to `[lon, lat]`, accepting
42
+ * the shapes used by `mappoint`/`flowmap`: `{ lat, lon }`,
43
+ * `{ geometry: { coordinates: [lon, lat] } }`, a bare `[lon, lat]` pair, or a
44
+ * `{ x: lon, y: lat }` fallback. Returns null when no coordinate is present.
45
+ */
46
+ export declare function pointLonLat(p: any): [number, number] | null;
@@ -0,0 +1,53 @@
1
+ import 'd3-transition';
2
+ import { BaseSeries, type SeriesContext } from '../BaseSeries';
3
+ import type { InternalSeriesConfig } from '../../types/options';
4
+ export declare class PieChart extends BaseSeries {
5
+ private selectedIndices;
6
+ constructor(config: InternalSeriesConfig);
7
+ /**
8
+ * Returns the enabled data-label configs in array form. The API allows a
9
+ * pie point to carry several label sets (e.g. the name outside the slice plus
10
+ * the percentage inside it), passed as an array; this normalises the single-
11
+ * object and array forms to one list so the rest of the chart can treat them
12
+ * uniformly.
13
+ */
14
+ private dataLabelConfigs;
15
+ init(context: SeriesContext): void;
16
+ render(): void;
17
+ private renderPieLabels;
18
+ /**
19
+ * Rank-based label distribution. Packs the side's labels into the available
20
+ * vertical span using rank-based priority (higher percentage = higher rank)
21
+ * and greedy placement with relaxation. A label is dropped only when it cannot
22
+ * fit the plot height (capacity) or when packing would slide it further than
23
+ * `maxDisplacement` from its slice — the latter thins densely clustered
24
+ * regions instead of fanning every label out on a long leader line.
25
+ */
26
+ private distribute;
27
+ private distributeBoxes;
28
+ /**
29
+ * Renders pseudo-3D side effect below pie slices using the depth config.
30
+ */
31
+ private render3DEffect;
32
+ private resolvePercent;
33
+ private resolveBorderRadius;
34
+ getDataExtents(): {
35
+ xMin: number;
36
+ xMax: number;
37
+ yMin: number;
38
+ yMax: number;
39
+ };
40
+ }
41
+ export declare class FunnelChart extends BaseSeries {
42
+ constructor(config: InternalSeriesConfig);
43
+ render(): void;
44
+ getDataExtents(): {
45
+ xMin: number;
46
+ xMax: number;
47
+ yMin: number;
48
+ yMax: number;
49
+ };
50
+ }
51
+ export declare class PyramidChart extends FunnelChart {
52
+ constructor(config: InternalSeriesConfig);
53
+ }
@@ -0,0 +1,18 @@
1
+ import 'd3-transition';
2
+ import { BaseSeries } from '../BaseSeries';
3
+ import type { InternalSeriesConfig } from '../../types/options';
4
+ export declare class PolarChart extends BaseSeries {
5
+ constructor(config: InternalSeriesConfig);
6
+ render(): void;
7
+ private resolvePolarSubType;
8
+ private renderLineAreaPolar;
9
+ private renderColumnPolar;
10
+ private renderPolarDataLabels;
11
+ private renderGrid;
12
+ getDataExtents(): {
13
+ xMin: number;
14
+ xMax: number;
15
+ yMin: number;
16
+ yMax: number;
17
+ };
18
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Bar Chart Race series — animated horizontal bars ranked by value through time keyframes.
3
+ * Includes play/pause button and range slider.
4
+ */
5
+ import 'd3-transition';
6
+ import { BaseSeries } from '../BaseSeries';
7
+ import type { InternalSeriesConfig } from '../../types/options';
8
+ export declare class BarRaceChart extends BaseSeries {
9
+ private keyframes;
10
+ private currentFrameIndex;
11
+ private colorMap;
12
+ private timer;
13
+ private playing;
14
+ private axisGroup;
15
+ private barsGroup;
16
+ private tickerText;
17
+ private valueScale;
18
+ private controlsEl;
19
+ private playBtn;
20
+ private rangeInput;
21
+ private rangeLabel;
22
+ constructor(config: InternalSeriesConfig);
23
+ processData(): void;
24
+ render(): void;
25
+ private renderControls;
26
+ private updateControls;
27
+ private playIcon;
28
+ private pauseIcon;
29
+ private renderFrame;
30
+ private renderAxis;
31
+ private attachBarHoverEffects;
32
+ play(): void;
33
+ pause(): void;
34
+ restart(): void;
35
+ goToFrame(index: number): void;
36
+ getDataExtents(): {
37
+ xMin: number;
38
+ xMax: number;
39
+ yMin: number;
40
+ yMax: number;
41
+ };
42
+ destroy(): void;
43
+ private brightenColor;
44
+ }
@@ -0,0 +1,23 @@
1
+ import 'd3-transition';
2
+ import { BaseSeries } from '../BaseSeries';
3
+ import type { InternalSeriesConfig } from '../../types/options';
4
+ export declare class TimelineChart extends BaseSeries {
5
+ constructor(config: InternalSeriesConfig);
6
+ render(): void;
7
+ getDataExtents(): {
8
+ xMin: number;
9
+ xMax: number;
10
+ yMin: number;
11
+ yMax: number;
12
+ };
13
+ }
14
+ export declare class GanttChart extends BaseSeries {
15
+ constructor(config: InternalSeriesConfig);
16
+ render(): void;
17
+ getDataExtents(): {
18
+ xMin: number;
19
+ xMax: number;
20
+ yMin: number;
21
+ yMax: number;
22
+ };
23
+ }
@@ -0,0 +1,28 @@
1
+ import 'd3-transition';
2
+ import { BaseSeries } from '../BaseSeries';
3
+ import type { InternalSeriesConfig } from '../../types/options';
4
+ export declare class VennChart extends BaseSeries {
5
+ private selectedIndices;
6
+ constructor(config: InternalSeriesConfig);
7
+ render(): void;
8
+ private resolveDashStyle;
9
+ private attachEvents;
10
+ private renderLabels;
11
+ private layoutSets;
12
+ private optimizePositions;
13
+ private circlePath;
14
+ private lensPath;
15
+ private triIntersectionPath;
16
+ private circleIntersectionPoints;
17
+ private insideCircle;
18
+ private findArcCircle;
19
+ private blendColors;
20
+ private findDistance;
21
+ private lensArea;
22
+ getDataExtents(): {
23
+ xMin: number;
24
+ xMax: number;
25
+ yMin: number;
26
+ yMax: number;
27
+ };
28
+ }
@@ -0,0 +1,21 @@
1
+ import type { PointOptions } from '../types/options';
2
+ export type GroupingApproximation = 'average' | 'sum' | 'open' | 'high' | 'low' | 'close' | 'ohlc' | 'range';
3
+ export interface DataGroupingOptions {
4
+ enabled?: boolean;
5
+ approximation?: GroupingApproximation;
6
+ groupPixelWidth?: number;
7
+ forced?: boolean;
8
+ smoothed?: boolean;
9
+ anchor?: 'start' | 'middle' | 'end';
10
+ units?: [string, number[] | null][];
11
+ groupAll?: boolean;
12
+ }
13
+ export declare class DataGrouping {
14
+ static group(data: PointOptions[], interval: number, approximation?: GroupingApproximation, options?: DataGroupingOptions, visibleRange?: {
15
+ min: number;
16
+ max: number;
17
+ }): PointOptions[];
18
+ private static applyAnchor;
19
+ private static smooth;
20
+ private static approximate;
21
+ }
@@ -0,0 +1,25 @@
1
+ import { Selection } from 'd3-selection';
2
+ import type { NavigatorOptions, PlotArea } from '../types/options';
3
+ import { EventBus } from '../core/EventBus';
4
+ export declare class Navigator {
5
+ private group;
6
+ private config;
7
+ private events;
8
+ private width;
9
+ private height;
10
+ private brush;
11
+ private brushGroup;
12
+ private programmatic;
13
+ constructor(config: NavigatorOptions, svg: Selection<SVGSVGElement, unknown, null, undefined>, plotArea: PlotArea, chartHeight: number, events: EventBus, seriesData: {
14
+ x: number;
15
+ y: number;
16
+ }[]);
17
+ private renderSeriesLine;
18
+ private updateSeriesLine;
19
+ /**
20
+ * Sets the brush selection to reflect a visible window (fractions 0..1 of full range).
21
+ * A full or empty range clears the selection. Guarded to prevent re-emitting brush events.
22
+ */
23
+ setSelection(x0Frac: number, x1Frac: number): void;
24
+ destroy(): void;
25
+ }
@@ -0,0 +1,9 @@
1
+ import type { RangeSelectorOptions } from '../types/options';
2
+ import { EventBus } from '../core/EventBus';
3
+ export declare class RangeSelector {
4
+ private container;
5
+ private config;
6
+ private events;
7
+ constructor(config: RangeSelectorOptions, parentContainer: HTMLElement, events: EventBus);
8
+ destroy(): void;
9
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Wires the stock UI — RangeSelector buttons/inputs and the Navigator brush —
3
+ * to the chart's x-axis. Both translate user intent into an x-domain change and
4
+ * trigger a re-render, a standard stock-chart interaction. Kept separate from
5
+ * Chart so the stock concern stays self-contained.
6
+ */
7
+ import type { Selection } from 'd3-selection';
8
+ import type { EventBus } from '../core/EventBus';
9
+ import type { LayoutResult } from '../layout/LayoutEngine';
10
+ import type { AxisInstance } from '../axis/Axis';
11
+ import type { BaseSeries } from '../series/BaseSeries';
12
+ import type { InternalConfig } from '../types/options';
13
+ export interface StockHost {
14
+ getOptions(): InternalConfig;
15
+ getContainer(): HTMLElement;
16
+ getEvents(): EventBus;
17
+ getSvg(): Selection<SVGSVGElement, unknown, null, undefined>;
18
+ getLayout(): LayoutResult;
19
+ getChartHeight(): number;
20
+ getXAxes(): AxisInstance[];
21
+ getSeriesInstances(): BaseSeries[];
22
+ rerender(): void;
23
+ }
24
+ export declare class StockController {
25
+ private host;
26
+ private navigator;
27
+ private rangeSelector;
28
+ private xMin;
29
+ private xMax;
30
+ constructor(host: StockHost);
31
+ setup(): void;
32
+ /**
33
+ * Extracts {x, y} data from the base series, using close price for OHLC points.
34
+ */
35
+ private getBaseSeriesData;
36
+ private placeRangeSelectorOnTop;
37
+ /**
38
+ * Resolves a range-selector button (type/count) to an x-axis domain range.
39
+ */
40
+ private applyButton;
41
+ private applyXRange;
42
+ /**
43
+ * Syncs the navigator brush to reflect the current visible [min, max] x-axis window.
44
+ */
45
+ private syncNavigator;
46
+ destroy(): void;
47
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * KatuCharts Stock Chart entrypoint — adds navigator, range selector, data grouping.
3
+ */
4
+ import { KatuCharts, Chart } from './index';
5
+ import type { KatuChartsOptions } from './types/options';
6
+ export declare function stockChart(containerOrId: string | HTMLElement, options: KatuChartsOptions): Chart;
7
+ export default KatuCharts;
8
+ export { KatuCharts, Chart };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Thin wrappers for connecting WebSocket, SSE, and polling data sources
3
+ * to KatuCharts series instances.
4
+ */
5
+ import type { PointOptions } from '../types/options';
6
+ export interface StreamSubscription {
7
+ unsubscribe(): void;
8
+ }
9
+ export declare class StreamAdapter {
10
+ /**
11
+ * Connect a WebSocket to a series, parsing each message into points.
12
+ */
13
+ static fromWebSocket(ws: WebSocket, series: {
14
+ addPoint(p: PointOptions, redraw?: boolean, shift?: boolean): void;
15
+ addPoints?(pts: PointOptions[], redraw?: boolean, shift?: boolean): void;
16
+ }, parseMessage: (data: any) => PointOptions | PointOptions[], options?: {
17
+ shift?: boolean;
18
+ }): StreamSubscription;
19
+ /**
20
+ * Connect an EventSource (SSE) to a series.
21
+ */
22
+ static fromEventSource(source: EventSource, series: {
23
+ addPoint(p: PointOptions, redraw?: boolean, shift?: boolean): void;
24
+ }, eventName: string, parseMessage: (data: string) => PointOptions, options?: {
25
+ shift?: boolean;
26
+ }): StreamSubscription;
27
+ /**
28
+ * Create a polling adapter that fetches new data at a regular interval.
29
+ */
30
+ static fromPolling(fetchFn: () => Promise<PointOptions | PointOptions[]>, series: {
31
+ addPoint(p: PointOptions, redraw?: boolean, shift?: boolean): void;
32
+ addPoints?(pts: PointOptions[], redraw?: boolean, shift?: boolean): void;
33
+ }, intervalMs: number, options?: {
34
+ shift?: boolean;
35
+ }): StreamSubscription;
36
+ }