billboard.js 4.1.4 → 4.2.0-next.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/billboard.css +87 -1
- package/dist/billboard.js +11129 -7032
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +20 -20
- package/dist/billboard.pkgd.js +22703 -14154
- package/dist/billboard.pkgd.min.js +37 -37
- package/dist/billboard.react.js +5 -5
- package/dist/billboard.react.min.js +2 -2
- package/dist/billboard.worker.js +1 -1
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +21 -4
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +22 -13
- package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-tableview.js +20 -3
- package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1689 -1252
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2288 -1012
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +6350 -2390
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -18
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1310 -1006
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1293 -1006
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
- package/dist/theme/dark.css +90 -1
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +87 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +87 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +87 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist/theme/modern.css +87 -1
- package/dist/theme/modern.min.css +2 -2
- package/dist-esm/Chart/Chart.js +5 -5
- package/dist-esm/Chart/api/axis.js +2 -3
- package/dist-esm/Chart/api/category.js +2 -3
- package/dist-esm/Chart/api/chart.js +3 -4
- package/dist-esm/Chart/api/color.js +2 -3
- package/dist-esm/Chart/api/data.js +3 -4
- package/dist-esm/Chart/api/export.js +3 -4
- package/dist-esm/Chart/api/flow.js +15 -9
- package/dist-esm/Chart/api/focus.js +5 -3
- package/dist-esm/Chart/api/grid.js +2 -3
- package/dist-esm/Chart/api/group.js +2 -3
- package/dist-esm/Chart/api/legend.js +1 -2
- package/dist-esm/Chart/api/load.js +3 -4
- package/dist-esm/Chart/api/regions.js +3 -4
- package/dist-esm/Chart/api/selection.js +3 -4
- package/dist-esm/Chart/api/show.js +2 -3
- package/dist-esm/Chart/api/stubs.js +3 -4
- package/dist-esm/Chart/api/subchart.js +4 -5
- package/dist-esm/Chart/api/tooltip.js +28 -9
- package/dist-esm/Chart/api/x.js +2 -3
- package/dist-esm/Chart/api/zoom.js +6 -7
- package/dist-esm/ChartInternal/Axis/Axis.js +5 -6
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +26 -17
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +40 -12
- package/dist-esm/ChartInternal/ChartInternal.js +39 -24
- package/dist-esm/ChartInternal/data/convert.helper.js +2 -3
- package/dist-esm/ChartInternal/data/convert.js +3 -4
- package/dist-esm/ChartInternal/data/data.js +18 -11
- package/dist-esm/ChartInternal/data/load.js +4 -5
- package/dist-esm/ChartInternal/interactions/drag.js +3 -4
- package/dist-esm/ChartInternal/interactions/eventrect.js +4 -5
- package/dist-esm/ChartInternal/interactions/flow.js +25 -19
- package/dist-esm/ChartInternal/interactions/interaction.js +14 -13
- package/dist-esm/ChartInternal/interactions/subchart.js +5 -6
- package/dist-esm/ChartInternal/interactions/zoom.js +4 -5
- package/dist-esm/ChartInternal/internals/category.js +2 -3
- package/dist-esm/ChartInternal/internals/class.js +5 -5
- package/dist-esm/ChartInternal/internals/clip.js +2 -3
- package/dist-esm/ChartInternal/internals/color.js +4 -5
- package/dist-esm/ChartInternal/internals/domain.js +7 -7
- package/dist-esm/ChartInternal/internals/format.js +3 -4
- package/dist-esm/ChartInternal/internals/grid.js +4 -5
- package/dist-esm/ChartInternal/internals/legend.js +7 -7
- package/dist-esm/ChartInternal/internals/redraw.js +13 -13
- package/dist-esm/ChartInternal/internals/region.js +4 -5
- package/dist-esm/ChartInternal/internals/scale.js +2 -3
- package/dist-esm/ChartInternal/internals/selection.js +3 -4
- package/dist-esm/ChartInternal/internals/size.axis.js +2 -3
- package/dist-esm/ChartInternal/internals/size.js +8 -9
- package/dist-esm/ChartInternal/internals/style.js +4 -5
- package/dist-esm/ChartInternal/internals/subchart.util.js +2 -3
- package/dist-esm/ChartInternal/internals/text.arc.js +3 -4
- package/dist-esm/ChartInternal/internals/text.js +22 -23
- package/dist-esm/ChartInternal/internals/text.util.js +4 -5
- package/dist-esm/ChartInternal/internals/title.js +4 -5
- package/dist-esm/ChartInternal/internals/tooltip.js +42 -23
- package/dist-esm/ChartInternal/internals/transform.js +5 -6
- package/dist-esm/ChartInternal/internals/type.js +78 -11
- package/dist-esm/ChartInternal/shape/arc.js +5 -6
- package/dist-esm/ChartInternal/shape/area.js +4 -5
- package/dist-esm/ChartInternal/shape/bar.js +5 -6
- package/dist-esm/ChartInternal/shape/boxplot.js +111 -0
- package/dist-esm/ChartInternal/shape/bubble.js +2 -3
- package/dist-esm/ChartInternal/shape/bullet.js +213 -0
- package/dist-esm/ChartInternal/shape/candlestick.js +5 -6
- package/dist-esm/ChartInternal/shape/core/barRadius.js +2 -3
- package/dist-esm/ChartInternal/shape/core/boxplot.js +192 -0
- package/dist-esm/ChartInternal/shape/core/bubble.js +4 -5
- package/dist-esm/ChartInternal/shape/core/bullet.js +528 -0
- package/dist-esm/ChartInternal/shape/core/candlestick.js +2 -3
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +2 -3
- package/dist-esm/ChartInternal/shape/core/geometry.js +2 -3
- package/dist-esm/ChartInternal/shape/core/heatmap.js +453 -0
- package/dist-esm/ChartInternal/shape/core/path.js +2 -3
- package/dist-esm/ChartInternal/shape/core/point.js +2 -3
- package/dist-esm/ChartInternal/shape/core/sankey.js +576 -0
- package/dist-esm/ChartInternal/shape/core/treemap.js +2 -3
- package/dist-esm/ChartInternal/shape/funnel.js +45 -6
- package/dist-esm/ChartInternal/shape/gauge.js +3 -4
- package/dist-esm/ChartInternal/shape/heatmap.js +144 -0
- package/dist-esm/ChartInternal/shape/line.js +7 -8
- package/dist-esm/ChartInternal/shape/point.js +9 -9
- package/dist-esm/ChartInternal/shape/polar.js +3 -4
- package/dist-esm/ChartInternal/shape/radar.js +19 -7
- package/dist-esm/ChartInternal/shape/sankey.js +154 -0
- package/dist-esm/ChartInternal/shape/shape.js +15 -11
- package/dist-esm/ChartInternal/shape/treemap.js +8 -5
- package/dist-esm/canvas/CanvasAxisRenderer.js +28 -328
- package/dist-esm/canvas/CanvasEngine.js +2 -3
- package/dist-esm/canvas/CanvasPainter.js +2 -3
- package/dist-esm/canvas/CanvasRenderer.js +38 -408
- package/dist-esm/canvas/CanvasTheme.js +28 -8
- package/dist-esm/canvas/HitDetector.js +20 -24
- package/dist-esm/canvas/axisTicks.js +5 -6
- package/dist-esm/canvas/boxplot.js +201 -0
- package/dist-esm/canvas/bullet.js +212 -0
- package/dist-esm/canvas/classes.js +2 -3
- package/dist-esm/canvas/color.js +2 -3
- package/dist-esm/canvas/flow.js +190 -0
- package/dist-esm/canvas/geometry.js +2 -3
- package/dist-esm/canvas/grid.js +206 -0
- package/dist-esm/canvas/heatmap.js +141 -0
- package/dist-esm/canvas/labels.js +3 -4
- package/dist-esm/canvas/pointPattern.js +2 -3
- package/dist-esm/canvas/sankey.js +137 -0
- package/dist-esm/canvas/selection.js +473 -0
- package/dist-esm/canvas/subchart.js +814 -0
- package/dist-esm/canvas/treemap.js +100 -0
- package/dist-esm/canvas/util.js +2 -3
- package/dist-esm/config/Options/Options.js +3 -4
- package/dist-esm/config/Options/axis/axis.js +2 -3
- package/dist-esm/config/Options/axis/x.js +2 -3
- package/dist-esm/config/Options/axis/y.js +2 -3
- package/dist-esm/config/Options/axis/y2.js +14 -3
- package/dist-esm/config/Options/common/boost.js +2 -3
- package/dist-esm/config/Options/common/color.js +2 -3
- package/dist-esm/config/Options/common/grid.js +2 -3
- package/dist-esm/config/Options/common/legend.js +2 -3
- package/dist-esm/config/Options/common/main.js +2 -3
- package/dist-esm/config/Options/common/point.js +2 -3
- package/dist-esm/config/Options/common/title.js +2 -3
- package/dist-esm/config/Options/common/tooltip.js +2 -3
- package/dist-esm/config/Options/data/axis.js +2 -3
- package/dist-esm/config/Options/data/data.js +49 -4
- package/dist-esm/config/Options/data/selection.js +2 -3
- package/dist-esm/config/Options/interaction/interaction.js +2 -3
- package/dist-esm/config/Options/interaction/subchart.js +6 -3
- package/dist-esm/config/Options/interaction/zoom.js +2 -3
- package/dist-esm/config/Options/shape/arc.js +2 -3
- package/dist-esm/config/Options/shape/area.js +2 -3
- package/dist-esm/config/Options/shape/bar.js +2 -3
- package/dist-esm/config/Options/shape/boxplot.js +106 -0
- package/dist-esm/config/Options/shape/bubble.js +2 -3
- package/dist-esm/config/Options/shape/bullet.js +177 -0
- package/dist-esm/config/Options/shape/candlestick.js +2 -3
- package/dist-esm/config/Options/shape/donut.js +2 -3
- package/dist-esm/config/Options/shape/funnel.js +2 -3
- package/dist-esm/config/Options/shape/gauge.js +2 -3
- package/dist-esm/config/Options/shape/heatmap.js +137 -0
- package/dist-esm/config/Options/shape/line.js +2 -3
- package/dist-esm/config/Options/shape/pie.js +2 -3
- package/dist-esm/config/Options/shape/polar.js +2 -3
- package/dist-esm/config/Options/shape/radar.js +2 -3
- package/dist-esm/config/Options/shape/sankey.js +116 -0
- package/dist-esm/config/Options/shape/scatter.js +2 -3
- package/dist-esm/config/Options/shape/spline.js +2 -3
- package/dist-esm/config/Options/shape/treemap.js +2 -3
- package/dist-esm/config/Store/Element.js +2 -3
- package/dist-esm/config/Store/State.js +4 -4
- package/dist-esm/config/Store/Store.js +2 -3
- package/dist-esm/config/classes.js +2 -4
- package/dist-esm/config/config.js +2 -3
- package/dist-esm/config/const.js +31 -23
- package/dist-esm/config/resolver/axis.core.js +4 -5
- package/dist-esm/config/resolver/axis.js +2 -3
- package/dist-esm/config/resolver/canvas.js +113 -900
- package/dist-esm/config/resolver/canvasBoxplot.js +49 -0
- package/dist-esm/config/resolver/canvasBullet.js +29 -0
- package/dist-esm/config/resolver/canvasFlow.js +28 -0
- package/dist-esm/config/resolver/canvasGrid.js +27 -0
- package/dist-esm/config/resolver/canvasHeatmap.js +31 -0
- package/dist-esm/config/resolver/canvasSankey.js +31 -0
- package/dist-esm/config/resolver/canvasSelection.js +30 -0
- package/dist-esm/config/resolver/canvasShape.js +13 -12
- package/dist-esm/config/resolver/canvasSubchart.js +30 -0
- package/dist-esm/config/resolver/canvasType.js +48 -0
- package/dist-esm/config/resolver/category.js +3 -4
- package/dist-esm/config/resolver/customType.js +58 -0
- package/dist-esm/config/resolver/export.js +3 -4
- package/dist-esm/config/resolver/flow.js +5 -6
- package/dist-esm/config/resolver/grid.js +6 -7
- package/dist-esm/config/resolver/interaction/selection.js +6 -7
- package/dist-esm/config/resolver/interaction/subchart.js +6 -7
- package/dist-esm/config/resolver/interaction/zoom.js +6 -7
- package/dist-esm/config/resolver/regions.js +5 -6
- package/dist-esm/config/resolver/shape/arc.helpers.js +5 -6
- package/dist-esm/config/resolver/shape/area.js +3 -4
- package/dist-esm/config/resolver/shape/axis.helpers.js +2 -3
- package/dist-esm/config/resolver/shape/bar.js +5 -6
- package/dist-esm/config/resolver/shape/boxplot.js +30 -0
- package/dist-esm/config/resolver/shape/bubble.js +5 -6
- package/dist-esm/config/resolver/shape/bullet.js +23 -0
- package/dist-esm/config/resolver/shape/candlestick.js +5 -6
- package/dist-esm/config/resolver/shape/donut.js +2 -3
- package/dist-esm/config/resolver/shape/funnel.js +7 -6
- package/dist-esm/config/resolver/shape/gauge.js +4 -5
- package/dist-esm/config/resolver/shape/heatmap.js +23 -0
- package/dist-esm/config/resolver/shape/line.js +2 -3
- package/dist-esm/config/resolver/shape/pie.js +3 -4
- package/dist-esm/config/resolver/shape/polar.js +4 -5
- package/dist-esm/config/resolver/shape/radar.js +5 -6
- package/dist-esm/config/resolver/shape/sankey.js +23 -0
- package/dist-esm/config/resolver/shape/scatter.js +4 -5
- package/dist-esm/config/resolver/shape/treemap.js +4 -5
- package/dist-esm/core.js +5 -6
- package/dist-esm/index.canvas.js +13 -9
- package/dist-esm/index.esm.js +6 -2
- package/dist-esm/module/Cache.js +2 -3
- package/dist-esm/module/browser.js +2 -3
- package/dist-esm/module/dsv.js +2 -3
- package/dist-esm/module/error.js +23 -16
- package/dist-esm/module/generator.js +3 -4
- package/dist-esm/module/sanitize.js +2 -3
- package/dist-esm/module/util/brush.js +2 -3
- package/dist-esm/module/util/dom.js +3 -4
- package/dist-esm/module/util/object.js +13 -6
- package/dist-esm/module/util/type-checks.js +2 -3
- package/dist-esm/module/worker.js +2 -3
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +6 -10
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +10 -18
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +17 -45
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +10 -18
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +9 -16
- package/dist-esm/react/index.js +2 -3
- package/package.json +44 -44
- package/src/Chart/Chart.ts +1 -0
- package/src/Chart/api/chart.ts +2 -1
- package/src/Chart/api/flow.ts +20 -7
- package/src/Chart/api/focus.ts +3 -0
- package/src/Chart/api/subchart.ts +1 -1
- package/src/Chart/api/tooltip.ts +54 -15
- package/src/ChartInternal/Axis/AxisRenderer.ts +29 -20
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +45 -9
- package/src/ChartInternal/ChartInternal.ts +46 -19
- package/src/ChartInternal/data/IData.ts +13 -0
- package/src/ChartInternal/data/data.ts +26 -5
- package/src/ChartInternal/data/load.ts +2 -2
- package/src/ChartInternal/interactions/flow.ts +50 -19
- package/src/ChartInternal/interactions/interaction.ts +15 -11
- package/src/ChartInternal/internals/class.ts +3 -2
- package/src/ChartInternal/internals/domain.ts +4 -2
- package/src/ChartInternal/internals/format.ts +3 -1
- package/src/ChartInternal/internals/legend.ts +2 -1
- package/src/ChartInternal/internals/redraw.ts +18 -12
- package/src/ChartInternal/internals/size.ts +5 -3
- package/src/ChartInternal/internals/text.ts +24 -28
- package/src/ChartInternal/internals/tooltip.ts +59 -20
- package/src/ChartInternal/internals/transform.ts +2 -2
- package/src/ChartInternal/internals/type.ts +101 -9
- package/src/ChartInternal/shape/boxplot.ts +172 -0
- package/src/ChartInternal/shape/bullet.ts +323 -0
- package/src/ChartInternal/shape/core/boxplot.ts +241 -0
- package/src/ChartInternal/shape/core/bullet.ts +734 -0
- package/src/ChartInternal/shape/core/heatmap.ts +665 -0
- package/src/ChartInternal/shape/core/sankey.ts +782 -0
- package/src/ChartInternal/shape/funnel.ts +73 -2
- package/src/ChartInternal/shape/heatmap.ts +236 -0
- package/src/ChartInternal/shape/point.ts +6 -3
- package/src/ChartInternal/shape/radar.ts +30 -1
- package/src/ChartInternal/shape/sankey.ts +242 -0
- package/src/ChartInternal/shape/shape.ts +16 -4
- package/src/ChartInternal/shape/treemap.ts +10 -0
- package/src/Plugin/stanford/index.ts +1 -28
- package/src/canvas/CanvasAxisRenderer.ts +54 -596
- package/src/canvas/CanvasRenderer.ts +68 -640
- package/src/canvas/CanvasTheme.ts +92 -6
- package/src/canvas/HitDetector.ts +30 -28
- package/src/canvas/boxplot.ts +230 -0
- package/src/canvas/bullet.ts +269 -0
- package/src/canvas/flow.ts +237 -0
- package/src/canvas/grid.ts +359 -0
- package/src/canvas/heatmap.ts +147 -0
- package/src/canvas/labels.ts +3 -1
- package/src/canvas/sankey.ts +151 -0
- package/src/canvas/selection.ts +626 -0
- package/src/canvas/subchart.ts +1292 -0
- package/src/canvas/treemap.ts +142 -0
- package/src/config/Options/axis/y2.ts +13 -0
- package/src/config/Options/data/data.ts +47 -1
- package/src/config/Options/interaction/subchart.ts +4 -0
- package/src/config/Options/shape/boxplot.ts +95 -0
- package/src/config/Options/shape/bullet.ts +170 -0
- package/src/config/Options/shape/heatmap.ts +125 -0
- package/src/config/Options/shape/sankey.ts +108 -0
- package/src/config/Store/State.ts +2 -1
- package/src/config/classes.ts +0 -1
- package/src/config/const.ts +30 -21
- package/src/config/resolver/canvas.ts +147 -1293
- package/src/config/resolver/canvasBoxplot.ts +42 -0
- package/src/config/resolver/canvasBullet.ts +20 -0
- package/src/config/resolver/canvasFlow.ts +18 -0
- package/src/config/resolver/canvasGrid.ts +17 -0
- package/src/config/resolver/canvasHeatmap.ts +23 -0
- package/src/config/resolver/canvasSankey.ts +23 -0
- package/src/config/resolver/canvasSelection.ts +20 -0
- package/src/config/resolver/canvasShape.ts +6 -1
- package/src/config/resolver/canvasSubchart.ts +20 -0
- package/src/config/resolver/canvasType.ts +51 -0
- package/src/config/resolver/customType.ts +69 -0
- package/src/config/resolver/shape/boxplot.ts +31 -0
- package/src/config/resolver/shape/bullet.ts +18 -0
- package/src/config/resolver/shape/funnel.ts +8 -2
- package/src/config/resolver/shape/heatmap.ts +18 -0
- package/src/config/resolver/shape/index.ts +4 -0
- package/src/config/resolver/shape/sankey.ts +18 -0
- package/src/index.canvas.ts +9 -3
- package/src/index.esm.ts +4 -0
- package/src/index.ts +34 -0
- package/src/module/error.ts +32 -18
- package/src/module/util/object.ts +26 -1
- package/src/scss/billboard.scss +106 -0
- package/src/scss/theme/dark.scss +110 -0
- package/src/scss/theme/datalab.scss +106 -0
- package/src/scss/theme/graph.scss +106 -0
- package/src/scss/theme/insight.scss +106 -0
- package/src/scss/theme/modern.scss +106 -0
- package/types/bb.d.ts +4 -0
- package/types/canvas.d.ts +3 -0
- package/types/chart.d.ts +5 -0
- package/types/index.d.ts +4 -0
- package/types/options.d.ts +13 -1
- package/types/options.shape.d.ts +431 -0
- package/types/types.d.ts +4 -0
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
9
|
*/
|
|
10
10
|
import { TYPE, TYPE_BY_CATEGORY } from "../../config/const.js";
|
|
11
11
|
import { isArray, isNumber, isString } from "../../module/util/type-checks.js";
|
|
12
|
-
|
|
12
|
+
// src/ChartInternal/internals/type.ts
|
|
13
13
|
/**
|
|
14
14
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
15
15
|
* billboard.js project is licensed under the MIT license
|
|
@@ -39,7 +39,45 @@ var type_default = {
|
|
|
39
39
|
* @private
|
|
40
40
|
*/
|
|
41
41
|
isValidChartType(type) {
|
|
42
|
-
return !!(type && Object.values(TYPE).indexOf(type) > -1);
|
|
42
|
+
return !!(type && (Object.values(TYPE).indexOf(type) > -1 || type === this.state.customType || this.axisTypes?.[type]));
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Get the names of the chart types of their own modules that are drawn on the axes
|
|
46
|
+
* @returns {Array} Type names
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
getAxisTypes() {
|
|
50
|
+
return Object.keys(this.axisTypes || {});
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Get what the modules of the axis types registered
|
|
54
|
+
* @returns {Array} Parts of the types
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
getAxisTypeParts() {
|
|
58
|
+
return Object.values(this.axisTypes || {});
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* Check if the chart has a type of its own module that is drawn like a bar: it has the room of
|
|
62
|
+
* the half of a shape at each end of the x axis, as the bar does
|
|
63
|
+
* @returns {boolean}
|
|
64
|
+
* @private
|
|
65
|
+
*/
|
|
66
|
+
hasAxisTypePadding() {
|
|
67
|
+
const types = this.axisTypes;
|
|
68
|
+
return !!types && Object.keys(types).some((name) => types[name].padded && this.hasType(name));
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* Get what the module of an axis type registered, when the data belongs to that type
|
|
72
|
+
* @param {object|string} d Data object or id
|
|
73
|
+
* @returns {object|undefined} Hooks of the type
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
getAxisTypeHooks(d) {
|
|
77
|
+
const types = this.axisTypes;
|
|
78
|
+
if (types) {
|
|
79
|
+
for (const name in types) if (this.isTypeOf(d, name)) return types[name];
|
|
80
|
+
}
|
|
43
81
|
},
|
|
44
82
|
/**
|
|
45
83
|
* Get the chart type to use for the subchart target.
|
|
@@ -141,9 +179,10 @@ var type_default = {
|
|
|
141
179
|
*/
|
|
142
180
|
updateTypesElements() {
|
|
143
181
|
const $$ = this;
|
|
144
|
-
const { state: { current } } = $$;
|
|
145
|
-
Object.
|
|
146
|
-
|
|
182
|
+
const { state: { current, customType } } = $$;
|
|
183
|
+
const types = Object.values(TYPE);
|
|
184
|
+
customType && types.push(customType);
|
|
185
|
+
types.forEach((t) => {
|
|
147
186
|
const has = $$.hasType(t, null, true);
|
|
148
187
|
const idx = current.types.indexOf(t);
|
|
149
188
|
if (idx === -1 && has) current.types.push(t);
|
|
@@ -235,6 +274,36 @@ var type_default = {
|
|
|
235
274
|
isBubbleType(d) {
|
|
236
275
|
return this.isTypeOf(d, "bubble");
|
|
237
276
|
},
|
|
277
|
+
/**
|
|
278
|
+
* Get the name of the chart type of its own module that the chart has.
|
|
279
|
+
* The modules register their types by name (registerCustomType()): a bundle can have more than
|
|
280
|
+
* one of them, and a chart has one at most.
|
|
281
|
+
* @returns {string|null} Type name
|
|
282
|
+
* @private
|
|
283
|
+
*/
|
|
284
|
+
getCustomType() {
|
|
285
|
+
const types = this.customTypes;
|
|
286
|
+
return types && Object.keys(types).find((name) => this.hasType(name)) || null;
|
|
287
|
+
},
|
|
288
|
+
/**
|
|
289
|
+
* Get what the module of the custom type of the chart has registered: hooks and canvas parts.
|
|
290
|
+
* @returns {object|undefined} Parts of the type
|
|
291
|
+
* @private
|
|
292
|
+
*/
|
|
293
|
+
getCustomTypeParts() {
|
|
294
|
+
const { customType } = this.state;
|
|
295
|
+
return customType ? this.customTypes?.[customType] : void 0;
|
|
296
|
+
},
|
|
297
|
+
/**
|
|
298
|
+
* Get the hooks of the module of a custom type, when the data belongs to that type.
|
|
299
|
+
* @param {object} d Data object
|
|
300
|
+
* @returns {object|null} Hooks
|
|
301
|
+
* @private
|
|
302
|
+
*/
|
|
303
|
+
getCustomTypeHooks(d) {
|
|
304
|
+
const { customType } = this.state;
|
|
305
|
+
return customType && this.isTypeOf(d, customType) ? this.getCustomTypeParts()?.hooks ?? null : null;
|
|
306
|
+
},
|
|
238
307
|
isCandlestickType(d) {
|
|
239
308
|
return this.isTypeOf(d, "candlestick");
|
|
240
309
|
},
|
|
@@ -247,9 +316,6 @@ var type_default = {
|
|
|
247
316
|
isPieType(d) {
|
|
248
317
|
return this.isTypeOf(d, "pie");
|
|
249
318
|
},
|
|
250
|
-
isFunnelType(d) {
|
|
251
|
-
return this.isTypeOf(d, "funnel");
|
|
252
|
-
},
|
|
253
319
|
isGaugeType(d) {
|
|
254
320
|
return this.isTypeOf(d, "gauge");
|
|
255
321
|
},
|
|
@@ -283,7 +349,9 @@ var type_default = {
|
|
|
283
349
|
* @private
|
|
284
350
|
*/
|
|
285
351
|
labelishData(d) {
|
|
286
|
-
|
|
352
|
+
const custom = this.getCustomTypeHooks(d);
|
|
353
|
+
if (custom) return custom.labelData?.(this, d) ?? [];
|
|
354
|
+
return this.isBarType(d) || this.isLineType(d) || this.isScatterType(d) || this.isBubbleType(d) || this.isCandlestickType(d) || this.isRadarType(d) || this.isTreemapType(d) ? d.values.filter((v) => isNumber(v.value) || Boolean(v.value)) : [];
|
|
287
355
|
},
|
|
288
356
|
barLineBubbleData(d) {
|
|
289
357
|
return this.isBarType(d) || this.isLineType(d) || this.isBubbleType(d) ? d.values : [];
|
|
@@ -292,5 +360,4 @@ var type_default = {
|
|
|
292
360
|
return INTERPOLATION_TYPES.has(type);
|
|
293
361
|
}
|
|
294
362
|
};
|
|
295
|
-
//#endregion
|
|
296
363
|
export { type_default as default };
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
9
|
*/
|
|
10
|
+
import { $ARC, $COMMON, $FOCUS, $GAUGE } from "../../config/classes.js";
|
|
10
11
|
import { document as doc } from "../../module/browser.js";
|
|
11
|
-
import { isDefined, isFunction, isNumber, isObject, isUndefined } from "../../module/util/type-checks.js";
|
|
12
12
|
import { callFn, endall, tplProcess } from "../../module/util/object.js";
|
|
13
|
+
import { isDefined, isFunction, isNumber, isObject, isUndefined } from "../../module/util/type-checks.js";
|
|
13
14
|
import { setTextValue } from "../../module/util/dom.js";
|
|
14
|
-
import { $ARC, $COMMON, $FOCUS, $GAUGE } from "../../config/classes.js";
|
|
15
|
-
import { meetsLabelThreshold, updateTextImage, updateTextImagePos } from "../internals/text.util.js";
|
|
16
15
|
import { isLabelWithLine, redrawArcLabelLines } from "../internals/text.arc.js";
|
|
16
|
+
import { meetsLabelThreshold, updateTextImage, updateTextImagePos } from "../internals/text.util.js";
|
|
17
17
|
import { select } from "d3-selection";
|
|
18
18
|
import { arc, pie } from "d3-shape";
|
|
19
19
|
import { interpolate } from "d3-interpolate";
|
|
20
|
-
|
|
20
|
+
// src/ChartInternal/shape/arc.ts
|
|
21
21
|
/**
|
|
22
22
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
23
23
|
* billboard.js project is licensed under the MIT license
|
|
@@ -850,5 +850,4 @@ var arc_default = {
|
|
|
850
850
|
return arcs?.selectAll(`.${$COMMON.target} path`).filter(filterFn);
|
|
851
851
|
}
|
|
852
852
|
};
|
|
853
|
-
//#endregion
|
|
854
853
|
export { arc_default as default };
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
9
|
*/
|
|
10
|
-
import { getRandom } from "../../module/util/object.js";
|
|
11
10
|
import { $AREA, $CIRCLE, $LINE } from "../../config/classes.js";
|
|
12
|
-
import {
|
|
11
|
+
import { getRandom } from "../../module/util/object.js";
|
|
13
12
|
import { generateDrawAreaPath } from "./core/path.js";
|
|
13
|
+
import { getShapeColorWithGradient } from "./shape.js";
|
|
14
14
|
import { select } from "d3-selection";
|
|
15
|
-
|
|
15
|
+
// src/ChartInternal/shape/area.ts
|
|
16
16
|
/**
|
|
17
17
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
18
18
|
* billboard.js project is licensed under the MIT license
|
|
@@ -80,5 +80,4 @@ var area_default = {
|
|
|
80
80
|
return generateDrawAreaPath($$, areaIndices, isSub);
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
//#endregion
|
|
84
83
|
export { area_default as default };
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
9
|
*/
|
|
10
|
-
import { isNumber } from "../../module/util/type-checks.js";
|
|
11
|
-
import { getRandom } from "../../module/util/object.js";
|
|
12
10
|
import { $BAR, $COMMON } from "../../config/classes.js";
|
|
13
|
-
import {
|
|
11
|
+
import { getRandom } from "../../module/util/object.js";
|
|
12
|
+
import { isNumber } from "../../module/util/type-checks.js";
|
|
14
13
|
import { getBarPathInterpolator, getBarRadiusInfo, getBarRadiusResolver, getStackingBarRadiusSet } from "./core/barRadius.js";
|
|
14
|
+
import { getShapeColorWithGradient, updateTargetsForShape } from "./shape.js";
|
|
15
15
|
import { select } from "d3-selection";
|
|
16
|
-
|
|
16
|
+
// src/ChartInternal/shape/bar.ts
|
|
17
17
|
/**
|
|
18
18
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
19
19
|
* billboard.js project is licensed under the MIT license
|
|
@@ -236,5 +236,4 @@ var bar_default = {
|
|
|
236
236
|
node.attr("d", `M${path.join("")}z`);
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
|
-
//#endregion
|
|
240
239
|
export { bar_default as default };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
3
|
+
* billboard.js project is licensed under the MIT license
|
|
4
|
+
*
|
|
5
|
+
* billboard.js, JavaScript chart library
|
|
6
|
+
* https://naver.github.io/billboard.js/
|
|
7
|
+
*
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
|
+
*/
|
|
10
|
+
import { $COMMON } from "../../config/classes.js";
|
|
11
|
+
import { getRandom } from "../../module/util/object.js";
|
|
12
|
+
import boxplot_default$1, { $BOXPLOT } from "./core/boxplot.js";
|
|
13
|
+
import { select } from "d3-selection";
|
|
14
|
+
// src/ChartInternal/shape/boxplot.ts
|
|
15
|
+
/**
|
|
16
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
17
|
+
* billboard.js project is licensed under the MIT license
|
|
18
|
+
*/
|
|
19
|
+
var boxplot_default = {
|
|
20
|
+
...boxplot_default$1,
|
|
21
|
+
/**
|
|
22
|
+
* Initialize the container of the boxplot elements
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
initBoxplot() {
|
|
26
|
+
const { $el } = this;
|
|
27
|
+
$el.boxplot = $el.main.select(`.${$COMMON.chart}`).append("g").attr("class", $BOXPLOT.chartBoxplots);
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Update targets by its data
|
|
31
|
+
* @param {Array} targets Filtered target by type
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
updateTargetsForBoxplot(targets) {
|
|
35
|
+
const $$ = this;
|
|
36
|
+
const { $el } = $$;
|
|
37
|
+
!$$.$el.boxplot && $$.initBoxplot();
|
|
38
|
+
$el.main.select(`.${$BOXPLOT.chartBoxplots}`).selectAll(`.${$BOXPLOT.chartBoxplot}`).data($$.filterNullish(targets)).attr("class", (d) => $BOXPLOT.chartBoxplot + $$.classTarget(d.id)).enter().append("g").attr("class", (d) => $BOXPLOT.chartBoxplot + $$.classTarget(d.id)).style("pointer-events", "none");
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Generate/Update elements
|
|
42
|
+
* @param {boolean} withTransition Transition for exit elements
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
updateBoxplot(withTransition) {
|
|
46
|
+
const $$ = this;
|
|
47
|
+
const { $el, $T } = $$;
|
|
48
|
+
const boxplot = $el.main.selectAll(`.${$BOXPLOT.chartBoxplot}`).selectAll(`.${$BOXPLOT.boxplot}`).data((d) => $$.getBoxplotRows(d));
|
|
49
|
+
$T(boxplot.exit(), withTransition).style("opacity", "0").remove();
|
|
50
|
+
const enter = boxplot.enter().append("g").attr("class", (d) => $$.generateClass($BOXPLOT.boxplot, d.index).trim());
|
|
51
|
+
enter.append("path").attr("class", $BOXPLOT.boxplotWhisker);
|
|
52
|
+
enter.append("path").attr("class", $BOXPLOT.boxplotBox);
|
|
53
|
+
enter.append("path").attr("class", $BOXPLOT.boxplotMedian);
|
|
54
|
+
$el.boxplot = boxplot.merge(enter).attr("class", (d) => $$.generateClass($BOXPLOT.boxplot, d.index).trim()).style("opacity", $$.initialOpacity.bind($$));
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Get the rows of a target that have a boxplot value
|
|
58
|
+
* @param {object} d Target
|
|
59
|
+
* @returns {Array} Data rows
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
getBoxplotRows(d) {
|
|
63
|
+
return this.isBoxplotType(d) ? d.values.filter((v) => this.getBoxplotData(v)) : [];
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Get draw function
|
|
67
|
+
* @param {object} indices Indice data
|
|
68
|
+
* @param {boolean} isSub Subchart draw
|
|
69
|
+
* @returns {function}
|
|
70
|
+
* @private
|
|
71
|
+
*/
|
|
72
|
+
generateDrawBoxplot(indices, isSub) {
|
|
73
|
+
const $$ = this;
|
|
74
|
+
const getPoints = $$.generateGetBoxplotPoints(indices, isSub);
|
|
75
|
+
const P = $$.config.axis_rotated ? (i, v) => `${v},${i}` : (i, v) => `${i},${v}`;
|
|
76
|
+
return (d, i, g) => {
|
|
77
|
+
const points = getPoints(d, i);
|
|
78
|
+
if (!points) return;
|
|
79
|
+
const { config } = $$;
|
|
80
|
+
const [[x0, q1], [x1, q3], [xc, min, max], [median], outliers, mean] = points;
|
|
81
|
+
const cap = (x1 - x0) * config.boxplot_whisker_width / 2;
|
|
82
|
+
const capPath = cap > 0 ? `M${P(xc - cap, max)}L${P(xc + cap, max)}M${P(xc - cap, min)}L${P(xc + cap, min)}` : "";
|
|
83
|
+
g.select(`.${$BOXPLOT.boxplotBox}`).attr("d", `M${P(x0, q1)}L${P(x1, q1)}L${P(x1, q3)}L${P(x0, q3)}z`).style("fill", $$.color(d));
|
|
84
|
+
g.select(`.${$BOXPLOT.boxplotMedian}`).attr("d", `M${P(x0, median)}L${P(x1, median)}`);
|
|
85
|
+
g.select(`.${$BOXPLOT.boxplotWhisker}`).attr("d", `M${P(xc, max)}L${P(xc, q3)}M${P(xc, q1)}L${P(xc, min)}${capPath}`);
|
|
86
|
+
const el = select(g.node());
|
|
87
|
+
const r = config.boxplot_outlier_r;
|
|
88
|
+
const m = config.boxplot_mean_r;
|
|
89
|
+
el.selectAll(`.${$BOXPLOT.boxplotOutlier}`).data(outliers).join("path").attr("class", $BOXPLOT.boxplotOutlier).attr("d", (v) => {
|
|
90
|
+
const [cx, cy] = config.axis_rotated ? [v, xc] : [xc, v];
|
|
91
|
+
return `M${cx - r},${cy}a${r},${r} 0 1,0 ${2 * r},0a${r},${r} 0 1,0 ${-2 * r},0`;
|
|
92
|
+
});
|
|
93
|
+
el.selectAll(`.${$BOXPLOT.boxplotMean}`).data(mean).join("path").attr("class", $BOXPLOT.boxplotMean).attr("d", (v) => `M${P(xc - m, v)}L${P(xc, v - m)}L${P(xc + m, v)}L${P(xc, v + m)}z`);
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* Redraw function
|
|
98
|
+
* @param {function} drawFn Returned function from .generateDrawBoxplot()
|
|
99
|
+
* @param {boolean} withTransition With or without transition
|
|
100
|
+
* @returns {Array}
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
redrawBoxplot(drawFn, withTransition) {
|
|
104
|
+
const { $el, $T } = this;
|
|
105
|
+
const rand = getRandom(true);
|
|
106
|
+
return [$el.boxplot.each(function(d, i) {
|
|
107
|
+
drawFn(d, i, $T(select(this), withTransition, rand));
|
|
108
|
+
}).style("opacity", null)];
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
export { boxplot_default as default };
|
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
9
|
*/
|
|
10
10
|
import bubble_default$1 from "./core/bubble.js";
|
|
11
|
-
|
|
11
|
+
// src/ChartInternal/shape/bubble.ts
|
|
12
12
|
/**
|
|
13
13
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
14
14
|
* billboard.js project is licensed under the MIT license
|
|
15
15
|
*/
|
|
16
16
|
var bubble_default = bubble_default$1;
|
|
17
|
-
//#endregion
|
|
18
17
|
export { bubble_default as default };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
3
|
+
* billboard.js project is licensed under the MIT license
|
|
4
|
+
*
|
|
5
|
+
* billboard.js, JavaScript chart library
|
|
6
|
+
* https://naver.github.io/billboard.js/
|
|
7
|
+
*
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
|
+
*/
|
|
10
|
+
import { $COMMON, $SHAPE } from "../../config/classes.js";
|
|
11
|
+
import { isObject } from "../../module/util/type-checks.js";
|
|
12
|
+
import bullet_default$1, { $BULLET } from "./core/bullet.js";
|
|
13
|
+
import { local, select } from "d3-selection";
|
|
14
|
+
import { axisBottom, axisLeft } from "d3-axis";
|
|
15
|
+
// src/ChartInternal/shape/bullet.ts
|
|
16
|
+
/**
|
|
17
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
18
|
+
* billboard.js project is licensed under the MIT license
|
|
19
|
+
*/
|
|
20
|
+
const axisState = local();
|
|
21
|
+
/**
|
|
22
|
+
* Get the row element of the given tag and class, creating it before the given siblings.
|
|
23
|
+
* Elements are updated in place on redraw, instead of being recreated.
|
|
24
|
+
* @param {d3Selection} g Bullet row group selection
|
|
25
|
+
* @param {string} tag Element tag name
|
|
26
|
+
* @param {string} cls Class name
|
|
27
|
+
* @param {string|null} before Selector of the sibling to insert before: keeps the paint order
|
|
28
|
+
* @returns {Array} Row element selection, and whether it was just created
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
function _upsert(g, tag, cls, before) {
|
|
32
|
+
const el = g.select(`${tag}.${cls}`);
|
|
33
|
+
const isNew = el.empty();
|
|
34
|
+
return [isNew ? g.insert(tag, before).classed(cls, true) : el, isNew];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Set the attributes of an element: a new one is drawn at its place,
|
|
38
|
+
* an existing one moves there with the chart transition, same as the data labels.
|
|
39
|
+
* @param {ChartInternal} $$ ChartInternal instance
|
|
40
|
+
* @param {d3Selection} el Element selection
|
|
41
|
+
* @param {boolean} isNew Whether the element was just created
|
|
42
|
+
* @param {boolean} withTransition Whether to transit
|
|
43
|
+
* @param {object} attrs Attributes
|
|
44
|
+
* @param {string|null} fill Fill color, null to remove it
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
function _move($$, el, isNew, withTransition, attrs, fill) {
|
|
48
|
+
const target = isNew ? el : $$.$T(el, withTransition);
|
|
49
|
+
Object.keys(attrs).forEach((key) => target.attr(key, attrs[key]));
|
|
50
|
+
fill !== void 0 && target.style("fill", fill);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Draw a single bullet row within its group
|
|
54
|
+
* @param {d3Selection} g Bullet row group selection
|
|
55
|
+
* @param {object} d Bullet row data
|
|
56
|
+
* @param {object} layout Bullet layout
|
|
57
|
+
* @param {boolean} withTransition Whether to transit
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
function _drawRow(g, d, layout, withTransition) {
|
|
61
|
+
const $$ = this;
|
|
62
|
+
const { offset, ranges, isDot, measure, color, targets, axis, title } = $$.getBulletRowGeometry(d, layout);
|
|
63
|
+
const sel = {
|
|
64
|
+
target: `.${$BULLET.bulletTarget}`,
|
|
65
|
+
axis: `.${$BULLET.bulletAxis}`
|
|
66
|
+
};
|
|
67
|
+
_move($$, g, g.attr("transform") === null, withTransition, { transform: `translate(${offset.x}, ${offset.y})` });
|
|
68
|
+
const rangeSel = g.selectAll(`.${$BULLET.bulletRange}`).data(ranges);
|
|
69
|
+
const rangeAttrs = ({ x, y, width, height }) => ({
|
|
70
|
+
x,
|
|
71
|
+
y,
|
|
72
|
+
width,
|
|
73
|
+
height
|
|
74
|
+
});
|
|
75
|
+
const rangeTheme = (el, { fill, t }) => el.style("--bb-t", fill ? null : t);
|
|
76
|
+
rangeSel.exit().remove();
|
|
77
|
+
rangeSel.each(function(range) {
|
|
78
|
+
const el = select(this);
|
|
79
|
+
_move($$, el, false, withTransition, rangeAttrs(range), range.fill);
|
|
80
|
+
rangeTheme(el, range);
|
|
81
|
+
});
|
|
82
|
+
rangeSel.enter().insert("rect", `.${$BULLET.bulletMeasure}`).attr("class", $BULLET.bulletRange).each(function(range) {
|
|
83
|
+
const el = select(this);
|
|
84
|
+
_move($$, el, true, withTransition, rangeAttrs(range), range.fill);
|
|
85
|
+
rangeTheme(el, range);
|
|
86
|
+
});
|
|
87
|
+
const measureTag = isDot ? "circle" : "rect";
|
|
88
|
+
g.selectAll(`.${$BULLET.bulletMeasure}`).filter(function() {
|
|
89
|
+
return this.tagName.toLowerCase() !== measureTag;
|
|
90
|
+
}).remove();
|
|
91
|
+
const [measureEl, isNewMeasure] = _upsert(g, measureTag, $BULLET.bulletMeasure, `${sel.target}, ${sel.axis}`);
|
|
92
|
+
measureEl.attr("class", [
|
|
93
|
+
$BULLET.bulletMeasure,
|
|
94
|
+
$$.generateClass($SHAPE.shape, d.index),
|
|
95
|
+
$$.generateClass($BULLET.bullet, d.id)
|
|
96
|
+
].join("").replace(/\s+/g, " ").trim()).datum(d);
|
|
97
|
+
_move($$, measureEl, isNewMeasure, withTransition, measure, color);
|
|
98
|
+
const targetEls = g.selectAll(`line${sel.target}`).nodes();
|
|
99
|
+
targetEls.slice(targets.length).forEach((el) => el.remove());
|
|
100
|
+
targets.forEach((target, i) => {
|
|
101
|
+
const isNewTarget = !targetEls[i];
|
|
102
|
+
const targetEl = isNewTarget ? g.insert("line", sel.axis).classed($BULLET.bulletTarget, true) : select(targetEls[i]);
|
|
103
|
+
targetEl.datum(d);
|
|
104
|
+
_move($$, targetEl, isNewTarget, withTransition, target);
|
|
105
|
+
});
|
|
106
|
+
let axisEl = g.select(sel.axis);
|
|
107
|
+
if (axis && !axisEl.empty() && axisState.get(axisEl.node())?.rotated !== axis.rotated) {
|
|
108
|
+
axisEl.remove();
|
|
109
|
+
axisEl = g.select(sel.axis);
|
|
110
|
+
}
|
|
111
|
+
if (axis) {
|
|
112
|
+
const isNewAxis = axisEl.empty();
|
|
113
|
+
if (isNewAxis) axisEl = g.append("g").attr("class", $BULLET.bulletAxis);
|
|
114
|
+
if (axis.rotated) axisEl.attr("transform", null);
|
|
115
|
+
else _move($$, axisEl, isNewAxis, withTransition, { transform: `translate(${axis.x}, ${axis.y})` });
|
|
116
|
+
const { key } = axis;
|
|
117
|
+
if (axisState.get(axisEl.node())?.key !== key) {
|
|
118
|
+
(isNewAxis ? axisEl : $$.$T(axisEl, withTransition)).call((axis.rotated ? axisLeft : axisBottom)(axis.scale).tickValues(axis.ticks).tickFormat(axis.format).tickSizeOuter(0));
|
|
119
|
+
axisEl.attr("font-family", null).attr("font-size", null);
|
|
120
|
+
axisState.set(axisEl.node(), {
|
|
121
|
+
rotated: axis.rotated,
|
|
122
|
+
key
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
} else axisEl.remove();
|
|
126
|
+
if (title) {
|
|
127
|
+
const [titleEl, isNewTitle] = _upsert(g, "text", $BULLET.bulletTitle, null);
|
|
128
|
+
titleEl.text(title.text).style("text-anchor", title.anchor).attr("dy", title.anchor === "end" ? ".35em" : null);
|
|
129
|
+
_move($$, titleEl, isNewTitle, withTransition, {
|
|
130
|
+
x: title.x,
|
|
131
|
+
y: title.y
|
|
132
|
+
});
|
|
133
|
+
} else g.select(`.${$BULLET.bulletTitle}`).remove();
|
|
134
|
+
}
|
|
135
|
+
var bullet_default = {
|
|
136
|
+
...bullet_default$1,
|
|
137
|
+
/**
|
|
138
|
+
* Initialize bullet
|
|
139
|
+
* @private
|
|
140
|
+
*/
|
|
141
|
+
initBullet() {
|
|
142
|
+
const $$ = this;
|
|
143
|
+
const { $el } = $$;
|
|
144
|
+
$el.bullet = $el.main.select(`.${$COMMON.chart}`).append("g").classed($BULLET.chartBullets, true);
|
|
145
|
+
$$.bindBulletEvent();
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* Bind events
|
|
149
|
+
* @private
|
|
150
|
+
*/
|
|
151
|
+
bindBulletEvent() {
|
|
152
|
+
const $$ = this;
|
|
153
|
+
const { $el: { bullet }, config, state } = $$;
|
|
154
|
+
if (!config.interaction_enabled) return;
|
|
155
|
+
const getTarget = (event) => {
|
|
156
|
+
const target = event.target === bullet.node() ? state.eventReceiver.rect?.node?.() : event.target;
|
|
157
|
+
if (target && /^(rect|circle|line)$/i.test(target.tagName)) {
|
|
158
|
+
const datum = select(target).datum();
|
|
159
|
+
if (datum && isObject(datum) && "id" in datum) {
|
|
160
|
+
state.event = event;
|
|
161
|
+
return datum;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const isTouch = state.inputType === "touch";
|
|
166
|
+
bullet.on(isTouch ? "touchstart" : "mouseover mousemove", (event) => {
|
|
167
|
+
const data = getTarget(event);
|
|
168
|
+
if (data) {
|
|
169
|
+
$$.showTooltip([$$.addName(data)], $$.$el.svg.node());
|
|
170
|
+
/^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
|
|
171
|
+
}
|
|
172
|
+
}, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
173
|
+
const data = getTarget(event);
|
|
174
|
+
if (config.interaction_onout) {
|
|
175
|
+
$$.hideTooltip();
|
|
176
|
+
$$.setOverOut(false, data);
|
|
177
|
+
}
|
|
178
|
+
}).on("click", (event) => {
|
|
179
|
+
const data = getTarget(event);
|
|
180
|
+
data && config.data_onclick.bind($$.api)(data, event.target);
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
/**
|
|
184
|
+
* Update targets for bullet
|
|
185
|
+
* @private
|
|
186
|
+
*/
|
|
187
|
+
updateTargetsForBullet() {
|
|
188
|
+
const $$ = this;
|
|
189
|
+
const { $el } = $$;
|
|
190
|
+
if (!$el.bullet) $$.initBullet();
|
|
191
|
+
const bulletData = $$.getBulletData();
|
|
192
|
+
const classChartBullet = (d) => $BULLET.chartBullet + $$.classTarget(d.id);
|
|
193
|
+
const groups = $el.bullet.selectAll(`.${$BULLET.chartBullet}`).data(bulletData, (d) => d.id);
|
|
194
|
+
groups.exit().remove();
|
|
195
|
+
groups.enter().append("g").merge(groups).attr("class", classChartBullet);
|
|
196
|
+
},
|
|
197
|
+
/**
|
|
198
|
+
* Render bullet
|
|
199
|
+
* @param {boolean} withTransition Whether to transit
|
|
200
|
+
* @private
|
|
201
|
+
*/
|
|
202
|
+
redrawBullet(withTransition) {
|
|
203
|
+
const $$ = this;
|
|
204
|
+
const { $el: { bullet } } = $$;
|
|
205
|
+
const layout = $$.getBulletLayout();
|
|
206
|
+
const { left, top } = layout.area;
|
|
207
|
+
bullet.attr("transform", `translate(${left}, ${top})`);
|
|
208
|
+
bullet.selectAll(`.${$BULLET.chartBullet}`).data(layout.rows, (d) => d.id).each(function(d) {
|
|
209
|
+
_drawRow.call($$, select(this), d, layout, withTransition);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
export { bullet_default as default };
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
9
|
*/
|
|
10
|
-
import { isObject } from "../../module/util/type-checks.js";
|
|
11
|
-
import { getRandom } from "../../module/util/object.js";
|
|
12
10
|
import { $CANDLESTICK } from "../../config/classes.js";
|
|
13
|
-
import {
|
|
11
|
+
import { getRandom } from "../../module/util/object.js";
|
|
12
|
+
import { isObject } from "../../module/util/type-checks.js";
|
|
14
13
|
import candlestick_default$1 from "./core/candlestick.js";
|
|
14
|
+
import { initShapeElement, updateTargetsForShape } from "./shape.js";
|
|
15
15
|
import { select } from "d3-selection";
|
|
16
|
-
|
|
16
|
+
// src/ChartInternal/shape/candlestick.ts
|
|
17
17
|
/**
|
|
18
18
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
19
19
|
* billboard.js project is licensed under the MIT license
|
|
@@ -116,5 +116,4 @@ var candlestick_default = {
|
|
|
116
116
|
}).style("opacity", null)];
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
-
//#endregion
|
|
120
119
|
export { candlestick_default as default };
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
9
|
*/
|
|
10
10
|
import { isNumber } from "../../../module/util/type-checks.js";
|
|
11
|
-
|
|
11
|
+
// src/ChartInternal/shape/core/barRadius.ts
|
|
12
12
|
/**
|
|
13
13
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
14
14
|
* billboard.js project is licensed under the MIT license
|
|
@@ -217,5 +217,4 @@ function getBarRadiusInfo($$, d, points, getRadius, stackingRadiusSet, isStackin
|
|
|
217
217
|
pos
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
|
-
//#endregion
|
|
221
220
|
export { getBarPathInterpolator, getBarRadiusInfo, getBarRadiusResolver, getStackingBarRadiusSet };
|