@mathstack/viz 2.0.3 → 2.2.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 (448) hide show
  1. package/fesm2022/mathstack-viz.mjs +11024 -0
  2. package/fesm2022/mathstack-viz.mjs.map +1 -0
  3. package/package.json +14 -5
  4. package/types/mathstack-viz.d.ts +5830 -0
  5. package/CHANGELOG.md +0 -0
  6. package/cypress/fixtures/example.json +0 -5
  7. package/cypress/fixtures/usMap.json +0 -13511
  8. package/cypress/support/commands.ts +0 -104
  9. package/cypress/support/component-index.html +0 -12
  10. package/cypress/support/component.ts +0 -33
  11. package/cypress.config.ts +0 -9
  12. package/karma.conf.js +0 -62
  13. package/ng-package.json +0 -8
  14. package/project.json +0 -97
  15. package/src/.eslintrc.json +0 -35
  16. package/src/.prettierrc +0 -31
  17. package/src/lib/axes/base/config/xy-axis-builder.ts +0 -68
  18. package/src/lib/axes/base/config/xy-axis-config.ts +0 -35
  19. package/src/lib/axes/base/config/xy-axis-options.ts +0 -11
  20. package/src/lib/axes/base/xy-axis-base.spec.ts +0 -114
  21. package/src/lib/axes/base/xy-axis-base.ts +0 -300
  22. package/src/lib/axes/base/xy-axis-domain-lines.cy.ts +0 -511
  23. package/src/lib/axes/baseline/axis-baseline-builder.ts +0 -77
  24. package/src/lib/axes/baseline/axis-baseline-options.ts +0 -4
  25. package/src/lib/axes/baseline/axis-baseline.ts +0 -11
  26. package/src/lib/axes/grid/grid-builder.ts +0 -74
  27. package/src/lib/axes/grid/grid-config.ts +0 -13
  28. package/src/lib/axes/grid/grid-options.ts +0 -7
  29. package/src/lib/axes/index.ts +0 -40
  30. package/src/lib/axes/label/axis-label-builder.ts +0 -140
  31. package/src/lib/axes/label/axis-label-options.ts +0 -12
  32. package/src/lib/axes/label/axis-label.ts +0 -18
  33. package/src/lib/axes/label/axis-labels.cy.ts +0 -303
  34. package/src/lib/axes/ordinal/ordinal-axis-config.ts +0 -31
  35. package/src/lib/axes/ordinal/ordinal-axis.spec.ts +0 -30
  36. package/src/lib/axes/ordinal/ordinal-axis.ts +0 -26
  37. package/src/lib/axes/quantitative/quantitative-axis-config.ts +0 -39
  38. package/src/lib/axes/quantitative/quantitative-axis-ticks.cy.ts +0 -748
  39. package/src/lib/axes/quantitative/quantitative-axis.spec.ts +0 -537
  40. package/src/lib/axes/quantitative/quantitative-axis.ts +0 -191
  41. package/src/lib/axes/ticks/tick-wrap/tick-wrap-builder.ts +0 -141
  42. package/src/lib/axes/ticks/tick-wrap/tick-wrap-options.ts +0 -11
  43. package/src/lib/axes/ticks/tick-wrap/tick-wrap.cy.ts +0 -360
  44. package/src/lib/axes/ticks/tick-wrap/tick-wrap.ts +0 -21
  45. package/src/lib/axes/ticks/ticks-builder.ts +0 -370
  46. package/src/lib/axes/ticks/ticks-options.ts +0 -24
  47. package/src/lib/axes/ticks/ticks.ts +0 -33
  48. package/src/lib/axes/x/x-axis-config.ts +0 -48
  49. package/src/lib/axes/x/x-axis.spec.ts +0 -90
  50. package/src/lib/axes/x/x-axis.ts +0 -109
  51. package/src/lib/axes/x-ordinal/x-ordinal-axis-builder.ts +0 -75
  52. package/src/lib/axes/x-ordinal/x-ordinal-axis-config.ts +0 -27
  53. package/src/lib/axes/x-ordinal/x-ordinal-axis.component.ts +0 -33
  54. package/src/lib/axes/x-quantitative/x-quantitative-axis-builder.ts +0 -74
  55. package/src/lib/axes/x-quantitative/x-quantitative-axis-config.ts +0 -32
  56. package/src/lib/axes/x-quantitative/x-quantitative-axis.component.ts +0 -40
  57. package/src/lib/axes/xy-axis.module.ts +0 -20
  58. package/src/lib/axes/y/y-axis-config.ts +0 -47
  59. package/src/lib/axes/y/y-axis.spec.ts +0 -92
  60. package/src/lib/axes/y/y-axis.ts +0 -161
  61. package/src/lib/axes/y-ordinal/y-ordinal-axis-builder.ts +0 -76
  62. package/src/lib/axes/y-ordinal/y-ordinal-axis-config.ts +0 -29
  63. package/src/lib/axes/y-ordinal/y-ordinal-axis.component.ts +0 -33
  64. package/src/lib/axes/y-quantitative-axis/y-quantitative-axis-builder.ts +0 -74
  65. package/src/lib/axes/y-quantitative-axis/y-quantitative-axis-config.ts +0 -34
  66. package/src/lib/axes/y-quantitative-axis/y-quantitative-axis.component.ts +0 -40
  67. package/src/lib/bars/bars.component.scss +0 -0
  68. package/src/lib/bars/bars.component.spec.ts +0 -1470
  69. package/src/lib/bars/bars.component.ts +0 -717
  70. package/src/lib/bars/bars.cy.ts +0 -829
  71. package/src/lib/bars/bars.module.ts +0 -9
  72. package/src/lib/bars/config/backgrounds/bars-backgrounds-builder.ts +0 -51
  73. package/src/lib/bars/config/backgrounds/bars-backgrounds-options.ts +0 -4
  74. package/src/lib/bars/config/backgrounds/bars-backgrounds.ts +0 -11
  75. package/src/lib/bars/config/bars-builder.ts +0 -340
  76. package/src/lib/bars/config/bars-config.spec.ts +0 -132
  77. package/src/lib/bars/config/bars-config.ts +0 -70
  78. package/src/lib/bars/config/bars-dimensions.ts +0 -29
  79. package/src/lib/bars/config/bars-options.ts +0 -20
  80. package/src/lib/bars/config/labels/bars-labels-builder.ts +0 -89
  81. package/src/lib/bars/config/labels/bars-labels-options.ts +0 -6
  82. package/src/lib/bars/config/labels/bars-labels.cy.ts +0 -781
  83. package/src/lib/bars/config/labels/bars-labels.ts +0 -13
  84. package/src/lib/bars/events/actions/bars-click-actions.ts +0 -23
  85. package/src/lib/bars/events/actions/bars-hover-actions.ts +0 -43
  86. package/src/lib/bars/events/actions/bars-hover-move-actions.ts +0 -21
  87. package/src/lib/bars/events/bars-events.directive.spec.ts +0 -186
  88. package/src/lib/bars/events/bars-events.directive.ts +0 -235
  89. package/src/lib/bars/events/bars-interaction-output.ts +0 -17
  90. package/src/lib/bars/events/bars-tooltip-positioner.ts +0 -24
  91. package/src/lib/bars/index.ts +0 -18
  92. package/src/lib/charts/chart/chart-scaling.cy.ts +0 -323
  93. package/src/lib/charts/chart/chart.component.html +0 -45
  94. package/src/lib/charts/chart/chart.component.scss +0 -37
  95. package/src/lib/charts/chart/chart.component.ts +0 -243
  96. package/src/lib/charts/chart/chart.token.ts +0 -4
  97. package/src/lib/charts/chart/chart.ts +0 -5
  98. package/src/lib/charts/chart/config/chart-builder.ts +0 -194
  99. package/src/lib/charts/chart/config/chart-config.ts +0 -21
  100. package/src/lib/charts/chart/config/chart-options.ts +0 -11
  101. package/src/lib/charts/chart.module.ts +0 -10
  102. package/src/lib/charts/index.ts +0 -9
  103. package/src/lib/charts/map-chart/map-chart.component.scss +0 -0
  104. package/src/lib/charts/map-chart/map-chart.component.spec.ts +0 -35
  105. package/src/lib/charts/map-chart/map-chart.component.ts +0 -61
  106. package/src/lib/charts/xy-chart/xy-chart.component.spec.ts +0 -34
  107. package/src/lib/charts/xy-chart/xy-chart.component.ts +0 -65
  108. package/src/lib/core/common-behaviors/constructor.ts +0 -7
  109. package/src/lib/core/index.ts +0 -11
  110. package/src/lib/core/pipes/resize-chart-height.pipe.spec.ts +0 -23
  111. package/src/lib/core/pipes/resize-chart-height.pipe.ts +0 -20
  112. package/src/lib/core/styles/_spacing.scss +0 -4
  113. package/src/lib/core/types/layout.ts +0 -28
  114. package/src/lib/core/types/scale.ts +0 -6
  115. package/src/lib/core/types/utility.ts +0 -11
  116. package/src/lib/core/types/values.ts +0 -10
  117. package/src/lib/core/utilities/colors.spec.ts +0 -57
  118. package/src/lib/core/utilities/colors.ts +0 -42
  119. package/src/lib/core/utilities/fill-utilities.spec.ts +0 -25
  120. package/src/lib/core/utilities/fill-utilities.ts +0 -21
  121. package/src/lib/core/utilities/type-guards.spec.ts +0 -55
  122. package/src/lib/core/utilities/type-guards.ts +0 -33
  123. package/src/lib/core/utilities/value-format.ts +0 -21
  124. package/src/lib/core/utilities/values.spec.ts +0 -954
  125. package/src/lib/core/utilities/values.ts +0 -189
  126. package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position-builder.ts +0 -105
  127. package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position-options.ts +0 -24
  128. package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position.spec.ts +0 -66
  129. package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position.ts +0 -72
  130. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/concrete-domain-padding.ts +0 -10
  131. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/domain-padding.ts +0 -76
  132. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/domain-test-utility.ts +0 -130
  133. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/percent-over/percent-over-options.ts +0 -3
  134. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/percent-over/percent-over.ts +0 -37
  135. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/pixel/pixel-options.ts +0 -3
  136. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/pixel/pixel.ts +0 -73
  137. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/quantitative-domain-padding.cy.ts +0 -978
  138. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-interval/round-to-interval-options.ts +0 -3
  139. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-interval/round-to-interval.ts +0 -27
  140. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-sig-fig/round-to-sig-fig-options.ts +0 -3
  141. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-sig-fig/round-to-sig-fig.ts +0 -30
  142. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position-builder.ts +0 -183
  143. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position-options.ts +0 -8
  144. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position.spec.ts +0 -28
  145. package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position.ts +0 -62
  146. package/src/lib/data-dimensions/continuous-quantitative/number-dimension/number-dimension-options.ts +0 -15
  147. package/src/lib/data-dimensions/continuous-quantitative/number-dimension/number-dimension.spec.ts +0 -155
  148. package/src/lib/data-dimensions/continuous-quantitative/number-dimension/number-dimension.ts +0 -57
  149. package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value-builder.ts +0 -166
  150. package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value-options.ts +0 -10
  151. package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value.spec.ts +0 -34
  152. package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value.ts +0 -57
  153. package/src/lib/data-dimensions/dimension-builder.ts +0 -45
  154. package/src/lib/data-dimensions/dimension-options.ts +0 -12
  155. package/src/lib/data-dimensions/dimension.ts +0 -30
  156. package/src/lib/data-dimensions/index.ts +0 -31
  157. package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position-builder.ts +0 -122
  158. package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position-options.ts +0 -12
  159. package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position.spec.ts +0 -83
  160. package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position.ts +0 -101
  161. package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value-builder.ts +0 -108
  162. package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value-options.ts +0 -12
  163. package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value.cy.ts +0 -384
  164. package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value.spec.ts +0 -63
  165. package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value.ts +0 -79
  166. package/src/lib/data-export/data-export-config.ts +0 -98
  167. package/src/lib/data-export/data-export.spec.ts +0 -33
  168. package/src/lib/data-export/data-export.ts +0 -87
  169. package/src/lib/data-export/index.ts +0 -2
  170. package/src/lib/dots/config/dots-builder.ts +0 -442
  171. package/src/lib/dots/config/dots-config.spec.ts +0 -123
  172. package/src/lib/dots/config/dots-config.ts +0 -81
  173. package/src/lib/dots/config/dots-options.ts +0 -32
  174. package/src/lib/dots/dots.component.scss +0 -0
  175. package/src/lib/dots/dots.component.spec.ts +0 -143
  176. package/src/lib/dots/dots.component.ts +0 -291
  177. package/src/lib/dots/dots.cy.ts +0 -594
  178. package/src/lib/dots/dots.module.ts +0 -9
  179. package/src/lib/dots/events/actions/dots-hover-actions.ts +0 -19
  180. package/src/lib/dots/events/actions/dots-hover-move-actions.ts +0 -38
  181. package/src/lib/dots/events/dots-events.directive.ts +0 -214
  182. package/src/lib/dots/events/dots-interaction-output.ts +0 -15
  183. package/src/lib/dots/events/dots-tooltip-positioner.ts +0 -24
  184. package/src/lib/dots/index.ts +0 -10
  185. package/src/lib/events/events.directive.ts +0 -184
  186. package/src/lib/events/events.types.ts +0 -57
  187. package/src/lib/events/index.ts +0 -4
  188. package/src/lib/events/interaction-output.ts +0 -34
  189. package/src/lib/events/tooltip-positioner.ts +0 -15
  190. package/src/lib/fill-definitions/fill-definitions.ts +0 -4
  191. package/src/lib/fill-definitions/index.ts +0 -1
  192. package/src/lib/geographies/config/geographies-builder.ts +0 -224
  193. package/src/lib/geographies/config/geographies-config.spec.ts +0 -100
  194. package/src/lib/geographies/config/geographies-config.ts +0 -81
  195. package/src/lib/geographies/config/geographies-options.ts +0 -37
  196. package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer-builder.ts +0 -212
  197. package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer-options.ts +0 -26
  198. package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer.spec.ts +0 -119
  199. package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer.ts +0 -148
  200. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data/attribute-data-dimension-builder.ts +0 -65
  201. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data/attribute-data-dimension-options.ts +0 -15
  202. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data/attribute-data-dimension.ts +0 -32
  203. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data-bin-enums.ts +0 -10
  204. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data-bin-types.ts +0 -15
  205. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins-builder.ts +0 -18
  206. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins-options.ts +0 -8
  207. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins.spec.ts +0 -60
  208. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins.ts +0 -34
  209. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins-builder.ts +0 -46
  210. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins-options.ts +0 -8
  211. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins.cy.ts +0 -437
  212. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins.spec.ts +0 -105
  213. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins.ts +0 -54
  214. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins-builder.ts +0 -65
  215. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins-options.ts +0 -9
  216. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins.spec.ts +0 -82
  217. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins.ts +0 -81
  218. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks.cy.ts +0 -378
  219. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins-builder.ts +0 -50
  220. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins-options.ts +0 -8
  221. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins.cy.ts +0 -362
  222. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins.spec.ts +0 -72
  223. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins.ts +0 -56
  224. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins-builder.ts +0 -60
  225. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins-options.ts +0 -9
  226. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins.cy.ts +0 -307
  227. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins.spec.ts +0 -104
  228. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins.ts +0 -89
  229. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins-builder.ts +0 -62
  230. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins-options.ts +0 -8
  231. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.cy.ts +0 -265
  232. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.spec.ts +0 -42
  233. package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.ts +0 -42
  234. package/src/lib/geographies/config/layers/geographies-layer/geographies-layer-builder.ts +0 -116
  235. package/src/lib/geographies/config/layers/geographies-layer/geographies-layer-options.ts +0 -20
  236. package/src/lib/geographies/config/layers/geographies-layer/geographies-layer.ts +0 -104
  237. package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer-builder.ts +0 -111
  238. package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer-options.ts +0 -19
  239. package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer.spec.ts +0 -41
  240. package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer.ts +0 -67
  241. package/src/lib/geographies/config/layers/labels/geographies-labels-builder.ts +0 -269
  242. package/src/lib/geographies/config/layers/labels/geographies-labels-options.ts +0 -45
  243. package/src/lib/geographies/config/layers/labels/geographies-labels.ts +0 -38
  244. package/src/lib/geographies/events/actions/geographies-click-actions.ts +0 -21
  245. package/src/lib/geographies/events/actions/geographies-hover-actions.ts +0 -17
  246. package/src/lib/geographies/events/actions/geographies-hover-move-actions.ts +0 -19
  247. package/src/lib/geographies/events/geographies-events.directive.spec.ts +0 -225
  248. package/src/lib/geographies/events/geographies-events.directive.ts +0 -235
  249. package/src/lib/geographies/events/geographies-interaction-output.ts +0 -17
  250. package/src/lib/geographies/events/geographies-tooltip-positioner.ts +0 -23
  251. package/src/lib/geographies/geographies-feature.ts +0 -16
  252. package/src/lib/geographies/geographies.component.html +0 -1
  253. package/src/lib/geographies/geographies.component.scss +0 -0
  254. package/src/lib/geographies/geographies.component.spec.ts +0 -148
  255. package/src/lib/geographies/geographies.component.ts +0 -318
  256. package/src/lib/geographies/geographies.cy.ts +0 -640
  257. package/src/lib/geographies/geographies.module.ts +0 -9
  258. package/src/lib/geographies/index.ts +0 -32
  259. package/src/lib/grouped-bars/config/grouped-bars-builder.ts +0 -66
  260. package/src/lib/grouped-bars/config/grouped-bars-config.ts +0 -41
  261. package/src/lib/grouped-bars/config/grouped-bars-options.ts +0 -9
  262. package/src/lib/grouped-bars/events/grouped-bars-events.directive.ts +0 -221
  263. package/src/lib/grouped-bars/grouped-bars.component.scss +0 -0
  264. package/src/lib/grouped-bars/grouped-bars.component.spec.ts +0 -25
  265. package/src/lib/grouped-bars/grouped-bars.component.ts +0 -94
  266. package/src/lib/grouped-bars/grouped-bars.module.ts +0 -9
  267. package/src/lib/grouped-bars/index.ts +0 -10
  268. package/src/lib/image-download/image-download-config.ts +0 -57
  269. package/src/lib/image-download/image-download-enums.ts +0 -7
  270. package/src/lib/image-download/image-download-options.ts +0 -14
  271. package/src/lib/image-download/image-download.service.ts +0 -70
  272. package/src/lib/image-download/index.ts +0 -4
  273. package/src/lib/lines/config/area-fills/area-fills-builder.ts +0 -87
  274. package/src/lib/lines/config/area-fills/area-fills-options.ts +0 -8
  275. package/src/lib/lines/config/area-fills/area-fills.ts +0 -14
  276. package/src/lib/lines/config/lines-builder.ts +0 -242
  277. package/src/lib/lines/config/lines-config.spec.ts +0 -52
  278. package/src/lib/lines/config/lines-config.ts +0 -96
  279. package/src/lib/lines/config/lines-options.ts +0 -19
  280. package/src/lib/lines/config/stroke/lines-stroke-builder.ts +0 -135
  281. package/src/lib/lines/config/stroke/lines-stroke-options.ts +0 -6
  282. package/src/lib/lines/config/stroke/lines-stroke.ts +0 -15
  283. package/src/lib/lines/events/actions/lines-click-actions.ts +0 -17
  284. package/src/lib/lines/events/actions/lines-hover-move-actions.ts +0 -113
  285. package/src/lib/lines/events/actions/lines-marker-click-actions.ts +0 -29
  286. package/src/lib/lines/events/lines-events.directive.spec.ts +0 -152
  287. package/src/lib/lines/events/lines-events.directive.ts +0 -310
  288. package/src/lib/lines/events/lines-interaction-output.ts +0 -17
  289. package/src/lib/lines/events/lines-tooltip-positioner.ts +0 -24
  290. package/src/lib/lines/index.ts +0 -17
  291. package/src/lib/lines/lines.component.scss +0 -0
  292. package/src/lib/lines/lines.component.spec.ts +0 -95
  293. package/src/lib/lines/lines.component.ts +0 -425
  294. package/src/lib/lines/lines.cy.ts +0 -738
  295. package/src/lib/lines/lines.module.ts +0 -9
  296. package/src/lib/map-legend/continuous-legend/continuous-legend.component.html +0 -28
  297. package/src/lib/map-legend/continuous-legend/continuous-legend.component.scss +0 -76
  298. package/src/lib/map-legend/continuous-legend/continuous-legend.component.spec.ts +0 -61
  299. package/src/lib/map-legend/continuous-legend/continuous-legend.component.ts +0 -82
  300. package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.html +0 -40
  301. package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.scss +0 -141
  302. package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.spec.ts +0 -75
  303. package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.ts +0 -57
  304. package/src/lib/map-legend/index.ts +0 -2
  305. package/src/lib/map-legend/map-legend-base.spec.ts +0 -190
  306. package/src/lib/map-legend/map-legend-base.ts +0 -99
  307. package/src/lib/map-legend/map-legend.component.html +0 -24
  308. package/src/lib/map-legend/map-legend.component.scss +0 -0
  309. package/src/lib/map-legend/map-legend.component.spec.ts +0 -125
  310. package/src/lib/map-legend/map-legend.component.ts +0 -80
  311. package/src/lib/map-legend/map-legend.module.ts +0 -8
  312. package/src/lib/marks/aux-marks/aux-marks.ts +0 -18
  313. package/src/lib/marks/aux-marks/config/aux-marks-builder.ts +0 -25
  314. package/src/lib/marks/aux-marks/config/aux-marks-config.ts +0 -6
  315. package/src/lib/marks/config/marks-config.ts +0 -14
  316. package/src/lib/marks/config/marks-options.ts +0 -9
  317. package/src/lib/marks/index.ts +0 -15
  318. package/src/lib/marks/map-marks/map-aux-marks/map-aux-marks.spec.ts +0 -74
  319. package/src/lib/marks/map-marks/map-aux-marks/map-aux-marks.ts +0 -40
  320. package/src/lib/marks/map-marks/map-primary-marks/map-primary-marks.spec.ts +0 -79
  321. package/src/lib/marks/map-marks/map-primary-marks/map-primary-marks.ts +0 -63
  322. package/src/lib/marks/marks.ts +0 -39
  323. package/src/lib/marks/primary-marks/config/primary-marks-builder.ts +0 -75
  324. package/src/lib/marks/primary-marks/config/primary-marks-config.ts +0 -9
  325. package/src/lib/marks/primary-marks/primary-marks-base.spec.ts +0 -58
  326. package/src/lib/marks/primary-marks/primary-marks.ts +0 -43
  327. package/src/lib/marks/xy-marks/xy-aux-marks/xy-aux-marks.ts +0 -40
  328. package/src/lib/marks/xy-marks/xy-marks-config.ts +0 -5
  329. package/src/lib/marks/xy-marks/xy-marks.ts +0 -10
  330. package/src/lib/marks/xy-marks/xy-primary-marks/xy-primary-marks-config.ts +0 -7
  331. package/src/lib/marks/xy-marks/xy-primary-marks/xy-primary-marks.spec.ts +0 -186
  332. package/src/lib/marks/xy-marks/xy-primary-marks/xy-primary-marks.ts +0 -72
  333. package/src/lib/point-markers/index.ts +0 -3
  334. package/src/lib/point-markers/point-markers-builder.ts +0 -93
  335. package/src/lib/point-markers/point-markers-options.ts +0 -6
  336. package/src/lib/point-markers/point-markers.ts +0 -13
  337. package/src/lib/quantitative-rules/config/labels/quantitative-rules-labels-builder.ts +0 -162
  338. package/src/lib/quantitative-rules/config/labels/quantitative-rules-labels-options.ts +0 -17
  339. package/src/lib/quantitative-rules/config/labels/quantitative-rules-labels.ts +0 -26
  340. package/src/lib/quantitative-rules/config/quantitative-rules-builder.ts +0 -134
  341. package/src/lib/quantitative-rules/config/quantitative-rules-config.ts +0 -21
  342. package/src/lib/quantitative-rules/config/quantitative-rules-dimensions.ts +0 -20
  343. package/src/lib/quantitative-rules/config/quantitative-rules-options.ts +0 -13
  344. package/src/lib/quantitative-rules/index.ts +0 -6
  345. package/src/lib/quantitative-rules/quantitative-rules.component.scss +0 -3
  346. package/src/lib/quantitative-rules/quantitative-rules.component.spec.ts +0 -50
  347. package/src/lib/quantitative-rules/quantitative-rules.component.ts +0 -224
  348. package/src/lib/quantitative-rules/quantitative-rules.cy.ts +0 -549
  349. package/src/lib/quantitative-rules/quantitative-rules.module.ts +0 -8
  350. package/src/lib/stacked-area/config/stacked-area-builder.ts +0 -264
  351. package/src/lib/stacked-area/config/stacked-area-config.spec.ts +0 -107
  352. package/src/lib/stacked-area/config/stacked-area-config.ts +0 -109
  353. package/src/lib/stacked-area/config/stacked-area-options.ts +0 -28
  354. package/src/lib/stacked-area/events/actions/stacked-area-hover-move-actions.ts +0 -17
  355. package/src/lib/stacked-area/events/stacked-area-events.directive.spec.ts +0 -168
  356. package/src/lib/stacked-area/events/stacked-area-events.directive.ts +0 -272
  357. package/src/lib/stacked-area/events/stacked-area-interaction-output.ts +0 -33
  358. package/src/lib/stacked-area/events/stacked-area-tooltip-positioner.ts +0 -37
  359. package/src/lib/stacked-area/index.ts +0 -7
  360. package/src/lib/stacked-area/stacked-area.component.scss +0 -0
  361. package/src/lib/stacked-area/stacked-area.component.spec.ts +0 -41
  362. package/src/lib/stacked-area/stacked-area.component.ts +0 -241
  363. package/src/lib/stacked-area/stacked-area.module.ts +0 -9
  364. package/src/lib/stacked-bars/config/stacked-bars-builder.ts +0 -109
  365. package/src/lib/stacked-bars/config/stacked-bars-config.spec.ts +0 -122
  366. package/src/lib/stacked-bars/config/stacked-bars-config.ts +0 -79
  367. package/src/lib/stacked-bars/config/stacked-bars-options.ts +0 -16
  368. package/src/lib/stacked-bars/events/actions/stacked-bars-click-actions.ts +0 -23
  369. package/src/lib/stacked-bars/events/actions/stacked-bars-hover-actions.ts +0 -22
  370. package/src/lib/stacked-bars/events/actions/stacked-bars-hover-move-actions.ts +0 -21
  371. package/src/lib/stacked-bars/events/stacked-bars-events.directive.spec.ts +0 -266
  372. package/src/lib/stacked-bars/events/stacked-bars-events.directive.ts +0 -240
  373. package/src/lib/stacked-bars/index.ts +0 -10
  374. package/src/lib/stacked-bars/stacked-bars.component.scss +0 -0
  375. package/src/lib/stacked-bars/stacked-bars.component.spec.ts +0 -25
  376. package/src/lib/stacked-bars/stacked-bars.component.ts +0 -158
  377. package/src/lib/stacked-bars/stacked-bars.module.ts +0 -9
  378. package/src/lib/stroke/base/stroke-base-options.ts +0 -7
  379. package/src/lib/stroke/base/stroke-base.ts +0 -9
  380. package/src/lib/stroke/index.ts +0 -5
  381. package/src/lib/stroke/stroke-builder.ts +0 -103
  382. package/src/lib/stroke/stroke-options.ts +0 -5
  383. package/src/lib/stroke/stroke.ts +0 -12
  384. package/src/lib/svg-text-wrap/index.ts +0 -3
  385. package/src/lib/svg-text-wrap/svg-text-wrap-builder.ts +0 -105
  386. package/src/lib/svg-text-wrap/svg-text-wrap-options.ts +0 -8
  387. package/src/lib/svg-text-wrap/svg-text-wrap.ts +0 -137
  388. package/src/lib/testing/data/continent-population-year-data.ts +0 -126
  389. package/src/lib/testing/data/country-area-continent.ts +0 -59
  390. package/src/lib/testing/data/state-population-income-year-data.ts +0 -123
  391. package/src/lib/testing/stubs/bars.component.stub.ts +0 -12
  392. package/src/lib/testing/stubs/chart.component.stub.ts +0 -6
  393. package/src/lib/testing/stubs/click.directive.stub.ts +0 -15
  394. package/src/lib/testing/stubs/core/destroy-ref.stub.ts +0 -9
  395. package/src/lib/testing/stubs/core/overlay-ref.stub.ts +0 -13
  396. package/src/lib/testing/stubs/core/overlay.stub.ts +0 -8
  397. package/src/lib/testing/stubs/event.directive.stub.ts +0 -10
  398. package/src/lib/testing/stubs/hover-move.directive.stub.ts +0 -17
  399. package/src/lib/testing/stubs/hover.directive.stub.ts +0 -14
  400. package/src/lib/testing/stubs/input-event.directive.stub.ts +0 -9
  401. package/src/lib/testing/stubs/lines.component.stub.ts +0 -13
  402. package/src/lib/testing/stubs/map-aux-marks.stub.ts +0 -10
  403. package/src/lib/testing/stubs/map-chart.component.stub.ts +0 -3
  404. package/src/lib/testing/stubs/map-legend-content.stub.ts +0 -16
  405. package/src/lib/testing/stubs/map-legend.component.stub.ts +0 -10
  406. package/src/lib/testing/stubs/map-primary-marks.stub.ts +0 -16
  407. package/src/lib/testing/stubs/ordinal-axis.stub.ts +0 -18
  408. package/src/lib/testing/stubs/primary-marks.stub.ts +0 -18
  409. package/src/lib/testing/stubs/quantitative-axis.stub.ts +0 -18
  410. package/src/lib/testing/stubs/services/main.service.stub.ts +0 -5
  411. package/src/lib/testing/stubs/services/utilities.service.stub.ts +0 -7
  412. package/src/lib/testing/stubs/stacked-area.component.stub.ts +0 -13
  413. package/src/lib/testing/stubs/x-axis.stub.ts +0 -10
  414. package/src/lib/testing/stubs/xy-axis.class.stub.ts +0 -20
  415. package/src/lib/testing/stubs/xy-axis.stub.ts +0 -44
  416. package/src/lib/testing/stubs/xy-chart.component.stub.ts +0 -5
  417. package/src/lib/testing/stubs/xy-data-marks.stub.ts +0 -15
  418. package/src/lib/testing/stubs/y-axis.stub.ts +0 -15
  419. package/src/lib/tooltips/config/tooltip.ts +0 -11
  420. package/src/lib/tooltips/html-tooltip/config/html-tooltip-builder.ts +0 -134
  421. package/src/lib/tooltips/html-tooltip/config/html-tooltip-config.ts +0 -21
  422. package/src/lib/tooltips/html-tooltip/config/html-tooltip-options.ts +0 -12
  423. package/src/lib/tooltips/html-tooltip/config/position/tooltip-position-builder.ts +0 -191
  424. package/src/lib/tooltips/html-tooltip/config/position/tooltip-position.ts +0 -42
  425. package/src/lib/tooltips/html-tooltip/config/size/tooltip-size-builder.ts +0 -75
  426. package/src/lib/tooltips/html-tooltip/config/size/tooltip-size-options.ts +0 -8
  427. package/src/lib/tooltips/html-tooltip/config/size/tooltip-size.ts +0 -15
  428. package/src/lib/tooltips/html-tooltip/html-tooltip.directive.spec.ts +0 -537
  429. package/src/lib/tooltips/html-tooltip/html-tooltip.directive.ts +0 -210
  430. package/src/lib/tooltips/html-tooltip/html-tooltip.module.ts +0 -16
  431. package/src/lib/tooltips/html-tooltip/tooltip-triangle/tooltip-triangle.component.html +0 -41
  432. package/src/lib/tooltips/html-tooltip/tooltip-triangle/tooltip-triangle.component.scss +0 -63
  433. package/src/lib/tooltips/html-tooltip/tooltip-triangle/tooltip-triangle.component.ts +0 -19
  434. package/src/lib/tooltips/index.ts +0 -11
  435. package/src/lib/tooltips/svg-tooltip/config/svg-tooltip.ts +0 -5
  436. package/src/lib/xy-background/index.ts +0 -2
  437. package/src/lib/xy-background/xy-background.component.html +0 -10
  438. package/src/lib/xy-background/xy-background.component.scss +0 -0
  439. package/src/lib/xy-background/xy-background.component.spec.ts +0 -24
  440. package/src/lib/xy-background/xy-background.component.ts +0 -19
  441. package/src/lib/xy-background/xy-background.module.ts +0 -8
  442. package/src/public-api.ts +0 -26
  443. package/src/test.ts +0 -15
  444. package/tsconfig.doc.json +0 -4
  445. package/tsconfig.json +0 -20
  446. package/tsconfig.lib.json +0 -23
  447. package/tsconfig.lib.prod.json +0 -10
  448. package/tsconfig.spec.json +0 -10
@@ -1,224 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { safeAssign } from '@mathstack/app-kit';
3
- import {
4
- ExtendedFeature,
5
- ExtendedFeatureCollection,
6
- ExtendedGeometryCollection,
7
- geoAlbersUsa,
8
- GeoGeometryObjects,
9
- GeoProjection,
10
- } from 'd3';
11
- import { GeoJsonProperties, Geometry, MultiPolygon, Polygon } from 'geojson';
12
- import { GeographiesFeature } from '../geographies-feature';
13
- import { GeographiesConfig } from './geographies-config';
14
- import { GeographiesAttributeDataLayerBuilder } from './layers/attribute-data-layer/attribute-data-layer-builder';
15
- import { GeographiesGeojsonPropertiesLayerBuilder } from './layers/geojson-properties-layer/geojson-properties-layer-builder';
16
-
17
- const DEFAULT = {
18
- _class: () => '',
19
- _projection: geoAlbersUsa(),
20
- _mixBlendMode: 'normal',
21
- };
22
-
23
- /** Builds a configuration object for a GeographiesComponent.
24
- *
25
- * Must be added to a providers array in or above the component that consumes it if it is injected via the constructor. (e.g. `providers: [VicGeographiesBuilder]` in the component decorator)
26
- *
27
- * The first generic parameter, Datum, is the type of the attribute data that will be used to shade the map areas.
28
- *
29
- * The second generic parameter, TProperties, is the type of the properties object that is associated with the GeoJson.
30
- *
31
- * The optional third generic parameter, TGeometry, is the type of the geometry object that is associated with the GeoJson. It defaults to MultiPolygon | Polygon if not provided.
32
- */
33
- @Injectable()
34
- export class VicGeographiesConfigBuilder<
35
- Datum,
36
- TProperties extends GeoJsonProperties,
37
- TGeometry extends Geometry = MultiPolygon | Polygon,
38
- > {
39
- private _boundary:
40
- | ExtendedFeature
41
- | ExtendedFeatureCollection
42
- | GeoGeometryObjects
43
- | ExtendedGeometryCollection;
44
- protected _class: (d: Datum) => string;
45
- private _featureIndexAccessor: (
46
- d: GeographiesFeature<TProperties, TGeometry>
47
- ) => string;
48
- private _mixBlendMode: string;
49
- private _projection: GeoProjection;
50
- private attributeDataBuilder: GeographiesAttributeDataLayerBuilder<
51
- Datum,
52
- TProperties,
53
- TGeometry
54
- >;
55
- public geojsonBuilders: GeographiesGeojsonPropertiesLayerBuilder<
56
- TProperties,
57
- TGeometry
58
- >[] = [];
59
-
60
- constructor() {
61
- safeAssign(this, DEFAULT);
62
- }
63
-
64
- /**
65
- * REQUIRED. Sets a feature or geometry object or collection that defines the extents of the map to be drawn.
66
- *
67
- * Used for scaling the map.
68
- */
69
- boundary(
70
- boundary:
71
- | ExtendedFeature
72
- | ExtendedFeatureCollection
73
- | GeoGeometryObjects
74
- | ExtendedGeometryCollection
75
- ): this {
76
- this._boundary = boundary;
77
- return this;
78
- }
79
-
80
- /**
81
- * REQUIRED. Sets a function that derives an identifying string from the GeoJson feature.
82
- */
83
- featureIndexAccessor(
84
- accessor: (d: GeographiesFeature<TProperties, TGeometry>) => string
85
- ): this {
86
- this._featureIndexAccessor = accessor;
87
- return this;
88
- }
89
-
90
- /**
91
- * OPTIONAL. Creates a configuration object for a layer that will be drawn and styled using solely the properties on a geojson feature.
92
- *
93
- * This might be used for to draw the outline of a country, for example. It could also shade the area of a country based on a property of the geojson feature.
94
- *
95
- * If events are enabled, the geojson properties will be used to populate the tooltip.
96
- *
97
- * This method can be called multiple times to create multiple layers. If this method is called with null, all layers will be removed. (Though subsequent calls can be made to add new layers.)
98
- *
99
- * The order in which layers are created will determine the order in which they are drawn.
100
- *
101
- * Multiple layers can be used to draw different parts of the map with different styles.
102
- */
103
- geojsonPropertiesLayer(geojson: null): this;
104
- geojsonPropertiesLayer(
105
- geojson: (
106
- geojson: GeographiesGeojsonPropertiesLayerBuilder<TProperties, TGeometry>
107
- ) => void
108
- ): this;
109
- geojsonPropertiesLayer(
110
- geojson:
111
- | ((
112
- geojson: GeographiesGeojsonPropertiesLayerBuilder<
113
- TProperties,
114
- TGeometry
115
- >
116
- ) => void)
117
- | null
118
- ): this {
119
- if (geojson === null) {
120
- this.geojsonBuilders = [];
121
- return this;
122
- }
123
- const builder = new GeographiesGeojsonPropertiesLayerBuilder<
124
- TProperties,
125
- TGeometry
126
- >();
127
- geojson(builder);
128
- this.geojsonBuilders.push(builder);
129
- return this;
130
- }
131
-
132
- /**
133
- * OPTIONAL. Creates a configuration object for a layer that will be drawn from geojson and styled using attribute data.
134
- *
135
- * This object provides various methods for transforming data values into colors / color bins.
136
- *
137
- * This method can be called only once.
138
- */
139
- attributeDataLayer(attributeData: null): this;
140
- attributeDataLayer(
141
- attributeData: (
142
- attributeData: GeographiesAttributeDataLayerBuilder<
143
- Datum,
144
- TProperties,
145
- TGeometry
146
- >
147
- ) => void
148
- ): this;
149
- attributeDataLayer(
150
- attributeData:
151
- | ((
152
- attributeData: GeographiesAttributeDataLayerBuilder<
153
- Datum,
154
- TProperties,
155
- TGeometry
156
- >
157
- ) => void)
158
- | null
159
- ): this {
160
- if (attributeData === null) {
161
- this.attributeDataBuilder = undefined;
162
- return this;
163
- }
164
- this.attributeDataBuilder = new GeographiesAttributeDataLayerBuilder<
165
- Datum,
166
- TProperties,
167
- TGeometry
168
- >();
169
- attributeData(this.attributeDataBuilder);
170
- return this;
171
- }
172
-
173
- /**
174
- * OPTIONAL. Sets the mix-blend-mode of the marks.
175
- *
176
- * @default 'normal'
177
- */
178
- mixBlendMode(mixBlendMode: string): this {
179
- this._mixBlendMode = mixBlendMode;
180
- return this;
181
- }
182
-
183
- /**
184
- * OPTIONAL. Sets a projection function that maps a point in the map's coordinate space to a point in the SVG's coordinate space.
185
- *
186
- * @default d3.geoAlbersUsa()
187
- */
188
- projection(projection: GeoProjection): this {
189
- this._projection = projection;
190
- return this;
191
- }
192
-
193
- /**
194
- * REQUIRED. Builds the GeographiesConfig object.
195
- */
196
- getConfig(): GeographiesConfig<Datum, TProperties, TGeometry> {
197
- this.validateBuilder();
198
- const config = new GeographiesConfig<Datum, TProperties, TGeometry>({
199
- marksClass: 'vic-geographies',
200
- attributeDataLayer: this.attributeDataBuilder?._build(),
201
- boundary: this._boundary,
202
- mixBlendMode: this._mixBlendMode,
203
- featureIndexAccessor: this._featureIndexAccessor,
204
- geojsonPropertiesLayers: this.geojsonBuilders.length
205
- ? this.geojsonBuilders.map((builder) => builder._build())
206
- : undefined,
207
- projection: this._projection,
208
- });
209
- this.geojsonBuilders = [];
210
- return config;
211
- }
212
-
213
- private validateBuilder(): void {
214
- if (!this._boundary) {
215
- throw new Error('Boundary is required');
216
- }
217
- if (!this._featureIndexAccessor) {
218
- throw new Error('Feature index accessor is required');
219
- }
220
- if (!this.attributeDataBuilder && !this.geojsonBuilders.length) {
221
- throw new Error('At least one layer is required');
222
- }
223
- }
224
- }
@@ -1,100 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { VicGeographiesConfigBuilder } from './geographies-builder';
3
- import { GeographiesConfig } from './geographies-config';
4
- import { GeographiesAttributeDataLayer } from './layers/attribute-data-layer/attribute-data-layer';
5
- import { GeographiesLayer } from './layers/geographies-layer/geographies-layer';
6
-
7
- type Datum = { value: number; state: string };
8
- const data = [
9
- { value: 1, state: 'AL' },
10
- { value: 2, state: 'AK' },
11
- { value: 3, state: 'AZ' },
12
- { value: 4, state: 'CA' },
13
- { value: 5, state: 'CO' },
14
- { value: 6, state: 'CO' },
15
- ];
16
- const features = [
17
- { name: 'Alabama' },
18
- { name: 'Alaska' },
19
- { name: 'Arizona' },
20
- { name: 'California' },
21
- { name: 'Colorado' },
22
- ];
23
- function createConfig(): GeographiesConfig<Datum, { name: string }, any> {
24
- return new VicGeographiesConfigBuilder<Datum, { name: string }>()
25
- .boundary('boundary' as any)
26
- .featureIndexAccessor((d) => d.properties.name)
27
- .attributeDataLayer((layer) =>
28
- layer
29
- .equalValueRangesBins((dimension) =>
30
- dimension.valueAccessor((d) => d.value).numBins(5)
31
- )
32
- .geographyIndexAccessor((d) => d.state)
33
- .data(data)
34
- )
35
- .geojsonPropertiesLayer((layer) =>
36
- layer
37
- .geographies(features as any)
38
- .fill((dimension) => dimension.range(['lime']))
39
- )
40
- .getConfig();
41
- }
42
-
43
- describe('GeographiesConfig', () => {
44
- let config: GeographiesConfig<Datum, { name: string }, any>;
45
-
46
- beforeEach(() => {
47
- config = undefined;
48
- });
49
-
50
- describe('init()', () => {
51
- beforeEach(() => {
52
- spyOn(
53
- GeographiesAttributeDataLayer.prototype as any,
54
- 'initPropertiesFromData'
55
- );
56
- spyOn(GeographiesConfig.prototype as any, 'setLayers');
57
- spyOn(
58
- GeographiesConfig.prototype as any,
59
- 'setLayerFeatureIndexAccessors'
60
- );
61
- config = createConfig();
62
- });
63
- it('calls initPropertiesFromData once', () => {
64
- expect(
65
- (config as any).attributeDataLayer.initPropertiesFromData
66
- ).toHaveBeenCalledTimes(1);
67
- });
68
- it('calls setLayers once', () => {
69
- expect((config as any).setLayers).toHaveBeenCalledTimes(1);
70
- });
71
- it('calls setLayerFeatureIndexAccessors once', () => {
72
- expect(
73
- (config as any).setLayerFeatureIndexAccessors
74
- ).toHaveBeenCalledTimes(1);
75
- });
76
- });
77
-
78
- describe('setLayers()', () => {
79
- beforeEach(() => {
80
- config = createConfig();
81
- });
82
- it('sets layers to an array with attributeDataLayer and geojsonPropertiesLayers', () => {
83
- expect(config.layers.length).toBe(2);
84
- });
85
- });
86
-
87
- describe('setLayerFeatureIndexAccessors()', () => {
88
- let featureAccessorSpy: jasmine.Spy;
89
- beforeEach(() => {
90
- featureAccessorSpy = spyOn(
91
- GeographiesLayer.prototype as any,
92
- 'setFeatureIndexAccessor'
93
- );
94
- config = createConfig();
95
- });
96
- it('calls setFeatureValueAccessor once per layer', () => {
97
- expect(featureAccessorSpy).toHaveBeenCalledTimes(2);
98
- });
99
- });
100
- });
@@ -1,81 +0,0 @@
1
- import { safeAssign } from '@mathstack/app-kit';
2
- import {
3
- ExtendedFeature,
4
- ExtendedFeatureCollection,
5
- ExtendedGeometryCollection,
6
- GeoGeometryObjects,
7
- GeoProjection,
8
- } from 'd3';
9
- import {
10
- GeoJsonProperties,
11
- GeometryObject as Geometry,
12
- MultiPolygon,
13
- Polygon,
14
- } from 'geojson';
15
- import { MarksConfig } from '../../marks';
16
- import { GeographiesFeature } from '../geographies-feature';
17
- import { GeographiesOptions } from './geographies-options';
18
- import { GeographiesAttributeDataLayer } from './layers/attribute-data-layer/attribute-data-layer';
19
- import { GeographiesGeojsonPropertiesLayer } from './layers/geojson-properties-layer/geojson-properties-layer';
20
-
21
- export class GeographiesConfig<
22
- Datum,
23
- TProperties extends GeoJsonProperties,
24
- TGeometry extends Geometry = MultiPolygon | Polygon,
25
- >
26
- extends MarksConfig
27
- implements GeographiesOptions<Datum, TProperties, TGeometry>
28
- {
29
- readonly boundary:
30
- | ExtendedFeature
31
- | ExtendedFeatureCollection
32
- | GeoGeometryObjects
33
- | ExtendedGeometryCollection;
34
- readonly attributeDataLayer: GeographiesAttributeDataLayer<
35
- Datum,
36
- TProperties,
37
- TGeometry
38
- >;
39
- featureIndexAccessor: (
40
- d: GeographiesFeature<TProperties, TGeometry>
41
- ) => string;
42
- layers: (
43
- | GeographiesAttributeDataLayer<Datum, TProperties, TGeometry>
44
- | GeographiesGeojsonPropertiesLayer<TProperties, TGeometry>
45
- )[];
46
- readonly geojsonPropertiesLayers: GeographiesGeojsonPropertiesLayer<
47
- TProperties,
48
- TGeometry
49
- >[];
50
- readonly projection: GeoProjection;
51
-
52
- constructor(options: GeographiesOptions<Datum, TProperties, TGeometry>) {
53
- super();
54
- safeAssign(this, options);
55
- this.initPropertiesFromData();
56
- }
57
-
58
- protected initPropertiesFromData(): void {
59
- this.setLayers();
60
- this.setLayerFeatureIndexAccessors();
61
- }
62
-
63
- private setLayers(): void {
64
- this.layers = [];
65
- if (this.attributeDataLayer) {
66
- this.layers.push(this.attributeDataLayer);
67
- }
68
- if (this.geojsonPropertiesLayers) {
69
- this.layers.push(...this.geojsonPropertiesLayers);
70
- }
71
- this.layers.forEach((layer, i) => {
72
- layer.id = i;
73
- });
74
- }
75
-
76
- private setLayerFeatureIndexAccessors(): void {
77
- this.layers.forEach((layer) =>
78
- layer.setFeatureIndexAccessor(this.featureIndexAccessor)
79
- );
80
- }
81
- }
@@ -1,37 +0,0 @@
1
- import {
2
- ExtendedFeature,
3
- ExtendedFeatureCollection,
4
- ExtendedGeometryCollection,
5
- GeoGeometryObjects,
6
- GeoProjection,
7
- } from 'd3';
8
- import { GeoJsonProperties, Geometry, MultiPolygon, Polygon } from 'geojson';
9
- import { MarksOptions } from '../../marks/config/marks-options';
10
- import { GeographiesFeature } from '../geographies-feature';
11
- import { GeographiesAttributeDataLayer } from './layers/attribute-data-layer/attribute-data-layer';
12
- import { GeographiesGeojsonPropertiesLayer } from './layers/geojson-properties-layer/geojson-properties-layer';
13
-
14
- export interface GeographiesOptions<
15
- Datum,
16
- TProperties extends GeoJsonProperties,
17
- TGeometry extends Geometry = MultiPolygon | Polygon,
18
- > extends MarksOptions {
19
- boundary:
20
- | ExtendedFeature
21
- | ExtendedFeatureCollection
22
- | GeoGeometryObjects
23
- | ExtendedGeometryCollection;
24
- attributeDataLayer: GeographiesAttributeDataLayer<
25
- Datum,
26
- TProperties,
27
- TGeometry
28
- >;
29
- featureIndexAccessor: (
30
- d: GeographiesFeature<TProperties, TGeometry>
31
- ) => string;
32
- geojsonPropertiesLayers: GeographiesGeojsonPropertiesLayer<
33
- TProperties,
34
- TGeometry
35
- >[];
36
- projection: GeoProjection;
37
- }
@@ -1,212 +0,0 @@
1
- import { safeAssign } from '@mathstack/app-kit';
2
- import { Geometry, MultiPolygon, Polygon } from 'geojson';
3
- import { FillDefinition } from '../../../../fill-definitions/fill-definitions';
4
- import { GeographiesLayerBuilder } from '../geographies-layer/geographies-layer-builder';
5
- import { GeographiesAttributeDataLayer } from './attribute-data-layer';
6
- import { CategoricalBinsBuilder } from './dimensions/categorical-bins/categorical-bins-builder';
7
- import { CustomBreaksBinsAttributeDataDimensionBuilder } from './dimensions/custom-breaks/custom-breaks-bins-builder';
8
- import { EqualFrequenciesAttributeDataDimensionBuilder } from './dimensions/equal-frequencies-bins/equal-frequencies-bins-builder';
9
- import { EqualValueRangesBinsBuilder } from './dimensions/equal-value-ranges-bins/equal-value-ranges-bins-builder';
10
- import { NoBinsAttributeDataDimensionBuilder } from './dimensions/no-bins/no-bins-builder';
11
-
12
- const DEFAULT = {
13
- _class: () => '',
14
- _enableEventActions: true,
15
- };
16
-
17
- export class GeographiesAttributeDataLayerBuilder<
18
- Datum,
19
- TProperties,
20
- TGeometry extends Geometry = MultiPolygon | Polygon,
21
- > extends GeographiesLayerBuilder<TProperties, TGeometry> {
22
- private _customFills: FillDefinition<Datum>[];
23
- private _data: Datum[];
24
- private _geographyIndexAccessor: (d: Datum) => string;
25
-
26
- private binsBuilder:
27
- | CategoricalBinsBuilder<Datum>
28
- | CustomBreaksBinsAttributeDataDimensionBuilder<Datum>
29
- | EqualFrequenciesAttributeDataDimensionBuilder<Datum>
30
- | EqualValueRangesBinsBuilder<Datum>
31
- | NoBinsAttributeDataDimensionBuilder<Datum>;
32
-
33
- private categoricalBinsBuilder: CategoricalBinsBuilder<Datum>;
34
- private customBreaksBinsBuilder: CustomBreaksBinsAttributeDataDimensionBuilder<Datum>;
35
- private equalFrequenciesBinsBuilder: EqualFrequenciesAttributeDataDimensionBuilder<Datum>;
36
- private equalValueRangesBinsBuilder: EqualValueRangesBinsBuilder<Datum>;
37
- private noBinsBuilder: NoBinsAttributeDataDimensionBuilder<Datum>;
38
-
39
- constructor() {
40
- super();
41
- safeAssign(this, DEFAULT);
42
- }
43
-
44
- /**
45
- * OPTIONAL. Creates a configuration object that maps data to colors by categorical values.
46
- *
47
- * For example, if the data for a set of U.S. states had a string property, 'region', this could be used to color the states by region.
48
- */
49
- categoricalBins(bins: null): this;
50
- categoricalBins(bins: (bins: CategoricalBinsBuilder<Datum>) => void): this;
51
- categoricalBins(
52
- bins: ((bins: CategoricalBinsBuilder<Datum>) => void) | null
53
- ): this {
54
- if (bins === null) {
55
- this.categoricalBinsBuilder = undefined;
56
- return this;
57
- }
58
- this.categoricalBinsBuilder = new CategoricalBinsBuilder<Datum, string>();
59
- bins(this.categoricalBinsBuilder);
60
- return this;
61
- }
62
-
63
- /**
64
- * OPTIONAL. Creates a configuration object that maps data to colors by custom breaks values for bins.
65
- */
66
- customBreaksBins(bins: null): this;
67
- customBreaksBins(
68
- bins: (bins: CustomBreaksBinsAttributeDataDimensionBuilder<Datum>) => void
69
- ): this;
70
- customBreaksBins(
71
- bins:
72
- | ((bins: CustomBreaksBinsAttributeDataDimensionBuilder<Datum>) => void)
73
- | null
74
- ): this {
75
- if (bins === null) {
76
- this.customBreaksBinsBuilder = undefined;
77
- return this;
78
- }
79
- this.customBreaksBinsBuilder =
80
- new CustomBreaksBinsAttributeDataDimensionBuilder();
81
- bins(this.customBreaksBinsBuilder);
82
- return this;
83
- }
84
-
85
- /**
86
- * REQUIRED. The data that will be used to color the geographies.
87
- */
88
- data(data: Datum[]): this {
89
- this._data = data;
90
- return this;
91
- }
92
-
93
- /**
94
- * OPTIONAL. Creates a configuration object that for creating a map without binning values.
95
- */
96
- noBins(bins: null): this;
97
- noBins(
98
- bins: (bins: NoBinsAttributeDataDimensionBuilder<Datum>) => void
99
- ): this;
100
- noBins(
101
- bins: ((bins: NoBinsAttributeDataDimensionBuilder<Datum>) => void) | null
102
- ): this {
103
- if (bins === null) {
104
- this.noBinsBuilder = undefined;
105
- return this;
106
- }
107
- this.noBinsBuilder = new NoBinsAttributeDataDimensionBuilder();
108
- bins(this.noBinsBuilder);
109
- return this;
110
- }
111
-
112
- /**
113
- * OPTIONAL. Creates a configuration object that maps data to bins that each have the same size range.
114
- *
115
- * For example, bins may be, 0-10, 10-20, 20-30, etc.
116
- */
117
- equalValueRangesBins(bins: null): this;
118
- equalValueRangesBins(
119
- bins: (bins: EqualValueRangesBinsBuilder<Datum>) => void
120
- ): this;
121
- equalValueRangesBins(
122
- bins: ((bins: EqualValueRangesBinsBuilder<Datum>) => void) | null
123
- ): this {
124
- if (bins === null) {
125
- this.equalValueRangesBinsBuilder = undefined;
126
- return this;
127
- }
128
- this.equalValueRangesBinsBuilder = new EqualValueRangesBinsBuilder();
129
- bins(this.equalValueRangesBinsBuilder);
130
- return this;
131
- }
132
-
133
- /**
134
- * OPTIONAL. Creates a configuration object that maps data to bins that contain an equal number of data observations.
135
- *
136
- * This is useful for creating quartiles, deciles, etc.
137
- */
138
- equalFrequenciesBins(bins: null): this;
139
- equalFrequenciesBins(
140
- bins: (bins: EqualFrequenciesAttributeDataDimensionBuilder<Datum>) => void
141
- ): this;
142
- equalFrequenciesBins(
143
- bins:
144
- | ((bins: EqualFrequenciesAttributeDataDimensionBuilder<Datum>) => void)
145
- | null
146
- ): this {
147
- if (bins === null) {
148
- this.equalFrequenciesBinsBuilder = undefined;
149
- return this;
150
- }
151
- this.equalFrequenciesBinsBuilder =
152
- new EqualFrequenciesAttributeDataDimensionBuilder();
153
- bins(this.equalFrequenciesBinsBuilder);
154
- return this;
155
- }
156
-
157
- customFills(customFills: FillDefinition<Datum>[]): this {
158
- this._customFills = customFills;
159
- return this;
160
- }
161
-
162
- /**
163
- * REQUIRED. The accessor function that returns a value from a Datum that must match the value returned by featureIndexAccessor.
164
- */
165
- geographyIndexAccessor(accessor: (d: Datum) => string): this {
166
- this._geographyIndexAccessor = accessor;
167
- return this;
168
- }
169
-
170
- _build(): GeographiesAttributeDataLayer<Datum, TProperties, TGeometry> {
171
- this.validateBuilder();
172
- return new GeographiesAttributeDataLayer({
173
- marksClass: 'vic-geographies-attribute-data-layer',
174
- attributeDimension: this.binsBuilder._build(),
175
- customFills: this._customFills,
176
- data: this._data,
177
- featureClass: this._class,
178
- enableEventActions: this._enableEventActions,
179
- geographies: this._geographies,
180
- geographyIndexAccessor: this._geographyIndexAccessor,
181
- labels: this.labelsBuilder?._build(),
182
- mixBlendMode: this._mixBlendMode,
183
- stroke: this.strokeBuilder?._build(),
184
- });
185
- }
186
-
187
- private validateBuilder(): void {
188
- const binsBuilders = [
189
- this.categoricalBinsBuilder,
190
- this.customBreaksBinsBuilder,
191
- this.equalFrequenciesBinsBuilder,
192
- this.equalValueRangesBinsBuilder,
193
- this.noBinsBuilder,
194
- ];
195
- if (!this._data) {
196
- throw new Error('Data must be provided');
197
- }
198
- if (!this._geographyIndexAccessor) {
199
- throw new Error('Geography index accessor must be provided');
200
- }
201
- const numBinsBuilders = binsBuilders.filter((builder) => builder).length;
202
- if (numBinsBuilders !== 1) {
203
- throw new Error(
204
- `Exactly one bin strategy must be provided. Currently, ${numBinsBuilders} are provided.`
205
- );
206
- }
207
- this.binsBuilder = binsBuilders.find((builder) => builder);
208
- if (!this.strokeBuilder) {
209
- this.initStrokeBuilder();
210
- }
211
- }
212
- }
@@ -1,26 +0,0 @@
1
- import { Geometry, MultiPolygon, Polygon } from 'geojson';
2
- import { FillDefinition } from '../../../../fill-definitions/fill-definitions';
3
- import { GeographiesLayerOptions } from '../geographies-layer/geographies-layer-options';
4
- import { CategoricalBinsAttributeDataDimension } from './dimensions/categorical-bins/categorical-bins';
5
- import { CustomBreaksBinsAttributeDataDimension } from './dimensions/custom-breaks/custom-breaks-bins';
6
- import { EqualFrequenciesAttributeDataDimension } from './dimensions/equal-frequencies-bins/equal-frequencies-bins';
7
- import { EqualValueRangesAttributeDataDimension } from './dimensions/equal-value-ranges-bins/equal-value-ranges-bins';
8
- import { NoBinsAttributeDataDimension } from './dimensions/no-bins/no-bins';
9
-
10
- export interface GeographiesAttributeDataLayerOptions<
11
- Datum,
12
- TProperties,
13
- TGeometry extends Geometry = MultiPolygon | Polygon,
14
- > extends GeographiesLayerOptions<TProperties, TGeometry> {
15
- attributeDimension:
16
- | CategoricalBinsAttributeDataDimension<Datum>
17
- | NoBinsAttributeDataDimension<Datum>
18
- | EqualValueRangesAttributeDataDimension<Datum>
19
- | EqualFrequenciesAttributeDataDimension<Datum>
20
- | CustomBreaksBinsAttributeDataDimension<Datum>;
21
- customFills: FillDefinition<Datum>[];
22
- data: Datum[];
23
- geographyIndexAccessor: (d: Datum) => string;
24
- marksClass: string;
25
- mixBlendMode: string;
26
- }