@techie_doubts/tui.chart.2026 4.6.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 (284) hide show
  1. package/README.md +165 -0
  2. package/dist/esm/animator.d.ts +32 -0
  3. package/dist/esm/animator.js +102 -0
  4. package/dist/esm/brushes/axis.d.ts +3 -0
  5. package/dist/esm/brushes/axis.js +21 -0
  6. package/dist/esm/brushes/basic.d.ts +9 -0
  7. package/dist/esm/brushes/basic.js +95 -0
  8. package/dist/esm/brushes/boxPlot.d.ts +2 -0
  9. package/dist/esm/brushes/boxPlot.js +22 -0
  10. package/dist/esm/brushes/circleLegend.d.ts +2 -0
  11. package/dist/esm/brushes/circleLegend.js +26 -0
  12. package/dist/esm/brushes/dataLabel.d.ts +6 -0
  13. package/dist/esm/brushes/dataLabel.js +176 -0
  14. package/dist/esm/brushes/exportMenu.d.ts +2 -0
  15. package/dist/esm/brushes/exportMenu.js +55 -0
  16. package/dist/esm/brushes/gauge.d.ts +2 -0
  17. package/dist/esm/brushes/gauge.js +39 -0
  18. package/dist/esm/brushes/label.d.ts +34 -0
  19. package/dist/esm/brushes/label.js +165 -0
  20. package/dist/esm/brushes/legend.d.ts +7 -0
  21. package/dist/esm/brushes/legend.js +162 -0
  22. package/dist/esm/brushes/lineSeries.d.ts +5 -0
  23. package/dist/esm/brushes/lineSeries.js +41 -0
  24. package/dist/esm/brushes/polygon.d.ts +2 -0
  25. package/dist/esm/brushes/polygon.js +24 -0
  26. package/dist/esm/brushes/resetButton.d.ts +3 -0
  27. package/dist/esm/brushes/resetButton.js +112 -0
  28. package/dist/esm/brushes/scatterSeries.d.ts +2 -0
  29. package/dist/esm/brushes/scatterSeries.js +125 -0
  30. package/dist/esm/brushes/sector.d.ts +2 -0
  31. package/dist/esm/brushes/sector.js +54 -0
  32. package/dist/esm/brushes/spectrumLegend.d.ts +14 -0
  33. package/dist/esm/brushes/spectrumLegend.js +199 -0
  34. package/dist/esm/charts/areaChart.d.ts +254 -0
  35. package/dist/esm/charts/areaChart.js +358 -0
  36. package/dist/esm/charts/barChart.d.ts +203 -0
  37. package/dist/esm/charts/barChart.js +300 -0
  38. package/dist/esm/charts/boxPlotChart.d.ts +209 -0
  39. package/dist/esm/charts/boxPlotChart.js +288 -0
  40. package/dist/esm/charts/bubbleChart.d.ts +188 -0
  41. package/dist/esm/charts/bubbleChart.js +263 -0
  42. package/dist/esm/charts/bulletChart.d.ts +199 -0
  43. package/dist/esm/charts/bulletChart.js +278 -0
  44. package/dist/esm/charts/chart.d.ts +133 -0
  45. package/dist/esm/charts/chart.js +484 -0
  46. package/dist/esm/charts/columnChart.d.ts +205 -0
  47. package/dist/esm/charts/columnChart.js +299 -0
  48. package/dist/esm/charts/columnLineChart.d.ts +271 -0
  49. package/dist/esm/charts/columnLineChart.js +386 -0
  50. package/dist/esm/charts/gaugeChart.d.ts +191 -0
  51. package/dist/esm/charts/gaugeChart.js +279 -0
  52. package/dist/esm/charts/heatmapChart.d.ts +199 -0
  53. package/dist/esm/charts/heatmapChart.js +292 -0
  54. package/dist/esm/charts/lineAreaChart.d.ts +271 -0
  55. package/dist/esm/charts/lineAreaChart.js +374 -0
  56. package/dist/esm/charts/lineChart.d.ts +253 -0
  57. package/dist/esm/charts/lineChart.js +360 -0
  58. package/dist/esm/charts/lineScatterChart.d.ts +200 -0
  59. package/dist/esm/charts/lineScatterChart.js +285 -0
  60. package/dist/esm/charts/nestedPieChart.d.ts +192 -0
  61. package/dist/esm/charts/nestedPieChart.js +268 -0
  62. package/dist/esm/charts/pieChart.d.ts +156 -0
  63. package/dist/esm/charts/pieChart.js +224 -0
  64. package/dist/esm/charts/radarChart.d.ts +169 -0
  65. package/dist/esm/charts/radarChart.js +240 -0
  66. package/dist/esm/charts/radialBarChart.d.ts +172 -0
  67. package/dist/esm/charts/radialBarChart.js +251 -0
  68. package/dist/esm/charts/scatterChart.d.ts +184 -0
  69. package/dist/esm/charts/scatterChart.js +279 -0
  70. package/dist/esm/charts/treemapChart.d.ts +166 -0
  71. package/dist/esm/charts/treemapChart.js +239 -0
  72. package/dist/esm/component/areaSeries.d.ts +96 -0
  73. package/dist/esm/component/areaSeries.js +474 -0
  74. package/dist/esm/component/axis.d.ts +40 -0
  75. package/dist/esm/component/axis.js +176 -0
  76. package/dist/esm/component/axisTitle.d.ts +25 -0
  77. package/dist/esm/component/axisTitle.js +67 -0
  78. package/dist/esm/component/axisUsingCenterY.d.ts +32 -0
  79. package/dist/esm/component/axisUsingCenterY.js +175 -0
  80. package/dist/esm/component/backButton.d.ts +13 -0
  81. package/dist/esm/component/backButton.js +26 -0
  82. package/dist/esm/component/background.d.ts +10 -0
  83. package/dist/esm/component/background.js +15 -0
  84. package/dist/esm/component/boxPlotSeries.d.ts +126 -0
  85. package/dist/esm/component/boxPlotSeries.js +410 -0
  86. package/dist/esm/component/boxSeries.d.ts +211 -0
  87. package/dist/esm/component/boxSeries.js +603 -0
  88. package/dist/esm/component/boxStackSeries.d.ts +62 -0
  89. package/dist/esm/component/boxStackSeries.js +447 -0
  90. package/dist/esm/component/bubbleSeries.d.ts +35 -0
  91. package/dist/esm/component/bubbleSeries.js +174 -0
  92. package/dist/esm/component/bulletSeries.d.ts +89 -0
  93. package/dist/esm/component/bulletSeries.js +392 -0
  94. package/dist/esm/component/circleLegend.d.ts +10 -0
  95. package/dist/esm/component/circleLegend.js +37 -0
  96. package/dist/esm/component/component.d.ts +64 -0
  97. package/dist/esm/component/component.js +170 -0
  98. package/dist/esm/component/componentManager.d.ts +23 -0
  99. package/dist/esm/component/componentManager.js +45 -0
  100. package/dist/esm/component/dataLabels.d.ts +23 -0
  101. package/dist/esm/component/dataLabels.js +134 -0
  102. package/dist/esm/component/exportMenu.d.ts +38 -0
  103. package/dist/esm/component/exportMenu.js +147 -0
  104. package/dist/esm/component/gaugeSeries.d.ts +160 -0
  105. package/dist/esm/component/gaugeSeries.js +447 -0
  106. package/dist/esm/component/heatmapSeries.d.ts +64 -0
  107. package/dist/esm/component/heatmapSeries.js +152 -0
  108. package/dist/esm/component/hoveredSeries.d.ts +27 -0
  109. package/dist/esm/component/hoveredSeries.js +95 -0
  110. package/dist/esm/component/legend.d.ts +26 -0
  111. package/dist/esm/component/legend.js +149 -0
  112. package/dist/esm/component/lineSeries.d.ts +69 -0
  113. package/dist/esm/component/lineSeries.js +319 -0
  114. package/dist/esm/component/noDataText.d.ts +9 -0
  115. package/dist/esm/component/noDataText.js +31 -0
  116. package/dist/esm/component/pieSeries.d.ts +137 -0
  117. package/dist/esm/component/pieSeries.js +390 -0
  118. package/dist/esm/component/plot.d.ts +37 -0
  119. package/dist/esm/component/plot.js +163 -0
  120. package/dist/esm/component/radarSeries.d.ts +85 -0
  121. package/dist/esm/component/radarSeries.js +222 -0
  122. package/dist/esm/component/radialAxis.d.ts +26 -0
  123. package/dist/esm/component/radialAxis.js +210 -0
  124. package/dist/esm/component/radialBarSeries.d.ts +111 -0
  125. package/dist/esm/component/radialBarSeries.js +349 -0
  126. package/dist/esm/component/radialPlot.d.ts +55 -0
  127. package/dist/esm/component/radialPlot.js +188 -0
  128. package/dist/esm/component/rangeSelection.d.ts +61 -0
  129. package/dist/esm/component/rangeSelection.js +150 -0
  130. package/dist/esm/component/resetButton.d.ts +13 -0
  131. package/dist/esm/component/resetButton.js +26 -0
  132. package/dist/esm/component/scatterSeries.d.ts +34 -0
  133. package/dist/esm/component/scatterSeries.js +159 -0
  134. package/dist/esm/component/selectedSeries.d.ts +26 -0
  135. package/dist/esm/component/selectedSeries.js +109 -0
  136. package/dist/esm/component/spectrumLegend.d.ts +15 -0
  137. package/dist/esm/component/spectrumLegend.js +76 -0
  138. package/dist/esm/component/title.d.ts +12 -0
  139. package/dist/esm/component/title.js +53 -0
  140. package/dist/esm/component/tooltip.d.ts +41 -0
  141. package/dist/esm/component/tooltip.js +131 -0
  142. package/dist/esm/component/treemapSeries.d.ts +57 -0
  143. package/dist/esm/component/treemapSeries.js +191 -0
  144. package/dist/esm/component/zeroAxis.d.ts +9 -0
  145. package/dist/esm/component/zeroAxis.js +49 -0
  146. package/dist/esm/eventEmitter.d.ts +8 -0
  147. package/dist/esm/eventEmitter.js +15 -0
  148. package/dist/esm/helpers/arrayUtil.d.ts +10 -0
  149. package/dist/esm/helpers/arrayUtil.js +54 -0
  150. package/dist/esm/helpers/axes.d.ts +67 -0
  151. package/dist/esm/helpers/axes.js +345 -0
  152. package/dist/esm/helpers/boxSeries.d.ts +5 -0
  153. package/dist/esm/helpers/boxSeries.js +71 -0
  154. package/dist/esm/helpers/calculator.d.ts +19 -0
  155. package/dist/esm/helpers/calculator.js +153 -0
  156. package/dist/esm/helpers/color.d.ts +153 -0
  157. package/dist/esm/helpers/color.js +218 -0
  158. package/dist/esm/helpers/colorSpectrum.d.ts +5 -0
  159. package/dist/esm/helpers/colorSpectrum.js +17 -0
  160. package/dist/esm/helpers/coordinate.d.ts +9 -0
  161. package/dist/esm/helpers/coordinate.js +51 -0
  162. package/dist/esm/helpers/dataLabels.d.ts +36 -0
  163. package/dist/esm/helpers/dataLabels.js +405 -0
  164. package/dist/esm/helpers/dom.d.ts +2 -0
  165. package/dist/esm/helpers/dom.js +8 -0
  166. package/dist/esm/helpers/downloader.d.ts +7 -0
  167. package/dist/esm/helpers/downloader.js +287 -0
  168. package/dist/esm/helpers/formatDate.d.ts +16 -0
  169. package/dist/esm/helpers/formatDate.js +140 -0
  170. package/dist/esm/helpers/geometric.d.ts +3 -0
  171. package/dist/esm/helpers/geometric.js +35 -0
  172. package/dist/esm/helpers/googleAnalytics.d.ts +1 -0
  173. package/dist/esm/helpers/googleAnalytics.js +39 -0
  174. package/dist/esm/helpers/htmlSanitizer.d.ts +1 -0
  175. package/dist/esm/helpers/htmlSanitizer.js +86 -0
  176. package/dist/esm/helpers/legend.d.ts +9 -0
  177. package/dist/esm/helpers/legend.js +47 -0
  178. package/dist/esm/helpers/pieSeries.d.ts +15 -0
  179. package/dist/esm/helpers/pieSeries.js +72 -0
  180. package/dist/esm/helpers/plot.d.ts +2 -0
  181. package/dist/esm/helpers/plot.js +4 -0
  182. package/dist/esm/helpers/radarSeries.d.ts +1 -0
  183. package/dist/esm/helpers/radarSeries.js +7 -0
  184. package/dist/esm/helpers/range.d.ts +6 -0
  185. package/dist/esm/helpers/range.js +16 -0
  186. package/dist/esm/helpers/responders.d.ts +37 -0
  187. package/dist/esm/helpers/responders.js +197 -0
  188. package/dist/esm/helpers/sector.d.ts +55 -0
  189. package/dist/esm/helpers/sector.js +117 -0
  190. package/dist/esm/helpers/squarifier.d.ts +8 -0
  191. package/dist/esm/helpers/squarifier.js +110 -0
  192. package/dist/esm/helpers/style.d.ts +14 -0
  193. package/dist/esm/helpers/style.js +48 -0
  194. package/dist/esm/helpers/theme.d.ts +58 -0
  195. package/dist/esm/helpers/theme.js +557 -0
  196. package/dist/esm/helpers/tooltip.d.ts +2 -0
  197. package/dist/esm/helpers/tooltip.js +18 -0
  198. package/dist/esm/helpers/tooltipTemplate.d.ts +21 -0
  199. package/dist/esm/helpers/tooltipTemplate.js +147 -0
  200. package/dist/esm/helpers/utils.d.ts +42 -0
  201. package/dist/esm/helpers/utils.js +268 -0
  202. package/dist/esm/helpers/validation.d.ts +6 -0
  203. package/dist/esm/helpers/validation.js +16 -0
  204. package/dist/esm/index.d.ts +40 -0
  205. package/dist/esm/index.js +75 -0
  206. package/dist/esm/message.d.ts +11 -0
  207. package/dist/esm/message.js +11 -0
  208. package/dist/esm/painter.d.ts +27 -0
  209. package/dist/esm/painter.js +88 -0
  210. package/dist/esm/responderDetectors.d.ts +6 -0
  211. package/dist/esm/responderDetectors.js +124 -0
  212. package/dist/esm/scale/coordinateScaleCalculator.d.ts +24 -0
  213. package/dist/esm/scale/coordinateScaleCalculator.js +174 -0
  214. package/dist/esm/scale/datetimeScaleCalculator.d.ts +20 -0
  215. package/dist/esm/scale/datetimeScaleCalculator.js +59 -0
  216. package/dist/esm/store/axes.d.ts +30 -0
  217. package/dist/esm/store/axes.js +282 -0
  218. package/dist/esm/store/category.d.ts +4 -0
  219. package/dist/esm/store/category.js +73 -0
  220. package/dist/esm/store/colorValueScale.d.ts +3 -0
  221. package/dist/esm/store/colorValueScale.js +56 -0
  222. package/dist/esm/store/dataRange.d.ts +4 -0
  223. package/dist/esm/store/dataRange.js +170 -0
  224. package/dist/esm/store/gaugeAxes.d.ts +4 -0
  225. package/dist/esm/store/gaugeAxes.js +175 -0
  226. package/dist/esm/store/heatmapAxes.d.ts +3 -0
  227. package/dist/esm/store/heatmapAxes.js +98 -0
  228. package/dist/esm/store/heatmapSeriesData.d.ts +3 -0
  229. package/dist/esm/store/heatmapSeriesData.js +34 -0
  230. package/dist/esm/store/layout.d.ts +12 -0
  231. package/dist/esm/store/layout.js +487 -0
  232. package/dist/esm/store/legend.d.ts +3 -0
  233. package/dist/esm/store/legend.js +435 -0
  234. package/dist/esm/store/nestedPieSeriesData.d.ts +3 -0
  235. package/dist/esm/store/nestedPieSeriesData.js +49 -0
  236. package/dist/esm/store/options.d.ts +3 -0
  237. package/dist/esm/store/options.js +62 -0
  238. package/dist/esm/store/plot.d.ts +3 -0
  239. package/dist/esm/store/plot.js +102 -0
  240. package/dist/esm/store/radialAxes.d.ts +8 -0
  241. package/dist/esm/store/radialAxes.js +199 -0
  242. package/dist/esm/store/reactive.d.ts +11 -0
  243. package/dist/esm/store/reactive.js +196 -0
  244. package/dist/esm/store/root.d.ts +3 -0
  245. package/dist/esm/store/root.js +46 -0
  246. package/dist/esm/store/scale.d.ts +3 -0
  247. package/dist/esm/store/scale.js +102 -0
  248. package/dist/esm/store/seriesData.d.ts +3 -0
  249. package/dist/esm/store/seriesData.js +299 -0
  250. package/dist/esm/store/stackSeriesData.d.ts +8 -0
  251. package/dist/esm/store/stackSeriesData.js +192 -0
  252. package/dist/esm/store/store.d.ts +20 -0
  253. package/dist/esm/store/store.js +112 -0
  254. package/dist/esm/store/theme.d.ts +3 -0
  255. package/dist/esm/store/theme.js +139 -0
  256. package/dist/esm/store/treemapSeriesData.d.ts +4 -0
  257. package/dist/esm/store/treemapSeriesData.js +93 -0
  258. package/dist/td-chart.css +127 -0
  259. package/dist/td-chart.js +41463 -0
  260. package/dist/td-chart.min.css +6 -0
  261. package/dist/td-chart.min.js +9 -0
  262. package/package.json +112 -0
  263. package/types/brushes.d.ts +30 -0
  264. package/types/charts.d.ts +152 -0
  265. package/types/components/axis.d.ts +71 -0
  266. package/types/components/circleLegend.d.ts +9 -0
  267. package/types/components/dataLabels.d.ts +119 -0
  268. package/types/components/exportMenu.d.ts +14 -0
  269. package/types/components/legend.d.ts +27 -0
  270. package/types/components/plot.d.ts +8 -0
  271. package/types/components/radialAxis.d.ts +22 -0
  272. package/types/components/radialPlot.d.ts +11 -0
  273. package/types/components/rangeSelection.d.ts +3 -0
  274. package/types/components/resetButton.d.ts +13 -0
  275. package/types/components/series.d.ts +386 -0
  276. package/types/components/spectrumLegend.d.ts +25 -0
  277. package/types/components/tooltip.d.ts +58 -0
  278. package/types/components/zoom.d.ts +3 -0
  279. package/types/eventEmitter.d.ts +12 -0
  280. package/types/index.d.ts +615 -0
  281. package/types/options.d.ts +833 -0
  282. package/types/resizeObserver.d.ts +54 -0
  283. package/types/store/store.d.ts +564 -0
  284. package/types/theme.d.ts +670 -0
@@ -0,0 +1,199 @@
1
+ import { getInitAxisIntervalData, getMaxLabelSize, isLabelAxisOnYAxis, getDefaultRadialAxisData, getRadiusInfo, } from "../helpers/axes";
2
+ import { makeLabelsFromLimit, makeTickPixelPositions } from "../helpers/calculator";
3
+ import { getTitleFontString } from "../helpers/style";
4
+ import { DEGREE_360, DEGREE_0 } from "../helpers/sector";
5
+ const Y_LABEL_PADDING = 5;
6
+ export const RADIAL_LABEL_PADDING = 25;
7
+ export var RadialAxisType;
8
+ (function (RadialAxisType) {
9
+ RadialAxisType["CIRCULAR"] = "circularAxis";
10
+ RadialAxisType["VERTICAL"] = "verticalAxis";
11
+ })(RadialAxisType || (RadialAxisType = {}));
12
+ function getYAxisLabelAlign(clockwise = true, isLabelOnVerticalAxis = false) {
13
+ let align = 'center';
14
+ if (isLabelOnVerticalAxis) {
15
+ align = clockwise ? 'right' : 'left';
16
+ }
17
+ return align;
18
+ }
19
+ function getVerticalAxisData({ labels, pointOnColumn, intervalData, isLabelOnVerticalAxis, verticalAxisLabelMargin, verticalAxisLabelFont, defaultAxisData, radiusData, }) {
20
+ const { clockwise, axisSize, centerX, centerY, startAngle, endAngle } = defaultAxisData;
21
+ const { radiusRanges, innerRadius, outerRadius } = radiusData;
22
+ const { labelInterval } = intervalData;
23
+ /*
24
+ return {
25
+ labels,
26
+ tickDistance: (outerRadius - innerRadius) / labels.length,
27
+ ...pick(defaultAxisData, 'axisSize', 'centerX', 'centerY', 'startAngle', 'endAngle'),
28
+ pointOnColumn,
29
+ radiusRanges,
30
+ innerRadius,
31
+ outerRadius,
32
+ labelInterval,
33
+ labelMargin: verticalAxisLabelMargin,
34
+ labelAlign: getYAxisLabelAlign(clockwise, isLabelOnVerticalAxis),
35
+ ...getMaxLabelSize(labels, verticalAxisLabelMargin, verticalAxisLabelFont),
36
+ };
37
+ */
38
+ const { maxLabelWidth, maxLabelHeight } = getMaxLabelSize(labels, verticalAxisLabelMargin, verticalAxisLabelFont);
39
+ return {
40
+ axisSize,
41
+ centerX,
42
+ centerY,
43
+ label: {
44
+ labels,
45
+ interval: labelInterval,
46
+ margin: verticalAxisLabelMargin,
47
+ maxWidth: maxLabelWidth,
48
+ maxHeight: maxLabelHeight,
49
+ align: getYAxisLabelAlign(clockwise, isLabelOnVerticalAxis),
50
+ },
51
+ radius: {
52
+ inner: innerRadius,
53
+ outer: outerRadius,
54
+ ranges: radiusRanges,
55
+ },
56
+ angle: {
57
+ start: startAngle,
58
+ end: endAngle,
59
+ },
60
+ tickDistance: (outerRadius - innerRadius) / labels.length,
61
+ pointOnColumn,
62
+ };
63
+ }
64
+ function getCircularAxisData({ labels, intervalData, circularAxisLabelMargin, circularAxisLabelFont, defaultAxisData, radiusData, }) {
65
+ const { maxLabelWidth, maxLabelHeight } = getMaxLabelSize(labels, circularAxisLabelMargin, circularAxisLabelFont);
66
+ const { totalAngle, clockwise, axisSize, centerX, centerY, startAngle, endAngle, drawingStartAngle, } = defaultAxisData;
67
+ const { tickInterval, labelInterval } = intervalData;
68
+ const { innerRadius, outerRadius } = radiusData;
69
+ const centralAngle = totalAngle / (labels.length + (totalAngle < DEGREE_360 ? -1 : DEGREE_0));
70
+ /*
71
+ return {
72
+ labels,
73
+ ...defaultAxisData,
74
+ centralAngle,
75
+ tickInterval,
76
+ labelInterval,
77
+ labelMargin: circularAxisLabelMargin,
78
+ maxLabelWidth,
79
+ maxLabelHeight,
80
+ innerRadius,
81
+ outerRadius,
82
+ };
83
+ */
84
+ return {
85
+ axisSize,
86
+ centerX,
87
+ centerY,
88
+ label: {
89
+ labels,
90
+ interval: labelInterval,
91
+ margin: circularAxisLabelMargin,
92
+ maxWidth: maxLabelWidth,
93
+ maxHeight: maxLabelHeight,
94
+ },
95
+ radius: {
96
+ inner: innerRadius,
97
+ outer: outerRadius,
98
+ },
99
+ angle: {
100
+ start: startAngle,
101
+ end: endAngle,
102
+ total: totalAngle,
103
+ central: centralAngle,
104
+ drawingStart: drawingStartAngle,
105
+ },
106
+ tickInterval,
107
+ clockwise,
108
+ };
109
+ }
110
+ function makeLabels(options, rawLabels, axisName) {
111
+ var _a, _b, _c;
112
+ const formatter = (_c = (_b = (_a = options[axisName]) === null || _a === void 0 ? void 0 : _a.label) === null || _b === void 0 ? void 0 : _b.formatter, (_c !== null && _c !== void 0 ? _c : ((value) => value)));
113
+ return rawLabels.map((label, index) => formatter(label, { index, labels: rawLabels, axisName }));
114
+ }
115
+ function getAxisLabels(isLabelOnVerticalAxis, options, categories, scale) {
116
+ const valueAxisName = isLabelOnVerticalAxis
117
+ ? RadialAxisType.CIRCULAR
118
+ : RadialAxisType.VERTICAL;
119
+ const { limit, stepSize } = scale[valueAxisName];
120
+ const valueLabels = makeLabels(options, makeLabelsFromLimit(limit, stepSize), valueAxisName);
121
+ const categoryLabels = makeLabels(options, categories, isLabelOnVerticalAxis ? RadialAxisType.VERTICAL : RadialAxisType.CIRCULAR);
122
+ return {
123
+ radialAxisLabels: isLabelOnVerticalAxis ? valueLabels : categoryLabels,
124
+ yAxisLabels: isLabelOnVerticalAxis ? categoryLabels : valueLabels,
125
+ };
126
+ }
127
+ function getAxisLabelMargin(isLabelOnVerticalAxis, options) {
128
+ var _a, _b, _c, _d, _e, _f, _g, _h;
129
+ return {
130
+ verticalAxisLabelMargin: (_d = (_c = (_b = (_a = options) === null || _a === void 0 ? void 0 : _a.verticalAxis) === null || _b === void 0 ? void 0 : _b.label) === null || _c === void 0 ? void 0 : _c.margin, (_d !== null && _d !== void 0 ? _d : (isLabelOnVerticalAxis ? Y_LABEL_PADDING : 0))),
131
+ circularAxisLabelMargin: (_h = (_g = (_f = (_e = options) === null || _e === void 0 ? void 0 : _e.circularAxis) === null || _f === void 0 ? void 0 : _f.label) === null || _g === void 0 ? void 0 : _g.margin, (_h !== null && _h !== void 0 ? _h : RADIAL_LABEL_PADDING)),
132
+ };
133
+ }
134
+ const axes = {
135
+ name: 'radialAxes',
136
+ state: () => ({
137
+ radialAxes: {},
138
+ }),
139
+ action: {
140
+ setRadialAxesData({ state }) {
141
+ var _a, _b;
142
+ const { series, layout, scale } = state;
143
+ const categories = state.categories;
144
+ const { plot } = layout;
145
+ const isLabelOnVerticalAxis = isLabelAxisOnYAxis({ series, categories });
146
+ const options = state.options;
147
+ const theme = state.theme;
148
+ const circularAxisLabelFont = getTitleFontString(theme.circularAxis.label);
149
+ const verticalAxisLabelFont = getTitleFontString(theme.verticalAxis.label);
150
+ const { verticalAxisLabelMargin, circularAxisLabelMargin } = getAxisLabelMargin(isLabelOnVerticalAxis, options);
151
+ const { radialAxisLabels, yAxisLabels } = getAxisLabels(isLabelOnVerticalAxis, options, categories, scale);
152
+ const { maxLabelWidth, maxLabelHeight } = getMaxLabelSize(radialAxisLabels, circularAxisLabelMargin, circularAxisLabelFont);
153
+ const defaultAxisData = getDefaultRadialAxisData(options, plot, maxLabelWidth, maxLabelHeight + circularAxisLabelMargin, isLabelOnVerticalAxis);
154
+ const { axisSize } = defaultAxisData;
155
+ const radiusData = isLabelOnVerticalAxis
156
+ ? getRadiusInfo(axisSize, (_b = (_a = options) === null || _a === void 0 ? void 0 : _a.series) === null || _b === void 0 ? void 0 : _b.radiusRange, yAxisLabels.length + 1)
157
+ : {
158
+ radiusRanges: makeTickPixelPositions(axisSize, yAxisLabels.length),
159
+ innerRadius: 0,
160
+ outerRadius: axisSize,
161
+ };
162
+ const verticalAxisData = getVerticalAxisData({
163
+ labels: yAxisLabels,
164
+ pointOnColumn: isLabelOnVerticalAxis,
165
+ isLabelOnVerticalAxis,
166
+ intervalData: getInitAxisIntervalData(isLabelOnVerticalAxis, {
167
+ axis: options.verticalAxis,
168
+ categories,
169
+ layout,
170
+ }),
171
+ verticalAxisLabelMargin,
172
+ verticalAxisLabelFont,
173
+ defaultAxisData,
174
+ radiusData,
175
+ });
176
+ state.radialAxes = {
177
+ circularAxis: getCircularAxisData({
178
+ labels: radialAxisLabels,
179
+ intervalData: getInitAxisIntervalData(true, {
180
+ axis: options.circularAxis,
181
+ categories,
182
+ layout,
183
+ }),
184
+ defaultAxisData,
185
+ circularAxisLabelMargin,
186
+ circularAxisLabelFont,
187
+ radiusData,
188
+ }),
189
+ verticalAxis: verticalAxisData,
190
+ };
191
+ },
192
+ },
193
+ observe: {
194
+ updateRadialAxes() {
195
+ this.dispatch('setRadialAxesData');
196
+ },
197
+ },
198
+ };
199
+ export default axes;
@@ -0,0 +1,11 @@
1
+ export declare function observe(fn: Function): Function;
2
+ export declare function isObservable<T extends Record<string, any>>(target: T): boolean;
3
+ export declare function observable(target: Record<string, any>, source?: Record<string, any>): Record<string, any>;
4
+ export declare function setValue(target: Record<string, any>, key: string, source: any): Record<string, any>;
5
+ export declare function extend(target: Record<string, any>, source: Record<string, any>): Record<string, any>;
6
+ export declare function notify<T extends Record<string, any>, K extends keyof T>(target: T, key: K): void;
7
+ export declare function invisibleWork(fn: Function): void;
8
+ export declare function notifyByPath<T extends Record<string, any>>(holder: T, namePath: string): void;
9
+ export declare function computed(target: Record<string, any>, key: string, fn: Function): void;
10
+ export declare function watch(holder: Record<string, any>, path: string, fn: Function): Function | null;
11
+ export declare function makeObservableObjectToNormal(obj: any): any;
@@ -0,0 +1,196 @@
1
+ import { isNull, pickProperty } from "../helpers/utils";
2
+ import { message } from "../message";
3
+ let currentCollectorObserver = null;
4
+ let currentRunningObserver = null;
5
+ const observerCallCue = [];
6
+ let doingInvisibleWork = false;
7
+ export function observe(fn) {
8
+ const observer = () => {
9
+ if (currentRunningObserver === observer) {
10
+ return;
11
+ }
12
+ // If there is observer running or doing invisible work
13
+ if (doingInvisibleWork || !isNull(currentRunningObserver)) {
14
+ if (observerCallCue.includes(observer)) {
15
+ observerCallCue.splice(observerCallCue.indexOf(observer), 1);
16
+ }
17
+ // We use observer call cue because avoid nested observer call.
18
+ observerCallCue.push(observer);
19
+ // or If there are no observers running. Run the observer and run the next observer in the call queue.
20
+ }
21
+ else if (isNull(currentRunningObserver)) {
22
+ currentRunningObserver = observer;
23
+ fn();
24
+ currentRunningObserver = null;
25
+ digestObserverCallCue();
26
+ }
27
+ };
28
+ observer.deps = [];
29
+ // first observer excution for collect dependencies
30
+ currentCollectorObserver = observer;
31
+ currentCollectorObserver();
32
+ currentCollectorObserver = null;
33
+ return () => {
34
+ observer.deps.forEach((dep) => {
35
+ const index = dep.findIndex((ob) => ob === observer);
36
+ dep.splice(index, 1);
37
+ });
38
+ observer.deps = [];
39
+ };
40
+ }
41
+ function digestObserverCallCue() {
42
+ if (observerCallCue.length) {
43
+ const nextObserver = observerCallCue.shift();
44
+ if (nextObserver) {
45
+ nextObserver();
46
+ }
47
+ }
48
+ }
49
+ export function isObservable(target) {
50
+ return typeof target === 'object' && target.__toastUIChartOb__;
51
+ }
52
+ export function observable(target, source = target) {
53
+ if (isObservable(source)) {
54
+ throw new Error(message.ALREADY_OBSERVABLE_ERROR);
55
+ }
56
+ if (!isObservable(target)) {
57
+ Object.defineProperty(target, '__toastUIChartOb__', {
58
+ enumerable: false,
59
+ });
60
+ }
61
+ for (const key in source) {
62
+ if (!source.hasOwnProperty(key)) {
63
+ continue;
64
+ }
65
+ const obs = [];
66
+ let value = source[key];
67
+ const descriptor = Object.getOwnPropertyDescriptor(source, key);
68
+ const preGetter = descriptor && descriptor.get;
69
+ const preSetter = descriptor && descriptor.set;
70
+ /* eslint-disable no-loop-func */
71
+ Object.defineProperty(target, key, {
72
+ configurable: true,
73
+ enumerable: true,
74
+ get: function () {
75
+ // It's some kind a trick to get observable information from closure using getter for notify()
76
+ if (currentCollectorObserver === observableInfo) {
77
+ return { target, key, value, obs };
78
+ }
79
+ if (!doingInvisibleWork &&
80
+ currentCollectorObserver &&
81
+ !obs.includes(currentCollectorObserver)) {
82
+ // if there is collector observer in running, collect current data as dependency
83
+ obs.push(currentCollectorObserver);
84
+ currentCollectorObserver.deps.push(obs);
85
+ }
86
+ return value;
87
+ },
88
+ set: function (v) {
89
+ const prevValue = value;
90
+ if (preSetter) {
91
+ preSetter.call(target, v);
92
+ value = preGetter ? preGetter.call(target) : target[key];
93
+ }
94
+ else {
95
+ value = v;
96
+ }
97
+ if (prevValue !== value) {
98
+ // Run observers
99
+ invokeObs(obs);
100
+ }
101
+ },
102
+ });
103
+ if (typeof target[key] === 'object' && !Array.isArray(target[key])) {
104
+ observable(target[key]);
105
+ }
106
+ /* eslint-enable no-loop-func */
107
+ }
108
+ return target;
109
+ }
110
+ export function setValue(target, key, source) {
111
+ return observable(target, {
112
+ [key]: source,
113
+ });
114
+ }
115
+ export function extend(target, source) {
116
+ if (isObservable(source)) {
117
+ throw new Error(message.ALREADY_OBSERVABLE_ERROR);
118
+ }
119
+ return observable(target, source);
120
+ }
121
+ export function notify(target, key) {
122
+ const obInfo = observableInfo(target, key);
123
+ if (obInfo) {
124
+ invokeObs(obInfo.obs);
125
+ }
126
+ }
127
+ export function invisibleWork(fn) {
128
+ doingInvisibleWork = true;
129
+ fn();
130
+ doingInvisibleWork = false;
131
+ digestObserverCallCue();
132
+ }
133
+ export function notifyByPath(holder, namePath) {
134
+ const splited = namePath.split('.');
135
+ const key = splited.splice(splited.length - 1, 1)[0];
136
+ const target = pickProperty(holder, splited);
137
+ if (target) {
138
+ notify(target, key);
139
+ }
140
+ }
141
+ function invokeObs(obs) {
142
+ obs.forEach((ob) => ob());
143
+ }
144
+ function observableInfo(target, key) {
145
+ currentCollectorObserver = observableInfo;
146
+ const obInfo = target[key];
147
+ currentCollectorObserver = null;
148
+ if (typeof obInfo === 'object' &&
149
+ obInfo.hasOwnProperty('target') &&
150
+ obInfo.hasOwnProperty('obs')) {
151
+ return obInfo;
152
+ }
153
+ return null;
154
+ }
155
+ export function computed(target, key, fn) {
156
+ let cachedValue;
157
+ const computedBox = {};
158
+ Object.defineProperty(computedBox, key, {
159
+ configurable: true,
160
+ enumerable: true,
161
+ get: () => cachedValue,
162
+ });
163
+ extend(target, computedBox);
164
+ observe(() => {
165
+ const prevValue = cachedValue;
166
+ cachedValue = fn();
167
+ if (prevValue !== cachedValue) {
168
+ target[key] = cachedValue;
169
+ }
170
+ });
171
+ }
172
+ export function watch(holder, path, fn) {
173
+ const splited = path.split('.');
174
+ const key = splited.splice(splited.length - 1, 1)[0];
175
+ const target = pickProperty(holder, splited);
176
+ if (!target) {
177
+ return null;
178
+ }
179
+ const obInfo = observableInfo(target, key);
180
+ if (!obInfo) {
181
+ return null;
182
+ }
183
+ const watcher = () => {
184
+ fn(target[key]);
185
+ };
186
+ obInfo.obs.push(watcher);
187
+ return () => {
188
+ const index = obInfo.obs.findIndex((ob) => ob === watcher);
189
+ if (index > -1) {
190
+ obInfo.obs.splice(index, 1);
191
+ }
192
+ };
193
+ }
194
+ export function makeObservableObjectToNormal(obj) {
195
+ return JSON.parse(JSON.stringify(obj));
196
+ }
@@ -0,0 +1,3 @@
1
+ import { StoreModule } from "../../types/store/store";
2
+ declare const root: StoreModule;
3
+ export default root;
@@ -0,0 +1,46 @@
1
+ import { getInitialSize, isAutoValue } from "../helpers/utils";
2
+ function initialSize(containerEl, { width, height }) {
3
+ return {
4
+ width: width === 0 ? containerEl.offsetWidth : width,
5
+ height: height === 0 ? containerEl.offsetHeight : height,
6
+ };
7
+ }
8
+ const root = {
9
+ name: 'root',
10
+ state: ({ options }) => {
11
+ var _a, _b, _c, _d, _e, _f, _g, _h;
12
+ return ({
13
+ chart: Object.assign(Object.assign({}, options.chart), { width: getInitialSize((_b = (_a = options) === null || _a === void 0 ? void 0 : _a.chart) === null || _b === void 0 ? void 0 : _b.width), height: getInitialSize((_d = (_c = options) === null || _c === void 0 ? void 0 : _c.chart) === null || _d === void 0 ? void 0 : _d.height) }),
14
+ usingContainerSize: {
15
+ width: isAutoValue((_f = (_e = options) === null || _e === void 0 ? void 0 : _e.chart) === null || _f === void 0 ? void 0 : _f.width),
16
+ height: isAutoValue((_h = (_g = options) === null || _g === void 0 ? void 0 : _g.chart) === null || _h === void 0 ? void 0 : _h.height),
17
+ },
18
+ container: {},
19
+ });
20
+ },
21
+ action: {
22
+ setChartSize({ state }, size) {
23
+ state.chart.width = size.width;
24
+ state.chart.height = size.height;
25
+ this.notify(state, 'chart');
26
+ },
27
+ initChartSize({ state }, containerEl) {
28
+ const { width, height } = state.chart;
29
+ if (width === 0 || height === 0) {
30
+ if (containerEl.parentNode) {
31
+ this.dispatch('setChartSize', initialSize(containerEl, { width, height }));
32
+ }
33
+ else {
34
+ setTimeout(() => {
35
+ this.dispatch('setChartSize', initialSize(containerEl, { width, height }));
36
+ }, 0);
37
+ }
38
+ }
39
+ },
40
+ setUsingContainerSize({ state }, { width, height }) {
41
+ state.usingContainerSize.width = width;
42
+ state.usingContainerSize.height = height;
43
+ },
44
+ },
45
+ };
46
+ export default root;
@@ -0,0 +1,3 @@
1
+ import { StoreModule } from "../../types/store/store";
2
+ declare const scale: StoreModule;
3
+ export default scale;
@@ -0,0 +1,102 @@
1
+ import { getAxisName, getSizeKey, isLabelAxisOnYAxis, getYAxisOption, getValueAxisNames, isSeriesUsingRadialAxes, } from "../helpers/axes";
2
+ import { calculateCoordinateScale, calculateXAxisScaleForCoordinateLineType, getStackScaleData, } from "../scale/coordinateScaleCalculator";
3
+ import { calculateDatetimeScale } from "../scale/datetimeScaleCalculator";
4
+ import { isCoordinateSeries } from "../helpers/coordinate";
5
+ import { hasPercentStackSeries } from "./stackSeriesData";
6
+ import { isExist } from "../helpers/utils";
7
+ const MIN_OFFSET_SIZE = 1;
8
+ function getLabelScaleData(state, labelAxisOnYAxis, scaleOptions, labelAxisName) {
9
+ var _a, _b;
10
+ const { dataRange, layout, series, options } = state;
11
+ const categories = state.categories;
12
+ const rawCategories = state.rawCategories;
13
+ const { labelSizeKey } = getSizeKey(labelAxisOnYAxis);
14
+ const dateTypeLabel = isExist((_a = options.xAxis) === null || _a === void 0 ? void 0 : _a.date);
15
+ const labelOptions = {
16
+ dataRange: dataRange[labelAxisName],
17
+ offsetSize: Math.max(layout.plot[labelSizeKey], MIN_OFFSET_SIZE),
18
+ scaleOption: scaleOptions[labelAxisName],
19
+ rawCategoriesSize: rawCategories.length,
20
+ };
21
+ let result;
22
+ if (dataRange[labelAxisName]) {
23
+ result = dateTypeLabel
24
+ ? calculateDatetimeScale(labelOptions)
25
+ : calculateCoordinateScale(labelOptions);
26
+ }
27
+ if (series.line && categories && !((_b = options.xAxis) === null || _b === void 0 ? void 0 : _b.pointOnColumn)) {
28
+ result = calculateXAxisScaleForCoordinateLineType(result, options, categories);
29
+ }
30
+ return result;
31
+ }
32
+ function getValueScaleData(state, labelAxisOnYAxis, scaleOptions, valueAxisName, isCoordinateTypeChart) {
33
+ const { dataRange, layout, series, stackSeries } = state;
34
+ const { valueSizeKey } = getSizeKey(labelAxisOnYAxis);
35
+ let result;
36
+ if (hasPercentStackSeries(stackSeries)) {
37
+ Object.keys(series).forEach((seriesName) => {
38
+ result = getStackScaleData(stackSeries[seriesName].scaleType);
39
+ });
40
+ }
41
+ else if (isCoordinateTypeChart) {
42
+ const valueOptions = {
43
+ dataRange: dataRange[valueAxisName],
44
+ offsetSize: Math.max(layout.plot[valueSizeKey], MIN_OFFSET_SIZE),
45
+ scaleOption: scaleOptions[valueAxisName],
46
+ };
47
+ result = calculateCoordinateScale(valueOptions);
48
+ }
49
+ else {
50
+ result = calculateCoordinateScale({
51
+ dataRange: dataRange[valueAxisName],
52
+ offsetSize: Math.max(layout.plot[valueSizeKey], MIN_OFFSET_SIZE),
53
+ scaleOption: scaleOptions[valueAxisName],
54
+ });
55
+ }
56
+ return result;
57
+ }
58
+ function getScaleOptions(options, series, valueAxisName) {
59
+ var _a, _b, _c, _d, _e, _f;
60
+ const scaleOptions = {};
61
+ if (isSeriesUsingRadialAxes(series)) {
62
+ scaleOptions[valueAxisName] = (_b = (_a = options) === null || _a === void 0 ? void 0 : _a[valueAxisName]) === null || _b === void 0 ? void 0 : _b.scale;
63
+ }
64
+ else {
65
+ const { yAxis, secondaryYAxis } = getYAxisOption(options);
66
+ scaleOptions.xAxis = (_d = (_c = options) === null || _c === void 0 ? void 0 : _c.xAxis) === null || _d === void 0 ? void 0 : _d.scale;
67
+ scaleOptions.yAxis = (_e = yAxis) === null || _e === void 0 ? void 0 : _e.scale;
68
+ if (secondaryYAxis) {
69
+ scaleOptions.secondaryYAxis = (_f = secondaryYAxis) === null || _f === void 0 ? void 0 : _f.scale;
70
+ }
71
+ }
72
+ return scaleOptions;
73
+ }
74
+ const scale = {
75
+ name: 'scale',
76
+ state: () => ({
77
+ scale: {},
78
+ }),
79
+ action: {
80
+ setScale({ state, initStoreState }) {
81
+ const { series, options, categories } = state;
82
+ const labelAxisOnYAxis = isLabelAxisOnYAxis({ series, options, categories });
83
+ const { labelAxisName, valueAxisName } = getAxisName(labelAxisOnYAxis, series);
84
+ const scaleOptions = getScaleOptions(options, series, valueAxisName);
85
+ const isCoordinateTypeChart = isCoordinateSeries(initStoreState.series);
86
+ const scaleData = {};
87
+ getValueAxisNames(options, valueAxisName).forEach((axisName) => {
88
+ scaleData[axisName] = getValueScaleData(state, labelAxisOnYAxis, scaleOptions, axisName, isCoordinateTypeChart);
89
+ });
90
+ if (isCoordinateTypeChart) {
91
+ scaleData[labelAxisName] = getLabelScaleData(state, labelAxisOnYAxis, scaleOptions, labelAxisName);
92
+ }
93
+ state.scale = scaleData;
94
+ },
95
+ },
96
+ observe: {
97
+ updateScale() {
98
+ this.dispatch('setScale');
99
+ },
100
+ },
101
+ };
102
+ export default scale;
@@ -0,0 +1,3 @@
1
+ import { StoreModule } from "../../types/store/store";
2
+ declare const seriesData: StoreModule;
3
+ export default seriesData;