billboard.js 4.0.3 → 4.1.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/README.md +82 -7
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +1841 -491
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +19 -24
- package/dist/billboard.pkgd.js +1837 -676
- package/dist/billboard.pkgd.min.js +24 -29
- package/dist/billboard.react.js +205 -0
- package/dist/billboard.react.min.js +9 -0
- package/dist/billboard.worker.js +10 -0
- 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 +3 -2
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +3 -2
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +57 -27
- package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +72 -54
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +3 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +3 -2
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +57 -27
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -11
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +65 -3556
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/Chart/Chart.js +134 -152
- package/dist-esm/Chart/api/axis.js +217 -237
- package/dist-esm/Chart/api/category.js +54 -54
- package/dist-esm/Chart/api/chart.js +172 -215
- package/dist-esm/Chart/api/color.js +21 -21
- package/dist-esm/Chart/api/data.js +172 -173
- package/dist-esm/Chart/api/export.js +242 -262
- package/dist-esm/Chart/api/flow.js +198 -254
- package/dist-esm/Chart/api/focus.js +136 -143
- package/dist-esm/Chart/api/grid.js +191 -190
- package/dist-esm/Chart/api/group.js +31 -34
- package/dist-esm/Chart/api/legend.js +54 -63
- package/dist-esm/Chart/api/load.js +237 -257
- package/dist-esm/Chart/api/regions.js +148 -168
- package/dist-esm/Chart/api/selection.js +181 -139
- package/dist-esm/Chart/api/show.js +133 -147
- package/dist-esm/Chart/api/stubs.js +43 -42
- package/dist-esm/Chart/api/subchart.js +155 -172
- package/dist-esm/Chart/api/tooltip.js +132 -177
- package/dist-esm/Chart/api/x.js +67 -71
- package/dist-esm/Chart/api/zoom.js +183 -220
- package/dist-esm/ChartInternal/Axis/Axis.js +1059 -1266
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +408 -540
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +113 -149
- package/dist-esm/ChartInternal/ChartInternal.js +573 -749
- package/dist-esm/ChartInternal/data/convert.helper.js +133 -159
- package/dist-esm/ChartInternal/data/convert.js +200 -229
- package/dist-esm/ChartInternal/data/data.js +967 -1153
- package/dist-esm/ChartInternal/data/load.js +145 -197
- package/dist-esm/ChartInternal/interactions/drag.js +86 -122
- package/dist-esm/ChartInternal/interactions/eventrect.js +455 -621
- package/dist-esm/ChartInternal/interactions/flow.js +151 -215
- package/dist-esm/ChartInternal/interactions/interaction.js +214 -252
- package/dist-esm/ChartInternal/interactions/subchart.js +425 -300
- package/dist-esm/ChartInternal/interactions/zoom.js +321 -440
- package/dist-esm/ChartInternal/internals/category.js +18 -18
- package/dist-esm/ChartInternal/internals/class.js +89 -99
- package/dist-esm/ChartInternal/internals/clip.js +88 -119
- package/dist-esm/ChartInternal/internals/color.js +233 -288
- package/dist-esm/ChartInternal/internals/domain.js +452 -588
- package/dist-esm/ChartInternal/internals/format.js +64 -77
- package/dist-esm/ChartInternal/internals/grid.js +333 -457
- package/dist-esm/ChartInternal/internals/legend.js +675 -927
- package/dist-esm/ChartInternal/internals/redraw.js +200 -289
- package/dist-esm/ChartInternal/internals/region.js +106 -159
- package/dist-esm/ChartInternal/internals/scale.js +186 -215
- package/dist-esm/ChartInternal/internals/selection.js +132 -159
- package/dist-esm/ChartInternal/internals/size.axis.js +92 -139
- package/dist-esm/ChartInternal/internals/size.js +286 -394
- package/dist-esm/ChartInternal/internals/style.js +39 -41
- package/dist-esm/ChartInternal/internals/subchart.util.js +49 -0
- package/dist-esm/ChartInternal/internals/text.arc.js +155 -219
- package/dist-esm/ChartInternal/internals/text.js +368 -528
- package/dist-esm/ChartInternal/internals/text.util.js +179 -239
- package/dist-esm/ChartInternal/internals/title.js +96 -121
- package/dist-esm/ChartInternal/internals/tooltip.js +450 -586
- package/dist-esm/ChartInternal/internals/transform.js +79 -97
- package/dist-esm/ChartInternal/internals/type.js +285 -236
- package/dist-esm/ChartInternal/shape/arc.js +825 -1112
- package/dist-esm/ChartInternal/shape/area.js +73 -94
- package/dist-esm/ChartInternal/shape/bar.js +227 -288
- package/dist-esm/ChartInternal/shape/bubble.js +9 -8
- package/dist-esm/ChartInternal/shape/candlestick.js +110 -138
- package/dist-esm/ChartInternal/shape/core/barRadius.js +197 -133
- package/dist-esm/ChartInternal/shape/core/bubble.js +64 -73
- package/dist-esm/ChartInternal/shape/core/candlestick.js +93 -86
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +68 -75
- package/dist-esm/ChartInternal/shape/core/geometry.js +112 -112
- package/dist-esm/ChartInternal/shape/core/path.js +142 -115
- package/dist-esm/ChartInternal/shape/core/point.js +105 -125
- package/dist-esm/ChartInternal/shape/core/treemap.js +83 -88
- package/dist-esm/ChartInternal/shape/funnel.js +310 -338
- package/dist-esm/ChartInternal/shape/gauge.js +71 -103
- package/dist-esm/ChartInternal/shape/line.js +208 -278
- package/dist-esm/ChartInternal/shape/point.js +310 -425
- package/dist-esm/ChartInternal/shape/polar.js +84 -109
- package/dist-esm/ChartInternal/shape/radar.js +228 -318
- package/dist-esm/ChartInternal/shape/shape.js +782 -843
- package/dist-esm/ChartInternal/shape/treemap.js +152 -190
- package/dist-esm/canvas/CanvasAxisRenderer.js +1180 -1328
- package/dist-esm/canvas/CanvasEngine.js +148 -166
- package/dist-esm/canvas/CanvasPainter.js +395 -411
- package/dist-esm/canvas/CanvasRenderer.js +1584 -1834
- package/dist-esm/canvas/CanvasTheme.js +899 -802
- package/dist-esm/canvas/HitDetector.js +394 -463
- package/dist-esm/canvas/axisTicks.js +672 -786
- package/dist-esm/canvas/classes.js +19 -17
- package/dist-esm/canvas/color.js +40 -59
- package/dist-esm/canvas/geometry.js +38 -38
- package/dist-esm/canvas/labels.js +318 -371
- package/dist-esm/canvas/pointPattern.js +578 -580
- package/dist-esm/canvas/util.js +242 -262
- package/dist-esm/config/Options/Options.js +29 -32
- package/dist-esm/config/Options/axis/axis.js +101 -101
- package/dist-esm/config/Options/axis/x.js +759 -755
- package/dist-esm/config/Options/axis/y.js +525 -522
- package/dist-esm/config/Options/axis/y2.js +501 -485
- package/dist-esm/config/Options/common/boost.js +93 -32
- package/dist-esm/config/Options/common/color.js +88 -87
- package/dist-esm/config/Options/common/grid.js +74 -73
- package/dist-esm/config/Options/common/legend.js +180 -179
- package/dist-esm/config/Options/common/main.js +474 -473
- package/dist-esm/config/Options/common/point.js +160 -159
- package/dist-esm/config/Options/common/title.js +47 -46
- package/dist-esm/config/Options/common/tooltip.js +253 -252
- package/dist-esm/config/Options/data/axis.js +173 -172
- package/dist-esm/config/Options/data/data.js +958 -957
- package/dist-esm/config/Options/data/selection.js +131 -130
- package/dist-esm/config/Options/interaction/interaction.js +53 -52
- package/dist-esm/config/Options/interaction/subchart.js +164 -73
- package/dist-esm/config/Options/interaction/zoom.js +86 -85
- package/dist-esm/config/Options/shape/arc.js +150 -149
- package/dist-esm/config/Options/shape/area.js +69 -68
- package/dist-esm/config/Options/shape/bar.js +147 -146
- package/dist-esm/config/Options/shape/bubble.js +35 -34
- package/dist-esm/config/Options/shape/candlestick.js +61 -60
- package/dist-esm/config/Options/shape/donut.js +181 -180
- package/dist-esm/config/Options/shape/funnel.js +49 -48
- package/dist-esm/config/Options/shape/gauge.js +237 -236
- package/dist-esm/config/Options/shape/line.js +58 -57
- package/dist-esm/config/Options/shape/pie.js +185 -184
- package/dist-esm/config/Options/shape/polar.js +167 -166
- package/dist-esm/config/Options/shape/radar.js +76 -75
- package/dist-esm/config/Options/shape/scatter.js +36 -36
- package/dist-esm/config/Options/shape/spline.js +46 -46
- package/dist-esm/config/Options/shape/treemap.js +80 -79
- package/dist-esm/config/Store/Element.js +64 -62
- package/dist-esm/config/Store/State.js +189 -200
- package/dist-esm/config/Store/Store.js +25 -26
- package/dist-esm/config/classes.js +157 -155
- package/dist-esm/config/config.js +26 -35
- package/dist-esm/config/const.js +120 -128
- package/dist-esm/config/resolver/axis.core.js +25 -25
- package/dist-esm/config/resolver/axis.js +26 -27
- package/dist-esm/config/resolver/canvas.js +2071 -2472
- package/dist-esm/config/resolver/canvasShape.js +201 -177
- package/dist-esm/config/resolver/category.js +26 -27
- package/dist-esm/config/resolver/export.js +24 -26
- package/dist-esm/config/resolver/flow.js +29 -31
- package/dist-esm/config/resolver/grid.js +34 -35
- package/dist-esm/config/resolver/interaction/selection.js +17 -17
- package/dist-esm/config/resolver/interaction/subchart.js +17 -17
- package/dist-esm/config/resolver/interaction/zoom.js +17 -17
- package/dist-esm/config/resolver/regions.js +30 -31
- package/dist-esm/config/resolver/shape/arc.helpers.js +19 -19
- package/dist-esm/config/resolver/shape/area.js +17 -17
- package/dist-esm/config/resolver/shape/axis.helpers.js +28 -25
- package/dist-esm/config/resolver/shape/bar.js +13 -13
- package/dist-esm/config/resolver/shape/bubble.js +18 -14
- package/dist-esm/config/resolver/shape/candlestick.js +13 -13
- package/dist-esm/config/resolver/shape/donut.js +11 -11
- package/dist-esm/config/resolver/shape/funnel.js +11 -11
- package/dist-esm/config/resolver/shape/gauge.js +12 -12
- package/dist-esm/config/resolver/shape/line.js +10 -10
- package/dist-esm/config/resolver/shape/pie.js +11 -11
- package/dist-esm/config/resolver/shape/polar.js +12 -12
- package/dist-esm/config/resolver/shape/radar.js +22 -14
- package/dist-esm/config/resolver/shape/scatter.js +13 -13
- package/dist-esm/config/resolver/shape/treemap.js +11 -11
- package/dist-esm/core.js +208 -211
- package/dist-esm/index.canvas.js +14 -13
- package/dist-esm/index.esm.js +25 -24
- package/dist-esm/module/Cache.js +117 -129
- package/dist-esm/module/browser.js +30 -35
- package/dist-esm/module/dsv.js +107 -127
- package/dist-esm/module/error.js +45 -52
- package/dist-esm/module/generator.js +75 -83
- package/dist-esm/module/sanitize.js +302 -399
- package/dist-esm/module/util/brush.js +27 -38
- package/dist-esm/module/util/dom.js +288 -348
- package/dist-esm/module/util/object.js +277 -341
- package/dist-esm/module/util/type-checks.js +21 -25
- package/dist-esm/module/worker.js +312 -130
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +185 -198
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +442 -450
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +813 -950
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +708 -788
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +344 -301
- package/dist-esm/react/index.js +157 -0
- package/package.json +28 -8
- package/src/Chart/api/selection.ts +130 -5
- package/src/ChartInternal/Axis/Axis.ts +164 -65
- package/src/ChartInternal/Axis/AxisRenderer.ts +41 -8
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
- package/src/ChartInternal/ChartInternal.ts +1 -1
- package/src/ChartInternal/data/convert.ts +54 -4
- package/src/ChartInternal/data/data.ts +4 -1
- package/src/ChartInternal/interactions/eventrect.ts +6 -0
- package/src/ChartInternal/interactions/subchart.ts +437 -66
- package/src/ChartInternal/internals/color.ts +2 -2
- package/src/ChartInternal/internals/domain.ts +15 -3
- package/src/ChartInternal/internals/grid.ts +21 -1
- package/src/ChartInternal/internals/scale.ts +9 -2
- package/src/ChartInternal/internals/selection.ts +1 -1
- package/src/ChartInternal/internals/subchart.util.ts +55 -0
- package/src/ChartInternal/internals/text.arc.ts +3 -1
- package/src/ChartInternal/internals/text.ts +18 -5
- package/src/ChartInternal/internals/transform.ts +8 -2
- package/src/ChartInternal/internals/type.ts +105 -1
- package/src/ChartInternal/shape/IShape.ts +6 -3
- package/src/ChartInternal/shape/bar.ts +62 -31
- package/src/ChartInternal/shape/core/barRadius.ts +129 -0
- package/src/ChartInternal/shape/core/candlestick.ts +1 -1
- package/src/ChartInternal/shape/core/path.ts +76 -9
- package/src/ChartInternal/shape/funnel.ts +2 -3
- package/src/ChartInternal/shape/point.ts +2 -2
- package/src/ChartInternal/shape/shape.ts +149 -17
- package/src/Plugin/stanford/index.ts +0 -4
- package/src/Plugin/tableview/index.ts +85 -3
- package/src/Plugin/textoverlap/index.ts +9 -15
- package/src/canvas/CanvasAxisRenderer.ts +184 -36
- package/src/canvas/CanvasRenderer.ts +247 -160
- package/src/canvas/CanvasTheme.ts +212 -0
- package/src/canvas/axisTicks.ts +122 -40
- package/src/config/Options/axis/y2.ts +13 -0
- package/src/config/Options/common/boost.ts +64 -4
- package/src/config/Options/common/color.ts +2 -2
- package/src/config/Options/interaction/subchart.ts +98 -1
- package/src/config/Options/shape/gauge.ts +1 -1
- package/src/config/Options/shape/treemap.ts +2 -2
- package/src/config/Store/Element.ts +3 -1
- package/src/config/Store/State.ts +1 -0
- package/src/config/classes.ts +1 -0
- package/src/config/resolver/canvas.ts +92 -10
- package/src/module/voronoi.ts +119 -0
- package/src/module/worker.entry.ts +61 -0
- package/src/module/worker.ts +346 -63
- package/src/react/index.ts +193 -0
- package/types/options.d.ts +206 -3
- package/types/react/index.d.ts +27 -0
|
@@ -5,428 +5,375 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.
|
|
8
|
+
* @version 4.1.0-next.1
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
10
|
+
import { isFunction, isNumber, isObject, isString } from "../module/util/type-checks.js";
|
|
11
|
+
import { parseShorthand, tplProcess } from "../module/util/object.js";
|
|
12
|
+
import { getFontSize, isCanvasBubbleType, isCanvasCandlestickType, isCanvasLineType, isCanvasScatterType } from "./util.js";
|
|
13
|
+
//#region src/canvas/labels.ts
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// Canvas text has no DOM line box/getBBox. Use the common 1.2 line-height ratio so
|
|
19
|
-
// multiline data label decoration boxes stay close to SVG/CSS layout.
|
|
15
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
16
|
+
* billboard.js project is licensed under the MIT license
|
|
17
|
+
*/
|
|
20
18
|
const LABEL_LINE_HEIGHT_RATIO = 1.2;
|
|
21
19
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
* Get the data label value matching SVG label formatter input.
|
|
21
|
+
* @param {object} $$ ChartInternal instance
|
|
22
|
+
* @param {object} d Data row
|
|
23
|
+
* @returns {number|object|Array|null} Data label value
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
28
26
|
function getLabelValue($$, d) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
value = data.close;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return value;
|
|
27
|
+
let { value } = d;
|
|
28
|
+
if ($$.isBubbleZType?.(d)) value = $$.getBubbleZData(value, "z");
|
|
29
|
+
else if ($$.isCandlestickType?.(d)) {
|
|
30
|
+
const data = $$.getCandlestickData?.(d);
|
|
31
|
+
if (data) value = data.close;
|
|
32
|
+
}
|
|
33
|
+
return value;
|
|
40
34
|
}
|
|
41
35
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
* Convert a data label value into drawable text.
|
|
37
|
+
* @param {object} $$ ChartInternal instance
|
|
38
|
+
* @param {object} d Data row
|
|
39
|
+
* @returns {string|null} Label text
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
48
42
|
function getLabelText($$, d) {
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
const value = $$.dataLabelFormat(d.id)(getLabelValue($$, d), d.id, d.index, []);
|
|
44
|
+
return value === null || value === void 0 ? null : String(value);
|
|
51
45
|
}
|
|
52
46
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
* Get a stable key for data label caches.
|
|
48
|
+
* @param {object} d Data row
|
|
49
|
+
* @returns {string} Label key
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
58
52
|
function getLabelRowKey(d) {
|
|
59
|
-
|
|
53
|
+
return `${d.id}:${d.index}`;
|
|
60
54
|
}
|
|
61
55
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
* Build a matcher for SVG-like _expanded_ bar type focus.
|
|
57
|
+
* @param {object} $$ ChartInternal instance
|
|
58
|
+
* @param {Array} selectedData Focused data rows
|
|
59
|
+
* @param {function} typeFilter Canvas type filter
|
|
60
|
+
* @returns {function} Focus matcher
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
69
63
|
function getExpandedFocusMatcher($$, selectedData, typeFilter) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const keys = new Set(selectedData
|
|
78
|
-
.filter(d => d && typeFilter($$, d))
|
|
79
|
-
.map(getLabelRowKey));
|
|
80
|
-
return d => keys.has(getLabelRowKey(d));
|
|
64
|
+
if (!selectedData?.length) return () => false;
|
|
65
|
+
if ($$.config.tooltip_grouped && selectedData.length > 1) {
|
|
66
|
+
const index = selectedData[0]?.index;
|
|
67
|
+
return (d) => index !== void 0 && d.index === index && typeFilter($$, d);
|
|
68
|
+
}
|
|
69
|
+
const keys = new Set(selectedData.filter((d) => d && typeFilter($$, d)).map(getLabelRowKey));
|
|
70
|
+
return (d) => keys.has(getLabelRowKey(d));
|
|
81
71
|
}
|
|
82
72
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
73
|
+
* Get data label position offset.
|
|
74
|
+
* @param {object} $$ ChartInternal instance
|
|
75
|
+
* @param {object} d Data row
|
|
76
|
+
* @param {string} type Coordinate type
|
|
77
|
+
* @param {object} texts SVG-compatible text collection facade
|
|
78
|
+
* @returns {number} Offset value
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
91
81
|
function getLabelPosition($$, d, type, texts) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
else if (position) {
|
|
98
|
-
const targetPosition = d.id in position ? position[d.id] : position;
|
|
99
|
-
value = targetPosition?.[type];
|
|
100
|
-
}
|
|
101
|
-
return isNumber(value) ? value : 0;
|
|
82
|
+
const position = $$.config.data_labels_position;
|
|
83
|
+
let value;
|
|
84
|
+
if (isFunction(position)) value = position.bind($$.api)(type, getLabelValue($$, d), d.id, d.index, texts);
|
|
85
|
+
else if (position) value = (d.id in position ? position[d.id] : position)?.[type];
|
|
86
|
+
return isNumber(value) ? value : 0;
|
|
102
87
|
}
|
|
103
88
|
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
89
|
+
* Get image option for data label.
|
|
90
|
+
* @param {object} $$ ChartInternal instance
|
|
91
|
+
* @param {object} d Data row
|
|
92
|
+
* @returns {object|null} Image option
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
110
95
|
function getLabelImageOption($$, d) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
96
|
+
const option = $$.config.data_labels?.image;
|
|
97
|
+
if (isFunction(option)) return option.call($$.api, getLabelValue($$, d), d.id, d.index) ?? null;
|
|
98
|
+
else if (option) {
|
|
99
|
+
const { url = "", width = 0, height = 0, pos } = option;
|
|
100
|
+
return {
|
|
101
|
+
url,
|
|
102
|
+
width,
|
|
103
|
+
height,
|
|
104
|
+
pos
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
120
108
|
}
|
|
121
109
|
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
110
|
+
* Get resolved image URL for a data label row.
|
|
111
|
+
* @param {object} option Image option
|
|
112
|
+
* @param {object} d Data row
|
|
113
|
+
* @returns {string} Resolved image URL
|
|
114
|
+
* @private
|
|
115
|
+
*/
|
|
128
116
|
function getLabelImageUrl(option, d) {
|
|
129
|
-
|
|
130
|
-
ID: d.id
|
|
131
|
-
});
|
|
117
|
+
return tplProcess(option.url, { ID: d.id });
|
|
132
118
|
}
|
|
133
119
|
/**
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
120
|
+
* Get image and adjusted text position matching SVG label image placement.
|
|
121
|
+
* @param {object} $$ ChartInternal instance
|
|
122
|
+
* @param {object} option Image option
|
|
123
|
+
* @param {string} text Label text
|
|
124
|
+
* @param {number} x Text x coordinate
|
|
125
|
+
* @param {number} y Text y coordinate
|
|
126
|
+
* @param {object} d Data row
|
|
127
|
+
* @returns {object} Image and text positions
|
|
128
|
+
* @private
|
|
129
|
+
*/
|
|
144
130
|
function getLabelImagePosition($$, option, text, x, y, d) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
y: imageY + (pos?.y ?? 0),
|
|
163
|
-
textX,
|
|
164
|
-
textY
|
|
165
|
-
};
|
|
131
|
+
const { width = 0, height = 0, pos } = option;
|
|
132
|
+
const w = width / 2;
|
|
133
|
+
const h = height / 2;
|
|
134
|
+
const textHeight = getLabelDecorationBox($$.canvasEngine.ctx, text, x, y).h;
|
|
135
|
+
const fontSize = getFontSize($$.canvasEngine.ctx.font);
|
|
136
|
+
const imageX = x - w;
|
|
137
|
+
const imageY = y - h - ($$.isTreemapType?.(d) ? fontSize * .7 : textHeight / 2);
|
|
138
|
+
let textX = x;
|
|
139
|
+
let textY = y;
|
|
140
|
+
if ($$.config.axis_rotated) textX += w;
|
|
141
|
+
else textY += h;
|
|
142
|
+
return {
|
|
143
|
+
x: imageX + (pos?.x ?? 0),
|
|
144
|
+
y: imageY + (pos?.y ?? 0),
|
|
145
|
+
textX,
|
|
146
|
+
textY
|
|
147
|
+
};
|
|
166
148
|
}
|
|
167
149
|
/**
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
150
|
+
* Get canvas fill style for data label text.
|
|
151
|
+
* @param {object} $$ ChartInternal instance
|
|
152
|
+
* @param {object} d Data row
|
|
153
|
+
* @param {string} fallback Fallback color
|
|
154
|
+
* @returns {string} Canvas fill style
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
175
157
|
function getLabelColor($$, d, fallback) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
color :
|
|
179
|
-
($$.isTreemapType?.(d) ? fallback : ($$.color?.(d) || fallback));
|
|
158
|
+
const color = $$.updateTextColor?.(d);
|
|
159
|
+
return typeof color === "string" ? color : $$.isTreemapType?.(d) ? fallback : $$.color?.(d) || fallback;
|
|
180
160
|
}
|
|
181
161
|
/**
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
162
|
+
* Get canvas fill style for data label background.
|
|
163
|
+
* @param {object} $$ ChartInternal instance
|
|
164
|
+
* @param {object} d Data row
|
|
165
|
+
* @returns {string|null} Canvas fill style
|
|
166
|
+
* @private
|
|
167
|
+
*/
|
|
188
168
|
function getLabelBackgroundColor($$, d) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return color === null || color === undefined ? null : String(color);
|
|
200
|
-
}
|
|
201
|
-
const color = option[d.id];
|
|
202
|
-
return color === null || color === undefined ? null : String(color);
|
|
169
|
+
const option = $$.config.data_labels_backgroundColors;
|
|
170
|
+
if (!option) return null;
|
|
171
|
+
if (isString(option)) return option;
|
|
172
|
+
if (isFunction(option)) {
|
|
173
|
+
const defaultColor = $$.color?.(d);
|
|
174
|
+
const color = option.bind($$.api)(defaultColor, d);
|
|
175
|
+
return color === null || color === void 0 ? null : String(color);
|
|
176
|
+
}
|
|
177
|
+
const color = option[d.id];
|
|
178
|
+
return color === null || color === void 0 ? null : String(color);
|
|
203
179
|
}
|
|
204
180
|
/**
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
181
|
+
* Get normalized canvas data label border option.
|
|
182
|
+
* @param {object|boolean} border Border option
|
|
183
|
+
* @returns {object|null} Border option
|
|
184
|
+
* @private
|
|
185
|
+
*/
|
|
210
186
|
function getLabelBorderOption(border) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
fill: option.fill ?? "none"
|
|
221
|
-
};
|
|
187
|
+
if (!border) return null;
|
|
188
|
+
const option = isObject(border) ? border : {};
|
|
189
|
+
return {
|
|
190
|
+
padding: parseShorthand(option.padding ?? "3 5"),
|
|
191
|
+
radius: isNumber(option.radius) ? option.radius : 10,
|
|
192
|
+
stroke: option.stroke ?? "#000",
|
|
193
|
+
strokeWidth: isNumber(option.strokeWidth) ? option.strokeWidth : 1,
|
|
194
|
+
fill: option.fill ?? "none"
|
|
195
|
+
};
|
|
222
196
|
}
|
|
223
197
|
/**
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
function getLabelDecorationBox(ctx, text, x, y, padding = {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
else if (ctx.textBaseline === "bottom" ||
|
|
261
|
-
ctx.textBaseline === "ideographic") {
|
|
262
|
-
textY -= height;
|
|
263
|
-
}
|
|
264
|
-
return {
|
|
265
|
-
x: textX - padding.left,
|
|
266
|
-
y: textY - padding.top,
|
|
267
|
-
w: width + padding.left + padding.right,
|
|
268
|
-
h: height + padding.top + padding.bottom
|
|
269
|
-
};
|
|
198
|
+
* Measure the canvas rectangle needed behind a data label.
|
|
199
|
+
* @param {CanvasRenderingContext2D} ctx Canvas context
|
|
200
|
+
* @param {string} text Label text
|
|
201
|
+
* @param {number} x Label x coordinate
|
|
202
|
+
* @param {number} y Label y coordinate
|
|
203
|
+
* @param {object} padding Padding values
|
|
204
|
+
* @returns {object} Canvas rectangle
|
|
205
|
+
* @private
|
|
206
|
+
*/
|
|
207
|
+
function getLabelDecorationBox(ctx, text, x, y, padding = {
|
|
208
|
+
top: 0,
|
|
209
|
+
right: 0,
|
|
210
|
+
bottom: 0,
|
|
211
|
+
left: 0
|
|
212
|
+
}) {
|
|
213
|
+
const lines = text.split("\n");
|
|
214
|
+
const metrics = lines.map((line) => ctx.measureText(line));
|
|
215
|
+
const width = Math.max(...metrics.map((metric) => metric.width), 0);
|
|
216
|
+
const fontSize = getFontSize(ctx.font);
|
|
217
|
+
const lineHeight = fontSize * LABEL_LINE_HEIGHT_RATIO;
|
|
218
|
+
const fontBoundingHeight = metrics[0] ? (metrics[0].fontBoundingBoxAscent || 0) + (metrics[0].fontBoundingBoxDescent || 0) : 0;
|
|
219
|
+
const baselineDescent = metrics[0] ? metrics[0].fontBoundingBoxDescent || metrics[0].actualBoundingBoxDescent || 0 : 0;
|
|
220
|
+
const height = lines.length > 1 ? lineHeight * lines.length : Math.max(fontSize, fontBoundingHeight, metrics[0]?.actualBoundingBoxAscent + metrics[0]?.actualBoundingBoxDescent || 0);
|
|
221
|
+
let textX = x;
|
|
222
|
+
let textY = y;
|
|
223
|
+
if (ctx.textAlign === "center") textX -= width / 2;
|
|
224
|
+
else if (ctx.textAlign === "right" || ctx.textAlign === "end") textX -= width;
|
|
225
|
+
if (ctx.textBaseline === "middle") textY -= height / 2;
|
|
226
|
+
else if (ctx.textBaseline === "alphabetic") textY -= height - baselineDescent;
|
|
227
|
+
else if (ctx.textBaseline === "bottom" || ctx.textBaseline === "ideographic") textY -= height;
|
|
228
|
+
return {
|
|
229
|
+
x: textX - padding.left,
|
|
230
|
+
y: textY - padding.top,
|
|
231
|
+
w: width + padding.left + padding.right,
|
|
232
|
+
h: height + padding.top + padding.bottom
|
|
233
|
+
};
|
|
270
234
|
}
|
|
271
235
|
/**
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
236
|
+
* Draw data label background and border before drawing text.
|
|
237
|
+
* @param {object} $$ ChartInternal instance
|
|
238
|
+
* @param {CanvasPainter} painter Canvas painter
|
|
239
|
+
* @param {object} d Data row
|
|
240
|
+
* @param {string} text Label text
|
|
241
|
+
* @param {number} x Label x coordinate
|
|
242
|
+
* @param {number} y Label y coordinate
|
|
243
|
+
* @private
|
|
244
|
+
*/
|
|
281
245
|
function drawLabelDecorations($$, painter, d, text, x, y) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
246
|
+
const ctx = painter.context;
|
|
247
|
+
const backgroundColor = getLabelBackgroundColor($$, d);
|
|
248
|
+
const border = getLabelBorderOption($$.config.data_labels?.border);
|
|
249
|
+
const box = getLabelDecorationBox(ctx, text, x, y, border?.padding ?? {
|
|
250
|
+
top: 0,
|
|
251
|
+
right: 0,
|
|
252
|
+
bottom: 0,
|
|
253
|
+
left: 0
|
|
254
|
+
});
|
|
255
|
+
const angle = $$.config.data_labels.rotate;
|
|
256
|
+
painter.withState((canvas) => {
|
|
257
|
+
if (angle) {
|
|
258
|
+
canvas.translate(x, y);
|
|
259
|
+
canvas.rotate(angle * Math.PI / 180);
|
|
260
|
+
box.x -= x;
|
|
261
|
+
box.y -= y;
|
|
262
|
+
}
|
|
263
|
+
if (backgroundColor) painter.fillRoundRect(box, border?.radius ?? 0, { fill: backgroundColor });
|
|
264
|
+
if (border) {
|
|
265
|
+
if (border.fill !== "none") painter.fillRoundRect(box, border.radius, { fill: border.fill });
|
|
266
|
+
painter.strokeRoundRect(box, border.radius, {
|
|
267
|
+
stroke: border.stroke,
|
|
268
|
+
lineWidth: border.strokeWidth
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
});
|
|
308
272
|
}
|
|
309
273
|
/**
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
274
|
+
* Get SVG-compatible text anchor for rotated data labels.
|
|
275
|
+
* @param {number} angle Rotation angle
|
|
276
|
+
* @returns {string} Anchor string
|
|
277
|
+
* @private
|
|
278
|
+
*/
|
|
315
279
|
function getLabelRotateAnchor(angle) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
else if (angle > 190 && angle <= 360) {
|
|
321
|
-
anchor = "start";
|
|
322
|
-
}
|
|
323
|
-
return anchor;
|
|
280
|
+
let anchor = "middle";
|
|
281
|
+
if (angle > 0 && angle <= 170) anchor = "end";
|
|
282
|
+
else if (angle > 190 && angle <= 360) anchor = "start";
|
|
283
|
+
return anchor;
|
|
324
284
|
}
|
|
325
285
|
/**
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
286
|
+
* Map SVG text-anchor to canvas text alignment.
|
|
287
|
+
* @param {string} anchor SVG-compatible anchor
|
|
288
|
+
* @returns {string} Canvas text alignment
|
|
289
|
+
* @private
|
|
290
|
+
*/
|
|
331
291
|
function getCanvasTextAlign(anchor) {
|
|
332
|
-
|
|
292
|
+
return anchor === "start" ? "left" : anchor === "end" ? "right" : "center";
|
|
333
293
|
}
|
|
334
294
|
/**
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
295
|
+
* Resolve rotated data label position using the same offset rules as SVG text.
|
|
296
|
+
* @param {object} $$ ChartInternal instance
|
|
297
|
+
* @param {object} d Data row
|
|
298
|
+
* @param {number} x Label x coordinate
|
|
299
|
+
* @param {number} y Label y coordinate
|
|
300
|
+
* @returns {object} Adjusted label position and alignment
|
|
301
|
+
* @private
|
|
302
|
+
*/
|
|
343
303
|
function getRotatedLabelPosition($$, d, x, y) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
y += isNegative ? -17 : (isCandlestickType ? 13 : 7);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
return {
|
|
383
|
-
x,
|
|
384
|
-
y,
|
|
385
|
-
textAlign: getCanvasTextAlign(anchor)
|
|
386
|
-
};
|
|
304
|
+
const anchor = getLabelRotateAnchor($$.config.data_labels.rotate);
|
|
305
|
+
const isRotated = $$.config.axis_rotated;
|
|
306
|
+
const isInverted = $$.config[`axis_${$$.axis?.getId(d.id)}_inverted`];
|
|
307
|
+
const isCandlestickType = isCanvasCandlestickType($$, d);
|
|
308
|
+
const { value } = d;
|
|
309
|
+
const isNegative = isNumber(value) && value < 0 || isCandlestickType && !$$.getCandlestickData?.(d)?._isUp;
|
|
310
|
+
const gap = 4;
|
|
311
|
+
const doubleGap = gap * 2;
|
|
312
|
+
if (isRotated) {
|
|
313
|
+
if (anchor === "start") {
|
|
314
|
+
x += isNegative ? 0 : doubleGap;
|
|
315
|
+
y += gap;
|
|
316
|
+
} else if (anchor === "middle") {
|
|
317
|
+
x += doubleGap;
|
|
318
|
+
y -= doubleGap;
|
|
319
|
+
} else if (anchor === "end") {
|
|
320
|
+
isNegative && (x -= doubleGap);
|
|
321
|
+
y += gap;
|
|
322
|
+
}
|
|
323
|
+
} else {
|
|
324
|
+
if (anchor === "start") {
|
|
325
|
+
x += gap;
|
|
326
|
+
isNegative && (y += doubleGap * 2);
|
|
327
|
+
} else if (anchor === "middle") y -= doubleGap;
|
|
328
|
+
else if (anchor === "end") {
|
|
329
|
+
x -= gap;
|
|
330
|
+
isNegative && (y += doubleGap * 2);
|
|
331
|
+
}
|
|
332
|
+
if (isInverted) y += isNegative ? -17 : isCandlestickType ? 13 : 7;
|
|
333
|
+
}
|
|
334
|
+
return {
|
|
335
|
+
x,
|
|
336
|
+
y,
|
|
337
|
+
textAlign: getCanvasTextAlign(anchor)
|
|
338
|
+
};
|
|
387
339
|
}
|
|
388
340
|
/**
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
341
|
+
* Resolve point-like data label anchor and canvas text alignment.
|
|
342
|
+
* @param {object} $$ ChartInternal instance
|
|
343
|
+
* @param {CanvasRenderingContext2D} ctx Canvas context
|
|
344
|
+
* @param {object} d Data row
|
|
345
|
+
* @param {number} x Point x coordinate
|
|
346
|
+
* @param {number} y Point y coordinate
|
|
347
|
+
* @returns {object} Label anchor
|
|
348
|
+
* @private
|
|
349
|
+
*/
|
|
398
350
|
function getPointLabelAnchor($$, ctx, d, x, y) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
y -= baseY * 2;
|
|
426
|
-
ctx.textBaseline = "bottom";
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
return { x, y };
|
|
351
|
+
if ($$.config.axis_rotated) {
|
|
352
|
+
x += 6;
|
|
353
|
+
ctx.textAlign = "left";
|
|
354
|
+
ctx.textBaseline = "middle";
|
|
355
|
+
} else if (isCanvasBubbleType($$, d)) {
|
|
356
|
+
ctx.textAlign = "center";
|
|
357
|
+
ctx.textBaseline = "middle";
|
|
358
|
+
} else {
|
|
359
|
+
const { config, state } = $$;
|
|
360
|
+
const isInverted = config[`axis_${$$.axis?.getId(d.id)}_inverted`];
|
|
361
|
+
const isNegative = d.value < 0 || d.value === 0 && !state.hasPositiveValue && state.hasNegativeValue;
|
|
362
|
+
let baseY = 3;
|
|
363
|
+
if (isNumber(config.point_r) && config.point_r > 5 && (isCanvasLineType($$, d) || isCanvasScatterType($$, d))) baseY += config.point_r / 2.3;
|
|
364
|
+
ctx.textAlign = "center";
|
|
365
|
+
if (isInverted ? !isNegative : isNegative) {
|
|
366
|
+
y += baseY;
|
|
367
|
+
ctx.textBaseline = "top";
|
|
368
|
+
} else {
|
|
369
|
+
y -= baseY * 2;
|
|
370
|
+
ctx.textBaseline = "bottom";
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return {
|
|
374
|
+
x,
|
|
375
|
+
y
|
|
376
|
+
};
|
|
430
377
|
}
|
|
431
|
-
|
|
378
|
+
//#endregion
|
|
432
379
|
export { drawLabelDecorations, getCanvasTextAlign, getExpandedFocusMatcher, getLabelBackgroundColor, getLabelBorderOption, getLabelColor, getLabelDecorationBox, getLabelImageOption, getLabelImagePosition, getLabelImageUrl, getLabelPosition, getLabelRotateAnchor, getLabelRowKey, getLabelText, getLabelValue, getPointLabelAnchor, getRotatedLabelPosition };
|