@visactor/vgrammar-core 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +160 -0
- package/README.zh-CN.md +11 -0
- package/cjs/component/axis.d.ts +26 -0
- package/cjs/component/axis.js +164 -0
- package/cjs/component/axis.js.map +1 -0
- package/cjs/component/crosshair.d.ts +50 -0
- package/cjs/component/crosshair.js +281 -0
- package/cjs/component/crosshair.js.map +1 -0
- package/cjs/component/datazoom.d.ts +19 -0
- package/cjs/component/datazoom.js +166 -0
- package/cjs/component/datazoom.js.map +1 -0
- package/cjs/component/grid.d.ts +27 -0
- package/cjs/component/grid.js +190 -0
- package/cjs/component/grid.js.map +1 -0
- package/cjs/component/index.d.ts +11 -0
- package/cjs/component/index.js +105 -0
- package/cjs/component/index.js.map +1 -0
- package/cjs/component/label.d.ts +19 -0
- package/cjs/component/label.js +121 -0
- package/cjs/component/label.js.map +1 -0
- package/cjs/component/legend.d.ts +26 -0
- package/cjs/component/legend.js +170 -0
- package/cjs/component/legend.js.map +1 -0
- package/cjs/component/player.d.ts +25 -0
- package/cjs/component/player.js +138 -0
- package/cjs/component/player.js.map +1 -0
- package/cjs/component/scale.d.ts +8 -0
- package/cjs/component/scale.js +25 -0
- package/cjs/component/scale.js.map +1 -0
- package/cjs/component/scrollbar.d.ts +23 -0
- package/cjs/component/scrollbar.js +187 -0
- package/cjs/component/scrollbar.js.map +1 -0
- package/cjs/component/slider.d.ts +19 -0
- package/cjs/component/slider.js +86 -0
- package/cjs/component/slider.js.map +1 -0
- package/cjs/component/title.d.ts +15 -0
- package/cjs/component/title.js +56 -0
- package/cjs/component/title.js.map +1 -0
- package/cjs/component/tooltip.d.ts +62 -0
- package/cjs/component/tooltip.js +305 -0
- package/cjs/component/tooltip.js.map +1 -0
- package/cjs/core/factory.d.ts +35 -0
- package/cjs/core/factory.js +73 -0
- package/cjs/core/factory.js.map +1 -0
- package/cjs/glyph/boxplot.d.ts +10 -0
- package/cjs/glyph/boxplot.js +418 -0
- package/cjs/glyph/boxplot.js.map +1 -0
- package/cjs/glyph/index.d.ts +7 -0
- package/cjs/glyph/index.js +64 -0
- package/cjs/glyph/index.js.map +1 -0
- package/cjs/glyph/link-path.d.ts +7 -0
- package/cjs/glyph/link-path.js +138 -0
- package/cjs/glyph/link-path.js.map +1 -0
- package/cjs/glyph/ripple.d.ts +1 -0
- package/cjs/glyph/ripple.js +44 -0
- package/cjs/glyph/ripple.js.map +1 -0
- package/cjs/glyph/tree-path.d.ts +7 -0
- package/cjs/glyph/tree-path.js +152 -0
- package/cjs/glyph/tree-path.js.map +1 -0
- package/cjs/glyph/violin.d.ts +1 -0
- package/cjs/glyph/violin.js +165 -0
- package/cjs/glyph/violin.js.map +1 -0
- package/cjs/glyph/wave.d.ts +1 -0
- package/cjs/glyph/wave.js +67 -0
- package/cjs/glyph/wave.js.map +1 -0
- package/cjs/graph/animation/animate.d.ts +48 -0
- package/cjs/graph/animation/animate.js +250 -0
- package/cjs/graph/animation/animate.js.map +1 -0
- package/cjs/graph/animation/animation/clip.d.ts +4 -0
- package/cjs/graph/animation/animation/clip.js +54 -0
- package/cjs/graph/animation/animation/clip.js.map +1 -0
- package/cjs/graph/animation/animation/fade.d.ts +4 -0
- package/cjs/graph/animation/animation/fade.js +42 -0
- package/cjs/graph/animation/animation/fade.js.map +1 -0
- package/cjs/graph/animation/animation/grow-cartesian.d.ts +7 -0
- package/cjs/graph/animation/animation/grow-cartesian.js +288 -0
- package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -0
- package/cjs/graph/animation/animation/grow-interval.d.ts +3 -0
- package/cjs/graph/animation/animation/grow-interval.js +194 -0
- package/cjs/graph/animation/animation/grow-interval.js.map +1 -0
- package/cjs/graph/animation/animation/grow-points.d.ts +7 -0
- package/cjs/graph/animation/animation/grow-points.js +118 -0
- package/cjs/graph/animation/animation/grow-points.js.map +1 -0
- package/cjs/graph/animation/animation/grow-polar.d.ts +5 -0
- package/cjs/graph/animation/animation/grow-polar.js +164 -0
- package/cjs/graph/animation/animation/grow-polar.js.map +1 -0
- package/cjs/graph/animation/animation/index.d.ts +11 -0
- package/cjs/graph/animation/animation/index.js +191 -0
- package/cjs/graph/animation/animation/index.js.map +1 -0
- package/cjs/graph/animation/animation/move.d.ts +3 -0
- package/cjs/graph/animation/animation/move.js +90 -0
- package/cjs/graph/animation/animation/move.js.map +1 -0
- package/cjs/graph/animation/animation/rotate.d.ts +3 -0
- package/cjs/graph/animation/animation/rotate.js +42 -0
- package/cjs/graph/animation/animation/rotate.js.map +1 -0
- package/cjs/graph/animation/animation/scale.d.ts +3 -0
- package/cjs/graph/animation/animation/scale.js +84 -0
- package/cjs/graph/animation/animation/scale.js.map +1 -0
- package/cjs/graph/animation/animation/update.d.ts +6 -0
- package/cjs/graph/animation/animation/update.js +22 -0
- package/cjs/graph/animation/animation/update.js.map +1 -0
- package/cjs/graph/animation/animator.d.ts +26 -0
- package/cjs/graph/animation/animator.js +88 -0
- package/cjs/graph/animation/animator.js.map +1 -0
- package/cjs/graph/animation/arranger.d.ts +13 -0
- package/cjs/graph/animation/arranger.js +38 -0
- package/cjs/graph/animation/arranger.js.map +1 -0
- package/cjs/graph/animation/attribute.d.ts +27 -0
- package/cjs/graph/animation/attribute.js +124 -0
- package/cjs/graph/animation/attribute.js.map +1 -0
- package/cjs/graph/animation/config.d.ts +5 -0
- package/cjs/graph/animation/config.js +92 -0
- package/cjs/graph/animation/config.js.map +1 -0
- package/cjs/graph/animation/morph.d.ts +12 -0
- package/cjs/graph/animation/morph.js +174 -0
- package/cjs/graph/animation/morph.js.map +1 -0
- package/cjs/graph/attributes/common.d.ts +2 -0
- package/cjs/graph/attributes/common.js +22 -0
- package/cjs/graph/attributes/common.js.map +1 -0
- package/cjs/graph/attributes/helpers.d.ts +17 -0
- package/cjs/graph/attributes/helpers.js +86 -0
- package/cjs/graph/attributes/helpers.js.map +1 -0
- package/cjs/graph/attributes/index.d.ts +10 -0
- package/cjs/graph/attributes/index.js +257 -0
- package/cjs/graph/attributes/index.js.map +1 -0
- package/cjs/graph/canvas-renderer.d.ts +34 -0
- package/cjs/graph/canvas-renderer.js +121 -0
- package/cjs/graph/canvas-renderer.js.map +1 -0
- package/cjs/graph/constants.d.ts +23 -0
- package/cjs/graph/constants.js +21 -0
- package/cjs/graph/constants.js.map +1 -0
- package/cjs/graph/element.d.ts +66 -0
- package/cjs/graph/element.js +297 -0
- package/cjs/graph/element.js.map +1 -0
- package/cjs/graph/enums.d.ts +153 -0
- package/cjs/graph/enums.js +85 -0
- package/cjs/graph/enums.js.map +1 -0
- package/cjs/graph/glyph-element.d.ts +53 -0
- package/cjs/graph/glyph-element.js +202 -0
- package/cjs/graph/glyph-element.js.map +1 -0
- package/cjs/graph/index.d.ts +3 -0
- package/cjs/graph/index.js +44 -0
- package/cjs/graph/index.js.map +1 -0
- package/cjs/graph/layout/grid.d.ts +3 -0
- package/cjs/graph/layout/grid.js +75 -0
- package/cjs/graph/layout/grid.js.map +1 -0
- package/cjs/graph/layout/layout.d.ts +3 -0
- package/cjs/graph/layout/layout.js +33 -0
- package/cjs/graph/layout/layout.js.map +1 -0
- package/cjs/graph/layout/relative.d.ts +3 -0
- package/cjs/graph/layout/relative.js +86 -0
- package/cjs/graph/layout/relative.js.map +1 -0
- package/cjs/graph/mark/differ.d.ts +20 -0
- package/cjs/graph/mark/differ.js +110 -0
- package/cjs/graph/mark/differ.js.map +1 -0
- package/cjs/graph/mark/encode.d.ts +10 -0
- package/cjs/graph/mark/encode.js +95 -0
- package/cjs/graph/mark/encode.js.map +1 -0
- package/cjs/graph/mark/large-rects.d.ts +10 -0
- package/cjs/graph/mark/large-rects.js +31 -0
- package/cjs/graph/mark/large-rects.js.map +1 -0
- package/cjs/graph/mark/large-symbols.d.ts +11 -0
- package/cjs/graph/mark/large-symbols.js +33 -0
- package/cjs/graph/mark/large-symbols.js.map +1 -0
- package/cjs/graph/mark-tree.d.ts +2 -0
- package/cjs/graph/mark-tree.js +21 -0
- package/cjs/graph/mark-tree.js.map +1 -0
- package/cjs/graph/util/element.d.ts +2 -0
- package/cjs/graph/util/element.js +10 -0
- package/cjs/graph/util/element.js.map +1 -0
- package/cjs/graph/util/env.d.ts +2 -0
- package/cjs/graph/util/env.js +14 -0
- package/cjs/graph/util/env.js.map +1 -0
- package/cjs/graph/util/events-extend.d.ts +5 -0
- package/cjs/graph/util/events-extend.js +18 -0
- package/cjs/graph/util/events-extend.js.map +1 -0
- package/cjs/graph/util/graphic.d.ts +9 -0
- package/cjs/graph/util/graphic.js +59 -0
- package/cjs/graph/util/graphic.js.map +1 -0
- package/cjs/graph/util/point.d.ts +1 -0
- package/cjs/graph/util/point.js +75 -0
- package/cjs/graph/util/point.js.map +1 -0
- package/cjs/index.d.ts +14 -0
- package/cjs/index.js +111 -0
- package/cjs/index.js.map +1 -0
- package/cjs/parse/coordinate.d.ts +7 -0
- package/cjs/parse/coordinate.js +70 -0
- package/cjs/parse/coordinate.js.map +1 -0
- package/cjs/parse/event.d.ts +8 -0
- package/cjs/parse/event.js +33 -0
- package/cjs/parse/event.js.map +1 -0
- package/cjs/parse/mark.d.ts +4 -0
- package/cjs/parse/mark.js +25 -0
- package/cjs/parse/mark.js.map +1 -0
- package/cjs/parse/option.d.ts +3 -0
- package/cjs/parse/option.js +19 -0
- package/cjs/parse/option.js.map +1 -0
- package/cjs/parse/scale.d.ts +8 -0
- package/cjs/parse/scale.js +365 -0
- package/cjs/parse/scale.js.map +1 -0
- package/cjs/parse/transform.d.ts +5 -0
- package/cjs/parse/transform.js +103 -0
- package/cjs/parse/transform.js.map +1 -0
- package/cjs/parse/util.d.ts +13 -0
- package/cjs/parse/util.js +82 -0
- package/cjs/parse/util.js.map +1 -0
- package/cjs/parse/view.d.ts +17 -0
- package/cjs/parse/view.js +108 -0
- package/cjs/parse/view.js.map +1 -0
- package/cjs/semantic-marks/cell.d.ts +13 -0
- package/cjs/semantic-marks/cell.js +61 -0
- package/cjs/semantic-marks/cell.js.map +1 -0
- package/cjs/semantic-marks/interval.d.ts +14 -0
- package/cjs/semantic-marks/interval.js +80 -0
- package/cjs/semantic-marks/interval.js.map +1 -0
- package/cjs/semantic-marks/text.d.ts +10 -0
- package/cjs/semantic-marks/text.js +25 -0
- package/cjs/semantic-marks/text.js.map +1 -0
- package/cjs/theme/common/component.d.ts +15 -0
- package/cjs/theme/common/component.js +493 -0
- package/cjs/theme/common/component.js.map +1 -0
- package/cjs/theme/common/constants.d.ts +1 -0
- package/cjs/theme/common/constants.js +6 -0
- package/cjs/theme/common/constants.js.map +1 -0
- package/cjs/theme/common/mark.d.ts +2 -0
- package/cjs/theme/common/mark.js +15 -0
- package/cjs/theme/common/mark.js.map +1 -0
- package/cjs/theme/dark.d.ts +2 -0
- package/cjs/theme/dark.js +94 -0
- package/cjs/theme/dark.js.map +1 -0
- package/cjs/theme/default.d.ts +2 -0
- package/cjs/theme/default.js +18 -0
- package/cjs/theme/default.js.map +1 -0
- package/cjs/theme/theme-manager.d.ts +8 -0
- package/cjs/theme/theme-manager.js +26 -0
- package/cjs/theme/theme-manager.js.map +1 -0
- package/cjs/transforms/data/bin.d.ts +2 -0
- package/cjs/transforms/data/bin.js +21 -0
- package/cjs/transforms/data/bin.js.map +1 -0
- package/cjs/transforms/data/circular-relation.d.ts +2 -0
- package/cjs/transforms/data/circular-relation.js +56 -0
- package/cjs/transforms/data/circular-relation.js.map +1 -0
- package/cjs/transforms/data/contour.d.ts +2 -0
- package/cjs/transforms/data/contour.js +115 -0
- package/cjs/transforms/data/contour.js.map +1 -0
- package/cjs/transforms/data/filter.d.ts +2 -0
- package/cjs/transforms/data/filter.js +10 -0
- package/cjs/transforms/data/filter.js.map +1 -0
- package/cjs/transforms/data/fold.d.ts +2 -0
- package/cjs/transforms/data/fold.js +24 -0
- package/cjs/transforms/data/fold.js.map +1 -0
- package/cjs/transforms/data/funnel.d.ts +2 -0
- package/cjs/transforms/data/funnel.js +25 -0
- package/cjs/transforms/data/funnel.js.map +1 -0
- package/cjs/transforms/data/join.d.ts +2 -0
- package/cjs/transforms/data/join.js +33 -0
- package/cjs/transforms/data/join.js.map +1 -0
- package/cjs/transforms/data/kde.d.ts +2 -0
- package/cjs/transforms/data/kde.js +90 -0
- package/cjs/transforms/data/kde.js.map +1 -0
- package/cjs/transforms/data/map.d.ts +2 -0
- package/cjs/transforms/data/map.js +23 -0
- package/cjs/transforms/data/map.js.map +1 -0
- package/cjs/transforms/data/pick.d.ts +2 -0
- package/cjs/transforms/data/pick.js +20 -0
- package/cjs/transforms/data/pick.js.map +1 -0
- package/cjs/transforms/data/pie.d.ts +2 -0
- package/cjs/transforms/data/pie.js +24 -0
- package/cjs/transforms/data/pie.js.map +1 -0
- package/cjs/transforms/data/range.d.ts +4 -0
- package/cjs/transforms/data/range.js +15 -0
- package/cjs/transforms/data/range.js.map +1 -0
- package/cjs/transforms/data/sort.d.ts +2 -0
- package/cjs/transforms/data/sort.js +17 -0
- package/cjs/transforms/data/sort.js.map +1 -0
- package/cjs/transforms/data/stack.d.ts +2 -0
- package/cjs/transforms/data/stack.js +74 -0
- package/cjs/transforms/data/stack.js.map +1 -0
- package/cjs/transforms/data/unfold.d.ts +2 -0
- package/cjs/transforms/data/unfold.js +49 -0
- package/cjs/transforms/data/unfold.js.map +1 -0
- package/cjs/transforms/index.d.ts +23 -0
- package/cjs/transforms/index.js +213 -0
- package/cjs/transforms/index.js.map +1 -0
- package/cjs/transforms/mark/dodge.d.ts +2 -0
- package/cjs/transforms/mark/dodge.js +81 -0
- package/cjs/transforms/mark/dodge.js.map +1 -0
- package/cjs/transforms/mark/jitter.d.ts +4 -0
- package/cjs/transforms/mark/jitter.js +53 -0
- package/cjs/transforms/mark/jitter.js.map +1 -0
- package/cjs/transforms/mark/lttb-sample.d.ts +2 -0
- package/cjs/transforms/mark/lttb-sample.js +68 -0
- package/cjs/transforms/mark/lttb-sample.js.map +1 -0
- package/cjs/transforms/mark/mark-overlap.d.ts +2 -0
- package/cjs/transforms/mark/mark-overlap.js +79 -0
- package/cjs/transforms/mark/mark-overlap.js.map +1 -0
- package/cjs/transforms/mark/symmetry.d.ts +2 -0
- package/cjs/transforms/mark/symmetry.js +25 -0
- package/cjs/transforms/mark/symmetry.js.map +1 -0
- package/cjs/transforms/util/util.d.ts +5 -0
- package/cjs/transforms/util/util.js +41 -0
- package/cjs/transforms/util/util.js.map +1 -0
- package/cjs/transforms/view/identifier.d.ts +2 -0
- package/cjs/transforms/view/identifier.js +17 -0
- package/cjs/transforms/view/identifier.js.map +1 -0
- package/cjs/types/animate.d.ts +224 -0
- package/cjs/types/animate.js +6 -0
- package/cjs/types/animate.js.map +1 -0
- package/cjs/types/base.d.ts +36 -0
- package/cjs/types/base.js +6 -0
- package/cjs/types/base.js.map +1 -0
- package/cjs/types/component.d.ts +240 -0
- package/cjs/types/component.js +6 -0
- package/cjs/types/component.js.map +1 -0
- package/cjs/types/coordinate.d.ts +15 -0
- package/cjs/types/coordinate.js +6 -0
- package/cjs/types/coordinate.js.map +1 -0
- package/cjs/types/data.d.ts +55 -0
- package/cjs/types/data.js +5 -0
- package/cjs/types/data.js.map +1 -0
- package/cjs/types/dataflow.d.ts +13 -0
- package/cjs/types/dataflow.js +6 -0
- package/cjs/types/dataflow.js.map +1 -0
- package/cjs/types/element.d.ts +117 -0
- package/cjs/types/element.js +6 -0
- package/cjs/types/element.js.map +1 -0
- package/cjs/types/event.d.ts +58 -0
- package/cjs/types/event.js +6 -0
- package/cjs/types/event.js.map +1 -0
- package/cjs/types/glyph.d.ts +29 -0
- package/cjs/types/glyph.js +6 -0
- package/cjs/types/glyph.js.map +1 -0
- package/cjs/types/grammar.d.ts +184 -0
- package/cjs/types/grammar.js +6 -0
- package/cjs/types/grammar.js.map +1 -0
- package/cjs/types/hooks.d.ts +45 -0
- package/cjs/types/hooks.js +6 -0
- package/cjs/types/hooks.js.map +1 -0
- package/cjs/types/index.d.ts +22 -0
- package/cjs/types/index.js +31 -0
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/layout.d.ts +5 -0
- package/cjs/types/layout.js +6 -0
- package/cjs/types/layout.js.map +1 -0
- package/cjs/types/mark.d.ts +344 -0
- package/cjs/types/mark.js +6 -0
- package/cjs/types/mark.js.map +1 -0
- package/cjs/types/morph.d.ts +29 -0
- package/cjs/types/morph.js +6 -0
- package/cjs/types/morph.js.map +1 -0
- package/cjs/types/plot.d.ts +326 -0
- package/cjs/types/plot.js +6 -0
- package/cjs/types/plot.js.map +1 -0
- package/cjs/types/projection.d.ts +61 -0
- package/cjs/types/projection.js +6 -0
- package/cjs/types/projection.js.map +1 -0
- package/cjs/types/renderer.d.ts +19 -0
- package/cjs/types/renderer.js +6 -0
- package/cjs/types/renderer.js.map +1 -0
- package/cjs/types/scale.d.ts +111 -0
- package/cjs/types/scale.js +6 -0
- package/cjs/types/scale.js.map +1 -0
- package/cjs/types/signal.d.ts +20 -0
- package/cjs/types/signal.js +6 -0
- package/cjs/types/signal.js.map +1 -0
- package/cjs/types/theme.d.ts +41 -0
- package/cjs/types/theme.js +6 -0
- package/cjs/types/theme.js.map +1 -0
- package/cjs/types/transform.d.ts +291 -0
- package/cjs/types/transform.js +6 -0
- package/cjs/types/transform.js.map +1 -0
- package/cjs/types/view.d.ts +217 -0
- package/cjs/types/view.js +6 -0
- package/cjs/types/view.js.map +1 -0
- package/cjs/util/data.d.ts +3 -0
- package/cjs/util/data.js +64 -0
- package/cjs/util/data.js.map +1 -0
- package/cjs/util/grammar-heap.d.ts +14 -0
- package/cjs/util/grammar-heap.js +66 -0
- package/cjs/util/grammar-heap.js.map +1 -0
- package/cjs/util/text.d.ts +19 -0
- package/cjs/util/text.js +32 -0
- package/cjs/util/text.js.map +1 -0
- package/cjs/util/unique-list.d.ts +12 -0
- package/cjs/util/unique-list.js +37 -0
- package/cjs/util/unique-list.js.map +1 -0
- package/cjs/view/View.d.ts +157 -0
- package/cjs/view/View.js +800 -0
- package/cjs/view/View.js.map +1 -0
- package/cjs/view/animate.d.ts +20 -0
- package/cjs/view/animate.js +106 -0
- package/cjs/view/animate.js.map +1 -0
- package/cjs/view/component.d.ts +26 -0
- package/cjs/view/component.js +64 -0
- package/cjs/view/component.js.map +1 -0
- package/cjs/view/constants.d.ts +17 -0
- package/cjs/view/constants.js +13 -0
- package/cjs/view/constants.js.map +1 -0
- package/cjs/view/coordinate.d.ts +23 -0
- package/cjs/view/coordinate.js +59 -0
- package/cjs/view/coordinate.js.map +1 -0
- package/cjs/view/data.d.ts +37 -0
- package/cjs/view/data.js +198 -0
- package/cjs/view/data.js.map +1 -0
- package/cjs/view/dataflow.d.ts +32 -0
- package/cjs/view/dataflow.js +146 -0
- package/cjs/view/dataflow.js.map +1 -0
- package/cjs/view/events.d.ts +4 -0
- package/cjs/view/events.js +34 -0
- package/cjs/view/events.js.map +1 -0
- package/cjs/view/glyph-meta.d.ts +29 -0
- package/cjs/view/glyph-meta.js +45 -0
- package/cjs/view/glyph-meta.js.map +1 -0
- package/cjs/view/glyph.d.ts +14 -0
- package/cjs/view/glyph.js +29 -0
- package/cjs/view/glyph.js.map +1 -0
- package/cjs/view/grammar-base.d.ts +46 -0
- package/cjs/view/grammar-base.js +171 -0
- package/cjs/view/grammar-base.js.map +1 -0
- package/cjs/view/grammar-record.d.ts +39 -0
- package/cjs/view/grammar-record.js +180 -0
- package/cjs/view/grammar-record.js.map +1 -0
- package/cjs/view/group.d.ts +13 -0
- package/cjs/view/group.js +39 -0
- package/cjs/view/group.js.map +1 -0
- package/cjs/view/index.d.ts +1 -0
- package/cjs/view/index.js +21 -0
- package/cjs/view/index.js.map +1 -0
- package/cjs/view/mark.d.ts +112 -0
- package/cjs/view/mark.js +600 -0
- package/cjs/view/mark.js.map +1 -0
- package/cjs/view/scale.d.ts +26 -0
- package/cjs/view/scale.js +86 -0
- package/cjs/view/scale.js.map +1 -0
- package/cjs/view/signal.d.ts +18 -0
- package/cjs/view/signal.js +56 -0
- package/cjs/view/signal.js.map +1 -0
- package/es/component/axis.d.ts +26 -0
- package/es/component/axis.js +162 -0
- package/es/component/axis.js.map +1 -0
- package/es/component/crosshair.d.ts +50 -0
- package/es/component/crosshair.js +275 -0
- package/es/component/crosshair.js.map +1 -0
- package/es/component/datazoom.d.ts +19 -0
- package/es/component/datazoom.js +161 -0
- package/es/component/datazoom.js.map +1 -0
- package/es/component/grid.d.ts +27 -0
- package/es/component/grid.js +193 -0
- package/es/component/grid.js.map +1 -0
- package/es/component/index.d.ts +11 -0
- package/es/component/index.js +22 -0
- package/es/component/index.js.map +1 -0
- package/es/component/label.d.ts +19 -0
- package/es/component/label.js +124 -0
- package/es/component/label.js.map +1 -0
- package/es/component/legend.d.ts +26 -0
- package/es/component/legend.js +169 -0
- package/es/component/legend.js.map +1 -0
- package/es/component/player.d.ts +25 -0
- package/es/component/player.js +136 -0
- package/es/component/player.js.map +1 -0
- package/es/component/scale.d.ts +8 -0
- package/es/component/scale.js +19 -0
- package/es/component/scale.js.map +1 -0
- package/es/component/scrollbar.d.ts +23 -0
- package/es/component/scrollbar.js +184 -0
- package/es/component/scrollbar.js.map +1 -0
- package/es/component/slider.d.ts +19 -0
- package/es/component/slider.js +86 -0
- package/es/component/slider.js.map +1 -0
- package/es/component/title.d.ts +15 -0
- package/es/component/title.js +58 -0
- package/es/component/title.js.map +1 -0
- package/es/component/tooltip.d.ts +62 -0
- package/es/component/tooltip.js +303 -0
- package/es/component/tooltip.js.map +1 -0
- package/es/core/factory.d.ts +35 -0
- package/es/core/factory.js +67 -0
- package/es/core/factory.js.map +1 -0
- package/es/glyph/boxplot.d.ts +10 -0
- package/es/glyph/boxplot.js +410 -0
- package/es/glyph/boxplot.js.map +1 -0
- package/es/glyph/index.d.ts +7 -0
- package/es/glyph/index.js +11 -0
- package/es/glyph/index.js.map +1 -0
- package/es/glyph/link-path.d.ts +7 -0
- package/es/glyph/link-path.js +132 -0
- package/es/glyph/link-path.js.map +1 -0
- package/es/glyph/ripple.d.ts +1 -0
- package/es/glyph/ripple.js +38 -0
- package/es/glyph/ripple.js.map +1 -0
- package/es/glyph/tree-path.d.ts +7 -0
- package/es/glyph/tree-path.js +146 -0
- package/es/glyph/tree-path.js.map +1 -0
- package/es/glyph/violin.d.ts +1 -0
- package/es/glyph/violin.js +163 -0
- package/es/glyph/violin.js.map +1 -0
- package/es/glyph/wave.d.ts +1 -0
- package/es/glyph/wave.js +61 -0
- package/es/glyph/wave.js.map +1 -0
- package/es/graph/animation/animate.d.ts +48 -0
- package/es/graph/animation/animate.js +247 -0
- package/es/graph/animation/animate.js.map +1 -0
- package/es/graph/animation/animation/clip.d.ts +4 -0
- package/es/graph/animation/animation/clip.js +44 -0
- package/es/graph/animation/animation/clip.js.map +1 -0
- package/es/graph/animation/animation/fade.d.ts +4 -0
- package/es/graph/animation/animation/fade.js +32 -0
- package/es/graph/animation/animation/fade.js.map +1 -0
- package/es/graph/animation/animation/grow-cartesian.d.ts +7 -0
- package/es/graph/animation/animation/grow-cartesian.js +272 -0
- package/es/graph/animation/animation/grow-cartesian.js.map +1 -0
- package/es/graph/animation/animation/grow-interval.d.ts +3 -0
- package/es/graph/animation/animation/grow-interval.js +184 -0
- package/es/graph/animation/animation/grow-interval.js.map +1 -0
- package/es/graph/animation/animation/grow-points.d.ts +7 -0
- package/es/graph/animation/animation/grow-points.js +107 -0
- package/es/graph/animation/animation/grow-points.js.map +1 -0
- package/es/graph/animation/animation/grow-polar.d.ts +5 -0
- package/es/graph/animation/animation/grow-polar.js +160 -0
- package/es/graph/animation/animation/grow-polar.js.map +1 -0
- package/es/graph/animation/animation/index.d.ts +11 -0
- package/es/graph/animation/animation/index.js +22 -0
- package/es/graph/animation/animation/index.js.map +1 -0
- package/es/graph/animation/animation/move.d.ts +3 -0
- package/es/graph/animation/animation/move.js +78 -0
- package/es/graph/animation/animation/move.js.map +1 -0
- package/es/graph/animation/animation/rotate.d.ts +3 -0
- package/es/graph/animation/animation/rotate.js +32 -0
- package/es/graph/animation/animation/rotate.js.map +1 -0
- package/es/graph/animation/animation/scale.d.ts +3 -0
- package/es/graph/animation/animation/scale.js +74 -0
- package/es/graph/animation/animation/scale.js.map +1 -0
- package/es/graph/animation/animation/update.d.ts +6 -0
- package/es/graph/animation/animation/update.js +20 -0
- package/es/graph/animation/animation/update.js.map +1 -0
- package/es/graph/animation/animator.d.ts +26 -0
- package/es/graph/animation/animator.js +83 -0
- package/es/graph/animation/animator.js.map +1 -0
- package/es/graph/animation/arranger.d.ts +13 -0
- package/es/graph/animation/arranger.js +29 -0
- package/es/graph/animation/arranger.js.map +1 -0
- package/es/graph/animation/attribute.d.ts +27 -0
- package/es/graph/animation/attribute.js +114 -0
- package/es/graph/animation/attribute.js.map +1 -0
- package/es/graph/animation/config.d.ts +5 -0
- package/es/graph/animation/config.js +84 -0
- package/es/graph/animation/config.js.map +1 -0
- package/es/graph/animation/morph.d.ts +12 -0
- package/es/graph/animation/morph.js +171 -0
- package/es/graph/animation/morph.js.map +1 -0
- package/es/graph/attributes/common.d.ts +2 -0
- package/es/graph/attributes/common.js +13 -0
- package/es/graph/attributes/common.js.map +1 -0
- package/es/graph/attributes/helpers.d.ts +17 -0
- package/es/graph/attributes/helpers.js +75 -0
- package/es/graph/attributes/helpers.js.map +1 -0
- package/es/graph/attributes/index.d.ts +10 -0
- package/es/graph/attributes/index.js +231 -0
- package/es/graph/attributes/index.js.map +1 -0
- package/es/graph/canvas-renderer.d.ts +34 -0
- package/es/graph/canvas-renderer.js +115 -0
- package/es/graph/canvas-renderer.js.map +1 -0
- package/es/graph/constants.d.ts +23 -0
- package/es/graph/constants.js +47 -0
- package/es/graph/constants.js.map +1 -0
- package/es/graph/element.d.ts +66 -0
- package/es/graph/element.js +292 -0
- package/es/graph/element.js.map +1 -0
- package/es/graph/enums.d.ts +153 -0
- package/es/graph/enums.js +129 -0
- package/es/graph/enums.js.map +1 -0
- package/es/graph/glyph-element.d.ts +53 -0
- package/es/graph/glyph-element.js +206 -0
- package/es/graph/glyph-element.js.map +1 -0
- package/es/graph/index.d.ts +3 -0
- package/es/graph/index.js +6 -0
- package/es/graph/index.js.map +1 -0
- package/es/graph/layout/grid.d.ts +3 -0
- package/es/graph/layout/grid.js +66 -0
- package/es/graph/layout/grid.js.map +1 -0
- package/es/graph/layout/layout.d.ts +3 -0
- package/es/graph/layout/layout.js +33 -0
- package/es/graph/layout/layout.js.map +1 -0
- package/es/graph/layout/relative.d.ts +3 -0
- package/es/graph/layout/relative.js +85 -0
- package/es/graph/layout/relative.js.map +1 -0
- package/es/graph/mark/differ.d.ts +20 -0
- package/es/graph/mark/differ.js +104 -0
- package/es/graph/mark/differ.js.map +1 -0
- package/es/graph/mark/encode.d.ts +10 -0
- package/es/graph/mark/encode.js +92 -0
- package/es/graph/mark/encode.js.map +1 -0
- package/es/graph/mark/large-rects.d.ts +10 -0
- package/es/graph/mark/large-rects.js +23 -0
- package/es/graph/mark/large-rects.js.map +1 -0
- package/es/graph/mark/large-symbols.d.ts +11 -0
- package/es/graph/mark/large-symbols.js +27 -0
- package/es/graph/mark/large-symbols.js.map +1 -0
- package/es/graph/mark-tree.d.ts +2 -0
- package/es/graph/mark-tree.js +15 -0
- package/es/graph/mark-tree.js.map +1 -0
- package/es/graph/util/element.d.ts +2 -0
- package/es/graph/util/element.js +8 -0
- package/es/graph/util/element.js.map +1 -0
- package/es/graph/util/env.d.ts +2 -0
- package/es/graph/util/env.js +6 -0
- package/es/graph/util/env.js.map +1 -0
- package/es/graph/util/events-extend.d.ts +5 -0
- package/es/graph/util/events-extend.js +12 -0
- package/es/graph/util/events-extend.js.map +1 -0
- package/es/graph/util/graphic.d.ts +9 -0
- package/es/graph/util/graphic.js +59 -0
- package/es/graph/util/graphic.js.map +1 -0
- package/es/graph/util/point.d.ts +1 -0
- package/es/graph/util/point.js +67 -0
- package/es/graph/util/point.js.map +1 -0
- package/es/index.d.ts +14 -0
- package/es/index.js +27 -0
- package/es/index.js.map +1 -0
- package/es/parse/coordinate.d.ts +7 -0
- package/es/parse/coordinate.js +65 -0
- package/es/parse/coordinate.js.map +1 -0
- package/es/parse/event.d.ts +8 -0
- package/es/parse/event.js +23 -0
- package/es/parse/event.js.map +1 -0
- package/es/parse/mark.d.ts +4 -0
- package/es/parse/mark.js +19 -0
- package/es/parse/mark.js.map +1 -0
- package/es/parse/option.d.ts +3 -0
- package/es/parse/option.js +10 -0
- package/es/parse/option.js.map +1 -0
- package/es/parse/scale.d.ts +8 -0
- package/es/parse/scale.js +347 -0
- package/es/parse/scale.js.map +1 -0
- package/es/parse/transform.d.ts +5 -0
- package/es/parse/transform.js +102 -0
- package/es/parse/transform.js.map +1 -0
- package/es/parse/util.d.ts +13 -0
- package/es/parse/util.js +65 -0
- package/es/parse/util.js.map +1 -0
- package/es/parse/view.d.ts +17 -0
- package/es/parse/view.js +98 -0
- package/es/parse/view.js.map +1 -0
- package/es/semantic-marks/cell.d.ts +13 -0
- package/es/semantic-marks/cell.js +57 -0
- package/es/semantic-marks/cell.js.map +1 -0
- package/es/semantic-marks/interval.d.ts +14 -0
- package/es/semantic-marks/interval.js +87 -0
- package/es/semantic-marks/interval.js.map +1 -0
- package/es/semantic-marks/text.d.ts +10 -0
- package/es/semantic-marks/text.js +22 -0
- package/es/semantic-marks/text.js.map +1 -0
- package/es/theme/common/component.d.ts +15 -0
- package/es/theme/common/component.js +510 -0
- package/es/theme/common/component.js.map +1 -0
- package/es/theme/common/constants.d.ts +1 -0
- package/es/theme/common/constants.js +2 -0
- package/es/theme/common/constants.js.map +1 -0
- package/es/theme/common/mark.d.ts +2 -0
- package/es/theme/common/mark.js +11 -0
- package/es/theme/common/mark.js.map +1 -0
- package/es/theme/dark.d.ts +2 -0
- package/es/theme/dark.js +96 -0
- package/es/theme/dark.js.map +1 -0
- package/es/theme/default.d.ts +2 -0
- package/es/theme/default.js +16 -0
- package/es/theme/default.js.map +1 -0
- package/es/theme/theme-manager.d.ts +8 -0
- package/es/theme/theme-manager.js +22 -0
- package/es/theme/theme-manager.js.map +1 -0
- package/es/transforms/data/bin.d.ts +2 -0
- package/es/transforms/data/bin.js +16 -0
- package/es/transforms/data/bin.js.map +1 -0
- package/es/transforms/data/circular-relation.d.ts +2 -0
- package/es/transforms/data/circular-relation.js +44 -0
- package/es/transforms/data/circular-relation.js.map +1 -0
- package/es/transforms/data/contour.d.ts +2 -0
- package/es/transforms/data/contour.js +111 -0
- package/es/transforms/data/contour.js.map +1 -0
- package/es/transforms/data/filter.d.ts +2 -0
- package/es/transforms/data/filter.js +2 -0
- package/es/transforms/data/filter.js.map +1 -0
- package/es/transforms/data/fold.d.ts +2 -0
- package/es/transforms/data/fold.js +16 -0
- package/es/transforms/data/fold.js.map +1 -0
- package/es/transforms/data/funnel.d.ts +2 -0
- package/es/transforms/data/funnel.js +17 -0
- package/es/transforms/data/funnel.js.map +1 -0
- package/es/transforms/data/join.d.ts +2 -0
- package/es/transforms/data/join.js +26 -0
- package/es/transforms/data/join.js.map +1 -0
- package/es/transforms/data/kde.d.ts +2 -0
- package/es/transforms/data/kde.js +80 -0
- package/es/transforms/data/kde.js.map +1 -0
- package/es/transforms/data/map.d.ts +2 -0
- package/es/transforms/data/map.js +16 -0
- package/es/transforms/data/map.js.map +1 -0
- package/es/transforms/data/pick.d.ts +2 -0
- package/es/transforms/data/pick.js +15 -0
- package/es/transforms/data/pick.js.map +1 -0
- package/es/transforms/data/pie.d.ts +2 -0
- package/es/transforms/data/pie.js +18 -0
- package/es/transforms/data/pie.js.map +1 -0
- package/es/transforms/data/range.d.ts +4 -0
- package/es/transforms/data/range.js +9 -0
- package/es/transforms/data/range.js.map +1 -0
- package/es/transforms/data/sort.d.ts +2 -0
- package/es/transforms/data/sort.js +13 -0
- package/es/transforms/data/sort.js.map +1 -0
- package/es/transforms/data/stack.d.ts +2 -0
- package/es/transforms/data/stack.js +72 -0
- package/es/transforms/data/stack.js.map +1 -0
- package/es/transforms/data/unfold.d.ts +2 -0
- package/es/transforms/data/unfold.js +45 -0
- package/es/transforms/data/unfold.js.map +1 -0
- package/es/transforms/index.d.ts +23 -0
- package/es/transforms/index.js +205 -0
- package/es/transforms/index.js.map +1 -0
- package/es/transforms/mark/dodge.d.ts +2 -0
- package/es/transforms/mark/dodge.js +74 -0
- package/es/transforms/mark/dodge.js.map +1 -0
- package/es/transforms/mark/jitter.d.ts +4 -0
- package/es/transforms/mark/jitter.js +48 -0
- package/es/transforms/mark/jitter.js.map +1 -0
- package/es/transforms/mark/lttb-sample.d.ts +2 -0
- package/es/transforms/mark/lttb-sample.js +60 -0
- package/es/transforms/mark/lttb-sample.js.map +1 -0
- package/es/transforms/mark/mark-overlap.d.ts +2 -0
- package/es/transforms/mark/mark-overlap.js +71 -0
- package/es/transforms/mark/mark-overlap.js.map +1 -0
- package/es/transforms/mark/symmetry.d.ts +2 -0
- package/es/transforms/mark/symmetry.js +20 -0
- package/es/transforms/mark/symmetry.js.map +1 -0
- package/es/transforms/util/util.d.ts +5 -0
- package/es/transforms/util/util.js +33 -0
- package/es/transforms/util/util.js.map +1 -0
- package/es/transforms/view/identifier.d.ts +2 -0
- package/es/transforms/view/identifier.js +13 -0
- package/es/transforms/view/identifier.js.map +1 -0
- package/es/types/animate.d.ts +224 -0
- package/es/types/animate.js +2 -0
- package/es/types/animate.js.map +1 -0
- package/es/types/base.d.ts +36 -0
- package/es/types/base.js +2 -0
- package/es/types/base.js.map +1 -0
- package/es/types/component.d.ts +240 -0
- package/es/types/component.js +2 -0
- package/es/types/component.js.map +1 -0
- package/es/types/coordinate.d.ts +15 -0
- package/es/types/coordinate.js +2 -0
- package/es/types/coordinate.js.map +1 -0
- package/es/types/data.d.ts +55 -0
- package/es/types/data.js +1 -0
- package/es/types/data.js.map +1 -0
- package/es/types/dataflow.d.ts +13 -0
- package/es/types/dataflow.js +2 -0
- package/es/types/dataflow.js.map +1 -0
- package/es/types/element.d.ts +117 -0
- package/es/types/element.js +2 -0
- package/es/types/element.js.map +1 -0
- package/es/types/event.d.ts +58 -0
- package/es/types/event.js +2 -0
- package/es/types/event.js.map +1 -0
- package/es/types/glyph.d.ts +29 -0
- package/es/types/glyph.js +2 -0
- package/es/types/glyph.js.map +1 -0
- package/es/types/grammar.d.ts +184 -0
- package/es/types/grammar.js +2 -0
- package/es/types/grammar.js.map +1 -0
- package/es/types/hooks.d.ts +45 -0
- package/es/types/hooks.js +2 -0
- package/es/types/hooks.js.map +1 -0
- package/es/types/index.d.ts +22 -0
- package/es/types/index.js +44 -0
- package/es/types/index.js.map +1 -0
- package/es/types/layout.d.ts +5 -0
- package/es/types/layout.js +2 -0
- package/es/types/layout.js.map +1 -0
- package/es/types/mark.d.ts +344 -0
- package/es/types/mark.js +2 -0
- package/es/types/mark.js.map +1 -0
- package/es/types/morph.d.ts +29 -0
- package/es/types/morph.js +2 -0
- package/es/types/morph.js.map +1 -0
- package/es/types/plot.d.ts +326 -0
- package/es/types/plot.js +2 -0
- package/es/types/plot.js.map +1 -0
- package/es/types/projection.d.ts +61 -0
- package/es/types/projection.js +2 -0
- package/es/types/projection.js.map +1 -0
- package/es/types/renderer.d.ts +19 -0
- package/es/types/renderer.js +2 -0
- package/es/types/renderer.js.map +1 -0
- package/es/types/scale.d.ts +111 -0
- package/es/types/scale.js +2 -0
- package/es/types/scale.js.map +1 -0
- package/es/types/signal.d.ts +20 -0
- package/es/types/signal.js +2 -0
- package/es/types/signal.js.map +1 -0
- package/es/types/theme.d.ts +41 -0
- package/es/types/theme.js +2 -0
- package/es/types/theme.js.map +1 -0
- package/es/types/transform.d.ts +291 -0
- package/es/types/transform.js +2 -0
- package/es/types/transform.js.map +1 -0
- package/es/types/view.d.ts +217 -0
- package/es/types/view.js +2 -0
- package/es/types/view.js.map +1 -0
- package/es/util/data.d.ts +3 -0
- package/es/util/data.js +60 -0
- package/es/util/data.js.map +1 -0
- package/es/util/grammar-heap.d.ts +14 -0
- package/es/util/grammar-heap.js +58 -0
- package/es/util/grammar-heap.js.map +1 -0
- package/es/util/text.d.ts +19 -0
- package/es/util/text.js +25 -0
- package/es/util/text.js.map +1 -0
- package/es/util/unique-list.d.ts +12 -0
- package/es/util/unique-list.js +29 -0
- package/es/util/unique-list.js.map +1 -0
- package/es/view/View.d.ts +157 -0
- package/es/view/View.js +836 -0
- package/es/view/View.js.map +1 -0
- package/es/view/animate.d.ts +20 -0
- package/es/view/animate.js +98 -0
- package/es/view/animate.js.map +1 -0
- package/es/view/component.d.ts +26 -0
- package/es/view/component.js +64 -0
- package/es/view/component.js.map +1 -0
- package/es/view/constants.d.ts +17 -0
- package/es/view/constants.js +32 -0
- package/es/view/constants.js.map +1 -0
- package/es/view/coordinate.d.ts +23 -0
- package/es/view/coordinate.js +52 -0
- package/es/view/coordinate.js.map +1 -0
- package/es/view/data.d.ts +37 -0
- package/es/view/data.js +195 -0
- package/es/view/data.js.map +1 -0
- package/es/view/dataflow.d.ts +32 -0
- package/es/view/dataflow.js +141 -0
- package/es/view/dataflow.js.map +1 -0
- package/es/view/events.d.ts +4 -0
- package/es/view/events.js +26 -0
- package/es/view/events.js.map +1 -0
- package/es/view/glyph-meta.d.ts +29 -0
- package/es/view/glyph-meta.js +37 -0
- package/es/view/glyph-meta.js.map +1 -0
- package/es/view/glyph.d.ts +14 -0
- package/es/view/glyph.js +27 -0
- package/es/view/glyph.js.map +1 -0
- package/es/view/grammar-base.d.ts +46 -0
- package/es/view/grammar-base.js +165 -0
- package/es/view/grammar-base.js.map +1 -0
- package/es/view/grammar-record.d.ts +39 -0
- package/es/view/grammar-record.js +170 -0
- package/es/view/grammar-record.js.map +1 -0
- package/es/view/group.d.ts +13 -0
- package/es/view/group.js +39 -0
- package/es/view/group.js.map +1 -0
- package/es/view/index.d.ts +1 -0
- package/es/view/index.js +2 -0
- package/es/view/index.js.map +1 -0
- package/es/view/mark.d.ts +112 -0
- package/es/view/mark.js +604 -0
- package/es/view/mark.js.map +1 -0
- package/es/view/scale.d.ts +26 -0
- package/es/view/scale.js +82 -0
- package/es/view/scale.js.map +1 -0
- package/es/view/signal.d.ts +18 -0
- package/es/view/signal.js +52 -0
- package/es/view/signal.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.registerGrid = exports.Grid = exports.generateCircleAxisGridAttributes = exports.generateLineAxisGridAttributes = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), vrender_components_1 = require("@visactor/vrender-components"), graph_1 = require("../graph"), scale_1 = require("./scale"), encode_1 = require("../graph/mark/encode"), util_1 = require("../parse/util"), axis_1 = require("./axis"), factory_1 = require("../core/factory"), generateLineAxisGridAttributes = (scale, theme, addition, tickCount) => {
|
|
8
|
+
var _a, _b, _c, _d;
|
|
9
|
+
const gridTheme = null !== (_b = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.grid) && void 0 !== _b ? _b : {};
|
|
10
|
+
if (!scale) return (0, vutils_1.merge)({}, gridTheme, null != addition ? addition : {});
|
|
11
|
+
const items = (null !== (_d = null === (_c = scale.tickData) || void 0 === _c ? void 0 : _c.call(scale, tickCount)) && void 0 !== _d ? _d : []).map((tick => ({
|
|
12
|
+
id: tick.index,
|
|
13
|
+
label: tick.tick,
|
|
14
|
+
value: tick.value,
|
|
15
|
+
rawValue: tick.tick
|
|
16
|
+
})));
|
|
17
|
+
return (0, vutils_1.merge)({}, gridTheme, {
|
|
18
|
+
items: items
|
|
19
|
+
}, null != addition ? addition : {});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.generateLineAxisGridAttributes = generateLineAxisGridAttributes;
|
|
23
|
+
|
|
24
|
+
const generateCircleAxisGridAttributes = (scale, theme, addition, tickCount) => {
|
|
25
|
+
var _a, _b, _c, _d;
|
|
26
|
+
const gridTheme = null !== (_b = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.circleGrid) && void 0 !== _b ? _b : {};
|
|
27
|
+
if (!scale) return (0, vutils_1.merge)({}, gridTheme, null != addition ? addition : {});
|
|
28
|
+
const items = (null !== (_d = null === (_c = scale.tickData) || void 0 === _c ? void 0 : _c.call(scale, tickCount)) && void 0 !== _d ? _d : []).map((tick => ({
|
|
29
|
+
id: tick.index,
|
|
30
|
+
label: tick.tick,
|
|
31
|
+
value: tick.value,
|
|
32
|
+
rawValue: tick.tick
|
|
33
|
+
})));
|
|
34
|
+
return (0, vutils_1.merge)({}, gridTheme, {
|
|
35
|
+
items: items
|
|
36
|
+
}, null != addition ? addition : {});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.generateCircleAxisGridAttributes = generateCircleAxisGridAttributes;
|
|
40
|
+
|
|
41
|
+
class Grid extends scale_1.ScaleComponent {
|
|
42
|
+
constructor(view, group, mode) {
|
|
43
|
+
super(view, graph_1.ComponentEnum.grid, group), this.spec.componentType = graph_1.ComponentEnum.grid,
|
|
44
|
+
this.mode = mode;
|
|
45
|
+
}
|
|
46
|
+
parseAddition(spec) {
|
|
47
|
+
return super.parseAddition(spec), this.target(spec.target), this.gridType(spec.gridType),
|
|
48
|
+
this.gridShape(spec.gridShape), this;
|
|
49
|
+
}
|
|
50
|
+
scale(scale) {
|
|
51
|
+
return super.scale(scale), this._gridComponentType = null, this;
|
|
52
|
+
}
|
|
53
|
+
gridType(gridType) {
|
|
54
|
+
return this.spec.gridType = gridType, this._gridComponentType = null, this._prepareRejoin(),
|
|
55
|
+
this.commit(), this;
|
|
56
|
+
}
|
|
57
|
+
gridShape(gridShape) {
|
|
58
|
+
return this.spec.gridShape = gridShape, this.commit(), this;
|
|
59
|
+
}
|
|
60
|
+
target(axis) {
|
|
61
|
+
if (this.spec.target) {
|
|
62
|
+
const prevAxis = (0, vutils_1.isString)(this.spec.target) ? this.view.getMarkById(this.spec.target) : this.spec.target;
|
|
63
|
+
this.detach(prevAxis);
|
|
64
|
+
}
|
|
65
|
+
this.spec.target = axis;
|
|
66
|
+
const nextAxis = (0, vutils_1.isString)(axis) ? this.view.getMarkById(axis) : axis;
|
|
67
|
+
return this.attach(nextAxis), this._targetAxis = nextAxis, this._gridComponentType = null,
|
|
68
|
+
this._updateComponentEncoders(), this.commit(), this;
|
|
69
|
+
}
|
|
70
|
+
tickCount(tickCount) {
|
|
71
|
+
return this.setFunctionSpec(tickCount, "tickCount");
|
|
72
|
+
}
|
|
73
|
+
inside(inside) {
|
|
74
|
+
return this.setFunctionSpec(inside, "inside");
|
|
75
|
+
}
|
|
76
|
+
baseValue(baseValue) {
|
|
77
|
+
return this.setFunctionSpec(baseValue, "baseValue");
|
|
78
|
+
}
|
|
79
|
+
addGraphicItem(attrs, groupKey) {
|
|
80
|
+
const initialAttributes = (0, vutils_1.merge)({
|
|
81
|
+
x: 0,
|
|
82
|
+
y: 0,
|
|
83
|
+
start: {
|
|
84
|
+
x: 0,
|
|
85
|
+
y: 0
|
|
86
|
+
},
|
|
87
|
+
end: {
|
|
88
|
+
x: 0,
|
|
89
|
+
y: 0
|
|
90
|
+
}
|
|
91
|
+
}, attrs), graphicItem = factory_1.Factory.createGraphicComponent(this._getGridComponentType(), initialAttributes, this.mode);
|
|
92
|
+
return super.addGraphicItem(initialAttributes, groupKey, graphicItem);
|
|
93
|
+
}
|
|
94
|
+
_updateComponentEncoders() {
|
|
95
|
+
const encoders = Object.assign({
|
|
96
|
+
update: {}
|
|
97
|
+
}, this.spec.encode), componentEncoders = Object.keys(encoders).reduce(((res, state) => {
|
|
98
|
+
const encoder = encoders[state];
|
|
99
|
+
return encoder && (res[state] = {
|
|
100
|
+
callback: (datum, element, parameters) => {
|
|
101
|
+
var _a, _b, _c, _d;
|
|
102
|
+
const theme = this.view.getCurrentTheme();
|
|
103
|
+
let scaleGrammar, addition = (0, encode_1.invokeEncoder)(encoder, datum, element, parameters);
|
|
104
|
+
const baseValue = (0, util_1.invokeFunctionType)(this.spec.baseValue, parameters, datum, element);
|
|
105
|
+
if (this._targetAxis) {
|
|
106
|
+
const targetScale = null === (_a = this._targetAxis.getSpec()) || void 0 === _a ? void 0 : _a.scale;
|
|
107
|
+
scaleGrammar = (0, vutils_1.isString)(targetScale) ? this.view.getScaleById(targetScale) : targetScale;
|
|
108
|
+
const targetElement = this._targetAxis.elements[0];
|
|
109
|
+
if (targetElement) switch (this._getGridComponentType()) {
|
|
110
|
+
case graph_1.GridEnum.lineAxisGrid:
|
|
111
|
+
addition = Object.assign({
|
|
112
|
+
x: targetElement.getGraphicAttribute("x"),
|
|
113
|
+
y: targetElement.getGraphicAttribute("y"),
|
|
114
|
+
start: targetElement.getGraphicAttribute("start"),
|
|
115
|
+
end: targetElement.getGraphicAttribute("end"),
|
|
116
|
+
verticalFactor: null !== (_b = targetElement.getGraphicAttribute("verticalFactor")) && void 0 !== _b ? _b : 1
|
|
117
|
+
}, addition);
|
|
118
|
+
break;
|
|
119
|
+
|
|
120
|
+
case graph_1.GridEnum.circleAxisGrid:
|
|
121
|
+
addition = Object.assign({
|
|
122
|
+
x: targetElement.getGraphicAttribute("x"),
|
|
123
|
+
y: targetElement.getGraphicAttribute("y"),
|
|
124
|
+
center: targetElement.getGraphicAttribute("center"),
|
|
125
|
+
radius: targetElement.getGraphicAttribute("radius"),
|
|
126
|
+
innerRadius: targetElement.getGraphicAttribute("innerRadius"),
|
|
127
|
+
inside: targetElement.getGraphicAttribute("inside"),
|
|
128
|
+
startAngle: targetElement.getGraphicAttribute("startAngle"),
|
|
129
|
+
endAngle: targetElement.getGraphicAttribute("endAngle")
|
|
130
|
+
}, addition);
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
scaleGrammar = (0, vutils_1.isString)(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;
|
|
134
|
+
const inside = (0, util_1.invokeFunctionType)(this.spec.inside, parameters, datum, element), coordinate = null === (_c = null == scaleGrammar ? void 0 : scaleGrammar.getCoordinate) || void 0 === _c ? void 0 : _c.call(scaleGrammar);
|
|
135
|
+
coordinate && (addition = Object.assign((0, axis_1.generateCoordinateAxisAttribute)(scaleGrammar, coordinate, inside, baseValue, this.spec.layout, !0), addition));
|
|
136
|
+
}
|
|
137
|
+
this._getGridComponentType() === graph_1.GridEnum.lineAxisGrid && (addition = "line" !== this.spec.gridShape && this.spec.gridShape ? Object.assign({
|
|
138
|
+
center: addition.start,
|
|
139
|
+
closed: !0
|
|
140
|
+
}, addition, {
|
|
141
|
+
type: this.spec.gridShape
|
|
142
|
+
}) : Object.assign({}, addition, {
|
|
143
|
+
type: "line"
|
|
144
|
+
}));
|
|
145
|
+
const scale = null === (_d = null == scaleGrammar ? void 0 : scaleGrammar.getScale) || void 0 === _d ? void 0 : _d.call(scaleGrammar), tickCount = (0,
|
|
146
|
+
util_1.invokeFunctionType)(this.spec.tickCount, parameters, datum, element);
|
|
147
|
+
switch (this._getGridComponentType()) {
|
|
148
|
+
case graph_1.GridEnum.lineAxisGrid:
|
|
149
|
+
return (0, exports.generateLineAxisGridAttributes)(scale, theme, addition, tickCount);
|
|
150
|
+
|
|
151
|
+
case graph_1.GridEnum.circleAxisGrid:
|
|
152
|
+
return (0, exports.generateCircleAxisGridAttributes)(scale, theme, addition, tickCount);
|
|
153
|
+
}
|
|
154
|
+
return addition;
|
|
155
|
+
}
|
|
156
|
+
}), res;
|
|
157
|
+
}), {});
|
|
158
|
+
this._encoders = componentEncoders;
|
|
159
|
+
}
|
|
160
|
+
_getGridComponentType() {
|
|
161
|
+
var _a;
|
|
162
|
+
if (this._gridComponentType) return this._gridComponentType;
|
|
163
|
+
if (this.spec.gridType) if ("circle" === this.spec.gridType) this._gridComponentType = graph_1.GridEnum.circleAxisGrid; else this._gridComponentType = graph_1.GridEnum.lineAxisGrid; else if (this._targetAxis) {
|
|
164
|
+
switch (this._targetAxis.getAxisComponentType()) {
|
|
165
|
+
case graph_1.AxisEnum.circleAxis:
|
|
166
|
+
this._gridComponentType = graph_1.GridEnum.circleAxisGrid;
|
|
167
|
+
break;
|
|
168
|
+
|
|
169
|
+
case graph_1.AxisEnum.lineAxis:
|
|
170
|
+
default:
|
|
171
|
+
this._gridComponentType = graph_1.GridEnum.lineAxisGrid;
|
|
172
|
+
}
|
|
173
|
+
} else if (this.spec.scale) {
|
|
174
|
+
const scaleGrammar = (0, vutils_1.isString)(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;
|
|
175
|
+
this._gridComponentType = (null === (_a = null == scaleGrammar ? void 0 : scaleGrammar.getCoordinate) || void 0 === _a ? void 0 : _a.call(scaleGrammar)) ? scaleGrammar.getCoordinateAxisPoints() ? graph_1.GridEnum.lineAxisGrid : graph_1.GridEnum.circleAxisGrid : graph_1.GridEnum.lineAxisGrid;
|
|
176
|
+
} else this._gridComponentType = graph_1.GridEnum.lineAxisGrid;
|
|
177
|
+
return this._gridComponentType;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
exports.Grid = Grid, Grid.componentType = graph_1.ComponentEnum.grid;
|
|
182
|
+
|
|
183
|
+
const registerGrid = () => {
|
|
184
|
+
factory_1.Factory.registerGraphicComponent(graph_1.GridEnum.lineAxisGrid, ((attrs, mode) => new vrender_components_1.LineAxisGrid(attrs, mode))),
|
|
185
|
+
factory_1.Factory.registerGraphicComponent(graph_1.GridEnum.circleAxisGrid, ((attrs, mode) => new vrender_components_1.CircleAxisGrid(attrs))),
|
|
186
|
+
factory_1.Factory.registerComponent(graph_1.ComponentEnum.grid, Grid);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
exports.registerGrid = registerGrid;
|
|
190
|
+
//# sourceMappingURL=grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/component/grid.ts"],"names":[],"mappings":";;;AAAA,6CAAmD;AAInD,qEAA4E;AAe5E,oCAA6D;AAE7D,mCAAyC;AACzC,iDAAqD;AACrD,wCAAmD;AACnD,iCAAyD;AACzD,6CAA0C;AAEnC,MAAM,8BAA8B,GAAG,CAC5C,KAAiB,EACjB,KAAc,EACd,QAAmD,EACnD,SAAkB,EACM,EAAE;;IAC1B,MAAM,SAAS,GAAG,MAAA,MAAA,KAA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GAAG,gBAAQ,CAAC,YAAY,CAAC;SACjD;QAED,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;;AAnOH,oBAoOC;AAnOiB,kBAAa,GAAW,qBAAa,CAAC,IAAI,CAAC;AAqOtD,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,iBAAO,CAAC,wBAAwB,CAC9B,gBAAQ,CAAC,YAAY,EACrB,CAAC,KAA6B,EAAE,IAAkB,EAAE,EAAE,CAAC,IAAI,iCAAY,CAAC,KAAK,EAAE,IAAI,CAAwB,CAC5G,CAAC;IAEF,iBAAO,CAAC,wBAAwB,CAC9B,gBAAQ,CAAC,cAAc,EACvB,CAAC,KAA+B,EAAE,IAAkB,EAAE,EAAE,CAAC,IAAI,mCAAc,CAAC,KAAK,CAAwB,CAC1G,CAAC;IAEF,iBAAO,CAAC,iBAAiB,CAAC,qBAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC,CAAC;AAZW,QAAA,YAAY,gBAYvB","file":"grid.js","sourcesContent":["import { isString, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender';\nimport type { CircleAxisGridAttributes, LineAxisGridAttributes } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { CircleAxisGrid, LineAxisGrid } from '@visactor/vrender-components';\nimport type { IBaseScale } from '@visactor/vscale';\nimport type {\n BaseSignleEncodeSpec,\n IElement,\n IGroupMark,\n IScale,\n ITheme,\n IView,\n MarkFunctionType,\n MarkRelativeItemSpec,\n Nil,\n RecursivePartial,\n StateEncodeSpec\n} from '../types';\nimport { AxisEnum, ComponentEnum, GridEnum } from '../graph';\nimport type { GridShape, GridSpec, AxisType, IAxis, IGrid } from '../types/component';\nimport { ScaleComponent } from './scale';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport { generateCoordinateAxisAttribute } from './axis';\nimport { Factory } from '../core/factory';\n\nexport const generateLineAxisGridAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<LineAxisGridAttributes>,\n tickCount?: number\n): LineAxisGridAttributes => {\n const gridTheme = theme?.components?.grid ?? {};\n if (!scale) {\n return merge({}, gridTheme, addition ?? {});\n }\n const tickData = scale.tickData?.(tickCount) ?? [];\n const items = tickData.map(tick => ({\n id: tick.index,\n label: tick.tick,\n value: tick.value,\n rawValue: tick.tick\n }));\n return merge({}, gridTheme, { items }, addition ?? {});\n};\n\nexport const generateCircleAxisGridAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<CircleAxisGridAttributes>,\n tickCount?: number\n): CircleAxisGridAttributes => {\n const gridTheme = theme?.components?.circleGrid ?? {};\n if (!scale) {\n return merge({}, gridTheme, addition ?? {});\n }\n const tickData = scale.tickData?.(tickCount) ?? [];\n const items = tickData.map(tick => ({\n id: tick.index,\n label: tick.tick,\n value: tick.value,\n rawValue: tick.tick\n }));\n return merge({}, gridTheme, { items }, addition ?? {});\n};\n\nexport class Grid extends ScaleComponent implements IGrid {\n static readonly componentType: string = ComponentEnum.grid;\n protected declare spec: GridSpec;\n\n protected mode?: '2d' | '3d';\n\n private _gridComponentType: keyof typeof GridEnum;\n private _targetAxis: IAxis;\n\n constructor(view: IView, group?: IGroupMark, mode?: '2d' | '3d') {\n super(view, ComponentEnum.grid, group);\n this.spec.componentType = ComponentEnum.grid;\n this.mode = mode;\n }\n\n protected parseAddition(spec: GridSpec) {\n super.parseAddition(spec);\n this.target(spec.target);\n this.gridType(spec.gridType);\n this.gridShape(spec.gridShape);\n return this;\n }\n\n scale(scale?: IScale | string | Nil) {\n super.scale(scale);\n this._gridComponentType = null;\n return this;\n }\n\n gridType(gridType: AxisType | Nil) {\n this.spec.gridType = gridType;\n this._gridComponentType = null;\n this._prepareRejoin();\n this.commit();\n return this;\n }\n\n gridShape(gridShape: GridShape | Nil) {\n this.spec.gridShape = gridShape;\n // no need to rejoin when gridShape is updated\n // this._gridComponentType = null;\n // this._prepareRejoin();\n this.commit();\n return this;\n }\n\n target(axis: IAxis | string | Nil) {\n if (this.spec.target) {\n const prevAxis = isString(this.spec.target)\n ? (this.view.getMarkById(this.spec.target) as IAxis)\n : this.spec.target;\n this.detach(prevAxis);\n }\n this.spec.target = axis;\n const nextAxis = isString(axis) ? (this.view.getMarkById(axis) as IAxis) : axis;\n this.attach(nextAxis);\n this._targetAxis = nextAxis;\n\n // clear grid type when target is updated\n this._gridComponentType = null;\n this._updateComponentEncoders();\n\n this.commit();\n return this;\n }\n\n tickCount(tickCount: MarkFunctionType<number> | Nil) {\n return this.setFunctionSpec(tickCount, 'tickCount');\n }\n\n inside(inside: MarkFunctionType<boolean> | Nil) {\n return this.setFunctionSpec(inside, 'inside');\n }\n\n baseValue(baseValue: MarkFunctionType<number> | Nil) {\n return this.setFunctionSpec(baseValue, 'baseValue');\n }\n\n addGraphicItem(attrs: any, groupKey?: string) {\n const defaultAttributes = { x: 0, y: 0, start: { x: 0, y: 0 }, end: { x: 0, y: 0 } };\n const initialAttributes = merge(defaultAttributes, attrs);\n const graphicItem = Factory.createGraphicComponent(this._getGridComponentType(), initialAttributes, this.mode);\n return super.addGraphicItem(initialAttributes, groupKey, graphicItem);\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const theme = this.view.getCurrentTheme();\n let addition = invokeEncoder(encoder as BaseSignleEncodeSpec, datum, element, parameters);\n let scaleGrammar: IScale;\n const baseValue = invokeFunctionType(this.spec.baseValue, parameters, datum, element);\n\n // get attributes from target axis\n if (this._targetAxis) {\n const targetScale = this._targetAxis.getSpec()?.scale as IScale | string | Nil;\n scaleGrammar = isString(targetScale) ? this.view.getScaleById(targetScale) : targetScale;\n\n const targetElement = this._targetAxis.elements[0];\n if (targetElement) {\n switch (this._getGridComponentType()) {\n case GridEnum.lineAxisGrid:\n addition = Object.assign(\n {\n x: targetElement.getGraphicAttribute('x'),\n y: targetElement.getGraphicAttribute('y'),\n start: targetElement.getGraphicAttribute('start'),\n end: targetElement.getGraphicAttribute('end'),\n verticalFactor: targetElement.getGraphicAttribute('verticalFactor') ?? 1\n },\n addition\n );\n break;\n case GridEnum.circleAxisGrid:\n addition = Object.assign(\n {\n x: targetElement.getGraphicAttribute('x'),\n y: targetElement.getGraphicAttribute('y'),\n center: targetElement.getGraphicAttribute('center'),\n radius: targetElement.getGraphicAttribute('radius'),\n innerRadius: targetElement.getGraphicAttribute('innerRadius'),\n inside: targetElement.getGraphicAttribute('inside'),\n startAngle: targetElement.getGraphicAttribute('startAngle'),\n endAngle: targetElement.getGraphicAttribute('endAngle')\n },\n addition\n );\n break;\n }\n }\n }\n // compute attribute by spec\n else {\n scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n const inside = invokeFunctionType(this.spec.inside, parameters, datum, element);\n\n const coordinate = scaleGrammar?.getCoordinate?.();\n if (coordinate) {\n addition = Object.assign(\n generateCoordinateAxisAttribute(\n scaleGrammar,\n coordinate,\n inside,\n baseValue,\n this.spec.layout as MarkRelativeItemSpec,\n true\n ),\n addition\n );\n }\n }\n\n // compute addition shape attributes for line grid\n if (this._getGridComponentType() === GridEnum.lineAxisGrid) {\n if (this.spec.gridShape === 'line' || !this.spec.gridShape) {\n // set axis type\n addition = Object.assign({}, addition, { type: 'line' });\n } else {\n // set addition length & axis type\n addition = Object.assign(\n {\n center: addition.start,\n closed: true\n },\n addition,\n { type: this.spec.gridShape }\n );\n }\n }\n\n const scale = scaleGrammar?.getScale?.();\n const tickCount = invokeFunctionType(this.spec.tickCount, parameters, datum, element);\n switch (this._getGridComponentType()) {\n case GridEnum.lineAxisGrid:\n return generateLineAxisGridAttributes(scale, theme, addition, tickCount);\n case GridEnum.circleAxisGrid:\n return generateCircleAxisGridAttributes(scale, theme, addition, tickCount);\n }\n return addition;\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n\n private _getGridComponentType() {\n if (this._gridComponentType) {\n return this._gridComponentType;\n }\n\n if (this.spec.gridType) {\n switch (this.spec.gridType) {\n case 'circle':\n this._gridComponentType = GridEnum.circleAxisGrid;\n break;\n case 'line':\n default:\n this._gridComponentType = GridEnum.lineAxisGrid;\n }\n } else if (this._targetAxis) {\n const axisComponentType = this._targetAxis.getAxisComponentType();\n switch (axisComponentType) {\n case AxisEnum.circleAxis:\n this._gridComponentType = GridEnum.circleAxisGrid;\n break;\n case AxisEnum.lineAxis:\n default:\n this._gridComponentType = GridEnum.lineAxisGrid;\n }\n } else if (this.spec.scale) {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n this._gridComponentType = scaleGrammar?.getCoordinate?.()\n ? scaleGrammar.getCoordinateAxisPoints()\n ? GridEnum.lineAxisGrid\n : GridEnum.circleAxisGrid\n : GridEnum.lineAxisGrid;\n } else {\n this._gridComponentType = GridEnum.lineAxisGrid;\n }\n\n return this._gridComponentType;\n }\n}\n\nexport const registerGrid = () => {\n Factory.registerGraphicComponent(\n GridEnum.lineAxisGrid,\n (attrs: LineAxisGridAttributes, mode?: '2d' | '3d') => new LineAxisGrid(attrs, mode) as unknown as IGraphic\n );\n\n Factory.registerGraphicComponent(\n GridEnum.circleAxisGrid,\n (attrs: CircleAxisGridAttributes, mode?: '2d' | '3d') => new CircleAxisGrid(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.grid, Grid);\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { registerAxis } from './axis';
|
|
2
|
+
export { registerLegend } from './legend';
|
|
3
|
+
export { registerCrosshair } from './crosshair';
|
|
4
|
+
export { registerSlider } from './slider';
|
|
5
|
+
export { registerLabel } from './label';
|
|
6
|
+
export { registerDataZoom } from './datazoom';
|
|
7
|
+
export { registerPlayer } from './player';
|
|
8
|
+
export { registerTooltip } from './tooltip';
|
|
9
|
+
export { registerTitle } from './title';
|
|
10
|
+
export { registerGrid } from './grid';
|
|
11
|
+
export { registerScrollbar } from './scrollbar';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.registerScrollbar = exports.registerGrid = exports.registerTitle = exports.registerTooltip = exports.registerPlayer = exports.registerDataZoom = exports.registerLabel = exports.registerSlider = exports.registerCrosshair = exports.registerLegend = exports.registerAxis = void 0;
|
|
6
|
+
|
|
7
|
+
var axis_1 = require("./axis");
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "registerAxis", {
|
|
10
|
+
enumerable: !0,
|
|
11
|
+
get: function() {
|
|
12
|
+
return axis_1.registerAxis;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
var legend_1 = require("./legend");
|
|
17
|
+
|
|
18
|
+
Object.defineProperty(exports, "registerLegend", {
|
|
19
|
+
enumerable: !0,
|
|
20
|
+
get: function() {
|
|
21
|
+
return legend_1.registerLegend;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
var crosshair_1 = require("./crosshair");
|
|
26
|
+
|
|
27
|
+
Object.defineProperty(exports, "registerCrosshair", {
|
|
28
|
+
enumerable: !0,
|
|
29
|
+
get: function() {
|
|
30
|
+
return crosshair_1.registerCrosshair;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
var slider_1 = require("./slider");
|
|
35
|
+
|
|
36
|
+
Object.defineProperty(exports, "registerSlider", {
|
|
37
|
+
enumerable: !0,
|
|
38
|
+
get: function() {
|
|
39
|
+
return slider_1.registerSlider;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
var label_1 = require("./label");
|
|
44
|
+
|
|
45
|
+
Object.defineProperty(exports, "registerLabel", {
|
|
46
|
+
enumerable: !0,
|
|
47
|
+
get: function() {
|
|
48
|
+
return label_1.registerLabel;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
var datazoom_1 = require("./datazoom");
|
|
53
|
+
|
|
54
|
+
Object.defineProperty(exports, "registerDataZoom", {
|
|
55
|
+
enumerable: !0,
|
|
56
|
+
get: function() {
|
|
57
|
+
return datazoom_1.registerDataZoom;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
var player_1 = require("./player");
|
|
62
|
+
|
|
63
|
+
Object.defineProperty(exports, "registerPlayer", {
|
|
64
|
+
enumerable: !0,
|
|
65
|
+
get: function() {
|
|
66
|
+
return player_1.registerPlayer;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
var tooltip_1 = require("./tooltip");
|
|
71
|
+
|
|
72
|
+
Object.defineProperty(exports, "registerTooltip", {
|
|
73
|
+
enumerable: !0,
|
|
74
|
+
get: function() {
|
|
75
|
+
return tooltip_1.registerTooltip;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
var title_1 = require("./title");
|
|
80
|
+
|
|
81
|
+
Object.defineProperty(exports, "registerTitle", {
|
|
82
|
+
enumerable: !0,
|
|
83
|
+
get: function() {
|
|
84
|
+
return title_1.registerTitle;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
var grid_1 = require("./grid");
|
|
89
|
+
|
|
90
|
+
Object.defineProperty(exports, "registerGrid", {
|
|
91
|
+
enumerable: !0,
|
|
92
|
+
get: function() {
|
|
93
|
+
return grid_1.registerGrid;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
var scrollbar_1 = require("./scrollbar");
|
|
98
|
+
|
|
99
|
+
Object.defineProperty(exports, "registerScrollbar", {
|
|
100
|
+
enumerable: !0,
|
|
101
|
+
get: function() {
|
|
102
|
+
return scrollbar_1.registerScrollbar;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/component/index.ts"],"names":[],"mappings":";;;AAAA,+BAAsC;AAA7B,oGAAA,YAAY,OAAA;AACrB,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,yCAAgD;AAAvC,8GAAA,iBAAiB,OAAA;AAC1B,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AACtB,uCAA8C;AAArC,4GAAA,gBAAgB,OAAA;AACzB,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,qCAA4C;AAAnC,0GAAA,eAAe,OAAA;AACxB,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AACtB,+BAAsC;AAA7B,oGAAA,YAAY,OAAA;AACrB,yCAAgD;AAAvC,8GAAA,iBAAiB,OAAA","file":"index.js","sourcesContent":["export { registerAxis } from './axis';\nexport { registerLegend } from './legend';\nexport { registerCrosshair } from './crosshair';\nexport { registerSlider } from './slider';\nexport { registerLabel } from './label';\nexport { registerDataZoom } from './datazoom';\nexport { registerPlayer } from './player';\nexport { registerTooltip } from './tooltip';\nexport { registerTitle } from './title';\nexport { registerGrid } from './grid';\nexport { registerScrollbar } from './scrollbar';\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BaseLabelAttrs, DataLabelAttrs } from '@visactor/vrender-components';
|
|
2
|
+
import type { BaseSignleEncodeSpec, IGroupMark, IMark, ITheme, IView, MarkFunctionType, Nil } from '../types';
|
|
3
|
+
import type { ILabel, LabelSpec } from '../types/component';
|
|
4
|
+
import { Component } from '../view/component';
|
|
5
|
+
export declare const generateLabelAttributes: (marks: IMark[], groupSize: {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}, encoder: BaseSignleEncodeSpec, labelStyle: MarkFunctionType<Partial<BaseLabelAttrs>>, parameters: any, theme?: ITheme) => DataLabelAttrs;
|
|
9
|
+
export declare class Label extends Component implements ILabel {
|
|
10
|
+
static readonly componentType: string;
|
|
11
|
+
protected spec: LabelSpec;
|
|
12
|
+
constructor(view: IView, group?: IGroupMark);
|
|
13
|
+
protected parseAddition(spec: LabelSpec): this;
|
|
14
|
+
labelStyle(style: MarkFunctionType<Partial<BaseLabelAttrs>>): this;
|
|
15
|
+
size(size: LabelSpec['size']): this;
|
|
16
|
+
target(mark: IMark | IMark[] | string | string[] | Nil): this;
|
|
17
|
+
protected _updateComponentEncoders(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare const registerLabel: () => void;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.registerLabel = exports.Label = exports.generateLabelAttributes = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), vrender_components_1 = require("@visactor/vrender-components"), graph_1 = require("../graph"), component_1 = require("../view/component"), encode_1 = require("../graph/mark/encode"), util_1 = require("../parse/util"), factory_1 = require("../core/factory"), generateLabelAttributes = (marks, groupSize, encoder, labelStyle, parameters, theme) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const labelTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.dataLabel, dataLabels = marks.map((mark => {
|
|
10
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11
|
+
let currentTheme = {};
|
|
12
|
+
switch (mark.markType) {
|
|
13
|
+
case graph_1.GrammarMarkType.line:
|
|
14
|
+
currentTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.lineLabel;
|
|
15
|
+
break;
|
|
16
|
+
|
|
17
|
+
case graph_1.GrammarMarkType.rect:
|
|
18
|
+
case graph_1.GrammarMarkType.interval:
|
|
19
|
+
currentTheme = null === (_b = null == theme ? void 0 : theme.components) || void 0 === _b ? void 0 : _b.rectLabel;
|
|
20
|
+
break;
|
|
21
|
+
|
|
22
|
+
case graph_1.GrammarMarkType.symbol:
|
|
23
|
+
case graph_1.GrammarMarkType.circle:
|
|
24
|
+
case graph_1.GrammarMarkType.cell:
|
|
25
|
+
currentTheme = null === (_c = null == theme ? void 0 : theme.components) || void 0 === _c ? void 0 : _c.symbolLabel;
|
|
26
|
+
break;
|
|
27
|
+
|
|
28
|
+
case graph_1.GrammarMarkType.arc:
|
|
29
|
+
case graph_1.GrammarMarkType.arc3d:
|
|
30
|
+
currentTheme = null === (_d = null == theme ? void 0 : theme.components) || void 0 === _d ? void 0 : _d.arcLabel;
|
|
31
|
+
break;
|
|
32
|
+
|
|
33
|
+
case graph_1.GrammarMarkType.polygon:
|
|
34
|
+
case graph_1.GrammarMarkType.path:
|
|
35
|
+
default:
|
|
36
|
+
currentTheme = null === (_e = null == theme ? void 0 : theme.components) || void 0 === _e ? void 0 : _e.pointLabel;
|
|
37
|
+
}
|
|
38
|
+
const data = [];
|
|
39
|
+
mark.elements.forEach((element => {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
if ("willRelease" !== element.getGraphicItem().releaseStatus) {
|
|
42
|
+
const attributes = (0, encode_1.invokeEncoder)(encoder, element.getDatum(), element, parameters), datum = (0,
|
|
43
|
+
vutils_1.merge)({}, null !== (_b = null === (_a = null == currentTheme ? void 0 : currentTheme.data) || void 0 === _a ? void 0 : _a[0]) && void 0 !== _b ? _b : {}, attributes);
|
|
44
|
+
data.push(datum);
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
const addition = (0, util_1.invokeFunctionType)(labelStyle, parameters, mark), graphicItemName = null === (_f = mark.graphicItem) || void 0 === _f ? void 0 : _f.name;
|
|
48
|
+
return (0, vutils_1.merge)({}, currentTheme, {
|
|
49
|
+
data: data,
|
|
50
|
+
baseMarkGroupName: graphicItemName,
|
|
51
|
+
getBaseMarks: () => mark.elements.map((element => element.getGraphicItem()))
|
|
52
|
+
}, null != addition ? addition : {});
|
|
53
|
+
})).filter((label => !(0, vutils_1.isNil)(label)));
|
|
54
|
+
return (0, vutils_1.merge)({}, labelTheme, {
|
|
55
|
+
size: groupSize,
|
|
56
|
+
dataLabels: dataLabels
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
exports.generateLabelAttributes = generateLabelAttributes;
|
|
61
|
+
|
|
62
|
+
class Label extends component_1.Component {
|
|
63
|
+
constructor(view, group) {
|
|
64
|
+
super(view, graph_1.ComponentEnum.label, group), this.spec.componentType = graph_1.ComponentEnum.label;
|
|
65
|
+
}
|
|
66
|
+
parseAddition(spec) {
|
|
67
|
+
return super.parseAddition(spec), this.labelStyle(spec.labelStyle), this.size(spec.size),
|
|
68
|
+
this.target(spec.target), this;
|
|
69
|
+
}
|
|
70
|
+
labelStyle(style) {
|
|
71
|
+
return this.setFunctionSpec(style, "labelStyle");
|
|
72
|
+
}
|
|
73
|
+
size(size) {
|
|
74
|
+
return this.setFunctionSpec(size, "size");
|
|
75
|
+
}
|
|
76
|
+
target(mark) {
|
|
77
|
+
if (this.spec.target) {
|
|
78
|
+
const prevMarks = (0, vutils_1.array)(this.spec.target).map((m => (0, vutils_1.isString)(m) ? this.view.getMarkById(m) : m));
|
|
79
|
+
this.detach(prevMarks);
|
|
80
|
+
}
|
|
81
|
+
if (this.spec.target = mark, mark) {
|
|
82
|
+
const nextMarks = (0, vutils_1.array)(mark).map((m => (0, vutils_1.isString)(m) ? this.view.getMarkById(m) : m));
|
|
83
|
+
this.attach(nextMarks);
|
|
84
|
+
}
|
|
85
|
+
return this.commit(), this;
|
|
86
|
+
}
|
|
87
|
+
_updateComponentEncoders() {
|
|
88
|
+
const encoders = Object.assign({
|
|
89
|
+
update: {}
|
|
90
|
+
}, this.spec.encode), componentEncoders = Object.keys(encoders).reduce(((res, state) => {
|
|
91
|
+
const encoder = encoders[state];
|
|
92
|
+
return encoder && (res[state] = {
|
|
93
|
+
callback: (datum, element, parameters) => {
|
|
94
|
+
var _a, _b, _c, _d;
|
|
95
|
+
const marks = (0, vutils_1.array)(this.spec.target).map((m => (0, vutils_1.isString)(m) ? this.view.getMarkById(m) : m)), groupGraphicItem = null === (_b = null === (_a = this.group) || void 0 === _a ? void 0 : _a.getGroupGraphicItem) || void 0 === _b ? void 0 : _b.call(_a);
|
|
96
|
+
let size = (0, util_1.invokeFunctionType)(this.spec.size, parameters);
|
|
97
|
+
size || (size = groupGraphicItem ? {
|
|
98
|
+
width: null !== (_c = groupGraphicItem.attribute.width) && void 0 !== _c ? _c : groupGraphicItem.AABBBounds.width(),
|
|
99
|
+
height: null !== (_d = groupGraphicItem.attribute.height) && void 0 !== _d ? _d : groupGraphicItem.AABBBounds.height()
|
|
100
|
+
} : {
|
|
101
|
+
width: 1 / 0,
|
|
102
|
+
height: 1 / 0
|
|
103
|
+
});
|
|
104
|
+
const theme = this.view.getCurrentTheme();
|
|
105
|
+
return (0, exports.generateLabelAttributes)(marks, size, encoder, this.spec.labelStyle, parameters, theme);
|
|
106
|
+
}
|
|
107
|
+
}), res;
|
|
108
|
+
}), {});
|
|
109
|
+
this._encoders = componentEncoders;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
exports.Label = Label, Label.componentType = graph_1.ComponentEnum.label;
|
|
114
|
+
|
|
115
|
+
const registerLabel = () => {
|
|
116
|
+
factory_1.Factory.registerGraphicComponent(graph_1.ComponentEnum.label, (attrs => new vrender_components_1.DataLabel(attrs))),
|
|
117
|
+
factory_1.Factory.registerComponent(graph_1.ComponentEnum.label, Label);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
exports.registerLabel = registerLabel;
|
|
121
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/component/label.ts"],"names":[],"mappings":";;;AAAA,6CAAiE;AAIjE,qEAAyD;AAYzD,oCAA0D;AAE1D,iDAA8C;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,yBAAkB,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;wBAC1D,IAAI,CAAC,IAAI,EAAE;4BACT,IAAI,GAAG,gBAAgB;gCACrB,CAAC,CAAC;oCACE,KAAK,EAAE,MAAA,gBAAgB,CAAC,SAAS,CAAC,KAAK,mCAAI,gBAAgB,CAAC,UAAU,CAAC,KAAK,EAAE;oCAC9E,MAAM,EAAE,MAAA,gBAAgB,CAAC,SAAS,CAAC,MAAM,mCAAI,gBAAgB,CAAC,UAAU,CAAC,MAAM,EAAE;iCAClF;gCACH,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;yBAC3C;wBACD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;wBAE1C,OAAO,IAAA,+BAAuB,EAC5B,KAAK,EACL,IAAI,EACJ,OAA+B,EAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,EACpB,UAAU,EACV,KAAK,CACN,CAAC;oBACJ,CAAC;iBACF,CAAC;aACH;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC;IACrC,CAAC;;AAzEH,sBA0EC;AAzEiB,mBAAa,GAAW,qBAAa,CAAC,KAAK,CAAC;AA2EvD,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,iBAAO,CAAC,wBAAwB,CAC9B,qBAAa,CAAC,KAAK,EACnB,CAAC,KAAqB,EAAE,EAAE,CAAC,IAAI,8BAAS,CAAC,KAAK,CAAwB,CACvE,CAAC;IAEF,iBAAO,CAAC,iBAAiB,CAAC,qBAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB","file":"label.js","sourcesContent":["import { array, isNil, isString, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender';\nimport type { BaseLabelAttrs, DataLabelAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { DataLabel } from '@visactor/vrender-components';\nimport type {\n BaseSignleEncodeSpec,\n IElement,\n IGroupMark,\n IMark,\n ITheme,\n IView,\n MarkFunctionType,\n Nil,\n StateEncodeSpec\n} from '../types';\nimport { ComponentEnum, GrammarMarkType } from '../graph';\nimport type { ILabel, LabelSpec } from '../types/component';\nimport { Component } from '../view/component';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { invokeFunctionType } from '../parse/util';\nimport { Factory } from '../core/factory';\n\nexport const generateLabelAttributes = (\n marks: IMark[],\n groupSize: { width: number; height: number },\n encoder: BaseSignleEncodeSpec,\n labelStyle: MarkFunctionType<Partial<BaseLabelAttrs>>,\n parameters: any,\n theme?: ITheme\n): DataLabelAttrs => {\n const labelTheme = theme?.components?.dataLabel;\n\n const dataLabels = marks\n .map(mark => {\n let currentTheme: any = {};\n switch (mark.markType) {\n case GrammarMarkType.line:\n currentTheme = theme?.components?.lineLabel;\n break;\n case GrammarMarkType.rect:\n case GrammarMarkType.interval:\n currentTheme = theme?.components?.rectLabel;\n break;\n case GrammarMarkType.symbol:\n case GrammarMarkType.circle:\n case GrammarMarkType.cell:\n currentTheme = theme?.components?.symbolLabel;\n break;\n case GrammarMarkType.arc:\n case GrammarMarkType.arc3d:\n currentTheme = theme?.components?.arcLabel;\n break;\n case GrammarMarkType.polygon:\n case GrammarMarkType.path:\n default:\n currentTheme = theme?.components?.pointLabel;\n break;\n }\n const data: any[] = [];\n // process by order of elements\n mark.elements.forEach(element => {\n const graphicItem = element.getGraphicItem();\n if ((graphicItem as any).releaseStatus !== 'willRelease') {\n const attributes = invokeEncoder(encoder, element.getDatum(), element, parameters);\n const datum = merge({}, currentTheme?.data?.[0] ?? {}, attributes);\n data.push(datum);\n }\n });\n const addition = invokeFunctionType(labelStyle, parameters, mark);\n const graphicItemName = mark.graphicItem?.name;\n return merge(\n {},\n currentTheme,\n {\n data,\n baseMarkGroupName: graphicItemName,\n // FIXME: hack\n // 标签是对数据顺序有强要求的场景,因为顺序会影响标签躲避结果;而目前没有机制保证 vrender 图元顺序与数据顺序一致。\n // 这里目前只能通过自定义方法来 hack\n getBaseMarks: () => mark.elements.map(element => element.getGraphicItem())\n },\n addition ?? {}\n );\n })\n .filter(label => !isNil(label));\n return merge({}, labelTheme, { size: groupSize, dataLabels });\n};\n\nexport class Label extends Component implements ILabel {\n static readonly componentType: string = ComponentEnum.label;\n protected declare spec: LabelSpec;\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, ComponentEnum.label, group);\n this.spec.componentType = ComponentEnum.label;\n }\n\n protected parseAddition(spec: LabelSpec) {\n super.parseAddition(spec);\n this.labelStyle(spec.labelStyle);\n this.size(spec.size);\n this.target(spec.target);\n return this;\n }\n\n labelStyle(style: MarkFunctionType<Partial<BaseLabelAttrs>>) {\n return this.setFunctionSpec(style, 'labelStyle');\n }\n\n size(size: LabelSpec['size']) {\n return this.setFunctionSpec(size, 'size');\n }\n\n target(mark: IMark | IMark[] | string | string[] | Nil): this {\n if (this.spec.target) {\n const prevMarks = array(this.spec.target).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n this.detach(prevMarks);\n }\n this.spec.target = mark;\n if (mark) {\n const nextMarks = array(mark).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n this.attach(nextMarks);\n }\n this.commit();\n return this;\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const marks = array(this.spec.target).map(m => (isString(m) ? this.view.getMarkById(m) : m));\n const groupGraphicItem = this.group?.getGroupGraphicItem?.();\n let size = invokeFunctionType(this.spec.size, parameters);\n if (!size) {\n size = groupGraphicItem\n ? {\n width: groupGraphicItem.attribute.width ?? groupGraphicItem.AABBBounds.width(),\n height: groupGraphicItem.attribute.height ?? groupGraphicItem.AABBBounds.height()\n }\n : { width: Infinity, height: Infinity };\n }\n const theme = this.view.getCurrentTheme();\n\n return generateLabelAttributes(\n marks,\n size,\n encoder as BaseSignleEncodeSpec,\n this.spec.labelStyle,\n parameters,\n theme\n );\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n}\n\nexport const registerLabel = () => {\n Factory.registerGraphicComponent(\n ComponentEnum.label,\n (attrs: DataLabelAttrs) => new DataLabel(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.label, Label);\n};\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IBaseScale } from '@visactor/vscale';
|
|
2
|
+
import type { DiscreteLegendAttrs, ColorLegendAttributes, SizeLegendAttributes } from '@visactor/vrender-components';
|
|
3
|
+
import type { IData, IGroupMark, IScale, ITheme, IView, Nil, RecursivePartial } from '../types';
|
|
4
|
+
import type { ILegend, LegendSpec, LegendType } from '../types/component';
|
|
5
|
+
import { ScaleComponent } from './scale';
|
|
6
|
+
export declare const generateDiscreteLegendAttributes: (scale: IBaseScale, theme?: ITheme, addition?: RecursivePartial<DiscreteLegendAttrs>, shapeScale?: IBaseScale) => DiscreteLegendAttrs;
|
|
7
|
+
export declare const generateColorLegendAttributes: (scale: IBaseScale, theme?: ITheme, addition?: RecursivePartial<ColorLegendAttributes>) => ColorLegendAttributes;
|
|
8
|
+
export declare const generateSizeLegendAttributes: (scale: IBaseScale, theme?: ITheme, addition?: RecursivePartial<SizeLegendAttributes>) => SizeLegendAttributes;
|
|
9
|
+
export declare class Legend extends ScaleComponent implements ILegend {
|
|
10
|
+
static readonly componentType: string;
|
|
11
|
+
protected spec: LegendSpec;
|
|
12
|
+
private _legendComponentType;
|
|
13
|
+
constructor(view: IView, group?: IGroupMark);
|
|
14
|
+
protected parseAddition(spec: LegendSpec): this;
|
|
15
|
+
scale(scale?: IScale | string | Nil): this;
|
|
16
|
+
shapeScale(shapeScale: LegendSpec['shapeScale']): this;
|
|
17
|
+
legendType(legendType: LegendType | Nil): this;
|
|
18
|
+
isContinuousLegend(): boolean;
|
|
19
|
+
target(data: IData | string | Nil, filter: string | ((datum: any, legendValues: any) => boolean) | Nil): this;
|
|
20
|
+
setSelected(selectedValues: any[]): this;
|
|
21
|
+
addGraphicItem(attrs: any, groupKey?: string): any;
|
|
22
|
+
release(): void;
|
|
23
|
+
protected _updateComponentEncoders(): void;
|
|
24
|
+
private _getLegendComponentType;
|
|
25
|
+
}
|
|
26
|
+
export declare const registerLegend: () => void;
|