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
|
@@ -17,7 +17,7 @@ import Options from "../config/Options/Options";
|
|
|
17
17
|
import Store from "../config/Store/Store";
|
|
18
18
|
import {document, window} from "../module/browser";
|
|
19
19
|
import Cache from "../module/Cache";
|
|
20
|
-
import {checkModuleImport} from "../module/error";
|
|
20
|
+
import {checkModuleImport, getTypeMethod} from "../module/error";
|
|
21
21
|
import {generateResize} from "../module/generator";
|
|
22
22
|
import {
|
|
23
23
|
callFn,
|
|
@@ -81,11 +81,23 @@ function getUnsupportedCanvasRenderType($$): string | null {
|
|
|
81
81
|
return "arc charts";
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
if ($$.
|
|
85
|
-
|
|
84
|
+
if ($$.state.customType) {
|
|
85
|
+
// the type tells it by itself when it is drawn by svg only
|
|
86
|
+
const unsupported = $$.customTypeHooks?.canvasUnsupported;
|
|
87
|
+
|
|
88
|
+
if (unsupported) {
|
|
89
|
+
return unsupported;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// otherwise it is drawn on canvas by the canvas part of its module:
|
|
93
|
+
// there is nothing to draw it when only the svg part was imported
|
|
94
|
+
if (!$$.getCustomTypeParts()?.canvas) {
|
|
95
|
+
return `${$$.state.customType} chart without its canvas module`;
|
|
96
|
+
}
|
|
86
97
|
}
|
|
87
98
|
|
|
88
|
-
|
|
99
|
+
// the types drawn by canvas parts, which only the canvas module knows
|
|
100
|
+
return $$.getUnsupportedCanvasPart?.() ?? null;
|
|
89
101
|
}
|
|
90
102
|
|
|
91
103
|
/**
|
|
@@ -238,19 +250,33 @@ export default class ChartInternal {
|
|
|
238
250
|
callFn($$.config.onafterinit, $$.api);
|
|
239
251
|
}
|
|
240
252
|
|
|
253
|
+
/**
|
|
254
|
+
* The hooks of the module of the custom type of the chart (see registerCustomType()).
|
|
255
|
+
* @private
|
|
256
|
+
*/
|
|
257
|
+
get customTypeHooks() {
|
|
258
|
+
const $$ = <any>this;
|
|
259
|
+
|
|
260
|
+
// (reading it from the prototype, which has no state, is not an error)
|
|
261
|
+
return $$.state && $$.getCustomTypeParts()?.hooks;
|
|
262
|
+
}
|
|
263
|
+
|
|
241
264
|
init(): void {
|
|
242
265
|
const $$ = <any>this;
|
|
243
266
|
const {config, state, $el} = $$;
|
|
244
267
|
const {boost_useCssRule, bindto} = config;
|
|
245
268
|
|
|
269
|
+
// set by the module of a type that is neither axis based nor built in:
|
|
270
|
+
// the import check needs it to tell a type whose module is there
|
|
271
|
+
state.customType = $$.getCustomType();
|
|
272
|
+
|
|
246
273
|
checkModuleImport($$);
|
|
247
274
|
fallbackUnsupportedCanvasRenderMode($$);
|
|
248
275
|
|
|
249
276
|
const hasArcType = $$.hasArcType();
|
|
250
277
|
state.hasRadar = !state.hasAxis && $$.hasType("radar");
|
|
251
|
-
state.hasFunnel = !state.hasAxis && $$.hasType("funnel");
|
|
252
278
|
state.hasTreemap = !state.hasAxis && $$.hasType("treemap");
|
|
253
|
-
state.hasAxis = !hasArcType && !state.
|
|
279
|
+
state.hasAxis = !hasArcType && !state.customType && !state.hasTreemap;
|
|
254
280
|
|
|
255
281
|
// datetime to be used for uniqueness
|
|
256
282
|
state.datetimeId = `bb-${+new Date() * (getRandom() as number)}`;
|
|
@@ -354,7 +380,7 @@ export default class ChartInternal {
|
|
|
354
380
|
}
|
|
355
381
|
|
|
356
382
|
if (config.render_mode !== "canvas" && ($$.hasPointType() || $$.hasLegendDefsPoint?.())) {
|
|
357
|
-
$$.point =
|
|
383
|
+
$$.point = getTypeMethod($$, "generatePoint").call($$);
|
|
358
384
|
}
|
|
359
385
|
|
|
360
386
|
if (state.hasAxis) {
|
|
@@ -405,7 +431,7 @@ export default class ChartInternal {
|
|
|
405
431
|
initWithData(data): void {
|
|
406
432
|
const $$ = <any>this;
|
|
407
433
|
const {config, scale, state, $el, org} = $$;
|
|
408
|
-
const {
|
|
434
|
+
const {customType, hasAxis, hasTreemap} = state;
|
|
409
435
|
const hasInteraction = config.interaction_enabled;
|
|
410
436
|
const hasPolar = $$.hasType("polar");
|
|
411
437
|
const labelsBGColor = config.data_labels_backgroundColors;
|
|
@@ -542,7 +568,7 @@ export default class ChartInternal {
|
|
|
542
568
|
$el.defs = $el.svg.append("defs");
|
|
543
569
|
|
|
544
570
|
if (hasAxis) {
|
|
545
|
-
["id", "idXAxis", "idYAxis", "idGrid"].forEach(v => {
|
|
571
|
+
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(v => {
|
|
546
572
|
$$.appendClip($el.defs, state.clip[v]);
|
|
547
573
|
});
|
|
548
574
|
}
|
|
@@ -564,7 +590,7 @@ export default class ChartInternal {
|
|
|
564
590
|
// Define regions
|
|
565
591
|
const main = $el.svg.append("g")
|
|
566
592
|
.classed($COMMON.main, true)
|
|
567
|
-
.attr("transform",
|
|
593
|
+
.attr("transform", customType || hasTreemap ? null : $$.getTranslate("main"));
|
|
568
594
|
|
|
569
595
|
$el.main = main;
|
|
570
596
|
|
|
@@ -657,7 +683,7 @@ export default class ChartInternal {
|
|
|
657
683
|
const types: string[] = [];
|
|
658
684
|
|
|
659
685
|
if (hasAxis) {
|
|
660
|
-
const shapes = ["bar", "bubble", "candlestick", "line"];
|
|
686
|
+
const shapes = ["bar", "bubble", "candlestick", "line", ...$$.getAxisTypes()];
|
|
661
687
|
|
|
662
688
|
if ($$.config.bar_front) {
|
|
663
689
|
shapes.push(shapes.shift() as string);
|
|
@@ -671,8 +697,8 @@ export default class ChartInternal {
|
|
|
671
697
|
}
|
|
672
698
|
} else if (hasTreemap) {
|
|
673
699
|
types.push("Treemap");
|
|
674
|
-
} else if ($$.
|
|
675
|
-
types.push(
|
|
700
|
+
} else if ($$.state.customType) {
|
|
701
|
+
types.push(capitalize($$.state.customType));
|
|
676
702
|
} else {
|
|
677
703
|
const hasPolar = $$.hasType("polar");
|
|
678
704
|
const hasGauge = $$.hasType("gauge");
|
|
@@ -691,7 +717,7 @@ export default class ChartInternal {
|
|
|
691
717
|
}
|
|
692
718
|
|
|
693
719
|
for (const type of types) {
|
|
694
|
-
|
|
720
|
+
getTypeMethod($$, `init${type}`).call($$);
|
|
695
721
|
}
|
|
696
722
|
|
|
697
723
|
if (notEmpty($$.config.data_labels) && !$$.hasArcType(null, ["radar"])) {
|
|
@@ -784,9 +810,10 @@ export default class ChartInternal {
|
|
|
784
810
|
*/
|
|
785
811
|
updateTargets(targets): void {
|
|
786
812
|
const $$ = <any>this;
|
|
787
|
-
const {
|
|
813
|
+
const {customType, hasAxis, hasRadar, hasTreemap} = $$.state;
|
|
788
814
|
const helper = type =>
|
|
789
|
-
|
|
815
|
+
getTypeMethod($$, `updateTargetsFor${type}`).call(
|
|
816
|
+
$$,
|
|
790
817
|
targets.filter($$[`is${type}Type`].bind($$))
|
|
791
818
|
);
|
|
792
819
|
|
|
@@ -794,7 +821,7 @@ export default class ChartInternal {
|
|
|
794
821
|
$$.updateTargetsForText(targets);
|
|
795
822
|
|
|
796
823
|
if (hasAxis) {
|
|
797
|
-
const shapes = ["bar", "candlestick", "line"];
|
|
824
|
+
const shapes = ["bar", "candlestick", "line", ...$$.getAxisTypes()];
|
|
798
825
|
for (const shape of shapes) {
|
|
799
826
|
const name = capitalize(shape);
|
|
800
827
|
if ((shape === "line" && $$.hasTypeOf(name)) || $$.hasType(shape)) {
|
|
@@ -816,8 +843,8 @@ export default class ChartInternal {
|
|
|
816
843
|
}
|
|
817
844
|
|
|
818
845
|
helper(type);
|
|
819
|
-
} else if (
|
|
820
|
-
helper(
|
|
846
|
+
} else if (customType) {
|
|
847
|
+
helper(capitalize(customType));
|
|
821
848
|
} else if (hasTreemap) {
|
|
822
849
|
helper("Treemap");
|
|
823
850
|
}
|
|
@@ -15,6 +15,19 @@ export interface IFunnelData {
|
|
|
15
15
|
coords?: number[][];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
export interface IBulletData {
|
|
19
|
+
id: string;
|
|
20
|
+
index: number;
|
|
21
|
+
x: number; // for compatibility
|
|
22
|
+
name: string;
|
|
23
|
+
value: number;
|
|
24
|
+
title: string; // empty when bullet.title.show is not set
|
|
25
|
+
ranges: number[];
|
|
26
|
+
targets: number[];
|
|
27
|
+
domainMin: number; // 0 or less, unless bullet.axis.min is given
|
|
28
|
+
domainMax: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
18
31
|
export interface ITreemapData {
|
|
19
32
|
name: string;
|
|
20
33
|
id?: string; // for compatibility
|
|
@@ -763,12 +763,18 @@ export default {
|
|
|
763
763
|
|
|
764
764
|
targets.forEach(t => {
|
|
765
765
|
const data: any[] = [];
|
|
766
|
+
// a type of its own module that has the values of a row to cover by itself
|
|
767
|
+
const axisDomain = $$.getAxisTypeHooks?.(t)?.domainValues;
|
|
766
768
|
|
|
767
769
|
t.values
|
|
768
770
|
.filter(({value}) => isValue(value) || value === null)
|
|
769
771
|
.forEach(v => {
|
|
770
772
|
let {value} = v;
|
|
771
773
|
|
|
774
|
+
if (axisDomain) {
|
|
775
|
+
value = axisDomain($$, v);
|
|
776
|
+
}
|
|
777
|
+
|
|
772
778
|
// exclude 'volume' value to correct mis domain calculation
|
|
773
779
|
if (value !== null && $$.isCandlestickType(v)) {
|
|
774
780
|
value = isArray(value) ?
|
|
@@ -840,9 +846,20 @@ export default {
|
|
|
840
846
|
|
|
841
847
|
if (orderAsc || orderDesc) {
|
|
842
848
|
const reducer = (p, c) => p + Math.abs(c.value);
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
)
|
|
849
|
+
// sort calls the compare function O(n log n) times, so sum once per target
|
|
850
|
+
// (the cache lives as long as this compare function)
|
|
851
|
+
const sums = new WeakMap();
|
|
852
|
+
const sum = v => {
|
|
853
|
+
if (isNumber(v)) {
|
|
854
|
+
return v;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
if (!sums.has(v)) {
|
|
858
|
+
sums.set(v, "values" in v ? v.values.reduce(reducer, 0) : v.value);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
return sums.get(v);
|
|
862
|
+
};
|
|
846
863
|
|
|
847
864
|
fn = (t1: IData | IDataRow, t2: IData | IDataRow) => {
|
|
848
865
|
const t1Sum = sum(t1);
|
|
@@ -1217,9 +1234,13 @@ export default {
|
|
|
1217
1234
|
|
|
1218
1235
|
const isBar = $$.isBarType(v.id);
|
|
1219
1236
|
const isCandle = $$.isCandlestickType(v.id);
|
|
1237
|
+
// the selector of the shape of a type of its own module drawn on the axes
|
|
1238
|
+
const axisHit = $$.getAxisTypeHooks(v.id)?.hit;
|
|
1220
1239
|
|
|
1221
|
-
if (isBar || isCandle) {
|
|
1222
|
-
const selector =
|
|
1240
|
+
if (isBar || isCandle || axisHit) {
|
|
1241
|
+
const selector = axisHit ?
|
|
1242
|
+
axisHit($$, v) :
|
|
1243
|
+
isBar ?
|
|
1223
1244
|
`.${$BAR.chartBar}.${$COMMON.target}${
|
|
1224
1245
|
$$.getTargetSelectorSuffix(v.id)
|
|
1225
1246
|
} .${$BAR.bar}-${v.index}` :
|
|
@@ -227,8 +227,8 @@ export default {
|
|
|
227
227
|
// Remove targets
|
|
228
228
|
$$.data.targets = $$.data.targets.filter(t => !unloadIds.has(t.id));
|
|
229
229
|
|
|
230
|
-
//
|
|
231
|
-
|
|
230
|
+
// a type of its own module can need its data to be transformed
|
|
231
|
+
$$.customTypeHooks?.afterUnload?.($$);
|
|
232
232
|
|
|
233
233
|
// since treemap uses different data types, it needs to be transformed
|
|
234
234
|
state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
|
|
@@ -15,9 +15,14 @@ export default {
|
|
|
15
15
|
*/
|
|
16
16
|
generateFlow(args): Function {
|
|
17
17
|
const $$ = this;
|
|
18
|
-
const {data, state, $el} = $$;
|
|
18
|
+
const {config, data, state, $el} = $$;
|
|
19
19
|
|
|
20
20
|
return function() {
|
|
21
|
+
// destroy() empties the instance while the redraw transition is waited on
|
|
22
|
+
if (!$$.$el) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
const flowLength = args.flow.length;
|
|
22
27
|
|
|
23
28
|
// set flag
|
|
@@ -63,7 +68,18 @@ export default {
|
|
|
63
68
|
}
|
|
64
69
|
});
|
|
65
70
|
|
|
66
|
-
|
|
71
|
+
// the focus slides with its data and the flow end moves it to the data under the pointer
|
|
72
|
+
if (config.axis_rotated) {
|
|
73
|
+
$$.hideGridFocus?.();
|
|
74
|
+
} else {
|
|
75
|
+
const xFocus = $el.main.selectAll(
|
|
76
|
+
`line.${CLASS.xgridFocus}:not(.${CLASS.xgridFocusContinuous})`
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
xFocus.size() && (elements["gridFocus.x"] = xFocus);
|
|
80
|
+
$el.main.selectAll(`line.${CLASS.ygridFocus}`).style("visibility", "hidden");
|
|
81
|
+
}
|
|
82
|
+
|
|
67
83
|
$$.setFlowList(elements, args);
|
|
68
84
|
};
|
|
69
85
|
},
|
|
@@ -79,12 +95,10 @@ export default {
|
|
|
79
95
|
const {flow, targets} = args;
|
|
80
96
|
const {
|
|
81
97
|
duration = args.duration,
|
|
82
|
-
index: flowIndex,
|
|
83
|
-
length: flowLength,
|
|
84
98
|
orgDataCount
|
|
85
99
|
} = flow;
|
|
86
100
|
|
|
87
|
-
const transform = $$.getFlowTransform(targets, orgDataCount
|
|
101
|
+
const transform = $$.getFlowTransform(targets, orgDataCount);
|
|
88
102
|
const wait = generateWait();
|
|
89
103
|
let n;
|
|
90
104
|
|
|
@@ -121,6 +135,13 @@ export default {
|
|
|
121
135
|
*/
|
|
122
136
|
cleanUpFlow(elements, args): void {
|
|
123
137
|
const $$ = this;
|
|
138
|
+
|
|
139
|
+
// destroy() interrupts the flow transition, which the wait counts as ended,
|
|
140
|
+
// and empties the instance before this runs
|
|
141
|
+
if (!$$.$el) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
124
145
|
const {config, state, $el: {svg}} = $$;
|
|
125
146
|
const isRotated = config.axis_rotated;
|
|
126
147
|
|
|
@@ -133,6 +154,11 @@ export default {
|
|
|
133
154
|
|
|
134
155
|
// Remove flowed elements
|
|
135
156
|
if (flowLength) {
|
|
157
|
+
// point.focus.only draws one circle per data series, which the focus moves to any index
|
|
158
|
+
const isFocusCircle = $$.isPointFocusOnly() ?
|
|
159
|
+
(node: Element) => node.parentElement?.classList.contains(CLASS.circles) :
|
|
160
|
+
() => false;
|
|
161
|
+
|
|
136
162
|
["circle", "text", "shape", "eventRect"].forEach(v => {
|
|
137
163
|
const target: string[] = [];
|
|
138
164
|
|
|
@@ -142,6 +168,9 @@ export default {
|
|
|
142
168
|
|
|
143
169
|
svg.selectAll(`.${CLASS[`${v}s`]}`) // circles, shapes, texts, eventRects
|
|
144
170
|
.selectAll(target)
|
|
171
|
+
.filter(function() {
|
|
172
|
+
return !isFocusCircle(this);
|
|
173
|
+
})
|
|
145
174
|
.remove();
|
|
146
175
|
});
|
|
147
176
|
|
|
@@ -190,28 +219,31 @@ export default {
|
|
|
190
219
|
|
|
191
220
|
config.interaction_enabled && $$.redrawEventRect();
|
|
192
221
|
|
|
222
|
+
state.flowing = false;
|
|
223
|
+
|
|
224
|
+
// other data is under the pointer now: show its focus and tooltip
|
|
225
|
+
if ($$.$el.tooltip?.style("display") === "block") {
|
|
226
|
+
$$.updateTooltipOnRedraw();
|
|
227
|
+
} else {
|
|
228
|
+
$$.hideGridFocus?.();
|
|
229
|
+
}
|
|
230
|
+
|
|
193
231
|
// callback for end of flow
|
|
194
232
|
done.call($$.api);
|
|
195
|
-
|
|
196
|
-
state.flowing = false;
|
|
197
233
|
},
|
|
198
234
|
|
|
199
235
|
/**
|
|
200
236
|
* Get flow transform value
|
|
201
237
|
* @param {object} targets target
|
|
202
238
|
* @param {number} orgDataCount original data count
|
|
203
|
-
* @param {number} flowIndex flow index
|
|
204
|
-
* @param {number} flowLength flow length
|
|
205
239
|
* @returns {string}
|
|
206
240
|
* @private
|
|
207
241
|
*/
|
|
208
|
-
getFlowTransform(targets, orgDataCount
|
|
242
|
+
getFlowTransform(targets, orgDataCount): string {
|
|
209
243
|
const $$ = this;
|
|
210
244
|
const {data, scale: {x}} = $$;
|
|
211
245
|
const dataValues = data.targets[0].values;
|
|
212
246
|
|
|
213
|
-
let flowStart = $$.getValueOnIndex(dataValues, flowIndex);
|
|
214
|
-
let flowEnd = $$.getValueOnIndex(dataValues, flowIndex + flowLength);
|
|
215
247
|
let translateX;
|
|
216
248
|
|
|
217
249
|
// update x domain to generate axis elements for flow
|
|
@@ -224,19 +256,18 @@ export default {
|
|
|
224
256
|
translateX = x(orgDomain[0]) - x(domain[0]);
|
|
225
257
|
} else {
|
|
226
258
|
if ($$.axis.isTimeSeries()) {
|
|
227
|
-
flowStart = $$.getValueOnIndex(dataValues, 0);
|
|
228
|
-
flowEnd = $$.getValueOnIndex(dataValues, dataValues.length - 1);
|
|
259
|
+
const flowStart = $$.getValueOnIndex(dataValues, 0);
|
|
260
|
+
const flowEnd = $$.getValueOnIndex(dataValues, dataValues.length - 1);
|
|
261
|
+
|
|
229
262
|
translateX = x(flowStart.x) - x(flowEnd.x);
|
|
230
263
|
} else {
|
|
231
264
|
translateX = diffDomain(domain) / 2;
|
|
232
265
|
}
|
|
233
266
|
}
|
|
234
|
-
} else if (orgDataCount === 1 || flowStart?.x === flowEnd?.x) {
|
|
235
|
-
translateX = x(orgDomain[0]) - x(domain[0]);
|
|
236
267
|
} else {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
268
|
+
// The flowed-out head is already spliced from the data, so the slide is
|
|
269
|
+
// measured by how far the domain start moved.
|
|
270
|
+
translateX = x(orgDomain[0]) - x(domain[0]);
|
|
240
271
|
}
|
|
241
272
|
|
|
242
273
|
const scaleX = diffDomain(orgDomain) / diffDomain(domain);
|
|
@@ -59,11 +59,12 @@ export default {
|
|
|
59
59
|
* Handle data.onover/out callback options
|
|
60
60
|
* @param {boolean} isOver Over or not
|
|
61
61
|
* @param {number|object} d data object
|
|
62
|
+
* @param {Element} [element] The element hovered, when it isn't the first shape of the data
|
|
62
63
|
* @private
|
|
63
64
|
*/
|
|
64
|
-
setOverOut(isOver: boolean, d: number | IArcDataRow): void {
|
|
65
|
+
setOverOut(isOver: boolean, d: number | IArcDataRow, element?: Element): void {
|
|
65
66
|
const $$ = this;
|
|
66
|
-
const {config, state: {
|
|
67
|
+
const {config, state: {customType, hasRadar, hasTreemap}, $el: {main}} = $$;
|
|
67
68
|
const isArcishData = isObject(d);
|
|
68
69
|
|
|
69
70
|
// Call event handler
|
|
@@ -74,11 +75,12 @@ export default {
|
|
|
74
75
|
|
|
75
76
|
if (isArcishData) {
|
|
76
77
|
const suffix = $$.getTargetSelectorSuffix((d as IArcDataRow).id);
|
|
77
|
-
const selector =
|
|
78
|
+
const selector = customType || hasTreemap ?
|
|
78
79
|
`${$COMMON.target + suffix} .${$SHAPE.shape}` :
|
|
79
80
|
$ARC.arc + suffix;
|
|
80
81
|
|
|
81
|
-
|
|
82
|
+
// the element the type gives (the hovered cell, link...), or the first shape of the data
|
|
83
|
+
callback(d, element ?? main.select(`.${selector}`).node());
|
|
82
84
|
} else if (!config.tooltip_grouped) {
|
|
83
85
|
const last = $$.cache.get(KEY.setOverOut) || [];
|
|
84
86
|
|
|
@@ -187,14 +189,14 @@ export default {
|
|
|
187
189
|
state: {
|
|
188
190
|
eventReceiver,
|
|
189
191
|
hasAxis,
|
|
190
|
-
|
|
192
|
+
customType,
|
|
191
193
|
hasRadar,
|
|
192
194
|
hasTreemap
|
|
193
195
|
},
|
|
194
|
-
$el: {eventRect,
|
|
196
|
+
$el: {eventRect, radar, svg, treemap}
|
|
195
197
|
} = $$;
|
|
196
198
|
let element = (
|
|
197
|
-
((
|
|
199
|
+
((customType || hasTreemap) && eventReceiver.rect) ||
|
|
198
200
|
(hasRadar && radar.axes.select(`.${$AXIS.axis}-${index} text`)) || (
|
|
199
201
|
eventRect || $$.getArcElementByIdOrIndex?.(index)
|
|
200
202
|
)
|
|
@@ -242,9 +244,9 @@ export default {
|
|
|
242
244
|
bubbles: hasRadar // radar type needs to bubble up event
|
|
243
245
|
};
|
|
244
246
|
|
|
245
|
-
// for
|
|
246
|
-
if (
|
|
247
|
-
element = (
|
|
247
|
+
// for custom type and treemap event bound to <g> node
|
|
248
|
+
if (customType || hasTreemap) {
|
|
249
|
+
element = ($$.$el[customType as string] ?? treemap).node();
|
|
248
250
|
}
|
|
249
251
|
|
|
250
252
|
emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](
|
|
@@ -283,7 +285,8 @@ export default {
|
|
|
283
285
|
*/
|
|
284
286
|
unbindAllEvents(): void {
|
|
285
287
|
const $$ = this;
|
|
286
|
-
const {$el: {arcs, eventRect, legend, region, svg, treemap}, brush} =
|
|
288
|
+
const {$el: {arcs, eventRect, legend, region, svg, treemap}, brush, state: {customType}} =
|
|
289
|
+
$$;
|
|
287
290
|
const list = [
|
|
288
291
|
"wheel",
|
|
289
292
|
"click",
|
|
@@ -311,6 +314,7 @@ export default {
|
|
|
311
314
|
brush?.getSelection(),
|
|
312
315
|
arcs?.selectAll("path"),
|
|
313
316
|
legend?.selectAll("g"),
|
|
317
|
+
$$.$el[customType as string],
|
|
314
318
|
treemap
|
|
315
319
|
]
|
|
316
320
|
.forEach(v => v?.on(list, null));
|
|
@@ -25,12 +25,13 @@ export default {
|
|
|
25
25
|
* Get class string
|
|
26
26
|
* @param {string} type Shape type
|
|
27
27
|
* @param {boolean} withShape Get with shape prefix
|
|
28
|
+
* @param {boolean} useId Use the id of the data as the key of the class, as the types of the group
|
|
28
29
|
* @returns {string} Class string
|
|
29
30
|
* @private
|
|
30
31
|
*/
|
|
31
|
-
getClass(type: string, withShape: boolean): Function {
|
|
32
|
+
getClass(type: string, withShape: boolean, useId?: boolean): Function {
|
|
32
33
|
const isPlural = /s$/.test(type);
|
|
33
|
-
const useIdKey = /^(area|arc|line|
|
|
34
|
+
const useIdKey = useId ?? /^(area|arc|line|treemap)s?$/.test(type);
|
|
34
35
|
const key = isPlural ? "id" : "index";
|
|
35
36
|
|
|
36
37
|
return (d): string => {
|
|
@@ -120,11 +120,13 @@ function getTargetValueMinMax($$, targets: IData[]): DomainMinMax {
|
|
|
120
120
|
// asking per row made every main-chart domain pass walk the subchart type chain
|
|
121
121
|
const isSubchartCandlestick = !isCandlestick &&
|
|
122
122
|
!!$$.isSubchartSourceTypeOf?.(target, TYPE.CANDLESTICK);
|
|
123
|
+
// a type of its own module that has the values of a row to cover by itself
|
|
124
|
+
const axisDomain = $$.getAxisTypeHooks?.(target)?.domainValues;
|
|
123
125
|
const {values} = target;
|
|
124
126
|
|
|
125
127
|
for (let j = 0; j < values.length; j++) {
|
|
126
128
|
const row = values[j];
|
|
127
|
-
let value: any = row.value;
|
|
129
|
+
let value: any = axisDomain ? axisDomain($$, row) : row.value;
|
|
128
130
|
|
|
129
131
|
if (!(isValue(value) || value === null)) {
|
|
130
132
|
continue;
|
|
@@ -521,7 +523,7 @@ export default {
|
|
|
521
523
|
// determine default padding value
|
|
522
524
|
if (axis.isCategorized() || isTimeSeriesTickCount) {
|
|
523
525
|
defaultValue = 0;
|
|
524
|
-
} else if ($$.hasType("bar")) {
|
|
526
|
+
} else if ($$.hasType("bar") || $$.hasAxisTypePadding?.()) {
|
|
525
527
|
const maxDataCount = $$.getMaxDataCount();
|
|
526
528
|
|
|
527
529
|
defaultValue = maxDataCount > 1 ? (diff / (maxDataCount - 1)) / 2 : 0.5;
|
|
@@ -91,6 +91,8 @@ export default {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
// the format given by the module of a custom type takes precedence, as treemap.label.format does
|
|
95
|
+
return $$.state.customType && $$.customTypeHooks?.labelFormat?.($$, targetId) ||
|
|
96
|
+
format.bind($$.api);
|
|
95
97
|
}
|
|
96
98
|
};
|
|
@@ -33,7 +33,8 @@ function _getLegendColor(id: string): string {
|
|
|
33
33
|
const data = $$.getDataById(id);
|
|
34
34
|
const color = $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data);
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
// a chart type of its own can give the color of the swatch
|
|
37
|
+
return $$.customTypeHooks?.legendColor?.($$, data) ?? color;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
/**
|
|
@@ -65,7 +65,8 @@ export default {
|
|
|
65
65
|
|
|
66
66
|
if (state.isCanvasMode) {
|
|
67
67
|
const zoomScale = $$.scale.zoom;
|
|
68
|
-
|
|
68
|
+
// the domain set to the scale: a category scale reads its end one category further
|
|
69
|
+
const zoomDomain = zoomScale?.orgDomain?.() ?? zoomScale?.domain();
|
|
69
70
|
|
|
70
71
|
zoomScale && ($$.scale.zoom = null);
|
|
71
72
|
$$.updateScales(initializing, wth.UpdateXDomain);
|
|
@@ -73,7 +74,8 @@ export default {
|
|
|
73
74
|
if (zoomScale) {
|
|
74
75
|
zoomScale.range($$.scale.x.range());
|
|
75
76
|
zoomDomain && zoomScale.domain(zoomDomain);
|
|
76
|
-
|
|
77
|
+
// wrap the plain scale: wrapping the customized one again shifts a category domain
|
|
78
|
+
$$.scale.zoom = $$.getCustomizedXScale(zoomScale.orgScale?.() ?? zoomScale);
|
|
77
79
|
$$.axis.x.scale($$.scale.zoom);
|
|
78
80
|
$$.scale.x.domain(config.zoom_rescale ? zoomDomain : $$.org.xDomain);
|
|
79
81
|
$$.scale.subX.domain($$.org.xDomain);
|
|
@@ -149,7 +151,7 @@ export default {
|
|
|
149
151
|
// rect for regions (optional module — updateRegion installed by regions resolver)
|
|
150
152
|
config.regions.length && $$.updateRegion?.();
|
|
151
153
|
|
|
152
|
-
["bar", "candlestick", "line", "area"].forEach(v => {
|
|
154
|
+
["bar", "candlestick", "line", "area", ...$$.getAxisTypes()].forEach(v => {
|
|
153
155
|
const name = capitalize(v);
|
|
154
156
|
|
|
155
157
|
if ((/^(line|area)$/.test(v) && $$.hasTypeOf(name)) || $$.hasType(v)) {
|
|
@@ -180,8 +182,8 @@ export default {
|
|
|
180
182
|
// polar
|
|
181
183
|
$el.polar && $$.redrawPolar();
|
|
182
184
|
|
|
183
|
-
//
|
|
184
|
-
|
|
185
|
+
// custom type
|
|
186
|
+
state.customType && $$[`redraw${capitalize(state.customType)}`](wth.Transition);
|
|
185
187
|
|
|
186
188
|
// treemap
|
|
187
189
|
treemap && $$.updateTreemap(durationForExit);
|
|
@@ -189,7 +191,7 @@ export default {
|
|
|
189
191
|
|
|
190
192
|
if (!state.resizing && !treemap && ($$.hasPointType() || state.hasRadar)) {
|
|
191
193
|
if (needShapeUpdate) {
|
|
192
|
-
$$.updateCircle();
|
|
194
|
+
$$.updateCircle(false, !!flow);
|
|
193
195
|
}
|
|
194
196
|
} else if ($$.hasLegendDefsPoint?.()) {
|
|
195
197
|
$$.data.targets.forEach($$.point("create", this));
|
|
@@ -223,6 +225,12 @@ export default {
|
|
|
223
225
|
needShapeRegen: boolean = true): void {
|
|
224
226
|
const $$ = this;
|
|
225
227
|
const {config, state} = $$;
|
|
228
|
+
|
|
229
|
+
// subchart first: its initial range narrows the x domain, which sizes the main shapes
|
|
230
|
+
if (state.hasAxis) {
|
|
231
|
+
config.subchart_show && $$.redrawSubchart(withSubchart, duration);
|
|
232
|
+
}
|
|
233
|
+
|
|
226
234
|
const shape = needShapeRegen ?
|
|
227
235
|
$$.getDrawShape() :
|
|
228
236
|
(state._cachedDrawShape || $$.getDrawShape());
|
|
@@ -231,11 +239,6 @@ export default {
|
|
|
231
239
|
state._cachedDrawShape = shape;
|
|
232
240
|
}
|
|
233
241
|
|
|
234
|
-
if (state.hasAxis) {
|
|
235
|
-
// subchart
|
|
236
|
-
config.subchart_show && $$.redrawSubchart(withSubchart, duration, shape);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
242
|
// generate flow
|
|
240
243
|
const flowFn = flow && $$.generateFlow({
|
|
241
244
|
targets,
|
|
@@ -244,7 +247,10 @@ export default {
|
|
|
244
247
|
shape,
|
|
245
248
|
xv: $$.xv.bind($$)
|
|
246
249
|
});
|
|
247
|
-
|
|
250
|
+
// A flow slides the shapes itself, so they take their new data at once: a chart
|
|
251
|
+
// transition interpolated the paths between different point counts first, which
|
|
252
|
+
// bent them and held back the slide until it ended.
|
|
253
|
+
const withTransition = !flowFn && duration && isTabVisible();
|
|
248
254
|
|
|
249
255
|
// redraw list
|
|
250
256
|
const redrawList = $$.getRedrawList(shape, flow, flowFn, withTransition);
|
|
@@ -37,7 +37,8 @@ export default {
|
|
|
37
37
|
getCurrentHeight(): number {
|
|
38
38
|
const $$ = this;
|
|
39
39
|
const {config, state, $el} = $$;
|
|
40
|
-
|
|
40
|
+
// a chart type of its own can make the chart as high as it needs, from the width
|
|
41
|
+
let h = config.size_height || $$.customTypeHooks?.currentHeight?.($$);
|
|
41
42
|
|
|
42
43
|
if (!h) {
|
|
43
44
|
// The min-height reserved for the canvas surface is this element's own
|
|
@@ -441,7 +442,7 @@ export default {
|
|
|
441
442
|
const $$ = this;
|
|
442
443
|
const {config, state, $el: {legend}} = $$;
|
|
443
444
|
const isRotated = config.axis_rotated;
|
|
444
|
-
const isNonAxis = $$.hasArcType() || state.
|
|
445
|
+
const isNonAxis = $$.hasArcType() || state.customType || state.hasTreemap;
|
|
445
446
|
const isFitPadding = config.padding?.mode === "fit";
|
|
446
447
|
|
|
447
448
|
!isInit && $$.setContainerSize();
|
|
@@ -579,7 +580,8 @@ export default {
|
|
|
579
580
|
$$.updateRadius?.();
|
|
580
581
|
}
|
|
581
582
|
|
|
582
|
-
|
|
583
|
+
// arc types center their legend by the arc size: a custom type can place it beside its own plot
|
|
584
|
+
if (state.isLegendRight && isNonAxis && !$$.customTypeHooks?.ownLegendLayout) {
|
|
583
585
|
state.margin3.left = state.arcWidth / 2 + state.radiusExpanded * 1.1;
|
|
584
586
|
}
|
|
585
587
|
}
|