@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,101 +0,0 @@
|
|
|
1
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
2
|
-
import { InternSet, ScaleBand, scaleBand, scalePoint, ScalePoint } from 'd3';
|
|
3
|
-
import { DataValue } from '../../../core/types/values';
|
|
4
|
-
import { DataDimension } from '../../dimension';
|
|
5
|
-
import { OrdinalChartPositionDimensionOptions } from './ordinal-chart-position-options';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* A dimension that transforms string / number / Date values into a position on a chart.
|
|
9
|
-
*
|
|
10
|
-
* This dimension is used for the positional dimensions of a chart, such as x and y. The underlying scale will always be a [D3 band scale](https://d3js.org/d3-scale/band). The range of the scale will be a dimension from the chart.
|
|
11
|
-
*
|
|
12
|
-
* The first generic is the type of the data that will be passed to the dimension. The second generic is the type of the value that will be used to position the data on the chart.
|
|
13
|
-
*
|
|
14
|
-
* TESTABLE FUNCTIONALITY
|
|
15
|
-
*
|
|
16
|
-
* - It extracts values for the dimension from data.
|
|
17
|
-
* - tested in: bars.cy.ts, dots.cy.ts, stacked-bars.cy.ts
|
|
18
|
-
* - It sets the domain of the dimension.
|
|
19
|
-
* - tested in: bars.cy.ts, dots.cy.ts
|
|
20
|
-
* - It checks if a value is in the domain.
|
|
21
|
-
* - tested in: bars.cy.ts
|
|
22
|
-
* - It creates a scale from a range.
|
|
23
|
-
* - tested in: bars.cy.ts, dots.cy.ts
|
|
24
|
-
* - The domain will be unique values from the user-provided domain if the user provides a domain.
|
|
25
|
-
* - tested in: ordinal-chart-position.spec.ts
|
|
26
|
-
* - The domain will be unique values from the data if no custom domain is given by the user.
|
|
27
|
-
* - tested in: ordinal-chart-position.spec.ts
|
|
28
|
-
* - The domain can be set in reverse order.
|
|
29
|
-
* - tested in: ordinal-chart-position.spec.ts
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
export class OrdinalChartPositionDimension<Datum, Domain extends DataValue>
|
|
33
|
-
extends DataDimension<Datum, Domain>
|
|
34
|
-
implements OrdinalChartPositionDimensionOptions<Datum, Domain>
|
|
35
|
-
{
|
|
36
|
-
readonly align: number;
|
|
37
|
-
private _calculatedDomain: Domain[];
|
|
38
|
-
readonly domain: Domain[];
|
|
39
|
-
private internSetDomain: InternSet<Domain>;
|
|
40
|
-
readonly paddingInner: number;
|
|
41
|
-
readonly paddingOuter: number;
|
|
42
|
-
private scaleFn: (
|
|
43
|
-
domain?: Iterable<Domain>,
|
|
44
|
-
range?: Iterable<number>
|
|
45
|
-
) => ScaleBand<Domain> | ScalePoint<Domain>;
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
-
override readonly valueAccessor: (d: Datum, ...args: any) => Domain;
|
|
48
|
-
|
|
49
|
-
constructor(
|
|
50
|
-
scaleType: 'band' | 'point' = 'band',
|
|
51
|
-
options: OrdinalChartPositionDimensionOptions<Datum, Domain>
|
|
52
|
-
) {
|
|
53
|
-
super('ordinal');
|
|
54
|
-
this.scaleFn = scaleType === 'band' ? scaleBand : scalePoint;
|
|
55
|
-
safeAssign(this, options);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
get calculatedDomain(): Domain[] {
|
|
59
|
-
return this._calculatedDomain;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
setPropertiesFromData(data: Datum[], reverseDomain: boolean = false): void {
|
|
63
|
-
this.setValues(data);
|
|
64
|
-
this.setDomain(reverseDomain);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
protected setDomain(reverseDomain: boolean): void {
|
|
68
|
-
let domain = this.domain;
|
|
69
|
-
if (domain === undefined) {
|
|
70
|
-
domain = this.values;
|
|
71
|
-
}
|
|
72
|
-
this.internSetDomain = new InternSet(domain);
|
|
73
|
-
const uniqueValues = [...this.internSetDomain.values()];
|
|
74
|
-
this._calculatedDomain = reverseDomain
|
|
75
|
-
? uniqueValues.reverse()
|
|
76
|
-
: uniqueValues;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
domainIncludes(value: Domain): boolean {
|
|
80
|
-
return this.internSetDomain.has(value);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
getScaleFromRange(
|
|
84
|
-
range: [number, number]
|
|
85
|
-
): ScaleBand<Domain> | ScalePoint<Domain> {
|
|
86
|
-
if (this.scaleFn === scalePoint) {
|
|
87
|
-
return (this.scaleFn() as ScalePoint<Domain>)
|
|
88
|
-
.domain(this._calculatedDomain)
|
|
89
|
-
.range(range)
|
|
90
|
-
.padding(this.paddingOuter)
|
|
91
|
-
.align(this.align);
|
|
92
|
-
} else {
|
|
93
|
-
return (this.scaleFn() as ScaleBand<Domain>)
|
|
94
|
-
.domain(this._calculatedDomain)
|
|
95
|
-
.range(range)
|
|
96
|
-
.paddingInner(this.paddingInner)
|
|
97
|
-
.paddingOuter(this.paddingOuter)
|
|
98
|
-
.align(this.align);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value-builder.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
2
|
-
import { schemeTableau10 } from 'd3';
|
|
3
|
-
import { DataValue, VisualValue } from '../../../core/types/values';
|
|
4
|
-
import { DataDimensionBuilder } from '../../dimension-builder';
|
|
5
|
-
import { OrdinalVisualValueDimension } from './ordinal-visual-value';
|
|
6
|
-
|
|
7
|
-
const DEFAULT = {
|
|
8
|
-
_range: schemeTableau10,
|
|
9
|
-
_valueAccessor: () => '',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export class OrdinalVisualValueDimensionBuilder<
|
|
13
|
-
Datum,
|
|
14
|
-
Domain extends DataValue,
|
|
15
|
-
Range extends VisualValue,
|
|
16
|
-
> extends DataDimensionBuilder<Datum, Domain> {
|
|
17
|
-
private _domain: Domain[];
|
|
18
|
-
private _range: Range[];
|
|
19
|
-
private _scale: (category: Domain) => Range;
|
|
20
|
-
|
|
21
|
-
constructor() {
|
|
22
|
-
super();
|
|
23
|
-
safeAssign(this, DEFAULT);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* OPTIONAL. Sets an array of categorical values that will be used to define the domain of the scale.
|
|
28
|
-
*
|
|
29
|
-
* If not provided, the domain will be determined by the data.
|
|
30
|
-
*/
|
|
31
|
-
domain(domain: null): this;
|
|
32
|
-
domain(domain: Domain[]): this;
|
|
33
|
-
domain(domain: Domain[]): this {
|
|
34
|
-
if (domain === null) {
|
|
35
|
-
this._domain = undefined;
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
this._domain = domain;
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* OPTIONAL. Sets an array of visual values that will be the output from D3 scale ordinal.
|
|
44
|
-
*
|
|
45
|
-
* For example, this could be an array of colors or sizes.
|
|
46
|
-
*
|
|
47
|
-
* To have all marks use the same visual value, use an array with a single element.
|
|
48
|
-
*
|
|
49
|
-
* Will not be used if `scale` is set by the user.
|
|
50
|
-
*
|
|
51
|
-
* @default d3.schemeTableau10
|
|
52
|
-
*/
|
|
53
|
-
range(range: null): this;
|
|
54
|
-
range(range: Range[]): this;
|
|
55
|
-
range(range: Range[]): this {
|
|
56
|
-
if (range === null) {
|
|
57
|
-
this._range = DEFAULT._range as Range[];
|
|
58
|
-
return this;
|
|
59
|
-
}
|
|
60
|
-
this._range = range;
|
|
61
|
-
return this;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* OPTIONAL. Sets a user-defined function that transforms a categorical value into a visual value.
|
|
66
|
-
*
|
|
67
|
-
* User must also provide their own implementation of `valueAccessor`.
|
|
68
|
-
*
|
|
69
|
-
* If a custom valueAccessor function is not provided, this function will not be used even if provided (due to default value of `valueAccessor`).
|
|
70
|
-
*/
|
|
71
|
-
scale(scale: null): this;
|
|
72
|
-
scale(scale: (category: Domain) => Range): this;
|
|
73
|
-
scale(scale: (category: Domain) => Range): this {
|
|
74
|
-
if (scale === null) {
|
|
75
|
-
this._scale = undefined;
|
|
76
|
-
return this;
|
|
77
|
-
}
|
|
78
|
-
this._scale = scale;
|
|
79
|
-
return this;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @internal This method is not intended to be used by consumers of this library.
|
|
84
|
-
*
|
|
85
|
-
* @param dimensionName A user-intelligible name for the dimension being built. Used for error messages. Should be title cased.
|
|
86
|
-
*/
|
|
87
|
-
_build(
|
|
88
|
-
dimensionName: string
|
|
89
|
-
): OrdinalVisualValueDimension<Datum, Domain, Range> {
|
|
90
|
-
this.validateDimension(dimensionName);
|
|
91
|
-
return new OrdinalVisualValueDimension({
|
|
92
|
-
domain: this._domain,
|
|
93
|
-
formatFunction: this._formatFunction,
|
|
94
|
-
range: this._range,
|
|
95
|
-
scale: this._scale,
|
|
96
|
-
valueAccessor: this._valueAccessor,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
private validateDimension(dimensionName: string): void {
|
|
101
|
-
this.validateValueAccessor(dimensionName);
|
|
102
|
-
if (!this._range && !this._scale) {
|
|
103
|
-
throw new Error(
|
|
104
|
-
`${dimensionName} Dimension: Either a range or a scale must be provided.`
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value-options.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DataValue, VisualValue } from '../../../core/types/values';
|
|
2
|
-
import { DataDimensionOptions } from '../../dimension-options';
|
|
3
|
-
|
|
4
|
-
export interface OrdinalVisualValueDimensionOptions<
|
|
5
|
-
Datum,
|
|
6
|
-
Domain extends DataValue,
|
|
7
|
-
Range extends VisualValue,
|
|
8
|
-
> extends DataDimensionOptions<Datum, Domain> {
|
|
9
|
-
domain: Domain[];
|
|
10
|
-
range: Range[];
|
|
11
|
-
scale: (category: Domain) => Range;
|
|
12
|
-
}
|
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @angular-eslint/prefer-standalone */
|
|
2
|
-
import { Component, Input } from '@angular/core';
|
|
3
|
-
import {
|
|
4
|
-
BarsConfig,
|
|
5
|
-
ChartConfig,
|
|
6
|
-
VicBarsConfigBuilder,
|
|
7
|
-
VicBarsModule,
|
|
8
|
-
VicChartConfigBuilder,
|
|
9
|
-
VicChartModule,
|
|
10
|
-
VicXQuantitativeAxisConfig,
|
|
11
|
-
VicXQuantitativeAxisConfigBuilder,
|
|
12
|
-
VicXyAxisModule,
|
|
13
|
-
VicYOrdinalAxisConfig,
|
|
14
|
-
VicYOrdinalAxisConfigBuilder,
|
|
15
|
-
} from '@mathstack/viz';
|
|
16
|
-
import { schemeTableau10 } from 'd3';
|
|
17
|
-
import { beforeEach, cy, describe, expect, it } from 'local-cypress';
|
|
18
|
-
import {
|
|
19
|
-
countryFactsData,
|
|
20
|
-
CountryFactsDatum,
|
|
21
|
-
} from '../../../testing/data/country-area-continent';
|
|
22
|
-
|
|
23
|
-
const dotsPatternMagenta = 'dotsMagenta';
|
|
24
|
-
const dotsPatternTeal = 'dotsTeal';
|
|
25
|
-
const horizontalMargin = { top: 36, right: 20, bottom: 4, left: 80 };
|
|
26
|
-
const chartHeight = 400;
|
|
27
|
-
const chartWidth = 600;
|
|
28
|
-
const customCategoricalScale = (d: string) => {
|
|
29
|
-
switch (d) {
|
|
30
|
-
case 'Asia':
|
|
31
|
-
return 'red';
|
|
32
|
-
case 'Europe':
|
|
33
|
-
return 'blue';
|
|
34
|
-
case 'Africa':
|
|
35
|
-
return 'green';
|
|
36
|
-
case 'North America':
|
|
37
|
-
return 'yellow';
|
|
38
|
-
case 'South America':
|
|
39
|
-
return 'purple';
|
|
40
|
-
default:
|
|
41
|
-
return 'chartreuse';
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const barSelector = '.vic-bars-bar';
|
|
46
|
-
|
|
47
|
-
// ***********************************************************
|
|
48
|
-
// Horizontal bar chart component set up
|
|
49
|
-
// ***********************************************************
|
|
50
|
-
@Component({
|
|
51
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
52
|
-
selector: 'app-test-horizontal-bar',
|
|
53
|
-
template: `
|
|
54
|
-
<vic-xy-chart [config]="chartConfig">
|
|
55
|
-
<ng-container svg-defs>
|
|
56
|
-
<svg:pattern
|
|
57
|
-
[id]="dotsPatternMagenta"
|
|
58
|
-
x="2"
|
|
59
|
-
y="2"
|
|
60
|
-
width="5"
|
|
61
|
-
height="5"
|
|
62
|
-
patternUnits="userSpaceOnUse"
|
|
63
|
-
>
|
|
64
|
-
<rect x="3" y="3" width="2" height="2" fill="magenta" />
|
|
65
|
-
</svg:pattern>
|
|
66
|
-
<svg:pattern
|
|
67
|
-
[id]="dotsPatternTeal"
|
|
68
|
-
x="2"
|
|
69
|
-
y="2"
|
|
70
|
-
width="5"
|
|
71
|
-
height="5"
|
|
72
|
-
patternUnits="userSpaceOnUse"
|
|
73
|
-
>
|
|
74
|
-
<rect x="3" y="3" width="2" height="2" fill="teal" />
|
|
75
|
-
</svg:pattern>
|
|
76
|
-
</ng-container>
|
|
77
|
-
<ng-container svg-elements>
|
|
78
|
-
<svg:g
|
|
79
|
-
vic-x-quantitative-axis
|
|
80
|
-
[config]="xQuantitativeAxisConfig"
|
|
81
|
-
></svg:g>
|
|
82
|
-
<svg:g vic-y-ordinal-axis [config]="yOrdinalAxisConfig"></svg:g>
|
|
83
|
-
<svg:g vic-primary-marks-bars [config]="barsConfig"></svg:g>
|
|
84
|
-
</ng-container>
|
|
85
|
-
</vic-xy-chart>
|
|
86
|
-
`,
|
|
87
|
-
styles: [],
|
|
88
|
-
imports: [VicChartModule, VicBarsModule, VicXyAxisModule],
|
|
89
|
-
})
|
|
90
|
-
class TestHorizontalBarsComponent {
|
|
91
|
-
@Input() barsConfig: BarsConfig<CountryFactsDatum, string>;
|
|
92
|
-
@Input() yOrdinalAxisConfig: VicYOrdinalAxisConfig<string>;
|
|
93
|
-
@Input() xQuantitativeAxisConfig: VicXQuantitativeAxisConfig<number>;
|
|
94
|
-
dotsPatternMagenta = dotsPatternMagenta;
|
|
95
|
-
dotsPatternTeal = dotsPatternTeal;
|
|
96
|
-
chartConfig: ChartConfig = new VicChartConfigBuilder()
|
|
97
|
-
.maxHeight(chartHeight)
|
|
98
|
-
.maxWidth(chartWidth)
|
|
99
|
-
.margin(horizontalMargin)
|
|
100
|
-
.scalingStrategy('responsive-width')
|
|
101
|
-
.getConfig();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const mountHorizontalBarsComponent = (
|
|
105
|
-
barsConfig: BarsConfig<CountryFactsDatum, string>
|
|
106
|
-
): void => {
|
|
107
|
-
const xAxisConfig = new VicXQuantitativeAxisConfigBuilder()
|
|
108
|
-
.ticks((ticks) => ticks.format('.0f'))
|
|
109
|
-
.getConfig();
|
|
110
|
-
const yAxisConfig = new VicYOrdinalAxisConfigBuilder().getConfig();
|
|
111
|
-
|
|
112
|
-
cy.mount(TestHorizontalBarsComponent, {
|
|
113
|
-
componentProperties: {
|
|
114
|
-
barsConfig: barsConfig,
|
|
115
|
-
xQuantitativeAxisConfig: xAxisConfig,
|
|
116
|
-
yOrdinalAxisConfig: yAxisConfig,
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
// ***********************************************************
|
|
122
|
-
// Marks fill/stroke is correct
|
|
123
|
-
// ***********************************************************
|
|
124
|
-
describe('marks have expected fill', () => {
|
|
125
|
-
let barsConfig: BarsConfig<CountryFactsDatum, string>;
|
|
126
|
-
beforeEach(() => {
|
|
127
|
-
barsConfig = undefined;
|
|
128
|
-
});
|
|
129
|
-
describe('user does not specify a categorical valueAccessor or a custom scale', () => {
|
|
130
|
-
it('colors every mark by first color in user-provided range if user provides range of length >= 1', () => {
|
|
131
|
-
const color = 'chartreuse';
|
|
132
|
-
barsConfig = new VicBarsConfigBuilder<CountryFactsDatum, string>()
|
|
133
|
-
.data(countryFactsData)
|
|
134
|
-
.horizontal((bars) =>
|
|
135
|
-
bars
|
|
136
|
-
.x((dimension) => dimension.valueAccessor((d) => d.area))
|
|
137
|
-
.y((dimension) => dimension.valueAccessor((d) => d.country))
|
|
138
|
-
)
|
|
139
|
-
.color((dimension) => dimension.range([color, 'red', 'yellow']))
|
|
140
|
-
.labels((labels) => labels.display(true))
|
|
141
|
-
.getConfig();
|
|
142
|
-
mountHorizontalBarsComponent(barsConfig);
|
|
143
|
-
cy.get(barSelector).each(($bar) => {
|
|
144
|
-
expect($bar.attr('fill')).to.equal(color);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
it('colors every mark by first color in the default range if user provides no range and no custom scale', () => {
|
|
148
|
-
const color = schemeTableau10[0];
|
|
149
|
-
barsConfig = new VicBarsConfigBuilder<CountryFactsDatum, string>()
|
|
150
|
-
.data(countryFactsData)
|
|
151
|
-
.horizontal((bars) =>
|
|
152
|
-
bars
|
|
153
|
-
.x((dimension) =>
|
|
154
|
-
dimension.valueAccessor((d) => d.area).domainPaddingPixels()
|
|
155
|
-
)
|
|
156
|
-
.y((dimension) => dimension.valueAccessor((d) => d.country))
|
|
157
|
-
)
|
|
158
|
-
.labels((labels) => labels.display(true))
|
|
159
|
-
.getConfig();
|
|
160
|
-
mountHorizontalBarsComponent(barsConfig);
|
|
161
|
-
cy.get(barSelector).each(($bar) => {
|
|
162
|
-
expect($bar.attr('fill')).to.equal(color);
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
describe('user provides a valueAccessor for the categorical dimension', () => {
|
|
167
|
-
it('colors every mark according to the valueAccessor using default color array', () => {
|
|
168
|
-
const color = schemeTableau10;
|
|
169
|
-
barsConfig = new VicBarsConfigBuilder<CountryFactsDatum, string>()
|
|
170
|
-
.data(countryFactsData)
|
|
171
|
-
.horizontal((bars) =>
|
|
172
|
-
bars
|
|
173
|
-
.x((dimension) =>
|
|
174
|
-
dimension.valueAccessor((d) => d.area).domainPaddingPixels()
|
|
175
|
-
)
|
|
176
|
-
.y((dimension) => dimension.valueAccessor((d) => d.country))
|
|
177
|
-
)
|
|
178
|
-
.color((dimension) => dimension.valueAccessor((d) => d.continent))
|
|
179
|
-
.labels((labels) => labels.display(true))
|
|
180
|
-
.getConfig();
|
|
181
|
-
mountHorizontalBarsComponent(barsConfig);
|
|
182
|
-
cy.get(barSelector).each(($bar, i) => {
|
|
183
|
-
switch (countryFactsData[i].continent) {
|
|
184
|
-
case 'Asia':
|
|
185
|
-
expect($bar.attr('fill')).to.equal(color[0]);
|
|
186
|
-
break;
|
|
187
|
-
case 'Europe':
|
|
188
|
-
expect($bar.attr('fill')).to.equal(color[1]);
|
|
189
|
-
break;
|
|
190
|
-
case 'Africa':
|
|
191
|
-
expect($bar.attr('fill')).to.equal(color[2]);
|
|
192
|
-
break;
|
|
193
|
-
case 'North America':
|
|
194
|
-
expect($bar.attr('fill')).to.equal(color[3]);
|
|
195
|
-
break;
|
|
196
|
-
case 'South America':
|
|
197
|
-
expect($bar.attr('fill')).to.equal(color[4]);
|
|
198
|
-
break;
|
|
199
|
-
default:
|
|
200
|
-
expect($bar.attr('fill')).to.equal(color[5]);
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
describe('user provides a custom scale for the categorical dimension', () => {
|
|
206
|
-
it('colors every mark according to the custom scale when user also provides a value accessor', () => {
|
|
207
|
-
barsConfig = new VicBarsConfigBuilder<CountryFactsDatum, string>()
|
|
208
|
-
.data(countryFactsData)
|
|
209
|
-
.horizontal((bars) =>
|
|
210
|
-
bars
|
|
211
|
-
.x((dimension) =>
|
|
212
|
-
dimension.valueAccessor((d) => d.area).domainPaddingPixels()
|
|
213
|
-
)
|
|
214
|
-
.y((dimension) => dimension.valueAccessor((d) => d.country))
|
|
215
|
-
)
|
|
216
|
-
.color((dimension) =>
|
|
217
|
-
dimension
|
|
218
|
-
.valueAccessor((d) => d.continent)
|
|
219
|
-
.scale(customCategoricalScale)
|
|
220
|
-
)
|
|
221
|
-
.labels((labels) => labels.display(true))
|
|
222
|
-
.getConfig();
|
|
223
|
-
mountHorizontalBarsComponent(barsConfig);
|
|
224
|
-
cy.get(barSelector).each(($bar, i) => {
|
|
225
|
-
switch (countryFactsData[i].continent) {
|
|
226
|
-
case 'Asia':
|
|
227
|
-
expect($bar.attr('fill')).to.equal('red');
|
|
228
|
-
break;
|
|
229
|
-
case 'Europe':
|
|
230
|
-
expect($bar.attr('fill')).to.equal('blue');
|
|
231
|
-
break;
|
|
232
|
-
case 'Africa':
|
|
233
|
-
expect($bar.attr('fill')).to.equal('green');
|
|
234
|
-
break;
|
|
235
|
-
case 'North America':
|
|
236
|
-
expect($bar.attr('fill')).to.equal('yellow');
|
|
237
|
-
break;
|
|
238
|
-
case 'South America':
|
|
239
|
-
expect($bar.attr('fill')).to.equal('purple');
|
|
240
|
-
break;
|
|
241
|
-
default:
|
|
242
|
-
expect($bar.attr('fill')).to.equal('chartreuse');
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
it('colors every mark according to the custom scales behavior with empty string arg when user does not provide a value accessor', () => {
|
|
247
|
-
barsConfig = new VicBarsConfigBuilder<CountryFactsDatum, string>()
|
|
248
|
-
.data(countryFactsData)
|
|
249
|
-
.horizontal((bars) =>
|
|
250
|
-
bars
|
|
251
|
-
.x((dimension) =>
|
|
252
|
-
dimension.valueAccessor((d) => d.area).domainPaddingPixels()
|
|
253
|
-
)
|
|
254
|
-
.y((dimension) => dimension.valueAccessor((d) => d.country))
|
|
255
|
-
)
|
|
256
|
-
.color((dimension) => dimension.scale(customCategoricalScale))
|
|
257
|
-
.labels((labels) => labels.display(true))
|
|
258
|
-
.getConfig();
|
|
259
|
-
mountHorizontalBarsComponent(barsConfig);
|
|
260
|
-
cy.get(barSelector).each(($bar) => {
|
|
261
|
-
expect($bar.attr('fill')).to.equal('chartreuse');
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
// ***********************************************************
|
|
268
|
-
// Marks fill/stroke is correct - testing Fill Pattern
|
|
269
|
-
// ***********************************************************
|
|
270
|
-
describe('user provides a fill pattern', () => {
|
|
271
|
-
let barsConfig: BarsConfig<CountryFactsDatum, string>;
|
|
272
|
-
beforeEach(() => {
|
|
273
|
-
barsConfig = undefined;
|
|
274
|
-
});
|
|
275
|
-
it('sets bar fill with either the pattern name or the regular fill according to shouldApply function', () => {
|
|
276
|
-
barsConfig = new VicBarsConfigBuilder<CountryFactsDatum, string>()
|
|
277
|
-
.data(countryFactsData)
|
|
278
|
-
.horizontal((bars) =>
|
|
279
|
-
bars
|
|
280
|
-
.x((dimension) =>
|
|
281
|
-
dimension.valueAccessor((d) => d.area).domainPaddingPixels()
|
|
282
|
-
)
|
|
283
|
-
.y((dimension) => dimension.valueAccessor((d) => d.country))
|
|
284
|
-
)
|
|
285
|
-
.customFills([
|
|
286
|
-
{
|
|
287
|
-
defId: dotsPatternMagenta,
|
|
288
|
-
shouldApply: (d) => d.continent === 'Africa' && d.area > 500000,
|
|
289
|
-
},
|
|
290
|
-
])
|
|
291
|
-
.labels((labels) => labels.display(true))
|
|
292
|
-
.getConfig();
|
|
293
|
-
mountHorizontalBarsComponent(barsConfig);
|
|
294
|
-
cy.get(barSelector).each(($bar, i) => {
|
|
295
|
-
if (i === 2) {
|
|
296
|
-
expect($bar.attr('fill')).to.equal(`url(#${dotsPatternMagenta})`);
|
|
297
|
-
} else {
|
|
298
|
-
expect($bar.attr('fill')).to.equal(schemeTableau10[0]);
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
it('sets bar fill with either the pattern name or the regular fill according to shouldApply function when user provides a scale and valueAccessor', () => {
|
|
303
|
-
barsConfig = new VicBarsConfigBuilder<CountryFactsDatum, string>()
|
|
304
|
-
.data(countryFactsData)
|
|
305
|
-
.horizontal((bars) =>
|
|
306
|
-
bars
|
|
307
|
-
.x((dimension) =>
|
|
308
|
-
dimension.valueAccessor((d) => d.area).domainPaddingPixels()
|
|
309
|
-
)
|
|
310
|
-
.y((dimension) => dimension.valueAccessor((d) => d.country))
|
|
311
|
-
)
|
|
312
|
-
.color((dimension) =>
|
|
313
|
-
dimension
|
|
314
|
-
.valueAccessor((d) => d.continent)
|
|
315
|
-
.scale(customCategoricalScale)
|
|
316
|
-
)
|
|
317
|
-
.customFills([
|
|
318
|
-
{
|
|
319
|
-
defId: dotsPatternMagenta,
|
|
320
|
-
shouldApply: (d) => d.continent === 'Africa' && d.area > 500000,
|
|
321
|
-
},
|
|
322
|
-
])
|
|
323
|
-
.labels((labels) => labels.display(true))
|
|
324
|
-
.getConfig();
|
|
325
|
-
mountHorizontalBarsComponent(barsConfig);
|
|
326
|
-
cy.get(barSelector).each(($bar, i) => {
|
|
327
|
-
if (i === 2) {
|
|
328
|
-
expect($bar.attr('fill')).to.equal(`url(#${dotsPatternMagenta})`);
|
|
329
|
-
} else {
|
|
330
|
-
switch (countryFactsData[i].continent) {
|
|
331
|
-
case 'Asia':
|
|
332
|
-
expect($bar.attr('fill')).to.equal('red');
|
|
333
|
-
break;
|
|
334
|
-
case 'Europe':
|
|
335
|
-
expect($bar.attr('fill')).to.equal('blue');
|
|
336
|
-
break;
|
|
337
|
-
case 'Africa':
|
|
338
|
-
expect($bar.attr('fill')).to.equal('green');
|
|
339
|
-
break;
|
|
340
|
-
case 'North America':
|
|
341
|
-
expect($bar.attr('fill')).to.equal('yellow');
|
|
342
|
-
break;
|
|
343
|
-
case 'South America':
|
|
344
|
-
expect($bar.attr('fill')).to.equal('purple');
|
|
345
|
-
break;
|
|
346
|
-
default:
|
|
347
|
-
expect($bar.attr('fill')).to.equal('chartreuse');
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
it('sets bar fill with the last matching pattern in customFills array if two patterns match', () => {
|
|
353
|
-
barsConfig = new VicBarsConfigBuilder<CountryFactsDatum, string>()
|
|
354
|
-
.data(countryFactsData)
|
|
355
|
-
.horizontal((bars) =>
|
|
356
|
-
bars
|
|
357
|
-
.x((dimension) =>
|
|
358
|
-
dimension.valueAccessor((d) => d.area).domainPaddingPixels()
|
|
359
|
-
)
|
|
360
|
-
.y((dimension) => dimension.valueAccessor((d) => d.country))
|
|
361
|
-
)
|
|
362
|
-
.color((dimension) => dimension.range(['lightcoral']))
|
|
363
|
-
.customFills([
|
|
364
|
-
{
|
|
365
|
-
defId: dotsPatternMagenta,
|
|
366
|
-
shouldApply: (d) => d.continent === 'Africa' && d.area > 500000,
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
defId: dotsPatternTeal,
|
|
370
|
-
shouldApply: (d) => d.continent === 'Africa' && d.area > 700000,
|
|
371
|
-
},
|
|
372
|
-
])
|
|
373
|
-
.labels((labels) => labels.display(true))
|
|
374
|
-
.getConfig();
|
|
375
|
-
mountHorizontalBarsComponent(barsConfig);
|
|
376
|
-
cy.get(barSelector).each(($bar, i) => {
|
|
377
|
-
if (i === 2) {
|
|
378
|
-
expect($bar.attr('fill')).to.equal(`url(#${dotsPatternTeal})`);
|
|
379
|
-
} else {
|
|
380
|
-
expect($bar.attr('fill')).to.equal('lightcoral');
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
});
|
|
384
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
|
|
3
|
-
import { OrdinalVisualValueDimension } from './ordinal-visual-value';
|
|
4
|
-
import { OrdinalVisualValueDimensionBuilder } from './ordinal-visual-value-builder';
|
|
5
|
-
|
|
6
|
-
describe('OrdinalVisualValueDimension', () => {
|
|
7
|
-
let dimension: OrdinalVisualValueDimension<string, string, string>;
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
dimension = new OrdinalVisualValueDimensionBuilder<string, string, string>()
|
|
10
|
-
.valueAccessor((d) => d)
|
|
11
|
-
._build('Test');
|
|
12
|
-
});
|
|
13
|
-
describe('setPropertiesFromData', () => {
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
spyOn(dimension as any, 'setValues');
|
|
16
|
-
spyOn(dimension as any, 'setDomain');
|
|
17
|
-
spyOn(dimension as any, 'setScale');
|
|
18
|
-
});
|
|
19
|
-
it('calls setValues once', () => {
|
|
20
|
-
dimension.setPropertiesFromData(['a', 'b', 'c', 'a', 'b']);
|
|
21
|
-
expect((dimension as any).setValues).toHaveBeenCalledOnceWith([
|
|
22
|
-
'a',
|
|
23
|
-
'b',
|
|
24
|
-
'c',
|
|
25
|
-
'a',
|
|
26
|
-
'b',
|
|
27
|
-
]);
|
|
28
|
-
});
|
|
29
|
-
it('calls initDomain once', () => {
|
|
30
|
-
dimension.setPropertiesFromData(['a', 'b', 'c', 'a', 'b']);
|
|
31
|
-
expect((dimension as any).setDomain).toHaveBeenCalledTimes(1);
|
|
32
|
-
});
|
|
33
|
-
it('calls initScale once', () => {
|
|
34
|
-
dimension.setPropertiesFromData(['a', 'b', 'c', 'a', 'b']);
|
|
35
|
-
expect((dimension as any).setScale).toHaveBeenCalledTimes(1);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('setDomain()', () => {
|
|
40
|
-
it('sets the domain to the correct value, user did not specify domain', () => {
|
|
41
|
-
dimension.setPropertiesFromData(['a', 'b', 'c', 'a', 'b']);
|
|
42
|
-
expect((dimension as any).calculatedDomain).toEqual(['a', 'b', 'c']);
|
|
43
|
-
});
|
|
44
|
-
it('sets the domain to the correct value, user specified domain', () => {
|
|
45
|
-
(dimension as any).domain = ['e', 'f', 'g', 'e'];
|
|
46
|
-
dimension.setPropertiesFromData(['a', 'b', 'c', 'a', 'b']);
|
|
47
|
-
expect((dimension as any).calculatedDomain).toEqual(['e', 'f', 'g']);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
describe('integration: domainIncludes', () => {
|
|
52
|
-
it('correctly sets internSetDomain and domainIncludes returns correct value', () => {
|
|
53
|
-
(dimension as any).domain = ['c', 'd', 'b', 'a', 'd'];
|
|
54
|
-
dimension.setPropertiesFromData(['a', 'b', 'c', 'a', 'b']);
|
|
55
|
-
expect(dimension.domainIncludes('a')).toEqual(true);
|
|
56
|
-
});
|
|
57
|
-
it('correctly sets internSetDomain and domainIncludes returns correct value - scenario 2', () => {
|
|
58
|
-
(dimension as any).domain = ['c', 'd', 'b', 'a', 'd'];
|
|
59
|
-
dimension.setPropertiesFromData(['a', 'b', 'c', 'a', 'b']);
|
|
60
|
-
expect(dimension.domainIncludes('z')).toEqual(false);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|