@mathstack/viz 2.0.3 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 -300
- 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,738 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @angular-eslint/prefer-standalone */
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { Component, Input } from '@angular/core';
|
|
4
|
-
import {
|
|
5
|
-
ChartConfig,
|
|
6
|
-
HoverMoveAction,
|
|
7
|
-
HtmlTooltipConfig,
|
|
8
|
-
LinesConfig,
|
|
9
|
-
LinesHost,
|
|
10
|
-
LinesHoverMoveEmitTooltipData,
|
|
11
|
-
LinesInteractionOutput,
|
|
12
|
-
VicChartConfigBuilder,
|
|
13
|
-
VicChartModule,
|
|
14
|
-
VicHtmlTooltipConfigBuilder,
|
|
15
|
-
VicHtmlTooltipModule,
|
|
16
|
-
VicLinesConfigBuilder,
|
|
17
|
-
VicLinesModule,
|
|
18
|
-
VicXQuantitativeAxisConfig,
|
|
19
|
-
VicXQuantitativeAxisConfigBuilder,
|
|
20
|
-
VicXyAxisModule,
|
|
21
|
-
VicYQuantitativeAxisConfig,
|
|
22
|
-
VicYQuantitativeAxisConfigBuilder,
|
|
23
|
-
} from '@mathstack/viz';
|
|
24
|
-
import 'cypress-real-events';
|
|
25
|
-
import { curveBasis, schemeTableau10 } from 'd3';
|
|
26
|
-
import { beforeEach, cy, describe, expect, it } from 'local-cypress';
|
|
27
|
-
import { cloneDeep } from 'lodash-es';
|
|
28
|
-
import { BehaviorSubject } from 'rxjs';
|
|
29
|
-
import {
|
|
30
|
-
continentPopulationDateYearData,
|
|
31
|
-
ContinentPopulationDateYearDatum,
|
|
32
|
-
ContinentPopulationNumYearData,
|
|
33
|
-
ContinentPopulationNumYearDatum,
|
|
34
|
-
} from '../testing/data/continent-population-year-data';
|
|
35
|
-
|
|
36
|
-
// Cypress will get the tick elements before d3 has set the text value of the elements,
|
|
37
|
-
// because d3 creates the elements and sets the text value in a transition).
|
|
38
|
-
// This wait time is necessary to ensure that the text value of the tick elements has been set by d3.
|
|
39
|
-
const axisTickTextWaitTime = 1000;
|
|
40
|
-
|
|
41
|
-
const margin = { top: 60, right: 20, bottom: 40, left: 80 };
|
|
42
|
-
const chartHeight = 400;
|
|
43
|
-
const chartWidth = 600;
|
|
44
|
-
const dateData = continentPopulationDateYearData;
|
|
45
|
-
const numericData = ContinentPopulationNumYearData;
|
|
46
|
-
|
|
47
|
-
const lineSelector = '.vic-lines-line';
|
|
48
|
-
const markerSelector = '.vic-lines-marker';
|
|
49
|
-
|
|
50
|
-
// ***********************************************************
|
|
51
|
-
// Set up Lines component -- can use with Date or numeric values for x axis
|
|
52
|
-
// ***********************************************************
|
|
53
|
-
@Component({
|
|
54
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
55
|
-
selector: 'app-test-lines',
|
|
56
|
-
template: `
|
|
57
|
-
<vic-xy-chart [config]="chartConfig">
|
|
58
|
-
<ng-container svg-elements>
|
|
59
|
-
<svg:g
|
|
60
|
-
vic-x-quantitative-axis
|
|
61
|
-
[config]="xQuantitativeAxisConfig"
|
|
62
|
-
></svg:g>
|
|
63
|
-
<svg:g
|
|
64
|
-
vic-y-quantitative-axis
|
|
65
|
-
[config]="yQuantitativeAxisConfig"
|
|
66
|
-
></svg:g>
|
|
67
|
-
<svg:g
|
|
68
|
-
vic-primary-marks-lines
|
|
69
|
-
[config]="linesConfig"
|
|
70
|
-
vicLinesEvents
|
|
71
|
-
[hoverMoveActions]="hoverMoveActions"
|
|
72
|
-
(interactionOutput)="updateTooltipForNewOutput($event)"
|
|
73
|
-
>
|
|
74
|
-
<vic-html-tooltip
|
|
75
|
-
[config]="tooltipConfig$ | async"
|
|
76
|
-
[template]="htmlTooltip"
|
|
77
|
-
></vic-html-tooltip>
|
|
78
|
-
</svg:g>
|
|
79
|
-
</ng-container>
|
|
80
|
-
</vic-xy-chart>
|
|
81
|
-
|
|
82
|
-
<ng-template #htmlTooltip>
|
|
83
|
-
@if (tooltipData$ | async; as tooltipData) {
|
|
84
|
-
<p class="tooltip-text">{{ tooltipData.values.strokeColor }}</p>
|
|
85
|
-
<p class="tooltip-text">{{
|
|
86
|
-
getYearFromStringDate(tooltipData.values.x)
|
|
87
|
-
}}</p>
|
|
88
|
-
<p class="tooltip-text">{{ tooltipData.values.y }}</p>
|
|
89
|
-
}
|
|
90
|
-
</ng-template>
|
|
91
|
-
`,
|
|
92
|
-
styles: [
|
|
93
|
-
'.tooltip-text { font-size: 12px; } .events-disabled { pointer-events: none; }',
|
|
94
|
-
],
|
|
95
|
-
imports: [
|
|
96
|
-
VicChartModule,
|
|
97
|
-
VicLinesModule,
|
|
98
|
-
VicXyAxisModule,
|
|
99
|
-
VicHtmlTooltipModule,
|
|
100
|
-
CommonModule,
|
|
101
|
-
],
|
|
102
|
-
})
|
|
103
|
-
class TestLinesComponent<Datum, QuantAxisType extends number | Date> {
|
|
104
|
-
@Input() linesConfig: LinesConfig<Datum>;
|
|
105
|
-
@Input() yQuantitativeAxisConfig: VicYQuantitativeAxisConfig<number>;
|
|
106
|
-
@Input() xQuantitativeAxisConfig: VicXQuantitativeAxisConfig<QuantAxisType>;
|
|
107
|
-
tooltipConfig: BehaviorSubject<HtmlTooltipConfig> =
|
|
108
|
-
new BehaviorSubject<HtmlTooltipConfig>(null);
|
|
109
|
-
tooltipConfig$ = this.tooltipConfig.asObservable();
|
|
110
|
-
tooltipData: BehaviorSubject<LinesInteractionOutput<Datum>> =
|
|
111
|
-
new BehaviorSubject<LinesInteractionOutput<Datum>>(null);
|
|
112
|
-
tooltipData$ = this.tooltipData.asObservable();
|
|
113
|
-
hoverMoveActions: HoverMoveAction<LinesHost<Datum>>[] = [
|
|
114
|
-
new LinesHoverMoveEmitTooltipData(),
|
|
115
|
-
];
|
|
116
|
-
chartConfig: ChartConfig = new VicChartConfigBuilder()
|
|
117
|
-
.maxHeight(chartHeight)
|
|
118
|
-
.maxWidth(chartWidth)
|
|
119
|
-
.margin(margin)
|
|
120
|
-
.scalingStrategy('responsive-width')
|
|
121
|
-
.getConfig();
|
|
122
|
-
|
|
123
|
-
updateTooltipForNewOutput(data: LinesInteractionOutput<Datum>): void {
|
|
124
|
-
this.updateTooltipData(data);
|
|
125
|
-
this.updateTooltipConfig(data);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
updateTooltipData(data: LinesInteractionOutput<Datum>): void {
|
|
129
|
-
this.tooltipData.next(data);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
updateTooltipConfig(data: LinesInteractionOutput<Datum>): void {
|
|
133
|
-
const config = new VicHtmlTooltipConfigBuilder()
|
|
134
|
-
.size((size) => size.minWidth(100))
|
|
135
|
-
.positionFromOutput(data)
|
|
136
|
-
.show(!!data)
|
|
137
|
-
.getConfig();
|
|
138
|
-
this.tooltipConfig.next(config);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
getYearFromStringDate(dateString: string): number {
|
|
142
|
-
return new Date(dateString).getFullYear();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function mountDateLinesComponent(
|
|
147
|
-
linesConfig: LinesConfig<ContinentPopulationDateYearDatum>
|
|
148
|
-
): void {
|
|
149
|
-
const xAxisConfig = new VicXQuantitativeAxisConfigBuilder<Date>()
|
|
150
|
-
.ticks((ticks) => ticks.format('%Y'))
|
|
151
|
-
.getConfig();
|
|
152
|
-
const yAxisConfig =
|
|
153
|
-
new VicYQuantitativeAxisConfigBuilder<number>().getConfig();
|
|
154
|
-
cy.mount(TestLinesComponent<ContinentPopulationDateYearDatum, Date>, {
|
|
155
|
-
componentProperties: {
|
|
156
|
-
linesConfig: linesConfig,
|
|
157
|
-
xQuantitativeAxisConfig: xAxisConfig,
|
|
158
|
-
yQuantitativeAxisConfig: yAxisConfig,
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function mountNumberLinesComponent(
|
|
164
|
-
linesConfig: LinesConfig<ContinentPopulationNumYearDatum>
|
|
165
|
-
): void {
|
|
166
|
-
const xAxisConfig = new VicXQuantitativeAxisConfigBuilder<number>()
|
|
167
|
-
.ticks((ticks) => ticks.format('.0f'))
|
|
168
|
-
.getConfig();
|
|
169
|
-
const yAxisConfig =
|
|
170
|
-
new VicYQuantitativeAxisConfigBuilder<number>().getConfig();
|
|
171
|
-
cy.mount(TestLinesComponent<ContinentPopulationNumYearDatum, number>, {
|
|
172
|
-
componentProperties: {
|
|
173
|
-
linesConfig: linesConfig,
|
|
174
|
-
xQuantitativeAxisConfig: xAxisConfig,
|
|
175
|
-
yQuantitativeAxisConfig: yAxisConfig,
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// ***********************************************************
|
|
181
|
-
// Creating the correct marks from the right values
|
|
182
|
-
// ***********************************************************
|
|
183
|
-
describe('it creates the correct marks - x axis values are Dates', () => {
|
|
184
|
-
it('should draw the correct number of lines', () => {
|
|
185
|
-
const linesConfig =
|
|
186
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
187
|
-
.data(dateData)
|
|
188
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
189
|
-
.xDate((xDate) => xDate.valueAccessor((d) => d.year))
|
|
190
|
-
.y((y) => y.valueAccessor((d) => d.population))
|
|
191
|
-
.stroke((stroke) =>
|
|
192
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
193
|
-
)
|
|
194
|
-
.getConfig();
|
|
195
|
-
mountDateLinesComponent(linesConfig);
|
|
196
|
-
const categories = [];
|
|
197
|
-
cy.get(lineSelector)
|
|
198
|
-
.each((line) => {
|
|
199
|
-
categories.push(line.attr('class').split(' ')[1].split('-').join(' '));
|
|
200
|
-
})
|
|
201
|
-
.then(() => {
|
|
202
|
-
expect(categories).to.have.members([
|
|
203
|
-
...new Set(dateData.map((d) => d.continent)),
|
|
204
|
-
]);
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
it('draws line but omits value when a user inputs data with a null value for y axis', () => {
|
|
208
|
-
const testData = cloneDeep(dateData);
|
|
209
|
-
testData[2].population = null;
|
|
210
|
-
const markersCounts = testData.reduce((acc, d) => {
|
|
211
|
-
if (!acc[d.continent]) {
|
|
212
|
-
acc[d.continent] = { expect: 0, actual: 0 };
|
|
213
|
-
}
|
|
214
|
-
if (d.population !== null) {
|
|
215
|
-
acc[d.continent].expect += 1;
|
|
216
|
-
}
|
|
217
|
-
return acc;
|
|
218
|
-
}, {});
|
|
219
|
-
const linesConfig =
|
|
220
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
221
|
-
.data(testData)
|
|
222
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
223
|
-
.xDate((xDate) => xDate.valueAccessor((d) => d.year))
|
|
224
|
-
.y((y) => y.valueAccessor((d) => d.population))
|
|
225
|
-
.stroke((stroke) =>
|
|
226
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
227
|
-
)
|
|
228
|
-
.pointMarkers((markers) =>
|
|
229
|
-
markers.class((d) => d.continent.split(' ').join('-'))
|
|
230
|
-
)
|
|
231
|
-
.getConfig();
|
|
232
|
-
mountDateLinesComponent(linesConfig);
|
|
233
|
-
cy.get('.vic-lines-marker')
|
|
234
|
-
.each((marker) => {
|
|
235
|
-
const category = marker
|
|
236
|
-
.attr('class')
|
|
237
|
-
.split(' ')[1]
|
|
238
|
-
.split('-')
|
|
239
|
-
.join(' ');
|
|
240
|
-
markersCounts[category].actual += 1;
|
|
241
|
-
})
|
|
242
|
-
.then(() => {
|
|
243
|
-
Object.keys(markersCounts).forEach((key) => {
|
|
244
|
-
expect(markersCounts[key].expect).to.equal(markersCounts[key].actual);
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
// Example situation for the below: the API returns data and we think everything is a number but...it's not
|
|
249
|
-
it('draws line but omits value when a user inputs data with y axis value of the wrong type', () => {
|
|
250
|
-
const testData = cloneDeep(dateData);
|
|
251
|
-
testData[2].population = 'hello';
|
|
252
|
-
const markersCounts = testData.reduce((acc, d) => {
|
|
253
|
-
if (!acc[d.continent]) {
|
|
254
|
-
acc[d.continent] = { expect: 0, actual: 0 };
|
|
255
|
-
}
|
|
256
|
-
if (d.population !== 'hello') {
|
|
257
|
-
acc[d.continent].expect += 1;
|
|
258
|
-
}
|
|
259
|
-
return acc;
|
|
260
|
-
}, {});
|
|
261
|
-
const linesConfig =
|
|
262
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
263
|
-
.data(testData)
|
|
264
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
265
|
-
.xDate((dimension) => dimension.valueAccessor((d) => d.year))
|
|
266
|
-
.y((dimension) => dimension.valueAccessor((d) => d.population))
|
|
267
|
-
.stroke((stroke) =>
|
|
268
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
269
|
-
)
|
|
270
|
-
.pointMarkers((markers) =>
|
|
271
|
-
markers.class((d) => d.continent.split(' ').join('-'))
|
|
272
|
-
)
|
|
273
|
-
.getConfig();
|
|
274
|
-
mountDateLinesComponent(linesConfig);
|
|
275
|
-
cy.get('.vic-lines-marker')
|
|
276
|
-
.each((marker) => {
|
|
277
|
-
const category = marker
|
|
278
|
-
.attr('class')
|
|
279
|
-
.split(' ')[1]
|
|
280
|
-
.split('-')
|
|
281
|
-
.join(' ');
|
|
282
|
-
markersCounts[category].actual += 1;
|
|
283
|
-
})
|
|
284
|
-
.then(() => {
|
|
285
|
-
Object.keys(markersCounts).forEach((key) => {
|
|
286
|
-
expect(markersCounts[key].expect).to.equal(markersCounts[key].actual);
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
});
|
|
290
|
-
// Example situation for the below: the API returns data and we think everything is a number but...it's not
|
|
291
|
-
it('draws line but omits value when a user inputs data with x axis value of the wrong type', () => {
|
|
292
|
-
const testData = cloneDeep(dateData);
|
|
293
|
-
testData[6].year = 'hello';
|
|
294
|
-
const markersCounts = testData.reduce((acc, d) => {
|
|
295
|
-
if (!acc[d.continent]) {
|
|
296
|
-
acc[d.continent] = { expect: 0, actual: 0 };
|
|
297
|
-
}
|
|
298
|
-
if (d.year !== 'hello') {
|
|
299
|
-
acc[d.continent].expect += 1;
|
|
300
|
-
}
|
|
301
|
-
return acc;
|
|
302
|
-
}, {});
|
|
303
|
-
const linesConfig =
|
|
304
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
305
|
-
.data(testData)
|
|
306
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
307
|
-
.xDate((dimension) => dimension.valueAccessor((d) => d.year))
|
|
308
|
-
.y((dimension) => dimension.valueAccessor((d) => d.population))
|
|
309
|
-
.stroke((stroke) =>
|
|
310
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
311
|
-
)
|
|
312
|
-
.pointMarkers((markers) =>
|
|
313
|
-
markers.class((d) => d.continent.split(' ').join('-'))
|
|
314
|
-
)
|
|
315
|
-
.getConfig();
|
|
316
|
-
mountDateLinesComponent(linesConfig);
|
|
317
|
-
cy.get('.vic-lines-marker')
|
|
318
|
-
.each((marker) => {
|
|
319
|
-
const category = marker
|
|
320
|
-
.attr('class')
|
|
321
|
-
.split(' ')[1]
|
|
322
|
-
.split('-')
|
|
323
|
-
.join(' ');
|
|
324
|
-
markersCounts[category].actual += 1;
|
|
325
|
-
})
|
|
326
|
-
.then(() => {
|
|
327
|
-
Object.keys(markersCounts).forEach((key) => {
|
|
328
|
-
expect(markersCounts[key].expect).to.equal(markersCounts[key].actual);
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
describe('it creates the correct lines - x axis values are Numbers', () => {
|
|
334
|
-
it('should draw the correct number of lines, one for each category', () => {
|
|
335
|
-
const linesConfig =
|
|
336
|
-
new VicLinesConfigBuilder<ContinentPopulationNumYearDatum>()
|
|
337
|
-
.data(numericData)
|
|
338
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
339
|
-
.xNumeric((dimension) =>
|
|
340
|
-
dimension.valueAccessor((d) => d.year).includeZeroInDomain(false)
|
|
341
|
-
)
|
|
342
|
-
.y((dimension) => dimension.valueAccessor((d) => d.population))
|
|
343
|
-
.stroke((stroke) =>
|
|
344
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
345
|
-
)
|
|
346
|
-
.getConfig();
|
|
347
|
-
mountNumberLinesComponent(linesConfig);
|
|
348
|
-
const categories = [];
|
|
349
|
-
cy.get(lineSelector)
|
|
350
|
-
.each((line) => {
|
|
351
|
-
categories.push(line.attr('class').split(' ')[1].split('-').join(' '));
|
|
352
|
-
})
|
|
353
|
-
.then(() => {
|
|
354
|
-
expect(categories).to.have.members([
|
|
355
|
-
...new Set(numericData.map((d) => d.continent)),
|
|
356
|
-
]);
|
|
357
|
-
});
|
|
358
|
-
});
|
|
359
|
-
|
|
360
|
-
describe('it creates the correct under-line area fills', () => {
|
|
361
|
-
it('should draw the correct number of fills, one for each category', () => {
|
|
362
|
-
const linesConfig =
|
|
363
|
-
new VicLinesConfigBuilder<ContinentPopulationNumYearDatum>()
|
|
364
|
-
.data(numericData)
|
|
365
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
366
|
-
.xNumeric((dimension) =>
|
|
367
|
-
dimension.valueAccessor((d) => d.year).includeZeroInDomain(false)
|
|
368
|
-
)
|
|
369
|
-
.y((dimension) => dimension.valueAccessor((d) => d.population))
|
|
370
|
-
.stroke((stroke) =>
|
|
371
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
372
|
-
)
|
|
373
|
-
.areaFills()
|
|
374
|
-
.getConfig();
|
|
375
|
-
mountNumberLinesComponent(linesConfig);
|
|
376
|
-
cy.get('.vic-lines-area').should(
|
|
377
|
-
'have.length',
|
|
378
|
-
[...new Set(numericData.map((x) => x.continent))].length
|
|
379
|
-
);
|
|
380
|
-
});
|
|
381
|
-
});
|
|
382
|
-
});
|
|
383
|
-
|
|
384
|
-
// ***********************************************************
|
|
385
|
-
// Tests of domains
|
|
386
|
-
// ***********************************************************
|
|
387
|
-
describe('if the user specifies a y domain that is smaller than max value', () => {
|
|
388
|
-
it('should draw the lines with the users specified y domain - CORRECT BEHAVIOR CAUSES VISUAL ERROR', () => {
|
|
389
|
-
const linesConfig =
|
|
390
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
391
|
-
.data(dateData)
|
|
392
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
393
|
-
.xDate((dimension) => dimension.valueAccessor((d) => d.year))
|
|
394
|
-
.y((dimension) =>
|
|
395
|
-
dimension.valueAccessor((d) => d.population).domain([0, 4900000000])
|
|
396
|
-
)
|
|
397
|
-
.stroke((stroke) =>
|
|
398
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
399
|
-
)
|
|
400
|
-
.getConfig();
|
|
401
|
-
mountDateLinesComponent(linesConfig);
|
|
402
|
-
cy.wait(axisTickTextWaitTime);
|
|
403
|
-
const categories = [];
|
|
404
|
-
cy.get(lineSelector)
|
|
405
|
-
.each(($lines) => {
|
|
406
|
-
categories.push(
|
|
407
|
-
$lines.attr('class').split(' ')[1].split('-').join(' ')
|
|
408
|
-
);
|
|
409
|
-
})
|
|
410
|
-
.then(() => {
|
|
411
|
-
expect(categories).to.have.members([
|
|
412
|
-
...new Set(dateData.map((d) => d.continent)),
|
|
413
|
-
]);
|
|
414
|
-
});
|
|
415
|
-
cy.get('.vic-axis-y-quantitative .tick text').each(($tick) => {
|
|
416
|
-
const tickValue = parseInt($tick.text());
|
|
417
|
-
expect(tickValue).to.be.gte(0);
|
|
418
|
-
expect(tickValue).to.be.lte(4900000000);
|
|
419
|
-
});
|
|
420
|
-
});
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
describe('if the user specifies an x domain that is smaller than max value', () => {
|
|
424
|
-
it('should draw the lines with the users specified x domain - CORRECT BEHAVIOR CAUSES VISUAL ERROR', () => {
|
|
425
|
-
const linesConfig =
|
|
426
|
-
new VicLinesConfigBuilder<ContinentPopulationNumYearDatum>()
|
|
427
|
-
.data(numericData)
|
|
428
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
429
|
-
.xNumeric((dimension) =>
|
|
430
|
-
dimension
|
|
431
|
-
.valueAccessor((d) => d.year)
|
|
432
|
-
.includeZeroInDomain(false)
|
|
433
|
-
.domain([2020, 2080])
|
|
434
|
-
)
|
|
435
|
-
.y((dimension) => dimension.valueAccessor((d) => d.population))
|
|
436
|
-
.stroke((stroke) =>
|
|
437
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
438
|
-
)
|
|
439
|
-
.getConfig();
|
|
440
|
-
mountNumberLinesComponent(linesConfig);
|
|
441
|
-
cy.wait(axisTickTextWaitTime);
|
|
442
|
-
const categories = [];
|
|
443
|
-
cy.get(lineSelector)
|
|
444
|
-
.each((line) => {
|
|
445
|
-
categories.push(line.attr('class').split(' ')[1].split('-').join(' '));
|
|
446
|
-
})
|
|
447
|
-
.then(() => {
|
|
448
|
-
expect(categories).to.have.members([
|
|
449
|
-
...new Set(dateData.map((d) => d.continent)),
|
|
450
|
-
]);
|
|
451
|
-
});
|
|
452
|
-
cy.get('.vic-axis-x-quantitative .tick text').each(($tick) => {
|
|
453
|
-
const tickValue = parseInt($tick.text());
|
|
454
|
-
expect(tickValue).to.be.gte(2020);
|
|
455
|
-
expect(tickValue).to.be.lte(2080);
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
// ***********************************************************
|
|
461
|
-
// Tests of various config properties
|
|
462
|
-
// ***********************************************************
|
|
463
|
-
describe('it creates lines with the correct properties per config', () => {
|
|
464
|
-
// More rigorous testing of categorical dimension in categorical tests
|
|
465
|
-
it('draws lines with the correct colors', () => {
|
|
466
|
-
const linesConfig =
|
|
467
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
468
|
-
.data(dateData)
|
|
469
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
470
|
-
.xDate((dimension) => dimension.valueAccessor((d) => d.year))
|
|
471
|
-
.y((dimension) => dimension.valueAccessor((d) => d.population))
|
|
472
|
-
.stroke((stroke) =>
|
|
473
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
474
|
-
)
|
|
475
|
-
.getConfig();
|
|
476
|
-
mountDateLinesComponent(linesConfig);
|
|
477
|
-
cy.get(lineSelector).each(($line, i) => {
|
|
478
|
-
cy.wrap($line).should('have.attr', 'stroke', schemeTableau10[i]);
|
|
479
|
-
});
|
|
480
|
-
});
|
|
481
|
-
it('draws the correct number of lines if a user provides a custom curve function', () => {
|
|
482
|
-
const linesConfig =
|
|
483
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
484
|
-
.data(dateData)
|
|
485
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
486
|
-
.curve(curveBasis)
|
|
487
|
-
.xDate((dimension) => dimension.valueAccessor((d) => d.year))
|
|
488
|
-
.y((dimension) =>
|
|
489
|
-
dimension.valueAccessor((d) => d.population).domain([0, 4900000000])
|
|
490
|
-
)
|
|
491
|
-
.stroke((stroke) =>
|
|
492
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
493
|
-
)
|
|
494
|
-
.getConfig();
|
|
495
|
-
mountDateLinesComponent(linesConfig);
|
|
496
|
-
cy.get(lineSelector).should('have.length', 6);
|
|
497
|
-
});
|
|
498
|
-
|
|
499
|
-
describe('pointMarkers', () => {
|
|
500
|
-
it('draws the correct number of point markers', () => {
|
|
501
|
-
const linesConfig =
|
|
502
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
503
|
-
.data(dateData)
|
|
504
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
505
|
-
.xDate((dimension) => dimension.valueAccessor((d) => d.year))
|
|
506
|
-
.y((dimension) =>
|
|
507
|
-
dimension.valueAccessor((d) => d.population).domain([0, 4900000000])
|
|
508
|
-
)
|
|
509
|
-
.stroke((stroke) =>
|
|
510
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
511
|
-
)
|
|
512
|
-
.pointMarkers()
|
|
513
|
-
.getConfig();
|
|
514
|
-
mountDateLinesComponent(linesConfig);
|
|
515
|
-
cy.get(markerSelector).should('have.length', 24);
|
|
516
|
-
cy.get(markerSelector)
|
|
517
|
-
.filter(
|
|
518
|
-
(index, element) =>
|
|
519
|
-
window.getComputedStyle(element).display === 'block'
|
|
520
|
-
)
|
|
521
|
-
.should('have.length', 24);
|
|
522
|
-
});
|
|
523
|
-
it('draws the correct number of point markers with none visible if display is set to false', () => {
|
|
524
|
-
const linesConfig =
|
|
525
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
526
|
-
.data(dateData)
|
|
527
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
528
|
-
.xDate((dimension) => dimension.valueAccessor((d) => d.year))
|
|
529
|
-
.y((dimension) =>
|
|
530
|
-
dimension.valueAccessor((d) => d.population).domain([0, 4900000000])
|
|
531
|
-
)
|
|
532
|
-
.stroke((stroke) =>
|
|
533
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
534
|
-
)
|
|
535
|
-
.pointMarkers((markers) => markers.display(false))
|
|
536
|
-
.getConfig();
|
|
537
|
-
mountDateLinesComponent(linesConfig);
|
|
538
|
-
cy.get(markerSelector).should('have.length', 24);
|
|
539
|
-
cy.get(markerSelector)
|
|
540
|
-
.filter(
|
|
541
|
-
(index, element) =>
|
|
542
|
-
window.getComputedStyle(element).display === 'block'
|
|
543
|
-
)
|
|
544
|
-
.should('have.length', 0);
|
|
545
|
-
cy.get(markerSelector)
|
|
546
|
-
.filter(
|
|
547
|
-
(index, element) =>
|
|
548
|
-
window.getComputedStyle(element).display === 'none'
|
|
549
|
-
)
|
|
550
|
-
.should('have.length', 24);
|
|
551
|
-
});
|
|
552
|
-
it('draws the correct number of point markers with the right number visible if display is set to a function', () => {
|
|
553
|
-
const linesConfig =
|
|
554
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
555
|
-
.data(dateData)
|
|
556
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
557
|
-
.xDate((dimension) => dimension.valueAccessor((d) => d.year))
|
|
558
|
-
.y((dimension) =>
|
|
559
|
-
dimension.valueAccessor((d) => d.population).domain([0, 4900000000])
|
|
560
|
-
)
|
|
561
|
-
.stroke((stroke) =>
|
|
562
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
563
|
-
)
|
|
564
|
-
.pointMarkers((markers) =>
|
|
565
|
-
markers.display((d) => d.continent === 'Asia')
|
|
566
|
-
)
|
|
567
|
-
.getConfig();
|
|
568
|
-
mountDateLinesComponent(linesConfig);
|
|
569
|
-
cy.get(markerSelector).should('have.length', 24);
|
|
570
|
-
cy.get(markerSelector)
|
|
571
|
-
.filter(
|
|
572
|
-
(index, element) =>
|
|
573
|
-
window.getComputedStyle(element).display === 'block'
|
|
574
|
-
)
|
|
575
|
-
.should('have.length', 4);
|
|
576
|
-
cy.get(markerSelector)
|
|
577
|
-
.filter(
|
|
578
|
-
(index, element) =>
|
|
579
|
-
window.getComputedStyle(element).display === 'none'
|
|
580
|
-
)
|
|
581
|
-
.should('have.length', 20);
|
|
582
|
-
});
|
|
583
|
-
it('draws point markers with the correct radius - user provides custom radius', () => {
|
|
584
|
-
const radius = 4;
|
|
585
|
-
const linesConfig =
|
|
586
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
587
|
-
.data(dateData)
|
|
588
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
589
|
-
.xDate((dimension) => dimension.valueAccessor((d) => d.year))
|
|
590
|
-
.y((dimension) =>
|
|
591
|
-
dimension.valueAccessor((d) => d.population).domain([0, 4900000000])
|
|
592
|
-
)
|
|
593
|
-
.stroke((stroke) =>
|
|
594
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
595
|
-
)
|
|
596
|
-
.pointMarkers((markers) => markers.radius(radius))
|
|
597
|
-
.getConfig();
|
|
598
|
-
mountDateLinesComponent(linesConfig);
|
|
599
|
-
cy.get(markerSelector).each(($pointMarker) => {
|
|
600
|
-
cy.wrap($pointMarker).should('have.attr', 'r', radius.toString());
|
|
601
|
-
});
|
|
602
|
-
});
|
|
603
|
-
});
|
|
604
|
-
|
|
605
|
-
describe('stroke', () => {
|
|
606
|
-
it('draws lines with the correct properties', () => {
|
|
607
|
-
const linesConfig =
|
|
608
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
609
|
-
.data(dateData)
|
|
610
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
611
|
-
.xDate((dimension) => dimension.valueAccessor((d) => d.year))
|
|
612
|
-
.y((dimension) =>
|
|
613
|
-
dimension.valueAccessor((d) => d.population).domain([0, 4900000000])
|
|
614
|
-
)
|
|
615
|
-
.stroke((stroke) =>
|
|
616
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
617
|
-
)
|
|
618
|
-
.pointMarkers()
|
|
619
|
-
.stroke((stroke) =>
|
|
620
|
-
stroke.width(3).opacity(0.5).linecap('square').linejoin('miter')
|
|
621
|
-
)
|
|
622
|
-
.getConfig();
|
|
623
|
-
mountDateLinesComponent(linesConfig);
|
|
624
|
-
cy.get('.vic-lines').should('have.attr', 'stroke-width', '3');
|
|
625
|
-
cy.get('.vic-lines').should('have.attr', 'stroke-opacity', '0.5');
|
|
626
|
-
cy.get('.vic-lines').should('have.attr', 'stroke-linecap', 'square');
|
|
627
|
-
cy.get('.vic-lines').should('have.attr', 'stroke-linejoin', 'miter');
|
|
628
|
-
});
|
|
629
|
-
});
|
|
630
|
-
|
|
631
|
-
describe('line labels', () => {
|
|
632
|
-
it('draws the correct number of line labels', () => {
|
|
633
|
-
const linesConfig =
|
|
634
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
635
|
-
.data(dateData)
|
|
636
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
637
|
-
.xDate((dimension) => dimension.valueAccessor((d) => d.year))
|
|
638
|
-
.y((dimension) =>
|
|
639
|
-
dimension.valueAccessor((d) => d.population).domain([0, 4900000000])
|
|
640
|
-
)
|
|
641
|
-
.stroke((stroke) =>
|
|
642
|
-
stroke.color((color) => color.valueAccessor((d) => d.continent))
|
|
643
|
-
)
|
|
644
|
-
.labelLines(true)
|
|
645
|
-
.getConfig();
|
|
646
|
-
mountDateLinesComponent(linesConfig);
|
|
647
|
-
const labels = [];
|
|
648
|
-
cy.get('.vic-lines-label')
|
|
649
|
-
.each(($label) => {
|
|
650
|
-
labels.push($label.text());
|
|
651
|
-
})
|
|
652
|
-
.then(() => {
|
|
653
|
-
expect(labels).to.have.members([
|
|
654
|
-
...new Set(dateData.map((d) => d.continent)),
|
|
655
|
-
]);
|
|
656
|
-
});
|
|
657
|
-
});
|
|
658
|
-
});
|
|
659
|
-
});
|
|
660
|
-
|
|
661
|
-
// ***********************************************************
|
|
662
|
-
// Tests of tooltips
|
|
663
|
-
// ***********************************************************
|
|
664
|
-
describe('displays tooltips for correct data per hover position', () => {
|
|
665
|
-
beforeEach(() => {
|
|
666
|
-
cy.viewport(800, 600); // ensure that tts don't get repositioned at the edges of the chart
|
|
667
|
-
const linesConfig =
|
|
668
|
-
new VicLinesConfigBuilder<ContinentPopulationDateYearDatum>()
|
|
669
|
-
.data(dateData)
|
|
670
|
-
.datumClass((d) => d.continent.split(' ').join('-'))
|
|
671
|
-
.xDate((xDate) =>
|
|
672
|
-
// When running in headless mode, realHover is finicky with point markers that are on the edge of the svg container
|
|
673
|
-
// Padded the x and y domains to avoid this issue
|
|
674
|
-
xDate
|
|
675
|
-
.valueAccessor((d) => d.year)
|
|
676
|
-
.domain([new Date('2020-01-02'), new Date('2104-01-02')])
|
|
677
|
-
)
|
|
678
|
-
.y((y) => y.valueAccessor((d) => d.population).domainPaddingPixels(100))
|
|
679
|
-
.stroke((stroke) =>
|
|
680
|
-
stroke
|
|
681
|
-
.color((color) => color.valueAccessor((d) => d.continent))
|
|
682
|
-
.width(3)
|
|
683
|
-
.opacity(0.5)
|
|
684
|
-
.linecap('square')
|
|
685
|
-
.linejoin('miter')
|
|
686
|
-
)
|
|
687
|
-
.pointMarkers()
|
|
688
|
-
.getConfig();
|
|
689
|
-
mountDateLinesComponent(linesConfig);
|
|
690
|
-
});
|
|
691
|
-
|
|
692
|
-
dateData.forEach((_, i) => {
|
|
693
|
-
describe(`Data point at index ${i}`, () => {
|
|
694
|
-
beforeEach(() => {
|
|
695
|
-
cy.get('.vic-lines-marker').eq(i).realHoverAndWait();
|
|
696
|
-
});
|
|
697
|
-
|
|
698
|
-
it('displays a tooltip', () => {
|
|
699
|
-
cy.get('.vic-html-tooltip-overlay').should('exist');
|
|
700
|
-
});
|
|
701
|
-
|
|
702
|
-
it('hides the tooltip on Esc button press', () => {
|
|
703
|
-
cy.get('body').focus().type('{esc}');
|
|
704
|
-
cy.get('.vic-html-tooltip-overlay').should('not.exist');
|
|
705
|
-
});
|
|
706
|
-
|
|
707
|
-
it('tooltip displays correct data', () => {
|
|
708
|
-
cy.get('.vic-html-tooltip-overlay p')
|
|
709
|
-
.eq(0)
|
|
710
|
-
.should('have.text', dateData[i].continent);
|
|
711
|
-
cy.get('.vic-html-tooltip-overlay p')
|
|
712
|
-
.eq(1)
|
|
713
|
-
.then(($el) => {
|
|
714
|
-
expect(+$el.text()).to.equal(dateData[i].year.getFullYear());
|
|
715
|
-
});
|
|
716
|
-
cy.get('.vic-html-tooltip-overlay p')
|
|
717
|
-
.eq(2)
|
|
718
|
-
.should('have.text', dateData[i].population);
|
|
719
|
-
});
|
|
720
|
-
|
|
721
|
-
it('tooltip appears at the correct position', () => {
|
|
722
|
-
cy.get('.vic-html-tooltip-overlay').then(($el) => {
|
|
723
|
-
const tooltipBox = $el[0].getBoundingClientRect();
|
|
724
|
-
cy.get('.vic-lines-marker')
|
|
725
|
-
.eq(i)
|
|
726
|
-
.then(($el) => {
|
|
727
|
-
const markerBox = $el[0].getBoundingClientRect();
|
|
728
|
-
expect((tooltipBox.left + tooltipBox.right) / 2).to.be.closeTo(
|
|
729
|
-
(markerBox.left + markerBox.right) / 2,
|
|
730
|
-
1
|
|
731
|
-
);
|
|
732
|
-
expect(tooltipBox.bottom).to.be.closeTo(markerBox.top, 10);
|
|
733
|
-
});
|
|
734
|
-
});
|
|
735
|
-
});
|
|
736
|
-
});
|
|
737
|
-
});
|
|
738
|
-
});
|