@gravity-ui/chartkit 5.17.1 → 5.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/build/components/ChartKit.css +0 -1
  2. package/build/components/SplitPane/Pane.d.ts +14 -0
  3. package/build/components/SplitPane/Pane.js +26 -0
  4. package/build/components/SplitPane/Resizer.d.ts +18 -0
  5. package/build/components/SplitPane/Resizer.js +26 -0
  6. package/build/components/SplitPane/SplitPane.d.ts +59 -0
  7. package/build/components/SplitPane/SplitPane.js +235 -0
  8. package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.css +0 -1
  9. package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.d.ts +1 -1
  10. package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.js +3 -3
  11. package/build/components/SplitPane/constants.d.ts +4 -0
  12. package/build/components/SplitPane/constants.js +4 -0
  13. package/build/components/SplitPane/index.d.ts +8 -0
  14. package/build/components/SplitPane/index.js +18 -0
  15. package/build/components/SplitPane/types.d.ts +2 -0
  16. package/build/constants/index.d.ts +1 -0
  17. package/build/constants/index.js +1 -0
  18. package/build/constants/misc.d.ts +10 -0
  19. package/build/constants/misc.js +19 -0
  20. package/build/hooks/index.d.ts +1 -0
  21. package/build/hooks/index.js +1 -0
  22. package/build/hooks/misc.d.ts +1 -0
  23. package/build/hooks/misc.js +8 -0
  24. package/build/plugins/d3/index.d.ts +1 -1
  25. package/build/plugins/d3/index.js +2 -1
  26. package/build/plugins/d3/renderer/D3Widget.d.ts +5 -1
  27. package/build/plugins/d3/renderer/D3Widget.js +31 -66
  28. package/build/plugins/d3/renderer/withSplitPane/TooltipContent.d.ts +8 -0
  29. package/build/plugins/d3/renderer/withSplitPane/TooltipContent.js +12 -0
  30. package/build/plugins/d3/renderer/withSplitPane/useWithSplitPaneState.d.ts +19 -0
  31. package/build/plugins/d3/renderer/withSplitPane/useWithSplitPaneState.js +46 -0
  32. package/build/plugins/d3/renderer/withSplitPane/withSplitPane.d.ts +4 -0
  33. package/build/plugins/d3/renderer/withSplitPane/withSplitPane.js +100 -0
  34. package/build/plugins/d3/types.d.ts +2 -2
  35. package/build/plugins/highcharts/renderer/HighchartsWidget.d.ts +2 -2
  36. package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.js +1 -1
  37. package/build/types/index.js +1 -0
  38. package/build/types/widget-data/pie.d.ts +1 -1
  39. package/build/types/widget.d.ts +6 -3
  40. package/build/utils/index.d.ts +1 -0
  41. package/build/utils/index.js +1 -0
  42. package/build/utils/misc.d.ts +2 -0
  43. package/build/utils/misc.js +7 -0
  44. package/package.json +4 -4
  45. package/build/plugins/d3/examples/ExampleWrapper.d.ts +0 -7
  46. package/build/plugins/d3/examples/ExampleWrapper.js +0 -5
  47. package/build/plugins/d3/examples/area/Basic.d.ts +0 -2
  48. package/build/plugins/d3/examples/area/Basic.js +0 -34
  49. package/build/plugins/d3/examples/area/NegativeValues.d.ts +0 -2
  50. package/build/plugins/d3/examples/area/NegativeValues.js +0 -24
  51. package/build/plugins/d3/examples/area/PercentStacking.d.ts +0 -2
  52. package/build/plugins/d3/examples/area/PercentStacking.js +0 -47
  53. package/build/plugins/d3/examples/area/StackedArea.d.ts +0 -2
  54. package/build/plugins/d3/examples/area/StackedArea.js +0 -47
  55. package/build/plugins/d3/examples/area/TwoYAxis.d.ts +0 -2
  56. package/build/plugins/d3/examples/area/TwoYAxis.js +0 -58
  57. package/build/plugins/d3/examples/bar-x/Basic.d.ts +0 -4
  58. package/build/plugins/d3/examples/bar-x/Basic.js +0 -88
  59. package/build/plugins/d3/examples/bar-x/DataLabels.d.ts +0 -2
  60. package/build/plugins/d3/examples/bar-x/DataLabels.js +0 -48
  61. package/build/plugins/d3/examples/bar-x/GroupedColumns.d.ts +0 -2
  62. package/build/plugins/d3/examples/bar-x/GroupedColumns.js +0 -48
  63. package/build/plugins/d3/examples/bar-x/NegativeValues.d.ts +0 -2
  64. package/build/plugins/d3/examples/bar-x/NegativeValues.js +0 -41
  65. package/build/plugins/d3/examples/bar-x/PercentStack.d.ts +0 -2
  66. package/build/plugins/d3/examples/bar-x/PercentStack.js +0 -47
  67. package/build/plugins/d3/examples/bar-x/StackedColumns.d.ts +0 -2
  68. package/build/plugins/d3/examples/bar-x/StackedColumns.js +0 -47
  69. package/build/plugins/d3/examples/bar-x/TwoYAxis.d.ts +0 -2
  70. package/build/plugins/d3/examples/bar-x/TwoYAxis.js +0 -58
  71. package/build/plugins/d3/examples/bar-y/Basic.d.ts +0 -2
  72. package/build/plugins/d3/examples/bar-y/Basic.js +0 -45
  73. package/build/plugins/d3/examples/bar-y/GroupedColumns.d.ts +0 -2
  74. package/build/plugins/d3/examples/bar-y/GroupedColumns.js +0 -50
  75. package/build/plugins/d3/examples/bar-y/NegativeValues.d.ts +0 -2
  76. package/build/plugins/d3/examples/bar-y/NegativeValues.js +0 -40
  77. package/build/plugins/d3/examples/bar-y/PercentStacking.d.ts +0 -2
  78. package/build/plugins/d3/examples/bar-y/PercentStacking.js +0 -49
  79. package/build/plugins/d3/examples/bar-y/StackedColumns.d.ts +0 -2
  80. package/build/plugins/d3/examples/bar-y/StackedColumns.js +0 -49
  81. package/build/plugins/d3/examples/combined/LineAndBarX.d.ts +0 -2
  82. package/build/plugins/d3/examples/combined/LineAndBarX.js +0 -63
  83. package/build/plugins/d3/examples/line/Basic.d.ts +0 -2
  84. package/build/plugins/d3/examples/line/Basic.js +0 -68
  85. package/build/plugins/d3/examples/line/DataLabels.d.ts +0 -2
  86. package/build/plugins/d3/examples/line/DataLabels.js +0 -91
  87. package/build/plugins/d3/examples/line/LineWithMarkers.d.ts +0 -2
  88. package/build/plugins/d3/examples/line/LineWithMarkers.js +0 -69
  89. package/build/plugins/d3/examples/line/LogarithmicAxis.d.ts +0 -2
  90. package/build/plugins/d3/examples/line/LogarithmicAxis.js +0 -38
  91. package/build/plugins/d3/examples/line/Shapes.d.ts +0 -2
  92. package/build/plugins/d3/examples/line/Shapes.js +0 -93
  93. package/build/plugins/d3/examples/line/TwoYAxis.d.ts +0 -2
  94. package/build/plugins/d3/examples/line/TwoYAxis.js +0 -58
  95. package/build/plugins/d3/examples/mars-weather.d.ts +0 -13
  96. package/build/plugins/d3/examples/mars-weather.js +0 -1203
  97. package/build/plugins/d3/examples/nintendoGames.d.ts +0 -92
  98. package/build/plugins/d3/examples/nintendoGames.js +0 -12264
  99. package/build/plugins/d3/examples/pie/Basic.d.ts +0 -2
  100. package/build/plugins/d3/examples/pie/Basic.js +0 -32
  101. package/build/plugins/d3/examples/pie/Donut.d.ts +0 -2
  102. package/build/plugins/d3/examples/pie/Donut.js +0 -33
  103. package/build/plugins/d3/examples/pie/DonutWithTotals.d.ts +0 -2
  104. package/build/plugins/d3/examples/pie/DonutWithTotals.js +0 -36
  105. package/build/plugins/d3/examples/scatter/Basic.d.ts +0 -2
  106. package/build/plugins/d3/examples/scatter/Basic.js +0 -47
  107. package/build/plugins/d3/examples/scatter/TwoYAxis.d.ts +0 -2
  108. package/build/plugins/d3/examples/scatter/TwoYAxis.js +0 -58
  109. package/build/plugins/d3/renderer/components/AxisX.d.ts +0 -19
  110. package/build/plugins/d3/renderer/components/AxisX.js +0 -108
  111. package/build/plugins/d3/renderer/components/AxisY.d.ts +0 -11
  112. package/build/plugins/d3/renderer/components/AxisY.js +0 -199
  113. package/build/plugins/d3/renderer/components/Chart.d.ts +0 -10
  114. package/build/plugins/d3/renderer/components/Chart.js +0 -145
  115. package/build/plugins/d3/renderer/components/Legend.d.ts +0 -12
  116. package/build/plugins/d3/renderer/components/Legend.js +0 -278
  117. package/build/plugins/d3/renderer/components/PlotTitle.d.ts +0 -7
  118. package/build/plugins/d3/renderer/components/PlotTitle.js +0 -12
  119. package/build/plugins/d3/renderer/components/Title.d.ts +0 -7
  120. package/build/plugins/d3/renderer/components/Title.js +0 -8
  121. package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.d.ts +0 -10
  122. package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.js +0 -102
  123. package/build/plugins/d3/renderer/components/Tooltip/index.d.ts +0 -12
  124. package/build/plugins/d3/renderer/components/Tooltip/index.js +0 -28
  125. package/build/plugins/d3/renderer/components/index.d.ts +0 -1
  126. package/build/plugins/d3/renderer/components/index.js +0 -1
  127. package/build/plugins/d3/renderer/components/styles.css +0 -140
  128. package/build/plugins/d3/renderer/constants/defaults/axis.d.ts +0 -14
  129. package/build/plugins/d3/renderer/constants/defaults/axis.js +0 -18
  130. package/build/plugins/d3/renderer/constants/defaults/index.d.ts +0 -3
  131. package/build/plugins/d3/renderer/constants/defaults/index.js +0 -3
  132. package/build/plugins/d3/renderer/constants/defaults/legend.d.ts +0 -12
  133. package/build/plugins/d3/renderer/constants/defaults/legend.js +0 -12
  134. package/build/plugins/d3/renderer/constants/defaults/series-options.d.ts +0 -24
  135. package/build/plugins/d3/renderer/constants/defaults/series-options.js +0 -106
  136. package/build/plugins/d3/renderer/constants/index.d.ts +0 -3
  137. package/build/plugins/d3/renderer/constants/index.js +0 -24
  138. package/build/plugins/d3/renderer/d3-dispatcher.d.ts +0 -1
  139. package/build/plugins/d3/renderer/d3-dispatcher.js +0 -4
  140. package/build/plugins/d3/renderer/hooks/index.d.ts +0 -10
  141. package/build/plugins/d3/renderer/hooks/index.js +0 -10
  142. package/build/plugins/d3/renderer/hooks/useAxisScales/index.d.ts +0 -25
  143. package/build/plugins/d3/renderer/hooks/useAxisScales/index.js +0 -183
  144. package/build/plugins/d3/renderer/hooks/useChartDimensions/index.d.ts +0 -16
  145. package/build/plugins/d3/renderer/hooks/useChartDimensions/index.js +0 -34
  146. package/build/plugins/d3/renderer/hooks/useChartDimensions/utils.d.ts +0 -10
  147. package/build/plugins/d3/renderer/hooks/useChartDimensions/utils.js +0 -32
  148. package/build/plugins/d3/renderer/hooks/useChartOptions/chart.d.ts +0 -6
  149. package/build/plugins/d3/renderer/hooks/useChartOptions/chart.js +0 -28
  150. package/build/plugins/d3/renderer/hooks/useChartOptions/index.d.ts +0 -7
  151. package/build/plugins/d3/renderer/hooks/useChartOptions/index.js +0 -21
  152. package/build/plugins/d3/renderer/hooks/useChartOptions/title.d.ts +0 -5
  153. package/build/plugins/d3/renderer/hooks/useChartOptions/title.js +0 -18
  154. package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.d.ts +0 -5
  155. package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.js +0 -5
  156. package/build/plugins/d3/renderer/hooks/useChartOptions/types.d.ts +0 -47
  157. package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.d.ts +0 -7
  158. package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.js +0 -114
  159. package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.d.ts +0 -7
  160. package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.js +0 -116
  161. package/build/plugins/d3/renderer/hooks/useSeries/constants.d.ts +0 -8
  162. package/build/plugins/d3/renderer/hooks/useSeries/constants.js +0 -19
  163. package/build/plugins/d3/renderer/hooks/useSeries/index.d.ts +0 -29
  164. package/build/plugins/d3/renderer/hooks/useSeries/index.js +0 -82
  165. package/build/plugins/d3/renderer/hooks/useSeries/prepare-area.d.ts +0 -19
  166. package/build/plugins/d3/renderer/hooks/useSeries/prepare-area.js +0 -63
  167. package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-x.d.ts +0 -10
  168. package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-x.js +0 -38
  169. package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-y.d.ts +0 -10
  170. package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-y.js +0 -49
  171. package/build/plugins/d3/renderer/hooks/useSeries/prepare-legend.d.ts +0 -27
  172. package/build/plugins/d3/renderer/hooks/useSeries/prepare-legend.js +0 -144
  173. package/build/plugins/d3/renderer/hooks/useSeries/prepare-line.d.ts +0 -22
  174. package/build/plugins/d3/renderer/hooks/useSeries/prepare-line.js +0 -82
  175. package/build/plugins/d3/renderer/hooks/useSeries/prepare-options.d.ts +0 -3
  176. package/build/plugins/d3/renderer/hooks/useSeries/prepare-options.js +0 -5
  177. package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.d.ts +0 -9
  178. package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.js +0 -62
  179. package/build/plugins/d3/renderer/hooks/useSeries/prepare-scatter.d.ts +0 -11
  180. package/build/plugins/d3/renderer/hooks/useSeries/prepare-scatter.js +0 -47
  181. package/build/plugins/d3/renderer/hooks/useSeries/prepare-treemap.d.ts +0 -11
  182. package/build/plugins/d3/renderer/hooks/useSeries/prepare-treemap.js +0 -38
  183. package/build/plugins/d3/renderer/hooks/useSeries/prepare-waterfall.d.ts +0 -10
  184. package/build/plugins/d3/renderer/hooks/useSeries/prepare-waterfall.js +0 -37
  185. package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.d.ts +0 -10
  186. package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.js +0 -65
  187. package/build/plugins/d3/renderer/hooks/useSeries/types.d.ts +0 -254
  188. package/build/plugins/d3/renderer/hooks/useSeries/types.js +0 -1
  189. package/build/plugins/d3/renderer/hooks/useSeries/utils.d.ts +0 -7
  190. package/build/plugins/d3/renderer/hooks/useSeries/utils.js +0 -33
  191. package/build/plugins/d3/renderer/hooks/useShapes/HtmlLayer.d.ts +0 -8
  192. package/build/plugins/d3/renderer/hooks/useShapes/HtmlLayer.js +0 -22
  193. package/build/plugins/d3/renderer/hooks/useShapes/area/index.d.ts +0 -12
  194. package/build/plugins/d3/renderer/hooks/useShapes/area/index.js +0 -144
  195. package/build/plugins/d3/renderer/hooks/useShapes/area/prepare-data.d.ts +0 -12
  196. package/build/plugins/d3/renderer/hooks/useShapes/area/prepare-data.js +0 -158
  197. package/build/plugins/d3/renderer/hooks/useShapes/area/types.d.ts +0 -28
  198. package/build/plugins/d3/renderer/hooks/useShapes/area/types.js +0 -1
  199. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/index.d.ts +0 -13
  200. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/index.js +0 -96
  201. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/prepare-data.d.ts +0 -13
  202. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/prepare-data.js +0 -160
  203. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/types.d.ts +0 -13
  204. package/build/plugins/d3/renderer/hooks/useShapes/bar-x/types.js +0 -1
  205. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/index.d.ts +0 -12
  206. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/index.js +0 -84
  207. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/prepare-data.d.ts +0 -12
  208. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/prepare-data.js +0 -169
  209. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/types.d.ts +0 -14
  210. package/build/plugins/d3/renderer/hooks/useShapes/bar-y/types.js +0 -1
  211. package/build/plugins/d3/renderer/hooks/useShapes/constants.d.ts +0 -3
  212. package/build/plugins/d3/renderer/hooks/useShapes/constants.js +0 -3
  213. package/build/plugins/d3/renderer/hooks/useShapes/index.d.ts +0 -33
  214. package/build/plugins/d3/renderer/hooks/useShapes/index.js +0 -153
  215. package/build/plugins/d3/renderer/hooks/useShapes/line/index.d.ts +0 -12
  216. package/build/plugins/d3/renderer/hooks/useShapes/line/index.js +0 -131
  217. package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.d.ts +0 -13
  218. package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.js +0 -91
  219. package/build/plugins/d3/renderer/hooks/useShapes/line/types.d.ts +0 -30
  220. package/build/plugins/d3/renderer/hooks/useShapes/line/types.js +0 -1
  221. package/build/plugins/d3/renderer/hooks/useShapes/marker.d.ts +0 -13
  222. package/build/plugins/d3/renderer/hooks/useShapes/marker.js +0 -76
  223. package/build/plugins/d3/renderer/hooks/useShapes/pie/index.d.ts +0 -13
  224. package/build/plugins/d3/renderer/hooks/useShapes/pie/index.js +0 -172
  225. package/build/plugins/d3/renderer/hooks/useShapes/pie/prepare-data.d.ts +0 -9
  226. package/build/plugins/d3/renderer/hooks/useShapes/pie/prepare-data.js +0 -186
  227. package/build/plugins/d3/renderer/hooks/useShapes/pie/types.d.ts +0 -42
  228. package/build/plugins/d3/renderer/hooks/useShapes/pie/types.js +0 -1
  229. package/build/plugins/d3/renderer/hooks/useShapes/pie/utils.d.ts +0 -4
  230. package/build/plugins/d3/renderer/hooks/useShapes/pie/utils.js +0 -15
  231. package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.d.ts +0 -12
  232. package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.js +0 -69
  233. package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.d.ts +0 -11
  234. package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.js +0 -31
  235. package/build/plugins/d3/renderer/hooks/useShapes/scatter/types.d.ts +0 -18
  236. package/build/plugins/d3/renderer/hooks/useShapes/scatter/types.js +0 -1
  237. package/build/plugins/d3/renderer/hooks/useShapes/styles.css +0 -36
  238. package/build/plugins/d3/renderer/hooks/useShapes/treemap/index.d.ts +0 -12
  239. package/build/plugins/d3/renderer/hooks/useShapes/treemap/index.js +0 -99
  240. package/build/plugins/d3/renderer/hooks/useShapes/treemap/prepare-data.d.ts +0 -7
  241. package/build/plugins/d3/renderer/hooks/useShapes/treemap/prepare-data.js +0 -114
  242. package/build/plugins/d3/renderer/hooks/useShapes/treemap/types.d.ts +0 -17
  243. package/build/plugins/d3/renderer/hooks/useShapes/treemap/types.js +0 -1
  244. package/build/plugins/d3/renderer/hooks/useShapes/utils.d.ts +0 -29
  245. package/build/plugins/d3/renderer/hooks/useShapes/utils.js +0 -53
  246. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/index.d.ts +0 -13
  247. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/index.js +0 -128
  248. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/prepare-data.d.ts +0 -12
  249. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/prepare-data.js +0 -133
  250. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/types.d.ts +0 -15
  251. package/build/plugins/d3/renderer/hooks/useShapes/waterfall/types.js +0 -1
  252. package/build/plugins/d3/renderer/hooks/useSplit/index.d.ts +0 -14
  253. package/build/plugins/d3/renderer/hooks/useSplit/index.js +0 -57
  254. package/build/plugins/d3/renderer/hooks/useSplit/types.d.ts +0 -17
  255. package/build/plugins/d3/renderer/hooks/useSplit/types.js +0 -1
  256. package/build/plugins/d3/renderer/hooks/useTooltip/index.d.ts +0 -13
  257. package/build/plugins/d3/renderer/hooks/useTooltip/index.js +0 -17
  258. package/build/plugins/d3/renderer/hooks/useTooltip/types.d.ts +0 -1
  259. package/build/plugins/d3/renderer/hooks/useTooltip/types.js +0 -1
  260. package/build/plugins/d3/renderer/types/index.d.ts +0 -24
  261. package/build/plugins/d3/renderer/types/index.js +0 -1
  262. package/build/plugins/d3/renderer/utils/axis-generators/bottom.d.ts +0 -24
  263. package/build/plugins/d3/renderer/utils/axis-generators/bottom.js +0 -126
  264. package/build/plugins/d3/renderer/utils/axis-generators/index.d.ts +0 -1
  265. package/build/plugins/d3/renderer/utils/axis-generators/index.js +0 -1
  266. package/build/plugins/d3/renderer/utils/axis.d.ts +0 -31
  267. package/build/plugins/d3/renderer/utils/axis.js +0 -71
  268. package/build/plugins/d3/renderer/utils/color.d.ts +0 -10
  269. package/build/plugins/d3/renderer/utils/color.js +0 -43
  270. package/build/plugins/d3/renderer/utils/get-closest-data.d.ts +0 -15
  271. package/build/plugins/d3/renderer/utils/get-closest-data.js +0 -172
  272. package/build/plugins/d3/renderer/utils/index.d.ts +0 -78
  273. package/build/plugins/d3/renderer/utils/index.js +0 -211
  274. package/build/plugins/d3/renderer/utils/labels.d.ts +0 -6
  275. package/build/plugins/d3/renderer/utils/labels.js +0 -44
  276. package/build/plugins/d3/renderer/utils/legend.d.ts +0 -8
  277. package/build/plugins/d3/renderer/utils/legend.js +0 -23
  278. package/build/plugins/d3/renderer/utils/math.d.ts +0 -25
  279. package/build/plugins/d3/renderer/utils/math.js +0 -51
  280. package/build/plugins/d3/renderer/utils/series/index.d.ts +0 -1
  281. package/build/plugins/d3/renderer/utils/series/index.js +0 -1
  282. package/build/plugins/d3/renderer/utils/series/waterfall.d.ts +0 -4
  283. package/build/plugins/d3/renderer/utils/series/waterfall.js +0 -25
  284. package/build/plugins/d3/renderer/utils/symbol.d.ts +0 -3
  285. package/build/plugins/d3/renderer/utils/symbol.js +0 -36
  286. package/build/plugins/d3/renderer/utils/text.d.ts +0 -29
  287. package/build/plugins/d3/renderer/utils/text.js +0 -139
  288. package/build/plugins/d3/renderer/utils/time.d.ts +0 -3
  289. package/build/plugins/d3/renderer/utils/time.js +0 -34
  290. package/build/plugins/d3/renderer/validation/__mocks__/index.d.ts +0 -3
  291. package/build/plugins/d3/renderer/validation/__mocks__/index.js +0 -44
  292. package/build/plugins/d3/renderer/validation/index.d.ts +0 -2
  293. package/build/plugins/d3/renderer/validation/index.js +0 -221
  294. package/build/plugins/d3/utils/index.d.ts +0 -4
  295. package/build/plugins/d3/utils/index.js +0 -4
  296. package/build/plugins/d3/utils/pie-center-text.d.ts +0 -7
  297. package/build/plugins/d3/utils/pie-center-text.js +0 -23
  298. /package/build/{plugins/d3/renderer/hooks/useChartOptions → components/SplitPane}/types.js +0 -0
@@ -1,81 +1,46 @@
1
1
  import React from 'react';
2
+ import { Chart } from '@gravity-ui/charts';
2
3
  import afterFrame from 'afterframe';
3
- import { select } from 'd3';
4
- import debounce from 'lodash/debounce';
5
- import { getRandomCKId, measurePerformance } from '../../../utils';
6
- import { Chart } from './components';
7
- import { validateData } from './validation';
4
+ import { settings } from '../../../libs';
5
+ import { measurePerformance } from '../../../utils';
6
+ import { withSplitPane } from './withSplitPane/withSplitPane';
7
+ const ChartWithSplitPane = withSplitPane(Chart);
8
8
  const D3Widget = React.forwardRef(function D3Widget(props, forwardedRef) {
9
- const { data, onLoad, onRender, onChartLoad } = props;
10
- const validatedData = React.useRef();
11
- const ref = React.useRef(null);
12
- const debounced = React.useRef();
13
- const [dimensions, setDimensions] = React.useState();
9
+ const { data, tooltip, onLoad, onRender, onChartLoad } = props;
10
+ const lang = settings.get('lang');
14
11
  const performanceMeasure = React.useRef(measurePerformance());
15
- const handleResize = React.useCallback(() => {
16
- var _a;
17
- const parentElement = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.parentElement;
18
- if (parentElement) {
19
- const { width, height } = parentElement.getBoundingClientRect();
20
- setDimensions({ width, height });
12
+ const chartRef = React.useRef(null);
13
+ const ChartComponent = (tooltip === null || tooltip === void 0 ? void 0 : tooltip.splitted) ? ChartWithSplitPane : Chart;
14
+ const handleResize = React.useCallback(({ dimensions }) => {
15
+ if (!dimensions) {
16
+ return;
21
17
  }
22
- }, []);
23
- const debuncedHandleResize = React.useMemo(() => {
24
- var _a;
25
- (_a = debounced.current) === null || _a === void 0 ? void 0 : _a.cancel();
26
- debounced.current = debounce(handleResize, 200);
27
- return debounced.current;
28
- }, [handleResize]);
18
+ if (!performanceMeasure.current) {
19
+ performanceMeasure.current = measurePerformance();
20
+ }
21
+ afterFrame(() => {
22
+ var _a;
23
+ const renderTime = (_a = performanceMeasure.current) === null || _a === void 0 ? void 0 : _a.end();
24
+ onRender === null || onRender === void 0 ? void 0 : onRender({
25
+ renderTime,
26
+ });
27
+ onLoad === null || onLoad === void 0 ? void 0 : onLoad({
28
+ widgetRendering: renderTime,
29
+ });
30
+ performanceMeasure.current = null;
31
+ });
32
+ }, [onRender, onLoad]);
29
33
  React.useImperativeHandle(forwardedRef, () => ({
30
34
  reflow() {
31
- debuncedHandleResize();
35
+ var _a;
36
+ (_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow();
32
37
  },
33
- }), [debuncedHandleResize]);
34
- React.useEffect(() => {
35
- const selection = select(window);
36
- // https://github.com/d3/d3-selection/blob/main/README.md#handling-events
37
- const eventName = `resize.${getRandomCKId()}`;
38
- selection.on(eventName, debuncedHandleResize);
39
- return () => {
40
- // https://d3js.org/d3-selection/events#selection_on
41
- selection.on(eventName, null);
42
- };
43
- }, [debuncedHandleResize]);
44
- React.useEffect(() => {
45
- // dimensions initialize
46
- debuncedHandleResize();
47
- }, [debuncedHandleResize]);
48
- if (validatedData.current !== data) {
49
- validateData(data);
50
- validatedData.current = data;
51
- }
38
+ }), []);
52
39
  React.useLayoutEffect(() => {
53
40
  if (onChartLoad) {
54
41
  onChartLoad({});
55
42
  }
56
43
  }, [onChartLoad]);
57
- React.useLayoutEffect(() => {
58
- if (dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) {
59
- if (!performanceMeasure.current) {
60
- performanceMeasure.current = measurePerformance();
61
- }
62
- afterFrame(() => {
63
- var _a;
64
- const renderTime = (_a = performanceMeasure.current) === null || _a === void 0 ? void 0 : _a.end();
65
- onRender === null || onRender === void 0 ? void 0 : onRender({
66
- renderTime,
67
- });
68
- onLoad === null || onLoad === void 0 ? void 0 : onLoad({
69
- widgetRendering: renderTime,
70
- });
71
- performanceMeasure.current = null;
72
- });
73
- }
74
- }, [data, onRender, onLoad, dimensions]);
75
- return (React.createElement("div", { ref: ref, style: {
76
- width: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) || '100%',
77
- height: (dimensions === null || dimensions === void 0 ? void 0 : dimensions.height) || '100%',
78
- position: 'relative',
79
- } }, (dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) && (dimensions === null || dimensions === void 0 ? void 0 : dimensions.height) && (React.createElement(Chart, { width: dimensions.width, height: dimensions.height, data: data }))));
44
+ return React.createElement(ChartComponent, { ref: chartRef, data: data, lang: lang, onResize: handleResize });
80
45
  });
81
46
  export default D3Widget;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { ChartTooltipContentProps } from '@gravity-ui/charts';
3
+ export type TooltipContentRef = {
4
+ redraw: (updates?: Omit<ChartTooltipContentProps, 'renderer'>) => void;
5
+ };
6
+ type TooltipContentProps = Pick<ChartTooltipContentProps, 'renderer'>;
7
+ export declare const TooltipContent: React.ForwardRefExoticComponent<TooltipContentProps & React.RefAttributes<TooltipContentRef>>;
8
+ export {};
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { ChartTooltipContent } from '@gravity-ui/charts';
3
+ export const TooltipContent = React.forwardRef(function TooltipContent(props, forwardedRef) {
4
+ const { renderer } = props;
5
+ const [tooltipProps, setTooltipProps] = React.useState();
6
+ React.useImperativeHandle(forwardedRef, () => ({
7
+ redraw(updates) {
8
+ setTooltipProps(updates);
9
+ },
10
+ }), []);
11
+ return React.createElement(ChartTooltipContent, Object.assign({}, tooltipProps, { renderer: renderer }));
12
+ });
@@ -0,0 +1,19 @@
1
+ import type { SplitLayoutType } from '../../../../components/SplitPane';
2
+ export declare const RESIZER_HEIGHT = 24;
3
+ type WithSplitPaneState = {
4
+ allowResize: boolean;
5
+ tooltipHeight: number;
6
+ setTooltipHeight: (value: number) => void;
7
+ split: SplitLayoutType;
8
+ setSplit: (value: SplitLayoutType) => void;
9
+ size: number | string;
10
+ setSize: (value: number | string) => void;
11
+ maxSize?: number;
12
+ minSize?: number;
13
+ };
14
+ type UseWithSplitPaneProps = {
15
+ container: HTMLDivElement | null;
16
+ };
17
+ export declare function getVerticalSize(): number;
18
+ export declare function useWithSplitPaneState(props: UseWithSplitPaneProps): WithSplitPaneState;
19
+ export {};
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { SplitLayout } from '../../../../components/SplitPane';
3
+ import { IS_WINDOW_AVAILABLE } from '../../../../constants';
4
+ const CHART_SECTION_PERCENTAGE = 0.6;
5
+ export const RESIZER_HEIGHT = 24;
6
+ function getInitialSplit() {
7
+ if (!IS_WINDOW_AVAILABLE) {
8
+ return SplitLayout.HORIZONTAL;
9
+ }
10
+ return window.innerWidth > window.innerHeight ? SplitLayout.VERTICAL : SplitLayout.HORIZONTAL;
11
+ }
12
+ export function getVerticalSize() {
13
+ return window.innerWidth * CHART_SECTION_PERCENTAGE;
14
+ }
15
+ function getInitialSize(split) {
16
+ const defaultSize = `calc(100% - ${RESIZER_HEIGHT}px)`;
17
+ if (!IS_WINDOW_AVAILABLE) {
18
+ return defaultSize;
19
+ }
20
+ return split === SplitLayout.VERTICAL ? getVerticalSize() : defaultSize;
21
+ }
22
+ export function useWithSplitPaneState(props) {
23
+ const { container } = props;
24
+ const [tooltipHeight, setTooltipHeight] = React.useState(0);
25
+ const [split, setSplit] = React.useState(getInitialSplit());
26
+ const [size, setSize] = React.useState(getInitialSize(split));
27
+ const allowResize = split === SplitLayout.HORIZONTAL;
28
+ let maxSize;
29
+ let minSize;
30
+ if (IS_WINDOW_AVAILABLE && container && split === SplitLayout.HORIZONTAL) {
31
+ const containerHeight = container.getBoundingClientRect().height;
32
+ maxSize = containerHeight - RESIZER_HEIGHT - tooltipHeight;
33
+ minSize = containerHeight / 3;
34
+ }
35
+ return {
36
+ allowResize,
37
+ maxSize,
38
+ minSize,
39
+ tooltipHeight,
40
+ setTooltipHeight,
41
+ split,
42
+ setSplit,
43
+ size,
44
+ setSize,
45
+ };
46
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { Chart } from '@gravity-ui/charts';
3
+ import type { ChartProps, ChartRef } from '@gravity-ui/charts';
4
+ export declare function withSplitPane(ChartComponent: typeof Chart): React.ForwardRefExoticComponent<ChartProps & React.RefAttributes<ChartRef>>;
@@ -0,0 +1,100 @@
1
+ import { __rest } from "tslib";
2
+ import React from 'react';
3
+ import { getComponentName, useResizeObserver } from '@gravity-ui/uikit';
4
+ import { SplitLayout, StyledSplitPane, mapScreenOrientationTypeToSplitLayout, } from '../../../../components/SplitPane';
5
+ import { IS_SCREEN_ORIENTATION_AVAILABLE, IS_WINDOW_AVAILABLE } from '../../../../constants';
6
+ import { usePrevious } from '../../../../hooks';
7
+ import { isScreenOrientationEventType } from '../../../../utils';
8
+ import { TooltipContent } from './TooltipContent';
9
+ import { RESIZER_HEIGHT, getVerticalSize, useWithSplitPaneState } from './useWithSplitPaneState';
10
+ export function withSplitPane(ChartComponent) {
11
+ const componentName = getComponentName(ChartComponent);
12
+ const component = React.forwardRef(function WithSplitPaneComponent(props, _ref) {
13
+ var _a;
14
+ const { data } = props, restProps = __rest(props, ["data"]);
15
+ const containerRef = React.useRef(null);
16
+ const tooltipContainerRef = React.useRef(null);
17
+ const chartRef = React.useRef(null);
18
+ const tooltipRef = React.useRef(null);
19
+ const { allowResize, minSize, maxSize, tooltipHeight, split, size, setTooltipHeight, setSplit, setSize, } = useWithSplitPaneState({
20
+ container: containerRef.current,
21
+ });
22
+ const prevTooltipHeight = usePrevious(tooltipHeight);
23
+ const prevSplit = usePrevious(split);
24
+ if (prevSplit && split !== prevSplit && split === SplitLayout.VERTICAL) {
25
+ setSize(getVerticalSize());
26
+ }
27
+ else if (split === SplitLayout.HORIZONTAL &&
28
+ containerRef.current &&
29
+ prevTooltipHeight === 0 &&
30
+ tooltipHeight !== prevTooltipHeight) {
31
+ const containerHeight = containerRef.current.getBoundingClientRect().height;
32
+ if (containerHeight - RESIZER_HEIGHT === size) {
33
+ setSize(containerHeight - RESIZER_HEIGHT - tooltipHeight);
34
+ (_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow();
35
+ }
36
+ }
37
+ const handleTooltipContentResize = React.useCallback(() => {
38
+ if (!tooltipContainerRef.current) {
39
+ return;
40
+ }
41
+ const nextTooltipHeight = tooltipContainerRef.current.getBoundingClientRect().height;
42
+ setTooltipHeight(nextTooltipHeight);
43
+ }, [setTooltipHeight]);
44
+ useResizeObserver({
45
+ ref: tooltipContainerRef,
46
+ onResize: handleTooltipContentResize,
47
+ });
48
+ const resultData = React.useMemo(() => {
49
+ var _a, _b, _c;
50
+ const userPointerMoveHandler = (_b = (_a = data.chart) === null || _a === void 0 ? void 0 : _a.events) === null || _b === void 0 ? void 0 : _b.pointermove;
51
+ const pointerMoveHandler = (pointerMoveData, event) => {
52
+ var _a;
53
+ (_a = tooltipRef.current) === null || _a === void 0 ? void 0 : _a.redraw(pointerMoveData);
54
+ userPointerMoveHandler === null || userPointerMoveHandler === void 0 ? void 0 : userPointerMoveHandler(pointerMoveData, event);
55
+ };
56
+ return Object.assign(Object.assign({}, data), { chart: Object.assign(Object.assign({}, data.chart), { events: Object.assign(Object.assign({}, (_c = data.chart) === null || _c === void 0 ? void 0 : _c.events), { pointermove: pointerMoveHandler }) }), tooltip: Object.assign(Object.assign({}, data.tooltip), { enabled: false }) });
57
+ }, [data]);
58
+ const handleOrientationChange = React.useCallback(() => {
59
+ const deviceWidth = window.innerWidth;
60
+ const deviceHeight = window.innerHeight;
61
+ const nextSplit = deviceWidth > deviceHeight ? SplitLayout.VERTICAL : SplitLayout.HORIZONTAL;
62
+ setSplit(nextSplit);
63
+ }, [setSplit]);
64
+ const handleScreenOrientationChange = React.useCallback((e) => {
65
+ const type = e.target && 'type' in e.target && e.target.type;
66
+ if (!isScreenOrientationEventType(type)) {
67
+ return;
68
+ }
69
+ setSplit(mapScreenOrientationTypeToSplitLayout(type));
70
+ }, [setSplit]);
71
+ const handleSizeChange = React.useCallback((nextSize) => {
72
+ var _a;
73
+ (_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow();
74
+ if (split === SplitLayout.HORIZONTAL) {
75
+ setSize(nextSize);
76
+ }
77
+ }, [split, setSize]);
78
+ React.useLayoutEffect(() => {
79
+ if (IS_SCREEN_ORIENTATION_AVAILABLE) {
80
+ screen.orientation.addEventListener('change', handleScreenOrientationChange);
81
+ }
82
+ else if (IS_WINDOW_AVAILABLE) {
83
+ window.addEventListener('orientationchange', handleOrientationChange);
84
+ }
85
+ return () => {
86
+ if (IS_SCREEN_ORIENTATION_AVAILABLE) {
87
+ screen.orientation.removeEventListener('change', handleScreenOrientationChange);
88
+ }
89
+ else if (IS_WINDOW_AVAILABLE) {
90
+ window.removeEventListener('orientationchange', handleOrientationChange);
91
+ }
92
+ };
93
+ }, [handleOrientationChange, handleScreenOrientationChange]);
94
+ return (React.createElement("div", { ref: containerRef, style: { position: 'relative', height: '100%' } },
95
+ React.createElement(StyledSplitPane, { allowResize: allowResize, maxSize: maxSize, minSize: minSize, size: size, split: split, onChange: handleSizeChange, paneOneRender: () => (React.createElement(ChartComponent, Object.assign({}, restProps, { ref: chartRef, data: resultData }))), paneTwoRender: () => (React.createElement("div", { ref: tooltipContainerRef },
96
+ React.createElement(TooltipContent, { ref: tooltipRef, renderer: resultData.tooltip.renderer }))) })));
97
+ });
98
+ component.displayName = `withSplitPane(${componentName})`;
99
+ return component;
100
+ }
@@ -1,4 +1,4 @@
1
- import type { ChartKitWidgetData } from '../../types/widget-data';
1
+ import type { ChartData } from '@gravity-ui/charts';
2
2
  export type D3WidgetData = {
3
- data: ChartKitWidgetData;
3
+ data: ChartData;
4
4
  };
@@ -15,8 +15,8 @@ declare const HighchartsWidget: React.ForwardRefExoticComponent<{
15
15
  hoistConfigError?: boolean | undefined;
16
16
  nonBodyScroll?: boolean | undefined;
17
17
  splitTooltip?: boolean | undefined;
18
- paneSplitOrientation?: import("react-split-pane").Split | undefined;
19
- onSplitPaneOrientationChange?: ((orientation: import("react-split-pane").Split) => void) | undefined;
18
+ paneSplitOrientation?: import("../../../components/SplitPane").SplitLayoutType | undefined;
19
+ onSplitPaneOrientationChange?: ((orientation: import("../../../components/SplitPane").SplitLayoutType) => void) | undefined;
20
20
  onChange?: ((data: {
21
21
  type: "PARAMS_CHANGED";
22
22
  data: {
@@ -2,10 +2,10 @@
2
2
  import React from 'react';
3
3
  import debounce from 'lodash/debounce';
4
4
  import get from 'lodash/get';
5
+ import { StyledSplitPane } from '../../../../../components/SplitPane';
5
6
  import { getRandomCKId } from '../../../../../utils';
6
7
  import { cn } from '../../../../../utils/cn';
7
8
  import { chartTypesWithoutCrosshair } from '../../helpers/config/config';
8
- import { StyledSplitPane } from '../StyledSplitPane/StyledSplitPane';
9
9
  import './WithSplitPane.css';
10
10
  const b = cn('with-split-pane');
11
11
  const PANE_RESIZER_HEIGHT = 24;
@@ -1 +1,2 @@
1
+ // TODO: remove in the next major. This types should be consumed directly from '@gravity-ui/charts'
1
2
  export * from './widget-data';
@@ -1,4 +1,4 @@
1
- import { BaseType } from 'd3';
1
+ import type { BaseType } from 'd3';
2
2
  import { SeriesType } from '../../constants';
3
3
  import type { BaseSeries, BaseSeriesData } from './base';
4
4
  import { ChartKitWidgetLegend, RectLegendSymbolOptions } from './legend';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { Split } from 'react-split-pane';
2
+ import type { SplitLayoutType } from '../components/SplitPane/types';
3
3
  import type { Highcharts, HighchartsWidgetData, StringParams } from '../plugins/highcharts/types';
4
4
  import type { IndicatorWidgetData } from '../plugins/indicator/types';
5
5
  import type { CustomTooltipProps, Yagr, YagrWidgetData } from '../plugins/yagr/types';
@@ -21,8 +21,8 @@ export interface ChartKitWidget {
21
21
  hoistConfigError?: boolean;
22
22
  nonBodyScroll?: boolean;
23
23
  splitTooltip?: boolean;
24
- paneSplitOrientation?: Split;
25
- onSplitPaneOrientationChange?: (orientation: Split) => void;
24
+ paneSplitOrientation?: SplitLayoutType;
25
+ onSplitPaneOrientationChange?: (orientation: SplitLayoutType) => void;
26
26
  onChange?: (data: {
27
27
  type: 'PARAMS_CHANGED';
28
28
  data: {
@@ -35,5 +35,8 @@ export interface ChartKitWidget {
35
35
  d3: {
36
36
  data: ChartKitWidgetData;
37
37
  widget: never;
38
+ tooltip?: {
39
+ splitted?: boolean;
40
+ };
38
41
  };
39
42
  }
@@ -1,3 +1,4 @@
1
1
  export { getRandomCKId, randomString } from './common';
2
2
  export { typedMemo } from './react';
3
3
  export * from './performance';
4
+ export * from './misc';
@@ -1,3 +1,4 @@
1
1
  export { getRandomCKId, randomString } from './common';
2
2
  export { typedMemo } from './react';
3
3
  export * from './performance';
4
+ export * from './misc';
@@ -0,0 +1,2 @@
1
+ import type { ScreenOrientationType } from '../constants';
2
+ export declare function isScreenOrientationEventType(value: unknown): value is ScreenOrientationType;
@@ -0,0 +1,7 @@
1
+ import { AVAILABLE_SCREEN_ORIENTATIONS } from '../constants';
2
+ export function isScreenOrientationEventType(value) {
3
+ if (typeof value !== 'string') {
4
+ return false;
5
+ }
6
+ return AVAILABLE_SCREEN_ORIENTATIONS.includes(value);
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/chartkit",
3
- "version": "5.17.1",
3
+ "version": "5.18.0",
4
4
  "description": "React component used to render charts based on any sources you need",
5
5
  "license": "MIT",
6
6
  "repository": "git@github.com:gravity-ui/ChartKit.git",
@@ -47,13 +47,12 @@
47
47
  ],
48
48
  "dependencies": {
49
49
  "@bem-react/classname": "^1.6.0",
50
+ "@gravity-ui/charts": "^0.4.0",
50
51
  "@gravity-ui/date-utils": "^2.1.0",
51
52
  "@gravity-ui/i18n": "^1.0.0",
52
53
  "@gravity-ui/yagr": "^4.3.4",
53
54
  "afterframe": "^1.0.2",
54
- "d3": "^7.8.5",
55
55
  "lodash": "^4.17.21",
56
- "react-split-pane": "^0.1.92",
57
56
  "tslib": "^2.6.2"
58
57
  },
59
58
  "devDependencies": {
@@ -64,7 +63,7 @@
64
63
  "@gravity-ui/prettier-config": "^1.1.0",
65
64
  "@gravity-ui/stylelint-config": "^4.0.1",
66
65
  "@gravity-ui/tsconfig": "^1.0.0",
67
- "@gravity-ui/uikit": "^6.0.0",
66
+ "@gravity-ui/uikit": "^6.35.2",
68
67
  "@jest/types": "^29.6.3",
69
68
  "@playwright/experimental-ct-react17": "^1.41.1",
70
69
  "@storybook/addon-actions": "^7.6.14",
@@ -84,6 +83,7 @@
84
83
  "@typescript-eslint/eslint-plugin": "^5.31.0",
85
84
  "cross-env": "^7.0.3",
86
85
  "css-loader": "^5.2.7",
86
+ "d3": "^7.9.0",
87
87
  "eslint": "^8.56.0",
88
88
  "gulp": "^4.0.2",
89
89
  "gulp-cli": "^2.3.0",
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- type Props = {
3
- children?: React.ReactNode;
4
- styles?: React.CSSProperties;
5
- };
6
- export declare const ExampleWrapper: (props: Props) => React.JSX.Element;
7
- export {};
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export const ExampleWrapper = (props) => {
3
- const styles = Object.assign({ height: 280 }, props.styles);
4
- return React.createElement("div", { style: styles }, props.children);
5
- };
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const Basic: () => React.JSX.Element;
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import { ChartKit } from '../../../../components/ChartKit';
3
- import { ExampleWrapper } from '../ExampleWrapper';
4
- import nintendoGames from '../nintendoGames';
5
- function prepareData() {
6
- const games = nintendoGames.filter((d) => {
7
- return d.date && d.user_score && d.genres.includes('Puzzle');
8
- });
9
- return [
10
- {
11
- name: 'User score',
12
- type: 'area',
13
- data: games.map((d) => {
14
- return {
15
- x: Number(d.date),
16
- y: Number(d.user_score),
17
- };
18
- }),
19
- },
20
- ];
21
- }
22
- export const Basic = () => {
23
- const series = prepareData();
24
- const widgetData = {
25
- series: {
26
- data: series,
27
- },
28
- xAxis: {
29
- type: 'datetime',
30
- },
31
- };
32
- return (React.createElement(ExampleWrapper, null,
33
- React.createElement(ChartKit, { type: "d3", data: widgetData })));
34
- };
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const NegativeValues: () => React.JSX.Element;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import { ChartKit } from '../../../../components/ChartKit';
3
- import { ExampleWrapper } from '../ExampleWrapper';
4
- export const NegativeValues = () => {
5
- const data = [
6
- { x: 0, y: 10 },
7
- { x: 1, y: 20 },
8
- { x: 2, y: -30 },
9
- { x: 3, y: 100 },
10
- ];
11
- const widgetData = {
12
- series: {
13
- data: [
14
- {
15
- type: 'area',
16
- data: data,
17
- name: 'Min temperature',
18
- },
19
- ],
20
- },
21
- };
22
- return (React.createElement(ExampleWrapper, null,
23
- React.createElement(ChartKit, { type: "d3", data: widgetData })));
24
- };
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const PercentStackingArea: () => React.JSX.Element;
@@ -1,47 +0,0 @@
1
- import React from 'react';
2
- import { groups } from 'd3';
3
- import { ChartKit } from '../../../../components/ChartKit';
4
- import { ExampleWrapper } from '../ExampleWrapper';
5
- import nintendoGames from '../nintendoGames';
6
- const years = Array.from(new Set(nintendoGames.map((d) => d.date ? String(new Date(d.date).getFullYear()) : 'unknown'))).sort();
7
- function prepareData() {
8
- const grouped = groups(nintendoGames, (d) => d.platform, (d) => (d.date ? String(new Date(d.date).getFullYear()) : 'unknown'));
9
- const series = grouped.map(([platform, gamesByYear]) => {
10
- const platformGames = Object.fromEntries(gamesByYear) || {};
11
- return {
12
- name: platform,
13
- data: years.reduce((acc, year) => {
14
- if (year in platformGames) {
15
- acc.push({
16
- x: year,
17
- y: platformGames[year].length,
18
- });
19
- }
20
- return acc;
21
- }, []),
22
- };
23
- });
24
- return { series };
25
- }
26
- export const PercentStackingArea = () => {
27
- const { series } = prepareData();
28
- const data = series.map((s) => {
29
- return {
30
- type: 'area',
31
- stacking: 'percent',
32
- name: s.name,
33
- data: s.data,
34
- };
35
- });
36
- const widgetData = {
37
- series: {
38
- data: data,
39
- },
40
- xAxis: {
41
- type: 'category',
42
- categories: years,
43
- },
44
- };
45
- return (React.createElement(ExampleWrapper, null,
46
- React.createElement(ChartKit, { type: "d3", data: widgetData })));
47
- };
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const StackedArea: () => React.JSX.Element;
@@ -1,47 +0,0 @@
1
- import React from 'react';
2
- import { groups } from 'd3';
3
- import { ChartKit } from '../../../../components/ChartKit';
4
- import { ExampleWrapper } from '../ExampleWrapper';
5
- import nintendoGames from '../nintendoGames';
6
- const years = Array.from(new Set(nintendoGames.map((d) => d.date ? String(new Date(d.date).getFullYear()) : 'unknown'))).sort();
7
- function prepareData() {
8
- const grouped = groups(nintendoGames, (d) => d.platform, (d) => (d.date ? String(new Date(d.date).getFullYear()) : 'unknown'));
9
- const series = grouped.map(([platform, gamesByYear]) => {
10
- const platformGames = Object.fromEntries(gamesByYear) || {};
11
- return {
12
- name: platform,
13
- data: years.reduce((acc, year) => {
14
- if (year in platformGames) {
15
- acc.push({
16
- x: year,
17
- y: platformGames[year].length,
18
- });
19
- }
20
- return acc;
21
- }, []),
22
- };
23
- });
24
- return { series };
25
- }
26
- export const StackedArea = () => {
27
- const { series } = prepareData();
28
- const data = series.map((s) => {
29
- return {
30
- type: 'area',
31
- stacking: 'normal',
32
- name: s.name,
33
- data: s.data,
34
- };
35
- });
36
- const widgetData = {
37
- series: {
38
- data: data,
39
- },
40
- xAxis: {
41
- type: 'category',
42
- categories: years,
43
- },
44
- };
45
- return (React.createElement(ExampleWrapper, null,
46
- React.createElement(ChartKit, { type: "d3", data: widgetData })));
47
- };
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const TwoYAxis: () => React.JSX.Element;