billboard.js 3.15.0 → 3.16.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 +1 -1
- package/dist/billboard.js +226 -39
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +9 -9
- package/dist/billboard.pkgd.js +2916 -1493
- package/dist/billboard.pkgd.min.js +19 -19
- 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 +12 -9
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +12 -9
- package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.js +10 -8
- package/dist/plugin/billboardjs-plugin-tableview.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-textoverlap.js +10 -8
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2692 -1456
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +4 -4
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2703 -1464
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -7
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2704 -1465
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2703 -1465
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +7 -7
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2704 -1466
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +7 -7
- 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/billboard.js +224 -46
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +4 -3
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +4 -3
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +25 -25
- package/src/Chart/api/category.ts +1 -1
- package/src/Chart/api/chart.ts +12 -0
- package/src/Chart/api/export.ts +1 -1
- package/src/ChartInternal/Axis/Axis.ts +2 -1
- package/src/ChartInternal/Axis/AxisRenderer.ts +2 -1
- package/src/ChartInternal/ChartInternal.ts +1 -1
- package/src/ChartInternal/data/data.ts +10 -0
- package/src/ChartInternal/interactions/interaction.ts +1 -1
- package/src/ChartInternal/internals/color.ts +2 -2
- package/src/ChartInternal/internals/domain.ts +5 -1
- package/src/ChartInternal/internals/style.ts +1 -1
- package/src/ChartInternal/internals/text.ts +1 -1
- package/src/ChartInternal/shape/bar.ts +113 -14
- package/src/ChartInternal/shape/candlestick.ts +1 -1
- package/src/ChartInternal/shape/funnel.ts +1 -1
- package/src/ChartInternal/shape/line.ts +6 -2
- package/src/ChartInternal/shape/point.ts +10 -7
- package/src/ChartInternal/shape/radar.ts +1 -1
- package/src/ChartInternal/shape/shape.ts +1 -1
- package/src/ChartInternal/shape/treemap.ts +1 -1
- package/src/config/Options/axis/x.ts +22 -1
- package/src/config/Options/axis/y.ts +20 -0
- package/src/config/Options/axis/y2.ts +33 -0
- package/src/config/Options/common/main.ts +1 -1
- package/src/config/Options/shape/bar.ts +1 -0
- package/src/config/Store/State.ts +2 -1
- package/src/config/classes.ts +2 -1
- package/src/core.ts +2 -2
- package/src/module/util.ts +9 -7
- package/types/axis.d.ts +12 -0
- package/types/chart.d.ts +10 -0
- package/types/options.shape.d.ts +6 -0
package/dist/billboard.css
CHANGED
package/dist/billboard.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.16.0-next.1
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -268,7 +268,8 @@ const $BAR = {
|
|
|
268
268
|
bar: "bb-bar",
|
|
269
269
|
bars: "bb-bars",
|
|
270
270
|
chartBar: "bb-chart-bar",
|
|
271
|
-
chartBars: "bb-chart-bars"
|
|
271
|
+
chartBars: "bb-chart-bars",
|
|
272
|
+
barConnectLine: "bb-bar-connectLine"
|
|
272
273
|
};
|
|
273
274
|
const $CANDLESTICK = {
|
|
274
275
|
candlestick: "bb-candlestick",
|
|
@@ -858,7 +859,7 @@ const $ZOOM = {
|
|
|
858
859
|
* }
|
|
859
860
|
*/
|
|
860
861
|
resize_auto: true,
|
|
861
|
-
resize_timer:
|
|
862
|
+
resize_timer: false,
|
|
862
863
|
/**
|
|
863
864
|
* Set a callback to execute when the chart is clicked.
|
|
864
865
|
* @name onclick
|
|
@@ -2571,12 +2572,14 @@ function mergeObj(target, ...objectN) {
|
|
|
2571
2572
|
const source = objectN.shift();
|
|
2572
2573
|
if (isObject(target) && isObject(source)) {
|
|
2573
2574
|
Object.keys(source).forEach((key) => {
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2575
|
+
if (!/^(__proto__|constructor|prototype)$/i.test(key)) {
|
|
2576
|
+
const value = source[key];
|
|
2577
|
+
if (isObject(value)) {
|
|
2578
|
+
!target[key] && (target[key] = {});
|
|
2579
|
+
target[key] = mergeObj(target[key], value);
|
|
2580
|
+
} else {
|
|
2581
|
+
target[key] = isArray(value) ? value.concat() : value;
|
|
2582
|
+
}
|
|
2580
2583
|
}
|
|
2581
2584
|
});
|
|
2582
2585
|
}
|
|
@@ -2927,8 +2930,10 @@ class State {
|
|
|
2927
2930
|
},
|
|
2928
2931
|
// current used chart type list
|
|
2929
2932
|
types: [],
|
|
2930
|
-
needle: void 0
|
|
2933
|
+
needle: void 0,
|
|
2931
2934
|
// arc needle current value
|
|
2935
|
+
zoomDomain: null
|
|
2936
|
+
// zoomed domain value
|
|
2932
2937
|
},
|
|
2933
2938
|
// legend
|
|
2934
2939
|
isLegendRight: false,
|
|
@@ -4141,6 +4146,12 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4141
4146
|
filterByX(targets, x) {
|
|
4142
4147
|
return mergeArray(targets.map((t) => t.values)).filter((v) => v.x - x === 0);
|
|
4143
4148
|
},
|
|
4149
|
+
filterNullish(data) {
|
|
4150
|
+
const filter = (v) => isValue(v.value);
|
|
4151
|
+
return data ? data.filter(
|
|
4152
|
+
(v) => "value" in v ? filter(v) : v.values.some(filter)
|
|
4153
|
+
) : data;
|
|
4154
|
+
},
|
|
4144
4155
|
filterRemoveNull(data) {
|
|
4145
4156
|
return data.filter((d) => isValue(this.getBaseValue(d)));
|
|
4146
4157
|
},
|
|
@@ -4645,7 +4656,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
4645
4656
|
if (isArcishData || d !== -1) {
|
|
4646
4657
|
const callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
|
|
4647
4658
|
config.color_onover && $$.setOverColor(isOver, d, isArcishData);
|
|
4648
|
-
if (isArcishData
|
|
4659
|
+
if (isArcishData) {
|
|
4649
4660
|
const suffix = $$.getTargetSelectorSuffix(d.id);
|
|
4650
4661
|
const selector = hasFunnel || hasTreemap ? `${$COMMON.target + suffix} .${$SHAPE.shape}` : $ARC.arc + suffix;
|
|
4651
4662
|
callback(d, main.select(`.${selector}`).node());
|
|
@@ -4977,8 +4988,6 @@ const schemeCategory10 = [
|
|
|
4977
4988
|
generateColor() {
|
|
4978
4989
|
const $$ = this;
|
|
4979
4990
|
const { $el, config } = $$;
|
|
4980
|
-
const colors = config.data_colors;
|
|
4981
|
-
const callback = config.data_color;
|
|
4982
4991
|
const ids = [];
|
|
4983
4992
|
let pattern = notEmpty(config.color_pattern) ? config.color_pattern : (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleOrdinal)(getColorFromCss($el.chart) || schemeCategory10).range();
|
|
4984
4993
|
const originalColorPattern = pattern;
|
|
@@ -4994,6 +5003,8 @@ const schemeCategory10 = [
|
|
|
4994
5003
|
}
|
|
4995
5004
|
return function(d) {
|
|
4996
5005
|
var _a;
|
|
5006
|
+
const colors = config.data_colors;
|
|
5007
|
+
const callback = config.data_color;
|
|
4997
5008
|
const id = d.id || ((_a = d.data) == null ? void 0 : _a.id) || d;
|
|
4998
5009
|
const isLine = $$.isTypeOf(id, ["line", "spline", "step"]) || !config.data_types[id];
|
|
4999
5010
|
let color;
|
|
@@ -5254,7 +5265,10 @@ const schemeCategory10 = [
|
|
|
5254
5265
|
}
|
|
5255
5266
|
if (showHorizontalDataLabel) {
|
|
5256
5267
|
const diff = diffDomain(scale.y.range());
|
|
5257
|
-
const ratio = $$.getDataLabelLength(yDomainMin, yDomainMax, "width").map((v) =>
|
|
5268
|
+
const ratio = $$.getDataLabelLength(yDomainMin, yDomainMax, "width").map((v) => {
|
|
5269
|
+
const result = v / diff;
|
|
5270
|
+
return isFinite(result) ? result : 0;
|
|
5271
|
+
});
|
|
5258
5272
|
["bottom", "top"].forEach((v, i) => {
|
|
5259
5273
|
padding[v] += domainLength * (ratio[i] / (1 - ratio[0] - ratio[1]));
|
|
5260
5274
|
});
|
|
@@ -7014,7 +7028,7 @@ function getTextPos(d, type) {
|
|
|
7014
7028
|
const classChartText = $$.getChartClass("Text");
|
|
7015
7029
|
const classTexts = $$.getClass("texts", "id");
|
|
7016
7030
|
const classFocus = $$.classFocus.bind($$);
|
|
7017
|
-
const mainTextUpdate = $$.$el.main.select(`.${$TEXT.chartTexts}`).selectAll(`.${$TEXT.chartText}`).data(targets).attr("class", (d) => `${classChartText(d)}${classFocus(d)}`.trim());
|
|
7031
|
+
const mainTextUpdate = $$.$el.main.select(`.${$TEXT.chartTexts}`).selectAll(`.${$TEXT.chartText}`).data($$.filterNullish(targets)).attr("class", (d) => `${classChartText(d)}${classFocus(d)}`.trim());
|
|
7018
7032
|
const mainTextEnter = mainTextUpdate.enter().append("g").style("opacity", "0").attr("class", classChartText).call(
|
|
7019
7033
|
$$.setCssRule(
|
|
7020
7034
|
true,
|
|
@@ -8956,7 +8970,7 @@ class ChartInternal {
|
|
|
8956
8970
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_a = $$.hasLegendDefsPoint) == null ? void 0 : _a.call($$))) {
|
|
8957
8971
|
$el.defs = $el.svg.append("defs");
|
|
8958
8972
|
if (hasAxis) {
|
|
8959
|
-
["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
|
|
8973
|
+
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
|
|
8960
8974
|
$$.appendClip($el.defs, state.clip[v]);
|
|
8961
8975
|
});
|
|
8962
8976
|
}
|
|
@@ -9347,6 +9361,9 @@ function loadConfig(config) {
|
|
|
9347
9361
|
(_b = $$.axis) == null ? void 0 : _b.setOrient();
|
|
9348
9362
|
}
|
|
9349
9363
|
zoomResetBtn == null ? void 0 : zoomResetBtn.style("display", "none");
|
|
9364
|
+
if ($$.scale.zoom) {
|
|
9365
|
+
state.current.zoomDomain = $$.scale.zoom.domain();
|
|
9366
|
+
}
|
|
9350
9367
|
$$.scale.zoom = null;
|
|
9351
9368
|
soft ? $$.redraw({
|
|
9352
9369
|
withTransform: true,
|
|
@@ -9362,6 +9379,10 @@ function loadConfig(config) {
|
|
|
9362
9379
|
$$.brush.getSelection().call($$.brush.move);
|
|
9363
9380
|
$$.unselectRect();
|
|
9364
9381
|
}
|
|
9382
|
+
if (state.current.zoomDomain) {
|
|
9383
|
+
$$.api.zoom(state.current.zoomDomain);
|
|
9384
|
+
state.current.zoomDomain = null;
|
|
9385
|
+
}
|
|
9365
9386
|
} else {
|
|
9366
9387
|
$$.initToRender(true);
|
|
9367
9388
|
}
|
|
@@ -9796,7 +9817,7 @@ function renderText(ctx, glyph) {
|
|
|
9796
9817
|
const $$ = this.internal;
|
|
9797
9818
|
const { state, $el: { chart, svg } } = $$;
|
|
9798
9819
|
const { width, height } = state.current;
|
|
9799
|
-
const opt = mergeObj({
|
|
9820
|
+
const opt = mergeObj(/* @__PURE__ */ Object.create(null), {
|
|
9800
9821
|
width,
|
|
9801
9822
|
height,
|
|
9802
9823
|
preserveAspectRatio: true,
|
|
@@ -12972,7 +12993,7 @@ class AxisRenderer {
|
|
|
12972
12993
|
return isTopBottom ? `M${range[0]},${outerTickSized}V0H${range[1]}V${outerTickSized}` : `M${outerTickSized},${range[0]}H0V${range[1]}H${outerTickSized}`;
|
|
12973
12994
|
});
|
|
12974
12995
|
if (tickShow.tick || tickShow.text) {
|
|
12975
|
-
const ticks = config.tickValues || helper.generateTicks(scale1, isLeftRight);
|
|
12996
|
+
const ticks = config.tickValues || helper.generateTicks(scale1, isLeftRight || params.config.axis_rotated);
|
|
12976
12997
|
ctx.generatedTicks = ticks;
|
|
12977
12998
|
let tick = g2.selectAll(".tick").data(ticks, scale1);
|
|
12978
12999
|
const tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick");
|
|
@@ -14010,7 +14031,10 @@ class Axis_Axis {
|
|
|
14010
14031
|
const toCull = config[cullingOptionPrefix];
|
|
14011
14032
|
if (axis && toCull) {
|
|
14012
14033
|
const tickNodes = axis.selectAll(".tick");
|
|
14013
|
-
const tickValues = sortValue(
|
|
14034
|
+
const tickValues = sortValue(
|
|
14035
|
+
tickNodes.data(),
|
|
14036
|
+
!config[`${cullingOptionPrefix}_reverse`]
|
|
14037
|
+
);
|
|
14014
14038
|
const tickSize = tickValues.length;
|
|
14015
14039
|
const cullingMax = config[`${cullingOptionPrefix}_max`];
|
|
14016
14040
|
const lines = config[`${cullingOptionPrefix}_lines`];
|
|
@@ -15581,7 +15605,7 @@ function smoothLines(el, type) {
|
|
|
15581
15605
|
* axis: {
|
|
15582
15606
|
* x: {
|
|
15583
15607
|
* tick: {
|
|
15584
|
-
* culling: false
|
|
15608
|
+
* culling: false,
|
|
15585
15609
|
* }
|
|
15586
15610
|
* }
|
|
15587
15611
|
* }
|
|
@@ -15623,6 +15647,26 @@ function smoothLines(el, type) {
|
|
|
15623
15647
|
* }
|
|
15624
15648
|
*/
|
|
15625
15649
|
axis_x_tick_culling_lines: true,
|
|
15650
|
+
/**
|
|
15651
|
+
* Control culling start point to be reversed. If set to true, the culling will be started from the end to start.
|
|
15652
|
+
* - **NOTE:** This option is only available when `axis.x.tick.culling` is set to truthy value.
|
|
15653
|
+
* @name axis․x․tick․culling․reverse
|
|
15654
|
+
* @memberof Options
|
|
15655
|
+
* @type {boolean}
|
|
15656
|
+
* @default false
|
|
15657
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.XAxisTickCulling)
|
|
15658
|
+
* @example
|
|
15659
|
+
* axis: {
|
|
15660
|
+
* x: {
|
|
15661
|
+
* tick: {
|
|
15662
|
+
* culling: {
|
|
15663
|
+
* reverse: true,
|
|
15664
|
+
* }
|
|
15665
|
+
* }
|
|
15666
|
+
* }
|
|
15667
|
+
* }
|
|
15668
|
+
*/
|
|
15669
|
+
axis_x_tick_culling_reverse: false,
|
|
15626
15670
|
/**
|
|
15627
15671
|
* The number of x axis ticks to show.<br><br>
|
|
15628
15672
|
* This option hides tick lines together with tick text. If this option is used on timeseries axis, the ticks position will be determined precisely and not nicely positioned (e.g. it will have rough second value).
|
|
@@ -16356,6 +16400,25 @@ function smoothLines(el, type) {
|
|
|
16356
16400
|
* }
|
|
16357
16401
|
*/
|
|
16358
16402
|
axis_y_tick_culling_lines: true,
|
|
16403
|
+
/**
|
|
16404
|
+
* Control culling start point to be reversed. If set to true, the culling will be started from the end to start.
|
|
16405
|
+
* - **NOTE:** This option is only available when `axis.y.tick.culling` is set to truthy value.
|
|
16406
|
+
* @name axis․y․tick․culling․reverse
|
|
16407
|
+
* @memberof Options
|
|
16408
|
+
* @type {boolean}
|
|
16409
|
+
* @default false
|
|
16410
|
+
* @example
|
|
16411
|
+
* axis: {
|
|
16412
|
+
* y: {
|
|
16413
|
+
* tick: {
|
|
16414
|
+
* culling: {
|
|
16415
|
+
* reverse: true,
|
|
16416
|
+
* }
|
|
16417
|
+
* }
|
|
16418
|
+
* }
|
|
16419
|
+
* }
|
|
16420
|
+
*/
|
|
16421
|
+
axis_y_tick_culling_reverse: false,
|
|
16359
16422
|
/**
|
|
16360
16423
|
* Show y axis outer tick.
|
|
16361
16424
|
* @name axis․y․tick․outer
|
|
@@ -16611,6 +16674,18 @@ function smoothLines(el, type) {
|
|
|
16611
16674
|
|
|
16612
16675
|
;// ./src/config/Options/axis/y2.ts
|
|
16613
16676
|
/* harmony default export */ var y2 = ({
|
|
16677
|
+
/**
|
|
16678
|
+
* Set clip-path attribute for y2 axis element
|
|
16679
|
+
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
16680
|
+
* @name axis․y2․clipPath
|
|
16681
|
+
* @memberof Options
|
|
16682
|
+
* @type {boolean}
|
|
16683
|
+
* @default true
|
|
16684
|
+
* @example
|
|
16685
|
+
* // don't set 'clip-path' attribute
|
|
16686
|
+
* clipPath: false
|
|
16687
|
+
*/
|
|
16688
|
+
axis_y2_clipPath: true,
|
|
16614
16689
|
/**
|
|
16615
16690
|
* Show or hide y2 axis.
|
|
16616
16691
|
* - **NOTE**:
|
|
@@ -16825,6 +16900,25 @@ function smoothLines(el, type) {
|
|
|
16825
16900
|
* }
|
|
16826
16901
|
*/
|
|
16827
16902
|
axis_y2_tick_culling_lines: true,
|
|
16903
|
+
/**
|
|
16904
|
+
* Control culling start point to be reversed. If set to true, the culling will be started from the end to start.
|
|
16905
|
+
* - **NOTE:** This option is only available when `axis.y2.tick.culling` is set to truthy value.
|
|
16906
|
+
* @name axis․y2․tick․culling․reverse
|
|
16907
|
+
* @memberof Options
|
|
16908
|
+
* @type {boolean}
|
|
16909
|
+
* @default false
|
|
16910
|
+
* @example
|
|
16911
|
+
* axis: {
|
|
16912
|
+
* y2: {
|
|
16913
|
+
* tick: {
|
|
16914
|
+
* culling: {
|
|
16915
|
+
* reverse: true,
|
|
16916
|
+
* }
|
|
16917
|
+
* }
|
|
16918
|
+
* }
|
|
16919
|
+
* }
|
|
16920
|
+
*/
|
|
16921
|
+
axis_y2_tick_culling_reverse: false,
|
|
16828
16922
|
/**
|
|
16829
16923
|
* Show or hide y2 axis outer tick.
|
|
16830
16924
|
* @name axis․y2․tick․outer
|
|
@@ -18392,6 +18486,12 @@ function getAttrTweenFn(fn) {
|
|
|
18392
18486
|
;// ./src/ChartInternal/shape/bar.ts
|
|
18393
18487
|
|
|
18394
18488
|
|
|
18489
|
+
|
|
18490
|
+
function getConnectLineType(id) {
|
|
18491
|
+
const connectLine = this.config.bar_connectLine;
|
|
18492
|
+
const type = (connectLine == null ? void 0 : connectLine[id]) || connectLine;
|
|
18493
|
+
return /^(start|end)\-(start|end)$/.test(type) ? type : null;
|
|
18494
|
+
}
|
|
18395
18495
|
/* harmony default export */ var bar = ({
|
|
18396
18496
|
initBar() {
|
|
18397
18497
|
const { $el, config, state: { clip } } = this;
|
|
@@ -18412,17 +18512,19 @@ function getAttrTweenFn(fn) {
|
|
|
18412
18512
|
if (!$el.bar) {
|
|
18413
18513
|
$$.initBar();
|
|
18414
18514
|
}
|
|
18415
|
-
const mainBarUpdate = $el.main.select(`.${$BAR.chartBars}`).selectAll(`.${$BAR.chartBar}`).data(
|
|
18416
|
-
// remove
|
|
18417
|
-
targets.filter(
|
|
18418
|
-
(v) => v.values.some((d) => isNumber(d.value) || $$.isBarRangeType(d))
|
|
18419
|
-
)
|
|
18420
|
-
).attr("class", (d) => classChartBar(d) + classFocus(d));
|
|
18515
|
+
const mainBarUpdate = $el.main.select(`.${$BAR.chartBars}`).selectAll(`.${$BAR.chartBar}`).data($$.filterNullish(targets)).attr("class", (d) => classChartBar(d) + classFocus(d));
|
|
18421
18516
|
const mainBarEnter = mainBarUpdate.enter().append("g").attr("class", classChartBar).style("opacity", "0").style("pointer-events", $$.getStylePropValue("none"));
|
|
18422
18517
|
mainBarEnter.append("g").attr("class", classBars).style("cursor", (d) => {
|
|
18423
18518
|
var _a;
|
|
18424
18519
|
return ((_a = isSelectable == null ? void 0 : isSelectable.bind) == null ? void 0 : _a.call(isSelectable, $$.api)(d)) ? "pointer" : null;
|
|
18425
|
-
}).call(
|
|
18520
|
+
}).call((selection) => {
|
|
18521
|
+
$$.setCssRule(true, ` .${$BAR.bar}`, ["fill"], $$.color)(selection);
|
|
18522
|
+
selection.each(function(d) {
|
|
18523
|
+
if (getConnectLineType.call($$, d.id)) {
|
|
18524
|
+
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).append("path").attr("class", $BAR.barConnectLine);
|
|
18525
|
+
}
|
|
18526
|
+
});
|
|
18527
|
+
});
|
|
18426
18528
|
},
|
|
18427
18529
|
/**
|
|
18428
18530
|
* Generate/Update elements
|
|
@@ -18464,8 +18566,25 @@ function getAttrTweenFn(fn) {
|
|
|
18464
18566
|
redrawBar(drawFn, withTransition, isSub = false) {
|
|
18465
18567
|
const $$ = this;
|
|
18466
18568
|
const { bar } = isSub ? $$.$el.subchart : $$.$el;
|
|
18569
|
+
const barPath = [];
|
|
18467
18570
|
return [
|
|
18468
|
-
$$.$T(bar, withTransition, getRandom()).attr("d", (d
|
|
18571
|
+
$$.$T(bar, withTransition, getRandom()).attr("d", function(d, i, arr) {
|
|
18572
|
+
const path = (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d, i);
|
|
18573
|
+
const connectLineType = getConnectLineType.call($$, d.id);
|
|
18574
|
+
if (path.length > 1) {
|
|
18575
|
+
barPath.push(path[1]);
|
|
18576
|
+
if (i === arr.length - 1) {
|
|
18577
|
+
const barConnectLineNode = $$.$T(
|
|
18578
|
+
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this.parentNode.querySelector(`.${$BAR.barConnectLine}`)),
|
|
18579
|
+
withTransition,
|
|
18580
|
+
getRandom()
|
|
18581
|
+
);
|
|
18582
|
+
$$.updateConnectLine(barConnectLineNode, connectLineType, barPath);
|
|
18583
|
+
barPath.splice(0);
|
|
18584
|
+
}
|
|
18585
|
+
}
|
|
18586
|
+
return path[0];
|
|
18587
|
+
}).style("fill", $$.updateBarColor.bind($$)).style("clip-path", (d) => d.clipPath).style("opacity", null)
|
|
18469
18588
|
];
|
|
18470
18589
|
},
|
|
18471
18590
|
/**
|
|
@@ -18542,7 +18661,21 @@ function getAttrTweenFn(fn) {
|
|
|
18542
18661
|
}
|
|
18543
18662
|
}
|
|
18544
18663
|
const path = isRotated ? `H${pos} ${pathRadius[0]}V${points[2][indexY] - radius} ${pathRadius[1]}H${points[3][indexX]}` : `V${pos} ${pathRadius[0]}H${points[2][indexX] - radius} ${pathRadius[1]}V${points[3][indexY]}`;
|
|
18545
|
-
|
|
18664
|
+
const coords = [`M${points[0][indexX]},${points[0][indexY]}${path}z`];
|
|
18665
|
+
if (getConnectLineType.call($$, d.id)) {
|
|
18666
|
+
coords.push(isRotated ? {
|
|
18667
|
+
x: points[0][indexX],
|
|
18668
|
+
y: points[0][indexY],
|
|
18669
|
+
width: points[0][indexX] - pos,
|
|
18670
|
+
height: points[2][indexY] - points[0][indexY]
|
|
18671
|
+
} : {
|
|
18672
|
+
x: points[0][indexX],
|
|
18673
|
+
y: pos,
|
|
18674
|
+
width: points[2][indexX] - points[0][indexX],
|
|
18675
|
+
height: points[3][indexY] - pos
|
|
18676
|
+
});
|
|
18677
|
+
}
|
|
18678
|
+
return coords;
|
|
18546
18679
|
};
|
|
18547
18680
|
},
|
|
18548
18681
|
/**
|
|
@@ -18609,6 +18742,34 @@ function getAttrTweenFn(fn) {
|
|
|
18609
18742
|
[startPosX, offset]
|
|
18610
18743
|
];
|
|
18611
18744
|
};
|
|
18745
|
+
},
|
|
18746
|
+
/**
|
|
18747
|
+
* Update the bar connect line path
|
|
18748
|
+
* @param {d3Selection} node d3 selection of bar connect line
|
|
18749
|
+
* @param {string} type Type of connect line, one of "start-start", "start-end", "end-start", "end-end"
|
|
18750
|
+
* @param {Array} barPath d3 path data for the bar
|
|
18751
|
+
*/
|
|
18752
|
+
updateConnectLine(node, type, barPath) {
|
|
18753
|
+
const path = barPath.map((v, i, arr) => {
|
|
18754
|
+
const isRotated = this.config.axis_rotated;
|
|
18755
|
+
const isStart = /^start-(start|end)$/.test(type);
|
|
18756
|
+
const isEnd = /^end-(start|end)$/.test(type);
|
|
18757
|
+
const path2 = [];
|
|
18758
|
+
const x = isRotated ? isEnd ? v.x - v.width : v.x : v.x + v.width;
|
|
18759
|
+
const y = isRotated ? v.y + v.height : isStart ? v.y + v.height : v.y;
|
|
18760
|
+
if (i === 0) {
|
|
18761
|
+
path2.push(`${x},${y}`);
|
|
18762
|
+
} else {
|
|
18763
|
+
path2.push(
|
|
18764
|
+
isRotated ? `L${v.x - (/\w+-end$/.test(type) ? v.width : 0)},${v.y}` : `L${v.x},${v.y + (/\w+-start$/.test(type) ? v.height : 0)}`
|
|
18765
|
+
);
|
|
18766
|
+
if (i < arr.length - 1) {
|
|
18767
|
+
path2.push(`M${x},${y}`);
|
|
18768
|
+
}
|
|
18769
|
+
}
|
|
18770
|
+
return path2.join(" ");
|
|
18771
|
+
});
|
|
18772
|
+
node.attr("d", `M${path.join("")}z`);
|
|
18612
18773
|
}
|
|
18613
18774
|
});
|
|
18614
18775
|
|
|
@@ -18712,7 +18873,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
18712
18873
|
if (!$el.candlestick) {
|
|
18713
18874
|
$$.initCandlestick();
|
|
18714
18875
|
}
|
|
18715
|
-
const mainUpdate = $$.$el.main.select(`.${$CANDLESTICK.chartCandlesticks}`).selectAll(`.${$CANDLESTICK.chartCandlestick}`).data(targets);
|
|
18876
|
+
const mainUpdate = $$.$el.main.select(`.${$CANDLESTICK.chartCandlesticks}`).selectAll(`.${$CANDLESTICK.chartCandlestick}`).data($$.filterNullish(targets));
|
|
18716
18877
|
mainUpdate.enter().append("g").attr("class", classChart).style("pointer-events", "none");
|
|
18717
18878
|
},
|
|
18718
18879
|
/**
|
|
@@ -19063,7 +19224,7 @@ function updateRatio(data) {
|
|
|
19063
19224
|
$$.initFunnel();
|
|
19064
19225
|
}
|
|
19065
19226
|
const targets = getFunnelData.call($$, t.filter($$.isFunnelType.bind($$)));
|
|
19066
|
-
const mainFunnelUpdate = funnel.selectAll(`.${$FUNNEL.chartFunnel}`).data(targets);
|
|
19227
|
+
const mainFunnelUpdate = funnel.selectAll(`.${$FUNNEL.chartFunnel}`).data($$.filterNullish(targets));
|
|
19067
19228
|
mainFunnelUpdate.exit().remove();
|
|
19068
19229
|
const mainFunnelEnter = mainFunnelUpdate.enter().insert("g", `.${$FUNNEL.funnelBackground}`);
|
|
19069
19230
|
mainFunnelEnter.append("path");
|
|
@@ -19197,6 +19358,25 @@ function updateRatio(data) {
|
|
|
19197
19358
|
});
|
|
19198
19359
|
|
|
19199
19360
|
;// ./src/ChartInternal/shape/line.ts
|
|
19361
|
+
var line_defProp = Object.defineProperty;
|
|
19362
|
+
var line_defProps = Object.defineProperties;
|
|
19363
|
+
var line_getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
19364
|
+
var line_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
19365
|
+
var line_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
19366
|
+
var line_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
19367
|
+
var line_defNormalProp = (obj, key, value) => key in obj ? line_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
19368
|
+
var line_spreadValues = (a, b) => {
|
|
19369
|
+
for (var prop in b || (b = {}))
|
|
19370
|
+
if (line_hasOwnProp.call(b, prop))
|
|
19371
|
+
line_defNormalProp(a, prop, b[prop]);
|
|
19372
|
+
if (line_getOwnPropSymbols)
|
|
19373
|
+
for (var prop of line_getOwnPropSymbols(b)) {
|
|
19374
|
+
if (line_propIsEnum.call(b, prop))
|
|
19375
|
+
line_defNormalProp(a, prop, b[prop]);
|
|
19376
|
+
}
|
|
19377
|
+
return a;
|
|
19378
|
+
};
|
|
19379
|
+
var line_spreadProps = (a, b) => line_defProps(a, line_getOwnPropDescs(b));
|
|
19200
19380
|
|
|
19201
19381
|
|
|
19202
19382
|
|
|
@@ -19247,7 +19427,7 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
19247
19427
|
$$.initLine();
|
|
19248
19428
|
}
|
|
19249
19429
|
const targets = t.filter((d) => !($$.isScatterType(d) || $$.isBubbleType(d)));
|
|
19250
|
-
const mainLineUpdate = main.select(`.${$LINE.chartLines}`).selectAll(`.${$LINE.chartLine}`).data(targets).attr("class", (d) => classChartLine(d) + classFocus(d));
|
|
19430
|
+
const mainLineUpdate = main.select(`.${$LINE.chartLines}`).selectAll(`.${$LINE.chartLine}`).data($$.filterNullish(targets)).attr("class", (d) => classChartLine(d) + classFocus(d));
|
|
19251
19431
|
const mainLineEnter = mainLineUpdate.enter().append("g").attr("class", classChartLine).style("opacity", "0").style("pointer-events", $$.getStylePropValue("none"));
|
|
19252
19432
|
mainLineEnter.append("g").attr("class", classLines);
|
|
19253
19433
|
if ($$.hasTypeOf("Area")) {
|
|
@@ -19336,6 +19516,9 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
19336
19516
|
if ($$.isLineType(d)) {
|
|
19337
19517
|
const regions = config.data_regions[d.id];
|
|
19338
19518
|
if (regions) {
|
|
19519
|
+
if ($$.isAreaRangeType(d)) {
|
|
19520
|
+
values = values.map((dv) => line_spreadProps(line_spreadValues({}, dv), { value: $$.getRangedData(dv, "mid") }));
|
|
19521
|
+
}
|
|
19339
19522
|
path = $$.lineWithRegions(values, scale.zoom || x, y, regions);
|
|
19340
19523
|
} else {
|
|
19341
19524
|
if ($$.isStepType(d)) {
|
|
@@ -19544,7 +19727,7 @@ const getTransitionName = () => getRandom();
|
|
|
19544
19727
|
let targets = targetsValue;
|
|
19545
19728
|
let enterNode = enterNodeValue;
|
|
19546
19729
|
if (!targets) {
|
|
19547
|
-
targets = data.targets.filter((d) => this.isScatterType(d) || this.isBubbleType(d));
|
|
19730
|
+
targets = $$.filterNullish(data.targets).filter((d) => this.isScatterType(d) || this.isBubbleType(d));
|
|
19548
19731
|
const mainCircle = $el.main.select(`.${$CIRCLE.chartCircles}`).style("pointer-events", "none").selectAll(`.${$CIRCLE.circles}`).data(targets);
|
|
19549
19732
|
mainCircle.exit().remove();
|
|
19550
19733
|
enterNode = mainCircle.enter();
|
|
@@ -19572,7 +19755,10 @@ const getTransitionName = () => getRandom();
|
|
|
19572
19755
|
const $root = isSub ? $el.subchart : $el;
|
|
19573
19756
|
if (config.point_show && !state.toggling) {
|
|
19574
19757
|
config.point_radialGradient && $$.updateLinearGradient();
|
|
19575
|
-
const circles = $root.main.selectAll(`.${$CIRCLE.circles}`).selectAll(`.${$CIRCLE.circle}`).data((d) =>
|
|
19758
|
+
const circles = $root.main.selectAll(`.${$CIRCLE.circles}`).selectAll(`.${$CIRCLE.circle}`).data((d) => {
|
|
19759
|
+
const data = $$.isLineType(d) && $$.shouldDrawPointsForLine(d) || $$.isBubbleType(d) || $$.isRadarType(d) || $$.isScatterType(d) ? focusOnly ? [d.values[0]] : d.values : [];
|
|
19760
|
+
return $$.filterNullish(data);
|
|
19761
|
+
});
|
|
19576
19762
|
circles.exit().remove();
|
|
19577
19763
|
circles.enter().filter(Boolean).append(
|
|
19578
19764
|
$$.point("create", this, $$.pointR.bind($$), $$.updateCircleColor.bind($$))
|
|
@@ -20309,7 +20495,7 @@ const cacheKeyTextWidth = KEY.radarTextWidth;
|
|
|
20309
20495
|
const $$ = this;
|
|
20310
20496
|
const targets = $$.data.targets.filter((d) => $$.isRadarType(d));
|
|
20311
20497
|
const points = $$.cache.get(cacheKeyPoints);
|
|
20312
|
-
const areas = $$.$el.radar.shapes.selectAll("polygon").data(targets);
|
|
20498
|
+
const areas = $$.$el.radar.shapes.selectAll("polygon").data($$.filterNullish(targets));
|
|
20313
20499
|
const areasEnter = areas.enter().append("g").attr("class", $$.getChartClass("Radar"));
|
|
20314
20500
|
$$.$T(areas.exit()).remove();
|
|
20315
20501
|
areasEnter.append("polygon").merge(areas).style("fill", $$.color).style("stroke", $$.color).attr("points", (d) => points[d.id].join(" "));
|
|
@@ -20473,7 +20659,7 @@ function getHierachyData(data) {
|
|
|
20473
20659
|
const $$ = this;
|
|
20474
20660
|
const { $el: { treemap } } = $$;
|
|
20475
20661
|
const treemapData = getHierachyData.call($$, $$.getTreemapData(targets != null ? targets : $$.data.targets));
|
|
20476
|
-
treemap.data(treemapData);
|
|
20662
|
+
treemap.data($$.filterNullish(treemapData));
|
|
20477
20663
|
},
|
|
20478
20664
|
/**
|
|
20479
20665
|
* Render treemap
|
|
@@ -20897,6 +21083,7 @@ ${percentValue}%`;
|
|
|
20897
21083
|
* zerobased: false
|
|
20898
21084
|
* }
|
|
20899
21085
|
*/
|
|
21086
|
+
bar_connectLine: false,
|
|
20900
21087
|
bar_front: false,
|
|
20901
21088
|
bar_indices_removeNull: false,
|
|
20902
21089
|
bar_label_threshold: 0,
|
|
@@ -21895,7 +22082,7 @@ let resolver_shape_treemap = () => (extendAxis([treemap], [shape_treemap]), (res
|
|
|
21895
22082
|
;// ./src/core.ts
|
|
21896
22083
|
|
|
21897
22084
|
|
|
21898
|
-
let defaults =
|
|
22085
|
+
let defaults = /* @__PURE__ */ Object.create(null);
|
|
21899
22086
|
const bb = {
|
|
21900
22087
|
/**
|
|
21901
22088
|
* Version information
|
|
@@ -21904,7 +22091,7 @@ const bb = {
|
|
|
21904
22091
|
* bb.version; // "1.0.0"
|
|
21905
22092
|
* @memberof bb
|
|
21906
22093
|
*/
|
|
21907
|
-
version: "3.
|
|
22094
|
+
version: "3.16.0-next.1",
|
|
21908
22095
|
/**
|
|
21909
22096
|
* Generate chart
|
|
21910
22097
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|
|
@@ -21976,7 +22163,7 @@ const bb = {
|
|
|
21976
22163
|
* });
|
|
21977
22164
|
*/
|
|
21978
22165
|
generate(config) {
|
|
21979
|
-
const options = mergeObj(
|
|
22166
|
+
const options = mergeObj(/* @__PURE__ */ Object.create(null), defaults, config);
|
|
21980
22167
|
const inst = new Chart(options);
|
|
21981
22168
|
inst.internal.charts = this.instance;
|
|
21982
22169
|
this.instance.push(inst);
|
package/dist/billboard.min.css
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.16.0-next.1
|
|
9
9
|
*/.bb svg{font:10px sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0)}.bb path,.bb line{fill:none;stroke:#000}.bb text,.bb .bb-button{-webkit-user-select:none;-moz-user-select:none;user-select:none}.bb-legend-item-tile,.bb-xgrid-focus,.bb-ygrid-focus,.bb-ygrid{shape-rendering:crispEdges}.bb-chart-arcs .bb-needle,.bb-chart-arc .bb-gauge-value{fill:#000}.bb-chart-arc path{stroke:#fff}.bb-chart-arc rect{stroke:#fff;stroke-width:1}.bb-chart-arc text{fill:#fff;font-size:13px}.bb-chart-funnels path{stroke-width:0}.bb-chart-funnels+.bb-chart-texts text{font-size:13px;fill:#fff}.bb-axis{shape-rendering:crispEdges}.bb-axis .bb-axis-x-tooltip,.bb-axis .bb-axis-y-tooltip,.bb-axis .bb-axis-y2-tooltip{font-size:1em;fill:#fff;white-space:nowrap}.bb-grid{pointer-events:none}.bb-grid line{stroke:#aaa}.bb-grid text{fill:#aaa}.bb-xgrid,.bb-ygrid{stroke-dasharray:3 3}.bb-text.bb-empty{fill:gray;font-size:2em}.bb-line{stroke-width:1px}.bb-circle._expanded_{stroke-width:1px;stroke:#fff}.bb-selected-circle{fill:#fff;stroke-width:2px}.bb-bar{stroke-width:0}.bb-bar._expanded_{fill-opacity:.75}.bb-candlestick{stroke-width:1px}.bb-candlestick._expanded_{fill-opacity:.75}.bb-target.bb-focused,.bb-circles.bb-focused{opacity:1}.bb-target.bb-focused path.bb-line,.bb-target.bb-focused path.bb-step,.bb-circles.bb-focused path.bb-line,.bb-circles.bb-focused path.bb-step{stroke-width:2px}.bb-target.bb-defocused,.bb-circles.bb-defocused{opacity:.3!important}.bb-target.bb-defocused .text-overlapping,.bb-circles.bb-defocused .text-overlapping{opacity:.05!important}.bb-region{fill:#4682b4}.bb-region rect{fill-opacity:.1}.bb-zoom-brush,.bb-brush .extent{fill-opacity:.1}.bb-legend-item{font-size:12px;user-select:none}.bb-legend-item-hidden{opacity:.15}.bb-legend-background{opacity:.75;fill:#fff;stroke:#d3d3d3;stroke-width:1}.bb-title{font:14px sans-serif}.bb-chart-treemaps rect{stroke:#fff;stroke-width:1px}.bb-tooltip-container{z-index:10;user-select:none}.bb-tooltip{border-collapse:collapse;border-spacing:0;background-color:#fff;empty-cells:show;opacity:.9;box-shadow:7px 7px 12px -9px #777;white-space:nowrap}.bb-tooltip tr{border:1px solid #CCC}.bb-tooltip th{background-color:#aaa;font-size:14px;padding:2px 5px;text-align:left;color:#fff}.bb-tooltip td{font-size:13px;padding:3px 6px;background-color:#fff;border-left:1px dotted #999}.bb-tooltip td>span,.bb-tooltip td>svg{display:inline-block;width:10px;height:10px;margin-right:6px}.bb-tooltip.value{text-align:right}.bb-area{stroke-width:0;opacity:.2}.bb-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}text.bb-chart-arcs-gauge-title{dominant-baseline:middle;font-size:2.7em}.bb-chart-arcs .bb-chart-arcs-background{fill:#e0e0e0;stroke:#fff}.bb-chart-arcs .bb-chart-arcs-gauge-unit{fill:#000;font-size:16px}.bb-chart-arcs .bb-chart-arcs-gauge-max,.bb-chart-arcs .bb-chart-arcs-gauge-min{fill:#777}.bb-chart-arcs .bb-levels circle{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-arcs .bb-levels text{fill:#848282}.bb-chart-radars .bb-levels polygon{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-levels text{fill:#848282}.bb-chart-radars .bb-axis line{stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-axis text{font-size:1.15em;cursor:default}.bb-chart-radars .bb-shapes polygon{fill-opacity:.2;stroke-width:1px}.bb-button{position:absolute;top:10px;right:10px}.bb-button .bb-zoom-reset{font-size:11px;border:solid 1px #ccc;background-color:#fff;padding:5px;border-radius:5px;cursor:pointer}
|