@mathstack/viz 2.1.0 → 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.
- package/fesm2022/mathstack-viz.mjs +11024 -0
- package/fesm2022/mathstack-viz.mjs.map +1 -0
- package/package.json +14 -5
- package/types/mathstack-viz.d.ts +5830 -0
- package/CHANGELOG.md +0 -0
- package/cypress/fixtures/example.json +0 -5
- package/cypress/fixtures/usMap.json +0 -13511
- package/cypress/support/commands.ts +0 -104
- package/cypress/support/component-index.html +0 -12
- package/cypress/support/component.ts +0 -33
- package/cypress.config.ts +0 -9
- package/karma.conf.js +0 -62
- package/ng-package.json +0 -8
- package/project.json +0 -97
- package/src/.eslintrc.json +0 -35
- package/src/.prettierrc +0 -31
- package/src/lib/axes/base/config/xy-axis-builder.ts +0 -68
- package/src/lib/axes/base/config/xy-axis-config.ts +0 -35
- package/src/lib/axes/base/config/xy-axis-options.ts +0 -11
- package/src/lib/axes/base/xy-axis-base.spec.ts +0 -114
- package/src/lib/axes/base/xy-axis-base.ts +0 -305
- package/src/lib/axes/base/xy-axis-domain-lines.cy.ts +0 -511
- package/src/lib/axes/baseline/axis-baseline-builder.ts +0 -77
- package/src/lib/axes/baseline/axis-baseline-options.ts +0 -4
- package/src/lib/axes/baseline/axis-baseline.ts +0 -11
- package/src/lib/axes/grid/grid-builder.ts +0 -74
- package/src/lib/axes/grid/grid-config.ts +0 -13
- package/src/lib/axes/grid/grid-options.ts +0 -7
- package/src/lib/axes/index.ts +0 -40
- package/src/lib/axes/label/axis-label-builder.ts +0 -140
- package/src/lib/axes/label/axis-label-options.ts +0 -12
- package/src/lib/axes/label/axis-label.ts +0 -18
- package/src/lib/axes/label/axis-labels.cy.ts +0 -303
- package/src/lib/axes/ordinal/ordinal-axis-config.ts +0 -31
- package/src/lib/axes/ordinal/ordinal-axis.spec.ts +0 -30
- package/src/lib/axes/ordinal/ordinal-axis.ts +0 -26
- package/src/lib/axes/quantitative/quantitative-axis-config.ts +0 -39
- package/src/lib/axes/quantitative/quantitative-axis-ticks.cy.ts +0 -748
- package/src/lib/axes/quantitative/quantitative-axis.spec.ts +0 -537
- package/src/lib/axes/quantitative/quantitative-axis.ts +0 -191
- package/src/lib/axes/ticks/tick-wrap/tick-wrap-builder.ts +0 -141
- package/src/lib/axes/ticks/tick-wrap/tick-wrap-options.ts +0 -11
- package/src/lib/axes/ticks/tick-wrap/tick-wrap.cy.ts +0 -360
- package/src/lib/axes/ticks/tick-wrap/tick-wrap.ts +0 -21
- package/src/lib/axes/ticks/ticks-builder.ts +0 -370
- package/src/lib/axes/ticks/ticks-options.ts +0 -24
- package/src/lib/axes/ticks/ticks.ts +0 -33
- package/src/lib/axes/x/x-axis-config.ts +0 -48
- package/src/lib/axes/x/x-axis.spec.ts +0 -90
- package/src/lib/axes/x/x-axis.ts +0 -109
- package/src/lib/axes/x-ordinal/x-ordinal-axis-builder.ts +0 -75
- package/src/lib/axes/x-ordinal/x-ordinal-axis-config.ts +0 -27
- package/src/lib/axes/x-ordinal/x-ordinal-axis.component.ts +0 -33
- package/src/lib/axes/x-quantitative/x-quantitative-axis-builder.ts +0 -74
- package/src/lib/axes/x-quantitative/x-quantitative-axis-config.ts +0 -32
- package/src/lib/axes/x-quantitative/x-quantitative-axis.component.ts +0 -40
- package/src/lib/axes/xy-axis.module.ts +0 -20
- package/src/lib/axes/y/y-axis-config.ts +0 -47
- package/src/lib/axes/y/y-axis.spec.ts +0 -92
- package/src/lib/axes/y/y-axis.ts +0 -161
- package/src/lib/axes/y-ordinal/y-ordinal-axis-builder.ts +0 -76
- package/src/lib/axes/y-ordinal/y-ordinal-axis-config.ts +0 -29
- package/src/lib/axes/y-ordinal/y-ordinal-axis.component.ts +0 -33
- package/src/lib/axes/y-quantitative-axis/y-quantitative-axis-builder.ts +0 -74
- package/src/lib/axes/y-quantitative-axis/y-quantitative-axis-config.ts +0 -34
- package/src/lib/axes/y-quantitative-axis/y-quantitative-axis.component.ts +0 -40
- package/src/lib/bars/bars.component.scss +0 -0
- package/src/lib/bars/bars.component.spec.ts +0 -1470
- package/src/lib/bars/bars.component.ts +0 -717
- package/src/lib/bars/bars.cy.ts +0 -829
- package/src/lib/bars/bars.module.ts +0 -9
- package/src/lib/bars/config/backgrounds/bars-backgrounds-builder.ts +0 -51
- package/src/lib/bars/config/backgrounds/bars-backgrounds-options.ts +0 -4
- package/src/lib/bars/config/backgrounds/bars-backgrounds.ts +0 -11
- package/src/lib/bars/config/bars-builder.ts +0 -340
- package/src/lib/bars/config/bars-config.spec.ts +0 -132
- package/src/lib/bars/config/bars-config.ts +0 -70
- package/src/lib/bars/config/bars-dimensions.ts +0 -29
- package/src/lib/bars/config/bars-options.ts +0 -20
- package/src/lib/bars/config/labels/bars-labels-builder.ts +0 -89
- package/src/lib/bars/config/labels/bars-labels-options.ts +0 -6
- package/src/lib/bars/config/labels/bars-labels.cy.ts +0 -781
- package/src/lib/bars/config/labels/bars-labels.ts +0 -13
- package/src/lib/bars/events/actions/bars-click-actions.ts +0 -23
- package/src/lib/bars/events/actions/bars-hover-actions.ts +0 -43
- package/src/lib/bars/events/actions/bars-hover-move-actions.ts +0 -21
- package/src/lib/bars/events/bars-events.directive.spec.ts +0 -186
- package/src/lib/bars/events/bars-events.directive.ts +0 -235
- package/src/lib/bars/events/bars-interaction-output.ts +0 -17
- package/src/lib/bars/events/bars-tooltip-positioner.ts +0 -24
- package/src/lib/bars/index.ts +0 -18
- package/src/lib/charts/chart/chart-scaling.cy.ts +0 -323
- package/src/lib/charts/chart/chart.component.html +0 -45
- package/src/lib/charts/chart/chart.component.scss +0 -37
- package/src/lib/charts/chart/chart.component.ts +0 -243
- package/src/lib/charts/chart/chart.token.ts +0 -4
- package/src/lib/charts/chart/chart.ts +0 -5
- package/src/lib/charts/chart/config/chart-builder.ts +0 -194
- package/src/lib/charts/chart/config/chart-config.ts +0 -21
- package/src/lib/charts/chart/config/chart-options.ts +0 -11
- package/src/lib/charts/chart.module.ts +0 -10
- package/src/lib/charts/index.ts +0 -9
- package/src/lib/charts/map-chart/map-chart.component.scss +0 -0
- package/src/lib/charts/map-chart/map-chart.component.spec.ts +0 -35
- package/src/lib/charts/map-chart/map-chart.component.ts +0 -61
- package/src/lib/charts/xy-chart/xy-chart.component.spec.ts +0 -34
- package/src/lib/charts/xy-chart/xy-chart.component.ts +0 -65
- package/src/lib/core/common-behaviors/constructor.ts +0 -7
- package/src/lib/core/index.ts +0 -11
- package/src/lib/core/pipes/resize-chart-height.pipe.spec.ts +0 -23
- package/src/lib/core/pipes/resize-chart-height.pipe.ts +0 -20
- package/src/lib/core/styles/_spacing.scss +0 -4
- package/src/lib/core/types/layout.ts +0 -28
- package/src/lib/core/types/scale.ts +0 -6
- package/src/lib/core/types/utility.ts +0 -11
- package/src/lib/core/types/values.ts +0 -10
- package/src/lib/core/utilities/colors.spec.ts +0 -57
- package/src/lib/core/utilities/colors.ts +0 -42
- package/src/lib/core/utilities/fill-utilities.spec.ts +0 -25
- package/src/lib/core/utilities/fill-utilities.ts +0 -21
- package/src/lib/core/utilities/type-guards.spec.ts +0 -55
- package/src/lib/core/utilities/type-guards.ts +0 -33
- package/src/lib/core/utilities/value-format.ts +0 -21
- package/src/lib/core/utilities/values.spec.ts +0 -954
- package/src/lib/core/utilities/values.ts +0 -189
- package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position-builder.ts +0 -105
- package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position-options.ts +0 -24
- package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position.spec.ts +0 -66
- package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position.ts +0 -72
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/concrete-domain-padding.ts +0 -10
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/domain-padding.ts +0 -76
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/domain-test-utility.ts +0 -130
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/percent-over/percent-over-options.ts +0 -3
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/percent-over/percent-over.ts +0 -37
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/pixel/pixel-options.ts +0 -3
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/pixel/pixel.ts +0 -73
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/quantitative-domain-padding.cy.ts +0 -978
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-interval/round-to-interval-options.ts +0 -3
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-interval/round-to-interval.ts +0 -27
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-sig-fig/round-to-sig-fig-options.ts +0 -3
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-sig-fig/round-to-sig-fig.ts +0 -30
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position-builder.ts +0 -183
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position-options.ts +0 -8
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position.spec.ts +0 -28
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position.ts +0 -62
- package/src/lib/data-dimensions/continuous-quantitative/number-dimension/number-dimension-options.ts +0 -15
- package/src/lib/data-dimensions/continuous-quantitative/number-dimension/number-dimension.spec.ts +0 -155
- package/src/lib/data-dimensions/continuous-quantitative/number-dimension/number-dimension.ts +0 -57
- package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value-builder.ts +0 -166
- package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value-options.ts +0 -10
- package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value.spec.ts +0 -34
- package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value.ts +0 -57
- package/src/lib/data-dimensions/dimension-builder.ts +0 -45
- package/src/lib/data-dimensions/dimension-options.ts +0 -12
- package/src/lib/data-dimensions/dimension.ts +0 -30
- package/src/lib/data-dimensions/index.ts +0 -31
- package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position-builder.ts +0 -122
- package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position-options.ts +0 -12
- package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position.spec.ts +0 -83
- package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position.ts +0 -101
- package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value-builder.ts +0 -108
- package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value-options.ts +0 -12
- package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value.cy.ts +0 -384
- package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value.spec.ts +0 -63
- package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value.ts +0 -79
- package/src/lib/data-export/data-export-config.ts +0 -98
- package/src/lib/data-export/data-export.spec.ts +0 -33
- package/src/lib/data-export/data-export.ts +0 -87
- package/src/lib/data-export/index.ts +0 -2
- package/src/lib/dots/config/dots-builder.ts +0 -442
- package/src/lib/dots/config/dots-config.spec.ts +0 -123
- package/src/lib/dots/config/dots-config.ts +0 -81
- package/src/lib/dots/config/dots-options.ts +0 -32
- package/src/lib/dots/dots.component.scss +0 -0
- package/src/lib/dots/dots.component.spec.ts +0 -143
- package/src/lib/dots/dots.component.ts +0 -291
- package/src/lib/dots/dots.cy.ts +0 -594
- package/src/lib/dots/dots.module.ts +0 -9
- package/src/lib/dots/events/actions/dots-hover-actions.ts +0 -19
- package/src/lib/dots/events/actions/dots-hover-move-actions.ts +0 -38
- package/src/lib/dots/events/dots-events.directive.ts +0 -214
- package/src/lib/dots/events/dots-interaction-output.ts +0 -15
- package/src/lib/dots/events/dots-tooltip-positioner.ts +0 -24
- package/src/lib/dots/index.ts +0 -10
- package/src/lib/events/events.directive.ts +0 -184
- package/src/lib/events/events.types.ts +0 -57
- package/src/lib/events/index.ts +0 -4
- package/src/lib/events/interaction-output.ts +0 -34
- package/src/lib/events/tooltip-positioner.ts +0 -15
- package/src/lib/fill-definitions/fill-definitions.ts +0 -4
- package/src/lib/fill-definitions/index.ts +0 -1
- package/src/lib/geographies/config/geographies-builder.ts +0 -224
- package/src/lib/geographies/config/geographies-config.spec.ts +0 -100
- package/src/lib/geographies/config/geographies-config.ts +0 -81
- package/src/lib/geographies/config/geographies-options.ts +0 -37
- package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer-builder.ts +0 -212
- package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer-options.ts +0 -26
- package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer.spec.ts +0 -119
- package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer.ts +0 -148
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data/attribute-data-dimension-builder.ts +0 -65
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data/attribute-data-dimension-options.ts +0 -15
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data/attribute-data-dimension.ts +0 -32
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data-bin-enums.ts +0 -10
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data-bin-types.ts +0 -15
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins-builder.ts +0 -18
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins-options.ts +0 -8
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins.spec.ts +0 -60
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins.ts +0 -34
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins-builder.ts +0 -46
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins-options.ts +0 -8
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins.cy.ts +0 -437
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins.spec.ts +0 -105
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins.ts +0 -54
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins-builder.ts +0 -65
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins-options.ts +0 -9
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins.spec.ts +0 -82
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins.ts +0 -81
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks.cy.ts +0 -378
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins-builder.ts +0 -50
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins-options.ts +0 -8
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins.cy.ts +0 -362
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins.spec.ts +0 -72
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins.ts +0 -56
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins-builder.ts +0 -60
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins-options.ts +0 -9
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins.cy.ts +0 -307
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins.spec.ts +0 -104
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins.ts +0 -89
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins-builder.ts +0 -62
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins-options.ts +0 -8
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.cy.ts +0 -265
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.spec.ts +0 -42
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.ts +0 -42
- package/src/lib/geographies/config/layers/geographies-layer/geographies-layer-builder.ts +0 -116
- package/src/lib/geographies/config/layers/geographies-layer/geographies-layer-options.ts +0 -20
- package/src/lib/geographies/config/layers/geographies-layer/geographies-layer.ts +0 -104
- package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer-builder.ts +0 -111
- package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer-options.ts +0 -19
- package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer.spec.ts +0 -41
- package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer.ts +0 -67
- package/src/lib/geographies/config/layers/labels/geographies-labels-builder.ts +0 -269
- package/src/lib/geographies/config/layers/labels/geographies-labels-options.ts +0 -45
- package/src/lib/geographies/config/layers/labels/geographies-labels.ts +0 -38
- package/src/lib/geographies/events/actions/geographies-click-actions.ts +0 -21
- package/src/lib/geographies/events/actions/geographies-hover-actions.ts +0 -17
- package/src/lib/geographies/events/actions/geographies-hover-move-actions.ts +0 -19
- package/src/lib/geographies/events/geographies-events.directive.spec.ts +0 -225
- package/src/lib/geographies/events/geographies-events.directive.ts +0 -235
- package/src/lib/geographies/events/geographies-interaction-output.ts +0 -17
- package/src/lib/geographies/events/geographies-tooltip-positioner.ts +0 -23
- package/src/lib/geographies/geographies-feature.ts +0 -16
- package/src/lib/geographies/geographies.component.html +0 -1
- package/src/lib/geographies/geographies.component.scss +0 -0
- package/src/lib/geographies/geographies.component.spec.ts +0 -148
- package/src/lib/geographies/geographies.component.ts +0 -318
- package/src/lib/geographies/geographies.cy.ts +0 -640
- package/src/lib/geographies/geographies.module.ts +0 -9
- package/src/lib/geographies/index.ts +0 -32
- package/src/lib/grouped-bars/config/grouped-bars-builder.ts +0 -66
- package/src/lib/grouped-bars/config/grouped-bars-config.ts +0 -41
- package/src/lib/grouped-bars/config/grouped-bars-options.ts +0 -9
- package/src/lib/grouped-bars/events/grouped-bars-events.directive.ts +0 -221
- package/src/lib/grouped-bars/grouped-bars.component.scss +0 -0
- package/src/lib/grouped-bars/grouped-bars.component.spec.ts +0 -25
- package/src/lib/grouped-bars/grouped-bars.component.ts +0 -94
- package/src/lib/grouped-bars/grouped-bars.module.ts +0 -9
- package/src/lib/grouped-bars/index.ts +0 -10
- package/src/lib/image-download/image-download-config.ts +0 -57
- package/src/lib/image-download/image-download-enums.ts +0 -7
- package/src/lib/image-download/image-download-options.ts +0 -14
- package/src/lib/image-download/image-download.service.ts +0 -70
- package/src/lib/image-download/index.ts +0 -4
- package/src/lib/lines/config/area-fills/area-fills-builder.ts +0 -87
- package/src/lib/lines/config/area-fills/area-fills-options.ts +0 -8
- package/src/lib/lines/config/area-fills/area-fills.ts +0 -14
- package/src/lib/lines/config/lines-builder.ts +0 -242
- package/src/lib/lines/config/lines-config.spec.ts +0 -52
- package/src/lib/lines/config/lines-config.ts +0 -96
- package/src/lib/lines/config/lines-options.ts +0 -19
- package/src/lib/lines/config/stroke/lines-stroke-builder.ts +0 -135
- package/src/lib/lines/config/stroke/lines-stroke-options.ts +0 -6
- package/src/lib/lines/config/stroke/lines-stroke.ts +0 -15
- package/src/lib/lines/events/actions/lines-click-actions.ts +0 -17
- package/src/lib/lines/events/actions/lines-hover-move-actions.ts +0 -113
- package/src/lib/lines/events/actions/lines-marker-click-actions.ts +0 -29
- package/src/lib/lines/events/lines-events.directive.spec.ts +0 -152
- package/src/lib/lines/events/lines-events.directive.ts +0 -310
- package/src/lib/lines/events/lines-interaction-output.ts +0 -17
- package/src/lib/lines/events/lines-tooltip-positioner.ts +0 -24
- package/src/lib/lines/index.ts +0 -17
- package/src/lib/lines/lines.component.scss +0 -0
- package/src/lib/lines/lines.component.spec.ts +0 -95
- package/src/lib/lines/lines.component.ts +0 -425
- package/src/lib/lines/lines.cy.ts +0 -738
- package/src/lib/lines/lines.module.ts +0 -9
- package/src/lib/map-legend/continuous-legend/continuous-legend.component.html +0 -28
- package/src/lib/map-legend/continuous-legend/continuous-legend.component.scss +0 -76
- package/src/lib/map-legend/continuous-legend/continuous-legend.component.spec.ts +0 -61
- package/src/lib/map-legend/continuous-legend/continuous-legend.component.ts +0 -82
- package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.html +0 -40
- package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.scss +0 -141
- package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.spec.ts +0 -75
- package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.ts +0 -57
- package/src/lib/map-legend/index.ts +0 -2
- package/src/lib/map-legend/map-legend-base.spec.ts +0 -190
- package/src/lib/map-legend/map-legend-base.ts +0 -99
- package/src/lib/map-legend/map-legend.component.html +0 -24
- package/src/lib/map-legend/map-legend.component.scss +0 -0
- package/src/lib/map-legend/map-legend.component.spec.ts +0 -125
- package/src/lib/map-legend/map-legend.component.ts +0 -80
- package/src/lib/map-legend/map-legend.module.ts +0 -8
- package/src/lib/marks/aux-marks/aux-marks.ts +0 -18
- package/src/lib/marks/aux-marks/config/aux-marks-builder.ts +0 -25
- package/src/lib/marks/aux-marks/config/aux-marks-config.ts +0 -6
- package/src/lib/marks/config/marks-config.ts +0 -14
- package/src/lib/marks/config/marks-options.ts +0 -9
- package/src/lib/marks/index.ts +0 -15
- package/src/lib/marks/map-marks/map-aux-marks/map-aux-marks.spec.ts +0 -74
- package/src/lib/marks/map-marks/map-aux-marks/map-aux-marks.ts +0 -40
- package/src/lib/marks/map-marks/map-primary-marks/map-primary-marks.spec.ts +0 -79
- package/src/lib/marks/map-marks/map-primary-marks/map-primary-marks.ts +0 -63
- package/src/lib/marks/marks.ts +0 -39
- package/src/lib/marks/primary-marks/config/primary-marks-builder.ts +0 -75
- package/src/lib/marks/primary-marks/config/primary-marks-config.ts +0 -9
- package/src/lib/marks/primary-marks/primary-marks-base.spec.ts +0 -58
- package/src/lib/marks/primary-marks/primary-marks.ts +0 -43
- package/src/lib/marks/xy-marks/xy-aux-marks/xy-aux-marks.ts +0 -40
- package/src/lib/marks/xy-marks/xy-marks-config.ts +0 -5
- package/src/lib/marks/xy-marks/xy-marks.ts +0 -10
- package/src/lib/marks/xy-marks/xy-primary-marks/xy-primary-marks-config.ts +0 -7
- package/src/lib/marks/xy-marks/xy-primary-marks/xy-primary-marks.spec.ts +0 -186
- package/src/lib/marks/xy-marks/xy-primary-marks/xy-primary-marks.ts +0 -72
- package/src/lib/point-markers/index.ts +0 -3
- package/src/lib/point-markers/point-markers-builder.ts +0 -93
- package/src/lib/point-markers/point-markers-options.ts +0 -6
- package/src/lib/point-markers/point-markers.ts +0 -13
- package/src/lib/quantitative-rules/config/labels/quantitative-rules-labels-builder.ts +0 -162
- package/src/lib/quantitative-rules/config/labels/quantitative-rules-labels-options.ts +0 -17
- package/src/lib/quantitative-rules/config/labels/quantitative-rules-labels.ts +0 -26
- package/src/lib/quantitative-rules/config/quantitative-rules-builder.ts +0 -134
- package/src/lib/quantitative-rules/config/quantitative-rules-config.ts +0 -21
- package/src/lib/quantitative-rules/config/quantitative-rules-dimensions.ts +0 -20
- package/src/lib/quantitative-rules/config/quantitative-rules-options.ts +0 -13
- package/src/lib/quantitative-rules/index.ts +0 -6
- package/src/lib/quantitative-rules/quantitative-rules.component.scss +0 -3
- package/src/lib/quantitative-rules/quantitative-rules.component.spec.ts +0 -50
- package/src/lib/quantitative-rules/quantitative-rules.component.ts +0 -224
- package/src/lib/quantitative-rules/quantitative-rules.cy.ts +0 -549
- package/src/lib/quantitative-rules/quantitative-rules.module.ts +0 -8
- package/src/lib/stacked-area/config/stacked-area-builder.ts +0 -264
- package/src/lib/stacked-area/config/stacked-area-config.spec.ts +0 -107
- package/src/lib/stacked-area/config/stacked-area-config.ts +0 -109
- package/src/lib/stacked-area/config/stacked-area-options.ts +0 -28
- package/src/lib/stacked-area/events/actions/stacked-area-hover-move-actions.ts +0 -17
- package/src/lib/stacked-area/events/stacked-area-events.directive.spec.ts +0 -168
- package/src/lib/stacked-area/events/stacked-area-events.directive.ts +0 -272
- package/src/lib/stacked-area/events/stacked-area-interaction-output.ts +0 -33
- package/src/lib/stacked-area/events/stacked-area-tooltip-positioner.ts +0 -37
- package/src/lib/stacked-area/index.ts +0 -7
- package/src/lib/stacked-area/stacked-area.component.scss +0 -0
- package/src/lib/stacked-area/stacked-area.component.spec.ts +0 -41
- package/src/lib/stacked-area/stacked-area.component.ts +0 -241
- package/src/lib/stacked-area/stacked-area.module.ts +0 -9
- package/src/lib/stacked-bars/config/stacked-bars-builder.ts +0 -109
- package/src/lib/stacked-bars/config/stacked-bars-config.spec.ts +0 -122
- package/src/lib/stacked-bars/config/stacked-bars-config.ts +0 -79
- package/src/lib/stacked-bars/config/stacked-bars-options.ts +0 -16
- package/src/lib/stacked-bars/events/actions/stacked-bars-click-actions.ts +0 -23
- package/src/lib/stacked-bars/events/actions/stacked-bars-hover-actions.ts +0 -22
- package/src/lib/stacked-bars/events/actions/stacked-bars-hover-move-actions.ts +0 -21
- package/src/lib/stacked-bars/events/stacked-bars-events.directive.spec.ts +0 -266
- package/src/lib/stacked-bars/events/stacked-bars-events.directive.ts +0 -240
- package/src/lib/stacked-bars/index.ts +0 -10
- package/src/lib/stacked-bars/stacked-bars.component.scss +0 -0
- package/src/lib/stacked-bars/stacked-bars.component.spec.ts +0 -25
- package/src/lib/stacked-bars/stacked-bars.component.ts +0 -158
- package/src/lib/stacked-bars/stacked-bars.module.ts +0 -9
- package/src/lib/stroke/base/stroke-base-options.ts +0 -7
- package/src/lib/stroke/base/stroke-base.ts +0 -9
- package/src/lib/stroke/index.ts +0 -5
- package/src/lib/stroke/stroke-builder.ts +0 -103
- package/src/lib/stroke/stroke-options.ts +0 -5
- package/src/lib/stroke/stroke.ts +0 -12
- package/src/lib/svg-text-wrap/index.ts +0 -3
- package/src/lib/svg-text-wrap/svg-text-wrap-builder.ts +0 -105
- package/src/lib/svg-text-wrap/svg-text-wrap-options.ts +0 -8
- package/src/lib/svg-text-wrap/svg-text-wrap.ts +0 -137
- package/src/lib/testing/data/continent-population-year-data.ts +0 -126
- package/src/lib/testing/data/country-area-continent.ts +0 -59
- package/src/lib/testing/data/state-population-income-year-data.ts +0 -123
- package/src/lib/testing/stubs/bars.component.stub.ts +0 -12
- package/src/lib/testing/stubs/chart.component.stub.ts +0 -6
- package/src/lib/testing/stubs/click.directive.stub.ts +0 -15
- package/src/lib/testing/stubs/core/destroy-ref.stub.ts +0 -9
- package/src/lib/testing/stubs/core/overlay-ref.stub.ts +0 -13
- package/src/lib/testing/stubs/core/overlay.stub.ts +0 -8
- package/src/lib/testing/stubs/event.directive.stub.ts +0 -10
- package/src/lib/testing/stubs/hover-move.directive.stub.ts +0 -17
- package/src/lib/testing/stubs/hover.directive.stub.ts +0 -14
- package/src/lib/testing/stubs/input-event.directive.stub.ts +0 -9
- package/src/lib/testing/stubs/lines.component.stub.ts +0 -13
- package/src/lib/testing/stubs/map-aux-marks.stub.ts +0 -10
- package/src/lib/testing/stubs/map-chart.component.stub.ts +0 -3
- package/src/lib/testing/stubs/map-legend-content.stub.ts +0 -16
- package/src/lib/testing/stubs/map-legend.component.stub.ts +0 -10
- package/src/lib/testing/stubs/map-primary-marks.stub.ts +0 -16
- package/src/lib/testing/stubs/ordinal-axis.stub.ts +0 -18
- package/src/lib/testing/stubs/primary-marks.stub.ts +0 -18
- package/src/lib/testing/stubs/quantitative-axis.stub.ts +0 -18
- package/src/lib/testing/stubs/services/main.service.stub.ts +0 -5
- package/src/lib/testing/stubs/services/utilities.service.stub.ts +0 -7
- package/src/lib/testing/stubs/stacked-area.component.stub.ts +0 -13
- package/src/lib/testing/stubs/x-axis.stub.ts +0 -10
- package/src/lib/testing/stubs/xy-axis.class.stub.ts +0 -20
- package/src/lib/testing/stubs/xy-axis.stub.ts +0 -44
- package/src/lib/testing/stubs/xy-chart.component.stub.ts +0 -5
- package/src/lib/testing/stubs/xy-data-marks.stub.ts +0 -15
- package/src/lib/testing/stubs/y-axis.stub.ts +0 -15
- package/src/lib/tooltips/config/tooltip.ts +0 -11
- package/src/lib/tooltips/html-tooltip/config/html-tooltip-builder.ts +0 -134
- package/src/lib/tooltips/html-tooltip/config/html-tooltip-config.ts +0 -21
- package/src/lib/tooltips/html-tooltip/config/html-tooltip-options.ts +0 -12
- package/src/lib/tooltips/html-tooltip/config/position/tooltip-position-builder.ts +0 -191
- package/src/lib/tooltips/html-tooltip/config/position/tooltip-position.ts +0 -42
- package/src/lib/tooltips/html-tooltip/config/size/tooltip-size-builder.ts +0 -75
- package/src/lib/tooltips/html-tooltip/config/size/tooltip-size-options.ts +0 -8
- package/src/lib/tooltips/html-tooltip/config/size/tooltip-size.ts +0 -15
- package/src/lib/tooltips/html-tooltip/html-tooltip.directive.spec.ts +0 -537
- package/src/lib/tooltips/html-tooltip/html-tooltip.directive.ts +0 -210
- package/src/lib/tooltips/html-tooltip/html-tooltip.module.ts +0 -16
- package/src/lib/tooltips/html-tooltip/tooltip-triangle/tooltip-triangle.component.html +0 -41
- package/src/lib/tooltips/html-tooltip/tooltip-triangle/tooltip-triangle.component.scss +0 -63
- package/src/lib/tooltips/html-tooltip/tooltip-triangle/tooltip-triangle.component.ts +0 -19
- package/src/lib/tooltips/index.ts +0 -11
- package/src/lib/tooltips/svg-tooltip/config/svg-tooltip.ts +0 -5
- package/src/lib/xy-background/index.ts +0 -2
- package/src/lib/xy-background/xy-background.component.html +0 -10
- package/src/lib/xy-background/xy-background.component.scss +0 -0
- package/src/lib/xy-background/xy-background.component.spec.ts +0 -24
- package/src/lib/xy-background/xy-background.component.ts +0 -19
- package/src/lib/xy-background/xy-background.module.ts +0 -8
- package/src/public-api.ts +0 -26
- package/src/test.ts +0 -15
- package/tsconfig.doc.json +0 -4
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -23
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -10
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { Renderer2 } from '@angular/core';
|
|
3
|
-
import { TestBed } from '@angular/core/testing';
|
|
4
|
-
import { selectAll } from 'd3';
|
|
5
|
-
import { of } from 'rxjs';
|
|
6
|
-
import { EventType } from '../../events';
|
|
7
|
-
import { GEOGRAPHIES } from '../geographies.component';
|
|
8
|
-
import { GeographiesEventsDirective } from './geographies-events.directive';
|
|
9
|
-
|
|
10
|
-
describe('GeographiesEventsDirective', () => {
|
|
11
|
-
let directive: GeographiesEventsDirective<any, any, any, any>;
|
|
12
|
-
let geographiesStub: any;
|
|
13
|
-
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
geographiesStub = {
|
|
16
|
-
pathsByLayer$: {
|
|
17
|
-
pipe: () => ({
|
|
18
|
-
subscribe: (cb: any) =>
|
|
19
|
-
cb([[{ nodes: () => [document.createElement('path')] }]]),
|
|
20
|
-
}),
|
|
21
|
-
},
|
|
22
|
-
config: {
|
|
23
|
-
attributeDataLayer: { getTooltipData: () => ({ foo: 'bar' }) },
|
|
24
|
-
geojsonPropertiesLayers: [{ getTooltipData: () => ({ foo: 'baz' }) }],
|
|
25
|
-
},
|
|
26
|
-
path: {
|
|
27
|
-
bounds: () => [
|
|
28
|
-
[0, 0],
|
|
29
|
-
[10, 20],
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
TestBed.configureTestingModule({
|
|
34
|
-
providers: [
|
|
35
|
-
GeographiesEventsDirective,
|
|
36
|
-
Renderer2,
|
|
37
|
-
{ provide: GEOGRAPHIES, useValue: geographiesStub },
|
|
38
|
-
],
|
|
39
|
-
});
|
|
40
|
-
directive = TestBed.inject(GeographiesEventsDirective);
|
|
41
|
-
directive.geographies = geographiesStub;
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should get elements from pathsByLayer$', (done) => {
|
|
45
|
-
// Simulate observable
|
|
46
|
-
directive.geographies.pathsByLayer$ = of(
|
|
47
|
-
[selectAll([document.createElement('path')]), selectAll([])] // empty selection to test flatMap
|
|
48
|
-
);
|
|
49
|
-
directive.getElements().subscribe((els: any) => {
|
|
50
|
-
expect(Array.isArray(els)).toBeTrue();
|
|
51
|
-
expect(els[0] instanceof Element).toBeTrue();
|
|
52
|
-
done();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('should call initFromElement and run hoverActions on onEnter (Hover)', () => {
|
|
57
|
-
const el = document.createElement('path');
|
|
58
|
-
const action = { onStart: jasmine.createSpy('onStart') } as any;
|
|
59
|
-
directive.hoverActions = [action];
|
|
60
|
-
(directive as any).isEventAllowed = (type: any) => type === EventType.Hover;
|
|
61
|
-
spyOn(directive, 'initFromElement').and.callThrough();
|
|
62
|
-
spyOn(directive, 'setPositionsFromElement');
|
|
63
|
-
directive.onEnter({} as PointerEvent, el);
|
|
64
|
-
expect(directive.initFromElement).toHaveBeenCalledWith(el);
|
|
65
|
-
expect(directive.setPositionsFromElement).toHaveBeenCalled();
|
|
66
|
-
expect(action.onStart).toHaveBeenCalled();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should call runActions with hoverMoveActions on onEnter (HoverMove)', () => {
|
|
70
|
-
const el = document.createElement('path');
|
|
71
|
-
const action = { initialize: jasmine.createSpy('initialize') } as any;
|
|
72
|
-
directive.hoverMoveActions = [action];
|
|
73
|
-
(directive as any).isEventAllowed = (type: any) =>
|
|
74
|
-
type === EventType.HoverMove;
|
|
75
|
-
spyOn(directive, 'initFromElement').and.callThrough();
|
|
76
|
-
directive.onEnter({} as PointerEvent, el);
|
|
77
|
-
expect(directive.initFromElement).toHaveBeenCalledWith(el);
|
|
78
|
-
expect(action.initialize).toHaveBeenCalled();
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('should call setPositionsFromPointer and run onStart for each hoverMoveAction on onMove', () => {
|
|
82
|
-
const action = { onStart: jasmine.createSpy('onStart') } as any;
|
|
83
|
-
directive.hoverMoveActions = [action];
|
|
84
|
-
(directive as any).isEventAllowed = (type: any) =>
|
|
85
|
-
type === EventType.HoverMove;
|
|
86
|
-
spyOn(directive, 'setPositionsFromPointer');
|
|
87
|
-
directive.onMove({} as PointerEvent, {} as Element);
|
|
88
|
-
expect(directive.setPositionsFromPointer).toHaveBeenCalled();
|
|
89
|
-
expect(action.onStart).toHaveBeenCalled();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('should call onEnd for each hoverAction on onLeave (Hover)', () => {
|
|
93
|
-
const action = { onEnd: jasmine.createSpy('onEnd') } as any;
|
|
94
|
-
directive.hoverActions = [action];
|
|
95
|
-
(directive as any).isEventAllowed = (type: any) => type === EventType.Hover;
|
|
96
|
-
spyOn(directive as any, 'resetDirective');
|
|
97
|
-
directive.onLeave({} as PointerEvent, {} as Element);
|
|
98
|
-
expect(action.onEnd).toHaveBeenCalled();
|
|
99
|
-
expect((directive as any).resetDirective).toHaveBeenCalled();
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('should call onEnd for each hoverMoveAction on onLeave (HoverMove)', () => {
|
|
103
|
-
const action = { onEnd: jasmine.createSpy('onEnd') } as any;
|
|
104
|
-
directive.hoverMoveActions = [action];
|
|
105
|
-
(directive as any).isEventAllowed = (type: any) =>
|
|
106
|
-
type === EventType.HoverMove;
|
|
107
|
-
spyOn(directive as any, 'resetDirective');
|
|
108
|
-
directive.onLeave({} as PointerEvent, {} as Element);
|
|
109
|
-
expect(action.onEnd).toHaveBeenCalled();
|
|
110
|
-
expect((directive as any).resetDirective).toHaveBeenCalled();
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('should call setPositionsFromElement and run clickActions on onClick if not prevented and has Hover', () => {
|
|
114
|
-
const el = document.createElement('path');
|
|
115
|
-
const action = { onStart: jasmine.createSpy('onStart') } as any;
|
|
116
|
-
directive.clickActions = [action];
|
|
117
|
-
directive.preventAction = {
|
|
118
|
-
click: false,
|
|
119
|
-
hover: false,
|
|
120
|
-
hoverMove: false,
|
|
121
|
-
input: false,
|
|
122
|
-
};
|
|
123
|
-
(directive as any).hasEvent = (type: any) => type === EventType.Hover;
|
|
124
|
-
spyOn(directive, 'initFromElement').and.callThrough();
|
|
125
|
-
spyOn(directive, 'setPositionsFromElement');
|
|
126
|
-
directive.onClick({} as PointerEvent, el);
|
|
127
|
-
expect(directive.initFromElement).toHaveBeenCalledWith(el);
|
|
128
|
-
expect(directive.setPositionsFromElement).toHaveBeenCalled();
|
|
129
|
-
expect(action.onStart).toHaveBeenCalled();
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('should call setPositionsFromPointer and run clickActions on onClick if not prevented and no Hover', () => {
|
|
133
|
-
const el = document.createElement('path');
|
|
134
|
-
const action = { onStart: jasmine.createSpy('onStart') } as any;
|
|
135
|
-
directive.clickActions = [action];
|
|
136
|
-
directive.preventAction = {
|
|
137
|
-
click: false,
|
|
138
|
-
hover: false,
|
|
139
|
-
hoverMove: false,
|
|
140
|
-
input: false,
|
|
141
|
-
};
|
|
142
|
-
(directive as any).hasEvent = () => false;
|
|
143
|
-
spyOn(directive, 'initFromElement').and.callThrough();
|
|
144
|
-
spyOn(directive, 'setPositionsFromPointer');
|
|
145
|
-
directive.onClick({} as PointerEvent, el);
|
|
146
|
-
expect(directive.initFromElement).toHaveBeenCalledWith(el);
|
|
147
|
-
expect(directive.setPositionsFromPointer).toHaveBeenCalled();
|
|
148
|
-
expect(action.onStart).toHaveBeenCalled();
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('should run onEnd for each clickAction and resetDirective on onClickRemove if not prevented', () => {
|
|
152
|
-
const action = { onEnd: jasmine.createSpy('onEnd') } as any;
|
|
153
|
-
directive.clickActions = [action];
|
|
154
|
-
directive.preventAction = {
|
|
155
|
-
click: false,
|
|
156
|
-
hover: false,
|
|
157
|
-
hoverMove: false,
|
|
158
|
-
input: false,
|
|
159
|
-
};
|
|
160
|
-
spyOn(directive as any, 'resetDirective');
|
|
161
|
-
directive.onClickRemove();
|
|
162
|
-
expect(action.onEnd).toHaveBeenCalled();
|
|
163
|
-
expect((directive as any).resetDirective).toHaveBeenCalled();
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it('should call onStart/onEnd for inputEventActions on onInputEvent', () => {
|
|
167
|
-
const onStart = jasmine.createSpy('onStart');
|
|
168
|
-
const onEnd = jasmine.createSpy('onEnd');
|
|
169
|
-
directive.inputEventActions = [{ onStart, onEnd } as any];
|
|
170
|
-
(directive as any).isEventAllowed = (type: any) => type === EventType.Input;
|
|
171
|
-
directive.onInputEvent('foo');
|
|
172
|
-
expect(onStart).toHaveBeenCalledWith(directive, 'foo');
|
|
173
|
-
directive.onInputEvent(null);
|
|
174
|
-
expect(onEnd).toHaveBeenCalledWith(directive, null);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it('should call select and set path, layer, and bounds in initFromElement', () => {
|
|
178
|
-
const el = document.createElement('path');
|
|
179
|
-
el.dataset['layerIndex'] = '0';
|
|
180
|
-
spyOn<any>(window, 'getComputedStyle').and.returnValue({}); // for d3 select
|
|
181
|
-
directive.geographies.config.attributeDataLayer = {
|
|
182
|
-
getTooltipData: () => ({ foo: 'bar' }),
|
|
183
|
-
};
|
|
184
|
-
directive.geographies.path = {
|
|
185
|
-
bounds: () => [
|
|
186
|
-
[0, 0],
|
|
187
|
-
[10, 20],
|
|
188
|
-
],
|
|
189
|
-
};
|
|
190
|
-
directive.initFromElement(el);
|
|
191
|
-
expect(directive.path).toBe(el as any);
|
|
192
|
-
expect(directive.bounds).toEqual([
|
|
193
|
-
[0, 0],
|
|
194
|
-
[10, 20],
|
|
195
|
-
]);
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it('should set positionX and positionY in setPositionsFromElement', () => {
|
|
199
|
-
directive.bounds = [
|
|
200
|
-
[0, 0],
|
|
201
|
-
[10, 20],
|
|
202
|
-
];
|
|
203
|
-
directive.setPositionsFromElement();
|
|
204
|
-
expect(directive.positionX).toBe(5);
|
|
205
|
-
expect(directive.positionY).toBe(10);
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
it('should emit interaction output', () => {
|
|
209
|
-
spyOn(directive.interactionOutput, 'emit');
|
|
210
|
-
const output = {
|
|
211
|
-
geography: {} as any,
|
|
212
|
-
origin: {} as any,
|
|
213
|
-
positionX: 1,
|
|
214
|
-
positionY: 2,
|
|
215
|
-
type: EventType.Hover,
|
|
216
|
-
datum: {},
|
|
217
|
-
color: 'red',
|
|
218
|
-
values: { id: 1 },
|
|
219
|
-
};
|
|
220
|
-
directive.emitInteractionOutput(output as any);
|
|
221
|
-
expect(directive.interactionOutput.emit).toHaveBeenCalledWith(
|
|
222
|
-
output as any
|
|
223
|
-
);
|
|
224
|
-
});
|
|
225
|
-
});
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { Directive, EventEmitter, inject, Input, Output } from '@angular/core';
|
|
2
|
-
import { select } from 'd3';
|
|
3
|
-
import { Geometry, MultiPolygon, Polygon } from 'geojson';
|
|
4
|
-
import { filter, map, Observable } from 'rxjs';
|
|
5
|
-
import {
|
|
6
|
-
DEFAULT_TOOLTIP_Y_OFFSET,
|
|
7
|
-
EventAction,
|
|
8
|
-
EventsDirective,
|
|
9
|
-
EventType,
|
|
10
|
-
HoverMoveAction,
|
|
11
|
-
InputEventAction,
|
|
12
|
-
MarksHost,
|
|
13
|
-
UnlistenFunction,
|
|
14
|
-
} from '../../events';
|
|
15
|
-
import { TooltipPosition } from '../../tooltips';
|
|
16
|
-
import { GeographiesAttributeDataLayer } from '../config/layers/attribute-data-layer/attribute-data-layer';
|
|
17
|
-
import { GeographiesGeojsonPropertiesLayer } from '../config/layers/geojson-properties-layer/geojson-properties-layer';
|
|
18
|
-
import { GeographiesFeature } from '../geographies-feature';
|
|
19
|
-
import { GEOGRAPHIES, GeographiesComponent } from '../geographies.component';
|
|
20
|
-
import { GeographiesInteractionOutput } from './geographies-interaction-output';
|
|
21
|
-
import { GeographiesTooltipPositioner } from './geographies-tooltip-positioner';
|
|
22
|
-
|
|
23
|
-
export type GeographiesHost<
|
|
24
|
-
Datum,
|
|
25
|
-
TGeographiesComponent extends GeographiesComponent<Datum> =
|
|
26
|
-
GeographiesComponent<Datum>,
|
|
27
|
-
> = MarksHost<GeographiesInteractionOutput<Datum>, TGeographiesComponent>;
|
|
28
|
-
|
|
29
|
-
@Directive({
|
|
30
|
-
selector: '[vicGeographiesEvents]',
|
|
31
|
-
})
|
|
32
|
-
export class GeographiesEventsDirective<
|
|
33
|
-
Datum,
|
|
34
|
-
TProperties,
|
|
35
|
-
TGeometry extends Geometry = MultiPolygon | Polygon,
|
|
36
|
-
TComponent extends GeographiesComponent<Datum, TProperties, TGeometry> =
|
|
37
|
-
GeographiesComponent<Datum, TProperties, TGeometry>,
|
|
38
|
-
> extends EventsDirective<GeographiesHost<Datum>> {
|
|
39
|
-
@Input()
|
|
40
|
-
hoverActions:
|
|
41
|
-
| EventAction<GeographiesHost<Datum>, GeographiesInteractionOutput<Datum>>[]
|
|
42
|
-
| null;
|
|
43
|
-
@Input()
|
|
44
|
-
hoverMoveActions:
|
|
45
|
-
| HoverMoveAction<
|
|
46
|
-
GeographiesHost<Datum>,
|
|
47
|
-
GeographiesInteractionOutput<Datum>
|
|
48
|
-
>[]
|
|
49
|
-
| null;
|
|
50
|
-
@Input()
|
|
51
|
-
clickActions:
|
|
52
|
-
| EventAction<GeographiesHost<Datum>, GeographiesInteractionOutput<Datum>>[]
|
|
53
|
-
| null;
|
|
54
|
-
@Input()
|
|
55
|
-
inputEventActions: InputEventAction<
|
|
56
|
-
GeographiesHost<Datum>,
|
|
57
|
-
GeographiesInteractionOutput<Datum>
|
|
58
|
-
>[];
|
|
59
|
-
@Output() interactionOutput = new EventEmitter<
|
|
60
|
-
GeographiesInteractionOutput<Datum>
|
|
61
|
-
>();
|
|
62
|
-
|
|
63
|
-
bounds: [[number, number], [number, number]];
|
|
64
|
-
layer:
|
|
65
|
-
| GeographiesAttributeDataLayer<Datum, TProperties, TGeometry>
|
|
66
|
-
| GeographiesGeojsonPropertiesLayer<TProperties, TGeometry>;
|
|
67
|
-
path: SVGPathElement;
|
|
68
|
-
|
|
69
|
-
public geographies = inject<TComponent>(GEOGRAPHIES);
|
|
70
|
-
|
|
71
|
-
get marks(): GeographiesComponent<Datum, TProperties, TGeometry> {
|
|
72
|
-
return this.geographies;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
getElements(): Observable<Element[]> {
|
|
76
|
-
return this.geographies.pathsByLayer$.pipe(
|
|
77
|
-
filter((layers) => !!layers),
|
|
78
|
-
map((layers) => layers.flatMap((selections) => selections.nodes()))
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
setupListeners(elements: Element[]): UnlistenFunction[] {
|
|
83
|
-
if (this.inputEventActions?.length && this.inputEvent$) {
|
|
84
|
-
this.events.push(EventType.Input);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return this.bindEventListeners(
|
|
88
|
-
elements,
|
|
89
|
-
this.buildInteractionListeners({
|
|
90
|
-
hover: this.hoverActions?.length && {
|
|
91
|
-
pointerenter: (e, el) => this.onEnter(e, el),
|
|
92
|
-
pointerleave: (e, el) => this.onLeave(e, el),
|
|
93
|
-
},
|
|
94
|
-
hoverMove: this.hoverMoveActions?.length && {
|
|
95
|
-
pointerenter: (e, el) => this.onEnter(e, el),
|
|
96
|
-
pointermove: (e, el) => this.onMove(e, el),
|
|
97
|
-
pointerleave: (e, el) => this.onLeave(e, el),
|
|
98
|
-
},
|
|
99
|
-
click: this.clickActions?.length && {
|
|
100
|
-
click: (e, el) => this.onClick(e, el),
|
|
101
|
-
},
|
|
102
|
-
})
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
onEnter(_: PointerEvent, el: Element): void {
|
|
107
|
-
this.initFromElement(el);
|
|
108
|
-
|
|
109
|
-
if (this.isEventAllowed(EventType.Hover)) {
|
|
110
|
-
this.setPositionsFromElement();
|
|
111
|
-
this.runActions(this.hoverActions, (a) => a.onStart(this.asHost()));
|
|
112
|
-
} else if (this.isEventAllowed(EventType.HoverMove)) {
|
|
113
|
-
this.runActions(this.hoverMoveActions, (a) => {
|
|
114
|
-
if (a.initialize) {
|
|
115
|
-
a.initialize(this.asHost());
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
122
|
-
onMove(event: PointerEvent, _: Element): void {
|
|
123
|
-
if (this.isEventAllowed(EventType.HoverMove)) {
|
|
124
|
-
this.setPositionsFromPointer(event);
|
|
125
|
-
this.hoverMoveActions.forEach((action) => action.onStart(this.asHost()));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
130
|
-
onLeave(_: PointerEvent, __: Element): void {
|
|
131
|
-
if (this.isEventAllowed(EventType.Hover)) {
|
|
132
|
-
this.hoverActions.forEach((action) => action.onEnd(this.asHost()));
|
|
133
|
-
} else if (this.isEventAllowed(EventType.HoverMove)) {
|
|
134
|
-
this.hoverMoveActions.forEach((action) => action.onEnd(this.asHost()));
|
|
135
|
-
}
|
|
136
|
-
this.resetDirective();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
onClick(event: PointerEvent, el: Element): void {
|
|
140
|
-
this.initFromElement(el);
|
|
141
|
-
if (!this.preventAction.click) {
|
|
142
|
-
if (this.hasEvent(EventType.Hover)) {
|
|
143
|
-
this.setPositionsFromElement();
|
|
144
|
-
} else {
|
|
145
|
-
this.setPositionsFromPointer(event);
|
|
146
|
-
}
|
|
147
|
-
this.runActions(this.clickActions, (a) => a.onStart(this.asHost()));
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
onClickRemove(): void {
|
|
152
|
-
if (!this.preventAction.click) {
|
|
153
|
-
this.runActions(this.clickActions, (a) => a.onEnd(this.asHost()));
|
|
154
|
-
this.resetDirective();
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
onInputEvent(inputValue: unknown): void {
|
|
159
|
-
if (this.isEventAllowed(EventType.Input)) {
|
|
160
|
-
if (inputValue === null || inputValue === undefined) {
|
|
161
|
-
this.inputEventActions.forEach((action) =>
|
|
162
|
-
action.onEnd(this.asHost(), inputValue)
|
|
163
|
-
);
|
|
164
|
-
} else {
|
|
165
|
-
this.inputEventActions.forEach((action) =>
|
|
166
|
-
action.onStart(this.asHost(), inputValue)
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
initFromElement(el: Element): void {
|
|
173
|
-
this.path = el as SVGPathElement;
|
|
174
|
-
const layerIndex = parseFloat(this.path.dataset['layerIndex']);
|
|
175
|
-
this.layer =
|
|
176
|
-
layerIndex === 0
|
|
177
|
-
? this.geographies.config.attributeDataLayer
|
|
178
|
-
: this.geographies.config.geojsonPropertiesLayers[layerIndex - 1];
|
|
179
|
-
const d = select(this.path).datum() as GeographiesFeature<
|
|
180
|
-
TProperties,
|
|
181
|
-
TGeometry
|
|
182
|
-
>;
|
|
183
|
-
this.bounds = this.geographies.path.bounds(d);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
setPositionsFromElement(): void {
|
|
187
|
-
this.positionX = (this.bounds[1][0] - this.bounds[0][0]) / 2;
|
|
188
|
-
this.positionY = (this.bounds[1][1] - this.bounds[0][1]) / 2;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
getInteractionOutput(type: EventType): GeographiesInteractionOutput<Datum> {
|
|
192
|
-
const tooltipData = this.layer.getTooltipData(this.path);
|
|
193
|
-
const position = new GeographiesTooltipPositioner({
|
|
194
|
-
x: this.positionX,
|
|
195
|
-
y: this.positionY,
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
return {
|
|
199
|
-
...tooltipData,
|
|
200
|
-
origin: this.path,
|
|
201
|
-
anchor: {
|
|
202
|
-
x: this.positionX,
|
|
203
|
-
y: this.positionY,
|
|
204
|
-
},
|
|
205
|
-
defaultPosition: position.fromAnchor({
|
|
206
|
-
x: 0,
|
|
207
|
-
y: DEFAULT_TOOLTIP_Y_OFFSET,
|
|
208
|
-
}),
|
|
209
|
-
fromAnchor: (offset?: Partial<{ x: number; y: number }>) => {
|
|
210
|
-
return position.fromAnchor({
|
|
211
|
-
x: offset?.x ?? 0,
|
|
212
|
-
y: offset?.y ?? DEFAULT_TOOLTIP_Y_OFFSET,
|
|
213
|
-
});
|
|
214
|
-
},
|
|
215
|
-
customPosition: (positions: TooltipPosition[]) => {
|
|
216
|
-
return position.customPosition(positions);
|
|
217
|
-
},
|
|
218
|
-
type,
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
emitInteractionOutput(
|
|
223
|
-
output: GeographiesInteractionOutput<Datum> | null
|
|
224
|
-
): void {
|
|
225
|
-
this.interactionOutput.emit(output);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
private resetDirective(): void {
|
|
229
|
-
this.path = undefined;
|
|
230
|
-
this.bounds = undefined;
|
|
231
|
-
this.positionX = undefined;
|
|
232
|
-
this.positionY = undefined;
|
|
233
|
-
this.layer = undefined;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { InteractionOutput } from '../../events/interaction-output';
|
|
2
|
-
import { HtmlTooltipCdkManagedPosition } from '../../tooltips';
|
|
3
|
-
import { GeographiesTooltipDatum } from '../config/layers/geographies-layer/geographies-layer';
|
|
4
|
-
|
|
5
|
-
export interface GeographiesInteractionOutput<Datum>
|
|
6
|
-
extends InteractionOutput, GeographiesTooltipDatum<Datum> {
|
|
7
|
-
/**
|
|
8
|
-
* A method that positions the tooltip with a user specified offset from the tooltip's anchor point.
|
|
9
|
-
*
|
|
10
|
-
* @param offset - Optional offset from the anchor's x and y position.
|
|
11
|
-
* If not provided, defaults to { x: 0, y: 0 }.
|
|
12
|
-
* If provided, the x value is added to the anchor's x position (moves tooltip right) and the y value is subtracted from the anchor's y position (moves tooltip up).
|
|
13
|
-
*/
|
|
14
|
-
fromAnchor: (
|
|
15
|
-
offset?: Partial<{ x: number; y: number }>
|
|
16
|
-
) => HtmlTooltipCdkManagedPosition;
|
|
17
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { TooltipPositioner } from '../../events/tooltip-positioner';
|
|
2
|
-
import { HtmlTooltipCdkManagedPosition } from '../../tooltips';
|
|
3
|
-
import { TooltipPositionBuilder } from '../../tooltips/html-tooltip/config/position/tooltip-position-builder';
|
|
4
|
-
|
|
5
|
-
const DEFAULT_POSITIONS = [
|
|
6
|
-
new TooltipPositionBuilder().fromTopLeft().attachBottomCenter().getPosition(),
|
|
7
|
-
new TooltipPositionBuilder().fromTopLeft().attachBottomLeft().getPosition(),
|
|
8
|
-
new TooltipPositionBuilder().fromTopLeft().attachBottomRight().getPosition(),
|
|
9
|
-
];
|
|
10
|
-
export class GeographiesTooltipPositioner extends TooltipPositioner {
|
|
11
|
-
constructor(private anchor: { x: number; y: number }) {
|
|
12
|
-
super();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
fromAnchor(offset: { x: number; y: number }): HtmlTooltipCdkManagedPosition {
|
|
16
|
-
const positionsWithOffsets = new TooltipPositionBuilder().applyOffsets(
|
|
17
|
-
DEFAULT_POSITIONS,
|
|
18
|
-
this.anchor.x + offset.x,
|
|
19
|
-
this.anchor.y - offset.y
|
|
20
|
-
);
|
|
21
|
-
return new HtmlTooltipCdkManagedPosition(positionsWithOffsets);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A utility type that represents a GeoJson feature with a properties object of type TProperties and a geometry object of type TGeometry.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
Feature,
|
|
7
|
-
GeoJsonProperties,
|
|
8
|
-
Geometry,
|
|
9
|
-
MultiPolygon,
|
|
10
|
-
Polygon,
|
|
11
|
-
} from 'geojson';
|
|
12
|
-
|
|
13
|
-
export type GeographiesFeature<
|
|
14
|
-
TProperties extends GeoJsonProperties = GeoJsonProperties,
|
|
15
|
-
TGeometry extends Geometry = MultiPolygon | Polygon,
|
|
16
|
-
> = Feature<TGeometry, TProperties>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<ng-content></ng-content>
|
|
File without changes
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
3
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
4
|
-
import { MapChartComponent } from '../charts/map-chart/map-chart.component';
|
|
5
|
-
import { VicGeographiesConfigBuilder } from './config/geographies-builder';
|
|
6
|
-
import { GeographiesComponent } from './geographies.component';
|
|
7
|
-
|
|
8
|
-
type Datum = { value: number; state: string };
|
|
9
|
-
|
|
10
|
-
describe('GeographiesComponent', () => {
|
|
11
|
-
let component: GeographiesComponent<any, any, any>;
|
|
12
|
-
let fixture: ComponentFixture<GeographiesComponent<any, any, any>>;
|
|
13
|
-
|
|
14
|
-
beforeEach(async () => {
|
|
15
|
-
await TestBed.configureTestingModule({
|
|
16
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
17
|
-
imports: [GeographiesComponent],
|
|
18
|
-
providers: [MapChartComponent],
|
|
19
|
-
}).compileComponents();
|
|
20
|
-
|
|
21
|
-
fixture = TestBed.createComponent(GeographiesComponent);
|
|
22
|
-
component = fixture.componentInstance;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe('initFromConfig()', () => {
|
|
26
|
-
beforeEach(() => {
|
|
27
|
-
spyOn(component, 'setChartScalesFromRanges');
|
|
28
|
-
spyOn(component, 'updateChartAttributeProperties');
|
|
29
|
-
component.config = new VicGeographiesConfigBuilder<
|
|
30
|
-
Datum,
|
|
31
|
-
{ name: string }
|
|
32
|
-
>()
|
|
33
|
-
.boundary('boundary' as any)
|
|
34
|
-
.featureIndexAccessor((d) => d.properties.name)
|
|
35
|
-
.attributeDataLayer((layer) =>
|
|
36
|
-
layer
|
|
37
|
-
.equalValueRangesBins((dimension) =>
|
|
38
|
-
dimension.valueAccessor((d) => d.value).numBins(5)
|
|
39
|
-
)
|
|
40
|
-
.geographyIndexAccessor((d) => d.state)
|
|
41
|
-
.data([
|
|
42
|
-
{ value: 1, state: 'AL' },
|
|
43
|
-
{ value: 2, state: 'AK' },
|
|
44
|
-
{ value: 3, state: 'AZ' },
|
|
45
|
-
{ value: 4, state: 'CA' },
|
|
46
|
-
{ value: 5, state: 'CO' },
|
|
47
|
-
{ value: 6, state: 'CO' },
|
|
48
|
-
])
|
|
49
|
-
)
|
|
50
|
-
.getConfig();
|
|
51
|
-
});
|
|
52
|
-
it('calls setPropertiesFromRanges once', () => {
|
|
53
|
-
component.initFromConfig();
|
|
54
|
-
expect(component.setChartScalesFromRanges).toHaveBeenCalledTimes(1);
|
|
55
|
-
});
|
|
56
|
-
it('calls updateChartAttributeProperties once', () => {
|
|
57
|
-
component.initFromConfig();
|
|
58
|
-
expect(component.updateChartAttributeProperties).toHaveBeenCalledTimes(1);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
describe('setPropertiesFromRanges()', () => {
|
|
63
|
-
beforeEach(() => {
|
|
64
|
-
spyOn(component, 'setProjection');
|
|
65
|
-
spyOn(component, 'setPath');
|
|
66
|
-
});
|
|
67
|
-
it('calls setProjection once', () => {
|
|
68
|
-
component.setChartScalesFromRanges();
|
|
69
|
-
expect(component.setProjection).toHaveBeenCalledTimes(1);
|
|
70
|
-
});
|
|
71
|
-
it('calls setPath once', () => {
|
|
72
|
-
component.setChartScalesFromRanges();
|
|
73
|
-
expect(component.setPath).toHaveBeenCalledTimes(1);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
describe('updateChartAttributeProperties', () => {
|
|
78
|
-
beforeEach(() => {
|
|
79
|
-
component.chart = {
|
|
80
|
-
updateAttributeProperties: jasmine.createSpy(
|
|
81
|
-
'updateAttributeProperties'
|
|
82
|
-
),
|
|
83
|
-
} as any;
|
|
84
|
-
component.config = new VicGeographiesConfigBuilder<
|
|
85
|
-
Datum,
|
|
86
|
-
{ name: string }
|
|
87
|
-
>()
|
|
88
|
-
.boundary('boundary' as any)
|
|
89
|
-
.featureIndexAccessor((d) => d.properties.name)
|
|
90
|
-
.attributeDataLayer((layer) =>
|
|
91
|
-
layer
|
|
92
|
-
.equalValueRangesBins((dimension) =>
|
|
93
|
-
dimension
|
|
94
|
-
.valueAccessor((d) => d.value)
|
|
95
|
-
.numBins(5)
|
|
96
|
-
.nullColor('red')
|
|
97
|
-
)
|
|
98
|
-
.geographyIndexAccessor((d) => d.state)
|
|
99
|
-
.data([
|
|
100
|
-
{ value: 1, state: 'AL' },
|
|
101
|
-
{ value: 2, state: 'AK' },
|
|
102
|
-
{ value: 3, state: 'AZ' },
|
|
103
|
-
{ value: 4, state: 'CA' },
|
|
104
|
-
{ value: 5, state: 'CO' },
|
|
105
|
-
{ value: 6, state: 'CO' },
|
|
106
|
-
])
|
|
107
|
-
)
|
|
108
|
-
.getConfig();
|
|
109
|
-
spyOn(
|
|
110
|
-
component.config.attributeDataLayer.attributeDimension,
|
|
111
|
-
'getScale'
|
|
112
|
-
).and.returnValue('attribute data scale');
|
|
113
|
-
});
|
|
114
|
-
it('calls getScale once', () => {
|
|
115
|
-
component.updateChartAttributeProperties();
|
|
116
|
-
expect(
|
|
117
|
-
component.config.attributeDataLayer.attributeDimension.getScale
|
|
118
|
-
).toHaveBeenCalledOnceWith();
|
|
119
|
-
});
|
|
120
|
-
it('calls updateAttributeProperties once with the correct value', () => {
|
|
121
|
-
component.updateChartAttributeProperties();
|
|
122
|
-
expect(
|
|
123
|
-
component.chart.updateAttributeProperties
|
|
124
|
-
).toHaveBeenCalledOnceWith({
|
|
125
|
-
scale: 'attribute data scale' as any,
|
|
126
|
-
config: component.config.attributeDataLayer.attributeDimension,
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
describe('drawMarks', () => {
|
|
132
|
-
beforeEach(() => {
|
|
133
|
-
spyOn(component, 'drawMap');
|
|
134
|
-
spyOn(component, 'updateGeographyElements');
|
|
135
|
-
component.chart.config = {
|
|
136
|
-
transitionDuration: 200,
|
|
137
|
-
} as any;
|
|
138
|
-
});
|
|
139
|
-
it('calls drawMap with the correct value', () => {
|
|
140
|
-
component.drawMarks();
|
|
141
|
-
expect(component.drawMap).toHaveBeenCalledWith(200);
|
|
142
|
-
});
|
|
143
|
-
it('calls updateGeographyElements with the correct value', () => {
|
|
144
|
-
component.drawMarks();
|
|
145
|
-
expect(component.updateGeographyElements).toHaveBeenCalledTimes(1);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
});
|