billboard.js 4.1.5 → 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 +11000 -6970
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +19 -19
- package/dist/billboard.pkgd.js +22584 -14102
- 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 +2 -3
- 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 +3 -4
- 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 +9 -7
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +39 -11
- 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 +3 -4
- 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 +8 -8
- 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 +20 -20
- 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 +5 -6
- 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 +7 -7
- package/dist-esm/ChartInternal/shape/treemap.js +8 -5
- package/dist-esm/canvas/CanvasAxisRenderer.js +12 -315
- 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 +2 -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 +3 -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 +112 -911
- 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/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 +9 -2
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +42 -8
- 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/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 +3 -3
- package/src/ChartInternal/internals/size.ts +5 -3
- package/src/ChartInternal/internals/text.ts +24 -28
- package/src/ChartInternal/internals/tooltip.ts +35 -14
- 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/radar.ts +30 -1
- package/src/ChartInternal/shape/sankey.ts +242 -0
- package/src/ChartInternal/shape/shape.ts +1 -1
- package/src/ChartInternal/shape/treemap.ts +10 -0
- package/src/Plugin/stanford/index.ts +1 -28
- package/src/canvas/CanvasAxisRenderer.ts +35 -574
- 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/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 +1 -1
- package/src/config/classes.ts +0 -1
- package/src/config/const.ts +30 -21
- package/src/config/resolver/canvas.ts +126 -1290
- 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 +10 -1
- package/types/options.shape.d.ts +431 -0
- package/types/types.d.ts +4 -0
|
@@ -0,0 +1,144 @@
|
|
|
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, $FOCUS, $SHAPE } from "../../config/classes.js";
|
|
11
|
+
import heatmap_default$1, { $HEATMAP } from "./core/heatmap.js";
|
|
12
|
+
import { select } from "d3-selection";
|
|
13
|
+
// src/ChartInternal/shape/heatmap.ts
|
|
14
|
+
/**
|
|
15
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
16
|
+
* billboard.js project is licensed under the MIT license
|
|
17
|
+
*/
|
|
18
|
+
const ANCHOR = {
|
|
19
|
+
left: "start",
|
|
20
|
+
right: "end",
|
|
21
|
+
center: "middle"
|
|
22
|
+
};
|
|
23
|
+
const DY = {
|
|
24
|
+
middle: ".35em",
|
|
25
|
+
top: ".71em",
|
|
26
|
+
bottom: "0"
|
|
27
|
+
};
|
|
28
|
+
var heatmap_default = {
|
|
29
|
+
...heatmap_default$1,
|
|
30
|
+
/**
|
|
31
|
+
* Initialize heatmap
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
initHeatmap() {
|
|
35
|
+
const $$ = this;
|
|
36
|
+
const { $el } = $$;
|
|
37
|
+
$el.heatmap = $el.main.select(`.${$COMMON.chart}`).append("g").classed($HEATMAP.chartHeatmap, true);
|
|
38
|
+
$el.heatmap.append("defs");
|
|
39
|
+
$el.heatmap.append("g").classed($HEATMAP.heatmapRows, true);
|
|
40
|
+
$el.heatmap.append("g").classed($HEATMAP.heatmapNames, true);
|
|
41
|
+
$el.heatmap.append("g").classed($HEATMAP.heatmapColorbar, true);
|
|
42
|
+
$$.bindHeatmapEvent();
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Bind events
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
bindHeatmapEvent() {
|
|
49
|
+
const $$ = this;
|
|
50
|
+
const { $el: { heatmap }, config, state } = $$;
|
|
51
|
+
if (!config.interaction_enabled) return;
|
|
52
|
+
const getTarget = (event) => {
|
|
53
|
+
const target = event.target === heatmap.node() ? state.eventReceiver.rect?.node?.() : event.target;
|
|
54
|
+
if (target && /^rect$/i.test(target.tagName)) {
|
|
55
|
+
const datum = select(target).datum();
|
|
56
|
+
if (datum?.id !== void 0 && datum.value !== void 0 && datum.value !== null) {
|
|
57
|
+
state.event = event;
|
|
58
|
+
return $$.getHeatmapCellData(datum);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const isTouch = state.inputType === "touch";
|
|
63
|
+
heatmap.on(isTouch ? "touchstart" : "mouseover mousemove", (event) => {
|
|
64
|
+
const data = getTarget(event);
|
|
65
|
+
if (data) {
|
|
66
|
+
$$.showTooltip([data], $$.$el.svg.node());
|
|
67
|
+
/^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data, event.target);
|
|
68
|
+
}
|
|
69
|
+
}, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
70
|
+
const data = getTarget(event);
|
|
71
|
+
if (config.interaction_onout) {
|
|
72
|
+
$$.hideTooltip();
|
|
73
|
+
$$.setOverOut(false, data, event.target);
|
|
74
|
+
}
|
|
75
|
+
}).on("click", (event) => {
|
|
76
|
+
const data = getTarget(event);
|
|
77
|
+
data && config.data_onclick.bind($$.api)(data, event.target);
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Update targets for heatmap.
|
|
82
|
+
* The cells are made from all the series together, on redraw.
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
updateTargetsForHeatmap() {
|
|
86
|
+
const $$ = this;
|
|
87
|
+
!$$.$el.heatmap && $$.initHeatmap();
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* Draw a text of the axis or of the color bar
|
|
91
|
+
* @param {d3Selection} sel Text selection
|
|
92
|
+
* @param {boolean} withTransition Whether to transit
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
setHeatmapText(sel, withTransition) {
|
|
96
|
+
const $$ = this;
|
|
97
|
+
sel.each(function(d) {
|
|
98
|
+
select(this).attr("class", $HEATMAP.heatmapAxis).text(d.text).attr("dy", DY[d.baseline]).style("text-anchor", ANCHOR[d.align]);
|
|
99
|
+
});
|
|
100
|
+
$$.$T(sel, withTransition).attr("x", (d) => d.x).attr("y", (d) => d.y);
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Render heatmap
|
|
104
|
+
* @param {boolean} withTransition Whether to transit
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
redrawHeatmap(withTransition) {
|
|
108
|
+
const $$ = this;
|
|
109
|
+
const { $el: { heatmap }, config, state } = $$;
|
|
110
|
+
const { cells, rows, axisX, axisY, colorbar } = $$.getHeatmapLayout();
|
|
111
|
+
const radius = config.heatmap_cell_radius;
|
|
112
|
+
const borderWidth = config.heatmap_cell_border_width;
|
|
113
|
+
const byRow = new Map(rows.map((id) => [id, []]));
|
|
114
|
+
cells.forEach((d) => byRow.get(d.id)?.push(d));
|
|
115
|
+
const row = heatmap.select(`.${$HEATMAP.heatmapRows}`).selectAll(`.${$HEATMAP.heatmapRow}`).data(rows, (d) => d);
|
|
116
|
+
row.exit().remove();
|
|
117
|
+
row.enter().append("g").merge(row).attr("class", (id) => $HEATMAP.heatmapRow + $$.classTarget(id)).each(function(id) {
|
|
118
|
+
const g = select(this);
|
|
119
|
+
const rowCells = byRow.get(id);
|
|
120
|
+
const cell = g.selectAll(`.${$HEATMAP.heatmapCell}`).data(rowCells, (d) => d.index);
|
|
121
|
+
cell.exit().remove();
|
|
122
|
+
const cellMerge = cell.enter().append("rect").style("opacity", "0").merge(cell).attr("class", (d) => `${$SHAPE.shape} ${$SHAPE.shape}-${d.index} ${$HEATMAP.heatmapCell}`).style("fill", (d) => d.color).style("stroke", borderWidth ? config.heatmap_cell_border_color : null).style("stroke-width", borderWidth ? `${borderWidth}px` : null).attr("rx", radius || null);
|
|
123
|
+
$$.$T(cellMerge, withTransition).attr("x", (d) => d.x0).attr("y", (d) => d.y0).attr("width", (d) => Math.max(0, d.x1 - d.x0)).attr("height", (d) => Math.max(0, d.y1 - d.y0)).style("opacity", null);
|
|
124
|
+
const label = g.selectAll(`.${$HEATMAP.heatmapLabel}`).data(config.heatmap_label_show ? rowCells.filter((d) => d.value !== null) : [], (d) => d.index);
|
|
125
|
+
label.exit().remove();
|
|
126
|
+
label.enter().append("text").merge(label).attr("class", $HEATMAP.heatmapLabel).attr("x", (d) => (d.x0 + d.x1) / 2).attr("y", (d) => (d.y0 + d.y1) / 2).attr("dy", ".35em").style("text-anchor", "middle").style("fill", (d) => $$.getHeatmapLabelColor(d)).text((d) => $$.getHeatmapLabel(d));
|
|
127
|
+
});
|
|
128
|
+
const axis = heatmap.select(`.${$HEATMAP.heatmapNames}`).selectAll("text").data(axisX.concat(axisY), (d) => `${d.align}${d.text}`);
|
|
129
|
+
axis.exit().remove();
|
|
130
|
+
$$.setHeatmapText(axis.enter().append("text").merge(axis), withTransition);
|
|
131
|
+
const bar = heatmap.select(`.${$HEATMAP.heatmapColorbar}`);
|
|
132
|
+
const gradientId = `${state.datetimeId}-heatmap-colorbar`;
|
|
133
|
+
bar.selectAll("*").remove();
|
|
134
|
+
heatmap.select("defs").selectAll("*").remove();
|
|
135
|
+
if (colorbar) {
|
|
136
|
+
heatmap.select("defs").append("linearGradient").attr("id", gradientId).attr("x1", 0).attr("x2", colorbar.horizontal ? 1 : 0).attr("y1", 0).attr("y2", colorbar.horizontal ? 0 : 1).selectAll("stop").data(colorbar.stops).enter().append("stop").attr("offset", (d) => d[0]).attr("stop-color", (d) => d[1]);
|
|
137
|
+
bar.append("rect").attr("x", colorbar.x).attr("y", colorbar.y).attr("width", colorbar.width).attr("height", colorbar.height).style("fill", `url(#${gradientId})`);
|
|
138
|
+
$$.setHeatmapText(bar.selectAll("text").data(colorbar.labels).enter().append("text"));
|
|
139
|
+
}
|
|
140
|
+
$$.fitHeatmapHeight();
|
|
141
|
+
heatmap.selectAll(`.${$HEATMAP.heatmapRow}`).classed($FOCUS.defocused, (id) => $$.isHeatmapDefocused(id));
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
export { heatmap_default as default };
|
|
@@ -5,17 +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 { isArray, isUndefined, isValue } from "../../module/util/type-checks.js";
|
|
11
|
-
import { getRandom } from "../../module/util/object.js";
|
|
12
|
-
import { getPointer } from "../../module/util/dom.js";
|
|
13
10
|
import { $LINE } from "../../config/classes.js";
|
|
11
|
+
import { getPointer } from "../../module/util/dom.js";
|
|
12
|
+
import { getRandom } from "../../module/util/object.js";
|
|
13
|
+
import { isArray, isUndefined, isValue } from "../../module/util/type-checks.js";
|
|
14
14
|
import { getScale } from "../internals/scale.js";
|
|
15
|
-
import { initShapeElement, updateTargetsForShape } from "./shape.js";
|
|
16
|
-
import { generateDrawLinePath } from "./core/path.js";
|
|
17
15
|
import { getDataRegionStyle, normalizeDataRegions } from "./core/dataRegion.js";
|
|
18
|
-
|
|
16
|
+
import { generateDrawLinePath } from "./core/path.js";
|
|
17
|
+
import { initShapeElement, updateTargetsForShape } from "./shape.js";
|
|
18
|
+
// src/ChartInternal/shape/line.ts
|
|
19
19
|
/**
|
|
20
20
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
21
21
|
* billboard.js project is licensed under the MIT license
|
|
@@ -218,5 +218,4 @@ var line_default = {
|
|
|
218
218
|
return linePoint === true || isArray(linePoint) && linePoint.indexOf(d.id) !== -1;
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
|
-
//#endregion
|
|
222
221
|
export { line_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 { isObject, isUndefined, isValue } from "../../module/util/type-checks.js";
|
|
11
|
-
import { getRandom } from "../../module/util/object.js";
|
|
12
|
-
import { getBBox, getBoundingRect, getPointer } from "../../module/util/dom.js";
|
|
13
10
|
import { $CIRCLE, $COMMON, $SELECT } from "../../config/classes.js";
|
|
11
|
+
import { getBBox, getBoundingRect, getPointer } from "../../module/util/dom.js";
|
|
12
|
+
import { getRandom } from "../../module/util/object.js";
|
|
13
|
+
import { isObject, isUndefined, isValue } from "../../module/util/type-checks.js";
|
|
14
14
|
import { select } from "d3-selection";
|
|
15
|
-
|
|
15
|
+
// src/ChartInternal/shape/point.ts
|
|
16
16
|
/**
|
|
17
17
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
18
18
|
* billboard.js project is licensed under the MIT license
|
|
@@ -321,5 +321,4 @@ var point_default = {
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
};
|
|
324
|
-
//#endregion
|
|
325
324
|
export { point_default as default };
|
|
@@ -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
|
-
import { getRange } from "../../module/util/object.js";
|
|
11
10
|
import { $LEVEL } from "../../config/classes.js";
|
|
12
|
-
|
|
11
|
+
import { getRange } from "../../module/util/object.js";
|
|
12
|
+
// src/ChartInternal/shape/polar.ts
|
|
13
13
|
/**
|
|
14
14
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
15
15
|
* billboard.js project is licensed under the MIT license
|
|
@@ -93,5 +93,4 @@ var polar_default = {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
//#endregion
|
|
97
96
|
export { polar_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 { isDefined, isEmpty, isNumber, isUndefined } from "../../module/util/type-checks.js";
|
|
11
|
-
import { getMinMax, getRange, toArray } from "../../module/util/object.js";
|
|
12
|
-
import { getBoundingRect, getPathBox, setTextValue } from "../../module/util/dom.js";
|
|
13
10
|
import { $AXIS, $COMMON, $LEVEL, $RADAR, $SHAPE, $TEXT } from "../../config/classes.js";
|
|
14
11
|
import { KEY } from "../../module/Cache.js";
|
|
12
|
+
import { getBoundingRect, getPathBox, setTextValue } from "../../module/util/dom.js";
|
|
13
|
+
import { getMinMax, getRange, toArray } from "../../module/util/object.js";
|
|
14
|
+
import { isDefined, isEmpty, isNumber, isUndefined } from "../../module/util/type-checks.js";
|
|
15
15
|
import { select } from "d3-selection";
|
|
16
|
-
|
|
16
|
+
// src/ChartInternal/shape/radar.ts
|
|
17
17
|
/**
|
|
18
18
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
19
19
|
* billboard.js project is licensed under the MIT license
|
|
@@ -45,6 +45,11 @@ var radar_default = {
|
|
|
45
45
|
$el.radar.axes = $el.radar.append("g").attr("class", $AXIS.axis);
|
|
46
46
|
$el.radar.shapes = $el.radar.append("g").attr("class", $SHAPE.shapes);
|
|
47
47
|
current.dataMax = config.radar_axis_max || $$.getMinMaxData().max[0].value;
|
|
48
|
+
config.interaction_enabled && $el.radar.shapes.on("click", (event) => {
|
|
49
|
+
const { target } = event;
|
|
50
|
+
const data = /^circle$/i.test(target.tagName) ? select(target).datum() : null;
|
|
51
|
+
data?.id && config.data_onclick.bind($$.api)(data, target);
|
|
52
|
+
});
|
|
48
53
|
if (config.radar_axis_text_show) {
|
|
49
54
|
config.interaction_enabled && $$.bindRadarEvent();
|
|
50
55
|
$$.updateRadarLevel();
|
|
@@ -206,7 +211,15 @@ var radar_default = {
|
|
|
206
211
|
const index = $$.getDataIndexFromEvent(event);
|
|
207
212
|
$$.selectRectForSingle(svg.node(), index);
|
|
208
213
|
isMouse ? $$.setOverOut(true, index) : $$.callOverOutForTouch(index);
|
|
209
|
-
}, isMouse ? void 0 : { passive: true }).on("mouseout", isMouse ? hide : null)
|
|
214
|
+
}, isMouse ? void 0 : { passive: true }).on("mouseout", isMouse ? hide : null).on("click", (event) => {
|
|
215
|
+
const index = $$.getDataIndexFromEvent(event);
|
|
216
|
+
if (isUndefined(index)) return;
|
|
217
|
+
const target = /tspan/i.test(event.target.tagName) ? event.target.parentNode : event.target;
|
|
218
|
+
$$.filterTargetsToShow($$.data.targets).forEach((t) => {
|
|
219
|
+
const data = $$.getValueOnIndex(t.values, index);
|
|
220
|
+
data && config.data_onclick.bind($$.api)(data, target);
|
|
221
|
+
});
|
|
222
|
+
});
|
|
210
223
|
if (!isMouse) svg.on("touchstart", hide, { passive: true });
|
|
211
224
|
},
|
|
212
225
|
updateRadarShape() {
|
|
@@ -238,5 +251,4 @@ var radar_default = {
|
|
|
238
251
|
return this.cache.get(cacheKeyPoints)[d.id][d.index][1];
|
|
239
252
|
}
|
|
240
253
|
};
|
|
241
|
-
//#endregion
|
|
242
254
|
export { radar_default as default };
|
|
@@ -0,0 +1,154 @@
|
|
|
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, $FOCUS, $SHAPE } from "../../config/classes.js";
|
|
11
|
+
import sankey_default$1, { $SANKEY } from "./core/sankey.js";
|
|
12
|
+
import { select } from "d3-selection";
|
|
13
|
+
// src/ChartInternal/shape/sankey.ts
|
|
14
|
+
/**
|
|
15
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
16
|
+
* billboard.js project is licensed under the MIT license
|
|
17
|
+
*/
|
|
18
|
+
var sankey_default = {
|
|
19
|
+
...sankey_default$1,
|
|
20
|
+
/**
|
|
21
|
+
* Initialize sankey
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
initSankey() {
|
|
25
|
+
const $$ = this;
|
|
26
|
+
const { $el } = $$;
|
|
27
|
+
$el.sankey = $el.main.select(`.${$COMMON.chart}`).append("g").classed($SANKEY.chartSankey, true);
|
|
28
|
+
$el.sankey.append("defs");
|
|
29
|
+
$el.sankey.append("g").classed($SANKEY.sankeyLinks, true);
|
|
30
|
+
$el.sankey.append("g").classed($SANKEY.sankeyNodes, true);
|
|
31
|
+
$$.bindSankeyEvent();
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* Bind events
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
bindSankeyEvent() {
|
|
38
|
+
const $$ = this;
|
|
39
|
+
const { $el: { sankey }, config, state } = $$;
|
|
40
|
+
if (!config.interaction_enabled) return;
|
|
41
|
+
const getTarget = (event) => {
|
|
42
|
+
const target = event.target === sankey.node() ? state.eventReceiver.rect?.node?.() : event.target;
|
|
43
|
+
if (target && /^(rect|path)$/i.test(target.tagName)) {
|
|
44
|
+
const datum = select(target).datum();
|
|
45
|
+
if (datum?.sourceLinks) {
|
|
46
|
+
state.event = event;
|
|
47
|
+
return $$.getSankeyNodeData(datum);
|
|
48
|
+
} else if (datum?.source) {
|
|
49
|
+
state.event = event;
|
|
50
|
+
return $$.getSankeyLinkData(datum);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const isTouch = state.inputType === "touch";
|
|
55
|
+
sankey.on(isTouch ? "touchstart" : "mouseover mousemove", (event) => {
|
|
56
|
+
const data = getTarget(event);
|
|
57
|
+
if (data) {
|
|
58
|
+
$$.showTooltip([data], $$.$el.svg.node());
|
|
59
|
+
/^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data, event.target);
|
|
60
|
+
}
|
|
61
|
+
}, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
62
|
+
const data = getTarget(event);
|
|
63
|
+
if (config.interaction_onout) {
|
|
64
|
+
$$.hideTooltip();
|
|
65
|
+
$$.setOverOut(false, data, event.target);
|
|
66
|
+
}
|
|
67
|
+
}).on("click", (event) => {
|
|
68
|
+
const data = getTarget(event);
|
|
69
|
+
data && config.data_onclick.bind($$.api)(data, event.target);
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
/**
|
|
73
|
+
* Update targets for sankey.
|
|
74
|
+
* The nodes and the links are made from all the series together, on redraw.
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
updateTargetsForSankey() {
|
|
78
|
+
const $$ = this;
|
|
79
|
+
!$$.$el.sankey && $$.initSankey();
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* Set the defocused class of the links and the nodes, from the focus state.
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
updateSankeyFocus() {
|
|
86
|
+
const $$ = this;
|
|
87
|
+
const isDefocused = (d) => $$.isSankeyDefocused(d);
|
|
88
|
+
$$.$el.sankey?.selectAll(`.${$SANKEY.sankeyLink}, .${$SANKEY.sankeyNode}`).classed($FOCUS.defocused, isDefocused);
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* Render sankey
|
|
92
|
+
* @param {boolean} withTransition Whether to transit
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
redrawSankey(withTransition) {
|
|
96
|
+
const $$ = this;
|
|
97
|
+
const { $el: { sankey }, config, state } = $$;
|
|
98
|
+
const { nodes, links } = $$.getSankeyLayout();
|
|
99
|
+
const rotated = config.sankey_rotated;
|
|
100
|
+
const borderWidth = config.sankey_node_border_width;
|
|
101
|
+
const linkKey = (d) => `${d.source.id}\u0000${d.target.id}\u0000${d.index}`;
|
|
102
|
+
const nodeKey = (d) => d.id;
|
|
103
|
+
const gradientId = (d) => `${state.datetimeId}-sankey-link-${d.index}`;
|
|
104
|
+
sankey.style("--bb-sankey-link-opacity", config.sankey_link_opacity ?? null);
|
|
105
|
+
const link = sankey.select(`.${$SANKEY.sankeyLinks}`).selectAll(`.${$SANKEY.sankeyLink}`).data(links, linkKey);
|
|
106
|
+
link.exit().remove();
|
|
107
|
+
const linkMerge = link.enter().append("path").style("opacity", "0").merge(link).attr("class", (d) => $$.generateClass($SANKEY.sankeyLink, d.source.id)).style("stroke", (d) => {
|
|
108
|
+
const [start, end] = $$.getSankeyLinkColors(d);
|
|
109
|
+
return start === end ? start : `url(#${gradientId(d)})`;
|
|
110
|
+
});
|
|
111
|
+
const gradient = sankey.select("defs").selectAll("linearGradient").data(links.filter((d) => {
|
|
112
|
+
const [start, end] = $$.getSankeyLinkColors(d);
|
|
113
|
+
return start !== end;
|
|
114
|
+
}));
|
|
115
|
+
gradient.exit().remove();
|
|
116
|
+
gradient.enter().append("linearGradient").attr("gradientUnits", "userSpaceOnUse").call((g) => {
|
|
117
|
+
g.append("stop").attr("offset", "0");
|
|
118
|
+
g.append("stop").attr("offset", "1");
|
|
119
|
+
}).merge(gradient).attr("id", (d) => gradientId(d)).each(function(d) {
|
|
120
|
+
const [[start], , , [end]] = $$.getSankeyLinkPoints(d, true);
|
|
121
|
+
const [along, across] = rotated ? ["y", "x"] : ["x", "y"];
|
|
122
|
+
const colors = $$.getSankeyLinkColors(d);
|
|
123
|
+
select(this).attr(`${along}1`, start).attr(`${along}2`, end).attr(`${across}1`, 0).attr(`${across}2`, 0).selectAll("stop").attr("stop-color", (_, j) => colors[j]);
|
|
124
|
+
});
|
|
125
|
+
$$.$T(linkMerge, withTransition).attr("d", (d) => $$.getSankeyLinkPath(d)).style("stroke-width", (d) => `${Math.max(1, d.width)}px`).style("opacity", null);
|
|
126
|
+
const node = sankey.select(`.${$SANKEY.sankeyNodes}`).selectAll(`.${$SANKEY.sankeyNode}`).data(nodes, nodeKey);
|
|
127
|
+
node.exit().remove();
|
|
128
|
+
const nodeEnter = node.enter().append("g");
|
|
129
|
+
nodeEnter.append("rect").attr("class", $SHAPE.shape);
|
|
130
|
+
nodeEnter.append("text").attr("class", $SANKEY.sankeyLabel);
|
|
131
|
+
const nodeMerge = nodeEnter.merge(node).attr("class", (d) => $SANKEY.sankeyNode + $$.classTarget(d.id));
|
|
132
|
+
nodeMerge.select("rect").datum((d) => d).style("fill", (d) => d.color).style("stroke", borderWidth ? config.sankey_node_border_color : null).style("stroke-width", borderWidth ? `${borderWidth}px` : null).call((sel) => {
|
|
133
|
+
$$.$T(sel, withTransition).attr("x", (d) => d.x0).attr("y", (d) => d.y0).attr("width", (d) => Math.max(1, d.x1 - d.x0)).attr("height", (d) => Math.max(1, d.y1 - d.y0));
|
|
134
|
+
});
|
|
135
|
+
nodeMerge.select("text").datum((d) => d).each(function(d) {
|
|
136
|
+
const label = $$.getSankeyLabel(d);
|
|
137
|
+
const text = select(this);
|
|
138
|
+
if (label) {
|
|
139
|
+
text.text(label.text).attr("dy", {
|
|
140
|
+
middle: ".35em",
|
|
141
|
+
top: ".71em",
|
|
142
|
+
bottom: "0"
|
|
143
|
+
}[label.baseline]).style("text-anchor", {
|
|
144
|
+
left: "start",
|
|
145
|
+
right: "end",
|
|
146
|
+
center: "middle"
|
|
147
|
+
}[label.align]);
|
|
148
|
+
$$.$T(text, withTransition).attr("x", label.x).attr("y", label.y);
|
|
149
|
+
} else text.text(null);
|
|
150
|
+
});
|
|
151
|
+
$$.updateSankeyFocus();
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
export { sankey_default as default };
|
|
@@ -5,17 +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 classes_default from "../../config/classes.js";
|
|
10
11
|
import { TYPE } from "../../config/const.js";
|
|
11
|
-
import {
|
|
12
|
+
import { KEY } from "../../module/Cache.js";
|
|
12
13
|
import { capitalize, getUnique, parseDate } from "../../module/util/object.js";
|
|
13
14
|
import { getPointer, getRectSegList } from "../../module/util/dom.js";
|
|
14
|
-
import
|
|
15
|
-
import { KEY } from "../../module/Cache.js";
|
|
15
|
+
import { isFunction, isNumber, isObjectType, isUndefined, isValue, notEmpty } from "../../module/util/type-checks.js";
|
|
16
16
|
import { select } from "d3-selection";
|
|
17
17
|
import { curveBasis, curveBasisClosed, curveBasisOpen, curveBundle, curveCardinal, curveCardinalClosed, curveCardinalOpen, curveCatmullRom, curveCatmullRomClosed, curveCatmullRomOpen, curveLinear, curveLinearClosed, curveMonotoneX, curveMonotoneY, curveNatural, curveStep, curveStepAfter, curveStepBefore } from "d3-shape";
|
|
18
|
-
|
|
18
|
+
// src/ChartInternal/shape/shape.ts
|
|
19
19
|
/**
|
|
20
20
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
21
21
|
* billboard.js project is licensed under the MIT license
|
|
@@ -194,7 +194,8 @@ var shape_default = {
|
|
|
194
194
|
"bar",
|
|
195
195
|
"candlestick",
|
|
196
196
|
"line",
|
|
197
|
-
"area"
|
|
197
|
+
"area",
|
|
198
|
+
...$$.getAxisTypes()
|
|
198
199
|
].forEach((v) => {
|
|
199
200
|
const name = capitalize(v);
|
|
200
201
|
if ($$.hasType(v) || $$.hasTypeOf(name) || v === "line" && ($$.hasType("bubble") || $$.hasType("scatter"))) {
|
|
@@ -815,5 +816,4 @@ var shape_default = {
|
|
|
815
816
|
return sx < mouse[0] && mouse[0] < ex && ey < mouse[1] && mouse[1] < sy;
|
|
816
817
|
}
|
|
817
818
|
};
|
|
818
|
-
//#endregion
|
|
819
819
|
export { shape_default as default, getShapeColorWithGradient, initShapeElement, updateTargetsForShape };
|
|
@@ -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 { isFunction } from "../../module/util/type-checks.js";
|
|
11
|
-
import { getRandom } from "../../module/util/object.js";
|
|
12
10
|
import { $COMMON, $TREEMAP } from "../../config/classes.js";
|
|
11
|
+
import { getRandom } from "../../module/util/object.js";
|
|
12
|
+
import { isFunction } from "../../module/util/type-checks.js";
|
|
13
13
|
import { meetsLabelThreshold } from "../internals/text.util.js";
|
|
14
14
|
import { getTreemapNodeRect } from "./core/geometry.js";
|
|
15
15
|
import treemap_default$1 from "./core/treemap.js";
|
|
16
16
|
import { select } from "d3-selection";
|
|
17
|
-
|
|
17
|
+
// src/ChartInternal/shape/treemap.ts
|
|
18
18
|
/**
|
|
19
19
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
20
20
|
* billboard.js project is licensed under the MIT license
|
|
@@ -73,6 +73,10 @@ var treemap_default = {
|
|
|
73
73
|
$$.hideTooltip();
|
|
74
74
|
$$.setOverOut(false, data);
|
|
75
75
|
}
|
|
76
|
+
}).on("click", (event) => {
|
|
77
|
+
const { target } = event;
|
|
78
|
+
const data = /^rect$/i.test(target.tagName) ? select(target).datum()?.data : null;
|
|
79
|
+
data && config.data_onclick.bind($$.api)(data, target);
|
|
76
80
|
});
|
|
77
81
|
}
|
|
78
82
|
},
|
|
@@ -161,5 +165,4 @@ var treemap_default = {
|
|
|
161
165
|
};
|
|
162
166
|
}
|
|
163
167
|
};
|
|
164
|
-
//#endregion
|
|
165
168
|
export { treemap_default as default };
|