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,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
|
-
import { isDefined } from "../../module/util/type-checks.js";
|
|
11
10
|
import { $SHAPE } from "../../config/classes.js";
|
|
11
|
+
import { isDefined } from "../../module/util/type-checks.js";
|
|
12
12
|
var tooltip_default = { tooltip: {
|
|
13
13
|
/**
|
|
14
14
|
* Show tooltip
|
|
@@ -73,16 +73,28 @@ var tooltip_default = { tooltip: {
|
|
|
73
73
|
*/
|
|
74
74
|
show: function(args) {
|
|
75
75
|
const $$ = this.internal;
|
|
76
|
-
const { $el, config, state: {
|
|
76
|
+
const { $el, config, state: { customType, eventReceiver, hasTreemap, inputType, isCanvasMode } } = $$;
|
|
77
77
|
let index;
|
|
78
78
|
let mouse;
|
|
79
|
+
if (customType && !isCanvasMode && !args.data) {
|
|
80
|
+
const found = $$.customTypeHooks?.tooltipTarget?.($$, args).data[0];
|
|
81
|
+
found && (args = {
|
|
82
|
+
...args,
|
|
83
|
+
data: { id: found.id },
|
|
84
|
+
index: args.index ?? found.index
|
|
85
|
+
});
|
|
86
|
+
}
|
|
79
87
|
if (args.mouse) mouse = args.mouse;
|
|
80
88
|
if (args.data) {
|
|
81
89
|
const { data } = args;
|
|
82
90
|
const y = $$.getYScaleById(data.id)?.(data.value);
|
|
83
|
-
if ((
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
if ((customType || hasTreemap) && data.id) {
|
|
92
|
+
if (!isCanvasMode) {
|
|
93
|
+
const shape = `.${$SHAPE.shape}`;
|
|
94
|
+
const at = args.index ?? data.index ?? (isDefined(args.x) ? $$.customTypeHooks?.tooltipTarget?.($$, args).data[0]?.index : void 0);
|
|
95
|
+
const byIndex = isDefined(at) ? $el.main.select($$.selectorTarget(data.id, void 0, `${shape}${shape}-${at}`)) : null;
|
|
96
|
+
eventReceiver.rect = byIndex?.node() ? byIndex : $el.main.select($$.selectorTarget(data.id, void 0, shape));
|
|
97
|
+
}
|
|
86
98
|
} else if ($$.isMultipleX()) mouse = [$$.xx(data), y];
|
|
87
99
|
else {
|
|
88
100
|
if (!config.tooltip_grouped) mouse = [0, y];
|
|
@@ -92,12 +104,20 @@ var tooltip_default = { tooltip: {
|
|
|
92
104
|
else if (isDefined(args.index)) index = args.index;
|
|
93
105
|
if ($$.state.isCanvasMode) {
|
|
94
106
|
const targets = $$.filterTargetsToShow?.() || $$.data.targets;
|
|
95
|
-
const
|
|
107
|
+
const custom = customType ? $$.customTypeHooks?.tooltipTarget?.($$, args) : null;
|
|
108
|
+
const selectedData = custom ? custom.data : args.data?.id && !config.tooltip_grouped ? targets.filter((target) => target.id === args.data.id).map((target) => target.values[index ?? args.data.index]).filter(Boolean) : targets.map((target) => target.values[index]).filter(Boolean);
|
|
96
109
|
const canvas = $el.canvas?.node?.();
|
|
97
110
|
const shape = $$.state.canvasShape || $$.getDrawShape?.();
|
|
98
111
|
const first = selectedData[0];
|
|
99
|
-
const point = mouse || (first && shape?.pos?.cx && shape?.pos?.cy ? [$$.state.margin.left + shape.pos.cx(first), $$.state.margin.top + shape.pos.cy(first)] : void 0);
|
|
112
|
+
const point = mouse || (custom ? custom.point : first && shape?.pos?.cx && shape?.pos?.cy ? [$$.state.margin.left + shape.pos.cx(first), $$.state.margin.top + shape.pos.cy(first)] : void 0);
|
|
100
113
|
if (!selectedData.length || !canvas) return;
|
|
114
|
+
if (custom && point) {
|
|
115
|
+
const rect = canvas.getBoundingClientRect();
|
|
116
|
+
$$.state.event = {
|
|
117
|
+
clientX: rect.left + point[0],
|
|
118
|
+
clientY: rect.top + point[1]
|
|
119
|
+
};
|
|
120
|
+
}
|
|
101
121
|
$$.state.canvasFocusKey = selectedData.map((v) => `${v.id}:${v.index}`).join("|");
|
|
102
122
|
$$.renderCanvasFocus?.(selectedData, point);
|
|
103
123
|
$$.showTooltip?.(selectedData, canvas);
|
|
@@ -136,5 +156,4 @@ var tooltip_default = { tooltip: {
|
|
|
136
156
|
$$.expandBarTypeShapes?.(false);
|
|
137
157
|
}
|
|
138
158
|
} };
|
|
139
|
-
//#endregion
|
|
140
159
|
export { tooltip_default as default };
|
package/dist-esm/Chart/api/x.js
CHANGED
|
@@ -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 { isArray, isObject } from "../../module/util/type-checks.js";
|
|
11
|
-
|
|
11
|
+
// src/Chart/api/x.ts
|
|
12
12
|
/**
|
|
13
13
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
14
14
|
* billboard.js project is licensed under the MIT license
|
|
@@ -75,5 +75,4 @@ var x_default = {
|
|
|
75
75
|
return $$.data.xs;
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
-
//#endregion
|
|
79
78
|
export { x_default as default };
|
|
@@ -5,12 +5,12 @@
|
|
|
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 { isDefined, isObject } from "../../module/util/type-checks.js";
|
|
11
10
|
import { extend, getMinMax, parseDate } from "../../module/util/object.js";
|
|
11
|
+
import { isDefined, isObject } from "../../module/util/type-checks.js";
|
|
12
12
|
import { zoomIdentity, zoomTransform } from "d3-zoom";
|
|
13
|
-
|
|
13
|
+
// src/Chart/api/zoom.ts
|
|
14
14
|
/**
|
|
15
15
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
16
16
|
* billboard.js project is licensed under the MIT license
|
|
@@ -41,7 +41,7 @@ import { zoomIdentity, zoomTransform } from "d3-zoom";
|
|
|
41
41
|
* // Domain value may not be exact returning approximately values.
|
|
42
42
|
* chart.zoom();
|
|
43
43
|
*/
|
|
44
|
-
const zoom
|
|
44
|
+
const zoom = function(domainValue) {
|
|
45
45
|
const $$ = this.internal;
|
|
46
46
|
const { axis, config, org, scale, state } = $$;
|
|
47
47
|
let domain;
|
|
@@ -71,7 +71,7 @@ const zoom$1 = function(domainValue) {
|
|
|
71
71
|
}
|
|
72
72
|
return state.domain ?? domain;
|
|
73
73
|
};
|
|
74
|
-
extend(zoom
|
|
74
|
+
extend(zoom, {
|
|
75
75
|
/**
|
|
76
76
|
* Enable and disable zooming.
|
|
77
77
|
* @function zoom․enable
|
|
@@ -170,7 +170,7 @@ extend(zoom$1, {
|
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
var zoom_default = {
|
|
173
|
-
zoom
|
|
173
|
+
zoom,
|
|
174
174
|
/**
|
|
175
175
|
* Unzoom zoomed area
|
|
176
176
|
* - **NOTE:** Calling .unzoom() will not trigger zoom events.
|
|
@@ -193,5 +193,4 @@ var zoom_default = {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
};
|
|
196
|
-
//#endregion
|
|
197
196
|
export { zoom_default as default };
|
|
@@ -5,16 +5,16 @@
|
|
|
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 { isArray, isEmpty, isFunction, isNumber, isObjectType, isString, isValue, notEmpty } from "../../module/util/type-checks.js";
|
|
11
|
-
import { capitalize, mergeObj, parseDate, sortValue } from "../../module/util/object.js";
|
|
12
|
-
import { getBoundingRect } from "../../module/util/dom.js";
|
|
13
10
|
import { $AXIS, $COMMON } from "../../config/classes.js";
|
|
14
11
|
import { KEY } from "../../module/Cache.js";
|
|
12
|
+
import { capitalize, mergeObj, parseDate, sortValue } from "../../module/util/object.js";
|
|
13
|
+
import { getBoundingRect } from "../../module/util/dom.js";
|
|
14
|
+
import { isArray, isEmpty, isFunction, isNumber, isObjectType, isString, isValue, notEmpty } from "../../module/util/type-checks.js";
|
|
15
15
|
import { getScale } from "../internals/scale.js";
|
|
16
16
|
import AxisRenderer from "./AxisRenderer.js";
|
|
17
|
-
|
|
17
|
+
// src/ChartInternal/Axis/Axis.ts
|
|
18
18
|
/**
|
|
19
19
|
* Get the corresponding main axis id for subchart axis ids.
|
|
20
20
|
* @param {string} id Axis id
|
|
@@ -1120,5 +1120,4 @@ var Axis = class {
|
|
|
1120
1120
|
});
|
|
1121
1121
|
}
|
|
1122
1122
|
};
|
|
1123
|
-
//#endregion
|
|
1124
1123
|
export { Axis_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 { $COMMON } from "../../config/classes.js";
|
|
10
11
|
import { isArray, isFunction, isNumber, isString } from "../../module/util/type-checks.js";
|
|
11
12
|
import { toArray } from "../../module/util/object.js";
|
|
12
|
-
import { $COMMON } from "../../config/classes.js";
|
|
13
13
|
import AxisRendererHelper from "./AxisRendererHelper.js";
|
|
14
14
|
import { select } from "d3-selection";
|
|
15
|
-
|
|
15
|
+
// src/ChartInternal/Axis/AxisRenderer.ts
|
|
16
16
|
/**
|
|
17
17
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
18
18
|
* billboard.js project is licensed under the MIT license
|
|
@@ -136,13 +136,14 @@ var AxisRenderer = class {
|
|
|
136
136
|
return isTopBottom ? `M${range[0]},${outerTickSized}V0H${range[1]}V${outerTickSized}` : `M${outerTickSized},${range[0]}H0V${range[1]}H${outerTickSized}`;
|
|
137
137
|
});
|
|
138
138
|
if (tickShow.tick || tickShow.text) {
|
|
139
|
+
const domainNode = g.select(".domain").node();
|
|
139
140
|
const ticks = config.tickValues || helper.generateTicks(scale1, isLeftRight || params.config.axis_rotated);
|
|
140
141
|
ctx.generatedTicks = ticks;
|
|
141
142
|
let tick = g.selectAll(".tick");
|
|
142
143
|
if (ctx.canReuseTickNodesOnResize(tick, ticks, isLeftRight || params.config.axis_rotated, tickShow)) tickTransform(tick, scale1);
|
|
143
144
|
else {
|
|
144
145
|
tick = tick.data(ticks, scale1);
|
|
145
|
-
const tickEnter = tick.enter().insert("g",
|
|
146
|
+
const tickEnter = tick.enter().insert("g", () => domainNode).attr("class", "tick");
|
|
146
147
|
const tickExit = tick.exit().remove();
|
|
147
148
|
tick = tickEnter.merge(tick);
|
|
148
149
|
tickShow.tick && tickEnter.append("line");
|
|
@@ -177,7 +178,9 @@ var AxisRenderer = class {
|
|
|
177
178
|
}));
|
|
178
179
|
});
|
|
179
180
|
tspan.exit().remove();
|
|
180
|
-
tspan = tspan.enter().append("tspan").merge(tspan).
|
|
181
|
+
tspan = tspan.enter().append("tspan").merge(tspan).each(function(d) {
|
|
182
|
+
this.textContent !== d.splitted && (this.textContent = d.splitted);
|
|
183
|
+
});
|
|
181
184
|
tspan.attr("x", isTopBottom ? 0 : tickLength * sign).attr("dx", (() => {
|
|
182
185
|
let dx = 0;
|
|
183
186
|
if (/(top|bottom)/.test(orient) && rotate) dx = 8 * Math.sin(Math.PI * (rotate / 180)) * (orient === "top" ? -1 : 1);
|
|
@@ -317,19 +320,26 @@ var AxisRenderer = class {
|
|
|
317
320
|
if (isArray(tickText)) return tickText;
|
|
318
321
|
let tickWidth = params.tickWidth;
|
|
319
322
|
if (!tickWidth || tickWidth <= 0) tickWidth = isLeftRight ? 95 : params.isCategory ? (params.isInverted ? scale(ticks[0]) - scale(ticks[1]) : scale(ticks[1]) - scale(ticks[0])) - 12 : 110;
|
|
320
|
-
|
|
321
|
-
|
|
323
|
+
const text = String(tickText);
|
|
324
|
+
const result = [];
|
|
325
|
+
let start = 0;
|
|
326
|
+
while (true) {
|
|
322
327
|
let spaceIndex;
|
|
323
|
-
let
|
|
324
|
-
for (let i = 1; i < text.length; i++) {
|
|
325
|
-
if (text.charAt(i) === " ") spaceIndex = i;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
328
|
+
let splitAt = -1;
|
|
329
|
+
for (let i = 1; start + i < text.length; i++) {
|
|
330
|
+
if (text.charAt(start + i) === " ") spaceIndex = i;
|
|
331
|
+
if (tickWidth < charWidth * (i + 1)) {
|
|
332
|
+
splitAt = i;
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (splitAt === -1) {
|
|
337
|
+
result.push(text.slice(start));
|
|
338
|
+
return result;
|
|
329
339
|
}
|
|
330
|
-
|
|
340
|
+
result.push(text.substr(start, spaceIndex || splitAt));
|
|
341
|
+
start += spaceIndex ? spaceIndex + 1 : splitAt;
|
|
331
342
|
}
|
|
332
|
-
return split(splitted, String(tickText));
|
|
333
343
|
}
|
|
334
344
|
scale(x) {
|
|
335
345
|
if (!arguments.length) return this.helper.scale;
|
|
@@ -387,7 +397,7 @@ var AxisRenderer = class {
|
|
|
387
397
|
if (intervalByValue && intervalByValue < interval) interval = intervalByValue;
|
|
388
398
|
}
|
|
389
399
|
}
|
|
390
|
-
return interval ===
|
|
400
|
+
return interval === 1e400 ? 0 : interval;
|
|
391
401
|
}
|
|
392
402
|
ticks(...args) {
|
|
393
403
|
const { config } = this;
|
|
@@ -415,5 +425,4 @@ var AxisRenderer = class {
|
|
|
415
425
|
return this;
|
|
416
426
|
}
|
|
417
427
|
};
|
|
418
|
-
//#endregion
|
|
419
428
|
export { AxisRenderer as default };
|
|
@@ -5,12 +5,17 @@
|
|
|
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 { isDefined, isValue } from "../../module/util/type-checks.js";
|
|
11
10
|
import { getBBox } from "../../module/util/dom.js";
|
|
11
|
+
import { isDefined, isValue } from "../../module/util/type-checks.js";
|
|
12
12
|
import { getScale } from "../internals/scale.js";
|
|
13
|
-
|
|
13
|
+
// src/ChartInternal/Axis/AxisRendererHelper.ts
|
|
14
|
+
/**
|
|
15
|
+
* Size of one character per chart and font
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
const charSizeCache = /* @__PURE__ */ new WeakMap();
|
|
14
19
|
var AxisRendererHelper = class {
|
|
15
20
|
owner;
|
|
16
21
|
config;
|
|
@@ -39,17 +44,41 @@ var AxisRendererHelper = class {
|
|
|
39
44
|
h: 11.5
|
|
40
45
|
};
|
|
41
46
|
if (this.charSize[orient] && memoize) return this.charSize[orient];
|
|
42
|
-
|
|
47
|
+
const node = text.node();
|
|
48
|
+
if (node) {
|
|
49
|
+
const chart = this.owner.params.owner;
|
|
50
|
+
const style = window.getComputedStyle(node);
|
|
51
|
+
const key = [
|
|
52
|
+
orient,
|
|
53
|
+
style.fontStyle,
|
|
54
|
+
style.fontWeight,
|
|
55
|
+
style.fontSize,
|
|
56
|
+
style.fontFamily,
|
|
57
|
+
style.letterSpacing
|
|
58
|
+
].join(" ");
|
|
59
|
+
const cache = charSizeCache.get(chart) ?? {};
|
|
60
|
+
const cached = cache[key];
|
|
61
|
+
charSizeCache.set(chart, cache);
|
|
43
62
|
try {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
size.
|
|
47
|
-
|
|
63
|
+
if (cached) {
|
|
64
|
+
size.w = cached.w;
|
|
65
|
+
size.h = cached.h;
|
|
66
|
+
} else {
|
|
67
|
+
node.textContent = "0";
|
|
68
|
+
const { width, height } = getBBox(node, true);
|
|
69
|
+
if (width && height) {
|
|
70
|
+
size.w = width;
|
|
71
|
+
size.h = height;
|
|
72
|
+
cache[key] = {
|
|
73
|
+
w: width,
|
|
74
|
+
h: height
|
|
75
|
+
};
|
|
76
|
+
}
|
|
48
77
|
}
|
|
49
78
|
} finally {
|
|
50
|
-
|
|
79
|
+
text.text("");
|
|
51
80
|
}
|
|
52
|
-
}
|
|
81
|
+
}
|
|
53
82
|
this.charSize[orient] = size;
|
|
54
83
|
return size;
|
|
55
84
|
}
|
|
@@ -111,12 +140,11 @@ var AxisRendererHelper = class {
|
|
|
111
140
|
transitionise(selection) {
|
|
112
141
|
const { config } = this;
|
|
113
142
|
let transitionSelection = selection;
|
|
114
|
-
if (config.withoutTransition) transitionSelection = selection.interrupt();
|
|
143
|
+
if (config.withoutTransition && !config.transition) transitionSelection = selection.interrupt();
|
|
115
144
|
else if (config.transition || !this.owner.params.noTransition) try {
|
|
116
145
|
transitionSelection = selection.transition(config.transition);
|
|
117
146
|
} catch {}
|
|
118
147
|
return transitionSelection;
|
|
119
148
|
}
|
|
120
149
|
};
|
|
121
|
-
//#endregion
|
|
122
150
|
export { AxisRendererHelper as default };
|
|
@@ -5,18 +5,18 @@
|
|
|
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 { document as doc, window as win } from "../module/browser.js";
|
|
11
|
-
import { isBoolean, isFunction, isObject, isString, notEmpty } from "../module/util/type-checks.js";
|
|
12
|
-
import { callFn, capitalize, extend, getOption, getRandom, sortValue } from "../module/util/object.js";
|
|
13
|
-
import { convertInputType, hasStyle } from "../module/util/dom.js";
|
|
14
|
-
import { checkModuleImport } from "../module/error.js";
|
|
15
10
|
import { $CIRCLE, $COMMON, $TEXT } from "../config/classes.js";
|
|
16
11
|
import Options from "../config/Options/Options.js";
|
|
17
12
|
import Store from "../config/Store/Store.js";
|
|
13
|
+
import { document as doc, window as win } from "../module/browser.js";
|
|
18
14
|
import Cache from "../module/Cache.js";
|
|
15
|
+
import { checkModuleImport, getTypeMethod } from "../module/error.js";
|
|
19
16
|
import { generateResize } from "../module/generator.js";
|
|
17
|
+
import { callFn, capitalize, extend, getOption, getRandom, sortValue } from "../module/util/object.js";
|
|
18
|
+
import { convertInputType, hasStyle } from "../module/util/dom.js";
|
|
19
|
+
import { isBoolean, isFunction, isObject, isString, notEmpty } from "../module/util/type-checks.js";
|
|
20
20
|
import convert_default from "./data/convert.js";
|
|
21
21
|
import data_default from "./data/data.js";
|
|
22
22
|
import load_default from "./data/load.js";
|
|
@@ -39,7 +39,7 @@ import type_default from "./internals/type.js";
|
|
|
39
39
|
import shape_default from "./shape/shape.js";
|
|
40
40
|
import { select } from "d3-selection";
|
|
41
41
|
import { timeFormat, timeParse, utcFormat, utcParse } from "d3-time-format";
|
|
42
|
-
|
|
42
|
+
// src/ChartInternal/ChartInternal.ts
|
|
43
43
|
/**
|
|
44
44
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
45
45
|
* billboard.js project is licensed under the MIT license
|
|
@@ -61,8 +61,12 @@ function getTime() {
|
|
|
61
61
|
*/
|
|
62
62
|
function getUnsupportedCanvasRenderType($$) {
|
|
63
63
|
if ($$.hasArcType()) return "arc charts";
|
|
64
|
-
if ($$.
|
|
65
|
-
|
|
64
|
+
if ($$.state.customType) {
|
|
65
|
+
const unsupported = $$.customTypeHooks?.canvasUnsupported;
|
|
66
|
+
if (unsupported) return unsupported;
|
|
67
|
+
if (!$$.getCustomTypeParts()?.canvas) return `${$$.state.customType} chart without its canvas module`;
|
|
68
|
+
}
|
|
69
|
+
return $$.getUnsupportedCanvasPart?.() ?? null;
|
|
66
70
|
}
|
|
67
71
|
/**
|
|
68
72
|
* Fall back to SVG when canvas mode is requested for unsupported chart types.
|
|
@@ -159,17 +163,25 @@ var ChartInternal = class {
|
|
|
159
163
|
$$.callPluginHook("$afterInit");
|
|
160
164
|
callFn($$.config.onafterinit, $$.api);
|
|
161
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* The hooks of the module of the custom type of the chart (see registerCustomType()).
|
|
168
|
+
* @private
|
|
169
|
+
*/
|
|
170
|
+
get customTypeHooks() {
|
|
171
|
+
const $$ = this;
|
|
172
|
+
return $$.state && $$.getCustomTypeParts()?.hooks;
|
|
173
|
+
}
|
|
162
174
|
init() {
|
|
163
175
|
const $$ = this;
|
|
164
176
|
const { config, state, $el } = $$;
|
|
165
177
|
const { boost_useCssRule, bindto } = config;
|
|
178
|
+
state.customType = $$.getCustomType();
|
|
166
179
|
checkModuleImport($$);
|
|
167
180
|
fallbackUnsupportedCanvasRenderMode($$);
|
|
168
181
|
const hasArcType = $$.hasArcType();
|
|
169
182
|
state.hasRadar = !state.hasAxis && $$.hasType("radar");
|
|
170
|
-
state.hasFunnel = !state.hasAxis && $$.hasType("funnel");
|
|
171
183
|
state.hasTreemap = !state.hasAxis && $$.hasType("treemap");
|
|
172
|
-
state.hasAxis = !hasArcType && !state.
|
|
184
|
+
state.hasAxis = !hasArcType && !state.customType && !state.hasTreemap;
|
|
173
185
|
state.datetimeId = `bb-${+/* @__PURE__ */ new Date() * getRandom()}`;
|
|
174
186
|
if (boost_useCssRule) {
|
|
175
187
|
const styleEl = doc.createElement("style");
|
|
@@ -235,7 +247,7 @@ var ChartInternal = class {
|
|
|
235
247
|
config.axis_y2_show = false;
|
|
236
248
|
config.subchart_show = false;
|
|
237
249
|
}
|
|
238
|
-
if (config.render_mode !== "canvas" && ($$.hasPointType() || $$.hasLegendDefsPoint?.())) $$.point =
|
|
250
|
+
if (config.render_mode !== "canvas" && ($$.hasPointType() || $$.hasLegendDefsPoint?.())) $$.point = getTypeMethod($$, "generatePoint").call($$);
|
|
239
251
|
if (state.hasAxis) {
|
|
240
252
|
$$.initClip();
|
|
241
253
|
format.extraLineClasses = $$.generateExtraLineClass();
|
|
@@ -261,7 +273,7 @@ var ChartInternal = class {
|
|
|
261
273
|
initWithData(data) {
|
|
262
274
|
const $$ = this;
|
|
263
275
|
const { config, scale, state, $el, org } = $$;
|
|
264
|
-
const {
|
|
276
|
+
const { customType, hasAxis, hasTreemap } = state;
|
|
265
277
|
const hasInteraction = config.interaction_enabled;
|
|
266
278
|
const hasPolar = $$.hasType("polar");
|
|
267
279
|
const labelsBGColor = config.data_labels_backgroundColors;
|
|
@@ -332,6 +344,7 @@ var ChartInternal = class {
|
|
|
332
344
|
"id",
|
|
333
345
|
"idXAxis",
|
|
334
346
|
"idYAxis",
|
|
347
|
+
"idY2Axis",
|
|
335
348
|
"idGrid"
|
|
336
349
|
].forEach((v) => {
|
|
337
350
|
$$.appendClip($el.defs, state.clip[v]);
|
|
@@ -341,7 +354,7 @@ var ChartInternal = class {
|
|
|
341
354
|
}
|
|
342
355
|
$$.updateSvgSize();
|
|
343
356
|
$$.bindResize();
|
|
344
|
-
const main = $el.svg.append("g").classed($COMMON.main, true).attr("transform",
|
|
357
|
+
const main = $el.svg.append("g").classed($COMMON.main, true).attr("transform", customType || hasTreemap ? null : $$.getTranslate("main"));
|
|
345
358
|
$el.main = main;
|
|
346
359
|
config.subchart_show && $$.initSubchart();
|
|
347
360
|
config.tooltip_show && $$.initTooltip();
|
|
@@ -393,7 +406,8 @@ var ChartInternal = class {
|
|
|
393
406
|
"bar",
|
|
394
407
|
"bubble",
|
|
395
408
|
"candlestick",
|
|
396
|
-
"line"
|
|
409
|
+
"line",
|
|
410
|
+
...$$.getAxisTypes()
|
|
397
411
|
];
|
|
398
412
|
if ($$.config.bar_front) shapes.push(shapes.shift());
|
|
399
413
|
for (const shape of shapes) {
|
|
@@ -401,7 +415,7 @@ var ChartInternal = class {
|
|
|
401
415
|
if (shape === "line" && $$.hasTypeOf(name) || $$.hasType(shape)) types.push(name);
|
|
402
416
|
}
|
|
403
417
|
} else if (hasTreemap) types.push("Treemap");
|
|
404
|
-
else if ($$.
|
|
418
|
+
else if ($$.state.customType) types.push(capitalize($$.state.customType));
|
|
405
419
|
else {
|
|
406
420
|
const hasPolar = $$.hasType("polar");
|
|
407
421
|
const hasGauge = $$.hasType("gauge");
|
|
@@ -410,7 +424,7 @@ var ChartInternal = class {
|
|
|
410
424
|
else if (hasRadar) types.push("Radar");
|
|
411
425
|
else if (hasPolar) types.push("Polar");
|
|
412
426
|
}
|
|
413
|
-
for (const type of types)
|
|
427
|
+
for (const type of types) getTypeMethod($$, `init${type}`).call($$);
|
|
414
428
|
if (notEmpty($$.config.data_labels) && !$$.hasArcType(null, ["radar"])) $$.initText();
|
|
415
429
|
}
|
|
416
430
|
/**
|
|
@@ -463,15 +477,17 @@ var ChartInternal = class {
|
|
|
463
477
|
*/
|
|
464
478
|
updateTargets(targets) {
|
|
465
479
|
const $$ = this;
|
|
466
|
-
const {
|
|
467
|
-
const helper = (type) =>
|
|
480
|
+
const { customType, hasAxis, hasRadar, hasTreemap } = $$.state;
|
|
481
|
+
const helper = (type) => getTypeMethod($$, `updateTargetsFor${type}`).call($$, targets.filter($$[`is${type}Type`].bind($$)));
|
|
468
482
|
$$.updateTargetsForText(targets);
|
|
469
483
|
if (hasAxis) {
|
|
470
|
-
|
|
484
|
+
const shapes = [
|
|
471
485
|
"bar",
|
|
472
486
|
"candlestick",
|
|
473
|
-
"line"
|
|
474
|
-
|
|
487
|
+
"line",
|
|
488
|
+
...$$.getAxisTypes()
|
|
489
|
+
];
|
|
490
|
+
for (const shape of shapes) {
|
|
475
491
|
const name = capitalize(shape);
|
|
476
492
|
if (shape === "line" && $$.hasTypeOf(name) || $$.hasType(shape)) helper(name);
|
|
477
493
|
}
|
|
@@ -481,7 +497,7 @@ var ChartInternal = class {
|
|
|
481
497
|
if (hasRadar) type = "Radar";
|
|
482
498
|
else if ($$.hasType("polar")) type = "Polar";
|
|
483
499
|
helper(type);
|
|
484
|
-
} else if (
|
|
500
|
+
} else if (customType) helper(capitalize(customType));
|
|
485
501
|
else if (hasTreemap) helper("Treemap");
|
|
486
502
|
const hasPointType = $$.hasType("bubble") || $$.hasType("scatter");
|
|
487
503
|
if (hasPointType) $$.updateTargetForCircle?.();
|
|
@@ -612,5 +628,4 @@ extend(ChartInternal.prototype, [
|
|
|
612
628
|
transform_default,
|
|
613
629
|
type_default
|
|
614
630
|
]);
|
|
615
|
-
//#endregion
|
|
616
631
|
export { ChartInternal 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 { csvParse, csvParseRows, tsvParse, tsvParseRows } from "../../module/dsv.js";
|
|
11
|
-
|
|
11
|
+
// src/ChartInternal/data/convert.helper.ts
|
|
12
12
|
/**
|
|
13
13
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
14
14
|
* billboard.js project is licensed under the MIT license
|
|
@@ -162,5 +162,4 @@ function tsv(tsv) {
|
|
|
162
162
|
parse: tsvParse
|
|
163
163
|
}, tsv);
|
|
164
164
|
}
|
|
165
|
-
//#endregion
|
|
166
165
|
export { columns, csv, json, rows, tsv, url };
|
|
@@ -5,13 +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 { isArray, isDefined, isEmpty, isObject, isUndefined, isValue, notEmpty } from "../../module/util/type-checks.js";
|
|
11
11
|
import { toSet } from "../../module/util/object.js";
|
|
12
12
|
import { runWorker } from "../../module/worker.js";
|
|
13
13
|
import { columns, json, rows, url } from "./convert.helper.js";
|
|
14
|
-
|
|
14
|
+
// src/ChartInternal/data/convert.ts
|
|
15
15
|
/**
|
|
16
16
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
17
17
|
* billboard.js project is licensed under the MIT license
|
|
@@ -198,7 +198,7 @@ var convert_default = {
|
|
|
198
198
|
});
|
|
199
199
|
targets.forEach((t) => {
|
|
200
200
|
if (config.data_xSort) t.values = t.values.sort((v1, v2) => {
|
|
201
|
-
return (v1.x || v1.x === 0 ? v1.x :
|
|
201
|
+
return (v1.x || v1.x === 0 ? v1.x : 1e400) - (v2.x || v2.x === 0 ? v2.x : 1e400);
|
|
202
202
|
});
|
|
203
203
|
t.values.forEach((v, i) => v.index = i);
|
|
204
204
|
$$.data.xs[t.id]?.sort((v1, v2) => v1 - v2);
|
|
@@ -213,5 +213,4 @@ var convert_default = {
|
|
|
213
213
|
return targets;
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
|
-
//#endregion
|
|
217
216
|
export { convert_default as default };
|
|
@@ -5,16 +5,16 @@
|
|
|
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 { $BAR, $CANDLESTICK, $COMMON } from "../../config/classes.js";
|
|
10
11
|
import { TYPE } from "../../config/const.js";
|
|
11
|
-
import {
|
|
12
|
+
import { KEY } from "../../module/Cache.js";
|
|
12
13
|
import { findIndex, getUnique, hasValue, mergeArray, parseDate, sortValue } from "../../module/util/object.js";
|
|
13
14
|
import { getScrollPosition, getTransformCTM, hasViewBox } from "../../module/util/dom.js";
|
|
14
|
-
import {
|
|
15
|
-
import { KEY } from "../../module/Cache.js";
|
|
15
|
+
import { isArray, isBoolean, isDefined, isFunction, isNumber, isObject, isObjectType, isString, isUndefined, isValue, notEmpty } from "../../module/util/type-checks.js";
|
|
16
16
|
import { select } from "d3-selection";
|
|
17
|
-
|
|
17
|
+
// src/ChartInternal/data/data.ts
|
|
18
18
|
/**
|
|
19
19
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
20
20
|
* billboard.js project is licensed under the MIT license
|
|
@@ -221,8 +221,8 @@ var data_default = {
|
|
|
221
221
|
*/
|
|
222
222
|
getMinMaxValue(data) {
|
|
223
223
|
const getBaseValue = this.getBaseValue.bind(this);
|
|
224
|
-
let min =
|
|
225
|
-
let max = -
|
|
224
|
+
let min = 1e400;
|
|
225
|
+
let max = -1e400;
|
|
226
226
|
const targets = data || this.data.targets.map((t) => t.values);
|
|
227
227
|
for (let i = 0; i < targets.length; i++) {
|
|
228
228
|
const v = targets[i];
|
|
@@ -517,8 +517,10 @@ var data_default = {
|
|
|
517
517
|
}
|
|
518
518
|
targets.forEach((t) => {
|
|
519
519
|
const data = [];
|
|
520
|
+
const axisDomain = $$.getAxisTypeHooks?.(t)?.domainValues;
|
|
520
521
|
t.values.filter(({ value }) => isValue(value) || value === null).forEach((v) => {
|
|
521
522
|
let { value } = v;
|
|
523
|
+
if (axisDomain) value = axisDomain($$, v);
|
|
522
524
|
if (value !== null && $$.isCandlestickType(v)) value = isArray(value) ? value.slice(0, 4) : [
|
|
523
525
|
value.open,
|
|
524
526
|
value.high,
|
|
@@ -570,7 +572,12 @@ var data_default = {
|
|
|
570
572
|
let fn;
|
|
571
573
|
if (orderAsc || orderDesc) {
|
|
572
574
|
const reducer = (p, c) => p + Math.abs(c.value);
|
|
573
|
-
const
|
|
575
|
+
const sums = /* @__PURE__ */ new WeakMap();
|
|
576
|
+
const sum = (v) => {
|
|
577
|
+
if (isNumber(v)) return v;
|
|
578
|
+
if (!sums.has(v)) sums.set(v, "values" in v ? v.values.reduce(reducer, 0) : v.value);
|
|
579
|
+
return sums.get(v);
|
|
580
|
+
};
|
|
574
581
|
fn = (t1, t2) => {
|
|
575
582
|
const t1Sum = sum(t1);
|
|
576
583
|
const t2Sum = sum(t2);
|
|
@@ -804,8 +811,9 @@ var data_default = {
|
|
|
804
811
|
if (!v || !isValue(v.value)) continue;
|
|
805
812
|
const isBar = $$.isBarType(v.id);
|
|
806
813
|
const isCandle = $$.isCandlestickType(v.id);
|
|
807
|
-
|
|
808
|
-
|
|
814
|
+
const axisHit = $$.getAxisTypeHooks(v.id)?.hit;
|
|
815
|
+
if (isBar || isCandle || axisHit) {
|
|
816
|
+
const selector = axisHit ? axisHit($$, v) : isBar ? `.${$BAR.chartBar}.${$COMMON.target}${$$.getTargetSelectorSuffix(v.id)} .${$BAR.bar}-${v.index}` : `.${$CANDLESTICK.chartCandlestick}.${$COMMON.target}${$$.getTargetSelectorSuffix(v.id)} .${$CANDLESTICK.candlestick}-${v.index} path`;
|
|
809
817
|
if (!closest && $$.isWithinBar(main.select(selector).node())) closest = v;
|
|
810
818
|
} else {
|
|
811
819
|
const d = $$.dist(v, pos);
|
|
@@ -1009,5 +1017,4 @@ var data_default = {
|
|
|
1009
1017
|
return d?.[0] ?? d;
|
|
1010
1018
|
}
|
|
1011
1019
|
};
|
|
1012
|
-
//#endregion
|
|
1013
1020
|
export { data_default as default };
|