@d3plus/core 3.1.6 → 4.1.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 (579) hide show
  1. package/README.md +9924 -78528
  2. package/es/index.js +8 -0
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +54 -0
  5. package/es/internal.js.map +1 -0
  6. package/es/src/charts/AreaPlot/index.js +36 -0
  7. package/es/src/charts/AreaPlot/index.js.map +1 -0
  8. package/es/src/charts/BarChart/index.js +48 -0
  9. package/es/src/charts/BarChart/index.js.map +1 -0
  10. package/es/src/charts/BoxWhisker/index.js +52 -0
  11. package/es/src/charts/BoxWhisker/index.js.map +1 -0
  12. package/es/src/charts/BumpChart/index.js +81 -0
  13. package/es/src/charts/BumpChart/index.js.map +1 -0
  14. package/es/src/charts/Donut/index.js +42 -0
  15. package/es/src/charts/Donut/index.js.map +1 -0
  16. package/es/src/charts/Geomap/applyLayout.js +208 -0
  17. package/es/src/charts/Geomap/applyLayout.js.map +1 -0
  18. package/es/src/charts/Geomap/emit.js +169 -0
  19. package/es/src/charts/Geomap/emit.js.map +1 -0
  20. package/es/src/charts/Geomap/index.js +521 -0
  21. package/es/src/charts/Geomap/index.js.map +1 -0
  22. package/es/src/charts/LinePlot/index.js +32 -0
  23. package/es/src/charts/LinePlot/index.js.map +1 -0
  24. package/es/src/charts/Matrix/applyLayout.js +92 -0
  25. package/es/src/charts/Matrix/applyLayout.js.map +1 -0
  26. package/es/src/charts/Matrix/emit.js +44 -0
  27. package/es/src/charts/Matrix/emit.js.map +1 -0
  28. package/es/src/charts/Matrix/index.js +154 -0
  29. package/es/src/charts/Matrix/index.js.map +1 -0
  30. package/es/src/charts/Network/applyLayout.js +322 -0
  31. package/es/src/charts/Network/applyLayout.js.map +1 -0
  32. package/es/src/charts/Network/emit.js +273 -0
  33. package/es/src/charts/Network/emit.js.map +1 -0
  34. package/es/src/charts/Network/index.js +422 -0
  35. package/es/src/charts/Network/index.js.map +1 -0
  36. package/es/src/charts/Pack/applyLayout.js +46 -0
  37. package/es/src/charts/Pack/applyLayout.js.map +1 -0
  38. package/es/src/charts/Pack/emit.js +116 -0
  39. package/es/src/charts/Pack/emit.js.map +1 -0
  40. package/es/src/charts/Pack/index.js +194 -0
  41. package/es/src/charts/Pack/index.js.map +1 -0
  42. package/es/src/charts/Pack/recursionCircles.js +18 -0
  43. package/es/src/charts/Pack/recursionCircles.js.map +1 -0
  44. package/es/src/charts/Pie/applyLayout.js +44 -0
  45. package/es/src/charts/Pie/applyLayout.js.map +1 -0
  46. package/es/src/charts/Pie/emit.js +111 -0
  47. package/es/src/charts/Pie/emit.js.map +1 -0
  48. package/es/src/charts/Pie/index.js +134 -0
  49. package/es/src/charts/Pie/index.js.map +1 -0
  50. package/es/src/charts/Plot/draw.js +424 -0
  51. package/es/src/charts/Plot/draw.js.map +1 -0
  52. package/es/src/charts/Plot/index.js +827 -0
  53. package/es/src/charts/Plot/index.js.map +1 -0
  54. package/es/src/charts/Plot/labelPlacement.js +36 -0
  55. package/es/src/charts/Plot/labelPlacement.js.map +1 -0
  56. package/es/src/charts/Plot/pipeline.js +594 -0
  57. package/es/src/charts/Plot/pipeline.js.map +1 -0
  58. package/es/src/charts/Plot/pipelineDomains.js +254 -0
  59. package/es/src/charts/Plot/pipelineDomains.js.map +1 -0
  60. package/es/src/charts/Plot/pipelineLineLabels.js +210 -0
  61. package/es/src/charts/Plot/pipelineLineLabels.js.map +1 -0
  62. package/es/src/charts/Plot/shapeDefaults.js +189 -0
  63. package/es/src/charts/Plot/shapeDefaults.js.map +1 -0
  64. package/es/src/charts/Plot/stackHelpers.js +52 -0
  65. package/es/src/charts/Plot/stackHelpers.js.map +1 -0
  66. package/es/src/charts/Priestley/applyLayout.js +121 -0
  67. package/es/src/charts/Priestley/applyLayout.js.map +1 -0
  68. package/es/src/charts/Priestley/emit.js +129 -0
  69. package/es/src/charts/Priestley/emit.js.map +1 -0
  70. package/es/src/charts/Priestley/index.js +97 -0
  71. package/es/src/charts/Priestley/index.js.map +1 -0
  72. package/es/src/charts/Radar/applyLayout.js +326 -0
  73. package/es/src/charts/Radar/applyLayout.js.map +1 -0
  74. package/es/src/charts/Radar/emit.js +28 -0
  75. package/es/src/charts/Radar/emit.js.map +1 -0
  76. package/es/src/charts/Radar/index.js +98 -0
  77. package/es/src/charts/Radar/index.js.map +1 -0
  78. package/es/src/charts/RadialMatrix/applyLayout.js +132 -0
  79. package/es/src/charts/RadialMatrix/applyLayout.js.map +1 -0
  80. package/es/src/charts/RadialMatrix/emit.js +33 -0
  81. package/es/src/charts/RadialMatrix/emit.js.map +1 -0
  82. package/es/src/charts/RadialMatrix/index.js +144 -0
  83. package/es/src/charts/RadialMatrix/index.js.map +1 -0
  84. package/es/src/charts/Rings/applyLayout.js +508 -0
  85. package/es/src/charts/Rings/applyLayout.js.map +1 -0
  86. package/es/src/charts/Rings/emit.js +222 -0
  87. package/es/src/charts/Rings/emit.js.map +1 -0
  88. package/es/src/charts/Rings/index.js +245 -0
  89. package/es/src/charts/Rings/index.js.map +1 -0
  90. package/es/src/charts/Sankey/applyLayout.js +107 -0
  91. package/es/src/charts/Sankey/applyLayout.js.map +1 -0
  92. package/es/src/charts/Sankey/emit.js +134 -0
  93. package/es/src/charts/Sankey/emit.js.map +1 -0
  94. package/es/src/charts/Sankey/index.js +219 -0
  95. package/es/src/charts/Sankey/index.js.map +1 -0
  96. package/es/src/charts/StackedArea/index.js +27 -0
  97. package/es/src/charts/StackedArea/index.js.map +1 -0
  98. package/es/src/charts/Tree/applyLayout.js +233 -0
  99. package/es/src/charts/Tree/applyLayout.js.map +1 -0
  100. package/es/src/charts/Tree/emit.js +257 -0
  101. package/es/src/charts/Tree/emit.js.map +1 -0
  102. package/es/src/charts/Tree/index.js +105 -0
  103. package/es/src/charts/Tree/index.js.map +1 -0
  104. package/es/src/charts/Treemap/applyLayout.js +85 -0
  105. package/es/src/charts/Treemap/applyLayout.js.map +1 -0
  106. package/es/src/charts/Treemap/emit.js +141 -0
  107. package/es/src/charts/Treemap/emit.js.map +1 -0
  108. package/es/src/charts/Treemap/index.js +177 -0
  109. package/es/src/charts/Treemap/index.js.map +1 -0
  110. package/es/src/charts/Treemap/thresholdFunction.js +112 -0
  111. package/es/src/charts/Treemap/thresholdFunction.js.map +1 -0
  112. package/es/src/charts/definition/ChartDefinition.js +12 -0
  113. package/es/src/charts/definition/ChartDefinition.js.map +1 -0
  114. package/es/src/charts/definition/applyDefinition.js +107 -0
  115. package/es/src/charts/definition/applyDefinition.js.map +1 -0
  116. package/es/src/charts/definition/makeChart.js +153 -0
  117. package/es/src/charts/definition/makeChart.js.map +1 -0
  118. package/es/src/charts/drawSteps/zoomControls.js +231 -96
  119. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  120. package/es/src/charts/events/click.legend.js +2 -2
  121. package/es/src/charts/events/click.legend.js.map +1 -1
  122. package/es/src/charts/events/click.shape.js +5 -5
  123. package/es/src/charts/events/click.shape.js.map +1 -1
  124. package/es/src/charts/events/mouseenter.js +20 -1
  125. package/es/src/charts/events/mouseenter.js.map +1 -1
  126. package/es/src/charts/events/mouseleave.js +19 -4
  127. package/es/src/charts/events/mouseleave.js.map +1 -1
  128. package/es/src/charts/events/mousemove.legend.js +10 -10
  129. package/es/src/charts/events/mousemove.legend.js.map +1 -1
  130. package/es/src/charts/events/mousemove.shape.js +14 -8
  131. package/es/src/charts/events/mousemove.shape.js.map +1 -1
  132. package/es/src/charts/events/touchstart.body.js.map +1 -1
  133. package/es/src/charts/features/axes.js +432 -0
  134. package/es/src/charts/features/axes.js.map +1 -0
  135. package/es/src/charts/features/chartGeometry.js +66 -0
  136. package/es/src/charts/features/chartGeometry.js.map +1 -0
  137. package/es/src/charts/features/colorScaleBucket.js +92 -0
  138. package/es/src/charts/features/colorScaleBucket.js.map +1 -0
  139. package/es/src/charts/features/emitHelpers.js +217 -0
  140. package/es/src/charts/features/emitHelpers.js.map +1 -0
  141. package/es/src/charts/features/ensureZoomDom.js +71 -0
  142. package/es/src/charts/features/ensureZoomDom.js.map +1 -0
  143. package/es/src/charts/features/features.js +650 -0
  144. package/es/src/charts/features/features.js.map +1 -0
  145. package/es/src/charts/features/featuresLegend.js +180 -0
  146. package/es/src/charts/features/featuresLegend.js.map +1 -0
  147. package/es/src/charts/features/legendLabel.js +12 -0
  148. package/es/src/charts/features/legendLabel.js.map +1 -0
  149. package/es/src/charts/features/lineLabels.js +154 -0
  150. package/es/src/charts/features/lineLabels.js.map +1 -0
  151. package/es/src/charts/features/plotPaint.js +512 -0
  152. package/es/src/charts/features/plotPaint.js.map +1 -0
  153. package/es/src/charts/features/shapeEmit.js +273 -0
  154. package/es/src/charts/features/shapeEmit.js.map +1 -0
  155. package/es/src/charts/helpers/matrixData.js +3 -3
  156. package/es/src/charts/helpers/matrixData.js.map +1 -1
  157. package/es/src/charts/index.js +21 -21
  158. package/es/src/charts/index.js.map +1 -1
  159. package/es/src/charts/pipeline/resolveSpec.js +44 -0
  160. package/es/src/charts/pipeline/resolveSpec.js.map +1 -0
  161. package/es/src/charts/pipeline/runChartDraw.js +109 -0
  162. package/es/src/charts/pipeline/runChartDraw.js.map +1 -0
  163. package/es/src/charts/pipeline/runVizPipeline.js +84 -0
  164. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -0
  165. package/es/src/charts/pipeline/stages.js +103 -0
  166. package/es/src/charts/pipeline/stages.js.map +1 -0
  167. package/es/src/charts/pipeline/vizContext.js +29 -0
  168. package/es/src/charts/pipeline/vizContext.js.map +1 -0
  169. package/es/src/charts/pipeline/vizDraw.js +37 -0
  170. package/es/src/charts/pipeline/vizDraw.js.map +1 -0
  171. package/es/src/charts/pipeline/vizDrawPure.js +174 -0
  172. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -0
  173. package/es/src/charts/pipeline/vizPreDraw.js +145 -0
  174. package/es/src/charts/pipeline/vizPreDraw.js.map +1 -0
  175. package/es/src/charts/pipeline/vizPreDrawPure.js +279 -0
  176. package/es/src/charts/pipeline/vizPreDrawPure.js.map +1 -0
  177. package/es/src/charts/plotBuffers/Bar.js +4 -4
  178. package/es/src/charts/plotBuffers/Bar.js.map +1 -1
  179. package/es/src/charts/plotBuffers/Box.js +4 -4
  180. package/es/src/charts/plotBuffers/Box.js.map +1 -1
  181. package/es/src/charts/plotBuffers/Circle.js +2 -2
  182. package/es/src/charts/plotBuffers/Circle.js.map +1 -1
  183. package/es/src/charts/plotBuffers/Line.js +5 -5
  184. package/es/src/charts/plotBuffers/Line.js.map +1 -1
  185. package/es/src/charts/plotBuffers/Rect.js +2 -2
  186. package/es/src/charts/plotBuffers/Rect.js.map +1 -1
  187. package/es/src/charts/plotBuffers/discreteBuffer.js +1 -2
  188. package/es/src/charts/plotBuffers/discreteBuffer.js.map +1 -1
  189. package/es/src/charts/plotBuffers/numericBuffer.js +1 -2
  190. package/es/src/charts/plotBuffers/numericBuffer.js.map +1 -1
  191. package/es/src/charts/viz/Viz.js +985 -0
  192. package/es/src/charts/viz/Viz.js.map +1 -0
  193. package/es/src/charts/viz/VizBase.js +447 -0
  194. package/es/src/charts/viz/VizBase.js.map +1 -0
  195. package/es/src/charts/viz/VizBaseConfig.js +504 -0
  196. package/es/src/charts/viz/VizBaseConfig.js.map +1 -0
  197. package/es/src/charts/viz/interactionOpacity.js +247 -0
  198. package/es/src/charts/viz/interactionOpacity.js.map +1 -0
  199. package/es/src/charts/viz/ordinalColor.js +71 -0
  200. package/es/src/charts/viz/ordinalColor.js.map +1 -0
  201. package/es/src/charts/viz/trailCatchup.js +127 -0
  202. package/es/src/charts/viz/trailCatchup.js.map +1 -0
  203. package/es/src/charts/viz/vizDefaults.js +602 -0
  204. package/es/src/charts/viz/vizDefaults.js.map +1 -0
  205. package/es/src/charts/viz/vizRender.js +251 -0
  206. package/es/src/charts/viz/vizRender.js.map +1 -0
  207. package/es/src/charts/viz/vizTypes.js +28 -0
  208. package/es/src/charts/viz/vizTypes.js.map +1 -0
  209. package/es/src/components/Axis/Axis.js +691 -0
  210. package/es/src/components/Axis/Axis.js.map +1 -0
  211. package/es/src/components/Axis/AxisBottom.js.map +1 -0
  212. package/es/src/components/Axis/AxisLeft.js.map +1 -0
  213. package/es/src/components/Axis/AxisRight.js.map +1 -0
  214. package/es/src/components/Axis/AxisTop.js.map +1 -0
  215. package/es/src/components/Axis/axisLayout.js +208 -0
  216. package/es/src/components/Axis/axisLayout.js.map +1 -0
  217. package/es/src/components/Axis/axisLayoutLabels.js +177 -0
  218. package/es/src/components/Axis/axisLayoutLabels.js.map +1 -0
  219. package/es/src/components/Axis/axisLayoutScale.js +374 -0
  220. package/es/src/components/Axis/axisLayoutScale.js.map +1 -0
  221. package/es/src/components/Axis/axisRender.js +535 -0
  222. package/es/src/components/Axis/axisRender.js.map +1 -0
  223. package/es/src/components/ColorScale/ColorScale.js +506 -0
  224. package/es/src/components/ColorScale/ColorScale.js.map +1 -0
  225. package/es/src/components/ColorScale/colorScaleRender.js +277 -0
  226. package/es/src/components/ColorScale/colorScaleRender.js.map +1 -0
  227. package/es/src/components/ColorScale/colorScaleScale.js +274 -0
  228. package/es/src/components/ColorScale/colorScaleScale.js.map +1 -0
  229. package/es/src/components/Legend/Legend.js +445 -0
  230. package/es/src/components/Legend/Legend.js.map +1 -0
  231. package/es/src/components/Legend/legendConfig.js +87 -0
  232. package/es/src/components/Legend/legendConfig.js.map +1 -0
  233. package/es/src/components/Legend/legendRender.js +245 -0
  234. package/es/src/components/Legend/legendRender.js.map +1 -0
  235. package/es/src/components/Message.js.map +1 -1
  236. package/es/src/components/TextBox.js +655 -453
  237. package/es/src/components/TextBox.js.map +1 -1
  238. package/es/src/components/Timeline/Timeline.js +674 -0
  239. package/es/src/components/Timeline/Timeline.js.map +1 -0
  240. package/es/src/components/Timeline/timelineConfig.js +115 -0
  241. package/es/src/components/Timeline/timelineConfig.js.map +1 -0
  242. package/es/src/components/Timeline/timelineRender.js +267 -0
  243. package/es/src/components/Timeline/timelineRender.js.map +1 -0
  244. package/es/src/components/Tooltip.js +288 -249
  245. package/es/src/components/Tooltip.js.map +1 -1
  246. package/es/src/components/index.js +8 -8
  247. package/es/src/components/index.js.map +1 -1
  248. package/es/src/fluent.js +265 -0
  249. package/es/src/fluent.js.map +1 -0
  250. package/es/src/shapes/Area.js +96 -114
  251. package/es/src/shapes/Area.js.map +1 -1
  252. package/es/src/shapes/Bar.js +71 -86
  253. package/es/src/shapes/Bar.js.map +1 -1
  254. package/es/src/shapes/Box.js +295 -190
  255. package/es/src/shapes/Box.js.map +1 -1
  256. package/es/src/shapes/Circle.js +84 -35
  257. package/es/src/shapes/Circle.js.map +1 -1
  258. package/es/src/shapes/Image.js +164 -85
  259. package/es/src/shapes/Image.js.map +1 -1
  260. package/es/src/shapes/Line.js +51 -94
  261. package/es/src/shapes/Line.js.map +1 -1
  262. package/es/src/shapes/Path.js +33 -41
  263. package/es/src/shapes/Path.js.map +1 -1
  264. package/es/src/shapes/Rect.js +86 -37
  265. package/es/src/shapes/Rect.js.map +1 -1
  266. package/es/src/shapes/Shape.js +655 -678
  267. package/es/src/shapes/Shape.js.map +1 -1
  268. package/es/src/shapes/Whisker.js +156 -61
  269. package/es/src/shapes/Whisker.js.map +1 -1
  270. package/es/src/shapes/buildLabelData.js +125 -0
  271. package/es/src/shapes/buildLabelData.js.map +1 -0
  272. package/es/src/shapes/emitLabels.js +84 -0
  273. package/es/src/shapes/emitLabels.js.map +1 -0
  274. package/es/src/shapes/hitAreaNode.js +37 -0
  275. package/es/src/shapes/hitAreaNode.js.map +1 -0
  276. package/es/src/shapes/sceneSort.js +57 -0
  277. package/es/src/shapes/sceneSort.js.map +1 -0
  278. package/es/src/shapes/shapeConfig.js +31 -0
  279. package/es/src/shapes/shapeConfig.js.map +1 -0
  280. package/es/src/utils/BaseClass.js +35 -19
  281. package/es/src/utils/BaseClass.js.map +1 -1
  282. package/es/src/utils/D3Scale.js +16 -0
  283. package/es/src/utils/D3Scale.js.map +1 -0
  284. package/es/src/utils/D3plusConfig.js.map +1 -1
  285. package/es/src/utils/configPrep.js +8 -3
  286. package/es/src/utils/configPrep.js.map +1 -1
  287. package/es/src/utils/getProp.js +1 -1
  288. package/es/src/utils/getProp.js.map +1 -1
  289. package/es/src/utils/index.js +1 -0
  290. package/es/src/utils/index.js.map +1 -1
  291. package/es/src/utils/paintComponentScene.js +59 -0
  292. package/es/src/utils/paintComponentScene.js.map +1 -0
  293. package/es/umd-entry.js +16 -0
  294. package/es/umd-entry.js.map +1 -0
  295. package/package.json +15 -10
  296. package/types/index.d.ts +3 -1
  297. package/types/internal.d.ts +54 -0
  298. package/types/src/charts/AreaPlot/index.d.ts +10 -0
  299. package/types/src/charts/BarChart/index.d.ts +10 -0
  300. package/types/src/charts/BoxWhisker/index.d.ts +11 -0
  301. package/types/src/charts/BumpChart/index.d.ts +11 -0
  302. package/types/src/charts/ChartDefinition.d.ts +75 -0
  303. package/types/src/charts/Donut/index.d.ts +13 -0
  304. package/types/src/charts/Geomap/applyLayout.d.ts +7 -0
  305. package/types/src/charts/Geomap/emit.d.ts +7 -0
  306. package/types/src/charts/Geomap/index.d.ts +14 -0
  307. package/types/src/charts/Geomap.d.ts +6 -0
  308. package/types/src/charts/LinePlot/index.d.ts +10 -0
  309. package/types/src/charts/Matrix/applyLayout.d.ts +9 -0
  310. package/types/src/charts/Matrix/emit.d.ts +6 -0
  311. package/types/src/charts/Matrix/index.d.ts +14 -0
  312. package/types/src/charts/Matrix.d.ts +0 -26
  313. package/types/src/charts/Network/applyLayout.d.ts +10 -0
  314. package/types/src/charts/Network/emit.d.ts +6 -0
  315. package/types/src/charts/Network/index.d.ts +7 -0
  316. package/types/src/charts/Network.d.ts +0 -24
  317. package/types/src/charts/Pack/applyLayout.d.ts +16 -0
  318. package/types/src/charts/Pack/emit.d.ts +6 -0
  319. package/types/src/charts/Pack/index.d.ts +15 -0
  320. package/types/src/charts/Pack/recursionCircles.d.ts +7 -0
  321. package/types/src/charts/Pack.d.ts +0 -13
  322. package/types/src/charts/Pie/applyLayout.d.ts +8 -0
  323. package/types/src/charts/Pie/emit.d.ts +5 -0
  324. package/types/src/charts/Pie/index.d.ts +14 -0
  325. package/types/src/charts/Pie.d.ts +0 -27
  326. package/types/src/charts/Plot/draw.d.ts +2 -0
  327. package/types/src/charts/Plot/index.d.ts +167 -0
  328. package/types/src/charts/Plot/labelPlacement.d.ts +15 -0
  329. package/types/src/charts/Plot/pipeline.d.ts +70 -0
  330. package/types/src/charts/Plot/pipelineDomains.d.ts +2 -0
  331. package/types/src/charts/Plot/pipelineLineLabels.d.ts +2 -0
  332. package/types/src/charts/Plot/shapeDefaults.d.ts +64 -0
  333. package/types/src/charts/Plot/stackHelpers.d.ts +24 -0
  334. package/types/src/charts/Plot.d.ts +23 -72
  335. package/types/src/charts/Priestley/applyLayout.d.ts +21 -0
  336. package/types/src/charts/Priestley/emit.d.ts +6 -0
  337. package/types/src/charts/Priestley/index.d.ts +14 -0
  338. package/types/src/charts/Radar/applyLayout.d.ts +10 -0
  339. package/types/src/charts/Radar/emit.d.ts +7 -0
  340. package/types/src/charts/Radar/index.d.ts +14 -0
  341. package/types/src/charts/RadialMatrix/applyLayout.d.ts +11 -0
  342. package/types/src/charts/RadialMatrix/emit.d.ts +6 -0
  343. package/types/src/charts/RadialMatrix/index.d.ts +14 -0
  344. package/types/src/charts/RadialMatrix.d.ts +0 -15
  345. package/types/src/charts/Rings/applyLayout.d.ts +2 -0
  346. package/types/src/charts/Rings/emit.d.ts +7 -0
  347. package/types/src/charts/Rings/index.d.ts +15 -0
  348. package/types/src/charts/Rings.d.ts +0 -13
  349. package/types/src/charts/Sankey/applyLayout.d.ts +7 -0
  350. package/types/src/charts/Sankey/emit.d.ts +6 -0
  351. package/types/src/charts/Sankey/index.d.ts +7 -0
  352. package/types/src/charts/Sankey.d.ts +0 -4
  353. package/types/src/charts/StackedArea/index.d.ts +10 -0
  354. package/types/src/charts/Tree/applyLayout.d.ts +2 -0
  355. package/types/src/charts/Tree/emit.d.ts +7 -0
  356. package/types/src/charts/Tree/index.d.ts +14 -0
  357. package/types/src/charts/Tree.d.ts +0 -16
  358. package/types/src/charts/Treemap/applyLayout.d.ts +16 -0
  359. package/types/src/charts/Treemap/emit.d.ts +6 -0
  360. package/types/src/charts/Treemap/index.d.ts +18 -0
  361. package/types/src/charts/Treemap/thresholdFunction.d.ts +25 -0
  362. package/types/src/charts/Treemap.d.ts +4 -13
  363. package/types/src/charts/Viz.d.ts +49 -361
  364. package/types/src/charts/VizBase.d.ts +158 -0
  365. package/types/src/charts/VizBaseConfig.d.ts +148 -0
  366. package/types/src/charts/applyDefinition.d.ts +13 -0
  367. package/types/src/charts/axes.d.ts +134 -0
  368. package/types/src/charts/chartGeometry.d.ts +58 -0
  369. package/types/src/charts/definition/ChartDefinition.d.ts +84 -0
  370. package/types/src/charts/definition/applyDefinition.d.ts +13 -0
  371. package/types/src/charts/definition/makeChart.d.ts +22 -0
  372. package/types/src/charts/drawSteps/zoomControls.d.ts +25 -5
  373. package/types/src/charts/emitHelpers.d.ts +122 -0
  374. package/types/src/charts/ensureZoomDom.d.ts +39 -0
  375. package/types/src/charts/events/click.legend.d.ts +1 -1
  376. package/types/src/charts/events/click.shape.d.ts +1 -1
  377. package/types/src/charts/events/mouseenter.d.ts +1 -1
  378. package/types/src/charts/events/mouseleave.d.ts +1 -1
  379. package/types/src/charts/events/mousemove.legend.d.ts +1 -1
  380. package/types/src/charts/events/mousemove.shape.d.ts +1 -1
  381. package/types/src/charts/events/touchstart.body.d.ts +1 -1
  382. package/types/src/charts/factories.d.ts +73 -0
  383. package/types/src/charts/features/axes.d.ts +134 -0
  384. package/types/src/charts/features/chartGeometry.d.ts +58 -0
  385. package/types/src/charts/features/colorScaleBucket.d.ts +43 -0
  386. package/types/src/charts/features/colorScaleBucketShare.d.ts +16 -0
  387. package/types/src/charts/features/emitHelpers.d.ts +123 -0
  388. package/types/src/charts/features/ensureZoomDom.d.ts +39 -0
  389. package/types/src/charts/features/features.d.ts +152 -0
  390. package/types/src/charts/features/featuresLegend.d.ts +12 -0
  391. package/types/src/charts/features/legendLabel.d.ts +11 -0
  392. package/types/src/charts/features/lineLabels.d.ts +40 -0
  393. package/types/src/charts/features/plotPaint.d.ts +233 -0
  394. package/types/src/charts/features/shapeEmit.d.ts +61 -0
  395. package/types/src/charts/features.d.ts +152 -0
  396. package/types/src/charts/featuresLegend.d.ts +12 -0
  397. package/types/src/charts/helpers/matrixData.d.ts +1 -1
  398. package/types/src/charts/index.d.ts +21 -21
  399. package/types/src/charts/legendLabel.d.ts +11 -0
  400. package/types/src/charts/lineLabels.d.ts +40 -0
  401. package/types/src/charts/makeChart.d.ts +22 -0
  402. package/types/src/charts/pipeline/resolveSpec.d.ts +51 -0
  403. package/types/src/charts/pipeline/runChartDraw.d.ts +38 -0
  404. package/types/src/charts/pipeline/runVizPipeline.d.ts +31 -0
  405. package/types/src/charts/pipeline/stages.d.ts +160 -0
  406. package/types/src/charts/pipeline/vizContext.d.ts +45 -0
  407. package/types/src/charts/pipeline/vizDraw.d.ts +25 -0
  408. package/types/src/charts/pipeline/vizDrawPure.d.ts +46 -0
  409. package/types/src/charts/pipeline/vizPreDraw.d.ts +22 -0
  410. package/types/src/charts/pipeline/vizPreDrawPure.d.ts +68 -0
  411. package/types/src/charts/plotBuffers/Bar.d.ts +6 -5
  412. package/types/src/charts/plotBuffers/Box.d.ts +6 -5
  413. package/types/src/charts/plotBuffers/Circle.d.ts +6 -5
  414. package/types/src/charts/plotBuffers/Line.d.ts +6 -5
  415. package/types/src/charts/plotBuffers/Rect.d.ts +6 -5
  416. package/types/src/charts/plotBuffers/discreteBuffer.d.ts +2 -1
  417. package/types/src/charts/plotBuffers/numericBuffer.d.ts +2 -1
  418. package/types/src/charts/plotPaint.d.ts +233 -0
  419. package/types/src/charts/resolveSpec.d.ts +50 -0
  420. package/types/src/charts/runChartDraw.d.ts +38 -0
  421. package/types/src/charts/runVizPipeline.d.ts +31 -0
  422. package/types/src/charts/shapeEmit.d.ts +61 -0
  423. package/types/src/charts/stages.d.ts +117 -0
  424. package/types/src/charts/viz/Viz.d.ts +111 -0
  425. package/types/src/charts/viz/VizBase.d.ts +160 -0
  426. package/types/src/charts/viz/VizBaseConfig.d.ts +157 -0
  427. package/types/src/charts/viz/interactionOpacity.d.ts +23 -0
  428. package/types/src/charts/viz/ordinalColor.d.ts +14 -0
  429. package/types/src/charts/viz/trailCatchup.d.ts +14 -0
  430. package/types/src/charts/viz/vizDefaults.d.ts +8 -0
  431. package/types/src/charts/viz/vizRender.d.ts +8 -0
  432. package/types/src/charts/viz/vizTypes.d.ts +250 -0
  433. package/types/src/charts/vizContext.d.ts +46 -0
  434. package/types/src/charts/vizDefaults.d.ts +8 -0
  435. package/types/src/charts/vizDraw.d.ts +25 -0
  436. package/types/src/charts/vizDrawPure.d.ts +17 -0
  437. package/types/src/charts/vizPreDraw.d.ts +22 -0
  438. package/types/src/charts/vizPreDrawPure.d.ts +40 -0
  439. package/types/src/charts/vizRender.d.ts +8 -0
  440. package/types/src/charts/vizTypes.d.ts +202 -0
  441. package/types/src/components/Axis/Axis.d.ts +182 -0
  442. package/types/src/components/Axis/AxisBottom.d.ts +11 -0
  443. package/types/src/components/Axis/AxisLeft.d.ts +11 -0
  444. package/types/src/components/Axis/AxisRight.d.ts +11 -0
  445. package/types/src/components/Axis/AxisTop.d.ts +11 -0
  446. package/types/src/components/Axis/axisLayout.d.ts +29 -0
  447. package/types/src/components/Axis/axisLayoutLabels.d.ts +70 -0
  448. package/types/src/components/Axis/axisLayoutScale.d.ts +14 -0
  449. package/types/src/components/Axis/axisRender.d.ts +68 -0
  450. package/types/src/components/Axis.d.ts +68 -194
  451. package/types/src/components/ColorScale/ColorScale.d.ts +100 -0
  452. package/types/src/components/ColorScale/colorScaleRender.d.ts +15 -0
  453. package/types/src/components/ColorScale/colorScaleScale.d.ts +19 -0
  454. package/types/src/components/ColorScale.d.ts +1 -129
  455. package/types/src/components/Legend/Legend.d.ts +95 -0
  456. package/types/src/components/Legend/legendConfig.d.ts +7 -0
  457. package/types/src/components/Legend/legendRender.d.ts +16 -0
  458. package/types/src/components/Legend.d.ts +9 -73
  459. package/types/src/components/TextBox.d.ts +25 -218
  460. package/types/src/components/Timeline/Timeline.d.ts +118 -0
  461. package/types/src/components/Timeline/timelineConfig.d.ts +6 -0
  462. package/types/src/components/Timeline/timelineRender.d.ts +24 -0
  463. package/types/src/components/Timeline.d.ts +7 -81
  464. package/types/src/components/Tooltip.d.ts +20 -200
  465. package/types/src/components/axisLayout.d.ts +27 -0
  466. package/types/src/components/axisLayoutLabels.d.ts +42 -0
  467. package/types/src/components/axisLayoutScale.d.ts +12 -0
  468. package/types/src/components/axisRender.d.ts +65 -0
  469. package/types/src/components/colorScaleRender.d.ts +15 -0
  470. package/types/src/components/colorScaleScale.d.ts +19 -0
  471. package/types/src/components/index.d.ts +8 -8
  472. package/types/src/components/legendConfig.d.ts +7 -0
  473. package/types/src/components/legendRender.d.ts +16 -0
  474. package/types/src/components/timelineConfig.d.ts +6 -0
  475. package/types/src/components/timelineRender.d.ts +14 -0
  476. package/types/src/fluent.d.ts +94 -0
  477. package/types/src/shapes/Area.d.ts +15 -27
  478. package/types/src/shapes/Bar.d.ts +13 -33
  479. package/types/src/shapes/Box.d.ts +17 -56
  480. package/types/src/shapes/Circle.d.ts +11 -17
  481. package/types/src/shapes/Image.d.ts +18 -84
  482. package/types/src/shapes/Line.d.ts +12 -22
  483. package/types/src/shapes/Path.d.ts +12 -19
  484. package/types/src/shapes/Rect.d.ts +11 -27
  485. package/types/src/shapes/Shape.d.ts +46 -257
  486. package/types/src/shapes/Whisker.d.ts +15 -42
  487. package/types/src/shapes/buildLabelData.d.ts +50 -0
  488. package/types/src/shapes/emitLabels.d.ts +16 -0
  489. package/types/src/shapes/hitAreaNode.d.ts +19 -0
  490. package/types/src/shapes/sceneSort.d.ts +20 -0
  491. package/types/src/shapes/shapeConfig.d.ts +226 -0
  492. package/types/src/utils/BaseClass.d.ts +13 -7
  493. package/types/src/utils/D3Scale.d.ts +48 -0
  494. package/types/src/utils/D3plusConfig.d.ts +270 -15
  495. package/types/src/utils/configPrep.d.ts +7 -4
  496. package/types/src/utils/getProp.d.ts +3 -1
  497. package/types/src/utils/index.d.ts +3 -1
  498. package/types/src/utils/paintComponentScene.d.ts +28 -0
  499. package/types/umd-entry.d.ts +15 -0
  500. package/umd/d3plus-core.full.js +30966 -19051
  501. package/umd/d3plus-core.full.js.map +1 -1
  502. package/umd/d3plus-core.full.min.js +5400 -2949
  503. package/umd/d3plus-core.js +17364 -10534
  504. package/umd/d3plus-core.js.map +1 -1
  505. package/umd/d3plus-core.min.js +3494 -1877
  506. package/es/src/charts/AreaPlot.js +0 -85
  507. package/es/src/charts/AreaPlot.js.map +0 -1
  508. package/es/src/charts/BarChart.js +0 -92
  509. package/es/src/charts/BarChart.js.map +0 -1
  510. package/es/src/charts/BoxWhisker.js +0 -92
  511. package/es/src/charts/BoxWhisker.js.map +0 -1
  512. package/es/src/charts/BumpChart.js +0 -147
  513. package/es/src/charts/BumpChart.js.map +0 -1
  514. package/es/src/charts/Donut.js +0 -84
  515. package/es/src/charts/Donut.js.map +0 -1
  516. package/es/src/charts/Geomap.js +0 -766
  517. package/es/src/charts/Geomap.js.map +0 -1
  518. package/es/src/charts/LinePlot.js +0 -83
  519. package/es/src/charts/LinePlot.js.map +0 -1
  520. package/es/src/charts/Matrix.js +0 -341
  521. package/es/src/charts/Matrix.js.map +0 -1
  522. package/es/src/charts/Network.js +0 -796
  523. package/es/src/charts/Network.js.map +0 -1
  524. package/es/src/charts/Pack.js +0 -308
  525. package/es/src/charts/Pack.js.map +0 -1
  526. package/es/src/charts/Pie.js +0 -232
  527. package/es/src/charts/Pie.js.map +0 -1
  528. package/es/src/charts/Plot.js +0 -2114
  529. package/es/src/charts/Plot.js.map +0 -1
  530. package/es/src/charts/Priestley.js +0 -296
  531. package/es/src/charts/Priestley.js.map +0 -1
  532. package/es/src/charts/Radar.js +0 -420
  533. package/es/src/charts/Radar.js.map +0 -1
  534. package/es/src/charts/RadialMatrix.js +0 -383
  535. package/es/src/charts/RadialMatrix.js.map +0 -1
  536. package/es/src/charts/Rings.js +0 -788
  537. package/es/src/charts/Rings.js.map +0 -1
  538. package/es/src/charts/Sankey.js +0 -461
  539. package/es/src/charts/Sankey.js.map +0 -1
  540. package/es/src/charts/StackedArea.js +0 -80
  541. package/es/src/charts/StackedArea.js.map +0 -1
  542. package/es/src/charts/Tree.js +0 -347
  543. package/es/src/charts/Tree.js.map +0 -1
  544. package/es/src/charts/Treemap.js +0 -454
  545. package/es/src/charts/Treemap.js.map +0 -1
  546. package/es/src/charts/Viz.js +0 -1832
  547. package/es/src/charts/Viz.js.map +0 -1
  548. package/es/src/charts/drawSteps/drawAttribution.js +0 -16
  549. package/es/src/charts/drawSteps/drawAttribution.js.map +0 -1
  550. package/es/src/charts/drawSteps/drawBack.js +0 -24
  551. package/es/src/charts/drawSteps/drawBack.js.map +0 -1
  552. package/es/src/charts/drawSteps/drawColorScale.js +0 -75
  553. package/es/src/charts/drawSteps/drawColorScale.js.map +0 -1
  554. package/es/src/charts/drawSteps/drawLegend.js +0 -122
  555. package/es/src/charts/drawSteps/drawLegend.js.map +0 -1
  556. package/es/src/charts/drawSteps/drawSubtitle.js +0 -31
  557. package/es/src/charts/drawSteps/drawSubtitle.js.map +0 -1
  558. package/es/src/charts/drawSteps/drawTimeline.js +0 -85
  559. package/es/src/charts/drawSteps/drawTimeline.js.map +0 -1
  560. package/es/src/charts/drawSteps/drawTitle.js +0 -31
  561. package/es/src/charts/drawSteps/drawTitle.js.map +0 -1
  562. package/es/src/charts/drawSteps/drawTotal.js +0 -32
  563. package/es/src/charts/drawSteps/drawTotal.js.map +0 -1
  564. package/es/src/components/Axis.js +0 -1457
  565. package/es/src/components/Axis.js.map +0 -1
  566. package/es/src/components/AxisBottom.js.map +0 -1
  567. package/es/src/components/AxisLeft.js.map +0 -1
  568. package/es/src/components/AxisRight.js.map +0 -1
  569. package/es/src/components/AxisTop.js.map +0 -1
  570. package/es/src/components/ColorScale.js +0 -843
  571. package/es/src/components/ColorScale.js.map +0 -1
  572. package/es/src/components/Legend.js +0 -622
  573. package/es/src/components/Legend.js.map +0 -1
  574. package/es/src/components/Timeline.js +0 -695
  575. package/es/src/components/Timeline.js.map +0 -1
  576. /package/es/src/components/{AxisBottom.js → Axis/AxisBottom.js} +0 -0
  577. /package/es/src/components/{AxisLeft.js → Axis/AxisLeft.js} +0 -0
  578. /package/es/src/components/{AxisRight.js → Axis/AxisRight.js} +0 -0
  579. /package/es/src/components/{AxisTop.js → Axis/AxisTop.js} +0 -0
@@ -1,1457 +0,0 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _array_with_holes(arr) {
7
- if (Array.isArray(arr)) return arr;
8
- }
9
- function _array_without_holes(arr) {
10
- if (Array.isArray(arr)) return _array_like_to_array(arr);
11
- }
12
- function _assert_this_initialized(self) {
13
- if (self === void 0) {
14
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15
- }
16
- return self;
17
- }
18
- function _call_super(_this, derived, args) {
19
- derived = _get_prototype_of(derived);
20
- return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
21
- }
22
- function _class_call_check(instance, Constructor) {
23
- if (!(instance instanceof Constructor)) {
24
- throw new TypeError("Cannot call a class as a function");
25
- }
26
- }
27
- function _defineProperties(target, props) {
28
- for(var i = 0; i < props.length; i++){
29
- var descriptor = props[i];
30
- descriptor.enumerable = descriptor.enumerable || false;
31
- descriptor.configurable = true;
32
- if ("value" in descriptor) descriptor.writable = true;
33
- Object.defineProperty(target, descriptor.key, descriptor);
34
- }
35
- }
36
- function _create_class(Constructor, protoProps, staticProps) {
37
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
38
- if (staticProps) _defineProperties(Constructor, staticProps);
39
- return Constructor;
40
- }
41
- function _define_property(obj, key, value) {
42
- if (key in obj) {
43
- Object.defineProperty(obj, key, {
44
- value: value,
45
- enumerable: true,
46
- configurable: true,
47
- writable: true
48
- });
49
- } else {
50
- obj[key] = value;
51
- }
52
- return obj;
53
- }
54
- function _get_prototype_of(o) {
55
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
56
- return o.__proto__ || Object.getPrototypeOf(o);
57
- };
58
- return _get_prototype_of(o);
59
- }
60
- function _inherits(subClass, superClass) {
61
- if (typeof superClass !== "function" && superClass !== null) {
62
- throw new TypeError("Super expression must either be null or a function");
63
- }
64
- subClass.prototype = Object.create(superClass && superClass.prototype, {
65
- constructor: {
66
- value: subClass,
67
- writable: true,
68
- configurable: true
69
- }
70
- });
71
- if (superClass) _set_prototype_of(subClass, superClass);
72
- }
73
- function _instanceof(left, right) {
74
- "@swc/helpers - instanceof";
75
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
76
- return !!right[Symbol.hasInstance](left);
77
- } else {
78
- return left instanceof right;
79
- }
80
- }
81
- function _iterable_to_array(iter) {
82
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
83
- }
84
- function _iterable_to_array_limit(arr, i) {
85
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
86
- if (_i == null) return;
87
- var _arr = [];
88
- var _n = true;
89
- var _d = false;
90
- var _s, _e;
91
- try {
92
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
93
- _arr.push(_s.value);
94
- if (i && _arr.length === i) break;
95
- }
96
- } catch (err) {
97
- _d = true;
98
- _e = err;
99
- } finally{
100
- try {
101
- if (!_n && _i["return"] != null) _i["return"]();
102
- } finally{
103
- if (_d) throw _e;
104
- }
105
- }
106
- return _arr;
107
- }
108
- function _non_iterable_rest() {
109
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
110
- }
111
- function _non_iterable_spread() {
112
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
113
- }
114
- function _possible_constructor_return(self, call) {
115
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
116
- return call;
117
- }
118
- return _assert_this_initialized(self);
119
- }
120
- function _set_prototype_of(o, p) {
121
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
122
- o.__proto__ = p;
123
- return o;
124
- };
125
- return _set_prototype_of(o, p);
126
- }
127
- function _sliced_to_array(arr, i) {
128
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
129
- }
130
- function _to_consumable_array(arr) {
131
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
132
- }
133
- function _type_of(obj) {
134
- "@swc/helpers - typeof";
135
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
136
- }
137
- function _unsupported_iterable_to_array(o, minLen) {
138
- if (!o) return;
139
- if (typeof o === "string") return _array_like_to_array(o, minLen);
140
- var n = Object.prototype.toString.call(o).slice(8, -1);
141
- if (n === "Object" && o.constructor) n = o.constructor.name;
142
- if (n === "Map" || n === "Set") return Array.from(n);
143
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
144
- }
145
- function _is_native_reflect_construct() {
146
- try {
147
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
148
- } catch (_) {}
149
- return (_is_native_reflect_construct = function() {
150
- return !!result;
151
- })();
152
- }
153
- import { extent, max, min, range as d3Range, sum } from "d3-array";
154
- import { timeFormat, timeFormatDefaultLocale } from "d3-time-format";
155
- import * as scales from "d3-scale";
156
- import { select } from "d3-selection";
157
- import { transition } from "d3-transition";
158
- // @ts-ignore
159
- import pkg from "open-color/open-color.js";
160
- var openColor = pkg.theme;
161
- import { colorContrast, colorDefaults } from "@d3plus/color";
162
- import { assign, attrize, backgroundColor, date, elem, rtl as detectRTL } from "@d3plus/dom";
163
- import { formatAbbreviate, formatDate } from "@d3plus/format";
164
- import { formatLocale, locale } from "@d3plus/locales";
165
- import { closest } from "@d3plus/math";
166
- import { fontFamily as d3plusFontFamily, textWrap } from "@d3plus/text";
167
- import { TextBox } from "../components/index.js";
168
- import * as shapes from "../shapes/index.js";
169
- import { configPrep, BaseClass, constant } from "../utils/index.js";
170
- /* catches for -0 and less*/ var isNegative = function isNegative(d) {
171
- return d < 0 || Object.is(d, -0);
172
- };
173
- var floorPow = function floorPow(d) {
174
- return Math.pow(10, Math.floor(Math.log10(Math.abs(d)))) * Math.pow(-1, isNegative(d) ? 1 : 0);
175
- };
176
- var ceilPow = function ceilPow(d) {
177
- return Math.pow(10, Math.ceil(Math.log10(Math.abs(d)))) * Math.pow(-1, isNegative(d) ? 1 : 0);
178
- };
179
- var fixFloat = function fixFloat(d) {
180
- var str = "".concat(d);
181
- if (str.includes("e-") || str === "0") return 0;
182
- var nineMatch = str.match(/(-*[0-9]+\.[0]*)([0-8]+)9{3,}[0-9]+$/);
183
- if (nineMatch) return +"".concat(nineMatch[1]).concat(+nineMatch[2] + 1);
184
- var zeroMatch = str.match(/(-*[0-9]+\.[0]*)([1-9]+)0*[0-9]*0{3,}[0-9]+$/);
185
- if (zeroMatch) return +"".concat(zeroMatch[1]).concat(+zeroMatch[2]);
186
- return d;
187
- };
188
- var maxTimezoneOffset = 1000 * 60 * 60 * 26;
189
- /**
190
- * Calculates ticks from a given scale (negative and/or positive)
191
- * @param {scale} scale A d3-scale object
192
- * @private
193
- */ function calculateStep(// eslint-disable-next-line @typescript-eslint/no-explicit-any
194
- scale) {
195
- var minorTicks = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
196
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
197
- var stepScale = scales.scaleLinear().domain([
198
- 200,
199
- 1200
200
- ]).range([
201
- 8,
202
- 28
203
- ]);
204
- var scaleRange = scale.range();
205
- var size = Math.abs(scaleRange[1] - scaleRange[0]);
206
- var step = Math.floor(stepScale(size));
207
- if (this._scale === "time") {
208
- if (this._data && this._data.length) {
209
- var dataExtent = extent(this._data);
210
- var distance = this._data.reduce(function(n, d, i, arr) {
211
- if (i) {
212
- var dist = Math.abs(d - arr[i - 1]);
213
- if (dist < n) n = dist;
214
- }
215
- return n;
216
- }, Infinity);
217
- var newStep = Math.round((dataExtent[1] - dataExtent[0]) / distance);
218
- step = min([
219
- step * (minorTicks ? 2 : 0.5),
220
- newStep
221
- ]);
222
- } else {
223
- step = minorTicks ? step * 2 : step / 2;
224
- }
225
- }
226
- return Math.floor(step);
227
- }
228
- /**
229
- * Calculates ticks from a given scale (negative and/or positive)
230
- * @param {scale} scale A d3-scale object
231
- * @private
232
- */ function calculateTicks(// eslint-disable-next-line @typescript-eslint/no-explicit-any
233
- scale) {
234
- var minorTicks = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
235
- var ticks = [];
236
- var scaleClone = scale.copy();
237
- if (this._scale === "time" && this._data.length) {
238
- var newDomain = extent(this._data);
239
- var range = newDomain.map(scale);
240
- scaleClone.domain(newDomain).range(range);
241
- }
242
- var domain = scaleClone.domain();
243
- var inverted = domain[1] < domain[0];
244
- var step = calculateStep.bind(this)(scaleClone, minorTicks);
245
- if (!minorTicks && this._scale === "log") {
246
- var roundDomain = domain.map(function(d) {
247
- return Math.log10(d) % 1 === 0 ? d : (inverted ? ceilPow : floorPow)(d);
248
- });
249
- var invertedRound = roundDomain[1] < roundDomain[0];
250
- var powers = roundDomain.map(function(d) {
251
- return (isNegative(d) ? -1 : 1) * ([
252
- -1,
253
- 1
254
- ].includes(d) || Math.abs(d) < 1 ? 1 : Math.log10(Math.abs(d)));
255
- });
256
- var powMod = Math.ceil((Math.abs(powers[1] - powers[0]) + 1) / (step * 0.65));
257
- ticks = powMod <= 1 && powers[0] === powers[1] || invertedRound !== inverted ? scaleClone.ticks(step).filter(function(d) {
258
- return +"".concat(d).replace("0.", "") % 2 === 0;
259
- }) : d3Range(powers[0], powers[1], powers[1] < powers[0] ? -1 : 1).concat([
260
- powers[1]
261
- ]).filter(function(d) {
262
- return Math.abs(d) % powMod === 0;
263
- }).map(function(d) {
264
- return +"".concat((isNegative(d) ? -1 : 1) * (d ? Math.pow(10, Math.abs(d)) : Math.sign(1 / d) > 0 ? 1 : -1)).replace(/9+/g, "1");
265
- });
266
- } else {
267
- ticks = scaleClone.ticks(step);
268
- if (!minorTicks && ![
269
- "log",
270
- "time"
271
- ].includes(this._scale) && ticks.length > 1) {
272
- var majorDiff = Math.abs(fixFloat(ticks[1] - ticks[0]) * 2);
273
- ticks = ticks.filter(function(d) {
274
- var mod = Math.abs(d) % majorDiff;
275
- var modFloat = fixFloat(mod);
276
- if (modFloat !== mod) {
277
- return !modFloat || modFloat === majorDiff;
278
- }
279
- return mod === 0;
280
- });
281
- }
282
- }
283
- // for time scale, if data array has been provided, filter out ticks that are not in the array
284
- if (this._scale === "time" && this._data.length) {
285
- var dataNumbers = this._data.map(Number);
286
- ticks = ticks.filter(function(t) {
287
- var tn = +t;
288
- return dataNumbers.find(function(n) {
289
- return n >= tn - maxTimezoneOffset && n <= tn + maxTimezoneOffset;
290
- });
291
- });
292
- }
293
- // forces min/max into ticks, if not present
294
- if (!this._d3ScaleNegative || isNegative(domain[inverted ? 1 : 0]) === ticks.some(function(d) {
295
- return isNegative(d);
296
- })) {
297
- if (!ticks.map(Number).includes(+domain[0])) {
298
- ticks.unshift(domain[0]);
299
- }
300
- }
301
- if (!this._d3ScaleNegative || isNegative(domain[inverted ? 0 : 1]) === ticks.some(function(d) {
302
- return isNegative(d);
303
- })) {
304
- if (!ticks.map(Number).includes(+domain[1])) {
305
- ticks.push(domain[1]);
306
- }
307
- }
308
- return ticks;
309
- }
310
- var Axis = /*#__PURE__*/ function(BaseClass) {
311
- "use strict";
312
- _inherits(Axis, BaseClass);
313
- function Axis() {
314
- _class_call_check(this, Axis);
315
- var _this;
316
- _this = _call_super(this, Axis), _define_property(_this, "_select", void 0), _define_property(_this, "_align", void 0), _define_property(_this, "_barConfig", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
317
- _define_property(_this, "_data", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
318
- _define_property(_this, "_domain", void 0), _define_property(_this, "_duration", void 0), _define_property(_this, "_gridConfig", void 0), _define_property(_this, "_gridLog", void 0), _define_property(_this, "_gridSize", void 0), _define_property(_this, "_grid", void 0), _define_property(_this, "_height", void 0), _define_property(_this, "_labelOffset", void 0), _define_property(_this, "_labelRotation", void 0), _define_property(_this, "_labels", void 0), _define_property(_this, "_margin", void 0), _define_property(_this, "_maxSize", void 0), _define_property(_this, "_minSize", void 0), _define_property(_this, "_orient", void 0), _define_property(_this, "_outerBounds", void 0), _define_property(_this, "_padding", void 0), _define_property(_this, "_paddingInner", void 0), _define_property(_this, "_paddingOuter", void 0), _define_property(_this, "_position", void 0), _define_property(_this, "_range", void 0), _define_property(_this, "_rounding", void 0), _define_property(_this, "_roundingInsideMinPrefix", void 0), _define_property(_this, "_roundingInsideMinSuffix", void 0), _define_property(_this, "_roundingInsideMaxPrefix", void 0), _define_property(_this, "_roundingInsideMaxSuffix", void 0), _define_property(_this, "_scale", void 0), _define_property(_this, "_scalePadding", void 0), _define_property(_this, "_shape", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
319
- _define_property(_this, "_shapeConfig", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
320
- _define_property(_this, "_tickFormat", void 0), _define_property(_this, "_ticks", void 0), _define_property(_this, "_tickSize", void 0), _define_property(_this, "_tickSuffix", void 0), _define_property(_this, "_tickUnit", void 0), _define_property(_this, "_timeLocale", void 0), _define_property(_this, "_title", void 0), _define_property(_this, "_titleClass", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
321
- _define_property(_this, "_titleConfig", void 0), _define_property(_this, "_width", void 0), // D3 scales have complex polymorphic types that vary at runtime
322
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
323
- _define_property(_this, "_d3Scale", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
324
- _define_property(_this, "_d3ScaleNegative", void 0), _define_property(_this, "_group", void 0), _define_property(_this, "_lastScale", void 0), _define_property(_this, "_availableTicks", void 0), _define_property(_this, "_visibleTicks", void 0), _define_property(_this, "_transition", void 0), _define_property(_this, "_userFormat", void 0);
325
- _this._align = "middle";
326
- _this._barConfig = {
327
- stroke: function stroke() {
328
- var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
329
- return colorContrast(bg);
330
- },
331
- "stroke-width": 1
332
- };
333
- _this._data = [];
334
- _this._domain = [
335
- 0,
336
- 10
337
- ];
338
- _this._duration = 600;
339
- _this._gridConfig = {
340
- stroke: function stroke() {
341
- var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
342
- var contrast = colorContrast(bg);
343
- return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];
344
- },
345
- "stroke-width": 1
346
- };
347
- _this._gridLog = false;
348
- _this._height = 400;
349
- _this._labelOffset = false;
350
- _this._labelRotation = false;
351
- _this.orient("bottom");
352
- _this._outerBounds = {
353
- width: 0,
354
- height: 0,
355
- x: 0,
356
- y: 0
357
- };
358
- _this._padding = 5;
359
- _this._paddingInner = 0.1;
360
- _this._paddingOuter = 0.1;
361
- _this._rounding = "none";
362
- _this._roundingInsideMinPrefix = "< ";
363
- _this._roundingInsideMinSuffix = "";
364
- _this._roundingInsideMaxPrefix = "";
365
- _this._roundingInsideMaxSuffix = "+";
366
- _this._scale = "linear";
367
- _this._scalePadding = 0.5;
368
- _this._shape = "Line";
369
- _this._shapeConfig = {
370
- fill: function fill() {
371
- var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
372
- return colorContrast(bg);
373
- },
374
- height: function height(d) {
375
- return d.tick ? 8 : 0;
376
- },
377
- label: function label(d) {
378
- return d.text;
379
- },
380
- labelBounds: function labelBounds(d) {
381
- return d.labelBounds;
382
- },
383
- labelConfig: {
384
- fontColor: function fontColor() {
385
- var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
386
- return colorContrast(bg);
387
- },
388
- fontResize: false,
389
- fontSize: constant(12),
390
- padding: 5,
391
- textAnchor: function textAnchor() {
392
- var rtl = detectRTL();
393
- return _this._orient === "left" ? rtl ? "start" : "end" : _this._orient === "right" ? rtl ? "end" : "start" : _this._labelRotation ? _this._orient === "bottom" ? "end" : "start" : "middle";
394
- },
395
- verticalAlign: function verticalAlign() {
396
- return _this._orient === "bottom" ? "top" : _this._orient === "top" ? _this._labelRotation ? "top" : "bottom" : "middle";
397
- }
398
- },
399
- r: function r(d) {
400
- return d.tick ? 4 : 0;
401
- },
402
- stroke: function stroke() {
403
- var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
404
- return colorContrast(bg);
405
- },
406
- strokeWidth: 1,
407
- width: function width(d) {
408
- return d.tick ? 8 : 0;
409
- }
410
- };
411
- _this._tickSize = 8;
412
- _this._tickSuffix = "normal";
413
- _this._tickUnit = 0;
414
- _this._timeLocale = undefined;
415
- _this._titleClass = new TextBox();
416
- _this._titleConfig = {
417
- fontColor: function fontColor() {
418
- var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
419
- return colorContrast(bg);
420
- },
421
- fontSize: 12,
422
- textAnchor: "middle"
423
- };
424
- _this._width = 400;
425
- _this._margin = {
426
- top: 0,
427
- right: 0,
428
- bottom: 0,
429
- left: 0
430
- };
431
- _this._availableTicks = [];
432
- _this._visibleTicks = [];
433
- return _this;
434
- }
435
- _create_class(Axis, [
436
- {
437
- /**
438
- Sets positioning for the axis bar.
439
- @param bar @private
440
- */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
441
- key: "_barPosition",
442
- value: function _barPosition(bar) {
443
- var _this__position = this._position, height = _this__position.height, x = _this__position.x, y = _this__position.y, opposite = _this__position.opposite, offset = this._margin[opposite], position = [
444
- "top",
445
- "left"
446
- ].includes(this._orient) ? this._outerBounds[y] + this._outerBounds[height] - offset : this._outerBounds[y] + offset;
447
- var x1mod = this._scale === "band" ? this._d3Scale.step() - this._d3Scale.bandwidth() : this._scale === "point" ? this._d3Scale.step() * this._d3Scale.padding() : 0;
448
- var x2mod = this._scale === "band" ? this._d3Scale.step() : this._scale === "point" ? this._d3Scale.step() * this._d3Scale.padding() : 0;
449
- var sortedDomain = (this._d3ScaleNegative ? this._d3ScaleNegative.domain() : []).concat(this._d3Scale ? this._d3Scale.domain() : []).sort(function(a, b) {
450
- return a - b;
451
- });
452
- bar.call(attrize, this._barConfig).attr("".concat(x, "1"), this._getPosition(sortedDomain[0]) - x1mod).attr("".concat(x, "2"), this._getPosition(sortedDomain[sortedDomain.length - 1]) + x2mod).attr("".concat(y, "1"), position).attr("".concat(y, "2"), position);
453
- }
454
- },
455
- {
456
- /**
457
- Returns the scale's domain, taking into account negative and positive log scales.
458
- @private
459
- */ key: "_getDomain",
460
- value: function _getDomain() {
461
- var ticks = [];
462
- if (this._d3ScaleNegative) ticks = this._d3ScaleNegative.domain();
463
- if (this._d3Scale) ticks = ticks.concat(this._d3Scale.domain());
464
- var domain = [
465
- "band",
466
- "ordinal",
467
- "point"
468
- ].includes(this._scale) ? ticks : extent(ticks);
469
- return ticks[0] > ticks[1] ? domain.reverse() : domain;
470
- }
471
- },
472
- {
473
- /**
474
- Returns a value's scale position, taking into account negative and positive log scales.
475
- @param d @private
476
- */ key: "_getPosition",
477
- value: function _getPosition(d) {
478
- if (this._scale === "log") {
479
- if (d === 0) return (this._d3Scale || this._d3ScaleNegative).range()[this._d3Scale ? 0 : 1];
480
- return (isNegative(d) ? this._d3ScaleNegative || function() {
481
- return 0;
482
- } : this._d3Scale)(d);
483
- }
484
- return this._d3Scale(d);
485
- }
486
- },
487
- {
488
- /**
489
- Returns the scale's range, taking into account negative and positive log scales.
490
- @private
491
- */ key: "_getRange",
492
- value: function _getRange() {
493
- var ticks = [];
494
- if (this._d3ScaleNegative) ticks = this._d3ScaleNegative.range();
495
- if (this._d3Scale) ticks = ticks.concat(this._d3Scale.range());
496
- return ticks[0] > ticks[1] ? extent(ticks).reverse() : extent(ticks);
497
- }
498
- },
499
- {
500
- /**
501
- Returns the scale's labels, taking into account negative and positive log scales.
502
- @private
503
- */ key: "_getLabels",
504
- value: function _getLabels() {
505
- var labels = [];
506
- if (this._d3ScaleNegative) labels = labels.concat(calculateTicks.bind(this)(this._d3ScaleNegative, false));
507
- if (this._d3Scale) labels = labels.concat(calculateTicks.bind(this)(this._d3Scale, false));
508
- if (this._scale === "log") {
509
- var diverging = labels.some(function(d) {
510
- return isNegative(d);
511
- }) && labels.some(function(d) {
512
- return d > 0;
513
- });
514
- if (diverging) {
515
- var minValue = min(_to_consumable_array(this._d3ScaleNegative.domain().map(Math.abs)).concat(_to_consumable_array(this._d3Scale.domain())));
516
- // add minValue if it does not exist, and should
517
- if (!labels.includes(minValue)) {
518
- labels.splice(labels.findIndex(function(d) {
519
- return d > minValue;
520
- }), 0, minValue);
521
- }
522
- // remove -minValue if minValue also exists
523
- if (labels.includes(-minValue) && labels.includes(minValue)) {
524
- labels.splice(labels.indexOf(-minValue), 1);
525
- }
526
- }
527
- }
528
- return labels;
529
- }
530
- },
531
- {
532
- /**
533
- Returns the scale's ticks, taking into account negative and positive log scales.
534
- @private
535
- */ key: "_getTicks",
536
- value: function _getTicks() {
537
- if ([
538
- "band",
539
- "ordinal",
540
- "point",
541
- "time"
542
- ].includes(this._scale) && this._data.length && this._data.length < this._width / 4) {
543
- return this._scale === "time" ? this._data.map(date) : this._data;
544
- }
545
- var ticks = [];
546
- if (this._d3ScaleNegative) ticks = ticks.concat(calculateTicks.bind(this)(this._d3ScaleNegative, true));
547
- if (this._d3Scale) ticks = ticks.concat(calculateTicks.bind(this)(this._d3Scale, true));
548
- if (this._scale === "log" && ticks.includes(-1) && ticks.includes(1)) ticks.splice(ticks.indexOf(-1), 1);
549
- return ticks;
550
- }
551
- },
552
- {
553
- /**
554
- Sets positioning for the grid lines.
555
- @param lines @private
556
- */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
557
- key: "_gridPosition",
558
- value: function _gridPosition(lines) {
559
- var last = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
560
- var _this__position = this._position, height = _this__position.height, x = _this__position.x, y = _this__position.y, opposite = _this__position.opposite, offset = this._margin[opposite], position = [
561
- "top",
562
- "left"
563
- ].includes(this._orient) ? this._outerBounds[y] + this._outerBounds[height] - offset : this._outerBounds[y] + offset, scale = last ? this._lastScale || this._getPosition.bind(this) : this._getPosition.bind(this), size = [
564
- "top",
565
- "left"
566
- ].includes(this._orient) ? offset : -offset, xDiff = this._scale === "band" ? this._d3Scale.bandwidth() / 2 : 0, xPos = function xPos(d) {
567
- return scale(d.id) + xDiff;
568
- };
569
- lines.call(attrize, this._gridConfig).attr("".concat(x, "1"), xPos).attr("".concat(x, "2"), xPos).attr("".concat(y, "1"), position).attr("".concat(y, "2"), last ? position : position + size);
570
- }
571
- },
572
- {
573
- /**
574
- Renders the current Axis to the page.
575
- @param callback Optional callback invoked after rendering completes.
576
- */ key: "render",
577
- value: function render(callback) {
578
- var _this = this;
579
- var _this1 = this;
580
- /**
581
- * Creates an SVG element to contain the axis if none
582
- * has been specified using the "select" method.
583
- */ if (this._select === void 0) {
584
- this.select(select("body").append("svg").attr("width", "".concat(this._width, "px")).attr("height", "".concat(this._height, "px")).node());
585
- }
586
- var timeLocale = this._timeLocale || locale[this._locale] || locale["en-US"];
587
- timeFormatDefaultLocale(timeLocale);
588
- /**
589
- * Declares some commonly used variables.
590
- */ var _this__position = this._position, width = _this__position.width, height = _this__position.height, x = _this__position.x, y = _this__position.y, horizontal = _this__position.horizontal, opposite = _this__position.opposite, clipId = "d3plus-Axis-clip-".concat(this._uuid), flip = [
591
- "top",
592
- "left"
593
- ].includes(this._orient), p = this._padding, parent = this._select, rangeOuter = [
594
- p,
595
- this["_".concat(width)] - p
596
- ], t = transition().duration(this._duration);
597
- var tickValue = this._shape === "Circle" ? this._shapeConfig.r : this._shape === "Rect" ? this._shapeConfig[width] : this._shapeConfig.strokeWidth;
598
- var tickGet = typeof tickValue !== "function" ? function() {
599
- return tickValue;
600
- } : tickValue;
601
- /**
602
- * Zeros out the margins for re-calculation.
603
- */ var margin = this._margin = {
604
- top: 0,
605
- right: 0,
606
- bottom: 0,
607
- left: 0
608
- };
609
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
610
- var labels = [], range = [], ticks = [];
611
- /**
612
- * Constructs the tick formatter function.
613
- */ var tickFormat = this._tickFormat ? this._tickFormat : function(d) {
614
- if (isNaN(d) || [
615
- "band",
616
- "ordinal",
617
- "point"
618
- ].includes(_this._scale)) {
619
- return d;
620
- } else if (_this._scale === "time") {
621
- var refData = (_this._data.length ? _this._data : _this._domain).map(function(v) {
622
- return date(v);
623
- }).filter(function(d) {
624
- return _instanceof(d, Date);
625
- }).sort(function(a, b) {
626
- return +a - +b;
627
- });
628
- return formatDate(d, refData, timeFormat).replace(/^Q/g, timeLocale.quarter);
629
- } else if (_this._scale === "linear" && _this._tickSuffix === "smallest") {
630
- var loc = _type_of(_this._locale) === "object" ? _this._locale : formatLocale[_this._locale];
631
- var separator = loc.separator, suffixes = loc.suffixes;
632
- var suff = d >= 1000 ? suffixes[_this._tickUnit + 8] : "";
633
- var tick = d / Math.pow(10, 3 * _this._tickUnit);
634
- var number = formatAbbreviate(tick, loc, ",.".concat(tick.toString().length, "r"));
635
- return "".concat(number).concat(separator).concat(suff);
636
- } else {
637
- var inverted = ticks[1] < ticks[0];
638
- var minTick = inverted ? ticks.length - 1 : 0;
639
- var maxTick = inverted ? 0 : ticks.length - 1;
640
- var prefix = _this._rounding === "inside" ? ticks.indexOf(d) === minTick ? _this._roundingInsideMinPrefix : ticks.indexOf(d) === maxTick ? _this._roundingInsideMaxPrefix : "" : "";
641
- var suffix = _this._rounding === "inside" ? ticks.indexOf(d) === minTick ? _this._roundingInsideMinSuffix : ticks.indexOf(d) === maxTick ? _this._roundingInsideMaxSuffix : "" : "";
642
- return "".concat(prefix).concat(formatAbbreviate(d, _this._locale)).concat(suffix);
643
- }
644
- };
645
- /**
646
- * (Re)calculates the internal d3 scale
647
- * @param {} newRange
648
- */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
649
- var setScale = function setScale() {
650
- var newRange = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _this1._range;
651
- /**
652
- * Calculates the internal "range" array to use, including
653
- * fallbacks if not specified with the "range" method.
654
- */ range = newRange ? newRange.slice() : [
655
- undefined,
656
- undefined
657
- ];
658
- var _rangeOuter = _sliced_to_array(rangeOuter, 2), minRange = _rangeOuter[0], maxRange = _rangeOuter[1];
659
- if (_this1._range) {
660
- if (_this1._range[0] !== undefined) minRange = _this1._range[0];
661
- if (_this1._range[_this1._range.length - 1] !== undefined) maxRange = _this1._range[_this1._range.length - 1];
662
- }
663
- if (range[0] === undefined || range[0] < minRange) range[0] = minRange;
664
- if (range[1] === undefined || range[1] > maxRange) range[1] = maxRange;
665
- var sizeInner = maxRange - minRange;
666
- if (_this1._scale === "ordinal" && _this1._domain.length > range.length) {
667
- if (newRange === _this1._range) {
668
- var buckets = _this1._domain.length + 1;
669
- range = d3Range(buckets).map(function(d) {
670
- return range[0] + sizeInner * (d / (buckets - 1));
671
- }).slice(1, buckets);
672
- range = range.map(function(d) {
673
- return d - range[0] / 2;
674
- });
675
- } else {
676
- var buckets1 = _this1._domain.length;
677
- var size = range[1] - range[0];
678
- range = d3Range(buckets1).map(function(d) {
679
- return range[0] + size * (d / (buckets1 - 1));
680
- });
681
- }
682
- }
683
- /**
684
- * Sets up the initial d3 scale, using this._domain and the
685
- * previously defined range variable.
686
- */ var scale = "scale".concat(_this1._scale.charAt(0).toUpperCase()).concat(_this1._scale.slice(1));
687
- var initialDomain = _this1._domain.slice();
688
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
689
- _this1._d3Scale = scales[scale]().domain(_this1._scale === "time" ? initialDomain.map(date) : initialDomain).range(range);
690
- if (_this1._rounding !== "none") {
691
- var roundDomain = function roundDomain() {
692
- var zeroLength = function zeroLength(d) {
693
- if (smallScale) {
694
- if (!d) return 0;
695
- var m = "".concat(d).match(/0\.(0*)/);
696
- if (m) return +"0.".concat(Array(m[1].length + 1).fill(0).join(""), "1");
697
- }
698
- return "".concat(Math.round(Math.abs(d))).length;
699
- };
700
- var smallScale = initialDomain.every(function(d) {
701
- return Math.abs(d) < 1;
702
- });
703
- var zeroArray = [
704
- zeroLength(initialDomain[0]),
705
- zeroLength(initialDomain[1])
706
- ].filter(Boolean).sort();
707
- // Nothing meaningful to round to (e.g. a zero-extent domain like
708
- // [0, 0]); leave the scale's domain as-is to avoid a NaN factor.
709
- if (!zeroArray.length) return;
710
- var diverging = initialDomain.some(function(d) {
711
- return isNegative(d);
712
- }) && initialDomain.some(function(d) {
713
- return d > 0;
714
- });
715
- var zeros = zeroArray.length === 1 ? zeroArray[0] : zeroArray[0] > 1 && zeroArray[0] === zeroArray[1] ? zeroArray[0] - 1 : _this1._rounding === "outside" || !diverging ? zeroArray[0] + (zeroArray[1] - zeroArray[0]) / 2 : max(zeroArray);
716
- var factor = zeros < 1 ? fixFloat(zeros) : +"1".concat(Array(Math.floor(fixFloat(zeros)) - 1).fill(0).join(""));
717
- if (factor >= Math.abs(initialDomain[1] - initialDomain[0])) factor /= 2;
718
- var inverted = initialDomain[1] < initialDomain[0];
719
- var newDomain = [
720
- Math[_this1._rounding === "outside" ? inverted ? "ceil" : "floor" : inverted ? "floor" : "ceil"](initialDomain[0] / factor) * factor,
721
- Math[_this1._rounding === "outside" ? inverted ? "floor" : "ceil" : inverted ? "ceil" : "floor"](initialDomain[1] / factor) * factor
722
- ];
723
- if (_this1._scale === "log") {
724
- if (newDomain[0] === 0) newDomain[0] = initialDomain[0];
725
- if (newDomain[1] === 0) newDomain[1] = initialDomain[1];
726
- }
727
- _this1._d3Scale.domain(newDomain.map(fixFloat));
728
- };
729
- if (_this1._scale === "linear") {
730
- roundDomain.bind(_this1)();
731
- } else if (_this1._scale === "log") {
732
- var powDomain = [];
733
- var inverted = initialDomain[1] < initialDomain[0];
734
- powDomain[0] = (_this1._rounding === "outside" ? isNegative(initialDomain[0]) ? inverted ? floorPow : ceilPow : inverted ? ceilPow : floorPow : isNegative(initialDomain[0]) ? inverted ? ceilPow : floorPow : inverted ? floorPow : ceilPow)(initialDomain[0]);
735
- powDomain[1] = (_this1._rounding === "inside" ? isNegative(initialDomain[1]) ? inverted ? floorPow : ceilPow : inverted ? ceilPow : floorPow : isNegative(initialDomain[1]) ? inverted ? ceilPow : floorPow : inverted ? floorPow : ceilPow)(initialDomain[1]);
736
- var powInverted = powDomain[1] < powDomain[0];
737
- if (powDomain[0] !== powDomain[1] && powDomain.some(function(d) {
738
- return Math.abs(d) > 10;
739
- }) && powInverted === inverted) {
740
- _this1._d3Scale.domain(powDomain);
741
- } else {
742
- roundDomain.bind(_this1)();
743
- }
744
- }
745
- }
746
- if (_this1._d3Scale.padding) _this1._d3Scale.padding(_this1._scalePadding);
747
- if (_this1._d3Scale.paddingInner) _this1._d3Scale.paddingInner(_this1._paddingInner);
748
- if (_this1._d3Scale.paddingOuter) _this1._d3Scale.paddingOuter(_this1._paddingOuter);
749
- /**
750
- * Constructs a separate "negative only" scale for logarithmic
751
- * domains, as they cannot pass zero.
752
- */ _this1._d3ScaleNegative = null;
753
- if (_this1._scale === "log") {
754
- var domain = _this1._d3Scale.domain();
755
- if (domain[0] === 0) {
756
- var smallestNumber = min([
757
- min(_this1._data),
758
- Math.abs(domain[1])
759
- ]);
760
- domain[0] = smallestNumber === 0 || smallestNumber === 1 ? 1e-6 : smallestNumber <= 1 ? floorPow(smallestNumber) : 1;
761
- if (isNegative(domain[1])) domain[0] *= -1;
762
- } else if (domain[domain.length - 1] === 0) {
763
- var smallestNumber1 = min([
764
- min(_this1._data),
765
- Math.abs(domain[0])
766
- ]);
767
- domain[domain.length - 1] = smallestNumber1 === 0 || smallestNumber1 === 1 ? 1e-6 : smallestNumber1 <= 1 ? floorPow(smallestNumber1) : 1;
768
- if (isNegative(domain[0])) domain[domain.length - 1] *= -1;
769
- }
770
- var range1 = _this1._d3Scale.range();
771
- // all negatives
772
- if (isNegative(domain[0]) && isNegative(domain[domain.length - 1])) {
773
- _this1._d3ScaleNegative = _this1._d3Scale.copy().domain(domain).range(range1);
774
- _this1._d3Scale = null;
775
- } else if (domain[0] > 0 && domain[domain.length - 1] > 0) {
776
- _this1._d3Scale.domain(domain).range(range1);
777
- } else {
778
- var powers = domain.map(function(d) {
779
- return Math.log10(Math.abs(d));
780
- }).map(function(d) {
781
- return d || -1e-6;
782
- });
783
- var leftPercentage = powers[0] / sum(powers);
784
- var zero = leftPercentage * (range1[1] - range1[0]);
785
- var minPositive = min([
786
- min(_this1._data.filter(function(d) {
787
- return d >= 0;
788
- })),
789
- Math.abs(domain[1])
790
- ]);
791
- if (minPositive === 1) minPositive = 1e-6;
792
- var minNegative = min([
793
- min(_this1._data.filter(isNegative)),
794
- Math.abs(domain[0])
795
- ]);
796
- if (minNegative === 1) minNegative = 1e-6;
797
- var minPosPow = minPositive === 0 ? 1e-6 : minPositive <= 1 ? floorPow(minPositive) : 1;
798
- var minNegPow = minNegative === 0 ? -1e-6 : minNegative <= 1 ? floorPow(minNegative) : 1;
799
- var minValue = min([
800
- Math.abs(minPosPow),
801
- Math.abs(minNegPow)
802
- ]);
803
- _this1._d3ScaleNegative = _this1._d3Scale.copy();
804
- (isNegative(domain[0]) ? _this1._d3Scale : _this1._d3ScaleNegative).domain([
805
- isNegative(domain[0]) ? minValue : -minValue,
806
- domain[1]
807
- ]).range([
808
- range1[0] + zero,
809
- range1[1]
810
- ]);
811
- (isNegative(domain[0]) ? _this1._d3ScaleNegative : _this1._d3Scale).domain([
812
- domain[0],
813
- isNegative(domain[0]) ? -minValue : minValue
814
- ]).range([
815
- range1[0],
816
- range1[0] + zero
817
- ]);
818
- }
819
- }
820
- /**
821
- * Determines the of values array to use
822
- * for the "ticks" and the "labels"
823
- */ ticks = (_this1._ticks ? _this1._scale === "time" ? _this1._ticks.map(date) : _this1._ticks : (_this1._d3Scale ? _this1._d3Scale.ticks : _this1._d3ScaleNegative.ticks) ? _this1._getTicks() : _this1._domain).slice();
824
- labels = (_this1._labels ? _this1._scale === "time" ? _this1._labels.map(date) : _this1._labels : (_this1._d3Scale ? _this1._d3Scale.ticks : _this1._d3ScaleNegative.ticks) ? _this1._getLabels() : ticks).slice();
825
- if (_this1._scale === "time") {
826
- ticks = ticks.map(Number);
827
- labels = labels.map(Number);
828
- }
829
- ticks = ticks.sort(function(a, b) {
830
- return _this1._getPosition(a) - _this1._getPosition(b);
831
- });
832
- labels = labels.sort(function(a, b) {
833
- return _this1._getPosition(a) - _this1._getPosition(b);
834
- });
835
- /**
836
- * Get the smallest suffix.
837
- */ if (_this1._scale === "linear" && _this1._tickSuffix === "smallest") {
838
- var suffixes = labels.filter(function(d) {
839
- return d >= 1000;
840
- });
841
- if (suffixes.length > 0) {
842
- var _Math;
843
- var minVal = (_Math = Math).min.apply(_Math, _to_consumable_array(suffixes));
844
- var i = 1;
845
- while(i && i < 7){
846
- var n = Math.pow(10, 3 * i);
847
- if (minVal / n >= 1) {
848
- _this1._tickUnit = i;
849
- i += 1;
850
- } else {
851
- break;
852
- }
853
- }
854
- }
855
- }
856
- /**
857
- * Removes ticks when they overlap other ticks.
858
- */ var pixels = [];
859
- _this1._availableTicks = ticks;
860
- ticks.forEach(function(d, i) {
861
- var s = tickGet({
862
- id: d,
863
- tick: true
864
- }, i);
865
- if (_this1._shape === "Circle") s *= 2;
866
- var t = _this1._getPosition(d);
867
- if (!pixels.length || Math.abs(closest(t, pixels.filter(function(p) {
868
- return p !== false;
869
- })) - t) > s * 2) pixels.push(t);
870
- else pixels.push(false);
871
- });
872
- ticks = ticks.filter(function(_d, i) {
873
- return pixels[i] !== false;
874
- });
875
- _this1._visibleTicks = ticks;
876
- };
877
- setScale();
878
- /**
879
- * Pre-calculates the size of the title, if defined, in order
880
- * to adjust the internal margins.
881
- */ if (this._title) {
882
- var _this__titleConfig = this._titleConfig, fontFamily = _this__titleConfig.fontFamily, fontSize = _this__titleConfig.fontSize, lineHeight = _this__titleConfig.lineHeight;
883
- var titleWrap = textWrap().fontFamily(typeof fontFamily === "function" ? fontFamily() : fontFamily).fontSize(typeof fontSize === "function" ? fontSize() : fontSize).lineHeight(typeof lineHeight === "function" ? lineHeight() : lineHeight).width(range[range.length - 1] - range[0] - p * 2)// eslint-disable-next-line @typescript-eslint/no-explicit-any
884
- .height(this["_".concat(height)] - this._tickSize - p * 2);
885
- var lines = titleWrap(this._title).lines.length;
886
- margin[this._orient] = lines * titleWrap.lineHeight() + p;
887
- }
888
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
889
- var hBuff = this._shape === "Circle" ? typeof this._shapeConfig.r === "function" ? this._shapeConfig.r({
890
- tick: true
891
- }) : this._shapeConfig.r : this._shape === "Rect" ? typeof this._shapeConfig[height] === "function" ? this._shapeConfig[height]({
892
- tick: true
893
- }) : this._shapeConfig[height] : this._tickSize, // eslint-disable-next-line @typescript-eslint/no-explicit-any
894
- wBuff = tickGet({
895
- tick: true
896
- });
897
- if (typeof hBuff === "function") hBuff = max(ticks.map(hBuff));
898
- if (this._shape === "Rect") hBuff /= 2;
899
- if (typeof wBuff === "function") wBuff = max(ticks.map(wBuff));
900
- if (this._shape !== "Circle") wBuff /= 2;
901
- /**
902
- * Calculates the text wrapping and size of a given textData object.
903
- * @param {Object} datum
904
- */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
905
- var calculateLabelSize = function calculateLabelSize(datum) {
906
- var d = datum.d, i = datum.i, fF = datum.fF, fP = datum.fP, fS = datum.fS, rotate = datum.rotate, space = datum.space;
907
- var h = rotate ? "width" : "height", w = rotate ? "height" : "width";
908
- var wSize = min([
909
- _this._maxSize,
910
- _this._width
911
- ]);
912
- var hSize = min([
913
- _this._maxSize,
914
- _this._height
915
- ]);
916
- var wrap = textWrap().fontFamily(fF).fontSize(fS).lineHeight(_this._shapeConfig.lineHeight ? _this._shapeConfig.lineHeight(d, i) : undefined);
917
- wrap[w](horizontal ? space : wSize - hBuff - p - _this._margin.left - _this._margin.right);
918
- wrap[h](horizontal ? hSize - hBuff - p - _this._margin.top - _this._margin.bottom : space);
919
- var res = wrap(tickFormat(d));
920
- res.lines = res.lines.filter(function(d) {
921
- return d !== "";
922
- });
923
- res.width = res.lines.length ? Math.ceil(max(res.widths)) : 0;
924
- res.height = res.lines.length ? Math.ceil(res.lines.length * wrap.lineHeight()) + fP : 0;
925
- return res;
926
- };
927
- /** Calculates label offsets*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
928
- var calculateOffset = function calculateOffset() {
929
- var arr = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
930
- var offset = 0;
931
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
932
- arr.forEach(function(datum) {
933
- var prev = arr[datum.i - 1];
934
- var h = datum.rotate && horizontal || !datum.rotate && !horizontal ? "width" : "height", w = datum.rotate && horizontal || !datum.rotate && !horizontal ? "height" : "width";
935
- if (!prev) {
936
- offset = 1;
937
- } else if (prev.position + prev[w] / 2 > datum.position - datum[w] / 2) {
938
- if (offset) {
939
- datum.offset = prev[h];
940
- offset = 0;
941
- } else offset = 1;
942
- }
943
- });
944
- };
945
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
946
- var textData = [];
947
- var createTextData = function createTextData() {
948
- var offset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
949
- var fontSize = _this1._shapeConfig.labelConfig.fontSize;
950
- var fontFamily = _this1._shapeConfig.labelConfig.fontFamily || d3plusFontFamily;
951
- var fontPadding = _this1._shapeConfig.labelConfig.padding;
952
- /**
953
- * Calculates the space each label would take up, given
954
- * the provided this._space size.
955
- */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
956
- textData = labels.map(function(d, i) {
957
- var fF = typeof fontFamily === "function" ? fontFamily(d, i) : fontFamily, fP = typeof fontPadding === "function" ? fontPadding(d, i) : fontPadding, fS = typeof fontSize === "function" ? fontSize(d, i) : fontSize, position = _this1._getPosition(d);
958
- var lineHeight = _this1._shapeConfig.lineHeight ? _this1._shapeConfig.lineHeight(d, i) : fS * 1.4;
959
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
960
- var datum = {
961
- d: d,
962
- i: i,
963
- fF: fF,
964
- fP: fP,
965
- fS: fS,
966
- lineHeight: lineHeight,
967
- position: position,
968
- rotate: _this1._labelRotation
969
- };
970
- return datum;
971
- });
972
- var maxSpace = _this1._scale === "band" ? _this1._d3Scale.bandwidth() : textData.reduce(function(s, d, i) {
973
- var position = d.position;
974
- var prevPosition = !i ? textData.length === 1 ? rangeOuter[0] : position - (textData[i + 1].position - position) : position - (position - textData[i - 1].position);
975
- var prevSpace = Math.abs(position - prevPosition);
976
- var nextPosition = i == textData.length - 1 ? textData.length === 1 ? rangeOuter[1] : position + (position - textData[i - 1].position) : position - (position - textData[i + 1].position);
977
- var nextSpace = Math.abs(position - nextPosition);
978
- var mod = _this1._scale === "point" ? 1 : 2;
979
- return max([
980
- max([
981
- prevSpace,
982
- nextSpace
983
- ]) * mod,
984
- s
985
- ]);
986
- }, 0);
987
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
988
- textData = textData.map(function(datum) {
989
- datum.space = maxSpace - datum.fP * 2;
990
- var res = calculateLabelSize(datum);
991
- return Object.assign(res, datum);
992
- });
993
- var reverseTextData = textData.slice().reverse();
994
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
995
- textData.forEach(function(datum) {
996
- var fP = datum.fP, i = datum.i, position = datum.position;
997
- var sizeName = datum.rotate && horizontal || !datum.rotate && !horizontal ? "height" : "width";
998
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
999
- var prev = i ? reverseTextData.find(function(t) {
1000
- return t.i < i && !t.truncated;
1001
- }) : false;
1002
- if (i === textData.length - 1) {
1003
- while(prev && position - datum[sizeName] / 2 - fP < prev.position + prev[sizeName] / 2){
1004
- prev.truncated = true;
1005
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1006
- prev = reverseTextData.find(function(t) {
1007
- return t.i < i && !t.truncated;
1008
- });
1009
- }
1010
- }
1011
- datum.truncated = prev ? position - datum[sizeName] / 2 - fP < prev.position + prev[sizeName] / 2 : false;
1012
- });
1013
- if (offset > 1) calculateOffset(textData);
1014
- };
1015
- createTextData();
1016
- var offsetEnabled = // eslint-disable-next-line @typescript-eslint/no-explicit-any
1017
- this._labelOffset && textData.some(function(d) {
1018
- return d.truncated;
1019
- });
1020
- if (offsetEnabled) createTextData(2);
1021
- /**
1022
- * "spillover" will contain the pixel spillover of the first and last label,
1023
- * and then adjust the scale range accordingly.
1024
- */ var spillovers = [
1025
- 0,
1026
- 1
1027
- ].map(function(index) {
1028
- var datum = textData[index ? textData.length - 1 : 0];
1029
- if (!datum) return 0;
1030
- var dHeight = datum.height, position = datum.position, rotate = datum.rotate, dWidth = datum.width;
1031
- var compPosition = index ? rangeOuter[1] : rangeOuter[0];
1032
- var halfSpace = (rotate || !horizontal ? dHeight : dWidth) / 2;
1033
- if (Math.abs(position - compPosition) >= halfSpace) return 0;
1034
- var spill = halfSpace - (position - compPosition);
1035
- return Math.abs(spill);
1036
- });
1037
- var _range = _sliced_to_array(range, 2), first = _range[0], last = _range[1];
1038
- var newRange = [
1039
- first + spillovers[0],
1040
- last - spillovers[1]
1041
- ];
1042
- if (this._range) {
1043
- if (this._range[0] !== undefined) newRange[0] = this._range[0];
1044
- if (this._range[this._range.length - 1] !== undefined) newRange[1] = this._range[this._range.length - 1];
1045
- }
1046
- if (newRange[0] !== first || newRange[1] !== last) {
1047
- setScale(newRange);
1048
- createTextData(offsetEnabled ? 2 : 1);
1049
- }
1050
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1051
- var labelHeight = max(textData, function(t) {
1052
- return t.height;
1053
- }) || 0;
1054
- this._labelRotation = horizontal && this._labelRotation === undefined ? textData.some(function(datum) {
1055
- var i = datum.i, dH = datum.height, position = datum.position, truncated = datum.truncated;
1056
- var prev = textData[i - 1];
1057
- return truncated || i && prev.position + prev.height / 2 > position - dH / 2;
1058
- }) : this._labelRotation;
1059
- var globalOffset = this._labelOffset ? max(textData, function(d) {
1060
- return d.offset || 0;
1061
- }) : 0;
1062
- textData.forEach(// eslint-disable-next-line @typescript-eslint/no-explicit-any
1063
- function(datum) {
1064
- return datum.offset = datum.offset ? globalOffset : 0;
1065
- });
1066
- var tBuff = this._shape === "Line" ? 0 : hBuff;
1067
- var _obj;
1068
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1069
- var bounds = this._outerBounds = (_obj = {}, _define_property(_obj, height, // eslint-disable-next-line @typescript-eslint/no-explicit-any
1070
- (max(textData, function(t) {
1071
- return Math.ceil(t[t.rotate || !horizontal ? "width" : "height"] + t.offset);
1072
- }) || 0) + (textData.length ? p : 0)), _define_property(_obj, width, rangeOuter[rangeOuter.length - 1] - rangeOuter[0]), _define_property(_obj, x, rangeOuter[0]), _obj);
1073
- bounds[height] = max([
1074
- this._minSize,
1075
- bounds[height]
1076
- ]);
1077
- margin[this._orient] += hBuff;
1078
- margin[opposite] = this._gridSize !== undefined ? max([
1079
- this._gridSize,
1080
- tBuff
1081
- ]) : this["_".concat(height)] - margin[this._orient] - bounds[height] - p;
1082
- bounds[height] += margin[opposite] + margin[this._orient];
1083
- bounds[y] = this._align === "start" ? this._padding : this._align === "end" ? this["_".concat(height)] - bounds[height] - this._padding : this["_".concat(height)] / 2 - bounds[height] / 2;
1084
- var group = elem("g#d3plus-Axis-".concat(this._uuid), {
1085
- parent: parent
1086
- });
1087
- this._group = group;
1088
- var grid = elem("g.grid", {
1089
- parent: group
1090
- }).selectAll("line").data((this._gridSize !== 0 ? this._grid || this._scale === "log" && !this._gridLog ? labels : ticks : []).map(function(d) {
1091
- return {
1092
- id: d
1093
- };
1094
- }), // eslint-disable-next-line @typescript-eslint/no-explicit-any
1095
- function(d) {
1096
- return d.id;
1097
- });
1098
- grid.exit().transition(t).attr("opacity", 0).call(this._gridPosition.bind(this)).remove();
1099
- grid.enter().append("line").attr("opacity", 0).attr("clip-path", "url(#".concat(clipId, ")")).call(this._gridPosition.bind(this), true).merge(grid).transition(t).attr("opacity", 1).call(this._gridPosition.bind(this));
1100
- var labelOnly = labels.filter(function(d, i) {
1101
- return textData[i].lines.length && !ticks.includes(d);
1102
- });
1103
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1104
- var rotated = textData.some(function(d) {
1105
- return d.rotate;
1106
- });
1107
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1108
- var tickData = ticks.concat(labelOnly).map(function(d) {
1109
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1110
- var data = textData.find(function(td) {
1111
- return td.d === d;
1112
- });
1113
- var xPos = _this._getPosition(d);
1114
- var space = data ? data.space : 0;
1115
- var lines = data ? data.lines.length : 1;
1116
- var lineHeight = data ? data.lineHeight : 1;
1117
- var fP = data ? data.fP : 0;
1118
- var labelOffset = data && _this._labelOffset ? data.offset : 0;
1119
- var labelWidth = horizontal ? space : bounds.width - margin[_this._position.opposite] - hBuff - margin[_this._orient] + p;
1120
- var offset = margin[opposite], size = (hBuff + labelOffset) * (flip ? -1 : 1), yPos = flip ? bounds[y] + bounds[height] - offset : bounds[y] + offset;
1121
- var _obj;
1122
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1123
- var tickConfig = (_obj = {
1124
- id: d,
1125
- labelBounds: rotated && data ? {
1126
- x: -data.width / 2 + data.fS / 4,
1127
- y: _this._orient === "bottom" ? size + (data.width - lineHeight * lines) / 2 + fP : size - (data.width + lineHeight * lines) / 2 - 2 * fP,
1128
- width: data.width,
1129
- height: data.height
1130
- } : {
1131
- x: horizontal ? -space / 2 : _this._orient === "left" ? -labelWidth - p + size : size + p,
1132
- y: horizontal ? _this._orient === "bottom" ? size + fP : size - labelHeight - fP : -space / 2,
1133
- width: horizontal ? space : labelWidth,
1134
- height: horizontal ? labelHeight : space
1135
- },
1136
- rotate: data ? data.rotate : false,
1137
- size: labels.includes(d) || _this._scale === "log" && Math.log10(Math.abs(d)) % 1 === 0 ? size : ticks.includes(d) ? Math.ceil(size / 2) : _this._data.find(function(t) {
1138
- return +t === d;
1139
- }) ? Math.ceil(size / 4) : 0,
1140
- text: // eslint-disable-next-line @typescript-eslint/no-explicit-any
1141
- !(data || {}).truncated && labels.includes(d) ? tickFormat(d) : false,
1142
- tick: ticks.includes(d)
1143
- }, _define_property(_obj, x, xPos + (_this._scale === "band" ? _this._d3Scale.bandwidth() / 2 : 0)), _define_property(_obj, y, yPos), _obj);
1144
- return tickConfig;
1145
- });
1146
- if (this._shape === "Line") {
1147
- tickData = tickData.concat(// eslint-disable-next-line @typescript-eslint/no-explicit-any
1148
- tickData.map(function(d) {
1149
- var dupe = Object.assign({}, d);
1150
- dupe[y] += d.size;
1151
- return dupe;
1152
- }));
1153
- }
1154
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1155
- new shapes[this._shape]().data(tickData).duration(this._duration).labelConfig({
1156
- ellipsis: function ellipsis(d) {
1157
- return d && d.length ? "".concat(d, "...") : "";
1158
- },
1159
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1160
- rotate: function rotate(d) {
1161
- return d.rotate ? -90 : 0;
1162
- }
1163
- }).select(elem("g.ticks", {
1164
- parent: group
1165
- }).node())// eslint-disable-next-line @typescript-eslint/no-explicit-any
1166
- .config(configPrep.bind(this)(this._shapeConfig)).labelConfig({
1167
- padding: 0
1168
- }).render();
1169
- var bar = group.selectAll("line.bar").data([
1170
- null
1171
- ]);
1172
- bar.enter().append("line").attr("class", "bar").attr("opacity", 0).call(this._barPosition.bind(this)).merge(bar).transition(t).attr("opacity", 1).call(this._barPosition.bind(this));
1173
- this._titleClass.data(this._title ? [
1174
- {
1175
- text: this._title
1176
- }
1177
- ] : []).duration(this._duration).height(margin[this._orient]).rotate(this._orient === "left" ? -90 : this._orient === "right" ? 90 : 0).select(elem("g.d3plus-Axis-title", {
1178
- parent: group
1179
- }).node()).text(function(d) {
1180
- return d.text;
1181
- }).verticalAlign("middle").width(range[range.length - 1] - range[0]).x(horizontal ? range[0] : this._orient === "left" ? bounds.x + margin.left / 2 - (range[range.length - 1] - range[0]) / 2 : bounds.x + bounds.width - margin.right / 2 - (range[range.length - 1] - range[0]) / 2).y(horizontal ? this._orient === "bottom" ? bounds.y + bounds.height - margin.bottom : bounds.y : range[0] + (range[range.length - 1] - range[0]) / 2 - margin[this._orient] / 2)// eslint-disable-next-line @typescript-eslint/no-explicit-any
1182
- .config(configPrep.bind(this)(this._titleConfig)).render();
1183
- this._lastScale = this._getPosition.bind(this);
1184
- if (callback) setTimeout(callback, this._duration + 100);
1185
- return this;
1186
- }
1187
- },
1188
- {
1189
- key: "align",
1190
- value: function align(_) {
1191
- return arguments.length ? (this._align = _, this) : this._align;
1192
- }
1193
- },
1194
- {
1195
- key: "barConfig",
1196
- value: function barConfig(_) {
1197
- return arguments.length ? (this._barConfig = Object.assign(this._barConfig, _), this) : this._barConfig;
1198
- }
1199
- },
1200
- {
1201
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1202
- key: "data",
1203
- value: function data(_) {
1204
- return arguments.length ? (this._data = _, this) : this._data;
1205
- }
1206
- },
1207
- {
1208
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1209
- key: "domain",
1210
- value: function domain(_) {
1211
- return arguments.length ? (this._domain = _, this) : this._domain;
1212
- }
1213
- },
1214
- {
1215
- key: "duration",
1216
- value: function duration(_) {
1217
- return arguments.length ? (this._duration = _, this) : this._duration;
1218
- }
1219
- },
1220
- {
1221
- key: "grid",
1222
- value: function grid(_) {
1223
- return arguments.length ? (this._grid = _, this) : this._grid;
1224
- }
1225
- },
1226
- {
1227
- key: "gridConfig",
1228
- value: function gridConfig(_) {
1229
- return arguments.length ? (this._gridConfig = Object.assign(this._gridConfig, _), this) : this._gridConfig;
1230
- }
1231
- },
1232
- {
1233
- key: "gridLog",
1234
- value: function gridLog(_) {
1235
- return arguments.length ? (this._gridLog = _, this) : this._gridLog;
1236
- }
1237
- },
1238
- {
1239
- key: "gridSize",
1240
- value: function gridSize(_) {
1241
- return arguments.length ? (this._gridSize = _, this) : this._gridSize;
1242
- }
1243
- },
1244
- {
1245
- key: "height",
1246
- value: function height(_) {
1247
- return arguments.length ? (this._height = _, this) : this._height;
1248
- }
1249
- },
1250
- {
1251
- key: "labels",
1252
- value: function labels(_) {
1253
- return arguments.length ? (this._labels = _, this) : this._labels;
1254
- }
1255
- },
1256
- {
1257
- key: "labelOffset",
1258
- value: function labelOffset(_) {
1259
- return arguments.length ? (this._labelOffset = _, this) : this._labelOffset;
1260
- }
1261
- },
1262
- {
1263
- key: "labelRotation",
1264
- value: function labelRotation(_) {
1265
- return arguments.length ? (this._labelRotation = _, this) : this._labelRotation;
1266
- }
1267
- },
1268
- {
1269
- key: "maxSize",
1270
- value: function maxSize(_) {
1271
- return arguments.length ? (this._maxSize = _, this) : this._maxSize;
1272
- }
1273
- },
1274
- {
1275
- key: "minSize",
1276
- value: function minSize(_) {
1277
- return arguments.length ? (this._minSize = _, this) : this._minSize;
1278
- }
1279
- },
1280
- {
1281
- key: "orient",
1282
- value: function orient(_) {
1283
- if (arguments.length) {
1284
- var horizontal = [
1285
- "top",
1286
- "bottom"
1287
- ].includes(_), opps = {
1288
- top: "bottom",
1289
- right: "left",
1290
- bottom: "top",
1291
- left: "right"
1292
- };
1293
- this._position = {
1294
- horizontal: horizontal,
1295
- width: horizontal ? "width" : "height",
1296
- height: horizontal ? "height" : "width",
1297
- x: horizontal ? "x" : "y",
1298
- y: horizontal ? "y" : "x",
1299
- opposite: opps[_]
1300
- };
1301
- return this._orient = _, this;
1302
- }
1303
- return this._orient;
1304
- }
1305
- },
1306
- {
1307
- /**
1308
- Returns the outer bounds of the axis content. Must be called after rendering.
1309
- @example
1310
- {"width": 180, "height": 24, "x": 10, "y": 20}
1311
- */ key: "outerBounds",
1312
- value: function outerBounds() {
1313
- return this._outerBounds;
1314
- }
1315
- },
1316
- {
1317
- key: "padding",
1318
- value: function padding(_) {
1319
- return arguments.length ? (this._padding = _, this) : this._padding;
1320
- }
1321
- },
1322
- {
1323
- key: "paddingInner",
1324
- value: function paddingInner(_) {
1325
- return arguments.length ? (this._paddingInner = _, this) : this._paddingInner;
1326
- }
1327
- },
1328
- {
1329
- key: "paddingOuter",
1330
- value: function paddingOuter(_) {
1331
- return arguments.length ? (this._paddingOuter = _, this) : this._paddingOuter;
1332
- }
1333
- },
1334
- {
1335
- key: "range",
1336
- value: function range(_) {
1337
- return arguments.length ? (this._range = _, this) : this._range;
1338
- }
1339
- },
1340
- {
1341
- key: "rounding",
1342
- value: function rounding(_) {
1343
- return arguments.length ? (this._rounding = _, this) : this._rounding;
1344
- }
1345
- },
1346
- {
1347
- key: "roundingInsideMinPrefix",
1348
- value: function roundingInsideMinPrefix(_) {
1349
- return arguments.length ? (this._roundingInsideMinPrefix = _, this) : this._roundingInsideMinPrefix;
1350
- }
1351
- },
1352
- {
1353
- key: "roundingInsideMinSuffix",
1354
- value: function roundingInsideMinSuffix(_) {
1355
- return arguments.length ? (this._roundingInsideMinSuffix = _, this) : this._roundingInsideMinSuffix;
1356
- }
1357
- },
1358
- {
1359
- key: "roundingInsideMaxPrefix",
1360
- value: function roundingInsideMaxPrefix(_) {
1361
- return arguments.length ? (this._roundingInsideMaxPrefix = _, this) : this._roundingInsideMaxPrefix;
1362
- }
1363
- },
1364
- {
1365
- key: "roundingInsideMaxSuffix",
1366
- value: function roundingInsideMaxSuffix(_) {
1367
- return arguments.length ? (this._roundingInsideMaxSuffix = _, this) : this._roundingInsideMaxSuffix;
1368
- }
1369
- },
1370
- {
1371
- key: "scale",
1372
- value: function scale(_) {
1373
- return arguments.length ? (this._scale = _, this) : this._scale;
1374
- }
1375
- },
1376
- {
1377
- key: "scalePadding",
1378
- value: function scalePadding(_) {
1379
- return arguments.length ? (this._scalePadding = _, this) : this._scalePadding;
1380
- }
1381
- },
1382
- {
1383
- key: "select",
1384
- value: function select1(_) {
1385
- return arguments.length ? (this._select = select(_), this) : this._select;
1386
- }
1387
- },
1388
- {
1389
- key: "shape",
1390
- value: function shape(_) {
1391
- return arguments.length ? (this._shape = _, this) : this._shape;
1392
- }
1393
- },
1394
- {
1395
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1396
- key: "shapeConfig",
1397
- value: function shapeConfig(_) {
1398
- return arguments.length ? (this._shapeConfig = assign(this._shapeConfig, _), this) : this._shapeConfig;
1399
- }
1400
- },
1401
- {
1402
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1403
- key: "tickFormat",
1404
- value: function tickFormat(_) {
1405
- return arguments.length ? (this._tickFormat = _, this) : this._tickFormat;
1406
- }
1407
- },
1408
- {
1409
- key: "ticks",
1410
- value: function ticks(_) {
1411
- return arguments.length ? (this._ticks = _, this) : this._ticks;
1412
- }
1413
- },
1414
- {
1415
- key: "tickSize",
1416
- value: function tickSize(_) {
1417
- return arguments.length ? (this._tickSize = _, this) : this._tickSize;
1418
- }
1419
- },
1420
- {
1421
- key: "tickSuffix",
1422
- value: function tickSuffix(_) {
1423
- return arguments.length ? (this._tickSuffix = _, this) : this._tickSuffix;
1424
- }
1425
- },
1426
- {
1427
- key: "timeLocale",
1428
- value: function timeLocale(_) {
1429
- return arguments.length ? (this._timeLocale = _, this) : this._timeLocale;
1430
- }
1431
- },
1432
- {
1433
- key: "title",
1434
- value: function title(_) {
1435
- return arguments.length ? (this._title = _, this) : this._title;
1436
- }
1437
- },
1438
- {
1439
- key: "titleConfig",
1440
- value: function titleConfig(_) {
1441
- return arguments.length ? (this._titleConfig = Object.assign(this._titleConfig, _), this) : this._titleConfig;
1442
- }
1443
- },
1444
- {
1445
- key: "width",
1446
- value: function width(_) {
1447
- return arguments.length ? (this._width = _, this) : this._width;
1448
- }
1449
- }
1450
- ]);
1451
- return Axis;
1452
- }(BaseClass);
1453
- /**
1454
- Creates an SVG scale based on an array of data.
1455
- */ export { Axis as default };
1456
-
1457
- //# sourceMappingURL=Axis.js.map