@mathstack/viz 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +11 -11
- package/fesm2022/mathstack-viz.mjs +11024 -0
- package/fesm2022/mathstack-viz.mjs.map +1 -0
- package/package.json +18 -6
- 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
package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.cy.ts
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @angular-eslint/prefer-standalone */
|
|
2
|
-
import { Component, Input } from '@angular/core';
|
|
3
|
-
import {
|
|
4
|
-
ChartConfig,
|
|
5
|
-
GeographiesConfig,
|
|
6
|
-
VicChartConfigBuilder,
|
|
7
|
-
VicChartModule,
|
|
8
|
-
VicGeographiesConfigBuilder,
|
|
9
|
-
VicGeographiesModule,
|
|
10
|
-
} from '@mathstack/viz';
|
|
11
|
-
import { geoMercator } from 'd3';
|
|
12
|
-
import {
|
|
13
|
-
FeatureCollection,
|
|
14
|
-
GeoJsonProperties,
|
|
15
|
-
MultiPolygon,
|
|
16
|
-
Polygon,
|
|
17
|
-
} from 'geojson';
|
|
18
|
-
import {
|
|
19
|
-
stateIncomePopulationYearData,
|
|
20
|
-
StateIncomePopulationYearDatum,
|
|
21
|
-
} from 'libs/viz/src/lib/testing/data/state-population-income-year-data';
|
|
22
|
-
import { beforeEach, cy, describe, expect, it } from 'local-cypress';
|
|
23
|
-
import * as topojson from 'topojson-client';
|
|
24
|
-
import { GeometryCollection, Objects, Topology } from 'topojson-specification';
|
|
25
|
-
|
|
26
|
-
const margin = { top: 36, right: 36, bottom: 36, left: 36 };
|
|
27
|
-
const chartHeight = 400;
|
|
28
|
-
const chartWidth = 600;
|
|
29
|
-
const attributeData = stateIncomePopulationYearData
|
|
30
|
-
.filter((x) => x.year === 2020)
|
|
31
|
-
.filter((x) => x.state !== 'Puerto Rico');
|
|
32
|
-
|
|
33
|
-
interface TestMapGeometryProperties extends GeoJsonProperties {
|
|
34
|
-
name: string;
|
|
35
|
-
id: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface TestMapObjects extends Objects {
|
|
39
|
-
country: GeometryCollection<TestMapGeometryProperties>;
|
|
40
|
-
states: GeometryCollection<TestMapGeometryProperties>;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
type TestUsMapTopology = Topology<TestMapObjects>;
|
|
44
|
-
|
|
45
|
-
// ***********************************************************
|
|
46
|
-
// Geographies component set up
|
|
47
|
-
// ***********************************************************
|
|
48
|
-
@Component({
|
|
49
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
50
|
-
selector: 'app-test-geographies',
|
|
51
|
-
template: `
|
|
52
|
-
<vic-map-chart [config]="chartConfig">
|
|
53
|
-
<svg:g
|
|
54
|
-
vic-primary-marks-geographies
|
|
55
|
-
svg-elements
|
|
56
|
-
[config]="geographiesConfig"
|
|
57
|
-
[vicGeographiesHoverActions]="hoverActions"
|
|
58
|
-
(vicGeographiesHoverOutput)="updateTooltipForNewOutput($event)"
|
|
59
|
-
></svg:g>
|
|
60
|
-
</vic-map-chart>
|
|
61
|
-
`,
|
|
62
|
-
styles: [],
|
|
63
|
-
imports: [VicChartModule, VicGeographiesModule],
|
|
64
|
-
})
|
|
65
|
-
class TestGeographiesComponent {
|
|
66
|
-
@Input() geographiesConfig: GeographiesConfig<
|
|
67
|
-
StateIncomePopulationYearDatum,
|
|
68
|
-
TestMapGeometryProperties
|
|
69
|
-
>;
|
|
70
|
-
chartConfig: ChartConfig = new VicChartConfigBuilder()
|
|
71
|
-
.margin(margin)
|
|
72
|
-
.maxWidth(chartWidth)
|
|
73
|
-
.maxHeight(chartHeight)
|
|
74
|
-
.scalingStrategy('responsive-width')
|
|
75
|
-
.getConfig();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const mountGeographiesComponent = (
|
|
79
|
-
geographiesConfig: GeographiesConfig<
|
|
80
|
-
StateIncomePopulationYearDatum,
|
|
81
|
-
TestMapGeometryProperties
|
|
82
|
-
>
|
|
83
|
-
): void => {
|
|
84
|
-
cy.mount(TestGeographiesComponent, {
|
|
85
|
-
componentProperties: {
|
|
86
|
-
geographiesConfig: geographiesConfig,
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// ***********************************************************
|
|
92
|
-
// Test dimension
|
|
93
|
-
// ***********************************************************
|
|
94
|
-
describe('the No Bins Attribute Data dimension', () => {
|
|
95
|
-
let geographiesConfig: GeographiesConfig<
|
|
96
|
-
StateIncomePopulationYearDatum,
|
|
97
|
-
TestMapGeometryProperties
|
|
98
|
-
>;
|
|
99
|
-
beforeEach(() => {
|
|
100
|
-
geographiesConfig = undefined;
|
|
101
|
-
});
|
|
102
|
-
it('it colors the paths according to the data and the users/the default range', () => {
|
|
103
|
-
// Note: use colors where only one rbg color channel varies so that it's possible to test data values.
|
|
104
|
-
cy.fixture('usMap.json').then((response) => {
|
|
105
|
-
const usMap: TestUsMapTopology = response;
|
|
106
|
-
const usBoundary = topojson.feature(
|
|
107
|
-
usMap,
|
|
108
|
-
usMap.objects.country
|
|
109
|
-
) as FeatureCollection<MultiPolygon, TestMapGeometryProperties>;
|
|
110
|
-
const states = topojson.feature(
|
|
111
|
-
usMap,
|
|
112
|
-
usMap.objects.states
|
|
113
|
-
) as FeatureCollection<MultiPolygon | Polygon, TestMapGeometryProperties>;
|
|
114
|
-
geographiesConfig = new VicGeographiesConfigBuilder<
|
|
115
|
-
StateIncomePopulationYearDatum,
|
|
116
|
-
TestMapGeometryProperties
|
|
117
|
-
>()
|
|
118
|
-
.boundary(usBoundary)
|
|
119
|
-
.featureIndexAccessor((d) => d.properties.name)
|
|
120
|
-
.attributeDataLayer((layer) =>
|
|
121
|
-
layer
|
|
122
|
-
.data(attributeData)
|
|
123
|
-
.class((d) => d.name.split(' ').join('-'))
|
|
124
|
-
.geographies(states.features)
|
|
125
|
-
.geographyIndexAccessor((d) => d.state)
|
|
126
|
-
.noBins((dimension) =>
|
|
127
|
-
dimension
|
|
128
|
-
.valueAccessor((d) => d.income)
|
|
129
|
-
.range(['white', '#ff00ff'])
|
|
130
|
-
)
|
|
131
|
-
)
|
|
132
|
-
.getConfig();
|
|
133
|
-
mountGeographiesComponent(geographiesConfig);
|
|
134
|
-
const sortedData = attributeData
|
|
135
|
-
.slice()
|
|
136
|
-
.sort((a, b) => a.income - b.income);
|
|
137
|
-
const lowest = sortedData[0].state.replace(/\s/g, '-');
|
|
138
|
-
const highest = sortedData[sortedData.length - 1].state.replace(
|
|
139
|
-
/\s/g,
|
|
140
|
-
'-'
|
|
141
|
-
);
|
|
142
|
-
cy.get(`.vic-geographies-group.${lowest} path`).then((path) => {
|
|
143
|
-
expect(path.attr('fill')).to.eq('rgb(255, 255, 255)');
|
|
144
|
-
});
|
|
145
|
-
cy.get(`.vic-geographies-group.${highest} path`).then((path) => {
|
|
146
|
-
expect(path.attr('fill')).to.eq('rgb(255, 0, 255)');
|
|
147
|
-
});
|
|
148
|
-
const colors = [255];
|
|
149
|
-
sortedData.forEach((d, i) => {
|
|
150
|
-
const state = d.state.replace(/\s/g, '-');
|
|
151
|
-
cy.get(`.vic-geographies-group.${state} path`).then((path) => {
|
|
152
|
-
const color = parseInt(path.attr('fill').split('(')[1].split(',')[1]);
|
|
153
|
-
expect(color).to.be.lte(colors[i]);
|
|
154
|
-
colors.push(color);
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('it colors undefined, null, and non-quant values with null color', () => {
|
|
161
|
-
cy.fixture('usMap.json').then((response) => {
|
|
162
|
-
const usMap: TestUsMapTopology = response;
|
|
163
|
-
const usBoundary = topojson.feature(
|
|
164
|
-
usMap,
|
|
165
|
-
usMap.objects.country
|
|
166
|
-
) as FeatureCollection<MultiPolygon, TestMapGeometryProperties>;
|
|
167
|
-
const states = topojson.feature(
|
|
168
|
-
usMap,
|
|
169
|
-
usMap.objects.states
|
|
170
|
-
) as FeatureCollection<MultiPolygon | Polygon, TestMapGeometryProperties>;
|
|
171
|
-
const dataWithFalsyValues = attributeData.map((d) => {
|
|
172
|
-
if (d.state === 'Texas') {
|
|
173
|
-
return { ...d, income: null };
|
|
174
|
-
} else if (d.state === 'California') {
|
|
175
|
-
return { ...d, income: undefined };
|
|
176
|
-
} else if (d.state === 'Florida') {
|
|
177
|
-
return { ...d, income: 'Not a number' as unknown as number };
|
|
178
|
-
} else {
|
|
179
|
-
return d;
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
const nullColor = 'chartreuse';
|
|
183
|
-
geographiesConfig = new VicGeographiesConfigBuilder<
|
|
184
|
-
StateIncomePopulationYearDatum,
|
|
185
|
-
TestMapGeometryProperties
|
|
186
|
-
>()
|
|
187
|
-
.boundary(usBoundary)
|
|
188
|
-
.featureIndexAccessor((d) => d.properties.name)
|
|
189
|
-
.attributeDataLayer((layer) =>
|
|
190
|
-
layer
|
|
191
|
-
.data(dataWithFalsyValues)
|
|
192
|
-
.class((d) => d.name.split(' ').join('-'))
|
|
193
|
-
.geographies(states.features)
|
|
194
|
-
.geographyIndexAccessor((d) => d.state)
|
|
195
|
-
.noBins((dimension) =>
|
|
196
|
-
dimension
|
|
197
|
-
.valueAccessor((d) => d.income)
|
|
198
|
-
.range(['white', '#ff00ff'])
|
|
199
|
-
.nullColor(nullColor)
|
|
200
|
-
)
|
|
201
|
-
)
|
|
202
|
-
.getConfig();
|
|
203
|
-
mountGeographiesComponent(geographiesConfig);
|
|
204
|
-
cy.get(`.vic-geographies-group.Florida path`).then((path) => {
|
|
205
|
-
expect(path.attr('fill')).to.eq(nullColor);
|
|
206
|
-
});
|
|
207
|
-
cy.get(`.vic-geographies-group.Texas path`).then((path) => {
|
|
208
|
-
expect(path.attr('fill')).to.eq(nullColor);
|
|
209
|
-
});
|
|
210
|
-
cy.get(`.vic-geographies-group.California path`).then((path) => {
|
|
211
|
-
expect(path.attr('fill')).to.eq(nullColor);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
it('it colors geographies not in attribute data with the null color', () => {
|
|
217
|
-
// island territories like American Samoa, Guam, etc. are not in the attribute data but are in the geojson
|
|
218
|
-
// they wil be drawn with any projection but let's use geoMercator to make them a bit more visible-ish
|
|
219
|
-
cy.fixture('usMap.json').then((response) => {
|
|
220
|
-
const usMap: TestUsMapTopology = response;
|
|
221
|
-
const usBoundary = topojson.feature(
|
|
222
|
-
usMap,
|
|
223
|
-
usMap.objects.country
|
|
224
|
-
) as FeatureCollection<MultiPolygon, TestMapGeometryProperties>;
|
|
225
|
-
const states = topojson.feature(
|
|
226
|
-
usMap,
|
|
227
|
-
usMap.objects.states
|
|
228
|
-
) as FeatureCollection<MultiPolygon | Polygon, TestMapGeometryProperties>;
|
|
229
|
-
const nullColor = 'chartreuse';
|
|
230
|
-
geographiesConfig = new VicGeographiesConfigBuilder<
|
|
231
|
-
StateIncomePopulationYearDatum,
|
|
232
|
-
TestMapGeometryProperties
|
|
233
|
-
>()
|
|
234
|
-
.boundary(usBoundary)
|
|
235
|
-
.featureIndexAccessor((d) => d.properties.name)
|
|
236
|
-
.projection(geoMercator())
|
|
237
|
-
.attributeDataLayer((layer) =>
|
|
238
|
-
layer
|
|
239
|
-
.data(attributeData)
|
|
240
|
-
.class((d) => d.name.split(' ').join('-'))
|
|
241
|
-
.geographies(states.features)
|
|
242
|
-
.geographyIndexAccessor((d) => d.state)
|
|
243
|
-
.noBins((dimension) =>
|
|
244
|
-
dimension
|
|
245
|
-
.valueAccessor((d) => d.income)
|
|
246
|
-
.range(['white', '#ff00ff'])
|
|
247
|
-
.nullColor(nullColor)
|
|
248
|
-
)
|
|
249
|
-
)
|
|
250
|
-
.getConfig();
|
|
251
|
-
mountGeographiesComponent(geographiesConfig);
|
|
252
|
-
const geographiesNotInAttributeData = states.features
|
|
253
|
-
.filter(
|
|
254
|
-
(x) =>
|
|
255
|
-
attributeData.findIndex((d) => d.state === x.properties.name) === -1
|
|
256
|
-
)
|
|
257
|
-
.map((x) => x.properties.name.replace(/\s/g, '-'));
|
|
258
|
-
geographiesNotInAttributeData.forEach((state) => {
|
|
259
|
-
cy.get(`.vic-geographies-group.${state} path`).then((path) => {
|
|
260
|
-
expect(path.attr('fill')).to.eq(nullColor);
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
});
|
package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.spec.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { NoBinsAttributeDataDimension } from './no-bins';
|
|
3
|
-
import { NoBinsAttributeDataDimensionBuilder } from './no-bins-builder';
|
|
4
|
-
|
|
5
|
-
describe('VicNoBinsAttributeDataDimension', () => {
|
|
6
|
-
let dimension: NoBinsAttributeDataDimension<any>;
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
dimension = new NoBinsAttributeDataDimensionBuilder<any>()
|
|
9
|
-
.valueAccessor((d) => d)
|
|
10
|
-
._build();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
describe('setPropertiesFromData', () => {
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
spyOn(dimension as any, 'setDomain');
|
|
16
|
-
});
|
|
17
|
-
it('calls setDomain once', () => {
|
|
18
|
-
dimension.setPropertiesFromData([1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
|
19
|
-
expect((dimension as any).setDomain).toHaveBeenCalledOnceWith([
|
|
20
|
-
1, 2, 3, 4, 5, 6, 7, 8, 9,
|
|
21
|
-
]);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe('setDomain', () => {
|
|
26
|
-
it('sets the domain to the users value if it exists', () => {
|
|
27
|
-
dimension = new NoBinsAttributeDataDimensionBuilder<any>()
|
|
28
|
-
.valueAccessor((d) => d)
|
|
29
|
-
.domain([0, 5])
|
|
30
|
-
._build();
|
|
31
|
-
(dimension as any).setDomain([1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
|
32
|
-
expect((dimension as any).domain).toEqual([0, 5]);
|
|
33
|
-
});
|
|
34
|
-
it('sets the domain to values if there is no user provided domain', () => {
|
|
35
|
-
dimension = new NoBinsAttributeDataDimensionBuilder<any>()
|
|
36
|
-
.valueAccessor((d) => d)
|
|
37
|
-
._build();
|
|
38
|
-
(dimension as any).setDomain([1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
|
39
|
-
expect((dimension as any).domain).toEqual([1, 9]);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
2
|
-
import { extent } from 'd3';
|
|
3
|
-
import { BinStrategy } from '../attribute-data-bin-enums';
|
|
4
|
-
import { AttributeDataDimension } from '../attribute-data/attribute-data-dimension';
|
|
5
|
-
import { NoBinsAttributeDataDimensionOptions } from './no-bins-options';
|
|
6
|
-
|
|
7
|
-
export class NoBinsAttributeDataDimension<Datum> extends AttributeDataDimension<
|
|
8
|
-
Datum,
|
|
9
|
-
number
|
|
10
|
-
> {
|
|
11
|
-
override readonly binType: BinStrategy.none;
|
|
12
|
-
domain: [number, number];
|
|
13
|
-
formatSpecifier: string;
|
|
14
|
-
|
|
15
|
-
constructor(options: NoBinsAttributeDataDimensionOptions<Datum>) {
|
|
16
|
-
super('number');
|
|
17
|
-
this.binType = BinStrategy.none;
|
|
18
|
-
safeAssign(this, options);
|
|
19
|
-
if (!this.valueAccessor) {
|
|
20
|
-
console.error(
|
|
21
|
-
'Value accessor is required for NoBinsAttributeDataDimension'
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
setPropertiesFromData(data: Datum[]): void {
|
|
27
|
-
const values = data.map(this.valueAccessor);
|
|
28
|
-
this.setDomain(values);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
protected setDomain(values: number[]): void {
|
|
32
|
-
const domainValues = this.domain ?? values;
|
|
33
|
-
this.domain = extent(domainValues);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getScale() {
|
|
37
|
-
return this.scale()
|
|
38
|
-
.domain(this.domain)
|
|
39
|
-
.range(this.range)
|
|
40
|
-
.unknown(this.nullColor);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
2
|
-
import { Geometry } from 'geojson';
|
|
3
|
-
import { StrokeBuilder } from '../../../../stroke/stroke-builder';
|
|
4
|
-
import { GeographiesFeature } from '../../../geographies-feature';
|
|
5
|
-
import { GeographiesLabelsBuilder } from '../labels/geographies-labels-builder';
|
|
6
|
-
|
|
7
|
-
const DEFAULT = {
|
|
8
|
-
_class: () => '',
|
|
9
|
-
_mixBlendMode: 'normal',
|
|
10
|
-
_strokeColor: 'dimgray',
|
|
11
|
-
_strokeWidth: '1',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export abstract class GeographiesLayerBuilder<
|
|
15
|
-
TProperties,
|
|
16
|
-
TGeometry extends Geometry,
|
|
17
|
-
> {
|
|
18
|
-
protected _class: (d: TProperties) => string;
|
|
19
|
-
protected _enableEventActions: boolean;
|
|
20
|
-
protected _geographies: Array<GeographiesFeature<TProperties, TGeometry>>;
|
|
21
|
-
protected labelsBuilder: GeographiesLabelsBuilder<TProperties, TGeometry>;
|
|
22
|
-
protected _mixBlendMode: string;
|
|
23
|
-
protected strokeBuilder: StrokeBuilder;
|
|
24
|
-
|
|
25
|
-
constructor() {
|
|
26
|
-
safeAssign(this, DEFAULT);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* OPTIONAL. Provides a class on the SVG element that correspends to a single datum. If a datum creates multiple SVG elements -- for example, a rect and a label, the class will be applied on the parent SVGGElement.
|
|
31
|
-
*
|
|
32
|
-
* IF the chart does not have SVG elements that correspond to a single datum, this class will be placed on the SVG element that represents a collection of data, for example, a area in a stacked area chart, or a line in a line chart. In this case the datum passed to the callback function will be the first datum in the collection.
|
|
33
|
-
*
|
|
34
|
-
* Note that if the resultant string has spaces in the name, multiple classes will be applied. For example, if the class is 'North Carolina', the element will have the classes 'North' and 'Carolina'.
|
|
35
|
-
*/
|
|
36
|
-
class(value: null): this;
|
|
37
|
-
class(value: string): this;
|
|
38
|
-
class(value: (d: TProperties) => string): this;
|
|
39
|
-
class(value: ((d: TProperties) => string) | string | null): this {
|
|
40
|
-
if (value === null) {
|
|
41
|
-
this._class = DEFAULT._class;
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
if (typeof value === 'string') {
|
|
45
|
-
this._class = () => value;
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
this._class = value;
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* OPTIONAL. Determines whether the layer can use viz event actions.
|
|
54
|
-
*
|
|
55
|
-
* If true, the event listener that corresponds to the provided directive will be placed on that layer's paths.
|
|
56
|
-
*
|
|
57
|
-
* @default true for Attribute Data layer
|
|
58
|
-
* @default false for Geojson Properties layers
|
|
59
|
-
*/
|
|
60
|
-
enableEventActions(value: boolean): this {
|
|
61
|
-
this._enableEventActions = value;
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* REQUIRED. GeoJSON features that define the geographies to be drawn.
|
|
67
|
-
*/
|
|
68
|
-
geographies(value: Array<GeographiesFeature<TProperties, TGeometry>>): this {
|
|
69
|
-
this._geographies = value;
|
|
70
|
-
return this;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* OPTIONAL. Creates a configuration object for labels that will be drawn on the geographies.
|
|
75
|
-
*/
|
|
76
|
-
labels(labels: null): this;
|
|
77
|
-
labels(
|
|
78
|
-
labels: (labels: GeographiesLabelsBuilder<TProperties, TGeometry>) => void
|
|
79
|
-
): this;
|
|
80
|
-
labels(
|
|
81
|
-
labels:
|
|
82
|
-
| ((labels: GeographiesLabelsBuilder<TProperties, TGeometry>) => void)
|
|
83
|
-
| null
|
|
84
|
-
): this {
|
|
85
|
-
if (labels === null) {
|
|
86
|
-
this.labelsBuilder = undefined;
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
this.labelsBuilder = new GeographiesLabelsBuilder();
|
|
90
|
-
labels(this.labelsBuilder);
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Sets the mix-blend-mode of the marks.
|
|
96
|
-
*
|
|
97
|
-
* @default 'normal'
|
|
98
|
-
*/
|
|
99
|
-
mixBlendMode(mixBlendMode: string): this {
|
|
100
|
-
this._mixBlendMode = mixBlendMode;
|
|
101
|
-
return this;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* OPTIONAL. Sets the appearance of the stroke for the geographies in the layer.
|
|
106
|
-
*/
|
|
107
|
-
stroke(setProperties?: (stroke: StrokeBuilder) => void): this {
|
|
108
|
-
this.initStrokeBuilder();
|
|
109
|
-
setProperties?.(this.strokeBuilder);
|
|
110
|
-
return this;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
protected initStrokeBuilder(): void {
|
|
114
|
-
this.strokeBuilder = new StrokeBuilder();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Geometry } from 'geojson';
|
|
2
|
-
import { Stroke } from '../../../../stroke/stroke';
|
|
3
|
-
import { GeographiesFeature } from '../../../geographies-feature';
|
|
4
|
-
import { GeographiesLabels } from '../labels/geographies-labels';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Base configuration object for geographies that can be used with or without attribute data.
|
|
8
|
-
*
|
|
9
|
-
* The generic parameters are the same as those in VicGeographiesConfig.
|
|
10
|
-
*/
|
|
11
|
-
export interface GeographiesLayerOptions<
|
|
12
|
-
TProperties,
|
|
13
|
-
TGeometry extends Geometry,
|
|
14
|
-
> {
|
|
15
|
-
enableEventActions: boolean;
|
|
16
|
-
featureClass: (d: TProperties) => string;
|
|
17
|
-
labels: GeographiesLabels<TProperties, TGeometry>;
|
|
18
|
-
geographies: Array<GeographiesFeature<TProperties, TGeometry>>;
|
|
19
|
-
stroke: Stroke;
|
|
20
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import * as CSSType from 'csstype';
|
|
2
|
-
import { Geometry } from 'geojson';
|
|
3
|
-
import { ColorUtilities } from '../../../../core/utilities/colors';
|
|
4
|
-
import { Stroke } from '../../../../stroke/stroke';
|
|
5
|
-
import { GeographiesFeature } from '../../../geographies-feature';
|
|
6
|
-
import { GeographiesLabels } from '../labels/geographies-labels';
|
|
7
|
-
import {
|
|
8
|
-
GeographiesLabelsColorOptions,
|
|
9
|
-
GeographiesLabelsFontWeightOptions,
|
|
10
|
-
} from '../labels/geographies-labels-options';
|
|
11
|
-
import { GeographiesLayerOptions } from './geographies-layer-options';
|
|
12
|
-
|
|
13
|
-
export interface GeographiesTooltipDatum<Datum> {
|
|
14
|
-
attributeValue?: string;
|
|
15
|
-
color: string;
|
|
16
|
-
datum?: Datum;
|
|
17
|
-
geography: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export abstract class GeographiesLayer<
|
|
21
|
-
Datum,
|
|
22
|
-
TProperties,
|
|
23
|
-
TGeometry extends Geometry,
|
|
24
|
-
> implements GeographiesLayerOptions<TProperties, TGeometry> {
|
|
25
|
-
enableEventActions: boolean;
|
|
26
|
-
featureClass: (d: TProperties) => string;
|
|
27
|
-
featureIndexAccessor: (
|
|
28
|
-
d: GeographiesFeature<TProperties, TGeometry>
|
|
29
|
-
) => string;
|
|
30
|
-
geographies: Array<GeographiesFeature<TProperties, TGeometry>>;
|
|
31
|
-
id: number;
|
|
32
|
-
labels: GeographiesLabels<TProperties, TGeometry>;
|
|
33
|
-
stroke: Stroke;
|
|
34
|
-
|
|
35
|
-
setFeatureIndexAccessor(
|
|
36
|
-
accessor: (d: GeographiesFeature<TProperties, TGeometry>) => string
|
|
37
|
-
): void {
|
|
38
|
-
this.featureIndexAccessor = accessor;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
abstract getFill(feature: GeographiesFeature<TProperties, TGeometry>): string;
|
|
42
|
-
|
|
43
|
-
abstract getTooltipData(
|
|
44
|
-
path: SVGPathElement
|
|
45
|
-
): GeographiesTooltipDatum<Datum | undefined>;
|
|
46
|
-
|
|
47
|
-
getLabelColor(
|
|
48
|
-
feature: GeographiesFeature<TProperties, TGeometry>
|
|
49
|
-
): CSSType.Property.Fill {
|
|
50
|
-
const pathColor = this.getFill(feature);
|
|
51
|
-
if (typeof this.labels.color === 'string') {
|
|
52
|
-
return this.labels.color;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (pathColor.startsWith('url')) {
|
|
56
|
-
return this.labels.color.pattern ?? this.labels.color.default;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return ColorUtilities.getHigherContrastColorForBackground(
|
|
60
|
-
pathColor,
|
|
61
|
-
this.labels.color.default,
|
|
62
|
-
this.labels.color.contrastAlternative
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
getLabelFontWeight(
|
|
67
|
-
feature: GeographiesFeature<TProperties, TGeometry>
|
|
68
|
-
): CSSType.Property.FontWeight {
|
|
69
|
-
const pathColor = this.getFill(feature);
|
|
70
|
-
|
|
71
|
-
if (!this.isContrastFontWeightOptions(this.labels.fontWeight)) {
|
|
72
|
-
return this.labels.fontWeight;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (pathColor.startsWith('url')) {
|
|
76
|
-
return this.labels.fontWeight.pattern ?? this.labels.fontWeight.default;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (this.isContrastColorOptions(this.labels.color)) {
|
|
80
|
-
const labelColor = ColorUtilities.getHigherContrastColorForBackground(
|
|
81
|
-
pathColor,
|
|
82
|
-
this.labels.color.default,
|
|
83
|
-
this.labels.color.contrastAlternative
|
|
84
|
-
);
|
|
85
|
-
return labelColor === this.labels.color.default
|
|
86
|
-
? this.labels.fontWeight.default
|
|
87
|
-
: this.labels.fontWeight.contrastAlternative;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return this.labels.fontWeight.default;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
isContrastColorOptions(
|
|
94
|
-
options: GeographiesLabelsColorOptions | CSSType.Property.Fill
|
|
95
|
-
): options is GeographiesLabelsColorOptions {
|
|
96
|
-
return typeof options === 'object' && options !== null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
isContrastFontWeightOptions(
|
|
100
|
-
options: GeographiesLabelsFontWeightOptions | CSSType.Property.FontWeight
|
|
101
|
-
): options is GeographiesLabelsFontWeightOptions {
|
|
102
|
-
return typeof options === 'object' && options !== null;
|
|
103
|
-
}
|
|
104
|
-
}
|