@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,189 +0,0 @@
|
|
|
1
|
-
import { format, utcFormat } from 'd3';
|
|
2
|
-
import { ValueExtent } from '../types/values';
|
|
3
|
-
import { isDate } from './type-guards';
|
|
4
|
-
export type VicFormatSpecifier<Datum> = string | ((x: Datum) => string);
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export class ValueUtilities {
|
|
10
|
-
static getValueRoundedToNSignificantFigures(
|
|
11
|
-
value: number,
|
|
12
|
-
sigFigures: number,
|
|
13
|
-
valueExtent: keyof typeof ValueExtent
|
|
14
|
-
): number {
|
|
15
|
-
// If the value type is VicValueExtent.max, rounds up if value is > 0 and down if value is < 0
|
|
16
|
-
// If the value type is VicValueExtent.min, rounds down if value is > 0 and up if value is < 0
|
|
17
|
-
// ex: 1234 => 1235, -1234 => -1235
|
|
18
|
-
// SigDigits here means the first N non-zero as units holder values
|
|
19
|
-
// ex: 1234, sigFigures = 2, "1" and "2" are "significant"
|
|
20
|
-
// ex: 0.001234, sigFigures = 3, "1", "2", and "3" are "significant"
|
|
21
|
-
this.validateSigFigures(sigFigures);
|
|
22
|
-
let absRoundedValue;
|
|
23
|
-
if (Math.abs(value) < 1) {
|
|
24
|
-
absRoundedValue = this.getRoundedDecimalLessThanOne(
|
|
25
|
-
value,
|
|
26
|
-
sigFigures,
|
|
27
|
-
valueExtent
|
|
28
|
-
);
|
|
29
|
-
} else {
|
|
30
|
-
const absValueStr = Math.abs(value).toString();
|
|
31
|
-
const decimalIndex = absValueStr.indexOf('.');
|
|
32
|
-
let firstNDigits;
|
|
33
|
-
let numZeros = 0;
|
|
34
|
-
if (decimalIndex < sigFigures && decimalIndex > -1) {
|
|
35
|
-
firstNDigits = absValueStr.substring(0, sigFigures + 1);
|
|
36
|
-
} else {
|
|
37
|
-
firstNDigits = absValueStr.substring(0, sigFigures);
|
|
38
|
-
if (decimalIndex > -1) {
|
|
39
|
-
numZeros = decimalIndex - sigFigures;
|
|
40
|
-
} else {
|
|
41
|
-
numZeros = absValueStr.length - sigFigures;
|
|
42
|
-
}
|
|
43
|
-
numZeros = numZeros < 0 ? 0 : numZeros;
|
|
44
|
-
}
|
|
45
|
-
const offset = this.getRoundingOffset(value, valueExtent);
|
|
46
|
-
const lastSigDigit = Number(firstNDigits[firstNDigits.length - 1]);
|
|
47
|
-
// handle cases where the last rounded significant is 9 and the value is rounded up
|
|
48
|
-
if (offset === 1 && lastSigDigit === 9) {
|
|
49
|
-
firstNDigits = this.getNewValueForNine(
|
|
50
|
-
value,
|
|
51
|
-
firstNDigits.split(''),
|
|
52
|
-
absValueStr,
|
|
53
|
-
sigFigures,
|
|
54
|
-
valueExtent
|
|
55
|
-
);
|
|
56
|
-
if (firstNDigits[0] === '0') {
|
|
57
|
-
firstNDigits.unshift('1');
|
|
58
|
-
}
|
|
59
|
-
firstNDigits = firstNDigits.join('');
|
|
60
|
-
} else {
|
|
61
|
-
firstNDigits =
|
|
62
|
-
firstNDigits.substring(0, firstNDigits.length - 1) +
|
|
63
|
-
(lastSigDigit + offset).toString();
|
|
64
|
-
}
|
|
65
|
-
absRoundedValue = Number(firstNDigits + '0'.repeat(numZeros));
|
|
66
|
-
}
|
|
67
|
-
return value >= 0 || absRoundedValue === 0
|
|
68
|
-
? absRoundedValue
|
|
69
|
-
: -absRoundedValue;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private static validateSigFigures(sigFigures: number): void {
|
|
73
|
-
if (sigFigures < 1) {
|
|
74
|
-
throw new Error('sigFigures must be greater than or equal to 1');
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private static getRoundedDecimalLessThanOne(
|
|
79
|
-
value: number,
|
|
80
|
-
sigFigures: number,
|
|
81
|
-
valueExtent: keyof typeof ValueExtent
|
|
82
|
-
): number {
|
|
83
|
-
const valueStr = Math.abs(value).toString();
|
|
84
|
-
let newValue = [];
|
|
85
|
-
let sigDigitsFound = 0;
|
|
86
|
-
for (let i = 0; i < valueStr.length; i++) {
|
|
87
|
-
const char = valueStr[i];
|
|
88
|
-
if (char === '.' || (char === '0' && sigDigitsFound === 0)) {
|
|
89
|
-
newValue.push(char);
|
|
90
|
-
} else {
|
|
91
|
-
++sigDigitsFound;
|
|
92
|
-
if (sigDigitsFound <= sigFigures) {
|
|
93
|
-
let newDigit = '0';
|
|
94
|
-
if (sigDigitsFound === sigFigures || i === valueStr.length - 1) {
|
|
95
|
-
if (char === '9') {
|
|
96
|
-
newValue = this.getNewValueForNine(
|
|
97
|
-
value,
|
|
98
|
-
newValue,
|
|
99
|
-
valueStr,
|
|
100
|
-
i,
|
|
101
|
-
valueExtent
|
|
102
|
-
);
|
|
103
|
-
} else {
|
|
104
|
-
const offset = this.getRoundingOffset(value, valueExtent);
|
|
105
|
-
newDigit = `${Number(char) + offset}`;
|
|
106
|
-
}
|
|
107
|
-
} else if (sigDigitsFound < sigFigures) {
|
|
108
|
-
newDigit = char;
|
|
109
|
-
}
|
|
110
|
-
newValue.push(newDigit);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return parseFloat(newValue.join(''));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
private static getNewValueForNine(
|
|
118
|
-
value: number,
|
|
119
|
-
newValue: string[],
|
|
120
|
-
valueStr: string,
|
|
121
|
-
i: number,
|
|
122
|
-
valueExtent: keyof typeof ValueExtent
|
|
123
|
-
): string[] {
|
|
124
|
-
const prevChar = valueStr[i - 1];
|
|
125
|
-
if (prevChar === '9') {
|
|
126
|
-
newValue[i - 1] = '0';
|
|
127
|
-
newValue = this.getNewValueForNine(
|
|
128
|
-
value,
|
|
129
|
-
newValue,
|
|
130
|
-
valueStr,
|
|
131
|
-
i - 1,
|
|
132
|
-
valueExtent
|
|
133
|
-
);
|
|
134
|
-
} else if (prevChar === '.') {
|
|
135
|
-
newValue = this.getNewValueForNine(
|
|
136
|
-
value,
|
|
137
|
-
newValue,
|
|
138
|
-
valueStr,
|
|
139
|
-
i - 1,
|
|
140
|
-
valueExtent
|
|
141
|
-
);
|
|
142
|
-
} else {
|
|
143
|
-
const offset = this.getRoundingOffset(value, valueExtent);
|
|
144
|
-
newValue[i - 1] = `${Number(prevChar) + offset}`;
|
|
145
|
-
}
|
|
146
|
-
return newValue;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
private static getRoundingOffset(
|
|
150
|
-
value: number,
|
|
151
|
-
valueExtent: keyof typeof ValueExtent
|
|
152
|
-
): number {
|
|
153
|
-
return (value > 0 && valueExtent === ValueExtent.max) ||
|
|
154
|
-
(value < 0 && valueExtent === ValueExtent.min)
|
|
155
|
-
? 1
|
|
156
|
-
: 0;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
static getValueRoundedToInterval(
|
|
160
|
-
value: number,
|
|
161
|
-
interval: number,
|
|
162
|
-
valueExtent: keyof typeof ValueExtent
|
|
163
|
-
): number {
|
|
164
|
-
if (interval === 0) {
|
|
165
|
-
return value;
|
|
166
|
-
}
|
|
167
|
-
const round = valueExtent === ValueExtent.max ? Math.ceil : Math.floor;
|
|
168
|
-
return round(value / interval) * interval;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
static d3Format(value: Date | number, formatter: string): string {
|
|
172
|
-
return formatter
|
|
173
|
-
? isDate(value)
|
|
174
|
-
? utcFormat(formatter)(value)
|
|
175
|
-
: format(formatter)(value)
|
|
176
|
-
: value.toString();
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
static customFormat<Datum>(
|
|
180
|
-
value: Datum,
|
|
181
|
-
formatter: (x: Datum) => string
|
|
182
|
-
): string {
|
|
183
|
-
return formatter ? formatter(value) : value.toString();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
static formatForHtmlAttribute(value: string): string {
|
|
187
|
-
return value.replace(/\s/g, '-');
|
|
188
|
-
}
|
|
189
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
2
|
-
import { ScaleTime, scaleUtc } from 'd3';
|
|
3
|
-
import { DataDimensionBuilder } from '../../dimension-builder';
|
|
4
|
-
import { DateChartPositionDimension } from './date-chart-position';
|
|
5
|
-
|
|
6
|
-
const DEFAULT = {
|
|
7
|
-
_scaleFn: scaleUtc,
|
|
8
|
-
_formatSpecifier: '%Y %m',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export class DateChartPositionDimensionBuilder<
|
|
12
|
-
Datum,
|
|
13
|
-
> extends DataDimensionBuilder<Datum, Date> {
|
|
14
|
-
private _domain: [Date, Date];
|
|
15
|
-
private _formatSpecifier: string;
|
|
16
|
-
private _scaleFn: (
|
|
17
|
-
domain?: Iterable<Date>,
|
|
18
|
-
range?: Iterable<number>
|
|
19
|
-
) => ScaleTime<number, number>;
|
|
20
|
-
|
|
21
|
-
constructor() {
|
|
22
|
-
super();
|
|
23
|
-
safeAssign(this, DEFAULT);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* OPTIONAL. Sets the domain of the scale.
|
|
28
|
-
*
|
|
29
|
-
* If not provided, the domain will be determined by the data.
|
|
30
|
-
*/
|
|
31
|
-
domain(domain: null): this;
|
|
32
|
-
domain(domain: [Date, Date]): this;
|
|
33
|
-
domain(domain: [Date, Date]): this {
|
|
34
|
-
if (domain === null) {
|
|
35
|
-
this._domain = undefined;
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
this._domain = domain;
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* OPTIONAL. Sets a format specifier that will be applied to values from this dimension for display purposes, for example, in a tooltip.
|
|
44
|
-
*
|
|
45
|
-
* This is a string that is passed to D3's timeFormat function.
|
|
46
|
-
*
|
|
47
|
-
* @default '%Y %m'
|
|
48
|
-
*/
|
|
49
|
-
formatSpecifier(formatSpecifier: null): this;
|
|
50
|
-
formatSpecifier(formatSpecifier: string): this;
|
|
51
|
-
formatSpecifier(formatSpecifier: string): this {
|
|
52
|
-
if (formatSpecifier === null) {
|
|
53
|
-
this._formatSpecifier = undefined;
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
this._formatSpecifier = formatSpecifier;
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* OPTIONAL. This is a D3 scale function that maps values from the dimension's domain to the dimension's range.
|
|
62
|
-
*
|
|
63
|
-
* @default d3.scaleUtc
|
|
64
|
-
*/
|
|
65
|
-
scaleFn(scaleFn: null): this;
|
|
66
|
-
scaleFn(
|
|
67
|
-
scaleFn: (
|
|
68
|
-
domain?: Iterable<Date>,
|
|
69
|
-
range?: Iterable<number>
|
|
70
|
-
) => ScaleTime<number, number>
|
|
71
|
-
): this;
|
|
72
|
-
scaleFn(
|
|
73
|
-
scaleFn: (
|
|
74
|
-
domain?: Iterable<Date>,
|
|
75
|
-
range?: Iterable<number>
|
|
76
|
-
) => ScaleTime<number, number>
|
|
77
|
-
): this {
|
|
78
|
-
if (scaleFn === null) {
|
|
79
|
-
this._scaleFn = undefined;
|
|
80
|
-
return this;
|
|
81
|
-
}
|
|
82
|
-
this._scaleFn = scaleFn;
|
|
83
|
-
return this;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @internal This function is for internal use only and should never be called by the user.
|
|
88
|
-
*
|
|
89
|
-
* @param dimensionName A user-intelligible name for the dimension being built. Used for error messages. Should be title cased.
|
|
90
|
-
*/
|
|
91
|
-
_build(dimensionName: string): DateChartPositionDimension<Datum> {
|
|
92
|
-
this.validateBuilder(dimensionName);
|
|
93
|
-
return new DateChartPositionDimension<Datum>({
|
|
94
|
-
domain: this._domain,
|
|
95
|
-
formatFunction: this._formatFunction,
|
|
96
|
-
formatSpecifier: this._formatSpecifier,
|
|
97
|
-
scaleFn: this._scaleFn,
|
|
98
|
-
valueAccessor: this._valueAccessor,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
private validateBuilder(dimensionName): void {
|
|
103
|
-
this.validateValueAccessor(dimensionName);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ScaleTime } from 'd3';
|
|
2
|
-
import { DataDimensionOptions } from '../../dimension-options';
|
|
3
|
-
|
|
4
|
-
export interface DateChartPositionDimensionOptions<
|
|
5
|
-
Datum,
|
|
6
|
-
> extends DataDimensionOptions<Datum, Date> {
|
|
7
|
-
/**
|
|
8
|
-
* An optional, user-provided range of values that is used as the domain of the dimension's scale.
|
|
9
|
-
*
|
|
10
|
-
* If not provided by the user, it remains undefined.
|
|
11
|
-
*/
|
|
12
|
-
domain: [Date, Date];
|
|
13
|
-
/**
|
|
14
|
-
* A format specifier that will be applied to the value of this dimension for display purposes.
|
|
15
|
-
*/
|
|
16
|
-
readonly formatSpecifier: string;
|
|
17
|
-
/**
|
|
18
|
-
* The scale function for the dimension. This is a D3 scale function that maps values from the dimension's domain to the dimension's range.
|
|
19
|
-
*/
|
|
20
|
-
scaleFn: (
|
|
21
|
-
domain?: Iterable<Date>,
|
|
22
|
-
range?: Iterable<number>
|
|
23
|
-
) => ScaleTime<number, number>;
|
|
24
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { DateChartPositionDimension } from './date-chart-position';
|
|
3
|
-
import { DateChartPositionDimensionBuilder } from './date-chart-position-builder';
|
|
4
|
-
|
|
5
|
-
describe('DateChartPositionDimension', () => {
|
|
6
|
-
let dimension: DateChartPositionDimension<Date>;
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
dimension = new DateChartPositionDimensionBuilder<Date>()
|
|
9
|
-
.valueAccessor((d) => d)
|
|
10
|
-
._build('Test');
|
|
11
|
-
});
|
|
12
|
-
describe('setPropertiesFromData', () => {
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
spyOn(dimension as any, 'setValues');
|
|
15
|
-
spyOn(dimension as any, 'setDomain');
|
|
16
|
-
});
|
|
17
|
-
it('calls setValues once', () => {
|
|
18
|
-
dimension.setPropertiesFromData([
|
|
19
|
-
new Date(2000, 2),
|
|
20
|
-
new Date(2001, 2),
|
|
21
|
-
new Date(2002, 2),
|
|
22
|
-
]);
|
|
23
|
-
expect((dimension as any).setValues).toHaveBeenCalledOnceWith([
|
|
24
|
-
new Date(2000, 2),
|
|
25
|
-
new Date(2001, 2),
|
|
26
|
-
new Date(2002, 2),
|
|
27
|
-
]);
|
|
28
|
-
});
|
|
29
|
-
it('calls setDomain once', () => {
|
|
30
|
-
dimension.setPropertiesFromData([new Date(), new Date(), new Date()]);
|
|
31
|
-
expect((dimension as any).setDomain).toHaveBeenCalledTimes(1);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
describe('setDomain()', () => {
|
|
36
|
-
describe('when user specifies a domain', () => {
|
|
37
|
-
it('sets the domain to an array of unique values in the user-provided domain', () => {
|
|
38
|
-
(dimension as any).domain = [
|
|
39
|
-
new Date('2020-01-03'),
|
|
40
|
-
new Date('2020-01-01'),
|
|
41
|
-
];
|
|
42
|
-
dimension.setPropertiesFromData([
|
|
43
|
-
new Date('2020-02-01'),
|
|
44
|
-
new Date('2020-02-02'),
|
|
45
|
-
]);
|
|
46
|
-
expect((dimension as any).calculatedDomain).toEqual([
|
|
47
|
-
new Date('2020-01-03'),
|
|
48
|
-
new Date('2020-01-01'),
|
|
49
|
-
]);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
describe('when user does not specify a domain', () => {
|
|
53
|
-
it('sets the domain to the unique values from the data', () => {
|
|
54
|
-
dimension.setPropertiesFromData([
|
|
55
|
-
new Date('2020-01-01'),
|
|
56
|
-
new Date('2020-01-01'),
|
|
57
|
-
new Date('2020-01-03'),
|
|
58
|
-
]);
|
|
59
|
-
expect((dimension as any).calculatedDomain).toEqual([
|
|
60
|
-
new Date('2020-01-01'),
|
|
61
|
-
new Date('2020-01-03'),
|
|
62
|
-
]);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { safeAssign } from '@mathstack/app-kit';
|
|
2
|
-
import { ScaleTime, max, min } from 'd3';
|
|
3
|
-
import { isDate } from '../../../core/utilities/type-guards';
|
|
4
|
-
import { DataDimension } from '../../dimension';
|
|
5
|
-
import { DateChartPositionDimensionOptions } from './date-chart-position-options';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* A dimension that transforms Date values into a position on a chart.
|
|
9
|
-
*
|
|
10
|
-
* This dimension is used for the positional dimensions of a chart, such as x and y. The underlying scale will always be a [D3 time scale](https://d3js.org/d3-scale/time). The range of the scale will be a dimension from the chart.
|
|
11
|
-
*
|
|
12
|
-
* The generic is the type of the data that will be passed to the dimension.
|
|
13
|
-
*
|
|
14
|
-
* TESTABLE FUNCTIONALITY
|
|
15
|
-
*
|
|
16
|
-
* - It extracts values for the dimension from data.
|
|
17
|
-
* - tested in: lines.cy.ts
|
|
18
|
-
* - It sets the domain of the dimension.
|
|
19
|
-
* - tested in: lines.cy.ts
|
|
20
|
-
* - It creates and returns a scale from a range.
|
|
21
|
-
* - tested in: lines.cy.ts
|
|
22
|
-
* - It checks if a value is in valid.
|
|
23
|
-
* - tested in: lines.cy.ts
|
|
24
|
-
* - The domain will be unique values from the user-provided domain if the user provides a domain.
|
|
25
|
-
* - tested in: date-chart-position.spec.ts
|
|
26
|
-
* - The domain will be unique values from the data if no custom domain is given by the user.
|
|
27
|
-
* - tested in: date-chart-position.spec.ts
|
|
28
|
-
* - The domain can be set in reverse order.
|
|
29
|
-
* - tested in: date-chart-position.spec.ts
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
export class DateChartPositionDimension<Datum>
|
|
33
|
-
extends DataDimension<Datum, Date>
|
|
34
|
-
implements DateChartPositionDimensionOptions<Datum>
|
|
35
|
-
{
|
|
36
|
-
private calculatedDomain: [Date, Date];
|
|
37
|
-
readonly domain: [Date, Date];
|
|
38
|
-
readonly formatSpecifier: string;
|
|
39
|
-
scaleFn: (
|
|
40
|
-
domain?: Iterable<Date>,
|
|
41
|
-
range?: Iterable<number>
|
|
42
|
-
) => ScaleTime<number, number>;
|
|
43
|
-
|
|
44
|
-
constructor(options: DateChartPositionDimensionOptions<Datum>) {
|
|
45
|
-
super('date');
|
|
46
|
-
safeAssign(this, options);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
setPropertiesFromData(data: Datum[]): void {
|
|
50
|
-
this.setValues(data);
|
|
51
|
-
this.setDomain();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
protected setDomain() {
|
|
55
|
-
const extents: [Date, Date] =
|
|
56
|
-
this.domain === undefined
|
|
57
|
-
? [min(this.values), max(this.values)]
|
|
58
|
-
: this.domain;
|
|
59
|
-
this.calculatedDomain = extents;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
getScaleFromRange(range: [number, number]): ScaleTime<number, number> {
|
|
63
|
-
return this.scaleFn().domain(this.calculatedDomain).range(range);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// returns false if data is undefined or null of not a Date
|
|
67
|
-
// for some charts this may be fine
|
|
68
|
-
// original intended use case: d3Line can only handle defined values
|
|
69
|
-
isValidValue(x: unknown): boolean {
|
|
70
|
-
return isDate(x);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PercentOverDomainPadding } from './percent-over/percent-over';
|
|
2
|
-
import { PixelDomainPadding } from './pixel/pixel';
|
|
3
|
-
import { RoundUpToIntervalDomainPadding } from './round-to-interval/round-to-interval';
|
|
4
|
-
import { RoundUpToSigFigDomainPadding } from './round-to-sig-fig/round-to-sig-fig';
|
|
5
|
-
|
|
6
|
-
export type ConcreteDomainPadding =
|
|
7
|
-
| RoundUpToSigFigDomainPadding
|
|
8
|
-
| RoundUpToIntervalDomainPadding
|
|
9
|
-
| PercentOverDomainPadding
|
|
10
|
-
| PixelDomainPadding;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { ScaleContinuousNumeric } from 'd3';
|
|
2
|
-
import { ValueExtent } from '../../../../core/types/values';
|
|
3
|
-
|
|
4
|
-
export enum DomainPaddingType {
|
|
5
|
-
roundUp = 'roundUp',
|
|
6
|
-
roundInterval = 'roundInterval',
|
|
7
|
-
percentOver = 'percentOver',
|
|
8
|
-
numPixels = 'numPixels',
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface PaddedDomainArguments {
|
|
12
|
-
value?: number;
|
|
13
|
-
valueType: keyof typeof ValueExtent;
|
|
14
|
-
scaleFn?: (
|
|
15
|
-
domain?: Iterable<number>,
|
|
16
|
-
range?: Iterable<number>
|
|
17
|
-
) => ScaleContinuousNumeric<number, number>;
|
|
18
|
-
unpaddedDomain?: [number, number];
|
|
19
|
-
dimensionRange?: [number, number];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export abstract class DomainPadding {
|
|
23
|
-
abstract getPaddedValue(args: PaddedDomainArguments): number;
|
|
24
|
-
|
|
25
|
-
getPaddedDomain(
|
|
26
|
-
unpaddedDomain: [number, number],
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
-
scaleFn: any,
|
|
29
|
-
dimensionRange?: [number, number]
|
|
30
|
-
): [number, number] {
|
|
31
|
-
const domainMinArgs: PaddedDomainArguments = {
|
|
32
|
-
value: unpaddedDomain[0],
|
|
33
|
-
valueType: 'min',
|
|
34
|
-
scaleFn,
|
|
35
|
-
unpaddedDomain,
|
|
36
|
-
dimensionRange: dimensionRange,
|
|
37
|
-
};
|
|
38
|
-
const domainMaxArgs: PaddedDomainArguments = {
|
|
39
|
-
value: unpaddedDomain[1],
|
|
40
|
-
valueType: 'max',
|
|
41
|
-
scaleFn,
|
|
42
|
-
unpaddedDomain,
|
|
43
|
-
dimensionRange: dimensionRange,
|
|
44
|
-
};
|
|
45
|
-
let domainMin: number;
|
|
46
|
-
let domainMax: number;
|
|
47
|
-
if (unpaddedDomain[0] >= 0 && unpaddedDomain[1] >= 0) {
|
|
48
|
-
domainMin = unpaddedDomain[0];
|
|
49
|
-
domainMax = this.getPaddedValue(domainMaxArgs);
|
|
50
|
-
} else if (unpaddedDomain[0] <= 0 && unpaddedDomain[1] <= 0) {
|
|
51
|
-
domainMin = this.getPaddedValue(domainMinArgs);
|
|
52
|
-
domainMax = unpaddedDomain[1];
|
|
53
|
-
} else if (unpaddedDomain[0] < 0 && unpaddedDomain[1] > 0) {
|
|
54
|
-
[domainMin, domainMax] = this.getPaddedDomainForPositiveAndNegativeValues(
|
|
55
|
-
domainMinArgs,
|
|
56
|
-
domainMaxArgs,
|
|
57
|
-
unpaddedDomain,
|
|
58
|
-
scaleFn,
|
|
59
|
-
dimensionRange
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
return [domainMin, domainMax];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
protected getPaddedDomainForPositiveAndNegativeValues(
|
|
66
|
-
domainMinArgs: PaddedDomainArguments,
|
|
67
|
-
domainMaxArgs: PaddedDomainArguments,
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
69
|
-
...args: any
|
|
70
|
-
): [number, number] {
|
|
71
|
-
return [
|
|
72
|
-
this.getPaddedValue(domainMinArgs),
|
|
73
|
-
this.getPaddedValue(domainMaxArgs),
|
|
74
|
-
];
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { expect } from 'local-cypress';
|
|
2
|
-
|
|
3
|
-
type Assert = 'isEqual' | 'isAbove' | 'isBelow' | 'isCloseTo';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* ValidateValue class
|
|
7
|
-
* @class
|
|
8
|
-
* @classdesc ValidateValue class is used to validate the value of a domain
|
|
9
|
-
* @example
|
|
10
|
-
* const validateValue = new ValidateValue({ value: 10 });
|
|
11
|
-
* validateValue.validate(10);
|
|
12
|
-
* @example
|
|
13
|
-
* const validateValue = new ValidateValue({ value: 10, assertion: 'equal' });
|
|
14
|
-
* validateValue.validate(10);
|
|
15
|
-
* @example
|
|
16
|
-
* const validateValue = new ValidateValue({ value: 10, assertion: 'above' });
|
|
17
|
-
* validateValue.validate(11);
|
|
18
|
-
* @example
|
|
19
|
-
* const validateValue = new ValidateValue({ value: 10, assertion: 'below' });
|
|
20
|
-
* validateValue.validate(9);
|
|
21
|
-
* @example
|
|
22
|
-
* const validateValue = new ValidateValue({ value: 10, assertion: 'closeTo', tolerance: 0.0001 });
|
|
23
|
-
* validateValue.validate(10.00001);
|
|
24
|
-
*/
|
|
25
|
-
class ValidateValue {
|
|
26
|
-
private value: number;
|
|
27
|
-
private assert: Assert;
|
|
28
|
-
private tolerance: number;
|
|
29
|
-
|
|
30
|
-
constructor(options: { value: number; assert?: Assert; tolerance?: number }) {
|
|
31
|
-
this.value = options.value;
|
|
32
|
-
this.assert = options.assert;
|
|
33
|
-
this.tolerance = options.tolerance;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
validate(expected: number): void {
|
|
37
|
-
if (this.assert === undefined) {
|
|
38
|
-
this.assert = 'isEqual';
|
|
39
|
-
}
|
|
40
|
-
if (this.tolerance === undefined && this.assert === 'isCloseTo') {
|
|
41
|
-
this.tolerance = 0.0001;
|
|
42
|
-
}
|
|
43
|
-
switch (this.assert) {
|
|
44
|
-
case 'isEqual':
|
|
45
|
-
expect(expected).to.equal(this.value);
|
|
46
|
-
break;
|
|
47
|
-
case 'isAbove':
|
|
48
|
-
expect(expected).to.be.above(this.value);
|
|
49
|
-
break;
|
|
50
|
-
case 'isBelow':
|
|
51
|
-
expect(expected).to.be.below(this.value);
|
|
52
|
-
break;
|
|
53
|
-
case 'isCloseTo':
|
|
54
|
-
expect(expected).to.be.closeTo(this.value, this.tolerance);
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* ValidateDomain class
|
|
62
|
-
* @class
|
|
63
|
-
* @classdesc ValidateDomain class is used to validate the domain of a chart
|
|
64
|
-
* @example
|
|
65
|
-
* const validateDomain = new ValidateDomain();
|
|
66
|
-
* validateDomain.min(0).max(10);
|
|
67
|
-
* validateDomain.validate();
|
|
68
|
-
* @example
|
|
69
|
-
* const validateDomain = new ValidateDomain();
|
|
70
|
-
* validateDomain.min(0, { assertion: 'above' }).max(10, { assertion: 'below' });
|
|
71
|
-
* validateDomain.validate();
|
|
72
|
-
* @example
|
|
73
|
-
* const validateDomain = new ValidateDomain();
|
|
74
|
-
* validateDomain.min(0, { assertion: 'closeTo', tolerance: 0.0001 }).max(10, { assertion: 'closeTo', tolerance: 0.0001 });
|
|
75
|
-
*/
|
|
76
|
-
class ValidateDomain {
|
|
77
|
-
private min?: ValidateValue;
|
|
78
|
-
private max?: ValidateValue;
|
|
79
|
-
expected: [number, number];
|
|
80
|
-
|
|
81
|
-
constructor(expected: [number, number]) {
|
|
82
|
-
this.expected = expected;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
minToBe(
|
|
86
|
-
min: number,
|
|
87
|
-
options?: {
|
|
88
|
-
assert: Assert;
|
|
89
|
-
tolerance?: number;
|
|
90
|
-
}
|
|
91
|
-
): ValidateDomain {
|
|
92
|
-
this.min = new ValidateValue({ value: min, ...options });
|
|
93
|
-
return this;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
maxToBe(
|
|
97
|
-
max: number,
|
|
98
|
-
options?: {
|
|
99
|
-
assert: Assert;
|
|
100
|
-
tolerance?: number;
|
|
101
|
-
}
|
|
102
|
-
): ValidateDomain {
|
|
103
|
-
this.max = new ValidateValue({ value: max, ...options });
|
|
104
|
-
return this;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
validate(): void {
|
|
108
|
-
if (this.min) {
|
|
109
|
-
this.min.validate(this.expected[0]);
|
|
110
|
-
}
|
|
111
|
-
if (this.max) {
|
|
112
|
-
this.max.validate(this.expected[1]);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* expectDomain function
|
|
119
|
-
* @function
|
|
120
|
-
* @functiondesc expectDomain function is used to create a new instance of ValidateDomain
|
|
121
|
-
* @example
|
|
122
|
-
* expectDomain().min(0).max(10).validate();
|
|
123
|
-
* @example
|
|
124
|
-
* expectDomain().min(0, { assertion: 'above' }).max(10, { assertion: 'below' }).validate();
|
|
125
|
-
* @example
|
|
126
|
-
* expectDomain().min(0, { assertion: 'closeTo', tolerance: 0.0001 }).max(10, { assertion: 'closeTo', tolerance: 0.0001 }).validate();
|
|
127
|
-
*/
|
|
128
|
-
export function expectDomain(values: [number, number]): ValidateDomain {
|
|
129
|
-
return new ValidateDomain(values);
|
|
130
|
-
}
|