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,4 @@
1
+ const t = {};
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,26 @@
1
+ import { Selection } from 'd3-selection';
2
+ import type { AccessibilityOptions } from '../types/options';
3
+ import type { BaseSeries } from '../series/BaseSeries';
4
+ export declare class A11yModule {
5
+ private config;
6
+ constructor(config: AccessibilityOptions);
7
+ private lastSeriesCount;
8
+ private lastPointCounts;
9
+ apply(svg: Selection<SVGSVGElement, unknown, null, undefined>, series: BaseSeries[], chartTitle?: string): void;
10
+ private setupAnnounceNewData;
11
+ private renderScreenReaderSections;
12
+ private createScreenReaderDiv;
13
+ /**
14
+ * Substitutes placeholders in a developer-supplied section template. The
15
+ * template markup is preserved, but interpolated data values (chart title and
16
+ * series names) are HTML-escaped before reaching the section's innerHTML so a
17
+ * crafted series name or title cannot inject markup.
18
+ */
19
+ private formatSectionTemplate;
20
+ private applyLandmarks;
21
+ private generateDescription;
22
+ private setupKeyboardNav;
23
+ private announcePoint;
24
+ private announceSeries;
25
+ private announce;
26
+ }
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Axis classes wrapping D3 scales and d3-axis.
3
+ */
4
+ import { type ScaleLinear, type ScaleLogarithmic, type ScaleTime, type ScaleBand } from 'd3-scale';
5
+ import { type Axis as D3Axis } from 'd3-axis';
6
+ import { Selection } from 'd3-selection';
7
+ import 'd3-transition';
8
+ import type { InternalAxisConfig, PlotArea } from '../types/options';
9
+ export type AnyScale = ScaleLinear<number, number> | ScaleLogarithmic<number, number> | ScaleTime<number, number> | ScaleBand<string>;
10
+ export interface AxisInstance {
11
+ config: InternalAxisConfig;
12
+ scale: AnyScale;
13
+ render(group: Selection<SVGGElement, unknown, null, undefined>, plotArea: PlotArea): void;
14
+ updateDomain(data: {
15
+ min: number;
16
+ max: number;
17
+ extraMinPadding?: number;
18
+ extraMaxPadding?: number;
19
+ } | string[]): void;
20
+ animateAxis(group: Selection<SVGGElement, unknown, null, undefined>, plotArea: PlotArea, duration: number): void;
21
+ getPixelForValue(value: any): number;
22
+ getValueForPixel(pixel: number): any;
23
+ destroy(): void;
24
+ }
25
+ export declare function createAxis(config: InternalAxisConfig, plotArea: PlotArea): AxisInstance;
26
+ declare class BaseAxis {
27
+ config: InternalAxisConfig;
28
+ protected plotArea: PlotArea;
29
+ constructor(config: InternalAxisConfig, plotArea: PlotArea);
30
+ /** Readable axis text color when none is configured — adapts to the chart background. */
31
+ protected autoText(): string;
32
+ protected getRange(): [number, number];
33
+ /**
34
+ * Vertical sub-region (pane) this y-axis occupies, from `top`/`height`
35
+ * (pixels or '%' of plot height). Enables stacked stock panes (e.g. price on
36
+ * top, RSI/MACD below). Defaults to the full plot height.
37
+ */
38
+ protected getPaneBand(): {
39
+ top: number;
40
+ height: number;
41
+ };
42
+ protected createD3Axis(scale: any): D3Axis<any>;
43
+ protected applyAxisStyles(axisGroup: Selection<SVGGElement, unknown, null, undefined>, plotArea: PlotArea): void;
44
+ /**
45
+ * Truncates left-of-plot horizontal tick labels that are wider than `maxWidth`, appending an ellipsis
46
+ * and stashing the full text in a `<title>` so it stays readable on hover. Labels that already fit are
47
+ * left untouched. Measured live via getComputedTextLength so it follows the host page's actual font.
48
+ */
49
+ protected truncateSideLabels(axisGroup: Selection<SVGGElement, unknown, null, undefined>, maxWidth: number): void;
50
+ protected applyAutoRotation(axisGroup: Selection<SVGGElement, unknown, null, undefined>, rotations: number[], plotArea: PlotArea): void;
51
+ /**
52
+ * Detects whether adjacent tick labels overlap horizontally, using a 4px gap threshold.
53
+ */
54
+ protected hasLabelOverlap(ticks: SVGTextElement[], rotated?: boolean): boolean;
55
+ /**
56
+ * Hides every Nth label until labels no longer overlap, matching
57
+ * auto-step behavior for extreme ranges.
58
+ */
59
+ protected applyAutoStep(axisGroup: Selection<SVGGElement, unknown, null, undefined>, ticks: SVGTextElement[]): void;
60
+ protected renderGridLines(group: Selection<SVGGElement, unknown, null, undefined>, scale: any, plotArea: PlotArea, explicitTicks?: number[]): void;
61
+ protected renderAlternateGridColor(gridGroup: Selection<SVGGElement, unknown, null, undefined>, ticks: any[], scale: any, plotArea: PlotArea): void;
62
+ protected renderMinorGridLines(gridGroup: Selection<SVGGElement, unknown, null, undefined>, majorTicks: any[], scale: any, plotArea: PlotArea): void;
63
+ protected renderPlotBands(group: Selection<SVGGElement, unknown, null, undefined>, scale: any, plotArea: PlotArea): void;
64
+ protected renderPlotLines(group: Selection<SVGGElement, unknown, null, undefined>, scale: any, plotArea: PlotArea): void;
65
+ protected applyAxisBreaks(scale: any): void;
66
+ protected renderTitle(group: Selection<SVGGElement, unknown, null, undefined>, plotArea: PlotArea): void;
67
+ animateAxis(group: Selection<SVGGElement, unknown, null, undefined>, plotArea: PlotArea, duration: number): void;
68
+ protected animateGridLines(group: Selection<SVGGElement, unknown, null, undefined>, scale: any, plotArea: PlotArea, duration: number): void;
69
+ protected getDashArray(style?: string): string;
70
+ destroy(): void;
71
+ }
72
+ export declare class LinearAxis extends BaseAxis implements AxisInstance {
73
+ scale: ScaleLinear<number, number>;
74
+ constructor(config: InternalAxisConfig, plotArea: PlotArea);
75
+ updateDomain(data: {
76
+ min: number;
77
+ max: number;
78
+ extraMinPadding?: number;
79
+ extraMaxPadding?: number;
80
+ }): void;
81
+ render(group: Selection<SVGGElement, unknown, null, undefined>, plotArea: PlotArea): void;
82
+ private renderStackLabels;
83
+ /**
84
+ * Computes "nice" round tick values for clean axis labels:
85
+ * picks intervals from the sequence 1, 2, 2.5, 5 scaled by powers of 10,
86
+ * choosing the smallest interval that produces at most `maxTicks` ticks.
87
+ */
88
+ private computeNiceTicks;
89
+ getPixelForValue(value: number): number;
90
+ getValueForPixel(pixel: number): number;
91
+ /**
92
+ * SI suffixes (k, M, G, T) are applied only when
93
+ * the tick interval is >= 1000. Below that, plain numbers with thousands separators are used.
94
+ */
95
+ private linearTickFormat;
96
+ private getTransform;
97
+ }
98
+ export declare class LogarithmicAxis extends BaseAxis implements AxisInstance {
99
+ scale: ScaleLogarithmic<number, number>;
100
+ constructor(config: InternalAxisConfig, plotArea: PlotArea);
101
+ updateDomain(data: {
102
+ min: number;
103
+ max: number;
104
+ }): void;
105
+ /**
106
+ * Generates tick values at powers of 10 for logarithmic axes.
107
+ * tickInterval refers to the exponent interval (1 = every decade, 2 = every other decade).
108
+ * When no tickInterval is set, the axis uses tickPixelInterval to auto-compute the step.
109
+ */
110
+ private computeLogTicks;
111
+ render(group: Selection<SVGGElement, unknown, null, undefined>, plotArea: PlotArea): void;
112
+ getPixelForValue(value: number): number;
113
+ getValueForPixel(pixel: number): number;
114
+ }
115
+ export declare class DateTimeAxis extends BaseAxis implements AxisInstance {
116
+ scale: ScaleTime<number, number>;
117
+ constructor(config: InternalAxisConfig, plotArea: PlotArea);
118
+ updateDomain(data: {
119
+ min: number;
120
+ max: number;
121
+ }): void;
122
+ render(group: Selection<SVGGElement, unknown, null, undefined>, plotArea: PlotArea): void;
123
+ private pickDateFormat;
124
+ getPixelForValue(value: number): number;
125
+ getValueForPixel(pixel: number): number;
126
+ }
127
+ export declare class CategoryAxis extends BaseAxis implements AxisInstance {
128
+ scale: ScaleBand<string>;
129
+ constructor(config: InternalAxisConfig, plotArea: PlotArea);
130
+ updateDomain(data: string[] | {
131
+ min: number;
132
+ max: number;
133
+ }): void;
134
+ render(group: Selection<SVGGElement, unknown, null, undefined>, plotArea: PlotArea): void;
135
+ private applyAutoStepIfNeeded;
136
+ getPixelForValue(value: any): number;
137
+ getBandwidth(): number;
138
+ getValueForPixel(pixel: number): string;
139
+ }
140
+ export {};
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Owns the cartesian-axis coordination concern: computing axis domains from the
3
+ * visible series (including stacking and bubble-radius padding), rendering the
4
+ * axes into the axis group, wiring category-tick hover highlighting, and syncing
5
+ * tooltip categories. Extracted from `Chart`; it reaches the chart's current
6
+ * state through a narrow host interface and mutates the axis instances in place
7
+ * (the chart still owns the `xAxes`/`yAxes` arrays).
8
+ */
9
+ import 'd3-transition';
10
+ import type { SVGRenderer } from '../core/SVGRenderer';
11
+ import type { EventBus } from '../core/EventBus';
12
+ import type { Tooltip } from '../components/Tooltip';
13
+ import type { InternalConfig } from '../types/options';
14
+ import type { LayoutResult } from '../layout/LayoutEngine';
15
+ import type { BaseSeries } from '../series/BaseSeries';
16
+ import type { AxisInstance } from './Axis';
17
+ type AxisGroup = ReturnType<SVGRenderer['createGroup']>;
18
+ export interface AxisHost {
19
+ getOptions(): InternalConfig;
20
+ getLayout(): LayoutResult;
21
+ getSeriesInstances(): BaseSeries[];
22
+ getXAxes(): AxisInstance[];
23
+ getYAxes(): AxisInstance[];
24
+ getAxisGroup(): AxisGroup;
25
+ getEvents(): EventBus;
26
+ getTooltip(): Tooltip | null;
27
+ }
28
+ export declare class AxisCoordinator {
29
+ private host;
30
+ constructor(host: AxisHost);
31
+ updateTooltipCategories(): void;
32
+ updateAxesDomains(): void;
33
+ private computeBubbleRadiusPadding;
34
+ renderAxes(): void;
35
+ private setupAxisLabelHover;
36
+ private hasSeriesForAxis;
37
+ }
38
+ export {};
package/dist/bio.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * KatuCharts — Bioinformatics charts plugin.
3
+ *
4
+ * Import this module to register all bioinformatics series types:
5
+ * import 'katucharts/bio';
6
+ *
7
+ * Or import named exports for manual control:
8
+ * import { registerBioSeriesTypes, VolcanoChart } from 'katucharts/bio';
9
+ */
10
+ export { registerBioSeriesTypes } from './core/registerBio';
11
+ export { VolcanoChart } from './series/bioinformatics/VolcanoChart';
12
+ export { ManhattanChart } from './series/bioinformatics/ManhattanChart';
13
+ export { ViolinChart } from './series/bioinformatics/ViolinChart';
14
+ export { KaplanMeierChart } from './series/bioinformatics/KaplanMeierChart';
15
+ export { ForestPlotChart } from './series/bioinformatics/ForestPlotChart';
16
+ export { SequenceLogoChart } from './series/bioinformatics/SequenceLogoChart';
17
+ export { ClusteredHeatmapChart } from './series/bioinformatics/ClusteredHeatmapChart';
18
+ export { PhyloTreeChart } from './series/bioinformatics/PhyloTreeChart';
19
+ export { CircosChart } from './series/bioinformatics/CircosChart';
20
+ export { CircosHeatmapChart } from './series/bioinformatics/circos/CircosHeatmapChart';
21
+ export { CircosComparativeChart } from './series/bioinformatics/circos/CircosComparativeChart';
22
+ export { CircosSpiralChart } from './series/bioinformatics/circos/CircosSpiralChart';
@@ -0,0 +1,38 @@
1
+ import { Selection } from 'd3-selection';
2
+ import type { CreditsOptions } from '../types/options';
3
+ export declare class Credits {
4
+ private element;
5
+ private observer;
6
+ private intervalId;
7
+ private svg;
8
+ private chartWidth;
9
+ private chartHeight;
10
+ private config;
11
+ private unsubscribe;
12
+ constructor(config: CreditsOptions, svg: Selection<SVGSVGElement, unknown, null, undefined>, chartWidth: number, chartHeight: number);
13
+ /**
14
+ * Renders or hides the credits to match the current license state.
15
+ */
16
+ private apply;
17
+ updatePosition(chartWidth: number, chartHeight: number): void;
18
+ private render;
19
+ /**
20
+ * Re-resolves the credit colour after the series have been painted, so it can
21
+ * account for chart shapes that end up behind it. Called once the plot is drawn.
22
+ */
23
+ refresh(): void;
24
+ /**
25
+ * Returns the fill of the topmost chart shape painted under the credit's
26
+ * centre, or null when the corner is empty (transparent background).
27
+ */
28
+ private resolveBehindColor;
29
+ /**
30
+ * Reads the first opaque background-color walking up from the SVG, which
31
+ * covers the common case of a transparent chart over a coloured page/card.
32
+ */
33
+ private resolvePageBackground;
34
+ private elementFill;
35
+ private startProtection;
36
+ private stopProtection;
37
+ destroy(): void;
38
+ }
@@ -0,0 +1,15 @@
1
+ import { Selection } from 'd3-selection';
2
+ import type { CrosshairOptions, PlotArea } from '../types/options';
3
+ import { EventBus } from '../core/EventBus';
4
+ export declare class Crosshair {
5
+ private xLine;
6
+ private yLine;
7
+ private xLabel;
8
+ private yLabel;
9
+ private plotArea;
10
+ constructor(xConfig: boolean | CrosshairOptions | undefined, yConfig: boolean | CrosshairOptions | undefined, plotGroup: Selection<SVGGElement, unknown, null, undefined>, plotArea: PlotArea, events: EventBus);
11
+ private getDashArray;
12
+ private createLabel;
13
+ private updateLabel;
14
+ destroy(): void;
15
+ }
@@ -0,0 +1,7 @@
1
+ import { Selection } from 'd3-selection';
2
+ import type { DataLabelOptions, PointOptions } from '../types/options';
3
+ import type { AxisInstance } from '../axis/Axis';
4
+ export declare class DataLabels {
5
+ static render(group: Selection<SVGGElement, unknown, null, undefined>, data: PointOptions[], config: DataLabelOptions, xAxis: AxisInstance, yAxis: AxisInstance, seriesName: string): void;
6
+ private static matchesFilter;
7
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Gear icon button with radial animated menu for chart export actions.
3
+ */
4
+ import { Selection } from 'd3-selection';
5
+ import type { ExportingOptions } from '../types/options';
6
+ export declare class ExportButton {
7
+ private group;
8
+ private gearGroup;
9
+ private radialContainer;
10
+ private isOpen;
11
+ private onExport;
12
+ private container;
13
+ private config;
14
+ private chartWidth;
15
+ private chartHeight;
16
+ private outsideClickHandler;
17
+ private scrollHandler;
18
+ private btnCenterX;
19
+ private btnCenterY;
20
+ constructor(config: ExportingOptions, svg: Selection<SVGSVGElement, unknown, null, undefined>, container: HTMLElement, chartWidth: number, chartHeight: number, onExport: (type: string) => void);
21
+ toggle(): void;
22
+ repositionCenter(cx: number, cy: number): void;
23
+ private openMenu;
24
+ private closeMenu;
25
+ updatePosition(chartWidth: number, chartHeight: number): void;
26
+ destroy(): void;
27
+ }
@@ -0,0 +1,53 @@
1
+ import { Selection } from 'd3-selection';
2
+ import type { LegendOptions } from '../types/options';
3
+ import { EventBus } from '../core/EventBus';
4
+ import type { BaseSeries } from '../series/BaseSeries';
5
+ export declare class Legend {
6
+ private config;
7
+ private group;
8
+ private events;
9
+ private series;
10
+ private scrollOffset;
11
+ private contentHeight;
12
+ private visibleHeight;
13
+ constructor(config: LegendOptions, svg: Selection<SVGSVGElement, unknown, null, undefined>, events: EventBus);
14
+ /** Readable legend text color when none is configured — adapts to the chart background. */
15
+ private autoText;
16
+ private resolveLabel;
17
+ private computeAutoFontSize;
18
+ private estimateTextWidth;
19
+ static computeGridLayout(itemCount: number, labels: string[], availWidth: number, config: {
20
+ symbolWidth: number;
21
+ symbolPadding: number;
22
+ fontSize: string;
23
+ itemDistance: number;
24
+ padding: number;
25
+ itemWidth?: number;
26
+ }): {
27
+ columns: number;
28
+ itemWidth: number;
29
+ };
30
+ render(series: BaseSeries[], layoutArea: {
31
+ x: number;
32
+ y: number;
33
+ width: number;
34
+ height: number;
35
+ }): void;
36
+ private renderNavigationArrows;
37
+ private applyScroll;
38
+ /**
39
+ * Draws the size-reference circles for a bubble series: nested circles sharing
40
+ * a common baseline, each with a connector line to its formatted z value. The
41
+ * radii come straight from the series' own size scale so the legend matches the
42
+ * rendered bubbles exactly.
43
+ */
44
+ private renderBubbleLegend;
45
+ /**
46
+ * Alternative bubble-legend layout: each size reference is its own circle with
47
+ * the value beside it, rather than nested concentric circles. Lays the items
48
+ * out as a vertical list for side legends and as a baseline-aligned row for
49
+ * bottom legends, so the size key reads cleanly in any placement.
50
+ */
51
+ private renderBubbleLegendSeparate;
52
+ destroy(): void;
53
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Renders the chart title and subtitle — as SVG `<text>` (with word wrapping)
3
+ * or, when `useHTML` is set, as absolutely-positioned HTML overlays. Extracted
4
+ * from `Chart` as pure functions over an explicit context so the rendering has
5
+ * no hidden dependency on chart internals.
6
+ */
7
+ import type { SVGRenderer } from '../core/SVGRenderer';
8
+ import type { LayoutResult } from '../layout/LayoutEngine';
9
+ import type { InternalConfig } from '../types/options';
10
+ type TitleGroup = ReturnType<SVGRenderer['createGroup']>;
11
+ export interface TitleRenderContext {
12
+ titleGroup: TitleGroup;
13
+ container: HTMLElement;
14
+ options: InternalConfig;
15
+ layout: LayoutResult;
16
+ chartWidth: number;
17
+ }
18
+ export declare function renderTitles(ctx: TitleRenderContext): void;
19
+ export {};
@@ -0,0 +1,61 @@
1
+ import type { TooltipOptions, PointOptions, PlotArea } from '../types/options';
2
+ import { EventBus } from '../core/EventBus';
3
+ export interface TooltipPointData {
4
+ point: PointOptions;
5
+ series: {
6
+ name?: string;
7
+ color?: string;
8
+ config?: any;
9
+ };
10
+ plotX: number;
11
+ plotY: number;
12
+ }
13
+ export declare class Tooltip {
14
+ private config;
15
+ private container;
16
+ private plotArea;
17
+ private element;
18
+ private splitElements;
19
+ private hideTimeout;
20
+ private categories;
21
+ private isDatetime;
22
+ private sharedPoints;
23
+ private sharedProvider;
24
+ private static readonly DEFAULT_DATE_FORMAT;
25
+ private lastMouseEvent;
26
+ private boundHandlers;
27
+ constructor(config: TooltipOptions, container: HTMLElement, plotArea: PlotArea, events: EventBus);
28
+ show(rawData: any): void;
29
+ hide(): void;
30
+ private scheduleHide;
31
+ private showSplit;
32
+ private hideSplitElements;
33
+ private createSplitElement;
34
+ private createElement;
35
+ private formatValue;
36
+ private resolveKey;
37
+ private getPointCategory;
38
+ private buildFormatterPoint;
39
+ private buildFormatterContext;
40
+ private formatContent;
41
+ private formatValueWith;
42
+ private formatSharedContent;
43
+ private position;
44
+ private positionAtMouse;
45
+ updatePlotArea(plotArea: PlotArea): void;
46
+ setCategories(categories: string[]): void;
47
+ setDatetimeAxis(isDatetime: boolean): void;
48
+ /**
49
+ * Supplies a resolver that returns every series' point at a given x, used to
50
+ * populate a shared tooltip with the whole column on a single hover.
51
+ */
52
+ setSharedPointsProvider(fn: ((x: number | string) => TooltipPointData[]) | null): void;
53
+ /**
54
+ * Resolves the tooltip header label for a point, applying category names and
55
+ * datetime formatting. On a datetime axis the raw timestamp is formatted with
56
+ * the series/global `xDateFormat`, falling back to a sensible default so the
57
+ * header never shows a bare epoch.
58
+ */
59
+ private formatXKey;
60
+ destroy(): void;
61
+ }
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Central chart orchestrator — owns container, SVG, and all subsystems.
3
+ */
4
+ import type { KatuChartsOptions, InternalConfig, SeriesOptions, AxisOptions } from '../types/options';
5
+ import { SVGRenderer } from './SVGRenderer';
6
+ import { EventBus } from './EventBus';
7
+ import { StateManager } from './StateManager';
8
+ import { type AxisInstance } from '../axis/Axis';
9
+ import { BaseSeries } from '../series/BaseSeries';
10
+ import 'd3-transition';
11
+ import type { ExportingOptions } from '../types/options';
12
+ export declare class Chart {
13
+ container: HTMLElement;
14
+ renderer: SVGRenderer;
15
+ events: EventBus;
16
+ state: StateManager;
17
+ options: InternalConfig;
18
+ private layoutEngine;
19
+ private layout;
20
+ private xAxes;
21
+ private yAxes;
22
+ private seriesInstances;
23
+ private plotGroup;
24
+ private axisGroup;
25
+ private seriesGroup;
26
+ private tooltip;
27
+ private legend;
28
+ private crosshair;
29
+ private credits;
30
+ private exportButton;
31
+ private responsiveEngine;
32
+ private interactions;
33
+ private stock;
34
+ private clipPathId;
35
+ private chartWidth;
36
+ private chartHeight;
37
+ private resizeObserver;
38
+ private titleGroup;
39
+ private stackLabelsGroup;
40
+ private originalUserOptions;
41
+ private isResponsiveUpdate;
42
+ constructor(containerOrId: string | HTMLElement, options: KatuChartsOptions);
43
+ private scrollableInner;
44
+ private scrollableOuterWidth;
45
+ private scrollableOuterHeight;
46
+ private useVerticalScroll;
47
+ private useHorizontalScroll;
48
+ private fixedAxisOverlay;
49
+ private exporter;
50
+ private axes;
51
+ private createFixedAxisOverlay;
52
+ private getDefaultHeightAspectRatio;
53
+ private resolveHeight;
54
+ private applyChartStyles;
55
+ private computeLayout;
56
+ private createStructuralGroups;
57
+ private renderTitles;
58
+ private buildAxes;
59
+ private buildSeries;
60
+ /**
61
+ * For a shared tooltip: returns the nearest point in every tracked, visible
62
+ * series at the given x, so a single hover renders the whole column. Series
63
+ * with mouse tracking disabled (e.g. indicator band fills) are excluded.
64
+ */
65
+ private collectSharedPointsAt;
66
+ private renderAll;
67
+ private formatStackLabel;
68
+ private renderStackLabels;
69
+ private raiseplotLineLabels;
70
+ private updateTooltipCategories;
71
+ private updateAxesDomains;
72
+ private renderAxes;
73
+ private renderSeriesInstances;
74
+ private renderLegend;
75
+ private setupReflow;
76
+ private fireEvent;
77
+ /**
78
+ * Plot geometry exposed for custom `chart.events.render` callbacks.
79
+ */
80
+ get plotLeft(): number;
81
+ get plotTop(): number;
82
+ get plotWidth(): number;
83
+ get plotHeight(): number;
84
+ get plotRenderer(): {
85
+ rect(x: number, y: number, w: number, h: number): any;
86
+ circle(cx: number, cy: number, r: number): any;
87
+ ellipse(cx: number, cy: number, rx: number, ry: number): any;
88
+ path(d: string): any;
89
+ line(x1: number, y1: number, x2: number, y2: number): any;
90
+ text(str: string, x: number, y: number): any;
91
+ group(className?: string): any;
92
+ readonly plotArea: {
93
+ x: number;
94
+ y: number;
95
+ width: number;
96
+ height: number;
97
+ };
98
+ readonly localPlotArea: {
99
+ x: number;
100
+ y: number;
101
+ width: number;
102
+ height: number;
103
+ };
104
+ xAxis: {
105
+ toPixels(val: number, axisIdx?: number): number;
106
+ };
107
+ yAxis: {
108
+ toPixels(val: number, axisIdx?: number): number;
109
+ };
110
+ };
111
+ private setupResponsive;
112
+ private applyInitialResponsiveRules;
113
+ addSeries(options: SeriesOptions, redraw?: boolean): BaseSeries;
114
+ get(id: string): BaseSeries | AxisInstance | undefined;
115
+ private canReuseSeriesInstances;
116
+ private syncSeriesInstances;
117
+ update(options: Partial<KatuChartsOptions>, redraw?: boolean): void;
118
+ animatedRedraw(duration?: number): void;
119
+ redraw(): void;
120
+ reflow(): void;
121
+ setSize(width: number, height: number): void;
122
+ /** The current visible outer size — the scrollable viewport for scrollable charts, else the chart. */
123
+ getViewportSize(): {
124
+ width: number;
125
+ height: number;
126
+ };
127
+ /**
128
+ * Resize the chart to a new outer viewport (used for fullscreen). For scrollable charts this also
129
+ * grows the scrollable viewport box so the chart fills the screen instead of staying clipped to its
130
+ * original box; the content fills the viewport and only scrolls if the configured minimums still
131
+ * exceed it. The pinned axis/legend overlay is rebuilt at the new size so its axes/legend track the
132
+ * viewport; the export button is preserved across that rebuild (see createFixedAxisOverlay).
133
+ */
134
+ fitToViewport(viewportWidth: number, viewportHeight: number): void;
135
+ setTitle(titleOptions: {
136
+ text?: string;
137
+ } | null, subtitleOptions?: {
138
+ text?: string;
139
+ } | null): void;
140
+ addAxis(options: AxisOptions, isX?: boolean, redraw?: boolean): AxisInstance;
141
+ showLoading(text?: string): void;
142
+ hideLoading(): void;
143
+ destroy(): void;
144
+ getSVG(): string;
145
+ getSeriesInstances(): BaseSeries[];
146
+ get series(): BaseSeries[];
147
+ getXAxes(): AxisInstance[];
148
+ getYAxes(): AxisInstance[];
149
+ private handleExportAction;
150
+ getCSV(): string;
151
+ getTable(): string;
152
+ getDataRows(): (string | number | null)[][];
153
+ exportChart(exportingOptions?: Partial<ExportingOptions>, _chartOptions?: Partial<KatuChartsOptions>): void;
154
+ print(): void;
155
+ private optionsToExternal;
156
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Central event system for KatuCharts.
3
+ */
4
+ type EventCallback = (...args: any[]) => void;
5
+ export declare class EventBus {
6
+ private listeners;
7
+ on(event: string, callback: EventCallback): this;
8
+ once(event: string, callback: EventCallback): this;
9
+ off(event: string, callback?: EventCallback): this;
10
+ emit(event: string, ...args: any[]): this;
11
+ removeAllListeners(): void;
12
+ static mapEvent(context: string, eventName: string): string;
13
+ }
14
+ export {};