@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/chart/chart.js
CHANGED
|
@@ -33,24 +33,21 @@ import './animations';
|
|
|
33
33
|
import './register-charts';
|
|
34
34
|
import { parseDateCategory } from './utils';
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if ( context === void 0 ) context = {};
|
|
52
|
-
|
|
53
|
-
Class.call(this);
|
|
36
|
+
const AXIS_NAMES = [ CATEGORY, VALUE, X, Y ];
|
|
37
|
+
|
|
38
|
+
const MOUSEDOWN = "mousedown";
|
|
39
|
+
const MOUSEMOVE = "mousemove";
|
|
40
|
+
const CONTEXTMENU = "contextmenu";
|
|
41
|
+
const MOUSELEAVE = "mouseleave";
|
|
42
|
+
const KEYDOWN = "keydown";
|
|
43
|
+
const FOCUS = "focus";
|
|
44
|
+
const BLUR = "blur";
|
|
45
|
+
const MOUSEMOVE_DELAY = 20;
|
|
46
|
+
const NO_DATA_OVERLAY_TOP_CLASS = "k-chart-overlay-top";
|
|
47
|
+
|
|
48
|
+
class Chart extends Class {
|
|
49
|
+
constructor(element, userOptions, themeOptions, context = {}) {
|
|
50
|
+
super();
|
|
54
51
|
|
|
55
52
|
this.observers = [];
|
|
56
53
|
this.addObserver(context.observer);
|
|
@@ -59,7 +56,7 @@ var Chart = (function (Class) {
|
|
|
59
56
|
|
|
60
57
|
this._initElement(element);
|
|
61
58
|
|
|
62
|
-
|
|
59
|
+
const options = deepExtend({}, this.options, userOptions);
|
|
63
60
|
this._originalOptions = deepExtend({}, options);
|
|
64
61
|
this._theme = themeOptions;
|
|
65
62
|
this._initTheme(options, themeOptions);
|
|
@@ -69,32 +66,26 @@ var Chart = (function (Class) {
|
|
|
69
66
|
this._initSurface();
|
|
70
67
|
|
|
71
68
|
this.bindCategories();
|
|
72
|
-
FontLoader.preloadFonts(userOptions,
|
|
73
|
-
this
|
|
74
|
-
if (!this
|
|
75
|
-
this
|
|
76
|
-
this
|
|
77
|
-
this
|
|
78
|
-
this
|
|
69
|
+
FontLoader.preloadFonts(userOptions, () => {
|
|
70
|
+
this.fontLoaded = true;
|
|
71
|
+
if (!this._destroyed) {
|
|
72
|
+
this.trigger('init');
|
|
73
|
+
this._redraw();
|
|
74
|
+
this._attachEvents();
|
|
75
|
+
this._restoreOverlayElement();
|
|
79
76
|
}
|
|
80
77
|
});
|
|
81
78
|
}
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
Chart.prototype = Object.create( Class && Class.prototype );
|
|
85
|
-
Chart.prototype.constructor = Chart;
|
|
86
|
-
|
|
87
|
-
Chart.prototype._initElement = function _initElement (element) {
|
|
88
|
-
var this$1 = this;
|
|
89
|
-
|
|
80
|
+
_initElement(element) {
|
|
90
81
|
this._setElementClass(element);
|
|
91
82
|
element.style.position = "relative";
|
|
92
83
|
element.tabIndex = element.getAttribute("tabindex") ? element.getAttribute("tabindex") : 0;
|
|
93
84
|
// To support user agents and assistive technologies based on the ARIA 1.0 specification, authors may wish to include the document role as a fallback value, in the form role="graphics-document document".
|
|
94
85
|
element.setAttribute("role", "graphics-document document");
|
|
95
86
|
|
|
96
|
-
for (
|
|
97
|
-
|
|
87
|
+
for (let i = element.childNodes.length - 1; i >= 0; i--) {
|
|
88
|
+
const child = element.childNodes[i];
|
|
98
89
|
|
|
99
90
|
if (!hasClasses(child, "k-chart-overlay")) {
|
|
100
91
|
element.removeChild(child);
|
|
@@ -102,18 +93,18 @@ var Chart = (function (Class) {
|
|
|
102
93
|
// this is necessary if the overlay is rendered server-side, e.g. in blazor
|
|
103
94
|
// but drawing the surface clears the contents of the element
|
|
104
95
|
// and thus the no data overlay is lost
|
|
105
|
-
this
|
|
96
|
+
this.overlayElement = child;
|
|
106
97
|
}
|
|
107
98
|
}
|
|
108
99
|
|
|
109
100
|
this.element = element;
|
|
110
|
-
}
|
|
101
|
+
}
|
|
111
102
|
|
|
112
|
-
|
|
103
|
+
_setElementClass(element) {
|
|
113
104
|
addClass(element, "k-chart");
|
|
114
|
-
}
|
|
105
|
+
}
|
|
115
106
|
|
|
116
|
-
|
|
107
|
+
_restoreOverlayElement() {
|
|
117
108
|
if (!this.overlayElement) {
|
|
118
109
|
return;
|
|
119
110
|
}
|
|
@@ -133,19 +124,19 @@ var Chart = (function (Class) {
|
|
|
133
124
|
if (this.overlayElement.parentElement !== this.element) {
|
|
134
125
|
this.element.appendChild(this.overlayElement);
|
|
135
126
|
}
|
|
136
|
-
}
|
|
127
|
+
}
|
|
137
128
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
129
|
+
_hasSeriesData() {
|
|
130
|
+
const series = this.options.series || [];
|
|
131
|
+
const hasData = series.length > 0 && series.some(x => x.data && x.data.length > 0);
|
|
141
132
|
return hasData;
|
|
142
|
-
}
|
|
133
|
+
}
|
|
143
134
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
135
|
+
_initTheme(options, themeOptions) {
|
|
136
|
+
const seriesCopies = [];
|
|
137
|
+
const series = options.series || [];
|
|
147
138
|
|
|
148
|
-
for (
|
|
139
|
+
for (let i = 0; i < series.length; i++) {
|
|
149
140
|
seriesCopies.push(Object.assign({}, series[i]));
|
|
150
141
|
}
|
|
151
142
|
options.series = seriesCopies;
|
|
@@ -164,89 +155,89 @@ var Chart = (function (Class) {
|
|
|
164
155
|
|
|
165
156
|
this.options = deepExtend({}, themeOptions, options);
|
|
166
157
|
this.applySeriesColors();
|
|
167
|
-
}
|
|
158
|
+
}
|
|
168
159
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
160
|
+
getSize() {
|
|
161
|
+
const chartArea = this.options.chartArea || {};
|
|
162
|
+
const width = chartArea.width ? parseInt(chartArea.width, 10) : Math.floor(this.element.offsetWidth);
|
|
163
|
+
const height = chartArea.height ? parseInt(chartArea.height, 10) : Math.floor(this.element.offsetHeight);
|
|
173
164
|
|
|
174
165
|
return {
|
|
175
166
|
width: width,
|
|
176
167
|
height: height
|
|
177
168
|
};
|
|
178
|
-
}
|
|
169
|
+
}
|
|
179
170
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
171
|
+
resize(force) {
|
|
172
|
+
const size = this.getSize();
|
|
173
|
+
const currentSize = this._size;
|
|
174
|
+
const hasSize = size.width > 0 || size.height > 0;
|
|
184
175
|
|
|
185
176
|
if (force || hasSize && (!currentSize || size.width !== currentSize.width || size.height !== currentSize.height)) {
|
|
186
177
|
this._size = size;
|
|
187
178
|
this._resize(size, force);
|
|
188
179
|
this.trigger("resize", size);
|
|
189
|
-
} else if (hasSize && this._selections && find(this._selections,
|
|
180
|
+
} else if (hasSize && this._selections && find(this._selections, s => !s.visible)) {
|
|
190
181
|
this._destroySelections();
|
|
191
182
|
this._setupSelection();
|
|
192
183
|
}
|
|
193
|
-
}
|
|
184
|
+
}
|
|
194
185
|
|
|
195
|
-
|
|
186
|
+
_resize() {
|
|
196
187
|
this._noTransitionsRedraw();
|
|
197
|
-
}
|
|
188
|
+
}
|
|
198
189
|
|
|
199
|
-
|
|
190
|
+
redraw(paneName) {
|
|
200
191
|
this.applyDefaults(this.options);
|
|
201
192
|
this.applySeriesColors();
|
|
202
193
|
|
|
203
194
|
if (paneName) {
|
|
204
|
-
|
|
205
|
-
|
|
195
|
+
const plotArea = this._model._plotArea;
|
|
196
|
+
const pane = plotArea.findPane(paneName);
|
|
206
197
|
plotArea.redraw(pane);
|
|
207
198
|
} else {
|
|
208
199
|
this._redraw();
|
|
209
200
|
}
|
|
210
|
-
}
|
|
201
|
+
}
|
|
211
202
|
|
|
212
|
-
|
|
203
|
+
getAxis(name) {
|
|
213
204
|
return findAxisByName(name, this._plotArea.axes);
|
|
214
|
-
}
|
|
205
|
+
}
|
|
215
206
|
|
|
216
|
-
|
|
207
|
+
findAxisByName(name) {
|
|
217
208
|
return this.getAxis(name);
|
|
218
|
-
}
|
|
209
|
+
}
|
|
219
210
|
|
|
220
|
-
|
|
221
|
-
|
|
211
|
+
findPaneByName(name) {
|
|
212
|
+
const panes = this._plotArea.panes;
|
|
222
213
|
|
|
223
|
-
for (
|
|
214
|
+
for (let idx = 0; idx < panes.length; idx++) {
|
|
224
215
|
if (panes[idx].options.name === name) {
|
|
225
216
|
return new ChartPane(panes[idx]);
|
|
226
217
|
}
|
|
227
218
|
}
|
|
228
|
-
}
|
|
219
|
+
}
|
|
229
220
|
|
|
230
|
-
|
|
231
|
-
|
|
221
|
+
findPaneByIndex(idx) {
|
|
222
|
+
const panes = this._plotArea.panes;
|
|
232
223
|
if (panes[idx]) {
|
|
233
224
|
return new ChartPane(panes[idx]);
|
|
234
225
|
}
|
|
235
|
-
}
|
|
226
|
+
}
|
|
236
227
|
|
|
237
|
-
|
|
228
|
+
plotArea() {
|
|
238
229
|
return new ChartPlotArea(this._plotArea);
|
|
239
|
-
}
|
|
230
|
+
}
|
|
240
231
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
232
|
+
toggleHighlight(show, filter) {
|
|
233
|
+
const plotArea = this._plotArea;
|
|
234
|
+
const firstSeries = (plotArea.srcSeries || plotArea.series || [])[0];
|
|
235
|
+
let points;
|
|
245
236
|
|
|
246
237
|
if (isFunction(filter)) {
|
|
247
238
|
points = plotArea.filterPoints(filter);
|
|
248
239
|
} else {
|
|
249
|
-
|
|
240
|
+
let seriesName, categoryName;
|
|
250
241
|
if (isObject(filter)) {
|
|
251
242
|
seriesName = filter.series;
|
|
252
243
|
categoryName = filter.category;
|
|
@@ -266,21 +257,19 @@ var Chart = (function (Class) {
|
|
|
266
257
|
if (points) {
|
|
267
258
|
this.togglePointsHighlight(show, points);
|
|
268
259
|
}
|
|
269
|
-
}
|
|
260
|
+
}
|
|
270
261
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
for (
|
|
262
|
+
togglePointsHighlight(show, points) {
|
|
263
|
+
const highlight = this._highlight;
|
|
264
|
+
for (let idx = 0; idx < points.length; idx++) {
|
|
274
265
|
highlight.togglePointHighlight(points[idx], show);
|
|
275
266
|
}
|
|
276
|
-
}
|
|
267
|
+
}
|
|
277
268
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
var plotArea = ref._plotArea;
|
|
283
|
-
var point, categoryIndex;
|
|
269
|
+
showTooltip(filter) {
|
|
270
|
+
const shared = this._sharedTooltip();
|
|
271
|
+
const { _tooltip: tooltip, _plotArea: plotArea } = this;
|
|
272
|
+
let point, categoryIndex;
|
|
284
273
|
|
|
285
274
|
if (isFunction(filter)) {
|
|
286
275
|
point = plotArea.findPoint(filter);
|
|
@@ -293,23 +282,23 @@ var Chart = (function (Class) {
|
|
|
293
282
|
|
|
294
283
|
if (shared) {
|
|
295
284
|
if (categoryIndex >= 0) {
|
|
296
|
-
|
|
285
|
+
const points = this._plotArea.pointsByCategoryIndex(categoryIndex);
|
|
297
286
|
tooltip.showAt(points);
|
|
298
287
|
}
|
|
299
288
|
} else if (point) {
|
|
300
289
|
tooltip.show(point);
|
|
301
290
|
}
|
|
302
|
-
}
|
|
291
|
+
}
|
|
303
292
|
|
|
304
|
-
|
|
293
|
+
hideTooltip() {
|
|
305
294
|
this._tooltip.hide();
|
|
306
|
-
}
|
|
295
|
+
}
|
|
307
296
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
297
|
+
_initSurface() {
|
|
298
|
+
const surface = this.surface;
|
|
299
|
+
const wrap = this._surfaceWrap();
|
|
311
300
|
|
|
312
|
-
|
|
301
|
+
const chartArea = this.options.chartArea || {};
|
|
313
302
|
if (chartArea.width) {
|
|
314
303
|
elementSize(wrap, { width: chartArea.width });
|
|
315
304
|
}
|
|
@@ -334,14 +323,14 @@ var Chart = (function (Class) {
|
|
|
334
323
|
|
|
335
324
|
// Override the surface _kendoExportVisual in order to accept export options with size.
|
|
336
325
|
this.element._kendoExportVisual = this._kendoExportVisual.bind(this);
|
|
337
|
-
}
|
|
326
|
+
}
|
|
338
327
|
|
|
339
|
-
|
|
328
|
+
_surfaceWrap() {
|
|
340
329
|
return this.element;
|
|
341
|
-
}
|
|
330
|
+
}
|
|
342
331
|
|
|
343
|
-
|
|
344
|
-
|
|
332
|
+
_redraw() {
|
|
333
|
+
const model = this._getModel();
|
|
345
334
|
this._size = {
|
|
346
335
|
width: model.options.width,
|
|
347
336
|
height: model.options.height
|
|
@@ -392,42 +381,39 @@ var Chart = (function (Class) {
|
|
|
392
381
|
}
|
|
393
382
|
|
|
394
383
|
this._redrawFocusHighlight();
|
|
395
|
-
}
|
|
384
|
+
}
|
|
396
385
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
this.element.style.setProperty('--kendo-chart-computed-title-height',
|
|
400
|
-
}
|
|
386
|
+
_setComputedStyles() {
|
|
387
|
+
const titleHeight = this.titleHeight();
|
|
388
|
+
this.element.style.setProperty('--kendo-chart-computed-title-height', `${titleHeight}px`);
|
|
389
|
+
}
|
|
401
390
|
|
|
402
|
-
|
|
391
|
+
_redrawFocusHighlight() {
|
|
403
392
|
if (this._destroyed) {
|
|
404
393
|
return;
|
|
405
394
|
}
|
|
406
395
|
|
|
407
|
-
|
|
408
|
-
var ref_focusState = ref._focusState;
|
|
409
|
-
var legendInFocus = ref_focusState.legendInFocus;
|
|
410
|
-
var preserveHighlight = ref_focusState.preserveHighlight;
|
|
396
|
+
const { _focusState: { legendInFocus, preserveHighlight } } = this;
|
|
411
397
|
|
|
412
398
|
if (legendInFocus && preserveHighlight) {
|
|
413
399
|
this._focusElement(this._getFocusedLegendItem(), false);
|
|
414
400
|
this._focusState.preserveHighlight = false;
|
|
415
401
|
}
|
|
416
|
-
}
|
|
402
|
+
}
|
|
417
403
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
404
|
+
_setElementAccessibilityAttributes() {
|
|
405
|
+
let titleOptions = this.options.title;
|
|
406
|
+
let title = isString(titleOptions) ? titleOptions : (titleOptions.description || titleOptions.text);
|
|
421
407
|
|
|
422
408
|
if (title) {
|
|
423
409
|
this.element.setAttribute("aria-roledescription", title);
|
|
424
410
|
}
|
|
425
|
-
}
|
|
411
|
+
}
|
|
426
412
|
|
|
427
|
-
|
|
413
|
+
_kendoExportVisual(size) {
|
|
428
414
|
if (size && size.width && size.height) {
|
|
429
|
-
|
|
430
|
-
|
|
415
|
+
const chartArea = this._originalOptions.chartArea || {};
|
|
416
|
+
const exportOptions = {
|
|
431
417
|
width: chartArea.width || size.width,
|
|
432
418
|
height: chartArea.height || size.height
|
|
433
419
|
};
|
|
@@ -436,13 +422,13 @@ var Chart = (function (Class) {
|
|
|
436
422
|
}
|
|
437
423
|
|
|
438
424
|
return this.exportVisual();
|
|
439
|
-
}
|
|
425
|
+
}
|
|
440
426
|
|
|
441
|
-
|
|
442
|
-
|
|
427
|
+
exportVisual(exportOptions) {
|
|
428
|
+
let visual;
|
|
443
429
|
if (exportOptions && (exportOptions.width || exportOptions.height || exportOptions.options)) {
|
|
444
|
-
|
|
445
|
-
|
|
430
|
+
const currentOptions = this.options;
|
|
431
|
+
const options = deepExtend({}, exportOptions.options, {
|
|
446
432
|
chartArea: {
|
|
447
433
|
width: exportOptions.width,
|
|
448
434
|
height: exportOptions.height
|
|
@@ -454,7 +440,7 @@ var Chart = (function (Class) {
|
|
|
454
440
|
this._initTheme(this.options, this._theme);
|
|
455
441
|
this.bindCategories();
|
|
456
442
|
|
|
457
|
-
|
|
443
|
+
const model = this._getModel();
|
|
458
444
|
|
|
459
445
|
model.renderVisual();
|
|
460
446
|
triggerPaneRender(model._plotArea.panes);
|
|
@@ -467,43 +453,43 @@ var Chart = (function (Class) {
|
|
|
467
453
|
}
|
|
468
454
|
|
|
469
455
|
return visual;
|
|
470
|
-
}
|
|
456
|
+
}
|
|
471
457
|
|
|
472
|
-
|
|
458
|
+
_sharedTooltip() {
|
|
473
459
|
return this._plotArea instanceof CategoricalPlotArea && this.options.tooltip && this.options.tooltip.shared;
|
|
474
|
-
}
|
|
460
|
+
}
|
|
475
461
|
|
|
476
|
-
|
|
477
|
-
|
|
462
|
+
_createPannable() {
|
|
463
|
+
const options = this.options;
|
|
478
464
|
if (options.pannable !== false) {
|
|
479
465
|
this._pannable = new Pannable(this._plotArea, options.pannable);
|
|
480
466
|
}
|
|
481
|
-
}
|
|
467
|
+
}
|
|
482
468
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
469
|
+
_createZoomSelection() {
|
|
470
|
+
const zoomable = this.options.zoomable;
|
|
471
|
+
const selection = (zoomable || {}).selection;
|
|
486
472
|
if (zoomable !== false && selection !== false) {
|
|
487
473
|
this._zoomSelection = new ZoomSelection(this, selection);
|
|
488
474
|
}
|
|
489
|
-
}
|
|
475
|
+
}
|
|
490
476
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
477
|
+
_createMousewheelZoom() {
|
|
478
|
+
const zoomable = this.options.zoomable;
|
|
479
|
+
const mousewheel = (zoomable || {}).mousewheel;
|
|
494
480
|
if (zoomable !== false && mousewheel !== false) {
|
|
495
481
|
this._mousewheelZoom = new MousewheelZoom(this, mousewheel);
|
|
496
482
|
}
|
|
497
|
-
}
|
|
483
|
+
}
|
|
498
484
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
485
|
+
_toggleDragZoomEvents() {
|
|
486
|
+
const pannable = this.options.pannable;
|
|
487
|
+
const zoomable = this.options.zoomable;
|
|
488
|
+
const selection = (zoomable || {}).selection;
|
|
489
|
+
const mousewheel = (zoomable || {}).mousewheel;
|
|
490
|
+
const allowDrag = !pannable && (zoomable === false || selection === false) && !this.requiresHandlers([ DRAG_START, DRAG, DRAG_END ]);
|
|
491
|
+
const allowZoom = (zoomable === false || mousewheel === false) && !this.requiresHandlers([ ZOOM_START, ZOOM, ZOOM_END ]);
|
|
492
|
+
const element = this.element;
|
|
507
493
|
|
|
508
494
|
if (this._dragZoomEnabled && allowDrag && allowZoom) {
|
|
509
495
|
element.style.touchAction = this._touchAction || '';
|
|
@@ -515,10 +501,10 @@ var Chart = (function (Class) {
|
|
|
515
501
|
}
|
|
516
502
|
|
|
517
503
|
this._toggleDomEvents(!allowDrag, !allowZoom);
|
|
518
|
-
}
|
|
504
|
+
}
|
|
519
505
|
|
|
520
|
-
|
|
521
|
-
|
|
506
|
+
_toggleDomEvents(drag, zoom) {
|
|
507
|
+
const domEvents = this.domEvents;
|
|
522
508
|
if (!domEvents) {
|
|
523
509
|
return;
|
|
524
510
|
}
|
|
@@ -530,12 +516,11 @@ var Chart = (function (Class) {
|
|
|
530
516
|
if (domEvents.toggleZoom) {
|
|
531
517
|
domEvents.toggleZoom(zoom);
|
|
532
518
|
}
|
|
533
|
-
}
|
|
519
|
+
}
|
|
534
520
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
var tooltip;
|
|
521
|
+
_createTooltip() {
|
|
522
|
+
const { options: { tooltip: tooltipOptions } } = this;
|
|
523
|
+
let tooltip;
|
|
539
524
|
|
|
540
525
|
if (this._sharedTooltip()) {
|
|
541
526
|
tooltip = this._createSharedTooltip(tooltipOptions);
|
|
@@ -544,50 +529,50 @@ var Chart = (function (Class) {
|
|
|
544
529
|
}
|
|
545
530
|
|
|
546
531
|
return tooltip;
|
|
547
|
-
}
|
|
532
|
+
}
|
|
548
533
|
|
|
549
|
-
|
|
534
|
+
_createSharedTooltip(options) {
|
|
550
535
|
return new SharedTooltip(this._plotArea, options);
|
|
551
|
-
}
|
|
536
|
+
}
|
|
552
537
|
|
|
553
|
-
|
|
538
|
+
applyDefaults(options, themeOptions) {
|
|
554
539
|
applyAxisDefaults(options, themeOptions);
|
|
555
540
|
applySeriesDefaults(options, themeOptions);
|
|
556
|
-
}
|
|
541
|
+
}
|
|
557
542
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
543
|
+
applySeriesColors() {
|
|
544
|
+
const options = this.options;
|
|
545
|
+
const series = options.series;
|
|
546
|
+
const colors = options.seriesColors || [];
|
|
562
547
|
|
|
563
|
-
for (
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
548
|
+
for (let i = 0; i < series.length; i++) {
|
|
549
|
+
const currentSeries = series[i];
|
|
550
|
+
const seriesColor = colors[i % colors.length];
|
|
551
|
+
const defaults = currentSeries._defaults;
|
|
567
552
|
|
|
568
553
|
currentSeries.color = currentSeries.color || seriesColor;
|
|
569
554
|
if (defaults) {
|
|
570
555
|
defaults.color = defaults.color || seriesColor;
|
|
571
556
|
}
|
|
572
557
|
}
|
|
573
|
-
}
|
|
558
|
+
}
|
|
574
559
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
560
|
+
_getModel() {
|
|
561
|
+
const options = this.options;
|
|
562
|
+
const plotArea = this._createPlotArea();
|
|
563
|
+
const model = new RootElement(this._modelOptions());
|
|
579
564
|
model.chart = this;
|
|
580
565
|
model._plotArea = plotArea;
|
|
581
566
|
|
|
582
|
-
|
|
583
|
-
|
|
567
|
+
const title = Title.buildTitle(options.title);
|
|
568
|
+
const subtitle = Title.buildTitle(options.subtitle, {
|
|
584
569
|
align: options.title.align,
|
|
585
570
|
position: options.title.position
|
|
586
571
|
});
|
|
587
572
|
model.append.apply(model, Title.orderTitles([title, subtitle]));
|
|
588
573
|
|
|
589
574
|
if (options.legend && options.legend.visible) {
|
|
590
|
-
|
|
575
|
+
const legend = new Legend(plotArea.options.legend, this.chartService);
|
|
591
576
|
model.append(legend);
|
|
592
577
|
model._legend = legend;
|
|
593
578
|
}
|
|
@@ -597,81 +582,78 @@ var Chart = (function (Class) {
|
|
|
597
582
|
this._setTitleBox(title, subtitle);
|
|
598
583
|
|
|
599
584
|
return model;
|
|
600
|
-
}
|
|
585
|
+
}
|
|
601
586
|
|
|
602
|
-
|
|
587
|
+
_setTitleBox(title, subtitle) {
|
|
603
588
|
if (!title && !subtitle) {
|
|
604
589
|
return;
|
|
605
590
|
}
|
|
606
591
|
|
|
607
592
|
this._titleBox = (title || subtitle).box.clone();
|
|
608
593
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
594
|
+
const titlePosition = title ? title.options.position : '';
|
|
595
|
+
const subtitlePosition = subtitle ? subtitle.options.position : '';
|
|
596
|
+
const samePosition = titlePosition === subtitlePosition;
|
|
597
|
+
const subtitleAtTop = subtitlePosition !== BOTTOM;
|
|
613
598
|
|
|
614
599
|
if (samePosition && subtitle) {
|
|
615
600
|
this._titleBox.wrap(subtitle.box);
|
|
616
601
|
} else if (title && subtitle && subtitleAtTop) {
|
|
617
602
|
this._titleBox = subtitle.box.clone();
|
|
618
603
|
}
|
|
619
|
-
}
|
|
604
|
+
}
|
|
620
605
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
606
|
+
_modelOptions() {
|
|
607
|
+
const options = this.options;
|
|
608
|
+
const size = this.getSize();
|
|
624
609
|
|
|
625
610
|
return deepExtend({
|
|
626
611
|
transitions: options.transitions,
|
|
627
612
|
width: size.width || DEFAULT_WIDTH,
|
|
628
613
|
height: size.height || DEFAULT_HEIGHT
|
|
629
614
|
}, options.chartArea);
|
|
630
|
-
}
|
|
615
|
+
}
|
|
631
616
|
|
|
632
|
-
|
|
633
|
-
|
|
617
|
+
_createPlotArea(skipSeries) {
|
|
618
|
+
const options = this.options;
|
|
634
619
|
|
|
635
|
-
|
|
620
|
+
const plotArea = PlotAreaFactory.current.create(skipSeries ? [] : options.series, options, this.chartService);
|
|
636
621
|
|
|
637
622
|
return plotArea;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
Chart.prototype._setupSelection = function _setupSelection () {
|
|
641
|
-
var this$1 = this;
|
|
623
|
+
}
|
|
642
624
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
625
|
+
_setupSelection() {
|
|
626
|
+
const { _plotArea: { axes } } = this;
|
|
627
|
+
const selections = this._selections = [];
|
|
646
628
|
|
|
647
|
-
for (
|
|
648
|
-
|
|
649
|
-
|
|
629
|
+
for (let i = 0; i < axes.length; i++) {
|
|
630
|
+
const axis = axes[i];
|
|
631
|
+
const options = axis.options;
|
|
650
632
|
if (axis instanceof CategoryAxis && options.select && !options.vertical) {
|
|
651
|
-
|
|
633
|
+
const range = axis.range();
|
|
652
634
|
|
|
653
|
-
|
|
635
|
+
const selection = new Selection(this, axis,
|
|
654
636
|
deepExtend({ min: range.min, max: range.max }, options.select)
|
|
655
637
|
);
|
|
656
638
|
|
|
657
639
|
selections.push(selection);
|
|
658
640
|
}
|
|
659
641
|
}
|
|
660
|
-
}
|
|
642
|
+
}
|
|
661
643
|
|
|
662
|
-
|
|
644
|
+
_selectStart(e) {
|
|
663
645
|
return this.trigger(SELECT_START, e);
|
|
664
|
-
}
|
|
646
|
+
}
|
|
665
647
|
|
|
666
|
-
|
|
648
|
+
_select(e) {
|
|
667
649
|
return this.trigger(SELECT, e);
|
|
668
|
-
}
|
|
650
|
+
}
|
|
669
651
|
|
|
670
|
-
|
|
652
|
+
_selectEnd(e) {
|
|
671
653
|
return this.trigger(SELECT_END, e);
|
|
672
|
-
}
|
|
654
|
+
}
|
|
673
655
|
|
|
674
|
-
|
|
656
|
+
_initHandlers() {
|
|
675
657
|
this._clickHandler = this._click.bind(this);
|
|
676
658
|
this._keydownHandler = this._keydown.bind(this);
|
|
677
659
|
this._focusHandler = this._focus.bind(this);
|
|
@@ -686,33 +668,31 @@ var Chart = (function (Class) {
|
|
|
686
668
|
this._mousemove.bind(this),
|
|
687
669
|
MOUSEMOVE_DELAY
|
|
688
670
|
);
|
|
689
|
-
}
|
|
671
|
+
}
|
|
690
672
|
|
|
691
|
-
|
|
673
|
+
addObserver(observer) {
|
|
692
674
|
if (observer) {
|
|
693
675
|
this.observers.push(observer);
|
|
694
676
|
}
|
|
695
|
-
}
|
|
677
|
+
}
|
|
696
678
|
|
|
697
|
-
|
|
698
|
-
|
|
679
|
+
removeObserver(observer) {
|
|
680
|
+
const index = this.observers.indexOf(observer);
|
|
699
681
|
if (index >= 0) {
|
|
700
682
|
this.observers.splice(index, 1);
|
|
701
683
|
}
|
|
702
|
-
}
|
|
684
|
+
}
|
|
703
685
|
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
for (
|
|
686
|
+
requiresHandlers(eventNames) {
|
|
687
|
+
const observers = this.observers;
|
|
688
|
+
for (let idx = 0; idx < observers.length; idx++) {
|
|
707
689
|
if (observers[idx].requiresHandlers(eventNames)) {
|
|
708
690
|
return true;
|
|
709
691
|
}
|
|
710
692
|
}
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
Chart.prototype.trigger = function trigger (name, args) {
|
|
714
|
-
if ( args === void 0 ) args = {};
|
|
693
|
+
}
|
|
715
694
|
|
|
695
|
+
trigger(name, args = {}) {
|
|
716
696
|
args.sender = this;
|
|
717
697
|
|
|
718
698
|
if (name === SHOW_TOOLTIP) {
|
|
@@ -728,36 +708,42 @@ var Chart = (function (Class) {
|
|
|
728
708
|
this._focusLegendItem(args);
|
|
729
709
|
}
|
|
730
710
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
for (
|
|
711
|
+
const observers = this.observers;
|
|
712
|
+
let isDefaultPrevented = false;
|
|
713
|
+
for (let idx = 0; idx < observers.length; idx++) {
|
|
734
714
|
if (observers[idx].trigger(name, args)) {
|
|
735
715
|
isDefaultPrevented = true;
|
|
736
716
|
}
|
|
737
717
|
}
|
|
738
718
|
|
|
739
719
|
return isDefaultPrevented;
|
|
740
|
-
}
|
|
720
|
+
}
|
|
741
721
|
|
|
742
|
-
|
|
722
|
+
titleHeight() {
|
|
743
723
|
if (!this._titleBox) {
|
|
744
724
|
return 0;
|
|
745
725
|
}
|
|
746
726
|
|
|
747
727
|
return this._titleBox.height();
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
Chart.prototype._attachEvents = function _attachEvents () {
|
|
751
|
-
var obj, obj$1;
|
|
728
|
+
}
|
|
752
729
|
|
|
753
|
-
|
|
730
|
+
_attachEvents() {
|
|
731
|
+
const element = this.element;
|
|
754
732
|
|
|
755
733
|
this._touchAction = element.style.touchAction;
|
|
756
734
|
|
|
757
|
-
bindEvents(element,
|
|
735
|
+
bindEvents(element, {
|
|
736
|
+
[ CONTEXTMENU ]: this._clickHandler,
|
|
737
|
+
[ MOUSEWHEEL ]: this._mousewheelHandler,
|
|
738
|
+
[ MOUSELEAVE ]: this._mouseleaveHandler,
|
|
739
|
+
[ KEYDOWN ]: this._keydownHandler,
|
|
740
|
+
[ MOUSEDOWN ]: this._mousedownHandler,
|
|
741
|
+
[ FOCUS ]: this._focusHandler,
|
|
742
|
+
[ BLUR]: this._blurHandler
|
|
743
|
+
});
|
|
758
744
|
|
|
759
745
|
if (this._shouldAttachMouseMove()) {
|
|
760
|
-
bindEvents(element,
|
|
746
|
+
bindEvents(element, { [ MOUSEMOVE ]: this._mousemoveThrottled });
|
|
761
747
|
}
|
|
762
748
|
|
|
763
749
|
this.domEvents = DomEventsBuilder.create(this.element, {
|
|
@@ -771,9 +757,9 @@ var Chart = (function (Class) {
|
|
|
771
757
|
});
|
|
772
758
|
|
|
773
759
|
this._toggleDragZoomEvents();
|
|
774
|
-
}
|
|
760
|
+
}
|
|
775
761
|
|
|
776
|
-
|
|
762
|
+
_mouseleave(e) {
|
|
777
763
|
if (this._hoveredPoint) {
|
|
778
764
|
this._hoveredPoint.out(this, e);
|
|
779
765
|
this._hoveredPoint = null;
|
|
@@ -788,24 +774,24 @@ var Chart = (function (Class) {
|
|
|
788
774
|
this._applySeriesOpacity(this._activeChartInstance.children, null, true);
|
|
789
775
|
this._updateSeriesOpacity(null, true);
|
|
790
776
|
}
|
|
791
|
-
}
|
|
777
|
+
}
|
|
792
778
|
|
|
793
|
-
|
|
779
|
+
_cancelDomEvents() {
|
|
794
780
|
if (this.domEvents && this.domEvents.cancel) {
|
|
795
781
|
this.domEvents.cancel();
|
|
796
782
|
}
|
|
797
|
-
}
|
|
783
|
+
}
|
|
798
784
|
|
|
799
|
-
|
|
785
|
+
_gesturestart(e) {
|
|
800
786
|
if (this._mousewheelZoom && !this._stopChartHandlers(e)) {
|
|
801
787
|
this._gestureDistance = e.distance;
|
|
802
788
|
this._unsetActivePoint();
|
|
803
789
|
this._clearFocusedElement();
|
|
804
790
|
this.surface.suspendTracking();
|
|
805
791
|
}
|
|
806
|
-
}
|
|
792
|
+
}
|
|
807
793
|
|
|
808
|
-
|
|
794
|
+
_gestureend(e) {
|
|
809
795
|
if (this._zooming && !this._stopChartHandlers(e)) {
|
|
810
796
|
if (this.surface) {
|
|
811
797
|
this.surface.resumeTracking();
|
|
@@ -813,49 +799,49 @@ var Chart = (function (Class) {
|
|
|
813
799
|
this._zooming = false;
|
|
814
800
|
this.trigger(ZOOM_END, {});
|
|
815
801
|
}
|
|
816
|
-
}
|
|
802
|
+
}
|
|
817
803
|
|
|
818
|
-
|
|
819
|
-
|
|
804
|
+
_gesturechange(e) {
|
|
805
|
+
const mousewheelZoom = this._mousewheelZoom;
|
|
820
806
|
|
|
821
807
|
if (mousewheelZoom && !this._stopChartHandlers(e)) {
|
|
822
808
|
e.preventDefault();
|
|
823
|
-
|
|
824
|
-
|
|
809
|
+
const previousGestureDistance = this._gestureDistance;
|
|
810
|
+
let scaleDelta = -e.distance / previousGestureDistance + 1;
|
|
825
811
|
|
|
826
812
|
if (Math.abs(scaleDelta) >= 0.1) {
|
|
827
813
|
scaleDelta = Math.round(scaleDelta * 10);
|
|
828
814
|
|
|
829
815
|
this._gestureDistance = e.distance;
|
|
830
|
-
|
|
816
|
+
const args = { delta: scaleDelta, axisRanges: axisRanges(this._plotArea.axes), originalEvent: e };
|
|
831
817
|
if (this._zooming || !this.trigger(ZOOM_START, args)) {
|
|
832
|
-
|
|
818
|
+
const coords = this._eventCoordinates(e);
|
|
833
819
|
|
|
834
820
|
if (!this._zooming) {
|
|
835
821
|
this._zooming = true;
|
|
836
822
|
}
|
|
837
823
|
|
|
838
|
-
|
|
824
|
+
const ranges = args.axisRanges = mousewheelZoom.updateRanges(scaleDelta, coords);
|
|
839
825
|
if (ranges && !this.trigger(ZOOM, args)) {
|
|
840
826
|
mousewheelZoom.zoom();
|
|
841
827
|
}
|
|
842
828
|
}
|
|
843
829
|
}
|
|
844
830
|
}
|
|
845
|
-
}
|
|
831
|
+
}
|
|
846
832
|
|
|
847
|
-
|
|
833
|
+
_mouseout(e) {
|
|
848
834
|
if (e.element) {
|
|
849
|
-
|
|
835
|
+
const element = this._drawingChartElement(e.element, e);
|
|
850
836
|
|
|
851
837
|
if (element && element.leave) {
|
|
852
838
|
element.leave(this, e.originalEvent);
|
|
853
839
|
}
|
|
854
840
|
}
|
|
855
|
-
}
|
|
841
|
+
}
|
|
856
842
|
|
|
857
|
-
|
|
858
|
-
|
|
843
|
+
_start(e) {
|
|
844
|
+
const coords = this._eventCoordinates(e);
|
|
859
845
|
|
|
860
846
|
if (this._stopChartHandlers(e) || !this._plotArea.backgroundContainsPoint(coords)) {
|
|
861
847
|
return;
|
|
@@ -879,43 +865,41 @@ var Chart = (function (Class) {
|
|
|
879
865
|
this.trigger(ZOOM_START, { axisRanges: axisRanges(this._plotArea.axes), originalEvent: e });
|
|
880
866
|
}
|
|
881
867
|
}
|
|
882
|
-
}
|
|
868
|
+
}
|
|
883
869
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
var state = ref._navState;
|
|
887
|
-
var pannable = ref._pannable;
|
|
870
|
+
_move(e) {
|
|
871
|
+
let { _navState: state, _pannable: pannable } = this;
|
|
888
872
|
|
|
889
873
|
if (this._stopChartHandlers(e)) {
|
|
890
874
|
return;
|
|
891
875
|
}
|
|
892
876
|
|
|
893
877
|
if (pannable) {
|
|
894
|
-
|
|
878
|
+
const ranges = pannable.move(e);
|
|
895
879
|
|
|
896
880
|
if (ranges && !this.trigger(DRAG, { axisRanges: ranges, originalEvent: e })) {
|
|
897
881
|
pannable.pan();
|
|
898
882
|
}
|
|
899
883
|
} else if (state) {
|
|
900
|
-
|
|
901
|
-
|
|
884
|
+
const ranges = {};
|
|
885
|
+
const axes = state.axes;
|
|
902
886
|
|
|
903
|
-
for (
|
|
904
|
-
|
|
905
|
-
|
|
887
|
+
for (let i = 0; i < axes.length; i++) {
|
|
888
|
+
const currentAxis = axes[i];
|
|
889
|
+
const axisName = currentAxis.options.name;
|
|
906
890
|
if (axisName) {
|
|
907
|
-
|
|
908
|
-
|
|
891
|
+
const axis = currentAxis.options.vertical ? e.y : e.x;
|
|
892
|
+
const delta = axis.startLocation - axis.location;
|
|
909
893
|
|
|
910
894
|
if (delta !== 0) {
|
|
911
|
-
ranges
|
|
895
|
+
ranges[currentAxis.options.name] = currentAxis.translateRange(delta);
|
|
912
896
|
}
|
|
913
897
|
}
|
|
914
898
|
}
|
|
915
899
|
|
|
916
|
-
state.axisRanges = ranges
|
|
900
|
+
state.axisRanges = ranges;
|
|
917
901
|
this.trigger(DRAG, {
|
|
918
|
-
axisRanges: ranges
|
|
902
|
+
axisRanges: ranges,
|
|
919
903
|
originalEvent: e
|
|
920
904
|
});
|
|
921
905
|
}
|
|
@@ -923,14 +907,14 @@ var Chart = (function (Class) {
|
|
|
923
907
|
if (this._zoomSelection) {
|
|
924
908
|
this._zoomSelection.move(e);
|
|
925
909
|
}
|
|
926
|
-
}
|
|
910
|
+
}
|
|
927
911
|
|
|
928
|
-
|
|
912
|
+
_end(e) {
|
|
929
913
|
if (this._stopChartHandlers(e)) {
|
|
930
914
|
return;
|
|
931
915
|
}
|
|
932
916
|
|
|
933
|
-
|
|
917
|
+
const pannable = this._pannable;
|
|
934
918
|
if (pannable && pannable.end(e)) {
|
|
935
919
|
this.surface.resumeTracking();
|
|
936
920
|
this.trigger(DRAG_END, {
|
|
@@ -944,50 +928,48 @@ var Chart = (function (Class) {
|
|
|
944
928
|
}
|
|
945
929
|
|
|
946
930
|
if (this._zoomSelection) {
|
|
947
|
-
|
|
931
|
+
const ranges = this._zoomSelection.end(e);
|
|
948
932
|
if (ranges && !this.trigger(ZOOM, { axisRanges: ranges, originalEvent: e })) {
|
|
949
933
|
this._zoomSelection.zoom();
|
|
950
934
|
this.trigger(ZOOM_END, { axisRanges: ranges, originalEvent: e });
|
|
951
935
|
}
|
|
952
936
|
}
|
|
953
|
-
}
|
|
937
|
+
}
|
|
954
938
|
|
|
955
|
-
|
|
956
|
-
|
|
939
|
+
_stopChartHandlers(e) {
|
|
940
|
+
const selections = this._selections || [];
|
|
957
941
|
if (!selections.length) {
|
|
958
942
|
return false;
|
|
959
943
|
}
|
|
960
944
|
|
|
961
|
-
|
|
962
|
-
|
|
945
|
+
const coords = this._eventCoordinates(e);
|
|
946
|
+
const pane = this._plotArea.paneByPoint(coords);
|
|
963
947
|
if (pane) {
|
|
964
|
-
for (
|
|
948
|
+
for (let idx = 0; idx < selections.length; idx++) {
|
|
965
949
|
if (selections[idx].onPane(pane)) {
|
|
966
950
|
return true;
|
|
967
951
|
}
|
|
968
952
|
}
|
|
969
953
|
}
|
|
970
|
-
}
|
|
954
|
+
}
|
|
971
955
|
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
956
|
+
_mousewheelZoomRate() {
|
|
957
|
+
const zoomable = this.options.zoomable;
|
|
958
|
+
const mousewheel = (zoomable || {}).mousewheel || {};
|
|
975
959
|
return valueOrDefault(mousewheel.rate, MOUSEWHEEL_ZOOM_RATE);
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
Chart.prototype._mousewheel = function _mousewheel (e) {
|
|
979
|
-
var this$1 = this;
|
|
960
|
+
}
|
|
980
961
|
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
962
|
+
_mousewheel(e) {
|
|
963
|
+
const delta = mousewheelDelta(e);
|
|
964
|
+
const mousewheelZoom = this._mousewheelZoom;
|
|
965
|
+
const coords = this._eventCoordinates(e);
|
|
984
966
|
|
|
985
967
|
if (this._stopChartHandlers(e) || !this._plotArea.backgroundContainsPoint(coords)) {
|
|
986
968
|
return;
|
|
987
969
|
}
|
|
988
970
|
|
|
989
971
|
if (mousewheelZoom) {
|
|
990
|
-
|
|
972
|
+
const args = { delta: delta, axisRanges: axisRanges(this._plotArea.axes), originalEvent: e };
|
|
991
973
|
if (this._zooming || !this.trigger(ZOOM_START, args)) {
|
|
992
974
|
e.preventDefault();
|
|
993
975
|
|
|
@@ -1007,35 +989,35 @@ var Chart = (function (Class) {
|
|
|
1007
989
|
mousewheelZoom.zoom();
|
|
1008
990
|
}
|
|
1009
991
|
|
|
1010
|
-
this._mwTimeout = setTimeout(
|
|
1011
|
-
this
|
|
1012
|
-
this
|
|
1013
|
-
if (this
|
|
1014
|
-
this
|
|
992
|
+
this._mwTimeout = setTimeout(() => {
|
|
993
|
+
this.trigger(ZOOM_END, args);
|
|
994
|
+
this._zooming = false;
|
|
995
|
+
if (this.surface) {
|
|
996
|
+
this.surface.resumeTracking();
|
|
1015
997
|
}
|
|
1016
998
|
}, MOUSEWHEEL_DELAY);
|
|
1017
999
|
}
|
|
1018
1000
|
} else {
|
|
1019
|
-
|
|
1001
|
+
let state = this._navState;
|
|
1020
1002
|
if (!state) {
|
|
1021
|
-
|
|
1003
|
+
const prevented = this._startNavigation(e, coords, ZOOM_START);
|
|
1022
1004
|
if (!prevented) {
|
|
1023
1005
|
state = this._navState;
|
|
1024
1006
|
}
|
|
1025
1007
|
}
|
|
1026
1008
|
|
|
1027
1009
|
if (state) {
|
|
1028
|
-
|
|
1010
|
+
const totalDelta = state.totalDelta || delta;
|
|
1029
1011
|
state.totalDelta = totalDelta + delta;
|
|
1030
1012
|
|
|
1031
|
-
|
|
1032
|
-
|
|
1013
|
+
const axes = this._navState.axes;
|
|
1014
|
+
const ranges = {};
|
|
1033
1015
|
|
|
1034
|
-
for (
|
|
1035
|
-
|
|
1036
|
-
|
|
1016
|
+
for (let i = 0; i < axes.length; i++) {
|
|
1017
|
+
const currentAxis = axes[i];
|
|
1018
|
+
const axisName = currentAxis.options.name;
|
|
1037
1019
|
if (axisName) {
|
|
1038
|
-
ranges[axisName] = currentAxis.scaleRange(-totalDelta * this
|
|
1020
|
+
ranges[axisName] = currentAxis.scaleRange(-totalDelta * this._mousewheelZoomRate(), coords);
|
|
1039
1021
|
}
|
|
1040
1022
|
}
|
|
1041
1023
|
|
|
@@ -1049,25 +1031,25 @@ var Chart = (function (Class) {
|
|
|
1049
1031
|
clearTimeout(this._mwTimeout);
|
|
1050
1032
|
}
|
|
1051
1033
|
|
|
1052
|
-
this._mwTimeout = setTimeout(
|
|
1053
|
-
this
|
|
1034
|
+
this._mwTimeout = setTimeout(() => {
|
|
1035
|
+
this._endNavigation(e, ZOOM_END);
|
|
1054
1036
|
}, MOUSEWHEEL_DELAY);
|
|
1055
1037
|
}
|
|
1056
1038
|
}
|
|
1057
|
-
}
|
|
1039
|
+
}
|
|
1058
1040
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1041
|
+
_startNavigation(e, coords, chartEvent) {
|
|
1042
|
+
const plotArea = this._model._plotArea;
|
|
1043
|
+
const pane = plotArea.findPointPane(coords);
|
|
1044
|
+
const axes = plotArea.axes.slice(0);
|
|
1063
1045
|
|
|
1064
1046
|
if (!pane) {
|
|
1065
1047
|
return;
|
|
1066
1048
|
}
|
|
1067
1049
|
|
|
1068
|
-
|
|
1050
|
+
const ranges = axisRanges(axes);
|
|
1069
1051
|
|
|
1070
|
-
|
|
1052
|
+
const prevented = this.trigger(chartEvent, {
|
|
1071
1053
|
axisRanges: ranges,
|
|
1072
1054
|
originalEvent: e
|
|
1073
1055
|
});
|
|
@@ -1084,9 +1066,9 @@ var Chart = (function (Class) {
|
|
|
1084
1066
|
axes: axes
|
|
1085
1067
|
};
|
|
1086
1068
|
}
|
|
1087
|
-
}
|
|
1069
|
+
}
|
|
1088
1070
|
|
|
1089
|
-
|
|
1071
|
+
_endNavigation(e, chartEvent) {
|
|
1090
1072
|
if (this._navState) {
|
|
1091
1073
|
this.trigger(chartEvent, {
|
|
1092
1074
|
axisRanges: this._navState.axisRanges,
|
|
@@ -1095,18 +1077,18 @@ var Chart = (function (Class) {
|
|
|
1095
1077
|
this._suppressHover = false;
|
|
1096
1078
|
this._navState = null;
|
|
1097
1079
|
}
|
|
1098
|
-
}
|
|
1080
|
+
}
|
|
1099
1081
|
|
|
1100
|
-
|
|
1101
|
-
|
|
1082
|
+
_getChartElement(e, match) {
|
|
1083
|
+
const element = this.surface.eventTarget(e);
|
|
1102
1084
|
if (element) {
|
|
1103
1085
|
return this._drawingChartElement(element, e, match);
|
|
1104
1086
|
}
|
|
1105
|
-
}
|
|
1087
|
+
}
|
|
1106
1088
|
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1089
|
+
_drawingChartElement(element, e, match) {
|
|
1090
|
+
let current = element;
|
|
1091
|
+
let chartElement;
|
|
1110
1092
|
while (current && !chartElement) {
|
|
1111
1093
|
chartElement = current.chartElement;
|
|
1112
1094
|
current = current.parent;
|
|
@@ -1126,18 +1108,16 @@ var Chart = (function (Class) {
|
|
|
1126
1108
|
|
|
1127
1109
|
return chartElement;
|
|
1128
1110
|
}
|
|
1129
|
-
}
|
|
1111
|
+
}
|
|
1130
1112
|
|
|
1131
|
-
|
|
1132
|
-
|
|
1113
|
+
_eventCoordinates(e) {
|
|
1114
|
+
const coordinates = eventCoordinates(e);
|
|
1133
1115
|
return this._toModelCoordinates(coordinates.x, coordinates.y);
|
|
1134
|
-
}
|
|
1116
|
+
}
|
|
1135
1117
|
|
|
1136
|
-
|
|
1118
|
+
_elementPadding() {
|
|
1137
1119
|
if (!this._padding) {
|
|
1138
|
-
|
|
1139
|
-
var paddingLeft = ref.paddingLeft;
|
|
1140
|
-
var paddingTop = ref.paddingTop;
|
|
1120
|
+
const { paddingLeft, paddingTop } = elementStyles(this.element, [ "paddingLeft", "paddingTop" ]);
|
|
1141
1121
|
this._padding = {
|
|
1142
1122
|
top: paddingTop,
|
|
1143
1123
|
left: paddingLeft
|
|
@@ -1145,39 +1125,37 @@ var Chart = (function (Class) {
|
|
|
1145
1125
|
}
|
|
1146
1126
|
|
|
1147
1127
|
return this._padding;
|
|
1148
|
-
}
|
|
1128
|
+
}
|
|
1149
1129
|
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1130
|
+
_toDocumentCoordinates(point) {
|
|
1131
|
+
const padding = this._elementPadding();
|
|
1132
|
+
const offset = elementOffset(this.element);
|
|
1153
1133
|
|
|
1154
1134
|
return {
|
|
1155
1135
|
left: round(point.x + padding.left + offset.left),
|
|
1156
1136
|
top: round(point.y + padding.top + offset.top)
|
|
1157
1137
|
};
|
|
1158
|
-
}
|
|
1138
|
+
}
|
|
1159
1139
|
|
|
1160
1140
|
// TODO: Breaking change due to peer version change
|
|
1161
1141
|
// Reuse by exposing _surfacePoint on Surface
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1142
|
+
_toModelCoordinates(clientX, clientY) {
|
|
1143
|
+
const element = this.element;
|
|
1144
|
+
const offset = elementOffset(element);
|
|
1145
|
+
const padding = this._elementPadding();
|
|
1146
|
+
const inverseTransform = elementScale(element).invert();
|
|
1147
|
+
const point = new geometry.Point(
|
|
1168
1148
|
clientX - offset.left - padding.left,
|
|
1169
1149
|
clientY - offset.top - padding.top
|
|
1170
1150
|
).transform(inverseTransform);
|
|
1171
1151
|
|
|
1172
1152
|
return new Point(point.x, point.y);
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
Chart.prototype._tap = function _tap (e) {
|
|
1176
|
-
var this$1 = this;
|
|
1153
|
+
}
|
|
1177
1154
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1155
|
+
_tap(e) {
|
|
1156
|
+
const drawingElement = this.surface.eventTarget(e);
|
|
1157
|
+
const element = this._drawingChartElement(drawingElement, e);
|
|
1158
|
+
const sharedTooltip = this._sharedTooltip();
|
|
1181
1159
|
|
|
1182
1160
|
if (!this._startHover(drawingElement, e) && !sharedTooltip) {
|
|
1183
1161
|
this._unsetActivePoint();
|
|
@@ -1191,38 +1169,34 @@ var Chart = (function (Class) {
|
|
|
1191
1169
|
|
|
1192
1170
|
//part of fix for hover issue on windows touch
|
|
1193
1171
|
this.handlingTap = true;
|
|
1194
|
-
setTimeout(
|
|
1195
|
-
this
|
|
1172
|
+
setTimeout(() => {
|
|
1173
|
+
this.handlingTap = false;
|
|
1196
1174
|
}, 0);
|
|
1197
|
-
}
|
|
1175
|
+
}
|
|
1198
1176
|
|
|
1199
|
-
|
|
1200
|
-
|
|
1177
|
+
_click(e) {
|
|
1178
|
+
const element = this._getChartElement(e);
|
|
1201
1179
|
this._propagateClick(element, e);
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
Chart.prototype._propagateClick = function _propagateClick (element, e) {
|
|
1205
|
-
var this$1 = this;
|
|
1180
|
+
}
|
|
1206
1181
|
|
|
1207
|
-
|
|
1182
|
+
_propagateClick(element, e) {
|
|
1183
|
+
let current = element;
|
|
1208
1184
|
while (current) {
|
|
1209
1185
|
if (current.click) {
|
|
1210
|
-
current.click(this
|
|
1186
|
+
current.click(this, e);
|
|
1211
1187
|
}
|
|
1212
1188
|
|
|
1213
1189
|
current = current.parent;
|
|
1214
1190
|
}
|
|
1215
|
-
}
|
|
1191
|
+
}
|
|
1216
1192
|
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
var legendPosition = ref.options.legend.position;
|
|
1220
|
-
var legend = ref._legend;
|
|
1193
|
+
_isLegendBeforeChart() {
|
|
1194
|
+
const { options: { legend: { position: legendPosition } }, _legend: legend } = this;
|
|
1221
1195
|
|
|
1222
1196
|
return legend && legend.hasItems() && (legendPosition === TOP || legendPosition === LEFT);
|
|
1223
|
-
}
|
|
1197
|
+
}
|
|
1224
1198
|
|
|
1225
|
-
|
|
1199
|
+
_focus() {
|
|
1226
1200
|
if (!this._preventInitialPointFocus) {
|
|
1227
1201
|
if (this._isLegendBeforeChart()) {
|
|
1228
1202
|
this._focusFirstLegendItem();
|
|
@@ -1232,18 +1206,14 @@ var Chart = (function (Class) {
|
|
|
1232
1206
|
}
|
|
1233
1207
|
|
|
1234
1208
|
this._preventInitialPointFocus = false;
|
|
1235
|
-
}
|
|
1209
|
+
}
|
|
1236
1210
|
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
var ref_focusState = ref._focusState;
|
|
1240
|
-
var legendInFocus = ref_focusState.legendInFocus;
|
|
1241
|
-
var focusedElement = ref_focusState.focusedElement;
|
|
1242
|
-
var legend = ref._legend;
|
|
1211
|
+
_keydown(e) {
|
|
1212
|
+
const { _focusState: { legendInFocus, focusedElement }, _legend: legend } = this;
|
|
1243
1213
|
|
|
1244
1214
|
if (e.key === TAB) {
|
|
1245
1215
|
this._clearFocusedElement();
|
|
1246
|
-
|
|
1216
|
+
const isLegendBeforeChart = this._isLegendBeforeChart();
|
|
1247
1217
|
|
|
1248
1218
|
if (legendInFocus && isLegendBeforeChart !== e.shiftKey) {
|
|
1249
1219
|
this._navigatePoints(e);
|
|
@@ -1271,14 +1241,10 @@ var Chart = (function (Class) {
|
|
|
1271
1241
|
} else {
|
|
1272
1242
|
this._navigateLegend(e);
|
|
1273
1243
|
}
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
Chart.prototype._navigatePoints = function _navigatePoints (e) {
|
|
1277
|
-
var this$1 = this;
|
|
1244
|
+
}
|
|
1278
1245
|
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
var plotArea = ref._plotArea;
|
|
1246
|
+
_navigatePoints(e) {
|
|
1247
|
+
const { _focusState: focusState, _plotArea: plotArea } = this;
|
|
1282
1248
|
|
|
1283
1249
|
focusState.legendInFocus = false;
|
|
1284
1250
|
|
|
@@ -1288,11 +1254,11 @@ var Chart = (function (Class) {
|
|
|
1288
1254
|
return;
|
|
1289
1255
|
}
|
|
1290
1256
|
|
|
1291
|
-
|
|
1257
|
+
const moveFocus = (point) => {
|
|
1292
1258
|
focusState.focusedPoint = point;
|
|
1293
1259
|
|
|
1294
|
-
this
|
|
1295
|
-
this
|
|
1260
|
+
this._focusElement(focusState.focusedPoint);
|
|
1261
|
+
this._displayTooltip(point);
|
|
1296
1262
|
e.preventDefault();
|
|
1297
1263
|
};
|
|
1298
1264
|
|
|
@@ -1312,15 +1278,10 @@ var Chart = (function (Class) {
|
|
|
1312
1278
|
default:
|
|
1313
1279
|
break;
|
|
1314
1280
|
}
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
Chart.prototype._navigateLegend = function _navigateLegend (e) {
|
|
1318
|
-
var this$1 = this;
|
|
1281
|
+
}
|
|
1319
1282
|
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
var legend = ref._legend;
|
|
1323
|
-
var rtl = ref.chartService.rtl;
|
|
1283
|
+
_navigateLegend(e) {
|
|
1284
|
+
const { _focusState: focusState, _legend: legend, chartService: { rtl: rtl } } = this;
|
|
1324
1285
|
|
|
1325
1286
|
focusState.legendInFocus = true;
|
|
1326
1287
|
|
|
@@ -1330,13 +1291,13 @@ var Chart = (function (Class) {
|
|
|
1330
1291
|
return;
|
|
1331
1292
|
}
|
|
1332
1293
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1294
|
+
const itemsLength = legend.getItems().length;
|
|
1295
|
+
const moveFocus = (cycleFunc) => {
|
|
1335
1296
|
focusState.focusedLegendItemIndex = cycleFunc(
|
|
1336
1297
|
focusState.focusedLegendItemIndex,
|
|
1337
1298
|
itemsLength
|
|
1338
1299
|
);
|
|
1339
|
-
this
|
|
1300
|
+
this._focusElement(this._getFocusedLegendItem());
|
|
1340
1301
|
e.preventDefault();
|
|
1341
1302
|
};
|
|
1342
1303
|
|
|
@@ -1352,80 +1313,75 @@ var Chart = (function (Class) {
|
|
|
1352
1313
|
default:
|
|
1353
1314
|
break;
|
|
1354
1315
|
}
|
|
1355
|
-
}
|
|
1316
|
+
}
|
|
1356
1317
|
|
|
1357
|
-
|
|
1358
|
-
|
|
1318
|
+
_focusFirstPoint() {
|
|
1319
|
+
const point = this._focusState.focusedPoint = this._plotArea.getFirstPoint();
|
|
1359
1320
|
|
|
1360
1321
|
if (point) {
|
|
1361
1322
|
this._focusElement(point);
|
|
1362
1323
|
this._displayTooltip(point);
|
|
1363
1324
|
}
|
|
1364
|
-
}
|
|
1325
|
+
}
|
|
1365
1326
|
|
|
1366
|
-
|
|
1327
|
+
_hasFocus() {
|
|
1367
1328
|
return this.element.ownerDocument.activeElement === this.element;
|
|
1368
|
-
}
|
|
1329
|
+
}
|
|
1369
1330
|
|
|
1370
|
-
|
|
1331
|
+
_mousedown() {
|
|
1371
1332
|
if (!this._hasFocus()) {
|
|
1372
1333
|
this._preventInitialPointFocus = true;
|
|
1373
1334
|
}
|
|
1374
|
-
}
|
|
1335
|
+
}
|
|
1375
1336
|
|
|
1376
|
-
|
|
1337
|
+
_focusChart() {
|
|
1377
1338
|
if (!this._hasFocus()) {
|
|
1378
1339
|
this._preventInitialPointFocus = true;
|
|
1379
1340
|
this.element.focus();
|
|
1380
1341
|
}
|
|
1381
|
-
}
|
|
1342
|
+
}
|
|
1382
1343
|
|
|
1383
|
-
|
|
1344
|
+
_focusPoint(point) {
|
|
1384
1345
|
this._focusState.focusedPoint = point;
|
|
1385
1346
|
|
|
1386
1347
|
this._focusChart();
|
|
1387
1348
|
|
|
1388
1349
|
this._focusElement(point, true);
|
|
1389
|
-
}
|
|
1350
|
+
}
|
|
1390
1351
|
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
var focusState = ref._focusState;
|
|
1352
|
+
_focusFirstLegendItem() {
|
|
1353
|
+
const { _focusState: focusState } = this;
|
|
1394
1354
|
|
|
1395
1355
|
focusState.focusedLegendItemIndex = 0;
|
|
1396
1356
|
this._focusElement(this._getFocusedLegendItem());
|
|
1397
1357
|
focusState.legendInFocus = true;
|
|
1398
1358
|
|
|
1399
1359
|
this._hideTooltip();
|
|
1400
|
-
}
|
|
1360
|
+
}
|
|
1401
1361
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
var focusState = ref._focusState;
|
|
1362
|
+
_focusLegendItem(args) {
|
|
1363
|
+
const { _focusState: focusState } = this;
|
|
1405
1364
|
|
|
1406
1365
|
focusState.focusedLegendItemIndex = this._legend
|
|
1407
1366
|
.getItems()
|
|
1408
|
-
.findIndex(
|
|
1409
|
-
&& x.options.pointIndex === args.pointIndex
|
|
1367
|
+
.findIndex(x => x.options.series.index === args.seriesIndex
|
|
1368
|
+
&& x.options.pointIndex === args.pointIndex);
|
|
1410
1369
|
|
|
1411
1370
|
focusState.legendInFocus = true;
|
|
1412
1371
|
|
|
1413
1372
|
this._focusChart();
|
|
1414
1373
|
|
|
1415
1374
|
this._focusElement(this._getFocusedLegendItem(), true);
|
|
1416
|
-
}
|
|
1375
|
+
}
|
|
1417
1376
|
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
var focusState = ref._focusState;
|
|
1421
|
-
var legend = ref._legend;
|
|
1377
|
+
_getFocusedLegendItem() {
|
|
1378
|
+
const { _focusState: focusState, _legend: legend } = this;
|
|
1422
1379
|
|
|
1423
1380
|
return legend.getItems()[focusState.focusedLegendItemIndex];
|
|
1424
|
-
}
|
|
1381
|
+
}
|
|
1425
1382
|
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
var focusState = ref._focusState;
|
|
1383
|
+
_focusElement(element, omitHighlight) {
|
|
1384
|
+
const { _focusState: focusState } = this;
|
|
1429
1385
|
|
|
1430
1386
|
this._clearFocusedElement();
|
|
1431
1387
|
|
|
@@ -1441,18 +1397,17 @@ var Chart = (function (Class) {
|
|
|
1441
1397
|
element.focusVisual();
|
|
1442
1398
|
|
|
1443
1399
|
if (focusState.legendInFocus) {
|
|
1444
|
-
|
|
1400
|
+
const options = element.options;
|
|
1445
1401
|
|
|
1446
1402
|
this._showSeriesInactiveOpacity(options.series.index, options.pointIndex);
|
|
1447
1403
|
} else {
|
|
1448
1404
|
this._showInactiveOpacity(element);
|
|
1449
1405
|
}
|
|
1450
1406
|
}
|
|
1451
|
-
}
|
|
1407
|
+
}
|
|
1452
1408
|
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
var focusState = ref._focusState;
|
|
1409
|
+
_clearFocusedElement() {
|
|
1410
|
+
const { _focusState: focusState } = this;
|
|
1456
1411
|
|
|
1457
1412
|
if (!focusState) {
|
|
1458
1413
|
return;
|
|
@@ -1464,59 +1419,59 @@ var Chart = (function (Class) {
|
|
|
1464
1419
|
}
|
|
1465
1420
|
|
|
1466
1421
|
focusState.focusedElement = null;
|
|
1467
|
-
}
|
|
1422
|
+
}
|
|
1468
1423
|
|
|
1469
|
-
|
|
1424
|
+
_setElementActiveDescendant(element) {
|
|
1470
1425
|
if (this.options.renderAs === "canvas") {
|
|
1471
1426
|
this._pseudoFocusedElement = this._createPseudoFocusedElement(element);
|
|
1472
1427
|
this.element.append(this._pseudoFocusedElement);
|
|
1473
1428
|
}
|
|
1474
1429
|
|
|
1475
1430
|
this.element.setAttribute(ARIA_ACTIVE_DESCENDANT, element._id);
|
|
1476
|
-
}
|
|
1431
|
+
}
|
|
1477
1432
|
|
|
1478
|
-
|
|
1433
|
+
_clearElementActiveDescendant() {
|
|
1479
1434
|
if (this._pseudoFocusedElement) {
|
|
1480
1435
|
this._pseudoFocusedElement.remove();
|
|
1481
1436
|
this._pseudoFocusedElement = null;
|
|
1482
1437
|
}
|
|
1483
1438
|
|
|
1484
1439
|
this.element.removeAttribute(ARIA_ACTIVE_DESCENDANT);
|
|
1485
|
-
}
|
|
1440
|
+
}
|
|
1486
1441
|
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1442
|
+
_createPseudoFocusedElement(element) {
|
|
1443
|
+
const pseudoElement = document.createElement("div");
|
|
1444
|
+
const accessibilityOptions = element.options.accessibility;
|
|
1490
1445
|
|
|
1491
1446
|
pseudoElement.id = element._id;
|
|
1492
1447
|
pseudoElement.setAttribute("aria-label", element.getAriaLabelText());
|
|
1493
1448
|
pseudoElement.setAttribute("role", accessibilityOptions.role);
|
|
1494
1449
|
pseudoElement.setAttribute("aria-roledescription", accessibilityOptions.ariaRoleDescription);
|
|
1495
1450
|
|
|
1496
|
-
|
|
1451
|
+
const checked = accessibilityOptions.ariaChecked;
|
|
1497
1452
|
if (defined(checked)) {
|
|
1498
1453
|
pseudoElement.setAttribute("aria-checked", checked);
|
|
1499
1454
|
}
|
|
1500
1455
|
|
|
1501
1456
|
return pseudoElement;
|
|
1502
|
-
}
|
|
1457
|
+
}
|
|
1503
1458
|
|
|
1504
|
-
|
|
1459
|
+
_blur() {
|
|
1505
1460
|
this._focusState.legendInFocus = false;
|
|
1506
1461
|
this._clearFocusedElement();
|
|
1507
1462
|
this._hideInactiveOpacity();
|
|
1508
|
-
}
|
|
1463
|
+
}
|
|
1509
1464
|
|
|
1510
|
-
|
|
1465
|
+
_startHover(element, e) {
|
|
1511
1466
|
if (this._suppressHover) {
|
|
1512
1467
|
return false;
|
|
1513
1468
|
}
|
|
1514
1469
|
|
|
1515
|
-
|
|
1470
|
+
let point = this._drawingChartElement(element, e, function(element) {
|
|
1516
1471
|
return (element.hover || element.over) && !(element instanceof PlotAreaBase);
|
|
1517
1472
|
});
|
|
1518
1473
|
|
|
1519
|
-
|
|
1474
|
+
const activePoint = this._activePoint;
|
|
1520
1475
|
|
|
1521
1476
|
this._updateHoveredPoint(point, e);
|
|
1522
1477
|
|
|
@@ -1531,10 +1486,10 @@ var Chart = (function (Class) {
|
|
|
1531
1486
|
}
|
|
1532
1487
|
|
|
1533
1488
|
return point;
|
|
1534
|
-
}
|
|
1489
|
+
}
|
|
1535
1490
|
|
|
1536
|
-
|
|
1537
|
-
|
|
1491
|
+
_displayTooltip(point) {
|
|
1492
|
+
const tooltipOptions = deepExtend({}, this.options.tooltip, point.options.tooltip);
|
|
1538
1493
|
if (tooltipOptions.visible) {
|
|
1539
1494
|
if (this._sharedTooltip() && point.box) {
|
|
1540
1495
|
this._trackSharedTooltip(point.box.center(), {});
|
|
@@ -1542,16 +1497,16 @@ var Chart = (function (Class) {
|
|
|
1542
1497
|
this._tooltip.show(point);
|
|
1543
1498
|
}
|
|
1544
1499
|
}
|
|
1545
|
-
}
|
|
1500
|
+
}
|
|
1546
1501
|
|
|
1547
|
-
|
|
1502
|
+
_hideTooltip() {
|
|
1548
1503
|
if (this._tooltip) {
|
|
1549
1504
|
this._tooltip.hide();
|
|
1550
1505
|
}
|
|
1551
|
-
}
|
|
1506
|
+
}
|
|
1552
1507
|
|
|
1553
|
-
|
|
1554
|
-
|
|
1508
|
+
_displayInactiveOpacity(activePoint, multipleSeries, highlightPoints) {
|
|
1509
|
+
const chartInstance = this._activeChartInstance = this._chartInstanceFromPoint(activePoint);
|
|
1555
1510
|
if (!chartInstance) {
|
|
1556
1511
|
return;
|
|
1557
1512
|
}
|
|
@@ -1562,7 +1517,7 @@ var Chart = (function (Class) {
|
|
|
1562
1517
|
this._applySeriesOpacity(chartInstance.children, activePoint.series);
|
|
1563
1518
|
this._highlight.show(highlightPoints || activePoint);
|
|
1564
1519
|
} else {
|
|
1565
|
-
|
|
1520
|
+
let inactivePoints;
|
|
1566
1521
|
|
|
1567
1522
|
if (!chartInstance.supportsPointInactiveOpacity()) {
|
|
1568
1523
|
this._highlight.show(activePoint);
|
|
@@ -1575,34 +1530,32 @@ var Chart = (function (Class) {
|
|
|
1575
1530
|
this._highlight.show(inactivePoints, 1 - this._getInactiveOpacityForSeries(activePoint.series));
|
|
1576
1531
|
}
|
|
1577
1532
|
}
|
|
1578
|
-
}
|
|
1579
|
-
|
|
1580
|
-
Chart.prototype._getInactivePoints = function _getInactivePoints (activePoint, chartInstance) {
|
|
1581
|
-
var allPoints = this._getAllPointsOfType(chartInstance, activePoint.constructor);
|
|
1533
|
+
}
|
|
1582
1534
|
|
|
1583
|
-
|
|
1584
|
-
|
|
1535
|
+
_getInactivePoints(activePoint, chartInstance) {
|
|
1536
|
+
let allPoints = this._getAllPointsOfType(chartInstance, activePoint.constructor);
|
|
1585
1537
|
|
|
1586
|
-
|
|
1587
|
-
|
|
1538
|
+
return allPoints.filter(point => point !== activePoint);
|
|
1539
|
+
}
|
|
1588
1540
|
|
|
1589
|
-
|
|
1541
|
+
_getAllPointsOfType(container, type) {
|
|
1542
|
+
let points = [];
|
|
1590
1543
|
|
|
1591
|
-
for (
|
|
1592
|
-
|
|
1544
|
+
for (let i = 0; i < container.children.length; i++) {
|
|
1545
|
+
const element = container.children[i];
|
|
1593
1546
|
|
|
1594
1547
|
if (element.constructor === type) {
|
|
1595
1548
|
points.push(element);
|
|
1596
1549
|
} else if (element.children && element.children.length) {
|
|
1597
|
-
points = points.concat(this
|
|
1550
|
+
points = points.concat(this._getAllPointsOfType(element, type));
|
|
1598
1551
|
}
|
|
1599
1552
|
}
|
|
1600
1553
|
|
|
1601
1554
|
return points;
|
|
1602
|
-
}
|
|
1555
|
+
}
|
|
1603
1556
|
|
|
1604
|
-
|
|
1605
|
-
|
|
1557
|
+
_updateHoveredPoint(point, e) {
|
|
1558
|
+
const hoveredPoint = this._hoveredPoint;
|
|
1606
1559
|
|
|
1607
1560
|
if (hoveredPoint && hoveredPoint !== point) {
|
|
1608
1561
|
hoveredPoint.out(this, e);
|
|
@@ -1613,53 +1566,49 @@ var Chart = (function (Class) {
|
|
|
1613
1566
|
this._hoveredPoint = point;
|
|
1614
1567
|
point.over(this, e);
|
|
1615
1568
|
}
|
|
1616
|
-
}
|
|
1569
|
+
}
|
|
1617
1570
|
|
|
1618
|
-
|
|
1571
|
+
_updateDrilldownPoint(point) {
|
|
1619
1572
|
if (!point || !point.series) {
|
|
1620
1573
|
return;
|
|
1621
1574
|
}
|
|
1622
1575
|
|
|
1623
|
-
|
|
1624
|
-
var fields = ref.fields;
|
|
1576
|
+
const { fields } = SeriesBinder.current.bindPoint(point.series, null, point.dataItem);
|
|
1625
1577
|
if (fields.drilldown) {
|
|
1626
1578
|
this._drilldownState = { cursor: this.element.style.cursor };
|
|
1627
1579
|
this.element.style.cursor = 'pointer';
|
|
1628
1580
|
}
|
|
1629
|
-
}
|
|
1581
|
+
}
|
|
1630
1582
|
|
|
1631
|
-
|
|
1583
|
+
_resetDrilldownPoint() {
|
|
1632
1584
|
if (this._drilldownState) {
|
|
1633
1585
|
this.element.style.cursor = this._drilldownState.cursor;
|
|
1634
1586
|
this._drilldownState = null;
|
|
1635
1587
|
}
|
|
1636
|
-
}
|
|
1588
|
+
}
|
|
1637
1589
|
|
|
1638
|
-
|
|
1590
|
+
_startDrilldown(point) {
|
|
1639
1591
|
if (!point || !point.series) {
|
|
1640
1592
|
return;
|
|
1641
1593
|
}
|
|
1642
1594
|
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
var value = fields.drilldown;
|
|
1595
|
+
const series = point.series;
|
|
1596
|
+
const { fields } = SeriesBinder.current.bindPoint(series, null, point.dataItem);
|
|
1597
|
+
const value = fields.drilldown;
|
|
1647
1598
|
if (value) {
|
|
1648
|
-
|
|
1599
|
+
const args = { series, point, value, sender: this };
|
|
1649
1600
|
this.trigger(DRILLDOWN, args);
|
|
1650
1601
|
}
|
|
1651
|
-
}
|
|
1652
|
-
|
|
1653
|
-
Chart.prototype._updateSeriesOpacity = function _updateSeriesOpacity (point, resetOpacity) {
|
|
1654
|
-
var this$1 = this;
|
|
1602
|
+
}
|
|
1655
1603
|
|
|
1656
|
-
|
|
1657
|
-
|
|
1604
|
+
_updateSeriesOpacity(point, resetOpacity) {
|
|
1605
|
+
const plotArea = this._plotArea;
|
|
1606
|
+
const length = plotArea.series.length;
|
|
1658
1607
|
|
|
1659
|
-
for (
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1608
|
+
for (let i = 0; i < length; i++) {
|
|
1609
|
+
const currSeries = plotArea.series[i];
|
|
1610
|
+
const defaultOpacity = this._getDefaultOpacityForSeries(currSeries);
|
|
1611
|
+
const inactiveOpacity = this._getInactiveOpacityForSeries(currSeries);
|
|
1663
1612
|
|
|
1664
1613
|
if (!resetOpacity && currSeries !== point.series) {
|
|
1665
1614
|
currSeries.defaultOpacity = defaultOpacity;
|
|
@@ -1676,53 +1625,51 @@ var Chart = (function (Class) {
|
|
|
1676
1625
|
}
|
|
1677
1626
|
}
|
|
1678
1627
|
}
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
Chart.prototype._applySeriesOpacity = function _applySeriesOpacity (elements, activeSeries, reset, series) {
|
|
1682
|
-
var this$1 = this;
|
|
1628
|
+
}
|
|
1683
1629
|
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1630
|
+
_applySeriesOpacity(elements, activeSeries, reset, series) {
|
|
1631
|
+
for (let i = 0; i < elements.length; i++) {
|
|
1632
|
+
const element = elements[i];
|
|
1633
|
+
const currSeries = element.series || series;
|
|
1634
|
+
const shouldHighlight = currSeries && (currSeries.highlight || {}).visible;
|
|
1688
1635
|
|
|
1689
1636
|
if (shouldHighlight && element.visual) {
|
|
1690
|
-
|
|
1637
|
+
const opacity = series ? series.opacity : element.series.opacity;
|
|
1691
1638
|
if (currSeries !== activeSeries || reset) {
|
|
1692
1639
|
element.visual.opacity(reset ? 1 : opacity);
|
|
1693
1640
|
}
|
|
1694
1641
|
}
|
|
1695
1642
|
|
|
1696
1643
|
if (element.children && element.children.length) {
|
|
1697
|
-
this
|
|
1644
|
+
this._applySeriesOpacity(element.children, activeSeries, reset, element.series);
|
|
1698
1645
|
}
|
|
1699
1646
|
}
|
|
1700
|
-
}
|
|
1647
|
+
}
|
|
1701
1648
|
|
|
1702
|
-
|
|
1703
|
-
|
|
1649
|
+
_chartInstanceFromPoint(point) {
|
|
1650
|
+
let chartInstance = point.parent;
|
|
1704
1651
|
|
|
1705
1652
|
while (chartInstance && !chartInstance.plotArea) {
|
|
1706
1653
|
chartInstance = chartInstance.parent;
|
|
1707
1654
|
}
|
|
1708
1655
|
|
|
1709
1656
|
return chartInstance;
|
|
1710
|
-
}
|
|
1657
|
+
}
|
|
1711
1658
|
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1659
|
+
_showInactiveOpacity(point) {
|
|
1660
|
+
const multipleSeries = this._plotArea.series.length > 1;
|
|
1661
|
+
const hasInactiveOpacity = this._hasInactiveOpacity();
|
|
1715
1662
|
|
|
1716
1663
|
if (hasInactiveOpacity) {
|
|
1717
1664
|
this._displayInactiveOpacity(point, multipleSeries);
|
|
1718
1665
|
} else {
|
|
1719
1666
|
this._highlight.show(point);
|
|
1720
1667
|
}
|
|
1721
|
-
}
|
|
1668
|
+
}
|
|
1722
1669
|
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1670
|
+
_hideInactiveOpacity(point) {
|
|
1671
|
+
const multipleSeries = this._plotArea.series.length > 1;
|
|
1672
|
+
const hasInactiveOpacity = this._hasInactiveOpacity();
|
|
1726
1673
|
if (hasInactiveOpacity) {
|
|
1727
1674
|
if (multipleSeries && this._activeChartInstance) {
|
|
1728
1675
|
this._updateSeriesOpacity(point, true);
|
|
@@ -1732,53 +1679,47 @@ var Chart = (function (Class) {
|
|
|
1732
1679
|
this._highlight && this._highlight.hide();
|
|
1733
1680
|
this._activePoint = null;
|
|
1734
1681
|
}
|
|
1735
|
-
}
|
|
1682
|
+
}
|
|
1736
1683
|
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1684
|
+
_hasInactiveOpacity() {
|
|
1685
|
+
let hasDefaultInactiveOpacity = this.options.seriesDefaults.highlight.inactiveOpacity !== undefined;
|
|
1686
|
+
let hasInactiveOpacity = this.options.series.filter(s => s.highlight.inactiveOpacity !== undefined ).length > 0;
|
|
1740
1687
|
return hasDefaultInactiveOpacity || hasInactiveOpacity;
|
|
1741
|
-
}
|
|
1688
|
+
}
|
|
1742
1689
|
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1690
|
+
_getInactiveOpacityForSeries(series) {
|
|
1691
|
+
let defaultInactiveOpacity = this.options.seriesDefaults.highlight.inactiveOpacity;
|
|
1692
|
+
let seriesInactiveOpacity = series.highlight.inactiveOpacity;
|
|
1746
1693
|
return seriesInactiveOpacity || defaultInactiveOpacity || series.opacity || DEFAULT_SERIES_OPACITY;
|
|
1747
|
-
}
|
|
1694
|
+
}
|
|
1748
1695
|
|
|
1749
|
-
|
|
1696
|
+
_getDefaultOpacityForSeries(series) {
|
|
1750
1697
|
return series.defaultOpacity || series.opacity || DEFAULT_SERIES_OPACITY;
|
|
1751
|
-
}
|
|
1752
|
-
|
|
1753
|
-
Chart.prototype._mouseover = function _mouseover (e) {
|
|
1754
|
-
var obj;
|
|
1698
|
+
}
|
|
1755
1699
|
|
|
1756
|
-
|
|
1700
|
+
_mouseover(e) {
|
|
1701
|
+
const point = this._startHover(e.element, e.originalEvent);
|
|
1757
1702
|
|
|
1758
1703
|
if (point && point.tooltipTracking && !this._mouseMoveTrackHandler && !this._sharedTooltip()) {
|
|
1759
1704
|
this._mouseMoveTrackHandler = this._mouseMoveTracking.bind(this);
|
|
1760
|
-
bindEvents(document,
|
|
1705
|
+
bindEvents(document, {
|
|
1706
|
+
[ MOUSEMOVE ]: this._mouseMoveTrackHandler
|
|
1707
|
+
});
|
|
1761
1708
|
}
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
Chart.prototype._mouseMoveTracking = function _mouseMoveTracking (e) {
|
|
1765
|
-
var obj;
|
|
1709
|
+
}
|
|
1766
1710
|
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
var highlight = ref._highlight;
|
|
1771
|
-
var point = ref._activePoint;
|
|
1772
|
-
var coords = this._eventCoordinates(e);
|
|
1711
|
+
_mouseMoveTracking(e) {
|
|
1712
|
+
const { options, _tooltip: tooltip, _highlight: highlight, _activePoint: point } = this;
|
|
1713
|
+
const coords = this._eventCoordinates(e);
|
|
1773
1714
|
|
|
1774
1715
|
if (this._plotArea.box.containsPoint(coords)) {
|
|
1775
1716
|
if (point && point.tooltipTracking && point.series && point.parent.getNearestPoint) {
|
|
1776
|
-
|
|
1717
|
+
const seriesPoint = point.parent.getNearestPoint(coords.x, coords.y, point.seriesIx);
|
|
1777
1718
|
if (seriesPoint && seriesPoint !== point) {
|
|
1778
1719
|
this._activePoint = seriesPoint;
|
|
1779
1720
|
|
|
1780
1721
|
if (!seriesPoint.hover(this, e)) {
|
|
1781
|
-
|
|
1722
|
+
const tooltipOptions = deepExtend({}, options.tooltip, seriesPoint.options.tooltip);
|
|
1782
1723
|
if (tooltipOptions.visible) {
|
|
1783
1724
|
tooltip.show(seriesPoint);
|
|
1784
1725
|
}
|
|
@@ -1788,23 +1729,25 @@ var Chart = (function (Class) {
|
|
|
1788
1729
|
}
|
|
1789
1730
|
}
|
|
1790
1731
|
} else {
|
|
1791
|
-
unbindEvents(document,
|
|
1732
|
+
unbindEvents(document, {
|
|
1733
|
+
[ MOUSEMOVE ]: this._mouseMoveTrackHandler
|
|
1734
|
+
});
|
|
1792
1735
|
this._unsetActivePoint();
|
|
1793
1736
|
this._clearFocusedElement();
|
|
1794
1737
|
this._mouseMoveTrackHandler = null;
|
|
1795
1738
|
|
|
1796
1739
|
this._hideInactiveOpacity(point);
|
|
1797
1740
|
}
|
|
1798
|
-
}
|
|
1741
|
+
}
|
|
1799
1742
|
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1743
|
+
_mousemove(e) {
|
|
1744
|
+
const coords = this._eventCoordinates(e);
|
|
1745
|
+
const plotArea = this._plotArea;
|
|
1803
1746
|
|
|
1804
1747
|
this._trackCrosshairs(coords);
|
|
1805
1748
|
|
|
1806
1749
|
if (plotArea.hover) {
|
|
1807
|
-
|
|
1750
|
+
const overPlotArea = plotArea.backgroundContainsPoint(coords);
|
|
1808
1751
|
if (overPlotArea) {
|
|
1809
1752
|
this._plotAreaHovered = true;
|
|
1810
1753
|
this._plotArea.hover(this, e);
|
|
@@ -1817,13 +1760,13 @@ var Chart = (function (Class) {
|
|
|
1817
1760
|
if (this._sharedTooltip()) {
|
|
1818
1761
|
this._trackSharedTooltip(coords, e);
|
|
1819
1762
|
}
|
|
1820
|
-
}
|
|
1763
|
+
}
|
|
1821
1764
|
|
|
1822
|
-
|
|
1823
|
-
|
|
1765
|
+
_trackCrosshairs(coords) {
|
|
1766
|
+
const crosshairs = this._plotArea.crosshairs;
|
|
1824
1767
|
|
|
1825
|
-
for (
|
|
1826
|
-
|
|
1768
|
+
for (let i = 0; i < crosshairs.length; i++) {
|
|
1769
|
+
const current = crosshairs[i];
|
|
1827
1770
|
|
|
1828
1771
|
if (current.box.containsPoint(coords)) {
|
|
1829
1772
|
current.showAt(coords);
|
|
@@ -1831,28 +1774,23 @@ var Chart = (function (Class) {
|
|
|
1831
1774
|
current.hide();
|
|
1832
1775
|
}
|
|
1833
1776
|
}
|
|
1834
|
-
}
|
|
1777
|
+
}
|
|
1835
1778
|
|
|
1836
|
-
|
|
1779
|
+
_trackSharedTooltip(coords, e, toggle) {
|
|
1837
1780
|
if (this._suppressHover) {
|
|
1838
1781
|
return;
|
|
1839
1782
|
}
|
|
1840
1783
|
|
|
1841
|
-
|
|
1842
|
-
var tooltipOptions = ref.options.tooltip;
|
|
1843
|
-
var plotArea = ref._plotArea;
|
|
1844
|
-
var categoryAxis = ref._plotArea.categoryAxis;
|
|
1845
|
-
var tooltip = ref._tooltip;
|
|
1846
|
-
var highlight = ref._highlight;
|
|
1784
|
+
const { options: { tooltip: tooltipOptions }, _plotArea: plotArea, _plotArea: { categoryAxis }, _tooltip: tooltip, _highlight: highlight } = this;
|
|
1847
1785
|
|
|
1848
1786
|
if (plotArea.backgroundContainsPoint(coords)) {
|
|
1849
|
-
|
|
1787
|
+
const index = categoryAxis.pointCategoryIndex(coords);
|
|
1850
1788
|
if (index !== this._tooltipCategoryIx || (!this._sharedHighlight && toggle)) {
|
|
1851
|
-
|
|
1852
|
-
|
|
1789
|
+
const points = plotArea.pointsByCategoryIndex(index);
|
|
1790
|
+
const pointArgs = points.map(function(point) {
|
|
1853
1791
|
return point.eventArgs(e);
|
|
1854
1792
|
});
|
|
1855
|
-
|
|
1793
|
+
const hoverArgs = pointArgs[0] || {};
|
|
1856
1794
|
hoverArgs.categoryPoints = pointArgs;
|
|
1857
1795
|
|
|
1858
1796
|
if (points.length > 0 && !this.trigger(SERIES_HOVER, hoverArgs)) {
|
|
@@ -1879,20 +1817,19 @@ var Chart = (function (Class) {
|
|
|
1879
1817
|
this._tooltipCategoryIx = null;
|
|
1880
1818
|
this._sharedHighlight = false;
|
|
1881
1819
|
}
|
|
1882
|
-
}
|
|
1820
|
+
}
|
|
1883
1821
|
|
|
1884
|
-
|
|
1885
|
-
|
|
1822
|
+
hideElements(options) {
|
|
1823
|
+
const plotArea = this._plotArea;
|
|
1886
1824
|
this._mousemoveThrottled.cancel();
|
|
1887
1825
|
|
|
1888
1826
|
plotArea.hideCrosshairs();
|
|
1889
1827
|
|
|
1890
1828
|
this._unsetActivePoint(options);
|
|
1891
|
-
}
|
|
1829
|
+
}
|
|
1892
1830
|
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
var highlight = ref._highlight;
|
|
1831
|
+
_unsetActivePoint(options) {
|
|
1832
|
+
const { _highlight: highlight } = this;
|
|
1896
1833
|
|
|
1897
1834
|
this._activePoint = null;
|
|
1898
1835
|
this._hoveredPoint = null;
|
|
@@ -1907,72 +1844,68 @@ var Chart = (function (Class) {
|
|
|
1907
1844
|
if (highlight) {
|
|
1908
1845
|
highlight.hide();
|
|
1909
1846
|
}
|
|
1910
|
-
}
|
|
1847
|
+
}
|
|
1911
1848
|
|
|
1912
|
-
|
|
1849
|
+
_deferRedraw() {
|
|
1913
1850
|
this._redraw();
|
|
1914
|
-
}
|
|
1851
|
+
}
|
|
1915
1852
|
|
|
1916
|
-
|
|
1853
|
+
_clearRedrawTimeout() {
|
|
1917
1854
|
if (this._redrawTimeout) {
|
|
1918
1855
|
clearInterval(this._redrawTimeout);
|
|
1919
1856
|
this._redrawTimeout = null;
|
|
1920
1857
|
}
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
|
-
Chart.prototype.bindCategories = function bindCategories () {
|
|
1924
|
-
var this$1 = this;
|
|
1858
|
+
}
|
|
1925
1859
|
|
|
1926
|
-
|
|
1927
|
-
|
|
1860
|
+
bindCategories() {
|
|
1861
|
+
const options = this.options;
|
|
1862
|
+
const definitions = [].concat(options.categoryAxis);
|
|
1928
1863
|
|
|
1929
|
-
for (
|
|
1930
|
-
|
|
1864
|
+
for (let axisIx = 0; axisIx < definitions.length; axisIx++) {
|
|
1865
|
+
const axis = definitions[axisIx];
|
|
1931
1866
|
if (axis.autoBind !== false) {
|
|
1932
|
-
this
|
|
1867
|
+
this.bindCategoryAxisFromSeries(axis, axisIx);
|
|
1933
1868
|
}
|
|
1934
1869
|
}
|
|
1935
|
-
}
|
|
1936
|
-
|
|
1937
|
-
Chart.prototype.bindCategoryAxisFromSeries = function bindCategoryAxisFromSeries (axis, axisIx) {
|
|
1938
|
-
var this$1 = this;
|
|
1939
|
-
|
|
1940
|
-
var uniqueCategories = new Set();
|
|
1941
|
-
var seriesOnAxis = this.options.series.filter(function (series) { return series.categoryAxis === axis.name || (!series.categoryAxis && axisIx === 0); });
|
|
1942
|
-
var hasCategoryBinding = seriesOnAxis.some(function (series) { return Boolean(series.categoryField); });
|
|
1943
|
-
var seriesWithData = seriesOnAxis.filter(function (series) { return series.data && series.data.length > 0; });
|
|
1944
|
-
var categorySamples = seriesWithData.map(function (series) { return SeriesBinder.current.bindPoint(series, 0).fields.category; });
|
|
1945
|
-
var dateAxis = categorySamples.reduce(function (result, firstCategory) { return result || isDateAxis(axis, firstCategory); }, false);
|
|
1946
|
-
var seriesWithBinding = seriesWithData.filter(function (series, seriesIx) { return series.categoryField || defined(categorySamples[seriesIx]); });
|
|
1870
|
+
}
|
|
1947
1871
|
|
|
1948
|
-
|
|
1949
|
-
|
|
1872
|
+
bindCategoryAxisFromSeries(axis, axisIx) {
|
|
1873
|
+
const uniqueCategories = new Set();
|
|
1874
|
+
const seriesOnAxis = this.options.series.filter(series => series.categoryAxis === axis.name || (!series.categoryAxis && axisIx === 0));
|
|
1875
|
+
const hasCategoryBinding = seriesOnAxis.some(series => Boolean(series.categoryField));
|
|
1876
|
+
const seriesWithData = seriesOnAxis.filter(series => series.data && series.data.length > 0);
|
|
1877
|
+
const categorySamples = seriesWithData.map(series => SeriesBinder.current.bindPoint(series, 0).fields.category);
|
|
1878
|
+
const dateAxis = categorySamples.reduce((result, firstCategory) => result || isDateAxis(axis, firstCategory), false);
|
|
1879
|
+
const seriesWithBinding = seriesWithData.filter((series, seriesIx) => series.categoryField || defined(categorySamples[seriesIx]));
|
|
1880
|
+
|
|
1881
|
+
seriesWithBinding.forEach((series) => series.data.forEach((row, index) => {
|
|
1882
|
+
let category = SeriesBinder.current.bindPoint(series, index).fields.category;
|
|
1950
1883
|
if (dateAxis) {
|
|
1951
|
-
|
|
1884
|
+
const date = parseDateCategory(category, row, this.chartService.intl);
|
|
1952
1885
|
category = date ? date.getTime() : undefined;
|
|
1953
1886
|
}
|
|
1954
1887
|
|
|
1955
1888
|
uniqueCategories.add(category);
|
|
1956
|
-
})
|
|
1889
|
+
}));
|
|
1957
1890
|
|
|
1958
1891
|
if (uniqueCategories.size > 0) {
|
|
1959
|
-
|
|
1892
|
+
let categories = Array.from(uniqueCategories.values());
|
|
1960
1893
|
if (dateAxis) {
|
|
1961
|
-
categories = categories.sort().map(
|
|
1894
|
+
categories = categories.sort().map(time => time && new Date(time));
|
|
1962
1895
|
}
|
|
1963
1896
|
|
|
1964
1897
|
axis.categories = categories;
|
|
1965
1898
|
} else if (hasCategoryBinding) {
|
|
1966
1899
|
axis.categories = [];
|
|
1967
1900
|
}
|
|
1968
|
-
}
|
|
1901
|
+
}
|
|
1969
1902
|
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1903
|
+
_isBindable(series) {
|
|
1904
|
+
const valueFields = SeriesBinder.current.valueFields(series);
|
|
1905
|
+
let result = true;
|
|
1973
1906
|
|
|
1974
|
-
for (
|
|
1975
|
-
|
|
1907
|
+
for (let i = 0; i < valueFields.length; i++) {
|
|
1908
|
+
let field = valueFields[i];
|
|
1976
1909
|
if (field === VALUE) {
|
|
1977
1910
|
field = "field";
|
|
1978
1911
|
} else {
|
|
@@ -1986,11 +1919,11 @@ var Chart = (function (Class) {
|
|
|
1986
1919
|
}
|
|
1987
1920
|
|
|
1988
1921
|
return result;
|
|
1989
|
-
}
|
|
1922
|
+
}
|
|
1990
1923
|
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1924
|
+
_noTransitionsRedraw() {
|
|
1925
|
+
const options = this.options;
|
|
1926
|
+
let transitionsState;
|
|
1994
1927
|
|
|
1995
1928
|
if (options.transitions !== false) {
|
|
1996
1929
|
options.transitions = false;
|
|
@@ -2002,18 +1935,16 @@ var Chart = (function (Class) {
|
|
|
2002
1935
|
if (transitionsState) {
|
|
2003
1936
|
options.transitions = true;
|
|
2004
1937
|
}
|
|
2005
|
-
}
|
|
1938
|
+
}
|
|
2006
1939
|
|
|
2007
|
-
|
|
1940
|
+
_legendItemHover(seriesIndex, pointIndex) {
|
|
2008
1941
|
this._showSeriesInactiveOpacity(seriesIndex, pointIndex);
|
|
2009
|
-
}
|
|
1942
|
+
}
|
|
2010
1943
|
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
var currentSeries = (plotArea.srcSeries || plotArea.series)[seriesIndex];
|
|
2016
|
-
var items;
|
|
1944
|
+
_showSeriesInactiveOpacity(seriesIndex, pointIndex) {
|
|
1945
|
+
const { _plotArea: plotArea, _highlight: highlight } = this;
|
|
1946
|
+
const currentSeries = (plotArea.srcSeries || plotArea.series)[seriesIndex];
|
|
1947
|
+
let items;
|
|
2017
1948
|
|
|
2018
1949
|
if (inArray(currentSeries.type, [ PIE, DONUT, FUNNEL, PYRAMID ])) {
|
|
2019
1950
|
items = plotArea.findPoint(function(point) {
|
|
@@ -2024,30 +1955,32 @@ var Chart = (function (Class) {
|
|
|
2024
1955
|
}
|
|
2025
1956
|
|
|
2026
1957
|
if (this._hasInactiveOpacity() && currentSeries.visible && items) {
|
|
2027
|
-
|
|
2028
|
-
|
|
1958
|
+
const multipleSeries = plotArea.series.length > 1;
|
|
1959
|
+
const point = items.length ? items[0] : items;
|
|
2029
1960
|
|
|
2030
1961
|
this._displayInactiveOpacity(point, multipleSeries, items);
|
|
2031
1962
|
} else {
|
|
2032
1963
|
highlight.show(items);
|
|
2033
1964
|
}
|
|
2034
|
-
}
|
|
1965
|
+
}
|
|
2035
1966
|
|
|
2036
|
-
|
|
1967
|
+
_shouldAttachMouseMove() {
|
|
2037
1968
|
return this._plotArea.crosshairs.length || (this._tooltip && this._sharedTooltip()) || this.requiresHandlers([ PLOT_AREA_HOVER, PLOT_AREA_LEAVE ]);
|
|
2038
|
-
}
|
|
2039
|
-
|
|
2040
|
-
Chart.prototype.updateMouseMoveHandler = function updateMouseMoveHandler () {
|
|
2041
|
-
var obj, obj$1;
|
|
1969
|
+
}
|
|
2042
1970
|
|
|
2043
|
-
|
|
1971
|
+
updateMouseMoveHandler() {
|
|
1972
|
+
unbindEvents(this.element, {
|
|
1973
|
+
[ MOUSEMOVE ]: this._mousemoveThrottled
|
|
1974
|
+
});
|
|
2044
1975
|
|
|
2045
1976
|
if (this._shouldAttachMouseMove()) {
|
|
2046
|
-
bindEvents(this.element,
|
|
1977
|
+
bindEvents(this.element, {
|
|
1978
|
+
[ MOUSEMOVE ]: this._mousemoveThrottled
|
|
1979
|
+
});
|
|
2047
1980
|
}
|
|
2048
|
-
}
|
|
1981
|
+
}
|
|
2049
1982
|
|
|
2050
|
-
|
|
1983
|
+
applyOptions(options, theme) {
|
|
2051
1984
|
clearMissingValues(this._originalOptions, options);
|
|
2052
1985
|
this._originalOptions = deepExtend(this._originalOptions, options);
|
|
2053
1986
|
this.options = deepExtend({}, this._originalOptions);
|
|
@@ -2059,37 +1992,44 @@ var Chart = (function (Class) {
|
|
|
2059
1992
|
this._initTheme(this.options, this._theme);
|
|
2060
1993
|
|
|
2061
1994
|
this._toggleDragZoomEvents();
|
|
2062
|
-
}
|
|
1995
|
+
}
|
|
2063
1996
|
|
|
2064
|
-
|
|
1997
|
+
setOptions(options, theme) {
|
|
2065
1998
|
this.applyOptions(options, theme);
|
|
2066
1999
|
this.bindCategories();
|
|
2067
2000
|
this.redraw();
|
|
2068
2001
|
this.updateMouseMoveHandler();
|
|
2069
2002
|
this._restoreOverlayElement();
|
|
2070
|
-
}
|
|
2003
|
+
}
|
|
2071
2004
|
|
|
2072
|
-
|
|
2005
|
+
setDirection(rtl) {
|
|
2073
2006
|
this.chartService.rtl = Boolean(rtl);
|
|
2074
2007
|
if (this.surface && this.surface.type === 'svg') {
|
|
2075
2008
|
this._destroySurface();
|
|
2076
2009
|
}
|
|
2077
|
-
}
|
|
2010
|
+
}
|
|
2078
2011
|
|
|
2079
|
-
|
|
2012
|
+
setIntlService(intl) {
|
|
2080
2013
|
this.chartService.intl = intl;
|
|
2081
|
-
}
|
|
2014
|
+
}
|
|
2082
2015
|
|
|
2083
|
-
|
|
2016
|
+
noTransitionsRedraw() {
|
|
2084
2017
|
this._noTransitionsRedraw();
|
|
2085
|
-
}
|
|
2086
|
-
|
|
2087
|
-
Chart.prototype.destroy = function destroy () {
|
|
2088
|
-
var obj, obj$1;
|
|
2018
|
+
}
|
|
2089
2019
|
|
|
2020
|
+
destroy() {
|
|
2090
2021
|
this._destroyed = true;
|
|
2091
2022
|
|
|
2092
|
-
unbindEvents(this.element,
|
|
2023
|
+
unbindEvents(this.element, {
|
|
2024
|
+
[ CONTEXTMENU ]: this._clickHandler,
|
|
2025
|
+
[ MOUSEWHEEL ]: this._mousewheelHandler,
|
|
2026
|
+
[ MOUSEMOVE ]: this._mousemoveThrottled,
|
|
2027
|
+
[ MOUSELEAVE ]: this._mouseleaveHandler,
|
|
2028
|
+
[ MOUSEDOWN ]: this._mousedownHandler,
|
|
2029
|
+
[ KEYDOWN ]: this._keydownHandler,
|
|
2030
|
+
[ FOCUS ]: this._focusHandler,
|
|
2031
|
+
[ BLUR]: this._blurHandler
|
|
2032
|
+
});
|
|
2093
2033
|
|
|
2094
2034
|
if (this.domEvents) {
|
|
2095
2035
|
this.domEvents.destroy();
|
|
@@ -2097,7 +2037,9 @@ var Chart = (function (Class) {
|
|
|
2097
2037
|
}
|
|
2098
2038
|
|
|
2099
2039
|
if (this._mouseMoveTrackHandler) {
|
|
2100
|
-
unbindEvents(document,
|
|
2040
|
+
unbindEvents(document, {
|
|
2041
|
+
[ MOUSEMOVE ]: this._mouseMoveTrackHandler
|
|
2042
|
+
});
|
|
2101
2043
|
}
|
|
2102
2044
|
|
|
2103
2045
|
this._focusState = null;
|
|
@@ -2108,10 +2050,10 @@ var Chart = (function (Class) {
|
|
|
2108
2050
|
this._destroySurface();
|
|
2109
2051
|
|
|
2110
2052
|
this._clearRedrawTimeout();
|
|
2111
|
-
}
|
|
2053
|
+
}
|
|
2112
2054
|
|
|
2113
|
-
|
|
2114
|
-
|
|
2055
|
+
_destroySurface() {
|
|
2056
|
+
const surface = this.surface;
|
|
2115
2057
|
if (surface) {
|
|
2116
2058
|
surface.unbind("mouseenter", this._surfaceMouseenterHandler);
|
|
2117
2059
|
surface.unbind("mouseleave", this._surfaceMouseleaveHandler);
|
|
@@ -2119,20 +2061,20 @@ var Chart = (function (Class) {
|
|
|
2119
2061
|
|
|
2120
2062
|
this.surface = null;
|
|
2121
2063
|
}
|
|
2122
|
-
}
|
|
2064
|
+
}
|
|
2123
2065
|
|
|
2124
|
-
|
|
2125
|
-
|
|
2066
|
+
_destroySelections() {
|
|
2067
|
+
const selections = this._selections;
|
|
2126
2068
|
|
|
2127
2069
|
if (selections) {
|
|
2128
2070
|
while (selections.length > 0) {
|
|
2129
2071
|
selections.shift().destroy();
|
|
2130
2072
|
}
|
|
2131
2073
|
}
|
|
2132
|
-
}
|
|
2074
|
+
}
|
|
2133
2075
|
|
|
2134
|
-
|
|
2135
|
-
|
|
2076
|
+
_destroyView() {
|
|
2077
|
+
const model = this._model;
|
|
2136
2078
|
|
|
2137
2079
|
if (model) {
|
|
2138
2080
|
model.destroy();
|
|
@@ -2166,16 +2108,14 @@ var Chart = (function (Class) {
|
|
|
2166
2108
|
this._mousewheelZoom.destroy();
|
|
2167
2109
|
delete this._mousewheelZoom;
|
|
2168
2110
|
}
|
|
2169
|
-
}
|
|
2170
|
-
|
|
2171
|
-
return Chart;
|
|
2172
|
-
}(Class));
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2173
2113
|
|
|
2174
2114
|
function resolveAxisAliases(options) {
|
|
2175
|
-
|
|
2115
|
+
const aliases = AXIS_NAMES;
|
|
2176
2116
|
|
|
2177
|
-
for (
|
|
2178
|
-
|
|
2117
|
+
for (let idx = 0; idx < aliases.length; idx++) {
|
|
2118
|
+
const alias = aliases[idx] + "Axes";
|
|
2179
2119
|
if (options[alias]) {
|
|
2180
2120
|
options[aliases[idx] + "Axis"] = options[alias];
|
|
2181
2121
|
delete options[alias];
|
|
@@ -2185,7 +2125,7 @@ function resolveAxisAliases(options) {
|
|
|
2185
2125
|
|
|
2186
2126
|
function pointByCategoryName(points, name) {
|
|
2187
2127
|
if (points) {
|
|
2188
|
-
for (
|
|
2128
|
+
for (let idx = 0; idx < points.length; idx++) {
|
|
2189
2129
|
if (points[idx].category === name) {
|
|
2190
2130
|
return [ points[idx] ];
|
|
2191
2131
|
}
|
|
@@ -2194,12 +2134,12 @@ function pointByCategoryName(points, name) {
|
|
|
2194
2134
|
}
|
|
2195
2135
|
|
|
2196
2136
|
function applyAxisDefaults(options, themeOptions) {
|
|
2197
|
-
|
|
2198
|
-
|
|
2137
|
+
const themeAxisDefaults = ((themeOptions || {}).axisDefaults) || {};
|
|
2138
|
+
let axisName, axisDefaults, axes;
|
|
2199
2139
|
|
|
2200
2140
|
function mapAxisOptions(axisOptions) {
|
|
2201
|
-
|
|
2202
|
-
|
|
2141
|
+
const axisColor = (axisOptions || {}).color || axisDefaults.color;
|
|
2142
|
+
const result = deepExtend({},
|
|
2203
2143
|
themeAxisDefaults,
|
|
2204
2144
|
themeAxisDefaults[axisName],
|
|
2205
2145
|
axisDefaults,
|
|
@@ -2216,7 +2156,7 @@ function applyAxisDefaults(options, themeOptions) {
|
|
|
2216
2156
|
return result;
|
|
2217
2157
|
}
|
|
2218
2158
|
|
|
2219
|
-
for (
|
|
2159
|
+
for (let idx = 0; idx < AXIS_NAMES.length; idx++) {
|
|
2220
2160
|
axisName = AXIS_NAMES[idx] + "Axis";
|
|
2221
2161
|
axisDefaults = options.axisDefaults || {};
|
|
2222
2162
|
axes = [].concat(options[axisName]);
|
|
@@ -2228,20 +2168,20 @@ function applyAxisDefaults(options, themeOptions) {
|
|
|
2228
2168
|
}
|
|
2229
2169
|
|
|
2230
2170
|
function applySeriesDefaults(options, themeOptions) {
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2171
|
+
const series = options.series;
|
|
2172
|
+
const seriesLength = series.length;
|
|
2173
|
+
const seriesDefaults = options.seriesDefaults;
|
|
2174
|
+
const commonDefaults = deepExtend({}, options.seriesDefaults);
|
|
2175
|
+
const themeSeriesDefaults = themeOptions ? deepExtend({}, themeOptions.seriesDefaults) : {};
|
|
2176
|
+
const commonThemeDefaults = deepExtend({}, themeSeriesDefaults);
|
|
2237
2177
|
|
|
2238
2178
|
cleanupNestedSeriesDefaults(commonDefaults);
|
|
2239
2179
|
cleanupNestedSeriesDefaults(commonThemeDefaults);
|
|
2240
2180
|
|
|
2241
|
-
for (
|
|
2242
|
-
|
|
2181
|
+
for (let i = 0; i < seriesLength; i++) {
|
|
2182
|
+
const seriesType = series[i].type || options.seriesDefaults.type;
|
|
2243
2183
|
|
|
2244
|
-
|
|
2184
|
+
const baseOptions = deepExtend(
|
|
2245
2185
|
{ data: [] },
|
|
2246
2186
|
commonThemeDefaults,
|
|
2247
2187
|
themeSeriesDefaults[seriesType],
|
|
@@ -2283,11 +2223,11 @@ function cleanupNestedSeriesDefaults(seriesDefaults) {
|
|
|
2283
2223
|
|
|
2284
2224
|
|
|
2285
2225
|
function axisRanges(axes) {
|
|
2286
|
-
|
|
2226
|
+
const ranges = {};
|
|
2287
2227
|
|
|
2288
|
-
for (
|
|
2289
|
-
|
|
2290
|
-
|
|
2228
|
+
for (let i = 0; i < axes.length; i++) {
|
|
2229
|
+
const axis = axes[i];
|
|
2230
|
+
const axisName = axis.options.name;
|
|
2291
2231
|
if (axisName) {
|
|
2292
2232
|
ranges[axisName] = axis.range();
|
|
2293
2233
|
}
|
|
@@ -2296,15 +2236,15 @@ function axisRanges(axes) {
|
|
|
2296
2236
|
return ranges;
|
|
2297
2237
|
}
|
|
2298
2238
|
|
|
2299
|
-
|
|
2239
|
+
const DATA_FIELDS = [ 'data', 'categories' ];
|
|
2300
2240
|
|
|
2301
2241
|
function clearMissingValues(originalOptions, options) {
|
|
2302
|
-
for (
|
|
2242
|
+
for (let field in options) {
|
|
2303
2243
|
if (!inArray(field, DATA_FIELDS) && hasOwnProperty(options, field)) {
|
|
2304
|
-
|
|
2305
|
-
|
|
2244
|
+
const fieldValue = options[field];
|
|
2245
|
+
const originalValue = originalOptions[field];
|
|
2306
2246
|
if (defined(originalValue)) {
|
|
2307
|
-
|
|
2247
|
+
const nullValue = fieldValue === null;
|
|
2308
2248
|
if ((nullValue || !defined(fieldValue))) {
|
|
2309
2249
|
delete originalOptions[field];
|
|
2310
2250
|
if (nullValue) {
|
|
@@ -2321,7 +2261,7 @@ function clearMissingValues(originalOptions, options) {
|
|
|
2321
2261
|
}
|
|
2322
2262
|
|
|
2323
2263
|
function triggerPaneRender(panes) {
|
|
2324
|
-
for (
|
|
2264
|
+
for (let idx = 0; idx < panes.length; idx++) {
|
|
2325
2265
|
panes[idx].notifyRender();
|
|
2326
2266
|
}
|
|
2327
2267
|
}
|