@progress/kendo-charts 2.7.2-dev.202502101310 → 2.7.2-develop.1
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/dist/cdn/js/kendo-charts.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/barcode/barcode-validator.js +10 -12
- package/dist/es/barcode/barcode.js +84 -96
- package/dist/es/barcode/encodings/code11.js +41 -57
- package/dist/es/barcode/encodings/code128.js +222 -354
- package/dist/es/barcode/encodings/code39-extended.js +20 -34
- package/dist/es/barcode/encodings/code39.js +49 -75
- package/dist/es/barcode/encodings/code93-extended.js +12 -24
- package/dist/es/barcode/encodings/code93.js +52 -70
- package/dist/es/barcode/encodings/ean13.js +28 -42
- package/dist/es/barcode/encodings/ean8.js +8 -18
- package/dist/es/barcode/encodings/encoding.js +18 -24
- package/dist/es/barcode/encodings/main.js +13 -10
- package/dist/es/barcode/encodings/msi.js +56 -112
- package/dist/es/barcode/encodings/postnet.js +31 -45
- package/dist/es/barcode/surface-size.js +2 -2
- package/dist/es/chart/aggregates/aggregates.js +23 -23
- package/dist/es/chart/aggregates/default-aggregates.js +10 -18
- package/dist/es/chart/aggregates/series-aggregator.js +42 -54
- package/dist/es/chart/animations/bar-chart-animation.js +15 -26
- package/dist/es/chart/animations/bubble-animation.js +7 -17
- package/dist/es/chart/animations/clip-animation.js +13 -23
- package/dist/es/chart/animations/fade-in-animation.js +6 -16
- package/dist/es/chart/animations/pie-animation.js +6 -16
- package/dist/es/chart/api-elements/chart-axis.js +14 -22
- package/dist/es/chart/api-elements/chart-pane.js +10 -8
- package/dist/es/chart/api-elements/chart-plotarea.js +4 -10
- package/dist/es/chart/api-elements/find-axis-by-name.js +1 -1
- package/dist/es/chart/area-chart/area-chart.js +46 -60
- package/dist/es/chart/area-chart/area-segment.js +46 -52
- package/dist/es/chart/area-chart/spline-area-segment.js +12 -21
- package/dist/es/chart/area-chart/step-area-segment.js +6 -15
- package/dist/es/chart/axis-group-range-tracker.js +14 -20
- package/dist/es/chart/bar-chart/bar-chart.js +65 -80
- package/dist/es/chart/bar-chart/bar-label.js +25 -32
- package/dist/es/chart/bar-chart/bar.js +76 -91
- package/dist/es/chart/box-plot-chart/box-plot-chart.js +33 -48
- package/dist/es/chart/box-plot-chart/box-plot.js +55 -68
- package/dist/es/chart/box-plot-chart/vertical-box-plot.js +13 -23
- package/dist/es/chart/bubble-chart/bubble-chart.js +51 -64
- package/dist/es/chart/bubble-chart/bubble.js +21 -27
- package/dist/es/chart/bullet-chart/bullet-chart.js +45 -57
- package/dist/es/chart/bullet-chart/bullet.js +48 -57
- package/dist/es/chart/bullet-chart/target.js +1 -11
- package/dist/es/chart/candlestick-chart/candlestick-chart.js +41 -55
- package/dist/es/chart/candlestick-chart/candlestick.js +60 -69
- package/dist/es/chart/categorical-chart.js +178 -206
- package/dist/es/chart/chart-container.js +30 -39
- package/dist/es/chart/chart.js +641 -701
- package/dist/es/chart/constants.js +103 -103
- package/dist/es/chart/crosshair/crosshair-tooltip.js +22 -34
- package/dist/es/chart/crosshair/crosshair.js +39 -47
- package/dist/es/chart/donut-chart/donut-chart.js +36 -48
- package/dist/es/chart/donut-chart/donut-segment.js +12 -24
- package/dist/es/chart/error-bars/categorical-error-bar.js +5 -15
- package/dist/es/chart/error-bars/error-bar-base.js +37 -49
- package/dist/es/chart/error-bars/error-range-calculator.js +46 -56
- package/dist/es/chart/error-bars/scatter-error-bar.js +6 -16
- package/dist/es/chart/funnel-chart/funnel-chart.js +86 -103
- package/dist/es/chart/funnel-chart/funnel-segment.js +46 -54
- package/dist/es/chart/funnel-chart/pyramid-chart.js +5 -11
- package/dist/es/chart/heatmap-chart/color-scale.js +7 -9
- package/dist/es/chart/heatmap-chart/heatmap-chart.js +87 -110
- package/dist/es/chart/heatmap-chart/heatmap-point.js +72 -78
- package/dist/es/chart/highlight.js +26 -36
- package/dist/es/chart/layout/cluster-layout.js +16 -25
- package/dist/es/chart/layout/radar-cluster-layout.js +15 -24
- package/dist/es/chart/layout/radar-stack-layout.js +10 -22
- package/dist/es/chart/layout/stack-wrap.js +12 -24
- package/dist/es/chart/layout/utils.js +2 -2
- package/dist/es/chart/legend/legend-item-line-area.js +8 -19
- package/dist/es/chart/legend/legend-item-line.js +21 -31
- package/dist/es/chart/legend/legend-item-marker.js +18 -28
- package/dist/es/chart/legend/legend-item-square.js +8 -18
- package/dist/es/chart/legend/legend-item.js +91 -105
- package/dist/es/chart/legend/legend-layout.js +18 -25
- package/dist/es/chart/legend/legend.js +68 -92
- package/dist/es/chart/line-chart/line-chart.js +35 -48
- package/dist/es/chart/line-chart/line-point.js +90 -103
- package/dist/es/chart/line-chart/line-segment.js +23 -34
- package/dist/es/chart/line-chart/spline-segment.js +10 -20
- package/dist/es/chart/line-chart/step-line-mixin.js +14 -17
- package/dist/es/chart/line-chart/step-line-segment.js +4 -14
- package/dist/es/chart/mixins/accessibility-attributes-mixin.js +7 -7
- package/dist/es/chart/mixins/clip-animation-mixin.js +7 -7
- package/dist/es/chart/mixins/line-chart-mixin.js +27 -31
- package/dist/es/chart/mixins/note-mixin.js +3 -3
- package/dist/es/chart/mixins/pie-chart-mixin.js +9 -9
- package/dist/es/chart/mixins/plotarea-events-mixin.js +1 -1
- package/dist/es/chart/mixins/point-events-mixin.js +1 -1
- package/dist/es/chart/ohlc-chart/ohlc-chart.js +4 -14
- package/dist/es/chart/ohlc-chart/ohlc-point.js +15 -28
- package/dist/es/chart/pan-and-zoom/accept-key.js +3 -3
- package/dist/es/chart/pan-and-zoom/mousewheel-zoom.js +25 -33
- package/dist/es/chart/pan-and-zoom/pannable.js +29 -37
- package/dist/es/chart/pan-and-zoom/to-chart-axis-ranges.js +3 -3
- package/dist/es/chart/pan-and-zoom/zoom-selection.js +61 -70
- package/dist/es/chart/pane.js +71 -79
- package/dist/es/chart/pie-chart/pie-chart.js +153 -183
- package/dist/es/chart/pie-chart/pie-segment.js +82 -98
- package/dist/es/chart/plotarea/categorical-plotarea.js +285 -318
- package/dist/es/chart/plotarea/donut-plotarea.js +12 -22
- package/dist/es/chart/plotarea/funnel-plotarea.js +17 -27
- package/dist/es/chart/plotarea/heatmap-plotarea.js +139 -167
- package/dist/es/chart/plotarea/pie-plotarea.js +15 -25
- package/dist/es/chart/plotarea/plotarea-base.js +423 -462
- package/dist/es/chart/plotarea/plotarea-factory.js +15 -20
- package/dist/es/chart/plotarea/polar-plotarea-base.js +37 -51
- package/dist/es/chart/plotarea/polar-plotarea.js +39 -49
- package/dist/es/chart/plotarea/radar-plotarea.js +55 -65
- package/dist/es/chart/plotarea/xy-plotarea.js +111 -128
- package/dist/es/chart/polar-area-chart/polar-area-chart.js +22 -36
- package/dist/es/chart/polar-area-chart/polar-area-segment.js +7 -17
- package/dist/es/chart/polar-area-chart/spline-polar-area-segment.js +15 -25
- package/dist/es/chart/polar-line-chart/polar-line-chart.js +2 -11
- package/dist/es/chart/polar-scatter-chart/polar-scatter-chart.js +6 -16
- package/dist/es/chart/radar-area-chart/radar-area-chart.js +11 -21
- package/dist/es/chart/radar-area-chart/radar-area-segment.js +3 -13
- package/dist/es/chart/radar-area-chart/spline-radar-area-segment.js +3 -13
- package/dist/es/chart/radar-bar-chart/radar-bar-chart.js +19 -29
- package/dist/es/chart/radar-bar-chart/radar-segment.js +6 -12
- package/dist/es/chart/radar-line-chart/radar-line-chart.js +26 -35
- package/dist/es/chart/range-area-chart/range-area-chart.js +46 -58
- package/dist/es/chart/range-area-chart/range-area-point.js +55 -66
- package/dist/es/chart/range-area-chart/range-area-segment.js +19 -28
- package/dist/es/chart/range-area-chart/range-line-point.js +4 -14
- package/dist/es/chart/range-area-chart/spline-range-area-segment.js +11 -18
- package/dist/es/chart/range-area-chart/step-range-area-segment.js +7 -16
- package/dist/es/chart/range-bar-chart/range-bar-chart.js +18 -29
- package/dist/es/chart/range-bar-chart/range-bar.js +10 -23
- package/dist/es/chart/register-charts.js +20 -16
- package/dist/es/chart/scatter-charts/scatter-chart.js +100 -122
- package/dist/es/chart/scatter-charts/scatter-line-chart.js +15 -25
- package/dist/es/chart/selection.js +176 -201
- package/dist/es/chart/series-binder.js +55 -66
- package/dist/es/chart/theme/base-theme.js +75 -79
- package/dist/es/chart/theme/load-theme.js +52 -52
- package/dist/es/chart/tooltip/base-tooltip.js +17 -24
- package/dist/es/chart/tooltip/shared-tooltip.js +25 -31
- package/dist/es/chart/tooltip/tooltip.js +10 -20
- package/dist/es/chart/trendlines/calculate-moving-average.js +11 -13
- package/dist/es/chart/trendlines/calculate-polynomial.js +24 -26
- package/dist/es/chart/trendlines/calculate-slope.js +12 -14
- package/dist/es/chart/trendlines/check-all-positive.js +2 -5
- package/dist/es/chart/trendlines/exponential-trendline.js +15 -24
- package/dist/es/chart/trendlines/get-scatter-trendline-data.js +6 -7
- package/dist/es/chart/trendlines/get-trendline-data.js +6 -6
- package/dist/es/chart/trendlines/linear-trendline.js +12 -21
- package/dist/es/chart/trendlines/logarithmic-trendline.js +14 -23
- package/dist/es/chart/trendlines/moving-average.js +15 -26
- package/dist/es/chart/trendlines/polynomial-trendline.js +13 -21
- package/dist/es/chart/trendlines/power-trendline.js +15 -24
- package/dist/es/chart/trendlines/scatter-exponential-trendline.js +15 -24
- package/dist/es/chart/trendlines/scatter-linear-trendline.js +10 -16
- package/dist/es/chart/trendlines/scatter-logarithmic-trendline.js +17 -27
- package/dist/es/chart/trendlines/scatter-moving-average.js +7 -10
- package/dist/es/chart/trendlines/scatter-polynomial-trendline.js +11 -16
- package/dist/es/chart/trendlines/scatter-power-trendline.js +15 -22
- package/dist/es/chart/trendlines/scatter-trendline-registry.js +1 -1
- package/dist/es/chart/trendlines/scatter-value-getter.js +2 -5
- package/dist/es/chart/trendlines/trendline-factory.js +1 -1
- package/dist/es/chart/trendlines/trendline-registry.js +1 -1
- package/dist/es/chart/trendlines/x-value-limits.js +6 -8
- package/dist/es/chart/utils/any-has-z-index.js +1 -1
- package/dist/es/chart/utils/bind-segments.js +8 -8
- package/dist/es/chart/utils/categories-count.js +3 -3
- package/dist/es/chart/utils/count-numbers.js +4 -4
- package/dist/es/chart/utils/create-out-of-range-points.js +13 -22
- package/dist/es/chart/utils/eval-options.js +7 -10
- package/dist/es/chart/utils/filter-series-by-type.js +4 -4
- package/dist/es/chart/utils/get-field.js +1 -1
- package/dist/es/chart/utils/has-gradient-overlay.js +1 -1
- package/dist/es/chart/utils/is-date-axis.js +2 -2
- package/dist/es/chart/utils/parse-date-category.js +2 -2
- package/dist/es/chart/utils/segment-visible.js +2 -2
- package/dist/es/chart/waterfall-chart/waterfall-chart.js +41 -55
- package/dist/es/chart/waterfall-chart/waterfall-segment.js +16 -24
- package/dist/es/chart-wizard/get-wizard-data-from-data-rows.js +5 -6
- package/dist/es/chart-wizard/messages.js +1 -1
- package/dist/es/chart-wizard/state.js +145 -137
- package/dist/es/chart-wizard.js +12 -12
- package/dist/es/common/add-class.js +3 -3
- package/dist/es/common/align-path-to-pixel.js +2 -2
- package/dist/es/common/auto-text-color.js +1 -1
- package/dist/es/common/constants.js +53 -53
- package/dist/es/common/create-hash-set.js +59 -65
- package/dist/es/common/cycleDown.js +1 -1
- package/dist/es/common/deep-extend.js +10 -12
- package/dist/es/common/element-scale.js +9 -9
- package/dist/es/common/element-styles.js +8 -8
- package/dist/es/common/event-map.js +4 -4
- package/dist/es/common/event-utils.js +13 -13
- package/dist/es/common/find.js +2 -2
- package/dist/es/common/font-loader.js +42 -44
- package/dist/es/common/get-aria-template.js +2 -4
- package/dist/es/common/get-spacing.js +2 -4
- package/dist/es/common/get-supported-features.js +7 -7
- package/dist/es/common/get-template.js +2 -4
- package/dist/es/common/getter.js +5 -5
- package/dist/es/common/grep.js +3 -3
- package/dist/es/common/has-classes.js +2 -2
- package/dist/es/common/hash-map.js +11 -11
- package/dist/es/common/instance-observer.js +28 -33
- package/dist/es/common/keys.js +1 -1
- package/dist/es/common/map.js +4 -4
- package/dist/es/common/matrix.js +142 -150
- package/dist/es/common/mousewheel-delta.js +2 -2
- package/dist/es/common/observable.js +40 -52
- package/dist/es/common/remove-class.js +1 -1
- package/dist/es/common/render-icon.js +50 -60
- package/dist/es/common/set-default-options.js +1 -1
- package/dist/es/common/sparse-array-limits.js +4 -4
- package/dist/es/common/user-events.js +124 -150
- package/dist/es/core/axis-label.js +38 -43
- package/dist/es/core/axis.js +293 -345
- package/dist/es/core/box-element.js +36 -46
- package/dist/es/core/box.js +75 -83
- package/dist/es/core/category-axis.js +265 -314
- package/dist/es/core/chart-element.js +98 -109
- package/dist/es/core/constants.js +3 -3
- package/dist/es/core/curve-processor.js +86 -93
- package/dist/es/core/date-category-axis.js +381 -413
- package/dist/es/core/date-value-axis.js +108 -118
- package/dist/es/core/float-element.js +54 -78
- package/dist/es/core/gradients.js +3 -3
- package/dist/es/core/logarithmic-axis.js +134 -186
- package/dist/es/core/mixins/grid-lines-mixin.js +18 -20
- package/dist/es/core/mixins/radar-numeric-axis-mixin.js +46 -51
- package/dist/es/core/note.js +58 -73
- package/dist/es/core/numeric-axis.js +111 -133
- package/dist/es/core/pattern.js +4 -8
- package/dist/es/core/point.js +25 -34
- package/dist/es/core/polar-axis.js +73 -91
- package/dist/es/core/radar-category-axis.js +90 -114
- package/dist/es/core/radar-logarithmic-axis.js +10 -20
- package/dist/es/core/radar-numeric-axis.js +10 -20
- package/dist/es/core/ring.js +61 -68
- package/dist/es/core/root-element.js +40 -48
- package/dist/es/core/sector.js +11 -17
- package/dist/es/core/shape-builder.js +13 -23
- package/dist/es/core/shape-element.js +27 -37
- package/dist/es/core/text-box.js +50 -59
- package/dist/es/core/text.js +13 -24
- package/dist/es/core/title.js +19 -25
- package/dist/es/core/utils/auto-axis-max.js +3 -3
- package/dist/es/core/utils/auto-axis-min.js +3 -3
- package/dist/es/core/utils/auto-major-unit.js +4 -4
- package/dist/es/core/utils/box-diff.js +9 -9
- package/dist/es/core/utils/create-axis-grid-line.js +2 -4
- package/dist/es/core/utils/create-axis-tick.js +2 -4
- package/dist/es/core/utils/guid.js +3 -3
- package/dist/es/core/utils/rect-to-box.js +2 -2
- package/dist/es/date-utils/absolute-date-diff.js +2 -2
- package/dist/es/date-utils/add-duration.js +5 -5
- package/dist/es/date-utils/ceil-date.js +1 -1
- package/dist/es/date-utils/constants.js +17 -17
- package/dist/es/date-utils/date-index.js +3 -3
- package/dist/es/date-utils/duration.js +1 -1
- package/dist/es/date-utils/lte-date-index.js +4 -4
- package/dist/es/date-utils/parse-date.js +1 -1
- package/dist/es/date-utils/parse-dates.js +2 -2
- package/dist/es/date-utils/start-of-week.js +3 -5
- package/dist/es/date-utils/to-date.js +1 -1
- package/dist/es/date-utils/to-time.js +2 -2
- package/dist/es/drawing-utils.js +18 -17
- package/dist/es/gauges/arc/arc-gauge.js +29 -38
- package/dist/es/gauges/arc/arc-scale.js +16 -29
- package/dist/es/gauges/arc/range-pointer-animation.js +16 -25
- package/dist/es/gauges/arc/range-pointer.js +25 -46
- package/dist/es/gauges/circular/circular-gauge.js +7 -17
- package/dist/es/gauges/constants.js +14 -14
- package/dist/es/gauges/gauge.js +84 -96
- package/dist/es/gauges/linear/arrow-linear-pointer-animation.js +13 -25
- package/dist/es/gauges/linear/arrow-linear-pointer.js +23 -35
- package/dist/es/gauges/linear/bar-linear-pointer-animation.js +15 -24
- package/dist/es/gauges/linear/bar-linear-pointer.js +38 -51
- package/dist/es/gauges/linear/linear-gauge.js +61 -83
- package/dist/es/gauges/linear/linear-pointer.js +25 -39
- package/dist/es/gauges/linear/linear-scale.js +57 -74
- package/dist/es/gauges/pointer.js +11 -21
- package/dist/es/gauges/radial/radial-gauge.js +58 -81
- package/dist/es/gauges/radial/radial-pointer-animation.js +9 -15
- package/dist/es/gauges/radial/radial-pointer.js +33 -48
- package/dist/es/gauges/radial/radial-scale.js +154 -186
- package/dist/es/gauges/utils/build-label-element.js +10 -12
- package/dist/es/gauges/utils/get-range.js +2 -2
- package/dist/es/gauges/utils/pad.js +3 -3
- package/dist/es/gauges/utils/unpad.js +1 -1
- package/dist/es/map/attribution.js +42 -52
- package/dist/es/map/constants.js +5 -5
- package/dist/es/map/crs.js +68 -112
- package/dist/es/map/datums.js +3 -3
- package/dist/es/map/extent.js +40 -54
- package/dist/es/map/layers/bubble.js +52 -70
- package/dist/es/map/layers/layer.js +50 -56
- package/dist/es/map/layers/marker.js +109 -129
- package/dist/es/map/layers/shape.js +111 -133
- package/dist/es/map/layers/tile.js +144 -170
- package/dist/es/map/location.js +70 -78
- package/dist/es/map/map.js +261 -291
- package/dist/es/map/navigator.js +33 -39
- package/dist/es/map/scroller/draggable.js +98 -134
- package/dist/es/map/scroller/fx.js +39 -46
- package/dist/es/map/scroller/scroller.js +144 -174
- package/dist/es/map/tooltip/tooltip.js +15 -25
- package/dist/es/map/utils.js +25 -26
- package/dist/es/map/zoom.js +30 -36
- package/dist/es/qrcode/encodings/data-modes/alpha-numeric-data-mode.js +14 -26
- package/dist/es/qrcode/encodings/data-modes/byte-data-mode.js +15 -25
- package/dist/es/qrcode/encodings/data-modes/data-mode-instances.js +8 -7
- package/dist/es/qrcode/encodings/data-modes/numeric-data-mode.js +14 -24
- package/dist/es/qrcode/encodings/data-modes/qr-data-mode.js +15 -21
- package/dist/es/qrcode/encodings/encoders/iso-encoder.js +6 -16
- package/dist/es/qrcode/encodings/encoders/utf8-encoder.js +28 -36
- package/dist/es/qrcode/encodings/encoding-result.js +4 -10
- package/dist/es/qrcode/encodings/encoding.js +68 -192
- package/dist/es/qrcode/encodings/free-cell-visitor.js +16 -24
- package/dist/es/qrcode/encodings/utils/choose-mode.js +44 -0
- package/dist/es/qrcode/encodings/utils/get-data-codewords-count.js +13 -0
- package/dist/es/qrcode/encodings/utils/get-data-string.js +13 -0
- package/dist/es/qrcode/encodings/utils/get-modes.js +35 -0
- package/dist/es/qrcode/encodings/utils/get-version.js +23 -0
- package/dist/es/qrcode/encodings/utils/index.js +5 -0
- package/dist/es/qrcode/encodings/version-codewords.js +1 -1
- package/dist/es/qrcode/qrcode-validator.js +3 -5
- package/dist/es/qrcode/qrcode.js +104 -114
- package/dist/es/qrcode/utils.js +4 -4
- package/dist/es/sankey/calculation.js +286 -307
- package/dist/es/sankey/element.js +15 -23
- package/dist/es/sankey/label.js +29 -44
- package/dist/es/sankey/legend.js +15 -29
- package/dist/es/sankey/link.js +80 -98
- package/dist/es/sankey/node.js +26 -37
- package/dist/es/sankey/sankey.js +318 -385
- package/dist/es/sankey/title.js +9 -20
- package/dist/es/sankey/utils.js +18 -23
- package/dist/es/services/chart-service.js +24 -28
- package/dist/es/services/dom-events-builder.js +15 -15
- package/dist/es/services/format-service.js +30 -35
- package/dist/es/services/intl-service.js +14 -18
- package/dist/es/services/map-service.js +11 -11
- package/dist/es/services/template-service.js +9 -9
- package/dist/es/sparkline/shared-tooltip.js +11 -21
- package/dist/es/sparkline/sparkline.js +50 -60
- package/dist/es/stock/constants.js +3 -3
- package/dist/es/stock/fade-out-animation.js +12 -21
- package/dist/es/stock/navigator-hint.js +37 -49
- package/dist/es/stock/navigator.js +130 -161
- package/dist/es/stock/stock-chart.js +58 -67
- package/dist/es2015/chart/legend/legend-item.js +1 -1
- package/dist/es2015/qrcode/encodings/encoders/iso-encoder.js +1 -1
- package/dist/es2015/qrcode/encodings/encoders/utf8-encoder.js +1 -1
- package/dist/es2015/qrcode/encodings/encoding.js +3 -127
- package/dist/es2015/qrcode/encodings/utils/choose-mode.js +44 -0
- package/dist/es2015/qrcode/encodings/utils/get-data-codewords-count.js +13 -0
- package/dist/es2015/qrcode/encodings/utils/get-data-string.js +13 -0
- package/dist/es2015/qrcode/encodings/utils/get-modes.js +35 -0
- package/dist/es2015/qrcode/encodings/utils/get-version.js +23 -0
- package/dist/es2015/qrcode/encodings/utils/index.js +5 -0
- package/dist/npm/main.js +3222 -3589
- package/dist/systemjs/kendo-charts.js +1 -1
- package/package.json +19 -57
package/dist/es/core/axis.js
CHANGED
|
@@ -13,11 +13,9 @@ import createAxisGridLine from './utils/create-axis-grid-line';
|
|
|
13
13
|
import { NONE, BLACK, CENTER, TOP, BOTTOM, LEFT, RIGHT, OUTSIDE, X, Y, WIDTH, HEIGHT } from '../common/constants';
|
|
14
14
|
import { alignPathToPixel, deepExtend, getTemplate, grep, defined, isObject, inArray, limitValue, round, setDefaultOptions } from '../common';
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
ChartElement.call(this, options);
|
|
16
|
+
class Axis extends ChartElement {
|
|
17
|
+
constructor(options, chartService = new ChartService()) {
|
|
18
|
+
super(options);
|
|
21
19
|
|
|
22
20
|
this.chartService = chartService;
|
|
23
21
|
|
|
@@ -63,42 +61,36 @@ var Axis = (function (ChartElement) {
|
|
|
63
61
|
this.createNotes();
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Axis.prototype.constructor = Axis;
|
|
69
|
-
|
|
70
|
-
Axis.prototype.initFields = function initFields () {
|
|
71
|
-
};
|
|
64
|
+
initFields() {
|
|
65
|
+
}
|
|
72
66
|
|
|
73
67
|
// abstract labelsCount(): Number
|
|
74
68
|
// abstract createAxisLabel(index, options): AxisLabel
|
|
75
69
|
|
|
76
|
-
|
|
70
|
+
labelsRange() {
|
|
77
71
|
return {
|
|
78
72
|
min: this.options.labels.skip,
|
|
79
73
|
max: this.labelsCount()
|
|
80
74
|
};
|
|
81
|
-
}
|
|
75
|
+
}
|
|
82
76
|
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
normalizeLabelRotation(labelOptions) {
|
|
78
|
+
const rotation = labelOptions.rotation;
|
|
85
79
|
|
|
86
80
|
if (isObject(rotation)) {
|
|
87
81
|
labelOptions.alignRotation = rotation.align;
|
|
88
82
|
labelOptions.rotation = rotation.angle;
|
|
89
83
|
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
Axis.prototype.createLabels = function createLabels () {
|
|
93
|
-
var this$1 = this;
|
|
84
|
+
}
|
|
94
85
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
86
|
+
createLabels() {
|
|
87
|
+
const options = this.options;
|
|
88
|
+
const align = options.vertical ? RIGHT : CENTER;
|
|
89
|
+
const labelOptions = deepExtend({ }, options.labels, {
|
|
98
90
|
align: align,
|
|
99
91
|
zIndex: options.zIndex
|
|
100
92
|
});
|
|
101
|
-
|
|
93
|
+
const step = Math.max(1, labelOptions.step);
|
|
102
94
|
|
|
103
95
|
this.clearLabels();
|
|
104
96
|
|
|
@@ -109,55 +101,51 @@ var Axis = (function (ChartElement) {
|
|
|
109
101
|
options.autoRotateLabels = true;
|
|
110
102
|
}
|
|
111
103
|
|
|
112
|
-
|
|
113
|
-
for (
|
|
114
|
-
|
|
115
|
-
|
|
104
|
+
const range = this.labelsRange();
|
|
105
|
+
for (let idx = range.min; idx < range.max; idx += step) {
|
|
106
|
+
const labelContext = { index: idx, count: range.max };
|
|
107
|
+
let label = this.createAxisLabel(idx, labelOptions, labelContext);
|
|
116
108
|
if (label) {
|
|
117
|
-
this
|
|
118
|
-
this
|
|
109
|
+
this.append(label);
|
|
110
|
+
this.labels.push(label);
|
|
119
111
|
}
|
|
120
112
|
}
|
|
121
113
|
}
|
|
122
|
-
}
|
|
114
|
+
}
|
|
123
115
|
|
|
124
|
-
|
|
125
|
-
this.children = grep(this.children,
|
|
116
|
+
clearLabels() {
|
|
117
|
+
this.children = grep(this.children, child => !(child instanceof AxisLabel));
|
|
126
118
|
this.labels = [];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
Axis.prototype.clearTitle = function clearTitle () {
|
|
130
|
-
var this$1 = this;
|
|
119
|
+
}
|
|
131
120
|
|
|
121
|
+
clearTitle() {
|
|
132
122
|
if (this.title) {
|
|
133
|
-
this.children = grep(this.children,
|
|
123
|
+
this.children = grep(this.children, child => child !== this.title);
|
|
134
124
|
this.title = undefined;
|
|
135
125
|
}
|
|
136
|
-
}
|
|
126
|
+
}
|
|
137
127
|
|
|
138
|
-
|
|
128
|
+
clear() {
|
|
139
129
|
this.clearLabels();
|
|
140
130
|
this.clearTitle();
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
var axisY = mirror ? box.y2 : box.y1;
|
|
151
|
-
var lineWidth = options.line.width || 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
lineBox() {
|
|
134
|
+
const { options, box } = this;
|
|
135
|
+
const vertical = options.vertical;
|
|
136
|
+
const mirror = options.labels.mirror;
|
|
137
|
+
const axisX = mirror ? box.x1 : box.x2;
|
|
138
|
+
const axisY = mirror ? box.y2 : box.y1;
|
|
139
|
+
const lineWidth = options.line.width || 0;
|
|
152
140
|
|
|
153
141
|
return vertical ?
|
|
154
142
|
new Box(axisX, box.y1, axisX, box.y2 - lineWidth) :
|
|
155
143
|
new Box(box.x1, axisY, box.x2 - lineWidth, axisY);
|
|
156
|
-
}
|
|
144
|
+
}
|
|
157
145
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
146
|
+
createTitle() {
|
|
147
|
+
const options = this.options;
|
|
148
|
+
const titleOptions = deepExtend({
|
|
161
149
|
rotation: options.vertical ? -90 : 0,
|
|
162
150
|
text: "",
|
|
163
151
|
zIndex: 1,
|
|
@@ -165,30 +153,28 @@ var Axis = (function (ChartElement) {
|
|
|
165
153
|
}, options.title);
|
|
166
154
|
|
|
167
155
|
if (titleOptions.visible && titleOptions.text) {
|
|
168
|
-
|
|
156
|
+
const title = new TextBox(titleOptions.text, titleOptions);
|
|
169
157
|
this.append(title);
|
|
170
158
|
this.title = title;
|
|
171
159
|
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
Axis.prototype.createNotes = function createNotes () {
|
|
175
|
-
var this$1 = this;
|
|
160
|
+
}
|
|
176
161
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
162
|
+
createNotes() {
|
|
163
|
+
const options = this.options;
|
|
164
|
+
const notes = options.notes;
|
|
165
|
+
const items = notes.data || [];
|
|
180
166
|
|
|
181
167
|
this.notes = [];
|
|
182
168
|
|
|
183
|
-
for (
|
|
184
|
-
|
|
185
|
-
item.value = this
|
|
169
|
+
for (let i = 0; i < items.length; i++) {
|
|
170
|
+
const item = deepExtend({}, notes, items[i]);
|
|
171
|
+
item.value = this.parseNoteValue(item.value);
|
|
186
172
|
|
|
187
|
-
|
|
173
|
+
const note = new Note({
|
|
188
174
|
value: item.value,
|
|
189
175
|
text: item.label.text,
|
|
190
176
|
dataItem: item
|
|
191
|
-
}, item, this
|
|
177
|
+
}, item, this.chartService);
|
|
192
178
|
|
|
193
179
|
if (note.options.visible) {
|
|
194
180
|
if (defined(note.options.position)) {
|
|
@@ -204,31 +190,31 @@ var Axis = (function (ChartElement) {
|
|
|
204
190
|
note.options.position = options.reverse ? BOTTOM : TOP;
|
|
205
191
|
}
|
|
206
192
|
}
|
|
207
|
-
this
|
|
208
|
-
this
|
|
193
|
+
this.append(note);
|
|
194
|
+
this.notes.push(note);
|
|
209
195
|
}
|
|
210
196
|
}
|
|
211
|
-
}
|
|
197
|
+
}
|
|
212
198
|
|
|
213
|
-
|
|
199
|
+
parseNoteValue(value) {
|
|
214
200
|
return value;
|
|
215
|
-
}
|
|
201
|
+
}
|
|
216
202
|
|
|
217
|
-
|
|
218
|
-
|
|
203
|
+
renderVisual() {
|
|
204
|
+
super.renderVisual();
|
|
219
205
|
|
|
220
206
|
this.createPlotBands();
|
|
221
|
-
}
|
|
207
|
+
}
|
|
222
208
|
|
|
223
|
-
|
|
224
|
-
|
|
209
|
+
createVisual() {
|
|
210
|
+
super.createVisual();
|
|
225
211
|
|
|
226
212
|
this.createBackground();
|
|
227
213
|
this.createLine();
|
|
228
|
-
}
|
|
214
|
+
}
|
|
229
215
|
|
|
230
|
-
|
|
231
|
-
|
|
216
|
+
gridLinesVisual() {
|
|
217
|
+
let gridLines = this._gridLines;
|
|
232
218
|
if (!gridLines) {
|
|
233
219
|
gridLines = this._gridLines = new draw.Group({
|
|
234
220
|
zIndex: -2
|
|
@@ -237,25 +223,25 @@ var Axis = (function (ChartElement) {
|
|
|
237
223
|
}
|
|
238
224
|
|
|
239
225
|
return gridLines;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
createTicks(lineGroup) {
|
|
229
|
+
const options = this.options;
|
|
230
|
+
const lineBox = this.lineBox();
|
|
231
|
+
const mirror = options.labels.mirror;
|
|
232
|
+
const majorUnit = options.majorTicks.visible ? options.majorUnit : 0;
|
|
233
|
+
const tickLineOptions = {
|
|
248
234
|
// TODO
|
|
249
235
|
// _alignLines: options._alignLines,
|
|
250
236
|
vertical: options.vertical
|
|
251
237
|
};
|
|
252
238
|
|
|
253
239
|
function render(tickPositions, tickOptions, skipUnit) {
|
|
254
|
-
|
|
255
|
-
|
|
240
|
+
const count = tickPositions.length;
|
|
241
|
+
const step = Math.max(1, tickOptions.step);
|
|
256
242
|
|
|
257
243
|
if (tickOptions.visible) {
|
|
258
|
-
for (
|
|
244
|
+
for (let i = tickOptions.skip; i < count; i += step) {
|
|
259
245
|
if (defined(skipUnit) && (i % skipUnit === 0)) {
|
|
260
246
|
continue;
|
|
261
247
|
}
|
|
@@ -271,15 +257,15 @@ var Axis = (function (ChartElement) {
|
|
|
271
257
|
|
|
272
258
|
render(this.getMajorTickPositions(), options.majorTicks);
|
|
273
259
|
render(this.getMinorTickPositions(), options.minorTicks, majorUnit / options.minorUnit);
|
|
274
|
-
}
|
|
260
|
+
}
|
|
275
261
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
262
|
+
createLine() {
|
|
263
|
+
const options = this.options;
|
|
264
|
+
const line = options.line;
|
|
265
|
+
const lineBox = this.lineBox();
|
|
280
266
|
|
|
281
267
|
if (line.width > 0 && line.visible) {
|
|
282
|
-
|
|
268
|
+
const path = new draw.Path({
|
|
283
269
|
stroke: {
|
|
284
270
|
width: line.width,
|
|
285
271
|
color: line.color,
|
|
@@ -298,17 +284,17 @@ var Axis = (function (ChartElement) {
|
|
|
298
284
|
alignPathToPixel(path);
|
|
299
285
|
}
|
|
300
286
|
|
|
301
|
-
|
|
287
|
+
const group = this._lineGroup = new draw.Group();
|
|
302
288
|
group.append(path);
|
|
303
289
|
|
|
304
290
|
this.visual.append(group);
|
|
305
291
|
this.createTicks(group);
|
|
306
292
|
}
|
|
307
|
-
}
|
|
293
|
+
}
|
|
308
294
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
295
|
+
getActualTickSize() {
|
|
296
|
+
const options = this.options;
|
|
297
|
+
let tickSize = 0;
|
|
312
298
|
|
|
313
299
|
if (options.majorTicks.visible && options.minorTicks.visible) {
|
|
314
300
|
tickSize = Math.max(options.majorTicks.size, options.minorTicks.size);
|
|
@@ -319,13 +305,11 @@ var Axis = (function (ChartElement) {
|
|
|
319
305
|
}
|
|
320
306
|
|
|
321
307
|
return tickSize;
|
|
322
|
-
}
|
|
308
|
+
}
|
|
323
309
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
var box = ref.box;
|
|
328
|
-
var background = options.background;
|
|
310
|
+
createBackground() {
|
|
311
|
+
const { options, box } = this;
|
|
312
|
+
const background = options.background;
|
|
329
313
|
|
|
330
314
|
if (background) {
|
|
331
315
|
this._backgroundPath = draw.Path.fromRect(box.toRect(), {
|
|
@@ -337,43 +321,41 @@ var Axis = (function (ChartElement) {
|
|
|
337
321
|
|
|
338
322
|
this.visual.append(this._backgroundPath);
|
|
339
323
|
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
Axis.prototype.createPlotBands = function createPlotBands () {
|
|
343
|
-
var this$1 = this;
|
|
324
|
+
}
|
|
344
325
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
326
|
+
createPlotBands() {
|
|
327
|
+
const options = this.options;
|
|
328
|
+
const plotBands = options.plotBands || [];
|
|
329
|
+
const vertical = options.vertical;
|
|
330
|
+
const plotArea = this.plotArea;
|
|
349
331
|
|
|
350
332
|
if (plotBands.length === 0) {
|
|
351
333
|
return;
|
|
352
334
|
}
|
|
353
335
|
|
|
354
|
-
|
|
336
|
+
const group = this._plotbandGroup = new draw.Group({
|
|
355
337
|
zIndex: -1
|
|
356
338
|
});
|
|
357
339
|
|
|
358
|
-
|
|
340
|
+
const altAxis = grep(this.pane.axes, axis => axis.options.vertical !== this.options.vertical)[0];
|
|
359
341
|
|
|
360
|
-
for (
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
342
|
+
for (let idx = 0; idx < plotBands.length; idx++) {
|
|
343
|
+
let item = plotBands[idx];
|
|
344
|
+
let slotX, slotY;
|
|
345
|
+
let labelOptions = item.label;
|
|
346
|
+
let label;
|
|
365
347
|
|
|
366
348
|
if (vertical) {
|
|
367
349
|
slotX = (altAxis || plotArea.axisX).lineBox();
|
|
368
|
-
slotY = this
|
|
350
|
+
slotY = this.getSlot(item.from, item.to, true);
|
|
369
351
|
} else {
|
|
370
|
-
slotX = this
|
|
352
|
+
slotX = this.getSlot(item.from, item.to, true);
|
|
371
353
|
slotY = (altAxis || plotArea.axisY).lineBox();
|
|
372
354
|
}
|
|
373
355
|
|
|
374
356
|
if (labelOptions) {
|
|
375
357
|
labelOptions.vAlign = labelOptions.position || LEFT;
|
|
376
|
-
label = this
|
|
358
|
+
label = this.createPlotBandLabel(
|
|
377
359
|
labelOptions,
|
|
378
360
|
item,
|
|
379
361
|
new Box(
|
|
@@ -387,12 +369,12 @@ var Axis = (function (ChartElement) {
|
|
|
387
369
|
}
|
|
388
370
|
|
|
389
371
|
if (slotX.width() !== 0 && slotY.height() !== 0) {
|
|
390
|
-
|
|
372
|
+
const bandRect = new geom.Rect(
|
|
391
373
|
[ slotX.x1, slotY.y1 ],
|
|
392
374
|
[ slotX.width(), slotY.height() ]
|
|
393
375
|
);
|
|
394
376
|
|
|
395
|
-
|
|
377
|
+
const path = draw.Path.fromRect(bandRect, {
|
|
396
378
|
fill: {
|
|
397
379
|
color: item.color,
|
|
398
380
|
opacity: item.opacity
|
|
@@ -408,19 +390,19 @@ var Axis = (function (ChartElement) {
|
|
|
408
390
|
}
|
|
409
391
|
|
|
410
392
|
this.appendVisual(group);
|
|
411
|
-
}
|
|
393
|
+
}
|
|
412
394
|
|
|
413
|
-
|
|
395
|
+
createPlotBandLabel(label, item, box) {
|
|
414
396
|
|
|
415
397
|
if (label.visible === false) {
|
|
416
398
|
return null;
|
|
417
399
|
}
|
|
418
400
|
|
|
419
|
-
|
|
420
|
-
|
|
401
|
+
let text = label.text;
|
|
402
|
+
let textbox;
|
|
421
403
|
|
|
422
404
|
if (defined(label) && label.visible) {
|
|
423
|
-
|
|
405
|
+
const labelTemplate = getTemplate(label);
|
|
424
406
|
if (labelTemplate) {
|
|
425
407
|
text = labelTemplate({ text: text, item: item });
|
|
426
408
|
} else if (label.format) {
|
|
@@ -437,34 +419,31 @@ var Axis = (function (ChartElement) {
|
|
|
437
419
|
textbox.renderVisual();
|
|
438
420
|
|
|
439
421
|
return textbox.visual;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
var lineBox = altAxis.lineBox();
|
|
451
|
-
var linePos = lineBox[vertical ? "y1" : "x1"];
|
|
452
|
-
var lineOptions = {
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
createGridLines(altAxis) {
|
|
425
|
+
const options = this.options;
|
|
426
|
+
const { minorGridLines, majorGridLines, minorUnit, vertical } = options;
|
|
427
|
+
const axisLineVisible = altAxis.options.line.visible;
|
|
428
|
+
const majorUnit = majorGridLines.visible ? options.majorUnit : 0;
|
|
429
|
+
const lineBox = altAxis.lineBox();
|
|
430
|
+
const linePos = lineBox[vertical ? "y1" : "x1"];
|
|
431
|
+
const lineOptions = {
|
|
453
432
|
lineStart: lineBox[vertical ? "x1" : "y1"],
|
|
454
433
|
lineEnd: lineBox[vertical ? "x2" : "y2"],
|
|
455
434
|
vertical: vertical
|
|
456
435
|
};
|
|
457
|
-
|
|
436
|
+
const majorTicks = [];
|
|
458
437
|
|
|
459
|
-
|
|
438
|
+
const container = this.gridLinesVisual();
|
|
460
439
|
|
|
461
440
|
function render(tickPositions, gridLine, skipUnit) {
|
|
462
|
-
|
|
463
|
-
|
|
441
|
+
const count = tickPositions.length;
|
|
442
|
+
const step = Math.max(1, gridLine.step);
|
|
464
443
|
|
|
465
444
|
if (gridLine.visible) {
|
|
466
|
-
for (
|
|
467
|
-
|
|
445
|
+
for (let i = gridLine.skip; i < count; i += step) {
|
|
446
|
+
let pos = round(tickPositions[i]);
|
|
468
447
|
if (!inArray(pos, majorTicks)) {
|
|
469
448
|
if (i % skipUnit !== 0 && (!axisLineVisible || linePos !== pos)) {
|
|
470
449
|
lineOptions.position = pos;
|
|
@@ -481,24 +460,21 @@ var Axis = (function (ChartElement) {
|
|
|
481
460
|
render(this.getMinorTickPositions(), minorGridLines, majorUnit / minorUnit);
|
|
482
461
|
|
|
483
462
|
return container.children;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
for (var i = 0; i < count; i++) {
|
|
501
|
-
var labelSize = labels[i].box[sizeFn]();
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
reflow(box) {
|
|
466
|
+
const { options, labels, title } = this;
|
|
467
|
+
const vertical = options.vertical;
|
|
468
|
+
const count = labels.length;
|
|
469
|
+
const sizeFn = vertical ? WIDTH : HEIGHT;
|
|
470
|
+
const titleSize = title ? title.box[sizeFn]() : 0;
|
|
471
|
+
const space = this.getActualTickSize() + options.margin + titleSize;
|
|
472
|
+
const rootBox = (this.getRoot() || {}).box || box;
|
|
473
|
+
const boxSize = rootBox[sizeFn]();
|
|
474
|
+
let maxLabelSize = 0;
|
|
475
|
+
|
|
476
|
+
for (let i = 0; i < count; i++) {
|
|
477
|
+
let labelSize = labels[i].box[sizeFn]();
|
|
502
478
|
if (labelSize + space <= boxSize) {
|
|
503
479
|
maxLabelSize = Math.max(maxLabelSize, labelSize);
|
|
504
480
|
}
|
|
@@ -519,38 +495,34 @@ var Axis = (function (ChartElement) {
|
|
|
519
495
|
this.arrangeTitle();
|
|
520
496
|
this.arrangeLabels();
|
|
521
497
|
this.arrangeNotes();
|
|
522
|
-
}
|
|
498
|
+
}
|
|
523
499
|
|
|
524
|
-
|
|
500
|
+
getLabelsTickPositions() {
|
|
525
501
|
return this.getMajorTickPositions();
|
|
526
|
-
}
|
|
502
|
+
}
|
|
527
503
|
|
|
528
|
-
|
|
504
|
+
labelTickIndex(label) {
|
|
529
505
|
return label.index;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
var labelSize = vertical ? label.box.height() : label.box.width();
|
|
547
|
-
var firstTickPosition = tickPositions[tickIx];
|
|
548
|
-
var nextTickPosition = tickPositions[tickIx + 1];
|
|
549
|
-
var positionStart = (void 0), positionEnd = (void 0);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
arrangeLabels() {
|
|
509
|
+
const { options, labels } = this;
|
|
510
|
+
const labelsBetweenTicks = this.labelsBetweenTicks();
|
|
511
|
+
const vertical = options.vertical;
|
|
512
|
+
const mirror = options.labels.mirror;
|
|
513
|
+
const tickPositions = this.getLabelsTickPositions();
|
|
514
|
+
|
|
515
|
+
for (let idx = 0; idx < labels.length; idx++) {
|
|
516
|
+
const label = labels[idx];
|
|
517
|
+
const tickIx = this.labelTickIndex(label);
|
|
518
|
+
const labelSize = vertical ? label.box.height() : label.box.width();
|
|
519
|
+
const firstTickPosition = tickPositions[tickIx];
|
|
520
|
+
const nextTickPosition = tickPositions[tickIx + 1];
|
|
521
|
+
let positionStart, positionEnd;
|
|
550
522
|
|
|
551
523
|
if (vertical) {
|
|
552
524
|
if (labelsBetweenTicks) {
|
|
553
|
-
|
|
525
|
+
const middle = firstTickPosition + (nextTickPosition - firstTickPosition) / 2;
|
|
554
526
|
positionStart = middle - (labelSize / 2);
|
|
555
527
|
} else {
|
|
556
528
|
positionStart = firstTickPosition - (labelSize / 2);
|
|
@@ -567,21 +539,19 @@ var Axis = (function (ChartElement) {
|
|
|
567
539
|
}
|
|
568
540
|
}
|
|
569
541
|
|
|
570
|
-
this
|
|
542
|
+
this.positionLabel(label, mirror, positionStart, positionEnd);
|
|
571
543
|
}
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
Axis.prototype.positionLabel = function positionLabel (label, mirror, positionStart, positionEnd) {
|
|
575
|
-
if ( positionEnd === void 0 ) positionEnd = positionStart;
|
|
544
|
+
}
|
|
576
545
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
546
|
+
positionLabel(label, mirror, positionStart, positionEnd = positionStart) {
|
|
547
|
+
const options = this.options;
|
|
548
|
+
const vertical = options.vertical;
|
|
549
|
+
const lineBox = this.lineBox();
|
|
550
|
+
const labelOffset = this.getActualTickSize() + options.margin;
|
|
551
|
+
let labelBox;
|
|
582
552
|
|
|
583
553
|
if (vertical) {
|
|
584
|
-
|
|
554
|
+
let labelX = lineBox.x2;
|
|
585
555
|
|
|
586
556
|
if (mirror) {
|
|
587
557
|
labelX += labelOffset;
|
|
@@ -593,7 +563,7 @@ var Axis = (function (ChartElement) {
|
|
|
593
563
|
|
|
594
564
|
labelBox = label.box.move(labelX, positionStart);
|
|
595
565
|
} else {
|
|
596
|
-
|
|
566
|
+
let labelY = lineBox.y1;
|
|
597
567
|
|
|
598
568
|
if (mirror) {
|
|
599
569
|
labelY -= labelOffset + label.box.height();
|
|
@@ -610,9 +580,9 @@ var Axis = (function (ChartElement) {
|
|
|
610
580
|
}
|
|
611
581
|
|
|
612
582
|
label.reflow(labelBox);
|
|
613
|
-
}
|
|
583
|
+
}
|
|
614
584
|
|
|
615
|
-
|
|
585
|
+
autoRotateLabelAngle(labelBox, slotWidth) {
|
|
616
586
|
if (labelBox.width() < slotWidth) {
|
|
617
587
|
return 0;
|
|
618
588
|
}
|
|
@@ -622,24 +592,22 @@ var Axis = (function (ChartElement) {
|
|
|
622
592
|
}
|
|
623
593
|
|
|
624
594
|
return -45;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
Axis.prototype.autoRotateLabels = function autoRotateLabels () {
|
|
628
|
-
var this$1 = this;
|
|
595
|
+
}
|
|
629
596
|
|
|
597
|
+
autoRotateLabels() {
|
|
630
598
|
if (!this.options.autoRotateLabels || this.options.vertical) {
|
|
631
599
|
return false;
|
|
632
600
|
}
|
|
633
601
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
602
|
+
const tickPositions = this.getMajorTickPositions();
|
|
603
|
+
const labels = this.labels;
|
|
604
|
+
const limit = Math.min(labels.length, tickPositions.length - 1);
|
|
605
|
+
let angle = 0;
|
|
638
606
|
|
|
639
|
-
for (
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
607
|
+
for (let idx = 0; idx < limit; idx++) {
|
|
608
|
+
const width = Math.abs(tickPositions[idx + 1] - tickPositions[idx]);
|
|
609
|
+
const labelBox = labels[idx].box;
|
|
610
|
+
const labelAngle = this.autoRotateLabelAngle(labelBox, width);
|
|
643
611
|
|
|
644
612
|
if (labelAngle !== 0) {
|
|
645
613
|
angle = labelAngle;
|
|
@@ -651,21 +619,19 @@ var Axis = (function (ChartElement) {
|
|
|
651
619
|
}
|
|
652
620
|
|
|
653
621
|
if (angle !== 0) {
|
|
654
|
-
for (
|
|
655
|
-
labels[idx
|
|
656
|
-
labels[idx
|
|
622
|
+
for (let idx = 0; idx < labels.length; idx++) {
|
|
623
|
+
labels[idx].options.rotation = angle;
|
|
624
|
+
labels[idx].reflow(new Box());
|
|
657
625
|
}
|
|
658
626
|
|
|
659
627
|
return true;
|
|
660
628
|
}
|
|
661
|
-
}
|
|
629
|
+
}
|
|
662
630
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
var mirror = options.labels.mirror;
|
|
668
|
-
var vertical = options.vertical;
|
|
631
|
+
arrangeTitle() {
|
|
632
|
+
const { options, title } = this;
|
|
633
|
+
const mirror = options.labels.mirror;
|
|
634
|
+
const vertical = options.vertical;
|
|
669
635
|
|
|
670
636
|
if (title) {
|
|
671
637
|
if (vertical) {
|
|
@@ -678,40 +644,38 @@ var Axis = (function (ChartElement) {
|
|
|
678
644
|
|
|
679
645
|
title.reflow(this.box);
|
|
680
646
|
}
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
Axis.prototype.arrangeNotes = function arrangeNotes () {
|
|
684
|
-
var this$1 = this;
|
|
647
|
+
}
|
|
685
648
|
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
649
|
+
arrangeNotes() {
|
|
650
|
+
for (let idx = 0; idx < this.notes.length; idx++) {
|
|
651
|
+
const item = this.notes[idx];
|
|
652
|
+
const value = item.options.value;
|
|
653
|
+
let slot;
|
|
690
654
|
|
|
691
655
|
if (defined(value)) {
|
|
692
|
-
if (this
|
|
656
|
+
if (this.shouldRenderNote(value)) {
|
|
693
657
|
item.show();
|
|
694
658
|
} else {
|
|
695
659
|
item.hide();
|
|
696
660
|
}
|
|
697
661
|
|
|
698
|
-
slot = this
|
|
662
|
+
slot = this.noteSlot(value);
|
|
699
663
|
} else {
|
|
700
664
|
item.hide();
|
|
701
665
|
}
|
|
702
666
|
|
|
703
|
-
item.reflow(slot || this
|
|
667
|
+
item.reflow(slot || this.lineBox());
|
|
704
668
|
}
|
|
705
|
-
}
|
|
669
|
+
}
|
|
706
670
|
|
|
707
|
-
|
|
671
|
+
noteSlot(value) {
|
|
708
672
|
return this.getSlot(value);
|
|
709
|
-
}
|
|
673
|
+
}
|
|
710
674
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
675
|
+
alignTo(secondAxis) {
|
|
676
|
+
const lineBox = secondAxis.lineBox();
|
|
677
|
+
const vertical = this.options.vertical;
|
|
678
|
+
const pos = vertical ? Y : X;
|
|
715
679
|
|
|
716
680
|
this.box.snapTo(lineBox, pos);
|
|
717
681
|
if (vertical) {
|
|
@@ -721,27 +685,25 @@ var Axis = (function (ChartElement) {
|
|
|
721
685
|
}
|
|
722
686
|
this.box[pos + 1] -= this.lineBox()[pos + 1] - lineBox[pos + 1];
|
|
723
687
|
this.box[pos + 2] -= this.lineBox()[pos + 2] - lineBox[pos + 2];
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
Axis.prototype.axisLabelText = function axisLabelText (value, options, context) {
|
|
727
|
-
var this$1 = this;
|
|
688
|
+
}
|
|
728
689
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
690
|
+
axisLabelText(value, options, context) {
|
|
691
|
+
let text;
|
|
692
|
+
const tmpl = getTemplate(options);
|
|
693
|
+
const defaultText = () => {
|
|
732
694
|
if (!options.format) {
|
|
733
695
|
return value;
|
|
734
696
|
}
|
|
735
697
|
|
|
736
|
-
return this
|
|
698
|
+
return this.chartService.format.localeAuto(
|
|
737
699
|
options.format, [ value ], options.culture
|
|
738
700
|
);
|
|
739
701
|
};
|
|
740
702
|
|
|
741
703
|
if (tmpl) {
|
|
742
|
-
|
|
704
|
+
const templateContext = Object.assign({}, context, {
|
|
743
705
|
get text() { return defaultText(); },
|
|
744
|
-
value
|
|
706
|
+
value,
|
|
745
707
|
format: options.format,
|
|
746
708
|
culture: options.culture
|
|
747
709
|
});
|
|
@@ -752,29 +714,29 @@ var Axis = (function (ChartElement) {
|
|
|
752
714
|
}
|
|
753
715
|
|
|
754
716
|
return text;
|
|
755
|
-
}
|
|
717
|
+
}
|
|
756
718
|
|
|
757
|
-
|
|
758
|
-
|
|
719
|
+
slot(from , to, limit) {
|
|
720
|
+
const slot = this.getSlot(from, to, limit);
|
|
759
721
|
if (slot) {
|
|
760
722
|
return slot.toRect();
|
|
761
723
|
}
|
|
762
|
-
}
|
|
724
|
+
}
|
|
763
725
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
726
|
+
contentBox() {
|
|
727
|
+
const box = this.box.clone();
|
|
728
|
+
const labels = this.labels;
|
|
767
729
|
if (labels.length) {
|
|
768
|
-
|
|
730
|
+
const axis = this.options.vertical ? Y : X;
|
|
769
731
|
if (this.chartService.isPannable(axis)) {
|
|
770
|
-
|
|
732
|
+
const offset = this.maxLabelOffset();
|
|
771
733
|
box[axis + 1] -= offset.start;
|
|
772
734
|
box[axis + 2] += offset.end;
|
|
773
735
|
} else {
|
|
774
736
|
if (labels[0].options.visible) {
|
|
775
737
|
box.wrap(labels[0].box);
|
|
776
738
|
}
|
|
777
|
-
|
|
739
|
+
const lastLabel = labels[labels.length - 1];
|
|
778
740
|
if (lastLabel.options.visible) {
|
|
779
741
|
box.wrap(lastLabel.box);
|
|
780
742
|
}
|
|
@@ -782,27 +744,23 @@ var Axis = (function (ChartElement) {
|
|
|
782
744
|
}
|
|
783
745
|
|
|
784
746
|
return box;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
for (var idx = 0; idx < labels.length; idx++) {
|
|
803
|
-
var label = labels[idx];
|
|
804
|
-
var tickIx = this$1.labelTickIndex(label);
|
|
805
|
-
var startTick = (void 0), endTick = (void 0);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
maxLabelOffset() {
|
|
750
|
+
const { vertical, reverse } = this.options;
|
|
751
|
+
const labelsBetweenTicks = this.labelsBetweenTicks();
|
|
752
|
+
const tickPositions = this.getLabelsTickPositions();
|
|
753
|
+
const offsetField = vertical ? Y : X;
|
|
754
|
+
const labels = this.labels;
|
|
755
|
+
const startPosition = reverse ? 1 : 0;
|
|
756
|
+
const endPosition = reverse ? 0 : 1;
|
|
757
|
+
let maxStartOffset = 0;
|
|
758
|
+
let maxEndOffset = 0;
|
|
759
|
+
|
|
760
|
+
for (let idx = 0; idx < labels.length; idx++) {
|
|
761
|
+
const label = labels[idx];
|
|
762
|
+
const tickIx = this.labelTickIndex(label);
|
|
763
|
+
let startTick, endTick;
|
|
806
764
|
|
|
807
765
|
if (labelsBetweenTicks) {
|
|
808
766
|
startTick = tickPositions[tickIx + startPosition];
|
|
@@ -819,10 +777,10 @@ var Axis = (function (ChartElement) {
|
|
|
819
777
|
start: maxStartOffset,
|
|
820
778
|
end: maxEndOffset
|
|
821
779
|
};
|
|
822
|
-
}
|
|
780
|
+
}
|
|
823
781
|
|
|
824
|
-
|
|
825
|
-
|
|
782
|
+
limitRange(from, to, min, max, offset) {
|
|
783
|
+
const options = this.options;
|
|
826
784
|
|
|
827
785
|
if ((from < min && offset < 0 && (!defined(options.min) || options.min <= min)) || (max < to && offset > 0 && (!defined(options.max) || max <= options.max))) {
|
|
828
786
|
return null;
|
|
@@ -835,9 +793,9 @@ var Axis = (function (ChartElement) {
|
|
|
835
793
|
};
|
|
836
794
|
}
|
|
837
795
|
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
796
|
+
const rangeSize = to - from;
|
|
797
|
+
let minValue = from;
|
|
798
|
+
let maxValue = to;
|
|
841
799
|
|
|
842
800
|
if (from < min && offset < 0) {
|
|
843
801
|
minValue = limitValue(from, min, max);
|
|
@@ -851,73 +809,65 @@ var Axis = (function (ChartElement) {
|
|
|
851
809
|
min: minValue,
|
|
852
810
|
max: maxValue
|
|
853
811
|
};
|
|
854
|
-
}
|
|
812
|
+
}
|
|
855
813
|
|
|
856
|
-
|
|
814
|
+
valueRange() {
|
|
857
815
|
return {
|
|
858
816
|
min: this.seriesMin,
|
|
859
817
|
max: this.seriesMax
|
|
860
818
|
};
|
|
861
|
-
}
|
|
819
|
+
}
|
|
862
820
|
|
|
863
|
-
|
|
821
|
+
lineDir() {
|
|
864
822
|
/*
|
|
865
823
|
* Axis line direction:
|
|
866
824
|
* * Vertical: up.
|
|
867
825
|
* * Horizontal: right.
|
|
868
826
|
*/
|
|
869
827
|
|
|
870
|
-
|
|
871
|
-
var vertical = ref.vertical;
|
|
872
|
-
var reverse = ref.reverse;
|
|
828
|
+
const { vertical, reverse } = this.options;
|
|
873
829
|
return (vertical ? -1 : 1) * (reverse ? -1 : 1);
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
var lineStart = lineBox[axisOrigin];
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
lineInfo() {
|
|
833
|
+
const { vertical } = this.options;
|
|
834
|
+
const lineBox = this.lineBox();
|
|
835
|
+
const lineSize = vertical ? lineBox.height() : lineBox.width();
|
|
836
|
+
const axis = vertical ? Y : X;
|
|
837
|
+
const axisDir = this.lineDir();
|
|
838
|
+
const startEdge = axisDir === 1 ? 1 : 2;
|
|
839
|
+
const axisOrigin = axis + startEdge.toString();
|
|
840
|
+
const lineStart = lineBox[axisOrigin];
|
|
886
841
|
|
|
887
842
|
return {
|
|
888
|
-
axis
|
|
889
|
-
axisOrigin
|
|
890
|
-
axisDir
|
|
891
|
-
lineBox
|
|
892
|
-
lineSize
|
|
893
|
-
lineStart
|
|
843
|
+
axis,
|
|
844
|
+
axisOrigin,
|
|
845
|
+
axisDir,
|
|
846
|
+
lineBox,
|
|
847
|
+
lineSize,
|
|
848
|
+
lineStart
|
|
894
849
|
};
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
var axisOrigin = ref.axisOrigin;
|
|
902
|
-
var lineBox = ref.lineBox;
|
|
903
|
-
var lineSize = ref.lineSize;
|
|
904
|
-
var relative = axisDir > 0 ? point[axis] - lineBox[axisOrigin] : lineBox[axisOrigin] - point[axis];
|
|
905
|
-
var offset = relative / lineSize;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
pointOffset(point) {
|
|
853
|
+
const { axis, axisDir, axisOrigin, lineBox, lineSize } = this.lineInfo();
|
|
854
|
+
const relative = axisDir > 0 ? point[axis] - lineBox[axisOrigin] : lineBox[axisOrigin] - point[axis];
|
|
855
|
+
const offset = relative / lineSize;
|
|
906
856
|
|
|
907
857
|
return offset;
|
|
908
|
-
}
|
|
858
|
+
}
|
|
909
859
|
|
|
910
860
|
// Computes the axis range change (delta) for a given scale factor.
|
|
911
861
|
// The delta is subtracted from the axis range:
|
|
912
862
|
// * delta > 0 reduces the axis range (zoom-in)
|
|
913
863
|
// * delta < 0 expands the axis range (zoom-out)
|
|
914
|
-
|
|
864
|
+
scaleToDelta(rawScale, range) {
|
|
915
865
|
// Scale >= 1 would result in axis range of 0.
|
|
916
866
|
// Scale <= -1 would reverse the scale direction.
|
|
917
|
-
|
|
918
|
-
|
|
867
|
+
const MAX_SCALE = 0.999;
|
|
868
|
+
const scale = limitValue(rawScale, -MAX_SCALE, MAX_SCALE);
|
|
919
869
|
|
|
920
|
-
|
|
870
|
+
let delta;
|
|
921
871
|
if (scale > 0) {
|
|
922
872
|
delta = range * Math.min(1, scale);
|
|
923
873
|
} else {
|
|
@@ -925,18 +875,16 @@ var Axis = (function (ChartElement) {
|
|
|
925
875
|
}
|
|
926
876
|
|
|
927
877
|
return delta;
|
|
928
|
-
}
|
|
878
|
+
}
|
|
929
879
|
|
|
930
|
-
|
|
880
|
+
labelsBetweenTicks() {
|
|
931
881
|
return !this.options.justified;
|
|
932
|
-
}
|
|
882
|
+
}
|
|
933
883
|
|
|
934
884
|
//add legacy fields to the options that are no longer generated by default
|
|
935
|
-
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
return Axis;
|
|
939
|
-
}(ChartElement));
|
|
885
|
+
prepareUserOptions() {
|
|
886
|
+
}
|
|
887
|
+
}
|
|
940
888
|
|
|
941
889
|
setDefaultOptions(Axis, {
|
|
942
890
|
labels: {
|