@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,194 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
3
|
-
import { ElementSpacing } from '../../../core/types/layout';
|
|
4
|
-
import { ChartConfig } from './chart-config';
|
|
5
|
-
|
|
6
|
-
export type ScalingStrategy = 'fixed' | 'responsive-width' | 'viewbox';
|
|
7
|
-
|
|
8
|
-
export const CHART_SIZE = {
|
|
9
|
-
scaledWidth: 800,
|
|
10
|
-
viewBoxWidth: 800,
|
|
11
|
-
minWidth: 320,
|
|
12
|
-
aspectRatio: 16 / 9,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const DEFAULT = {
|
|
16
|
-
_fixedHeight: false,
|
|
17
|
-
_margin: { top: 36, right: 36, bottom: 36, left: 36 },
|
|
18
|
-
_scalingStrategy: 'responsive-width' as ScalingStrategy,
|
|
19
|
-
_transitionDuration: 250,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Builds a configuration object for a ChartComponent.
|
|
24
|
-
*
|
|
25
|
-
* Must be added to a providers array in or above the component that consumes it if it is injected via the constructor. (e.g. `providers: [VicChartConfigBuilder]` in the component decorator)
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
@Injectable()
|
|
29
|
-
export class VicChartConfigBuilder {
|
|
30
|
-
private _aspectRatio?: number;
|
|
31
|
-
private _fixedHeight: boolean;
|
|
32
|
-
private _height: number;
|
|
33
|
-
private _margin: ElementSpacing;
|
|
34
|
-
private _minWidth: number;
|
|
35
|
-
private _scalingStrategy: ScalingStrategy;
|
|
36
|
-
private _transitionDuration: number;
|
|
37
|
-
private _width: number;
|
|
38
|
-
|
|
39
|
-
constructor() {
|
|
40
|
-
safeAssign(this, DEFAULT);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* OPTIONAL. Explicitly sets the aspect ratio to use when scalingStrategy is 'responsive-width' and fixedHeight is false, or when scalingStrategy is 'viewbox'.
|
|
45
|
-
*
|
|
46
|
-
* @param value - The aspect ratio (width / height) to use. If not called or called with null, a default value of 16/9 will be used. If maxWidth and maxHeight are set, aspect ratio will be derived from those values.
|
|
47
|
-
*/
|
|
48
|
-
aspectRatio(value: number): this {
|
|
49
|
-
this._aspectRatio = value;
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* OPTIONAL. If set to true and used with 'responsive-width' scaling strategy, height will be fixed and not derived from aspect ratio.
|
|
55
|
-
*
|
|
56
|
-
* Has no effect if scaling strategy is 'fixed' or 'viewbox'.
|
|
57
|
-
*/
|
|
58
|
-
fixedHeight(value: boolean): this {
|
|
59
|
-
this._fixedHeight = value;
|
|
60
|
-
return this;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* OPTIONAL. Determines the margin that will be established between the edges of the svg and the svg's contents, in px.
|
|
65
|
-
*
|
|
66
|
-
* @param value - The margin that will be established between the edges of the svg and the svg's contents, in px. If called with null, a default value of `{ top: 36, right: 36, bottom: 36, left: 36 }` will be used.
|
|
67
|
-
*/
|
|
68
|
-
margin(
|
|
69
|
-
value: {
|
|
70
|
-
top: number;
|
|
71
|
-
right: number;
|
|
72
|
-
bottom: number;
|
|
73
|
-
left: number;
|
|
74
|
-
} | null
|
|
75
|
-
): this {
|
|
76
|
-
if (value === null) {
|
|
77
|
-
value = DEFAULT._margin;
|
|
78
|
-
return this;
|
|
79
|
-
}
|
|
80
|
-
this._margin = value;
|
|
81
|
-
return this;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* OPTIONAL. If scaling strategy is 'responsive-width' or 'viewbox', determines the maximum height of the chart. This will override any provided aspect ratio.
|
|
86
|
-
*
|
|
87
|
-
* If scaling strategy is 'fixed', sets the fixed height of the chart.
|
|
88
|
-
*
|
|
89
|
-
* @param value - The maximum height of the chart, in px. If chart size is static, the fixed height of the chart. If not called or called with `null`, chart height will be set via aspect ratio.
|
|
90
|
-
*/
|
|
91
|
-
maxHeight(value: number | null): this {
|
|
92
|
-
this._height = value;
|
|
93
|
-
return this;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* OPTIONAL. If scaling strategy is responsive-width or viewbox, sets the maximum width of the chart. In this case, this value is also used to determine the aspect ratio of the chart which will be maintained on resizing.
|
|
98
|
-
*
|
|
99
|
-
* If scaling strategy is fixed, sets the fixed width of the chart.
|
|
100
|
-
*
|
|
101
|
-
* @param value - The maximum width of the chart, in px. If chart size is static, the fixed width of the chart.
|
|
102
|
-
*
|
|
103
|
-
* If not called or called with `null`, a default value of 800 will be used.
|
|
104
|
-
*/
|
|
105
|
-
maxWidth(value: number | null): this {
|
|
106
|
-
this._width = value;
|
|
107
|
-
return this;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* OPTIONAL. If scaling strategy is responsive-width or viewbox, sets the minimum width of the chart. Has no effect if scaling strategy is fixed.
|
|
112
|
-
*
|
|
113
|
-
* @param value - The minimum width of the chart, in px. If not called or called with `null`, a default value of 320 will be used.
|
|
114
|
-
*/
|
|
115
|
-
minWidth(value: number | null): this {
|
|
116
|
-
this._minWidth = value;
|
|
117
|
-
return this;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* OPTIONAL. Determines how the chart scales in response to container or window size changes.
|
|
122
|
-
*
|
|
123
|
-
* Default value, if not called, is 'responsive-width'.
|
|
124
|
-
*
|
|
125
|
-
* @param value - One of:
|
|
126
|
-
* - 'fixed': Chart dimensions remain constant. Width and height are fixed. Dimensions can be set with maxWidth and maxHeight.
|
|
127
|
-
* - 'responsive-width': Chart width responds to container; height is derived via aspect ratio, unless fixedHeight is true.
|
|
128
|
-
* - 'viewbox': Chart is scaled entirely via SVG viewBox. All resizing behavior is controlled through CSS.
|
|
129
|
-
*/
|
|
130
|
-
scalingStrategy(value: ScalingStrategy): this {
|
|
131
|
-
this._scalingStrategy = value;
|
|
132
|
-
return this;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* OPTIONAL. A time duration for all transitions in the chart, in ms.
|
|
137
|
-
*
|
|
138
|
-
* @@param value - The time duration for all transitions in the chart, in ms. If not called or called with null, a default value of 250 will be used.
|
|
139
|
-
*/
|
|
140
|
-
transitionDuration(value: number | null): this {
|
|
141
|
-
if (value === null) {
|
|
142
|
-
value = DEFAULT._transitionDuration;
|
|
143
|
-
return this;
|
|
144
|
-
}
|
|
145
|
-
this._transitionDuration = value;
|
|
146
|
-
return this;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
getConfig(): ChartConfig {
|
|
150
|
-
this.validateBuilder();
|
|
151
|
-
|
|
152
|
-
return new ChartConfig({
|
|
153
|
-
aspectRatio: this._aspectRatio,
|
|
154
|
-
height: this._height,
|
|
155
|
-
isFixedHeight: this._fixedHeight,
|
|
156
|
-
margin: this._margin,
|
|
157
|
-
minWidth: this._minWidth,
|
|
158
|
-
scalingStrategy: this._scalingStrategy,
|
|
159
|
-
transitionDuration: this._transitionDuration,
|
|
160
|
-
width: this._width,
|
|
161
|
-
viewBoxX: CHART_SIZE.viewBoxWidth,
|
|
162
|
-
viewBoxY:
|
|
163
|
-
CHART_SIZE.viewBoxWidth / (this._aspectRatio ?? CHART_SIZE.aspectRatio),
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
private validateBuilder(): void {
|
|
168
|
-
if (this._width === undefined || this._width === null) {
|
|
169
|
-
this._width =
|
|
170
|
-
this._scalingStrategy === 'viewbox' ? null : CHART_SIZE.scaledWidth;
|
|
171
|
-
}
|
|
172
|
-
if (this._height === undefined || this._height === null) {
|
|
173
|
-
this._height =
|
|
174
|
-
this._scalingStrategy === 'viewbox'
|
|
175
|
-
? null
|
|
176
|
-
: this._width / (this._aspectRatio ?? CHART_SIZE.aspectRatio);
|
|
177
|
-
}
|
|
178
|
-
if (this._minWidth === undefined || this._minWidth === null) {
|
|
179
|
-
this._minWidth =
|
|
180
|
-
this._scalingStrategy === 'viewbox' ? null : CHART_SIZE.minWidth;
|
|
181
|
-
}
|
|
182
|
-
if (this._scalingStrategy !== 'viewbox' && this._minWidth > this._width) {
|
|
183
|
-
const [oldMin, oldWidth] = [this._minWidth, this._width];
|
|
184
|
-
this._minWidth = oldWidth;
|
|
185
|
-
this._width = oldMin;
|
|
186
|
-
console.warn(
|
|
187
|
-
`[vic-chart] The configured minWidth (${oldMin}px) cannot be larger than the configured width (${oldWidth}px). The values have been swapped.`
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
if (this._scalingStrategy === 'responsive-width' && !this._fixedHeight) {
|
|
191
|
-
this._aspectRatio = this._width / this._height;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
2
|
-
import { ElementSpacing } from '../../../core/types/layout';
|
|
3
|
-
import { ScalingStrategy } from './chart-builder';
|
|
4
|
-
import { ChartOptions } from './chart-options';
|
|
5
|
-
|
|
6
|
-
export class ChartConfig implements ChartOptions {
|
|
7
|
-
aspectRatio?: number;
|
|
8
|
-
height: number | null;
|
|
9
|
-
isFixedHeight: boolean;
|
|
10
|
-
margin: ElementSpacing;
|
|
11
|
-
minWidth: number | null;
|
|
12
|
-
scalingStrategy: ScalingStrategy;
|
|
13
|
-
transitionDuration: number;
|
|
14
|
-
width: number | null;
|
|
15
|
-
viewBoxX: number;
|
|
16
|
-
viewBoxY: number;
|
|
17
|
-
|
|
18
|
-
constructor(config: ChartConfig) {
|
|
19
|
-
safeAssign(this, config);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ElementSpacing } from '../../../core/types/layout';
|
|
2
|
-
import { ScalingStrategy } from './chart-builder';
|
|
3
|
-
|
|
4
|
-
export interface ChartOptions {
|
|
5
|
-
aspectRatio?: number;
|
|
6
|
-
height: number;
|
|
7
|
-
margin: ElementSpacing;
|
|
8
|
-
scalingStrategy: ScalingStrategy;
|
|
9
|
-
transitionDuration: number;
|
|
10
|
-
width: number;
|
|
11
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { ChartComponent } from './chart/chart.component';
|
|
3
|
-
import { MapChartComponent } from './map-chart/map-chart.component';
|
|
4
|
-
import { XyChartComponent } from './xy-chart/xy-chart.component';
|
|
5
|
-
|
|
6
|
-
@NgModule({
|
|
7
|
-
imports: [ChartComponent, XyChartComponent, MapChartComponent],
|
|
8
|
-
exports: [ChartComponent, XyChartComponent, MapChartComponent],
|
|
9
|
-
})
|
|
10
|
-
export class VicChartModule {}
|
package/src/lib/charts/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './chart.module';
|
|
2
|
-
export * from './chart/chart';
|
|
3
|
-
export * from './chart/chart.component';
|
|
4
|
-
export * from './chart/chart.token';
|
|
5
|
-
export * from './chart/config/chart-builder';
|
|
6
|
-
export * from './chart/config/chart-config';
|
|
7
|
-
export * from './chart/config/chart-options';
|
|
8
|
-
export * from './map-chart/map-chart.component';
|
|
9
|
-
export * from './xy-chart/xy-chart.component';
|
|
File without changes
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
-
import { MapChartComponent } from './map-chart.component';
|
|
4
|
-
|
|
5
|
-
describe('MapChartComponent', () => {
|
|
6
|
-
let component: MapChartComponent<any>;
|
|
7
|
-
let fixture: ComponentFixture<MapChartComponent<any>>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [MapChartComponent],
|
|
12
|
-
}).compileComponents();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
fixture = TestBed.createComponent(MapChartComponent);
|
|
17
|
-
component = fixture.componentInstance;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('updateAttributeProperties', () => {
|
|
21
|
-
it('calls next on updateAttributeProperties', () => {
|
|
22
|
-
spyOn((component as any).attributeProperties, 'next');
|
|
23
|
-
component.updateAttributeProperties({
|
|
24
|
-
scale: 'test scale',
|
|
25
|
-
config: 'test config',
|
|
26
|
-
} as any);
|
|
27
|
-
expect(
|
|
28
|
-
(component as any).attributeProperties.next
|
|
29
|
-
).toHaveBeenCalledOnceWith({
|
|
30
|
-
scale: 'test scale',
|
|
31
|
-
config: 'test config',
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { Component, inject, NgZone } from '@angular/core';
|
|
3
|
-
import { BehaviorSubject } from 'rxjs';
|
|
4
|
-
import { VicAttributeDataDimensionConfig } from '../../geographies/config/layers/attribute-data-layer/dimensions/attribute-data-bin-types';
|
|
5
|
-
import { Chart } from '../chart/chart';
|
|
6
|
-
import { ChartComponent } from '../chart/chart.component';
|
|
7
|
-
import { CHART } from '../chart/chart.token';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A `Chart` component to be used with a `Geographies` `PrimaryMarks` component.
|
|
11
|
-
*
|
|
12
|
-
* This component adds an attribute data scale and config to the base `ChartComponent` that can
|
|
13
|
-
* be used by any components projected into the chart.
|
|
14
|
-
*
|
|
15
|
-
* Components that may use these scales include the `Geographies` component
|
|
16
|
-
* and the `MapLegend` component.
|
|
17
|
-
*
|
|
18
|
-
* <p class="comment-slots">Content projection slots</p>
|
|
19
|
-
*
|
|
20
|
-
* `html-elements-before`: Elements that will be projected before the chart's scaled div
|
|
21
|
-
* and scaled svg element in the DOM. USeful for adding elements that require access to chart scales.
|
|
22
|
-
*
|
|
23
|
-
* `svg-defs`: Used to create any required defs for the chart's svg element. For example, patterns or gradients.
|
|
24
|
-
*
|
|
25
|
-
* `svg-elements`: Used for all elements that should be children of the chart's scaled svg element.
|
|
26
|
-
*
|
|
27
|
-
* `html-elements-after`: Elements that will be projected after the chart's scaled div
|
|
28
|
-
* and scaled svg element in the DOM. USeful for adding elements that require access to chart scales.
|
|
29
|
-
*/
|
|
30
|
-
@Component({
|
|
31
|
-
selector: 'vic-map-chart',
|
|
32
|
-
templateUrl: '../chart/chart.component.html',
|
|
33
|
-
styleUrls: ['../chart/chart.component.scss'],
|
|
34
|
-
providers: [{ provide: CHART, useExisting: ChartComponent }],
|
|
35
|
-
host: {
|
|
36
|
-
class: 'vic-map-chart',
|
|
37
|
-
},
|
|
38
|
-
imports: [CommonModule],
|
|
39
|
-
})
|
|
40
|
-
export class MapChartComponent<Datum> extends ChartComponent implements Chart {
|
|
41
|
-
private attributeProperties: BehaviorSubject<{
|
|
42
|
-
config: VicAttributeDataDimensionConfig<Datum>;
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
-
scale: any;
|
|
45
|
-
}> = new BehaviorSubject({ config: undefined, scale: undefined });
|
|
46
|
-
attributeProperties$ = this.attributeProperties.asObservable();
|
|
47
|
-
protected zone = inject(NgZone);
|
|
48
|
-
|
|
49
|
-
updateAttributeProperties(properties: {
|
|
50
|
-
config: VicAttributeDataDimensionConfig<Datum>;
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
-
scale: any;
|
|
53
|
-
}): void {
|
|
54
|
-
this.zone.run(() => {
|
|
55
|
-
this.attributeProperties.next({
|
|
56
|
-
config: properties.config,
|
|
57
|
-
scale: properties.scale,
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
-
import { XyChartComponent } from './xy-chart.component';
|
|
4
|
-
|
|
5
|
-
describe('XyChartComponent', () => {
|
|
6
|
-
let component: XyChartComponent;
|
|
7
|
-
let fixture: ComponentFixture<XyChartComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
imports: [XyChartComponent],
|
|
12
|
-
}).compileComponents();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
fixture = TestBed.createComponent(XyChartComponent);
|
|
17
|
-
component = fixture.componentInstance;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('updateScales', () => {
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
(component as any).scales.next({ x: 1, y: 2, categorical: 3 } as any);
|
|
23
|
-
});
|
|
24
|
-
it('calls next on scales', () => {
|
|
25
|
-
spyOn((component as any).scales, 'next');
|
|
26
|
-
component.updateScales({ x: 4 } as any);
|
|
27
|
-
expect((component as any).scales.next).toHaveBeenCalledOnceWith({
|
|
28
|
-
x: 4,
|
|
29
|
-
y: 2,
|
|
30
|
-
categorical: 3,
|
|
31
|
-
} as any);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import {
|
|
4
|
-
ChangeDetectionStrategy,
|
|
5
|
-
Component,
|
|
6
|
-
inject,
|
|
7
|
-
NgZone,
|
|
8
|
-
OnInit,
|
|
9
|
-
} from '@angular/core';
|
|
10
|
-
import { BehaviorSubject, filter } from 'rxjs';
|
|
11
|
-
import { GenericScale } from '../../core';
|
|
12
|
-
import { Chart } from '../chart/chart';
|
|
13
|
-
import { ChartComponent } from '../chart/chart.component';
|
|
14
|
-
import { CHART } from '../chart/chart.token';
|
|
15
|
-
|
|
16
|
-
export enum XyContentScale {
|
|
17
|
-
x = 'x',
|
|
18
|
-
y = 'y',
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface XyChartScales {
|
|
22
|
-
[XyContentScale.x]: GenericScale<any, any>;
|
|
23
|
-
[XyContentScale.y]: GenericScale<any, any>;
|
|
24
|
-
useTransition: boolean;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* A `Chart` component to be used with `PrimaryMarks` components that have X and Y axes, such as `Bars` and `Lines`.
|
|
28
|
-
*
|
|
29
|
-
* This component adds x, y, and categorical scales to the base `ChartComponent` that can
|
|
30
|
-
* be used by any components projected into the chart.
|
|
31
|
-
*
|
|
32
|
-
* <p class="comment-slots">Content projection slots</p>
|
|
33
|
-
*
|
|
34
|
-
* `html-elements-before`: Elements that will be projected before the chart's scaled div
|
|
35
|
-
* and scaled svg element in the DOM. USeful for adding elements that require access to chart scales.
|
|
36
|
-
*
|
|
37
|
-
* `svg-defs`: Used to create any required defs for the chart's svg element. For example, patterns or gradients.
|
|
38
|
-
*
|
|
39
|
-
* `svg-elements`: Used for all elements that should be children of the chart's scaled svg element.
|
|
40
|
-
*
|
|
41
|
-
* `html-elements-after`: Elements that will be projected after the chart's scaled div
|
|
42
|
-
* and scaled svg element in the DOM. USeful for adding elements that require access to chart scales.
|
|
43
|
-
*/
|
|
44
|
-
@Component({
|
|
45
|
-
selector: 'vic-xy-chart',
|
|
46
|
-
templateUrl: '../chart/chart.component.html',
|
|
47
|
-
styleUrls: ['../chart/chart.component.scss'],
|
|
48
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
49
|
-
providers: [{ provide: CHART, useExisting: ChartComponent }],
|
|
50
|
-
host: {
|
|
51
|
-
class: 'vic-xy-chart',
|
|
52
|
-
},
|
|
53
|
-
imports: [CommonModule],
|
|
54
|
-
})
|
|
55
|
-
export class XyChartComponent extends ChartComponent implements Chart, OnInit {
|
|
56
|
-
private scales: BehaviorSubject<XyChartScales> = new BehaviorSubject(null);
|
|
57
|
-
scales$ = this.scales.asObservable().pipe(filter((scales) => !!scales));
|
|
58
|
-
protected zone = inject(NgZone);
|
|
59
|
-
|
|
60
|
-
updateScales(scales: Partial<XyChartScales>): void {
|
|
61
|
-
this.zone.run(() => {
|
|
62
|
-
this.scales.next({ ...this.scales.value, ...scales });
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
-
export type Constructor<T = object> = new (...args: any[]) => T;
|
|
3
|
-
|
|
4
|
-
export type AbstractConstructor<T = object> = abstract new (
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
...args: any[]
|
|
7
|
-
) => T;
|
package/src/lib/core/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './common-behaviors/constructor';
|
|
2
|
-
export * from './pipes/resize-chart-height.pipe';
|
|
3
|
-
export * from './types/layout';
|
|
4
|
-
export * from './types/scale';
|
|
5
|
-
export * from './types/utility';
|
|
6
|
-
export * from './types/values';
|
|
7
|
-
export * from './utilities/colors';
|
|
8
|
-
export * from './utilities/fill-utilities';
|
|
9
|
-
export * from './utilities/type-guards';
|
|
10
|
-
export * from './utilities/value-format';
|
|
11
|
-
export * from './utilities/values';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ResizeChartHeightPipe } from './resize-chart-height.pipe';
|
|
2
|
-
|
|
3
|
-
describe('ResizeChartHeightPipe', () => {
|
|
4
|
-
let pipe: ResizeChartHeightPipe;
|
|
5
|
-
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
pipe = new ResizeChartHeightPipe();
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('returns divWidth if divWidth is not a number', () => {
|
|
11
|
-
expect(pipe.transform('divWidth', 100, 100)).toBe('divWidth');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('returns the correct value if divWidth is less than maxWidth', () => {
|
|
15
|
-
const result = pipe.transform(100, 300, 200);
|
|
16
|
-
expect(result).toEqual(150);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('returns maxHeight if divWidth is greater than or equal to maxWidth', () => {
|
|
20
|
-
const result = pipe.transform(400, 300, 200);
|
|
21
|
-
expect(result).toEqual(300);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* @internal
|
|
4
|
-
*/
|
|
5
|
-
@Pipe({
|
|
6
|
-
name: 'resizeChartHeight',
|
|
7
|
-
})
|
|
8
|
-
export class ResizeChartHeightPipe implements PipeTransform {
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
-
transform(divWidth: any, maxHeight: number, maxWidth: number): any {
|
|
11
|
-
if (typeof divWidth !== 'number') {
|
|
12
|
-
return divWidth;
|
|
13
|
-
} else if (divWidth < maxWidth) {
|
|
14
|
-
const aspectRatio = maxWidth / maxHeight;
|
|
15
|
-
return divWidth / aspectRatio;
|
|
16
|
-
} else {
|
|
17
|
-
return maxHeight;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export enum Orientation {
|
|
2
|
-
horizontal = 'horizontal',
|
|
3
|
-
vertical = 'vertical',
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export enum Side {
|
|
7
|
-
top = 'top',
|
|
8
|
-
right = 'right',
|
|
9
|
-
bottom = 'bottom',
|
|
10
|
-
left = 'left',
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ElementSpacing {
|
|
14
|
-
top: number;
|
|
15
|
-
right: number;
|
|
16
|
-
bottom: number;
|
|
17
|
-
left: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface Dimensions {
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface Position {
|
|
26
|
-
x: number;
|
|
27
|
-
y: number;
|
|
28
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
-
export type ToArray<T> = T extends any[] ? T : T[];
|
|
3
|
-
|
|
4
|
-
// https://stackoverflow.com/questions/49242232/constraining-type-in-typescript-generic-to-be-one-of-several-types
|
|
5
|
-
export type OneOf<
|
|
6
|
-
T,
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
V extends any[],
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
-
NK extends keyof V = Exclude<keyof V, keyof any[]>,
|
|
11
|
-
> = { [K in NK]: T extends V[K] ? V[K] : never }[NK];
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { ColorUtilities } from './colors';
|
|
2
|
-
|
|
3
|
-
describe('getContrastRatio', () => {
|
|
4
|
-
// https://webaim.org/resources/contrastchecker/
|
|
5
|
-
it('returns the same value as WebAIM checker given value - default WebAIM values', () => {
|
|
6
|
-
expect(
|
|
7
|
-
Math.floor(ColorUtilities.getContrastRatio('#0000FF', '#FFFFFF') * 100) /
|
|
8
|
-
100
|
|
9
|
-
).toEqual(8.59);
|
|
10
|
-
});
|
|
11
|
-
it('returns the same value as WebAIM checker given value - green and red', () => {
|
|
12
|
-
expect(
|
|
13
|
-
Math.floor(ColorUtilities.getContrastRatio('#04FA00', '#FF0036') * 100) /
|
|
14
|
-
100
|
|
15
|
-
).toEqual(2.76);
|
|
16
|
-
});
|
|
17
|
-
it('works with rgb values', () => {
|
|
18
|
-
expect(
|
|
19
|
-
Math.floor(
|
|
20
|
-
ColorUtilities.getContrastRatio(
|
|
21
|
-
'rgb(0, 0, 255)',
|
|
22
|
-
'rgb(255, 255, 255)'
|
|
23
|
-
) * 100
|
|
24
|
-
) / 100
|
|
25
|
-
).toEqual(8.59);
|
|
26
|
-
});
|
|
27
|
-
it('works with named colors', () => {
|
|
28
|
-
expect(
|
|
29
|
-
Math.floor(ColorUtilities.getContrastRatio('blue', 'white') * 100) / 100
|
|
30
|
-
).toEqual(8.59);
|
|
31
|
-
});
|
|
32
|
-
it('works with hsl values', () => {
|
|
33
|
-
expect(
|
|
34
|
-
Math.floor(
|
|
35
|
-
ColorUtilities.getContrastRatio(
|
|
36
|
-
'hsl(240, 100%, 50%)',
|
|
37
|
-
'hsl(0, 0%, 100%)'
|
|
38
|
-
) * 100
|
|
39
|
-
) / 100
|
|
40
|
-
).toEqual(8.59);
|
|
41
|
-
});
|
|
42
|
-
it('works with mixed values - one named color and one hex', () => {
|
|
43
|
-
expect(
|
|
44
|
-
Math.floor(ColorUtilities.getContrastRatio('blue', '#FFFFFF') * 100) / 100
|
|
45
|
-
).toEqual(8.59);
|
|
46
|
-
});
|
|
47
|
-
it('works with mixed values - one hsl color and one rgb', () => {
|
|
48
|
-
expect(
|
|
49
|
-
Math.floor(
|
|
50
|
-
ColorUtilities.getContrastRatio(
|
|
51
|
-
'hsl(240, 100%, 50%)',
|
|
52
|
-
'rgb(255, 255, 255)'
|
|
53
|
-
) * 100
|
|
54
|
-
) / 100
|
|
55
|
-
).toEqual(8.59);
|
|
56
|
-
});
|
|
57
|
-
});
|