@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,21 +0,0 @@
|
|
|
1
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
2
|
-
import { TickWrapOptions } from './tick-wrap-options';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A config that specifies how axis tick labels should wrap.
|
|
6
|
-
*/
|
|
7
|
-
export class TickWrap {
|
|
8
|
-
maintainXPosition: boolean;
|
|
9
|
-
maintainYPosition: boolean;
|
|
10
|
-
lineHeight: number;
|
|
11
|
-
breakOnChars: string[];
|
|
12
|
-
spaceAroundBreakChars: boolean;
|
|
13
|
-
width:
|
|
14
|
-
| 'bandwidth'
|
|
15
|
-
| number
|
|
16
|
-
| ((chartWidth: number, numOfTicks: number) => number);
|
|
17
|
-
|
|
18
|
-
constructor(options: TickWrapOptions) {
|
|
19
|
-
safeAssign(this, options);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
2
|
-
import { AxisTimeInterval } from 'd3';
|
|
3
|
-
import { TickWrapBuilder } from './tick-wrap/tick-wrap-builder';
|
|
4
|
-
import { QuantitativeTicks, Ticks } from './ticks';
|
|
5
|
-
|
|
6
|
-
export interface AxisSpecificTickBuilderOptions {
|
|
7
|
-
_sizeOuter: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface AxisSpecificQuantitativeTickBuilderOptions<
|
|
11
|
-
Tick,
|
|
12
|
-
> extends AxisSpecificTickBuilderOptions {
|
|
13
|
-
_format: string | ((value: Tick) => string);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const DEFAULT = {
|
|
17
|
-
_class: () => '',
|
|
18
|
-
_labelsDisplay: true,
|
|
19
|
-
_marksDisplay: true,
|
|
20
|
-
_remove: false,
|
|
21
|
-
_stroke: 'none',
|
|
22
|
-
_strokeOpacity: 1,
|
|
23
|
-
_strokeWidth: 3,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const QUANT_DEFAULT = {
|
|
27
|
-
_spacing: 40,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export class TicksBuilder<Tick> {
|
|
31
|
-
protected _class: (d: Tick) => string;
|
|
32
|
-
protected _fontSize: number;
|
|
33
|
-
protected _format: string | ((value: Tick) => string);
|
|
34
|
-
protected _labelsDisplay: boolean;
|
|
35
|
-
protected _rotate: number;
|
|
36
|
-
protected _labelsStroke: string;
|
|
37
|
-
protected _labelsStrokeOpacity: number;
|
|
38
|
-
protected _labelsStrokeWidth: number;
|
|
39
|
-
protected _marksDisplay: boolean;
|
|
40
|
-
protected _size: number;
|
|
41
|
-
protected _sizeInner: number;
|
|
42
|
-
protected _sizeOuter: number;
|
|
43
|
-
protected wrapBuilder: TickWrapBuilder;
|
|
44
|
-
|
|
45
|
-
constructor(options: Partial<AxisSpecificTickBuilderOptions>) {
|
|
46
|
-
safeAssign(this, DEFAULT);
|
|
47
|
-
safeAssign(this, options);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* OPTIONAL. Provides a class on the SVG G element that corresponds to a single tick.
|
|
52
|
-
*
|
|
53
|
-
* Note that if the resultant string has spaces in the name, multiple classes will be applied. For example, if the class is 'North Carolina', the element will have the classes 'North' and 'Carolina'.
|
|
54
|
-
*/
|
|
55
|
-
class(value: null): this;
|
|
56
|
-
class(value: string): this;
|
|
57
|
-
class(value: (d: Tick) => string): this;
|
|
58
|
-
class(value: ((d: Tick) => string) | string | null): this {
|
|
59
|
-
if (value === null) {
|
|
60
|
-
this._class = DEFAULT._class;
|
|
61
|
-
return this;
|
|
62
|
-
}
|
|
63
|
-
if (typeof value === 'string') {
|
|
64
|
-
this._class = () => value;
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
|
-
this._class = value;
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* OPTIONAL. Sets the font size of the tick labels.
|
|
73
|
-
*
|
|
74
|
-
* @param value - The font size of the tick labels, in px.
|
|
75
|
-
*
|
|
76
|
-
* If not called, the default font size is D3's default, which is 10px.
|
|
77
|
-
*/
|
|
78
|
-
fontSize(value: number | null): this {
|
|
79
|
-
if (value === null) {
|
|
80
|
-
this._fontSize = undefined;
|
|
81
|
-
return this;
|
|
82
|
-
}
|
|
83
|
-
this._fontSize = value;
|
|
84
|
-
return this;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* OPTIONAL. Specifies how tick labels will be formatted. The format can be a string or a function.
|
|
89
|
-
*
|
|
90
|
-
* @param value - Either a D3 format string, a function that takes a value and returns a string, or `null` to unset the format.
|
|
91
|
-
*
|
|
92
|
-
* If not called, the default value for quantitative axes is ',.1f'. If not called for an ordinal axis, tick labels will be the unformatted ordinal value.
|
|
93
|
-
*/
|
|
94
|
-
format(format: string): this;
|
|
95
|
-
format(format: (value: Tick) => string): this;
|
|
96
|
-
format(format: null): this;
|
|
97
|
-
format(format: string | ((value: Tick) => string) | null): this {
|
|
98
|
-
if (format === null) {
|
|
99
|
-
this._format = undefined;
|
|
100
|
-
return this;
|
|
101
|
-
}
|
|
102
|
-
this._format = format;
|
|
103
|
-
return this;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* OPTIONAL. If false, tick labels will be removed.
|
|
108
|
-
*
|
|
109
|
-
* @param value - `true` to retain all tick labels, `false` to remove all tick labels.
|
|
110
|
-
*
|
|
111
|
-
* If not called, the default value is `true`.
|
|
112
|
-
*/
|
|
113
|
-
labelsDisplay(value: boolean): this {
|
|
114
|
-
this._labelsDisplay = value;
|
|
115
|
-
return this;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* OPTIONAL. Sets the color of the stroke around the tick labels. Often used to improve the legibility of tick labels, for example, on dark backgrounds.
|
|
120
|
-
*
|
|
121
|
-
* @param value - The stroke of the tick labels.
|
|
122
|
-
*
|
|
123
|
-
* If not called, the default value is 'none'.
|
|
124
|
-
*/
|
|
125
|
-
labelsStroke(value: string | null): this {
|
|
126
|
-
if (value === null) {
|
|
127
|
-
this._labelsStroke = DEFAULT._stroke;
|
|
128
|
-
return this;
|
|
129
|
-
}
|
|
130
|
-
this._labelsStroke = value;
|
|
131
|
-
return this;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* OPTIONAL. Sets the opacity of the stroke applied around the tick labels.
|
|
136
|
-
*
|
|
137
|
-
* @param value - The opacity of the stroke around the tick labels.
|
|
138
|
-
*
|
|
139
|
-
* If not called, the default value is 1.
|
|
140
|
-
*/
|
|
141
|
-
labelsStrokeOpacity(value: number | null): this {
|
|
142
|
-
if (value === null) {
|
|
143
|
-
this._labelsStrokeOpacity = undefined;
|
|
144
|
-
return this;
|
|
145
|
-
}
|
|
146
|
-
this._labelsStrokeOpacity = value;
|
|
147
|
-
return this;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* OPTIONAL. Sets the width of the stroke around the tick labels. Often used to improve the legibility of tick labels, for example, on dark backgrounds.
|
|
152
|
-
*
|
|
153
|
-
* @param value - The width of the stroke around the tick labels.
|
|
154
|
-
*
|
|
155
|
-
* If not called, the default value is 3.
|
|
156
|
-
*/
|
|
157
|
-
labelsStrokeWidth(value: number | null): this {
|
|
158
|
-
if (value === null) {
|
|
159
|
-
this._labelsStrokeWidth = undefined;
|
|
160
|
-
return this;
|
|
161
|
-
}
|
|
162
|
-
this._labelsStrokeWidth = value;
|
|
163
|
-
return this;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* OPTIONAL. If false, tick marks (lines) will be removed.
|
|
168
|
-
*
|
|
169
|
-
* @param value - `true` to retain all tick marks, `false` to remove all tick marks.
|
|
170
|
-
*
|
|
171
|
-
* If not called, the default value is `true`.
|
|
172
|
-
*/
|
|
173
|
-
marksDisplay(value: boolean): this {
|
|
174
|
-
this._marksDisplay = value;
|
|
175
|
-
return this;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* OPTIONAL. Determines the rotation of tick labels.
|
|
180
|
-
*
|
|
181
|
-
* @param value - The rotation of the tick labels in degrees, or `null` to unset the rotation.
|
|
182
|
-
*
|
|
183
|
-
* Positive values rotate clockwise, negative values rotate counterclockwise.
|
|
184
|
-
*
|
|
185
|
-
* If not called, ticks will not be rotated.
|
|
186
|
-
*/
|
|
187
|
-
|
|
188
|
-
rotate(value: number | null): this {
|
|
189
|
-
if (value === null) {
|
|
190
|
-
this._rotate = undefined;
|
|
191
|
-
return this;
|
|
192
|
-
}
|
|
193
|
-
this._rotate = value;
|
|
194
|
-
return this;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* OPTIONAL. Sets the size of inner and outer tick marks.
|
|
199
|
-
*
|
|
200
|
-
* @param value - The size of the ticks, in px.
|
|
201
|
-
*
|
|
202
|
-
* If not called or called with `null`, the default size is the D3 default size.
|
|
203
|
-
*
|
|
204
|
-
* If specified, this value will override any values set by `sizeInner` or `sizeOuter`.
|
|
205
|
-
*/
|
|
206
|
-
size(value: number | null): this {
|
|
207
|
-
if (value === null) {
|
|
208
|
-
this._size = undefined;
|
|
209
|
-
return this;
|
|
210
|
-
}
|
|
211
|
-
this._size = value;
|
|
212
|
-
return this;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* OPTIONAL. Determines the length of the inner ticks drawn by D3. Does not apply to the outermost ticks.
|
|
217
|
-
*
|
|
218
|
-
* @param value - The length of the inner ticks in pixels, or `null` to unset the value.
|
|
219
|
-
*
|
|
220
|
-
* If not called or called with `null`, the default value is the D3 default size.
|
|
221
|
-
*
|
|
222
|
-
*/
|
|
223
|
-
sizeInner(value: number | null): this {
|
|
224
|
-
if (value === null) {
|
|
225
|
-
this._sizeInner = undefined;
|
|
226
|
-
return this;
|
|
227
|
-
}
|
|
228
|
-
this._sizeInner = value;
|
|
229
|
-
return this;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* OPTIONAL. Determines the length of the square ends of the domain path drawn by D3.
|
|
234
|
-
*
|
|
235
|
-
* @param value - The length of the square ends of the domain path in pixels, or `null` to unset the value.
|
|
236
|
-
*
|
|
237
|
-
* If not called on ordinal axes, the default value is 0. If not called on quantitative axes, no modification is made to D3's default value.
|
|
238
|
-
*/
|
|
239
|
-
sizeOuter(value: number | null): this {
|
|
240
|
-
if (value === null) {
|
|
241
|
-
this._sizeOuter = undefined;
|
|
242
|
-
return this;
|
|
243
|
-
}
|
|
244
|
-
this._sizeOuter = value;
|
|
245
|
-
return this;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* OPTIONAL. Specifies how tick labels will be wrapped.
|
|
250
|
-
*
|
|
251
|
-
* @param wrap - A callback that specifies how tick labels will be wrapped, or `null` to unset the wrapping.
|
|
252
|
-
*
|
|
253
|
-
* If not called, the tick labels will not be wrapped.
|
|
254
|
-
*/
|
|
255
|
-
wrap(wrap: (wrap: TickWrapBuilder) => void): this;
|
|
256
|
-
wrap(wrap: null): this;
|
|
257
|
-
wrap(wrap: (wrap: TickWrapBuilder) => void | null): this {
|
|
258
|
-
if (wrap === null) {
|
|
259
|
-
this.wrapBuilder = undefined;
|
|
260
|
-
return this;
|
|
261
|
-
}
|
|
262
|
-
this.wrapBuilder = new TickWrapBuilder();
|
|
263
|
-
wrap(this.wrapBuilder);
|
|
264
|
-
return this;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
_build(dimension: 'x' | 'y'): Ticks<Tick> {
|
|
268
|
-
return new Ticks({
|
|
269
|
-
class: this._class,
|
|
270
|
-
fontSize: this._fontSize,
|
|
271
|
-
format: this._format,
|
|
272
|
-
labelsDisplay: this._labelsDisplay,
|
|
273
|
-
labelsStroke: this._labelsStroke,
|
|
274
|
-
labelsStrokeOpacity: this._labelsStrokeOpacity,
|
|
275
|
-
labelsStrokeWidth: this._labelsStrokeWidth,
|
|
276
|
-
marksDisplay: this._marksDisplay,
|
|
277
|
-
rotate: this._rotate,
|
|
278
|
-
size: this._size,
|
|
279
|
-
sizeInner: this._sizeInner,
|
|
280
|
-
sizeOuter: this._sizeOuter,
|
|
281
|
-
wrap: this.wrapBuilder?._build(dimension),
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
export class QuantitativeTicksBuilder<Tick> extends TicksBuilder<Tick> {
|
|
287
|
-
private _count: number | AxisTimeInterval;
|
|
288
|
-
private _spacing: number;
|
|
289
|
-
private _values: Tick[];
|
|
290
|
-
|
|
291
|
-
constructor(
|
|
292
|
-
options: Partial<AxisSpecificQuantitativeTickBuilderOptions<Tick>>
|
|
293
|
-
) {
|
|
294
|
-
super(options);
|
|
295
|
-
safeAssign(this, DEFAULT);
|
|
296
|
-
safeAssign(this, QUANT_DEFAULT);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* OPTIONAL. Approximately specifies the number of ticks for the axis.
|
|
301
|
-
*
|
|
302
|
-
* @param value - The number of ticks to pass to D3's axis.ticks(), or null to unset the number of ticks.
|
|
303
|
-
*
|
|
304
|
-
* If not called, a reasonable and valid default will be used based on the size of the chart.
|
|
305
|
-
*
|
|
306
|
-
* Note that this number will be passed to D3's `ticks()` method and therefore it can be an approximate number of ticks.
|
|
307
|
-
*
|
|
308
|
-
* If this method is called, the passed in number of ticks will be validated against the data domain and the value formatter for the axis. If the number of ticks is not valid—for example, if the ticks are formatted with %Y and there are three years of values in the data, and this method is called with 10, a valid number will be used instead.
|
|
309
|
-
*/
|
|
310
|
-
count(value: number | AxisTimeInterval | null): this {
|
|
311
|
-
if (value === null) {
|
|
312
|
-
this._count = undefined;
|
|
313
|
-
return this;
|
|
314
|
-
}
|
|
315
|
-
this._count = value;
|
|
316
|
-
return this;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* OPTIONAL. Specifies the an approximate spacing between ticks, in pixels.
|
|
321
|
-
*
|
|
322
|
-
* @param value - The spacing between ticks in pixels, or null to unset the spacing.
|
|
323
|
-
*
|
|
324
|
-
* If not called, the default value is 40. If `count` is set, this value will be ignored.
|
|
325
|
-
*/
|
|
326
|
-
spacing(value: number | null): this {
|
|
327
|
-
if (value === null) {
|
|
328
|
-
this._spacing = undefined;
|
|
329
|
-
return this;
|
|
330
|
-
}
|
|
331
|
-
this._spacing = value;
|
|
332
|
-
return this;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* OPTIONAL. Determines the values that will show up as ticks on the axis.
|
|
337
|
-
*
|
|
338
|
-
* @param values - An array of quantitative values to pass to D3's axis.tickValues(), or null to unset the tick values.
|
|
339
|
-
*
|
|
340
|
-
*/
|
|
341
|
-
values(values: Tick[] | null): this {
|
|
342
|
-
if (values === null) {
|
|
343
|
-
this._values = undefined;
|
|
344
|
-
return this;
|
|
345
|
-
}
|
|
346
|
-
this._values = values;
|
|
347
|
-
return this;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
override _build(dimension: 'x' | 'y'): QuantitativeTicks<Tick> {
|
|
351
|
-
return new QuantitativeTicks({
|
|
352
|
-
class: this._class,
|
|
353
|
-
count: this._count,
|
|
354
|
-
fontSize: this._fontSize,
|
|
355
|
-
format: this._format,
|
|
356
|
-
labelsDisplay: this._labelsDisplay,
|
|
357
|
-
labelsStroke: this._labelsStroke,
|
|
358
|
-
labelsStrokeOpacity: this._labelsStrokeOpacity,
|
|
359
|
-
labelsStrokeWidth: this._labelsStrokeWidth,
|
|
360
|
-
marksDisplay: this._marksDisplay,
|
|
361
|
-
rotate: this._rotate,
|
|
362
|
-
size: this._size,
|
|
363
|
-
sizeInner: this._sizeInner,
|
|
364
|
-
sizeOuter: this._sizeOuter,
|
|
365
|
-
spacing: this._spacing,
|
|
366
|
-
values: this._values,
|
|
367
|
-
wrap: this.wrapBuilder?._build(dimension),
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AxisTimeInterval } from 'd3';
|
|
2
|
-
import { TickWrap } from './tick-wrap/tick-wrap';
|
|
3
|
-
|
|
4
|
-
export interface TicksOptions<Tick> {
|
|
5
|
-
class: (d: Tick) => string;
|
|
6
|
-
fontSize: number;
|
|
7
|
-
format: string | ((value: Tick) => string);
|
|
8
|
-
labelsDisplay: boolean;
|
|
9
|
-
labelsStroke: string;
|
|
10
|
-
labelsStrokeOpacity: number;
|
|
11
|
-
labelsStrokeWidth: number;
|
|
12
|
-
marksDisplay: boolean;
|
|
13
|
-
rotate: number;
|
|
14
|
-
size: number;
|
|
15
|
-
sizeInner: number;
|
|
16
|
-
sizeOuter: number;
|
|
17
|
-
wrap: TickWrap;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface QuantitativeTicksOptions<Tick> extends TicksOptions<Tick> {
|
|
21
|
-
count: number | AxisTimeInterval;
|
|
22
|
-
spacing: number;
|
|
23
|
-
values: Tick[];
|
|
24
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
2
|
-
import { TickWrap } from './tick-wrap/tick-wrap';
|
|
3
|
-
import { QuantitativeTicksOptions, TicksOptions } from './ticks-options';
|
|
4
|
-
|
|
5
|
-
export class Ticks<Tick> implements TicksOptions<Tick> {
|
|
6
|
-
class: (d: Tick) => string;
|
|
7
|
-
fontSize: number;
|
|
8
|
-
format: string | ((value: Tick) => string);
|
|
9
|
-
labelsDisplay: boolean;
|
|
10
|
-
labelsStroke: string;
|
|
11
|
-
labelsStrokeOpacity: number;
|
|
12
|
-
labelsStrokeWidth: number;
|
|
13
|
-
marksDisplay: boolean;
|
|
14
|
-
rotate: number;
|
|
15
|
-
size: number;
|
|
16
|
-
sizeInner: number;
|
|
17
|
-
sizeOuter: number;
|
|
18
|
-
wrap: TickWrap;
|
|
19
|
-
|
|
20
|
-
constructor(options: TicksOptions<Tick>) {
|
|
21
|
-
safeAssign(this, options);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class QuantitativeTicks<Tick> extends Ticks<Tick> {
|
|
26
|
-
count: number;
|
|
27
|
-
spacing: number;
|
|
28
|
-
values: Tick[];
|
|
29
|
-
|
|
30
|
-
constructor(options: QuantitativeTicksOptions<Tick>) {
|
|
31
|
-
super(options);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
2
|
-
import { DataValue } from '../../core';
|
|
3
|
-
import { AbstractConstructor } from '../../core/common-behaviors/constructor';
|
|
4
|
-
import { XyAxisConfig } from '../base/config/xy-axis-config';
|
|
5
|
-
import { XyAxisBaseOptions } from '../base/config/xy-axis-options';
|
|
6
|
-
import { Ticks } from '../ticks/ticks';
|
|
7
|
-
|
|
8
|
-
export interface XAxisOptions extends XyAxisBaseOptions {
|
|
9
|
-
/**
|
|
10
|
-
* The side of the chart on which the axis will be placed.
|
|
11
|
-
*/
|
|
12
|
-
side: 'top' | 'bottom';
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function mixinXAxisConfig<
|
|
16
|
-
Tick extends DataValue,
|
|
17
|
-
TicksConfig extends Ticks<Tick>,
|
|
18
|
-
T extends AbstractConstructor<XyAxisConfig<Tick, TicksConfig>>,
|
|
19
|
-
>(Base: T) {
|
|
20
|
-
abstract class Mixin extends Base {
|
|
21
|
-
side: 'top' | 'bottom';
|
|
22
|
-
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
-
constructor(...args: any[]) {
|
|
25
|
-
super(...args);
|
|
26
|
-
if (args.length > 0) {
|
|
27
|
-
safeAssign(this, args[0]);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getNumTicksBySpacing(
|
|
32
|
-
spacing: number,
|
|
33
|
-
dimensions: {
|
|
34
|
-
height: number;
|
|
35
|
-
width: number;
|
|
36
|
-
}
|
|
37
|
-
): number {
|
|
38
|
-
const d3SuggestedDefault = dimensions.width / spacing;
|
|
39
|
-
return this.getValidatedNumTicks(d3SuggestedDefault);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return Mixin;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export class XAxisConfig<
|
|
46
|
-
Tick extends DataValue,
|
|
47
|
-
TicksConfig extends Ticks<Tick>,
|
|
48
|
-
> extends mixinXAxisConfig(XyAxisConfig)<Tick, TicksConfig> {}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { ElementRef } from '@angular/core';
|
|
3
|
-
import { TestBed } from '@angular/core/testing';
|
|
4
|
-
import { XyChartComponent } from '@mathstack/viz';
|
|
5
|
-
import { axisBottom, axisTop } from 'd3';
|
|
6
|
-
import { XAxisStub } from '../../testing/stubs/x-axis.stub';
|
|
7
|
-
import { VicXQuantitativeAxisConfigBuilder } from '../x-quantitative/x-quantitative-axis-builder';
|
|
8
|
-
|
|
9
|
-
describe('the XAxis mixin', () => {
|
|
10
|
-
let abstractClass: XAxisStub<number>;
|
|
11
|
-
const mockElementRef = {
|
|
12
|
-
nativeElement: {
|
|
13
|
-
querySelector: jasmine.createSpy('querySelector'),
|
|
14
|
-
style: {},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
beforeEach(() => {
|
|
19
|
-
TestBed.configureTestingModule({
|
|
20
|
-
providers: [
|
|
21
|
-
XAxisStub,
|
|
22
|
-
XyChartComponent,
|
|
23
|
-
{ provide: ElementRef, useValue: mockElementRef },
|
|
24
|
-
],
|
|
25
|
-
});
|
|
26
|
-
abstractClass = TestBed.inject(XAxisStub);
|
|
27
|
-
abstractClass.scales = {
|
|
28
|
-
y: {
|
|
29
|
-
range: jasmine.createSpy().and.returnValue([100, 20]),
|
|
30
|
-
},
|
|
31
|
-
x: 'scale',
|
|
32
|
-
} as any;
|
|
33
|
-
abstractClass.chart.config = {
|
|
34
|
-
margin: { top: 10 },
|
|
35
|
-
} as any;
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
describe('setTranslate()', () => {
|
|
39
|
-
beforeEach(() => {
|
|
40
|
-
spyOn(abstractClass, 'getTranslateDistance').and.returnValue(90);
|
|
41
|
-
abstractClass.setTranslate();
|
|
42
|
-
});
|
|
43
|
-
it('calls getTranslateDistance once', () => {
|
|
44
|
-
expect(abstractClass.getTranslateDistance).toHaveBeenCalledTimes(1);
|
|
45
|
-
});
|
|
46
|
-
it('returns the correct string', () => {
|
|
47
|
-
expect(abstractClass.translate).toEqual('translate(0, 90)');
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
describe('integration: getTranslateDistance', () => {
|
|
52
|
-
it('returns the correct value for the top side', () => {
|
|
53
|
-
abstractClass.config = new VicXQuantitativeAxisConfigBuilder()
|
|
54
|
-
.side('top')
|
|
55
|
-
.getConfig() as any;
|
|
56
|
-
expect(abstractClass.getTranslateDistance()).toBe(20);
|
|
57
|
-
});
|
|
58
|
-
it('returns the correct value for the bottom side', () => {
|
|
59
|
-
abstractClass.config = new VicXQuantitativeAxisConfigBuilder()
|
|
60
|
-
.side('bottom')
|
|
61
|
-
.getConfig() as any;
|
|
62
|
-
expect(abstractClass.getTranslateDistance()).toBe(100);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe('setScale', () => {
|
|
67
|
-
it('sets scale to the correct value', () => {
|
|
68
|
-
abstractClass.setScale();
|
|
69
|
-
expect(abstractClass.scale).toBe('scale');
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
describe('setAxisFunction', () => {
|
|
74
|
-
it('sets the axis function to the correct value if side is top', () => {
|
|
75
|
-
abstractClass.config = new VicXQuantitativeAxisConfigBuilder()
|
|
76
|
-
.side('top')
|
|
77
|
-
.getConfig() as any;
|
|
78
|
-
abstractClass.setAxisFunction();
|
|
79
|
-
expect(abstractClass.axisFunction).toEqual(axisTop);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('sets the axis function to the correct value if side is bottom', () => {
|
|
83
|
-
abstractClass.config = new VicXQuantitativeAxisConfigBuilder()
|
|
84
|
-
.side('bottom')
|
|
85
|
-
.getConfig() as any;
|
|
86
|
-
abstractClass.setAxisFunction();
|
|
87
|
-
expect(abstractClass.axisFunction).toEqual(axisBottom);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
package/src/lib/axes/x/x-axis.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { axisBottom, axisTop } from 'd3';
|
|
2
|
-
import { AbstractConstructor } from '../../core/common-behaviors/constructor';
|
|
3
|
-
import { ContinuousValue, DataValue } from '../../core/types/values';
|
|
4
|
-
import { XyAxis } from '../base/xy-axis-base';
|
|
5
|
-
import { Ticks } from '../ticks/ticks';
|
|
6
|
-
import { XAxisConfig } from './x-axis-config';
|
|
7
|
-
|
|
8
|
-
export function xAxisMixin<
|
|
9
|
-
Tick extends DataValue | ContinuousValue,
|
|
10
|
-
TicksConfig extends Ticks<Tick>,
|
|
11
|
-
T extends AbstractConstructor<XyAxis<Tick, TicksConfig>>,
|
|
12
|
-
>(Base: T) {
|
|
13
|
-
abstract class Mixin extends Base {
|
|
14
|
-
override config: XAxisConfig<Tick, TicksConfig>;
|
|
15
|
-
translate: string;
|
|
16
|
-
|
|
17
|
-
setTranslate(): void {
|
|
18
|
-
const translate = this.getTranslateDistance();
|
|
19
|
-
this.translate = `translate(0, ${translate})`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getTranslateDistance(): number {
|
|
23
|
-
return this.config.side === 'top'
|
|
24
|
-
? this.getTopTranslate()
|
|
25
|
-
: this.getBottomTranslate();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getTopTranslate(): number {
|
|
29
|
-
return this.scales.y.range()[1];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getBottomTranslate(): number {
|
|
33
|
-
return this.scales.y.range()[0];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getBaselineTranslate(): string | null {
|
|
37
|
-
if (!this.otherAxisHasPosAndNegValues('x')) return null;
|
|
38
|
-
|
|
39
|
-
const rangeIndexForSide = this.config.side === 'top' ? 1 : 0;
|
|
40
|
-
const translateDistance =
|
|
41
|
-
this.scales.y(0) - this.scales.y.range()[rangeIndexForSide];
|
|
42
|
-
return `translate(0, ${translateDistance})`;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
setScale(): void {
|
|
46
|
-
this.scale = this.scales.x;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
setAxisFunction(): void {
|
|
50
|
-
this.axisFunction = this.config.side === 'top' ? axisTop : axisBottom;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
createLabel(): void {
|
|
54
|
-
const config = this.config.label;
|
|
55
|
-
if (!config) return;
|
|
56
|
-
|
|
57
|
-
const spaceFromMarginEdge = 4;
|
|
58
|
-
let x = config.offset.x || 0;
|
|
59
|
-
let y = config.offset.y || 0;
|
|
60
|
-
|
|
61
|
-
y +=
|
|
62
|
-
this.config.side === 'top'
|
|
63
|
-
? this.chart.config.margin.top * -1 + spaceFromMarginEdge
|
|
64
|
-
: this.chart.config.margin.bottom - spaceFromMarginEdge;
|
|
65
|
-
|
|
66
|
-
let anchor: 'start' | 'middle' | 'end';
|
|
67
|
-
const range = this.scales.x.range();
|
|
68
|
-
|
|
69
|
-
if (config.position === 'start') {
|
|
70
|
-
x += range[0];
|
|
71
|
-
anchor = config.anchor || 'start';
|
|
72
|
-
} else if (config.position === 'middle') {
|
|
73
|
-
x += (range[1] - range[0]) / 2 + range[0];
|
|
74
|
-
anchor = config.anchor || 'middle';
|
|
75
|
-
} else {
|
|
76
|
-
x += range[1];
|
|
77
|
-
anchor = config.anchor || 'end';
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
let label = this.axisGroup.select<SVGTextElement>(`.${this.class.label}`);
|
|
81
|
-
const needsInit = label.empty();
|
|
82
|
-
|
|
83
|
-
if (needsInit) {
|
|
84
|
-
label = this.axisGroup
|
|
85
|
-
.append<SVGTextElement>('text')
|
|
86
|
-
.attr('class', this.class.label);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
label
|
|
90
|
-
.text(this.config.label.text)
|
|
91
|
-
.attr('text-anchor', anchor)
|
|
92
|
-
.attr('y', y)
|
|
93
|
-
.style('visibility', config.wrap ? 'hidden' : 'visible');
|
|
94
|
-
|
|
95
|
-
if (config.wrap) {
|
|
96
|
-
requestAnimationFrame(() => {
|
|
97
|
-
this.config.label.wrap.wrap(label);
|
|
98
|
-
label.attr('x', x).style('visibility', 'visible');
|
|
99
|
-
|
|
100
|
-
label.selectAll('tspan').attr('x', x);
|
|
101
|
-
});
|
|
102
|
-
} else {
|
|
103
|
-
label.attr('x', x);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return Mixin;
|
|
109
|
-
}
|