@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,323 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { Component, Input } from '@angular/core';
|
|
3
|
-
import {
|
|
4
|
-
CHART_SIZE,
|
|
5
|
-
ChartConfig,
|
|
6
|
-
DotsConfig,
|
|
7
|
-
VicChartConfigBuilder,
|
|
8
|
-
VicChartModule,
|
|
9
|
-
VicDotsConfigBuilder,
|
|
10
|
-
VicDotsModule,
|
|
11
|
-
VicXQuantitativeAxisConfig,
|
|
12
|
-
VicXQuantitativeAxisConfigBuilder,
|
|
13
|
-
VicXyAxisModule,
|
|
14
|
-
VicYQuantitativeAxisConfig,
|
|
15
|
-
VicYQuantitativeAxisConfigBuilder,
|
|
16
|
-
} from '@mathstack/viz';
|
|
17
|
-
import { cy, describe, expect, it } from 'local-cypress';
|
|
18
|
-
import {
|
|
19
|
-
CountryFactsDatum,
|
|
20
|
-
countryFactsData,
|
|
21
|
-
} from '../../testing/data/country-area-continent';
|
|
22
|
-
|
|
23
|
-
@Component({
|
|
24
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
25
|
-
selector: 'app-svg-attr-test-component',
|
|
26
|
-
template: `
|
|
27
|
-
<div [style.width.px]="containerWidth">
|
|
28
|
-
<vic-chart [config]="chartConfig">
|
|
29
|
-
<ng-container svg-elements>
|
|
30
|
-
<svg:rect
|
|
31
|
-
x="50"
|
|
32
|
-
y="50"
|
|
33
|
-
width="100"
|
|
34
|
-
height="100"
|
|
35
|
-
fill="tomato"
|
|
36
|
-
></svg:rect>
|
|
37
|
-
</ng-container>
|
|
38
|
-
</vic-chart>
|
|
39
|
-
</div>
|
|
40
|
-
`,
|
|
41
|
-
imports: [CommonModule, VicChartModule],
|
|
42
|
-
})
|
|
43
|
-
class SvgAttrTestComponent {
|
|
44
|
-
@Input() chartConfig: ChartConfig;
|
|
45
|
-
@Input() containerWidth = 400;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
describe('ChartComponent applies correct SVG attributes/styles by scalingStrategy on initial render', () => {
|
|
49
|
-
const testWidth = 400;
|
|
50
|
-
const testHeight = 300;
|
|
51
|
-
const baseConfig = new VicChartConfigBuilder()
|
|
52
|
-
.maxWidth(testWidth)
|
|
53
|
-
.margin({ top: 20, right: 20, bottom: 20, left: 20 });
|
|
54
|
-
|
|
55
|
-
function mountWithStrategy(config: ChartConfig = baseConfig.getConfig()) {
|
|
56
|
-
cy.mount(SvgAttrTestComponent, {
|
|
57
|
-
componentProperties: { chartConfig: config },
|
|
58
|
-
});
|
|
59
|
-
cy.wait(50);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
it('applies fixed scaling with static width and aspect-ratio derived height', () => {
|
|
63
|
-
mountWithStrategy(baseConfig.scalingStrategy('fixed').getConfig());
|
|
64
|
-
cy.get('svg')
|
|
65
|
-
.should('have.css', 'width', `${testWidth}px`)
|
|
66
|
-
.and('have.css', 'height', `${testWidth / CHART_SIZE.aspectRatio}px`)
|
|
67
|
-
.and('not.have.attr', 'viewBox');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('applies fixed scaling with static width and user-speced height that overrides aspect ratio', () => {
|
|
71
|
-
mountWithStrategy(
|
|
72
|
-
baseConfig.scalingStrategy('fixed').maxHeight(testHeight).getConfig()
|
|
73
|
-
);
|
|
74
|
-
cy.get('svg')
|
|
75
|
-
.should('have.css', 'width', `${testWidth}px`)
|
|
76
|
-
.and('have.css', 'height', `${testHeight}px`)
|
|
77
|
-
.and('not.have.attr', 'viewBox');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('applies responsive-width scaling with dynamic width and aspect-ratio-derived height', () => {
|
|
81
|
-
mountWithStrategy(
|
|
82
|
-
baseConfig.scalingStrategy('responsive-width').maxHeight(null).getConfig()
|
|
83
|
-
);
|
|
84
|
-
cy.get('svg').should('not.have.attr', 'viewBox');
|
|
85
|
-
cy.get('svg')
|
|
86
|
-
.invoke('css', 'width')
|
|
87
|
-
.then((w) => {
|
|
88
|
-
const wNum = parseFloat(String(w));
|
|
89
|
-
expect(Number.isFinite(wNum) ? wNum : 0).to.be.lte(testWidth);
|
|
90
|
-
|
|
91
|
-
cy.get('svg')
|
|
92
|
-
.invoke('css', 'height')
|
|
93
|
-
.then((h) => {
|
|
94
|
-
const hNum = parseFloat(String(h));
|
|
95
|
-
expect(Number.isFinite(hNum) ? hNum : 0).to.be.closeTo(
|
|
96
|
-
wNum / CHART_SIZE.aspectRatio,
|
|
97
|
-
0.1
|
|
98
|
-
);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('applies responsive-width scaling with dynamic width and max-height-derived height', () => {
|
|
104
|
-
const config = baseConfig
|
|
105
|
-
.scalingStrategy('responsive-width')
|
|
106
|
-
.maxHeight(testHeight)
|
|
107
|
-
.aspectRatio(2) // should ignore this
|
|
108
|
-
.getConfig();
|
|
109
|
-
|
|
110
|
-
mountWithStrategy(config);
|
|
111
|
-
|
|
112
|
-
cy.wait(50);
|
|
113
|
-
cy.get('svg')
|
|
114
|
-
.invoke('css', 'width')
|
|
115
|
-
.then((w) => {
|
|
116
|
-
const n = parseFloat(String(w));
|
|
117
|
-
const width = Number.isFinite(n) ? n : 0;
|
|
118
|
-
cy.get('svg')
|
|
119
|
-
.invoke('css', 'height')
|
|
120
|
-
.then((h) => {
|
|
121
|
-
const m = parseFloat(String(h));
|
|
122
|
-
const height = Number.isFinite(m) ? m : 0;
|
|
123
|
-
expect(height).to.be.closeTo(width / (testWidth / testHeight), 0.1);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('applies viewbox scaling with a viewBox attribute', () => {
|
|
129
|
-
mountWithStrategy(baseConfig.scalingStrategy('viewbox').getConfig());
|
|
130
|
-
const vbHeight = CHART_SIZE.viewBoxWidth / (testWidth / testHeight);
|
|
131
|
-
cy.get('svg')
|
|
132
|
-
.should(
|
|
133
|
-
'have.attr',
|
|
134
|
-
'viewBox',
|
|
135
|
-
`0 0 ${CHART_SIZE.viewBoxWidth} ${vbHeight}`
|
|
136
|
-
)
|
|
137
|
-
.and('have.class', 'viewbox');
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
@Component({
|
|
142
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
143
|
-
selector: 'app-scaling-strategy-test',
|
|
144
|
-
template: `
|
|
145
|
-
<div
|
|
146
|
-
[style.width.px]="containerWidth"
|
|
147
|
-
[style.height.px]="containerHeight"
|
|
148
|
-
class="test-wrapper"
|
|
149
|
-
>
|
|
150
|
-
<vic-xy-chart [config]="chartConfig">
|
|
151
|
-
<ng-container svg-elements>
|
|
152
|
-
<svg:g
|
|
153
|
-
vic-x-quantitative-axis
|
|
154
|
-
[config]="xQuantitativeAxisConfig"
|
|
155
|
-
></svg:g>
|
|
156
|
-
<svg:g
|
|
157
|
-
vic-y-quantitative-axis
|
|
158
|
-
[config]="yQuantitativeAxisConfig"
|
|
159
|
-
></svg:g>
|
|
160
|
-
<svg:g vic-primary-marks-dots [config]="dotsConfig"></svg:g>
|
|
161
|
-
</ng-container>
|
|
162
|
-
</vic-xy-chart>
|
|
163
|
-
</div>
|
|
164
|
-
`,
|
|
165
|
-
imports: [CommonModule, VicChartModule, VicDotsModule, VicXyAxisModule],
|
|
166
|
-
})
|
|
167
|
-
export class ScalingStrategyTestComponent {
|
|
168
|
-
@Input() chartConfig: ChartConfig;
|
|
169
|
-
@Input() dotsConfig: DotsConfig<CountryFactsDatum>;
|
|
170
|
-
@Input() yQuantitativeAxisConfig: VicYQuantitativeAxisConfig<number>;
|
|
171
|
-
@Input() xQuantitativeAxisConfig: VicXQuantitativeAxisConfig<number>;
|
|
172
|
-
@Input() containerWidth = 400;
|
|
173
|
-
@Input() containerHeight = null;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
describe('ChartComponent correctly changes size of chart with scaling strategies', () => {
|
|
177
|
-
const testWidth = 800;
|
|
178
|
-
const testHeight = 600;
|
|
179
|
-
const testContainerWidth = 400;
|
|
180
|
-
const margin = { top: 20, right: 20, bottom: 20, left: 20 };
|
|
181
|
-
const baseConfig = new VicChartConfigBuilder().margin(margin).minWidth(100);
|
|
182
|
-
|
|
183
|
-
function getDotTransform(
|
|
184
|
-
selector = '.vic-dots-group'
|
|
185
|
-
): Cypress.Chainable<{ x: number; y: number }> {
|
|
186
|
-
return cy
|
|
187
|
-
.get(selector)
|
|
188
|
-
.first()
|
|
189
|
-
.invoke('attr', 'transform')
|
|
190
|
-
.then((t) => {
|
|
191
|
-
const match = /translate\(([^,]+),\s*([^)]+)\)/.exec(t);
|
|
192
|
-
if (!match) throw new Error(`Failed to parse transform string: ${t}`);
|
|
193
|
-
return {
|
|
194
|
-
x: parseFloat(match[1]),
|
|
195
|
-
y: parseFloat(match[2]),
|
|
196
|
-
};
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function mountWithStrategy(
|
|
201
|
-
config: ChartConfig,
|
|
202
|
-
containerWidth,
|
|
203
|
-
containerHeight
|
|
204
|
-
) {
|
|
205
|
-
const xAxisConfig = new VicXQuantitativeAxisConfigBuilder<number>()
|
|
206
|
-
.ticks((ticks) => ticks.format('.0f').count(5))
|
|
207
|
-
.getConfig();
|
|
208
|
-
const yAxisConfig =
|
|
209
|
-
new VicYQuantitativeAxisConfigBuilder<number>().getConfig();
|
|
210
|
-
const dotsConfig = new VicDotsConfigBuilder<CountryFactsDatum>()
|
|
211
|
-
.data(countryFactsData)
|
|
212
|
-
.xNumeric((x) => x.valueAccessor((d) => d.population))
|
|
213
|
-
.yNumeric((y) => y.valueAccessor((d) => d.gdpPerCapita))
|
|
214
|
-
.radiusNumeric((r) => r.valueAccessor((d) => d.popGrowth).range([4, 10]))
|
|
215
|
-
.datumClass((d) => d.country)
|
|
216
|
-
.getConfig();
|
|
217
|
-
|
|
218
|
-
cy.mount(ScalingStrategyTestComponent, {
|
|
219
|
-
componentProperties: {
|
|
220
|
-
chartConfig: config,
|
|
221
|
-
xQuantitativeAxisConfig: xAxisConfig,
|
|
222
|
-
yQuantitativeAxisConfig: yAxisConfig,
|
|
223
|
-
dotsConfig,
|
|
224
|
-
containerWidth,
|
|
225
|
-
containerHeight,
|
|
226
|
-
},
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
it('applies fixed scaling with static width and height and does not scale down', () => {
|
|
231
|
-
const config = baseConfig
|
|
232
|
-
.scalingStrategy('fixed')
|
|
233
|
-
.maxWidth(testWidth)
|
|
234
|
-
.maxHeight(testHeight)
|
|
235
|
-
.getConfig();
|
|
236
|
-
mountWithStrategy(config, testContainerWidth, null);
|
|
237
|
-
cy.get('svg')
|
|
238
|
-
.should('have.css', 'width', `${testWidth}px`)
|
|
239
|
-
.and('have.css', 'height', `${testHeight}px`)
|
|
240
|
-
.and('not.have.attr', 'viewBox');
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it('updates height when user provides a new height', () => {
|
|
244
|
-
const config = baseConfig
|
|
245
|
-
.scalingStrategy('fixed')
|
|
246
|
-
.maxWidth(testWidth)
|
|
247
|
-
.maxHeight(testHeight)
|
|
248
|
-
.getConfig();
|
|
249
|
-
mountWithStrategy(config, testContainerWidth, null);
|
|
250
|
-
cy.wait(100);
|
|
251
|
-
|
|
252
|
-
const newConfig = baseConfig
|
|
253
|
-
.scalingStrategy('fixed')
|
|
254
|
-
.maxWidth(testWidth)
|
|
255
|
-
.maxHeight(testHeight + 100)
|
|
256
|
-
.getConfig();
|
|
257
|
-
mountWithStrategy(newConfig, testContainerWidth, null);
|
|
258
|
-
cy.get('svg')
|
|
259
|
-
.should('have.css', 'width', `${testWidth}px`)
|
|
260
|
-
.and('have.css', 'height', `${testHeight + 100}px`)
|
|
261
|
-
.and('not.have.attr', 'viewBox');
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
it('applies responsive-width scaling with fixedHeight and updates mark positions when container resizes', () => {
|
|
265
|
-
const config = baseConfig
|
|
266
|
-
.scalingStrategy('responsive-width')
|
|
267
|
-
.maxWidth(testWidth)
|
|
268
|
-
.fixedHeight(true)
|
|
269
|
-
.aspectRatio(2)
|
|
270
|
-
.getConfig();
|
|
271
|
-
mountWithStrategy(config, testContainerWidth, null);
|
|
272
|
-
|
|
273
|
-
getDotTransform().then((originalPosition) => {
|
|
274
|
-
// remount with wider container
|
|
275
|
-
mountWithStrategy(config, testContainerWidth + 100, null);
|
|
276
|
-
cy.wait(100);
|
|
277
|
-
|
|
278
|
-
getDotTransform().should((newPosition) => {
|
|
279
|
-
expect(newPosition.x).to.be.greaterThan(originalPosition.x);
|
|
280
|
-
expect(newPosition.y).to.be.closeTo(originalPosition.y, 1);
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
// remount with narrower container
|
|
284
|
-
mountWithStrategy(config, testContainerWidth - 100, true);
|
|
285
|
-
cy.wait(100);
|
|
286
|
-
|
|
287
|
-
getDotTransform().should((newPosition) => {
|
|
288
|
-
expect(newPosition.x).to.be.lessThan(originalPosition.x);
|
|
289
|
-
expect(newPosition.y).to.be.closeTo(originalPosition.y, 1);
|
|
290
|
-
});
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
it('applies responsive-width scaling without fixedHeight and updates mark positions when container resizes', () => {
|
|
295
|
-
const config = baseConfig
|
|
296
|
-
.scalingStrategy('responsive-width')
|
|
297
|
-
.maxWidth(testWidth)
|
|
298
|
-
.fixedHeight(false)
|
|
299
|
-
.aspectRatio(2)
|
|
300
|
-
.getConfig();
|
|
301
|
-
mountWithStrategy(config, testContainerWidth, null);
|
|
302
|
-
|
|
303
|
-
getDotTransform().then((originalPosition) => {
|
|
304
|
-
// remount with wider container
|
|
305
|
-
mountWithStrategy(config, testContainerWidth + 100, null);
|
|
306
|
-
cy.wait(100);
|
|
307
|
-
|
|
308
|
-
getDotTransform().should((newPosition) => {
|
|
309
|
-
expect(newPosition.x).to.be.greaterThan(originalPosition.x);
|
|
310
|
-
expect(newPosition.y).to.be.greaterThan(originalPosition.y);
|
|
311
|
-
});
|
|
312
|
-
|
|
313
|
-
// remount with narrower container
|
|
314
|
-
mountWithStrategy(config, testContainerWidth - 100, true);
|
|
315
|
-
cy.wait(100);
|
|
316
|
-
|
|
317
|
-
getDotTransform().should((newPosition) => {
|
|
318
|
-
expect(newPosition.x).to.be.lessThan(originalPosition.x);
|
|
319
|
-
expect(newPosition.y).to.be.lessThan(originalPosition.y);
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<!-- Slot exists so that projected content can have access to scales -->
|
|
2
|
-
<ng-container *ngTemplateOutlet="htmlElementsBefore"></ng-container>
|
|
3
|
-
<div
|
|
4
|
-
#div
|
|
5
|
-
class="vic-chart-container"
|
|
6
|
-
[ngClass]="(strategy$ | async)"
|
|
7
|
-
[style.maxWidth.px]="widthCfg$ | async"
|
|
8
|
-
[style.minWidth.px]="minWidthCfg$ | async"
|
|
9
|
-
[style.maxHeight.px]="heightCfg$ | async"
|
|
10
|
-
[style.aspectRatio]="(strategy$ | async) === 'viewbox' ? (config.viewBoxX / config.viewBoxY) : null"
|
|
11
|
-
[style.width.%]="(strategy$ | async) === 'viewbox' ? 100 : null"
|
|
12
|
-
>
|
|
13
|
-
<svg
|
|
14
|
-
#svg
|
|
15
|
-
class="vic-chart-svg"
|
|
16
|
-
[ngClass]="(strategy$ | async)"
|
|
17
|
-
[style.width.px]="(strategy$ | async) !== 'viewbox' ? (svgDimensions$ | async)?.width : null"
|
|
18
|
-
[style.height.px]="(strategy$ | async) !== 'viewbox' ? (svgDimensions$ | async)?.height : null"
|
|
19
|
-
[attr.viewBox]="(strategy$ | async) === 'viewbox' ? '0 0 ' + config.viewBoxX + ' ' + config.viewBoxY : null"
|
|
20
|
-
>
|
|
21
|
-
<defs>
|
|
22
|
-
<ng-container *ngTemplateOutlet="svgDefs"></ng-container>
|
|
23
|
-
</defs>
|
|
24
|
-
<ng-container *ngTemplateOutlet="svgElements"></ng-container>
|
|
25
|
-
</svg>
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<!-- Slot exists so that projected content can have access to scales -->
|
|
29
|
-
<ng-container *ngTemplateOutlet="htmlElementsAfter"></ng-container>
|
|
30
|
-
|
|
31
|
-
<ng-template #htmlElementsBefore>
|
|
32
|
-
<ng-content select="[html-elements-before]"></ng-content>
|
|
33
|
-
</ng-template>
|
|
34
|
-
|
|
35
|
-
<ng-template #svgDefs>
|
|
36
|
-
<ng-content select="[svg-defs]"></ng-content>
|
|
37
|
-
</ng-template>
|
|
38
|
-
|
|
39
|
-
<ng-template #svgElements>
|
|
40
|
-
<ng-content select="[svg-elements]"></ng-content>
|
|
41
|
-
</ng-template>
|
|
42
|
-
|
|
43
|
-
<ng-template #htmlElementsAfter>
|
|
44
|
-
<ng-content select="[html-elements-after]"></ng-content>
|
|
45
|
-
</ng-template>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
}
|
|
3
|
-
|
|
4
|
-
.vic-chart-container {
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: stretch;
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
width: 100%;
|
|
9
|
-
min-width: 0;
|
|
10
|
-
|
|
11
|
-
&.responsive-width {
|
|
12
|
-
contain: inline-size;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
&.viewbox {
|
|
16
|
-
contain: inline-size;
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&.fixed {
|
|
21
|
-
display: block;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.vic-chart-svg {
|
|
26
|
-
display: block;
|
|
27
|
-
|
|
28
|
-
// Allow overflow for annotations, labels, etc. unless viewbox
|
|
29
|
-
&:not(.viewbox) {
|
|
30
|
-
overflow: visible;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&.viewbox {
|
|
34
|
-
width: 100%;
|
|
35
|
-
height: 100%;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import {
|
|
3
|
-
Component,
|
|
4
|
-
DestroyRef,
|
|
5
|
-
ElementRef,
|
|
6
|
-
Input,
|
|
7
|
-
NgZone,
|
|
8
|
-
OnChanges,
|
|
9
|
-
OnInit,
|
|
10
|
-
SimpleChanges,
|
|
11
|
-
ViewChild,
|
|
12
|
-
inject,
|
|
13
|
-
} from '@angular/core';
|
|
14
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
15
|
-
import { NgOnChangesUtilities } from '@mathstack/app-kit';
|
|
16
|
-
import { isEqual } from 'lodash-es';
|
|
17
|
-
import {
|
|
18
|
-
BehaviorSubject,
|
|
19
|
-
Observable,
|
|
20
|
-
auditTime,
|
|
21
|
-
combineLatest,
|
|
22
|
-
defer,
|
|
23
|
-
distinctUntilChanged,
|
|
24
|
-
filter,
|
|
25
|
-
map,
|
|
26
|
-
of,
|
|
27
|
-
shareReplay,
|
|
28
|
-
switchMap,
|
|
29
|
-
} from 'rxjs';
|
|
30
|
-
import { Dimensions, ElementSpacing } from '../../core/types/layout';
|
|
31
|
-
import { Chart } from './chart';
|
|
32
|
-
import { CHART } from './chart.token';
|
|
33
|
-
import { ScalingStrategy, VicChartConfigBuilder } from './config/chart-builder';
|
|
34
|
-
import { ChartConfig } from './config/chart-config';
|
|
35
|
-
|
|
36
|
-
export interface Ranges {
|
|
37
|
-
x: [number, number];
|
|
38
|
-
y: [number, number];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface ChartResizing {
|
|
42
|
-
width: boolean;
|
|
43
|
-
height: boolean;
|
|
44
|
-
useViewbox: boolean;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ReactiveConfig {
|
|
48
|
-
margin: ElementSpacing;
|
|
49
|
-
height: number;
|
|
50
|
-
width: number;
|
|
51
|
-
scalingStrategy: ScalingStrategy;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* A base component that can be extended to create specific types of `Chart` components,
|
|
56
|
-
* each of which can serve as a wrapper component for one `PrimaryMarks` component and any
|
|
57
|
-
* other content that is projected into its content projection slots.
|
|
58
|
-
*
|
|
59
|
-
* <p class="comment-slots">Content projection slots</p>
|
|
60
|
-
*
|
|
61
|
-
* `html-elements-before`: Elements that will be projected before the chart's scaled div
|
|
62
|
-
* and scaled svg element in the DOM. USeful for adding elements that require access to chart scales.
|
|
63
|
-
*
|
|
64
|
-
* `svg-defs`: Used to create any required defs for the chart's svg element. For example, patterns or gradients.
|
|
65
|
-
*
|
|
66
|
-
* `svg-elements`: Used for all elements that should be children of the chart's scaled svg element.
|
|
67
|
-
*
|
|
68
|
-
* `html-elements-after`: Elements that will be projected after the chart's scaled div
|
|
69
|
-
* and scaled svg element in the DOM. USeful for adding elements that require access to chart scales.
|
|
70
|
-
*/
|
|
71
|
-
@Component({
|
|
72
|
-
selector: 'vic-chart',
|
|
73
|
-
templateUrl: './chart.component.html',
|
|
74
|
-
styleUrls: ['./chart.component.scss'],
|
|
75
|
-
providers: [{ provide: CHART, useExisting: ChartComponent }],
|
|
76
|
-
host: {
|
|
77
|
-
class: 'vic-chart',
|
|
78
|
-
},
|
|
79
|
-
imports: [CommonModule],
|
|
80
|
-
})
|
|
81
|
-
export class ChartComponent implements Chart, OnInit, OnChanges {
|
|
82
|
-
@Input() config: ChartConfig = new VicChartConfigBuilder().getConfig();
|
|
83
|
-
@ViewChild('div', { static: true }) divRef: ElementRef<HTMLDivElement>;
|
|
84
|
-
@ViewChild('svg', { static: true }) svgRef: ElementRef<SVGSVGElement>;
|
|
85
|
-
|
|
86
|
-
private _config: BehaviorSubject<ChartConfig> = new BehaviorSubject(null);
|
|
87
|
-
config$: Observable<ChartConfig> = this._config.asObservable().pipe(
|
|
88
|
-
filter((c) => !!c),
|
|
89
|
-
distinctUntilChanged((a, b) => isEqual(a, b)),
|
|
90
|
-
shareReplay(1)
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
protected readonly strategy$ = this.config$.pipe(
|
|
94
|
-
map((c) => c.scalingStrategy),
|
|
95
|
-
distinctUntilChanged()
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
protected readonly widthCfg$ = this.config$.pipe(
|
|
99
|
-
map((c) => c.width),
|
|
100
|
-
distinctUntilChanged()
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
protected readonly minWidthCfg$ = this.config$.pipe(
|
|
104
|
-
map((c) => c.minWidth),
|
|
105
|
-
distinctUntilChanged()
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
protected readonly heightCfg$ = this.config$.pipe(
|
|
109
|
-
map((c) => c.height),
|
|
110
|
-
distinctUntilChanged()
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
private readonly aspectRatioCfg$ = this.config$.pipe(
|
|
114
|
-
map(
|
|
115
|
-
(c) =>
|
|
116
|
-
c.aspectRatio ??
|
|
117
|
-
(typeof c.width === 'number' &&
|
|
118
|
-
typeof c.height === 'number' &&
|
|
119
|
-
c.height !== 0
|
|
120
|
-
? c.width / c.height
|
|
121
|
-
: undefined)
|
|
122
|
-
),
|
|
123
|
-
distinctUntilChanged()
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
private readonly isFixedHeight$ = this.config$.pipe(
|
|
127
|
-
map((c) => c.isFixedHeight),
|
|
128
|
-
distinctUntilChanged()
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
protected readonly marginCfg$ = this.config$.pipe(
|
|
132
|
-
map((c) => c.margin),
|
|
133
|
-
distinctUntilChanged((a, b) => isEqual(a, b))
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
private readonly width$ = this.strategy$.pipe(
|
|
137
|
-
switchMap((strategy) =>
|
|
138
|
-
strategy === 'responsive-width'
|
|
139
|
-
? defer(() => this.observeElementWidth(this.divRef.nativeElement))
|
|
140
|
-
: strategy === 'viewbox'
|
|
141
|
-
? of(this.config.viewBoxX)
|
|
142
|
-
: this.widthCfg$
|
|
143
|
-
)
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
private readonly height$ = combineLatest([
|
|
147
|
-
this.strategy$,
|
|
148
|
-
this.width$,
|
|
149
|
-
this.heightCfg$,
|
|
150
|
-
this.aspectRatioCfg$,
|
|
151
|
-
this.isFixedHeight$,
|
|
152
|
-
]).pipe(
|
|
153
|
-
map(([strategy, w, hCfg, ar, isFixedHeight]) =>
|
|
154
|
-
strategy === 'responsive-width' && !isFixedHeight
|
|
155
|
-
? w / ar
|
|
156
|
-
: strategy === 'viewbox'
|
|
157
|
-
? this.config.viewBoxY
|
|
158
|
-
: hCfg
|
|
159
|
-
),
|
|
160
|
-
distinctUntilChanged()
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
protected readonly svgDimensions$ = combineLatest([
|
|
164
|
-
this.width$,
|
|
165
|
-
this.height$,
|
|
166
|
-
]).pipe(
|
|
167
|
-
filter(([w, h]) => w > 0 && h > 0),
|
|
168
|
-
map(([width, height]) => ({ width, height })),
|
|
169
|
-
distinctUntilChanged((a, b) => isEqual(a, b)),
|
|
170
|
-
shareReplay(1)
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
readonly ranges$ = combineLatest([this.svgDimensions$, this.marginCfg$]).pipe(
|
|
174
|
-
map(([dimensions, margin]) =>
|
|
175
|
-
this.getRangesFromSvgDimensions(dimensions, margin)
|
|
176
|
-
),
|
|
177
|
-
distinctUntilChanged((a, b) => isEqual(a, b)),
|
|
178
|
-
shareReplay(1)
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
protected destroyRef = inject(DestroyRef);
|
|
182
|
-
private ngZone = inject(NgZone);
|
|
183
|
-
|
|
184
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
185
|
-
if (NgOnChangesUtilities.inputObjectChanged(changes, 'config')) {
|
|
186
|
-
this._config.next(this.config);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
ngOnInit(): void {
|
|
191
|
-
// ensure that values are pulled through
|
|
192
|
-
this.ranges$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe();
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
private observeElementWidth(element: HTMLElement): Observable<number> {
|
|
196
|
-
return new Observable<number>((subscriber) => {
|
|
197
|
-
let ro: ResizeObserver;
|
|
198
|
-
this.ngZone.runOutsideAngular(() => {
|
|
199
|
-
ro = new ResizeObserver((entries) => {
|
|
200
|
-
const e = entries[0];
|
|
201
|
-
const w =
|
|
202
|
-
(Array.isArray(e.borderBoxSize)
|
|
203
|
-
? e.borderBoxSize[0]?.inlineSize
|
|
204
|
-
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
205
|
-
(e as any).borderBoxSize?.inlineSize) ?? e.contentRect.width;
|
|
206
|
-
this.ngZone.run(() => subscriber.next(w));
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
210
|
-
ro.observe(element, { box: 'border-box' as any });
|
|
211
|
-
return () => {
|
|
212
|
-
ro.unobserve(element);
|
|
213
|
-
ro.disconnect();
|
|
214
|
-
};
|
|
215
|
-
}).pipe(
|
|
216
|
-
map((w) => Math.round(w)),
|
|
217
|
-
auditTime(0),
|
|
218
|
-
distinctUntilChanged()
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
private getRangesFromSvgDimensions(
|
|
223
|
-
dim: Dimensions,
|
|
224
|
-
margin: ElementSpacing
|
|
225
|
-
): Ranges {
|
|
226
|
-
return {
|
|
227
|
-
x: [margin.left, dim.width - margin.right],
|
|
228
|
-
y: [dim.height - margin.bottom, margin.top],
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
getViewBoxScale(): { x: number; y: number } {
|
|
233
|
-
if (!this.svgRef?.nativeElement?.viewBox?.baseVal) {
|
|
234
|
-
return { x: 1, y: 1 };
|
|
235
|
-
}
|
|
236
|
-
const rect = this.svgRef.nativeElement.getBoundingClientRect();
|
|
237
|
-
const vb = this.svgRef.nativeElement.viewBox.baseVal;
|
|
238
|
-
return {
|
|
239
|
-
x: vb.width / rect.width,
|
|
240
|
-
y: vb.height / rect.height,
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
}
|