billboard.js 4.1.0-next.2 → 4.1.0
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 +1 -1
- package/dist/billboard.js +268 -107
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +16 -16
- package/dist/billboard.pkgd.js +3198 -1755
- package/dist/billboard.pkgd.min.js +23 -23
- package/dist/billboard.react.js +28 -49
- package/dist/billboard.react.min.js +2 -2
- package/dist/billboard.worker.js +1 -1
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +14 -31
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +14 -31
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +21 -35
- package/dist/plugin/billboardjs-plugin-stanford.min.js +7 -7
- package/dist/plugin/billboardjs-plugin-tableview.js +15 -30
- package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +15 -30
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2959 -1684
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2960 -1685
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2961 -1686
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -18
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2962 -1687
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -11
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2963 -1688
- 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 +1 -1
- package/dist-esm/Chart/api/axis.js +1 -1
- package/dist-esm/Chart/api/category.js +1 -1
- package/dist-esm/Chart/api/chart.js +9 -7
- package/dist-esm/Chart/api/color.js +1 -1
- package/dist-esm/Chart/api/data.js +3 -3
- package/dist-esm/Chart/api/export.js +1 -1
- package/dist-esm/Chart/api/flow.js +1 -1
- package/dist-esm/Chart/api/focus.js +1 -1
- package/dist-esm/Chart/api/grid.js +1 -1
- package/dist-esm/Chart/api/group.js +1 -1
- package/dist-esm/Chart/api/legend.js +1 -1
- package/dist-esm/Chart/api/load.js +1 -1
- package/dist-esm/Chart/api/regions.js +1 -1
- package/dist-esm/Chart/api/selection.js +1 -1
- package/dist-esm/Chart/api/show.js +1 -1
- package/dist-esm/Chart/api/stubs.js +1 -1
- package/dist-esm/Chart/api/subchart.js +1 -1
- package/dist-esm/Chart/api/tooltip.js +1 -1
- package/dist-esm/Chart/api/x.js +11 -9
- package/dist-esm/Chart/api/zoom.js +8 -7
- package/dist-esm/ChartInternal/Axis/Axis.js +7 -6
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +1 -1
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
- package/dist-esm/ChartInternal/ChartInternal.js +32 -8
- package/dist-esm/ChartInternal/data/convert.helper.js +7 -5
- package/dist-esm/ChartInternal/data/convert.js +1 -1
- package/dist-esm/ChartInternal/data/data.js +64 -33
- package/dist-esm/ChartInternal/data/load.js +1 -1
- package/dist-esm/ChartInternal/interactions/drag.js +1 -1
- package/dist-esm/ChartInternal/interactions/eventrect.js +1 -1
- package/dist-esm/ChartInternal/interactions/flow.js +17 -15
- package/dist-esm/ChartInternal/interactions/interaction.js +1 -1
- package/dist-esm/ChartInternal/interactions/subchart.js +8 -6
- package/dist-esm/ChartInternal/interactions/zoom.js +8 -6
- package/dist-esm/ChartInternal/internals/category.js +1 -1
- package/dist-esm/ChartInternal/internals/class.js +1 -1
- package/dist-esm/ChartInternal/internals/clip.js +1 -1
- package/dist-esm/ChartInternal/internals/color.js +1 -1
- package/dist-esm/ChartInternal/internals/domain.js +13 -9
- package/dist-esm/ChartInternal/internals/format.js +5 -3
- package/dist-esm/ChartInternal/internals/grid.js +5 -4
- package/dist-esm/ChartInternal/internals/legend.js +8 -7
- package/dist-esm/ChartInternal/internals/redraw.js +2 -2
- package/dist-esm/ChartInternal/internals/region.js +1 -1
- package/dist-esm/ChartInternal/internals/scale.js +1 -1
- package/dist-esm/ChartInternal/internals/selection.js +1 -1
- package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
- package/dist-esm/ChartInternal/internals/size.js +56 -10
- package/dist-esm/ChartInternal/internals/style.js +1 -1
- package/dist-esm/ChartInternal/internals/subchart.util.js +1 -1
- package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
- package/dist-esm/ChartInternal/internals/text.js +12 -9
- package/dist-esm/ChartInternal/internals/text.util.js +4 -4
- package/dist-esm/ChartInternal/internals/title.js +3 -2
- package/dist-esm/ChartInternal/internals/tooltip.js +25 -20
- package/dist-esm/ChartInternal/internals/transform.js +1 -1
- package/dist-esm/ChartInternal/internals/type.js +1 -1
- package/dist-esm/ChartInternal/shape/arc.js +3 -2
- package/dist-esm/ChartInternal/shape/area.js +3 -2
- package/dist-esm/ChartInternal/shape/bar.js +1 -1
- package/dist-esm/ChartInternal/shape/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
- package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
- package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
- package/dist-esm/ChartInternal/shape/core/path.js +1 -1
- package/dist-esm/ChartInternal/shape/core/point.js +1 -1
- package/dist-esm/ChartInternal/shape/core/treemap.js +3 -2
- package/dist-esm/ChartInternal/shape/funnel.js +1 -1
- package/dist-esm/ChartInternal/shape/gauge.js +1 -1
- package/dist-esm/ChartInternal/shape/line.js +3 -2
- package/dist-esm/ChartInternal/shape/point.js +1 -1
- package/dist-esm/ChartInternal/shape/polar.js +1 -1
- package/dist-esm/ChartInternal/shape/radar.js +1 -1
- package/dist-esm/ChartInternal/shape/shape.js +3 -2
- package/dist-esm/ChartInternal/shape/treemap.js +1 -1
- package/dist-esm/canvas/CanvasAxisRenderer.js +27 -21
- package/dist-esm/canvas/CanvasEngine.js +1 -1
- package/dist-esm/canvas/CanvasPainter.js +1 -1
- package/dist-esm/canvas/CanvasRenderer.js +1 -1
- package/dist-esm/canvas/CanvasTheme.js +7 -8
- package/dist-esm/canvas/HitDetector.js +1 -1
- package/dist-esm/canvas/axisTicks.js +3 -2
- package/dist-esm/canvas/classes.js +1 -1
- package/dist-esm/canvas/color.js +1 -1
- package/dist-esm/canvas/geometry.js +1 -1
- package/dist-esm/canvas/labels.js +4 -4
- package/dist-esm/canvas/pointPattern.js +1 -1
- package/dist-esm/canvas/util.js +1 -1
- package/dist-esm/config/Options/Options.js +1 -1
- package/dist-esm/config/Options/axis/axis.js +1 -1
- package/dist-esm/config/Options/axis/x.js +1 -1
- package/dist-esm/config/Options/axis/y.js +1 -1
- package/dist-esm/config/Options/axis/y2.js +1 -13
- package/dist-esm/config/Options/common/boost.js +1 -1
- package/dist-esm/config/Options/common/color.js +1 -1
- package/dist-esm/config/Options/common/grid.js +1 -1
- package/dist-esm/config/Options/common/legend.js +1 -1
- package/dist-esm/config/Options/common/main.js +44 -2
- package/dist-esm/config/Options/common/point.js +1 -1
- package/dist-esm/config/Options/common/title.js +1 -1
- package/dist-esm/config/Options/common/tooltip.js +1 -1
- package/dist-esm/config/Options/data/axis.js +1 -1
- package/dist-esm/config/Options/data/data.js +1 -1
- package/dist-esm/config/Options/data/selection.js +1 -1
- package/dist-esm/config/Options/interaction/interaction.js +1 -1
- package/dist-esm/config/Options/interaction/subchart.js +1 -1
- package/dist-esm/config/Options/interaction/zoom.js +1 -1
- package/dist-esm/config/Options/shape/arc.js +1 -1
- package/dist-esm/config/Options/shape/area.js +1 -1
- package/dist-esm/config/Options/shape/bar.js +1 -1
- package/dist-esm/config/Options/shape/bubble.js +1 -1
- package/dist-esm/config/Options/shape/candlestick.js +1 -1
- package/dist-esm/config/Options/shape/donut.js +1 -1
- package/dist-esm/config/Options/shape/funnel.js +1 -1
- package/dist-esm/config/Options/shape/gauge.js +1 -1
- package/dist-esm/config/Options/shape/line.js +1 -1
- package/dist-esm/config/Options/shape/pie.js +1 -1
- package/dist-esm/config/Options/shape/polar.js +1 -1
- package/dist-esm/config/Options/shape/radar.js +1 -1
- package/dist-esm/config/Options/shape/scatter.js +1 -1
- package/dist-esm/config/Options/shape/spline.js +1 -1
- package/dist-esm/config/Options/shape/treemap.js +1 -1
- package/dist-esm/config/Store/Element.js +1 -1
- package/dist-esm/config/Store/State.js +4 -1
- package/dist-esm/config/Store/Store.js +1 -1
- package/dist-esm/config/classes.js +1 -1
- package/dist-esm/config/config.js +1 -1
- package/dist-esm/config/const.js +1 -1
- package/dist-esm/config/resolver/axis.core.js +1 -1
- package/dist-esm/config/resolver/axis.js +1 -1
- package/dist-esm/config/resolver/canvas.js +17 -12
- package/dist-esm/config/resolver/canvasShape.js +1 -1
- package/dist-esm/config/resolver/category.js +1 -1
- package/dist-esm/config/resolver/export.js +1 -1
- package/dist-esm/config/resolver/flow.js +1 -1
- package/dist-esm/config/resolver/grid.js +1 -1
- package/dist-esm/config/resolver/interaction/selection.js +1 -1
- package/dist-esm/config/resolver/interaction/subchart.js +1 -1
- package/dist-esm/config/resolver/interaction/zoom.js +1 -1
- package/dist-esm/config/resolver/regions.js +1 -1
- package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/area.js +1 -1
- package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/bar.js +1 -1
- package/dist-esm/config/resolver/shape/bubble.js +1 -1
- package/dist-esm/config/resolver/shape/candlestick.js +1 -1
- package/dist-esm/config/resolver/shape/donut.js +1 -1
- package/dist-esm/config/resolver/shape/funnel.js +1 -1
- package/dist-esm/config/resolver/shape/gauge.js +1 -1
- package/dist-esm/config/resolver/shape/line.js +1 -1
- package/dist-esm/config/resolver/shape/pie.js +1 -1
- package/dist-esm/config/resolver/shape/polar.js +1 -1
- package/dist-esm/config/resolver/shape/radar.js +1 -1
- package/dist-esm/config/resolver/shape/scatter.js +1 -1
- package/dist-esm/config/resolver/shape/treemap.js +1 -1
- package/dist-esm/core.js +5 -4
- package/dist-esm/index.canvas.js +1 -1
- package/dist-esm/index.esm.js +1 -1
- package/dist-esm/module/Cache.js +2 -2
- package/dist-esm/module/browser.js +2 -2
- package/dist-esm/module/dsv.js +1 -1
- package/dist-esm/module/error.js +1 -1
- package/dist-esm/module/generator.js +16 -3
- package/dist-esm/module/sanitize.js +1 -1
- package/dist-esm/module/util/brush.js +1 -1
- package/dist-esm/module/util/dom.js +9 -7
- package/dist-esm/module/util/object.js +1 -1
- package/dist-esm/module/util/type-checks.js +1 -1
- package/dist-esm/module/worker.js +1 -1
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -40
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +4 -41
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist-esm/react/index.js +1 -1
- package/package.json +36 -36
- package/src/Chart/api/chart.ts +1 -0
- package/src/Chart/api/data.ts +5 -3
- package/src/ChartInternal/ChartInternal.ts +72 -25
- package/src/ChartInternal/data/data.ts +68 -34
- package/src/ChartInternal/internals/redraw.ts +8 -1
- package/src/ChartInternal/internals/size.ts +99 -2
- package/src/config/Options/axis/y2.ts +0 -13
- package/src/config/Options/common/main.ts +43 -1
- package/src/config/Store/State.ts +4 -0
- package/src/config/const.ts +4 -0
- package/src/config/resolver/canvas.ts +3 -0
- package/src/module/Cache.ts +1 -1
- package/src/module/generator.ts +27 -2
- package/types/options.d.ts +38 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isFunction, isNumber, isObject, isString } from "../../module/util/type-checks.js";
|
|
11
11
|
import { capitalize, getRandom } from "../../module/util/object.js";
|
|
@@ -265,11 +265,13 @@ var text_default = {
|
|
|
265
265
|
const isFunnelType = $$.isFunnelType(d);
|
|
266
266
|
const isTreemapType = $$.isTreemapType(d);
|
|
267
267
|
let xPos = points ? points[0][0] : 0;
|
|
268
|
-
if ($$.isCandlestickType(d))
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
else
|
|
272
|
-
|
|
268
|
+
if ($$.isCandlestickType(d)) {
|
|
269
|
+
if (isRotated) xPos = $$.getCandlestickData(d)?._isUp ? points[2][2] + 4 : points[2][1] - 4;
|
|
270
|
+
else xPos += (points[1][0] - xPos) / 2;
|
|
271
|
+
} else if (isFunnelType) {
|
|
272
|
+
if (points) xPos = points[2]?.[0] ?? xPos;
|
|
273
|
+
else return getElementPos(textElement, "x");
|
|
274
|
+
} else if (isTreemapType) xPos += config.data_labels.centered ? 0 : 5;
|
|
273
275
|
else if (isRotated) {
|
|
274
276
|
const isInverted = config[`axis_${$$.axis.getId(d.id)}_inverted`];
|
|
275
277
|
const padding = $$.isBarType(d) ? 4 : 6;
|
|
@@ -311,9 +313,10 @@ var text_default = {
|
|
|
311
313
|
yPos = value && value._isUp ? points[2][2] - baseY : points[2][1] + baseY * 4;
|
|
312
314
|
if (isInverted) yPos += 15 * (value._isUp ? 1 : -1);
|
|
313
315
|
}
|
|
314
|
-
} else if (isFunnelType)
|
|
315
|
-
|
|
316
|
-
|
|
316
|
+
} else if (isFunnelType) {
|
|
317
|
+
if (points) yPos = (points[2]?.[1] ?? points[0][1]) + rect.height / 2 - 3;
|
|
318
|
+
else return getElementPos(textElement, "y");
|
|
319
|
+
} else if (isTreemapType) yPos = points[0][1] + (config.data_labels.centered ? 0 : rect.height + 5);
|
|
317
320
|
else if (isRotated) yPos = (points[0][0] + points[2][0] + rect.height * .6) / 2;
|
|
318
321
|
else {
|
|
319
322
|
yPos = points[2][1];
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isFunction, isNumber } from "../../module/util/type-checks.js";
|
|
11
11
|
import { parseShorthand, toMap, tplProcess } from "../../module/util/object.js";
|
|
@@ -48,7 +48,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
48
48
|
const isNegative = isNumber(value) && value < 0 || isCandlestickType && !$$.getCandlestickData(d)?._isUp;
|
|
49
49
|
let { x, y } = pos;
|
|
50
50
|
const gap = 4;
|
|
51
|
-
const doubleGap =
|
|
51
|
+
const doubleGap = 8;
|
|
52
52
|
if (isRotated) {
|
|
53
53
|
if (anchor === "start") {
|
|
54
54
|
x += isNegative ? 0 : doubleGap;
|
|
@@ -63,11 +63,11 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
63
63
|
} else {
|
|
64
64
|
if (anchor === "start") {
|
|
65
65
|
x += gap;
|
|
66
|
-
isNegative && (y +=
|
|
66
|
+
isNegative && (y += 16);
|
|
67
67
|
} else if (anchor === "middle") y -= doubleGap;
|
|
68
68
|
else if (anchor === "end") {
|
|
69
69
|
x -= gap;
|
|
70
|
-
isNegative && (y +=
|
|
70
|
+
isNegative && (y += 16);
|
|
71
71
|
}
|
|
72
72
|
if (isInverted) y += isNegative ? -17 : isCandlestickType ? 13 : 7;
|
|
73
73
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isNumber } from "../../module/util/type-checks.js";
|
|
11
11
|
import { getBBox, getBoundingRect, getElementPos, setTextValue } from "../../module/util/dom.js";
|
|
@@ -63,7 +63,8 @@ var title_default = {
|
|
|
63
63
|
const { config, $el } = this;
|
|
64
64
|
if (config.title_text) {
|
|
65
65
|
$el.title = $el.svg.append("g");
|
|
66
|
-
|
|
66
|
+
const text = $el.title.append("text").style("text-anchor", _getTextXPos(config.title_position)).attr("class", $TEXT.title);
|
|
67
|
+
setTextValue(text, config.title_text, [.3, 1.5]);
|
|
67
68
|
}
|
|
68
69
|
},
|
|
69
70
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { document as doc } from "../../module/browser.js";
|
|
11
11
|
import { isEmpty, isFunction, isObject, isString, isUndefined, isValue } from "../../module/util/type-checks.js";
|
|
@@ -83,8 +83,10 @@ var tooltip_default = {
|
|
|
83
83
|
const boundValueFn = isFunction(valueFn) ? valueFn.bind(api) : null;
|
|
84
84
|
const valueFormat = (v, ratio, id, index) => {
|
|
85
85
|
let fn = boundValueFn;
|
|
86
|
-
if (!fn)
|
|
87
|
-
|
|
86
|
+
if (!fn) {
|
|
87
|
+
if (state.hasTreemap || $$.isStackNormalized() && (!$$.isStackNormalizedPerGroup() || $$.isGrouped(id))) fn = (v, ratio) => `${(ratio * 100).toFixed(2)}%`;
|
|
88
|
+
else fn = defaultValueFormat;
|
|
89
|
+
}
|
|
88
90
|
return fn(v, ratio, id, index);
|
|
89
91
|
};
|
|
90
92
|
const order = config.tooltip_order;
|
|
@@ -118,8 +120,8 @@ var tooltip_default = {
|
|
|
118
120
|
let row;
|
|
119
121
|
let param;
|
|
120
122
|
let value;
|
|
121
|
-
let i;
|
|
122
|
-
for (
|
|
123
|
+
let i = 0;
|
|
124
|
+
for (; i < len; i++) {
|
|
123
125
|
row = d[i];
|
|
124
126
|
const rowValue = row && getRowValue(row);
|
|
125
127
|
if (!row || !(rowValue || rowValue === 0)) continue;
|
|
@@ -253,12 +255,14 @@ var tooltip_default = {
|
|
|
253
255
|
const size = getTransformCTM(target, 20, 0, false).x;
|
|
254
256
|
let top = ctm.y;
|
|
255
257
|
let left = ctm.x + tWidth / 2 + size;
|
|
256
|
-
if (hasArcType)
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
258
|
+
if (hasArcType) {
|
|
259
|
+
if (state.hasFunnel || state.hasTreemap || state.hasRadar) {
|
|
260
|
+
left -= tWidth / 2 + size;
|
|
261
|
+
top += tHeight;
|
|
262
|
+
} else {
|
|
263
|
+
top += rect.height / 2;
|
|
264
|
+
left += rect.width / 2 - (tWidth - size);
|
|
265
|
+
}
|
|
262
266
|
}
|
|
263
267
|
if (left + tWidth > rect.width) left = rect.width - tWidth - size;
|
|
264
268
|
if (top + tHeight > rect.height) top -= tHeight * 2;
|
|
@@ -311,7 +315,7 @@ var tooltip_default = {
|
|
|
311
315
|
y += padding.top - 5;
|
|
312
316
|
}
|
|
313
317
|
}
|
|
314
|
-
if (x + tWidth + 15 > chartRight) x -= tWidth + (hasFunnel || hasTreemap || hasArcType ? 0 : isRotated ?
|
|
318
|
+
if (x + tWidth + 15 > chartRight) x -= tWidth + (hasFunnel || hasTreemap || hasArcType ? 0 : isRotated ? 40 : 38);
|
|
315
319
|
if (y + tHeight > current.height) {
|
|
316
320
|
const gap = hasTreemap ? tHeight + 10 : 30;
|
|
317
321
|
y -= hasGauge ? tHeight * 1.5 : tHeight + gap;
|
|
@@ -439,16 +443,17 @@ var tooltip_default = {
|
|
|
439
443
|
if ($$.state.isCanvasMode) return;
|
|
440
444
|
if (tooltip?.style("display") === "block" && event) {
|
|
441
445
|
const rect = context ?? (hasRadar ? svg : eventRect)?.node();
|
|
442
|
-
if (hasAxis || hasRadar)
|
|
443
|
-
|
|
444
|
-
const idx = index ?? $$.getDataIndexFromEvent(event);
|
|
445
|
-
if (index === -1) $$.api.tooltip.hide();
|
|
446
|
+
if (hasAxis || hasRadar) {
|
|
447
|
+
if ($$.isMultipleX()) $$.selectRectForMultipleXs(rect, false);
|
|
446
448
|
else {
|
|
447
|
-
$$.
|
|
448
|
-
|
|
449
|
+
const idx = index ?? $$.getDataIndexFromEvent(event);
|
|
450
|
+
if (index === -1) $$.api.tooltip.hide();
|
|
451
|
+
else {
|
|
452
|
+
$$.selectRectForSingle(rect, idx);
|
|
453
|
+
$$.setExpand(idx, null, true);
|
|
454
|
+
}
|
|
449
455
|
}
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
456
|
+
} else {
|
|
452
457
|
const { clientX, clientY } = event;
|
|
453
458
|
setTimeout(() => {
|
|
454
459
|
let target = [clientX, clientY].every(Number.isFinite) && doc.elementFromPoint(clientX, clientY);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { TYPE, TYPE_BY_CATEGORY } from "../../config/const.js";
|
|
11
11
|
import { isArray, isNumber, isString } from "../../module/util/type-checks.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { document as doc } from "../../module/browser.js";
|
|
11
11
|
import { isDefined, isFunction, isNumber, isObject, isUndefined } from "../../module/util/type-checks.js";
|
|
@@ -446,7 +446,8 @@ var arc_default = {
|
|
|
446
446
|
};
|
|
447
447
|
if (meetsThreshold) {
|
|
448
448
|
const { value } = updated || d;
|
|
449
|
-
|
|
449
|
+
const text = ($$.getArcLabelConfig("format") || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString();
|
|
450
|
+
setTextValue(node, text, [-1, 1], hasGauge);
|
|
450
451
|
} else node.text("");
|
|
451
452
|
});
|
|
452
453
|
},
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { getRandom } from "../../module/util/object.js";
|
|
11
11
|
import { $AREA, $CIRCLE, $LINE } from "../../config/classes.js";
|
|
@@ -76,7 +76,8 @@ var area_default = {
|
|
|
76
76
|
* @private
|
|
77
77
|
*/
|
|
78
78
|
generateDrawArea(areaIndices, isSub) {
|
|
79
|
-
|
|
79
|
+
const $$ = this;
|
|
80
|
+
return generateDrawAreaPath($$, areaIndices, isSub);
|
|
80
81
|
}
|
|
81
82
|
};
|
|
82
83
|
//#endregion
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isFunction, isNumber, isObject } from "../../../module/util/type-checks.js";
|
|
11
11
|
import { getMinMax } from "../../../module/util/object.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isArray, isNumber, isObject } from "../../../module/util/type-checks.js";
|
|
11
11
|
//#region src/ChartInternal/shape/core/candlestick.ts
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isUndefined, isValue } from "../../../module/util/type-checks.js";
|
|
11
11
|
import { parseDate } from "../../../module/util/object.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { document as doc } from "../../../module/browser.js";
|
|
11
11
|
import { isFunction, isObjectType, notEmpty } from "../../../module/util/type-checks.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { hierarchy, treemap, treemapBinary, treemapDice, treemapResquarify, treemapSlice, treemapSliceDice, treemapSquarify } from "d3-hierarchy";
|
|
11
11
|
//#region src/ChartInternal/shape/core/treemap.ts
|
|
@@ -86,7 +86,8 @@ var treemap_default = {
|
|
|
86
86
|
*/
|
|
87
87
|
getTreemapRoot(targets) {
|
|
88
88
|
const $$ = this;
|
|
89
|
-
const
|
|
89
|
+
const data = $$.getTreemapData(targets ?? $$.data.targets);
|
|
90
|
+
const hierarchyData = hierarchy(data).sum((d) => d.value);
|
|
90
91
|
const sortFn = $$.getSortCompareFn(true);
|
|
91
92
|
if (!$$.treemap) $$.initTreemapLayout();
|
|
92
93
|
return $$.treemap(sortFn ? hierarchyData.sort(sortFn) : hierarchyData);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isFunction } from "../../module/util/type-checks.js";
|
|
11
11
|
import { $ARC, $COMMON, $GAUGE } from "../../config/classes.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isArray, isUndefined, isValue } from "../../module/util/type-checks.js";
|
|
11
11
|
import { getRandom } from "../../module/util/object.js";
|
|
@@ -100,7 +100,8 @@ var line_default = {
|
|
|
100
100
|
return [$T(line, withTransition, getRandom()).attr("d", drawFn).style("stroke", this.color).style("opacity", null)];
|
|
101
101
|
},
|
|
102
102
|
generateDrawLine(lineIndices, isSub) {
|
|
103
|
-
|
|
103
|
+
const $$ = this;
|
|
104
|
+
return generateDrawLinePath($$, lineIndices, isSub);
|
|
104
105
|
},
|
|
105
106
|
/**
|
|
106
107
|
* Set regions dasharray and get path
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isObject, isUndefined, isValue } from "../../module/util/type-checks.js";
|
|
11
11
|
import { getRandom } from "../../module/util/object.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { isDefined, isEmpty, isNumber, isUndefined } from "../../module/util/type-checks.js";
|
|
11
11
|
import { getMinMax, getRange, toArray } from "../../module/util/object.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { TYPE } from "../../config/const.js";
|
|
11
11
|
import { isFunction, isNumber, isObjectType, isUndefined, isValue, notEmpty } from "../../module/util/type-checks.js";
|
|
@@ -97,7 +97,8 @@ function getSubchartCandlestickShapeValue($$, d, isSub) {
|
|
|
97
97
|
* @private
|
|
98
98
|
*/
|
|
99
99
|
function isSubchartCandlestickBarValue($$, d, isSub) {
|
|
100
|
-
|
|
100
|
+
const value = getSubchartCandlestickShapeValue($$, d, isSub);
|
|
101
|
+
return isNumber(value) && $$.isBarType(d);
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
104
|
* Get subchart bar color projected from candlestick up/down state.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { getFontSize } from "./util.js";
|
|
11
11
|
import { getAdditionalAxisScale, getAdditionalAxisTickFormat, getAdditionalAxisTickValues, getSubXTickLineValues, getSubXTickValues, getXScale, getXTickLinePosition, getXTickLineValues, getXTickValues, getYGridTickValues, getYTickValues, isSameTickValue, normalizeXValue, normalizeYValue } from "./axisTicks.js";
|
|
@@ -82,7 +82,7 @@ function getHorizontalXAxisClipRect(margin, width, height) {
|
|
|
82
82
|
return {
|
|
83
83
|
x: margin.left - X_AXIS_TICK_TEXT_HORIZONTAL_CLIP_PADDING,
|
|
84
84
|
y: 0,
|
|
85
|
-
w: width +
|
|
85
|
+
w: width + 40,
|
|
86
86
|
h: height
|
|
87
87
|
};
|
|
88
88
|
}
|
|
@@ -99,7 +99,7 @@ function getRotatedXAxisClipRect(margin, width, height) {
|
|
|
99
99
|
x: 0,
|
|
100
100
|
y: margin.top - X_AXIS_TICK_TEXT_VERTICAL_CLIP_PADDING,
|
|
101
101
|
w: width,
|
|
102
|
-
h: height +
|
|
102
|
+
h: height + 30
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
@@ -615,12 +615,14 @@ var CanvasAxisRenderer = class {
|
|
|
615
615
|
painter.strokePath(() => {
|
|
616
616
|
if (isRotated) painter.traceLine(x, y1, x, y2);
|
|
617
617
|
else painter.traceLine(x1, y, x2, y);
|
|
618
|
-
if (outerTick)
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
618
|
+
if (outerTick) {
|
|
619
|
+
if (isRotated) {
|
|
620
|
+
painter.traceLine(x, y1, x + 6 * outerTickDirection, y1);
|
|
621
|
+
painter.traceLine(x, y2, x + 6 * outerTickDirection, y2);
|
|
622
|
+
} else {
|
|
623
|
+
painter.traceLine(x1, y, x1, y + 6 * outerTickDirection);
|
|
624
|
+
painter.traceLine(x2, y, x2, y + 6 * outerTickDirection);
|
|
625
|
+
}
|
|
624
626
|
}
|
|
625
627
|
});
|
|
626
628
|
const tickFont = getAxisTickFont(axis, "x");
|
|
@@ -995,12 +997,14 @@ var CanvasAxisRenderer = class {
|
|
|
995
997
|
painter.strokePath(() => {
|
|
996
998
|
if (isRotated) painter.traceLine(x, y1, x, y2);
|
|
997
999
|
else painter.traceLine(x1, y, x2, y);
|
|
998
|
-
if (outerTick)
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1000
|
+
if (outerTick) {
|
|
1001
|
+
if (isRotated) {
|
|
1002
|
+
painter.traceLine(x, y1, x + 6 * outerTickDirection, y1);
|
|
1003
|
+
painter.traceLine(x, y2, x + 6 * outerTickDirection, y2);
|
|
1004
|
+
} else {
|
|
1005
|
+
painter.traceLine(x1, y, x1, y + 6 * outerTickDirection);
|
|
1006
|
+
painter.traceLine(x2, y, x2, y + 6 * outerTickDirection);
|
|
1007
|
+
}
|
|
1004
1008
|
}
|
|
1005
1009
|
});
|
|
1006
1010
|
ctx.font = getAxisTickFont(axis, "x");
|
|
@@ -1242,12 +1246,14 @@ var CanvasAxisRenderer = class {
|
|
|
1242
1246
|
painter.strokePath(() => {
|
|
1243
1247
|
if (isRotated) painter.traceLine(x1, y, x2, y);
|
|
1244
1248
|
else painter.traceLine(x, y1, x, y2);
|
|
1245
|
-
if (outerTick)
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1249
|
+
if (outerTick) {
|
|
1250
|
+
if (isRotated) {
|
|
1251
|
+
painter.traceLine(x1, y, x1, y + 6 * outerTickDirection);
|
|
1252
|
+
painter.traceLine(x2, y, x2, y + 6 * outerTickDirection);
|
|
1253
|
+
} else {
|
|
1254
|
+
painter.traceLine(x, y1, x + 6 * outerTickDirection, y1);
|
|
1255
|
+
painter.traceLine(x, y2, x + 6 * outerTickDirection, y2);
|
|
1256
|
+
}
|
|
1251
1257
|
}
|
|
1252
1258
|
});
|
|
1253
1259
|
const tickFont = getAxisTickFont(axis, id);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { SUBCHART_BRUSH_HANDLE_PATH, TYPE } from "../config/const.js";
|
|
11
11
|
import { window as win } from "../module/browser.js";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1.0
|
|
8
|
+
* @version 4.1.0
|
|
9
9
|
*/
|
|
10
10
|
import { document as doc, window as win } from "../module/browser.js";
|
|
11
11
|
import { mergeObj } from "../module/util/object.js";
|
|
@@ -562,12 +562,10 @@ function applySelectorStyle(target, selector, style) {
|
|
|
562
562
|
font: readFontValue(style)
|
|
563
563
|
});
|
|
564
564
|
break;
|
|
565
|
-
case ".bb-title":
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
});
|
|
570
|
-
break;
|
|
565
|
+
case ".bb-title": mergeThemeSection(target, "title", {
|
|
566
|
+
color: readColorValue(style, "fill"),
|
|
567
|
+
font: readFontValue(style)
|
|
568
|
+
});
|
|
571
569
|
}
|
|
572
570
|
}
|
|
573
571
|
/**
|
|
@@ -883,7 +881,8 @@ var CanvasTheme = class {
|
|
|
883
881
|
color: toColor(title.fill, "#000")
|
|
884
882
|
}
|
|
885
883
|
};
|
|
886
|
-
const
|
|
884
|
+
const themeOverride = getThemeOverride(userOverride);
|
|
885
|
+
const style = mergeObj(defaultStyle, themeOverride);
|
|
887
886
|
const userAxisOverride = userOverride?.axis;
|
|
888
887
|
const hasUserAxisLabelColor = !!userAxisOverride && Object.prototype.hasOwnProperty.call(userAxisOverride, "labelColor");
|
|
889
888
|
const hasUserAxisLabelFont = !!userAxisOverride && Object.prototype.hasOwnProperty.call(userAxisOverride, "labelFont");
|