billboard.js 3.10.1 → 3.10.3
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 +91 -74
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +203 -347
- package/dist/billboard.pkgd.min.js +4 -4
- 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 +13 -11
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +13 -11
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +13 -11
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +13 -11
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +112 -273
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +124 -283
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +125 -284
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +125 -284
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +125 -284
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
- 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 +69 -53
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +17 -17
- package/src/ChartInternal/Axis/Axis.ts +7 -4
- package/src/ChartInternal/data/data.ts +15 -9
- package/src/ChartInternal/internals/clip.ts +1 -2
- package/src/ChartInternal/internals/format.ts +15 -4
- package/src/ChartInternal/internals/size.axis.ts +4 -17
- package/src/ChartInternal/internals/size.ts +11 -5
- package/src/ChartInternal/internals/text.ts +3 -3
- package/src/ChartInternal/internals/tooltip.ts +2 -2
- package/src/ChartInternal/internals/transform.ts +1 -1
- package/src/ChartInternal/shape/arc.ts +1 -1
- package/src/ChartInternal/shape/shape.ts +2 -0
- package/src/module/browser.ts +8 -6
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.10.
|
|
8
|
+
* @version 3.10.3
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -246,15 +246,17 @@ function getGlobal() {
|
|
|
246
246
|
*/
|
|
247
247
|
function getFallback(w) {
|
|
248
248
|
var _this = this;
|
|
249
|
-
const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function",
|
|
250
|
-
hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function"
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
249
|
+
const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function" && typeof (w == null ? void 0 : w.cancelAnimationFrame) === "function",
|
|
250
|
+
hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function" && typeof (w == null ? void 0 : w.cancelIdleCallback) === "function",
|
|
251
|
+
request = function (cb) {
|
|
252
|
+
_newArrowCheck(this, _this);
|
|
253
|
+
return setTimeout(cb, 1);
|
|
254
|
+
}.bind(this),
|
|
255
|
+
cancel = function (id) {
|
|
256
|
+
_newArrowCheck(this, _this);
|
|
257
|
+
return clearTimeout(id);
|
|
258
|
+
}.bind(this);
|
|
259
|
+
return [hasRAF ? w.requestAnimationFrame : request, hasRAF ? w.cancelAnimationFrame : cancel, hasRIC ? w.requestIdleCallback : request, hasRIC ? w.cancelIdleCallback : cancel];
|
|
258
260
|
}
|
|
259
261
|
const win = getGlobal(),
|
|
260
262
|
browser_doc = win == null ? void 0 : win.document,
|
|
@@ -5332,6 +5334,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5332
5334
|
return current;
|
|
5333
5335
|
},
|
|
5334
5336
|
getRangedData: function getRangedData(d, key, type) {
|
|
5337
|
+
var _this39 = this;
|
|
5335
5338
|
if (key === void 0) {
|
|
5336
5339
|
key = "";
|
|
5337
5340
|
}
|
|
@@ -5340,13 +5343,20 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5340
5343
|
}
|
|
5341
5344
|
const value = d == null ? void 0 : d.value;
|
|
5342
5345
|
if (isArray(value)) {
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5346
|
+
if (type === "bar") {
|
|
5347
|
+
return value.reduce(function (a, c) {
|
|
5348
|
+
_newArrowCheck(this, _this39);
|
|
5349
|
+
return c - a;
|
|
5350
|
+
}.bind(this));
|
|
5351
|
+
} else {
|
|
5352
|
+
// @ts-ignore
|
|
5353
|
+
const index = {
|
|
5354
|
+
areaRange: ["high", "mid", "low"],
|
|
5355
|
+
candlestick: ["open", "high", "low", "close", "volume"]
|
|
5356
|
+
}[type].indexOf(key);
|
|
5357
|
+
return index >= 0 && value ? value[index] : undefined;
|
|
5358
|
+
}
|
|
5359
|
+
} else if (value && key) {
|
|
5350
5360
|
return value[key];
|
|
5351
5361
|
}
|
|
5352
5362
|
return value;
|
|
@@ -5357,20 +5367,20 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5357
5367
|
* @private
|
|
5358
5368
|
*/
|
|
5359
5369
|
setRatioForGroupedData: function setRatioForGroupedData(data) {
|
|
5360
|
-
var
|
|
5370
|
+
var _this40 = this;
|
|
5361
5371
|
const $$ = this,
|
|
5362
5372
|
config = $$.config;
|
|
5363
5373
|
// calculate ratio if grouped data exists
|
|
5364
5374
|
if (config.data_groups.length && data.some(function (d) {
|
|
5365
|
-
_newArrowCheck(this,
|
|
5375
|
+
_newArrowCheck(this, _this40);
|
|
5366
5376
|
return $$.isGrouped(d.id);
|
|
5367
5377
|
}.bind(this))) {
|
|
5368
5378
|
const setter = function (d) {
|
|
5369
|
-
_newArrowCheck(this,
|
|
5379
|
+
_newArrowCheck(this, _this40);
|
|
5370
5380
|
return $$.getRatio("index", d, !0);
|
|
5371
5381
|
}.bind(this);
|
|
5372
5382
|
data.forEach(function (v) {
|
|
5373
|
-
_newArrowCheck(this,
|
|
5383
|
+
_newArrowCheck(this, _this40);
|
|
5374
5384
|
"values" in v ? v.values.forEach(setter) : setter(v);
|
|
5375
5385
|
}.bind(this));
|
|
5376
5386
|
}
|
|
@@ -5384,7 +5394,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5384
5394
|
* @private
|
|
5385
5395
|
*/
|
|
5386
5396
|
getRatio: function getRatio(type, d, asPercent) {
|
|
5387
|
-
var
|
|
5397
|
+
var _this41 = this;
|
|
5388
5398
|
if (asPercent === void 0) {
|
|
5389
5399
|
asPercent = !1;
|
|
5390
5400
|
}
|
|
@@ -5413,15 +5423,15 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5413
5423
|
let hiddenSum = dataValues(state.hiddenTargetIds, !1);
|
|
5414
5424
|
if (hiddenSum.length) {
|
|
5415
5425
|
hiddenSum = hiddenSum.reduce(function (acc, curr) {
|
|
5416
|
-
var
|
|
5417
|
-
_newArrowCheck(this,
|
|
5426
|
+
var _this42 = this;
|
|
5427
|
+
_newArrowCheck(this, _this41);
|
|
5418
5428
|
return acc.map(function (v, i) {
|
|
5419
|
-
_newArrowCheck(this,
|
|
5429
|
+
_newArrowCheck(this, _this42);
|
|
5420
5430
|
return (isNumber(v) ? v : 0) + curr[i];
|
|
5421
5431
|
}.bind(this));
|
|
5422
5432
|
}.bind(this));
|
|
5423
5433
|
total = total.map(function (v, i) {
|
|
5424
|
-
_newArrowCheck(this,
|
|
5434
|
+
_newArrowCheck(this, _this41);
|
|
5425
5435
|
return v - hiddenSum[i];
|
|
5426
5436
|
}.bind(this));
|
|
5427
5437
|
}
|
|
@@ -5434,11 +5444,11 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5434
5444
|
} else if (type === "bar") {
|
|
5435
5445
|
const yScale = $$.getYScaleById.bind($$)(d.id),
|
|
5436
5446
|
max = yScale.domain().reduce(function (a, c) {
|
|
5437
|
-
_newArrowCheck(this,
|
|
5447
|
+
_newArrowCheck(this, _this41);
|
|
5438
5448
|
return c - a;
|
|
5439
5449
|
}.bind(this));
|
|
5440
5450
|
// when all data are 0, return 0
|
|
5441
|
-
ratio = max === 0 ? 0 : Math.abs(d
|
|
5451
|
+
ratio = max === 0 ? 0 : Math.abs($$.getRangedData(d, null, type) / max);
|
|
5442
5452
|
} else if (type === "treemap") {
|
|
5443
5453
|
ratio /= $$.getTotalDataSum(!0);
|
|
5444
5454
|
}
|
|
@@ -5451,18 +5461,18 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5451
5461
|
* @private
|
|
5452
5462
|
*/
|
|
5453
5463
|
updateDataIndexByX: function updateDataIndexByX(tickValues) {
|
|
5454
|
-
var
|
|
5464
|
+
var _this43 = this;
|
|
5455
5465
|
const $$ = this,
|
|
5456
5466
|
tickValueMap = tickValues.reduce(function (out, tick, index) {
|
|
5457
|
-
_newArrowCheck(this,
|
|
5467
|
+
_newArrowCheck(this, _this43);
|
|
5458
5468
|
out[+tick.x] = index;
|
|
5459
5469
|
return out;
|
|
5460
5470
|
}.bind(this), {});
|
|
5461
5471
|
$$.data.targets.forEach(function (t) {
|
|
5462
|
-
var
|
|
5463
|
-
_newArrowCheck(this,
|
|
5472
|
+
var _this44 = this;
|
|
5473
|
+
_newArrowCheck(this, _this43);
|
|
5464
5474
|
t.values.forEach(function (value, valueIndex) {
|
|
5465
|
-
_newArrowCheck(this,
|
|
5475
|
+
_newArrowCheck(this, _this44);
|
|
5466
5476
|
let index = tickValueMap[+value.x];
|
|
5467
5477
|
if (index === undefined) {
|
|
5468
5478
|
index = valueIndex;
|
|
@@ -5488,11 +5498,11 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5488
5498
|
* @private
|
|
5489
5499
|
*/
|
|
5490
5500
|
isBarRangeType: function isBarRangeType(d) {
|
|
5491
|
-
var
|
|
5501
|
+
var _this45 = this;
|
|
5492
5502
|
const $$ = this,
|
|
5493
5503
|
value = d.value;
|
|
5494
5504
|
return $$.isBarType(d) && isArray(value) && value.length >= 2 && value.every(function (v) {
|
|
5495
|
-
_newArrowCheck(this,
|
|
5505
|
+
_newArrowCheck(this, _this45);
|
|
5496
5506
|
return isNumber(v);
|
|
5497
5507
|
}.bind(this));
|
|
5498
5508
|
},
|
|
@@ -6785,7 +6795,7 @@ function getFormat($$, typeValue, v) {
|
|
|
6785
6795
|
};
|
|
6786
6796
|
},
|
|
6787
6797
|
defaultValueFormat: function defaultValueFormat(v) {
|
|
6788
|
-
return isValue(v) ? +v : "";
|
|
6798
|
+
return isArray(v) ? v.join("~") : isValue(v) ? +v : "";
|
|
6789
6799
|
},
|
|
6790
6800
|
defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
|
|
6791
6801
|
return (ratio * 100).toFixed(1) + "%";
|
|
@@ -6799,7 +6809,14 @@ function getFormat($$, typeValue, v) {
|
|
|
6799
6809
|
dataLabels = $$.config.data_labels,
|
|
6800
6810
|
defaultFormat = function (v) {
|
|
6801
6811
|
_newArrowCheck(this, _this);
|
|
6802
|
-
|
|
6812
|
+
const delimiter = "~";
|
|
6813
|
+
let res = v;
|
|
6814
|
+
if (isArray(v)) {
|
|
6815
|
+
res = v.join(delimiter);
|
|
6816
|
+
} else if (isObject(v)) {
|
|
6817
|
+
res = Object.values(v).join(delimiter);
|
|
6818
|
+
}
|
|
6819
|
+
return res;
|
|
6803
6820
|
}.bind(this);
|
|
6804
6821
|
let format = defaultFormat;
|
|
6805
6822
|
|
|
@@ -8321,6 +8338,8 @@ function getGroupedDataPointsFn(d) {
|
|
|
8321
8338
|
let value = d.value;
|
|
8322
8339
|
if (isNumber(d)) {
|
|
8323
8340
|
value = d;
|
|
8341
|
+
} else if ($$.isAreaRangeType(d)) {
|
|
8342
|
+
value = $$.getBaseValue(d, "mid");
|
|
8324
8343
|
} else if (isStackNormalized) {
|
|
8325
8344
|
value = $$.getRatio("index", d, !0);
|
|
8326
8345
|
} else if ($$.isBubbleZType(d)) {
|
|
@@ -8731,14 +8750,18 @@ function getGroupedDataPointsFn(d) {
|
|
|
8731
8750
|
* Get padding by the direction.
|
|
8732
8751
|
* @param {string} type "top" | "bottom" | "left" | "right"
|
|
8733
8752
|
* @param {boolean} [withoutRecompute=false] If set true, do not recompute the padding value.
|
|
8753
|
+
* @param {boolean} [withXAxisTickTextOverflow=false] If set true, calculate x axis tick text overflow.
|
|
8734
8754
|
* @returns {number} padding value
|
|
8735
8755
|
* @private
|
|
8736
8756
|
*/
|
|
8737
|
-
getCurrentPaddingByDirection: function getCurrentPaddingByDirection(type, withoutRecompute) {
|
|
8757
|
+
getCurrentPaddingByDirection: function getCurrentPaddingByDirection(type, withoutRecompute, withXAxisTickTextOverflow) {
|
|
8738
8758
|
var _config$padding;
|
|
8739
8759
|
if (withoutRecompute === void 0) {
|
|
8740
8760
|
withoutRecompute = !1;
|
|
8741
8761
|
}
|
|
8762
|
+
if (withXAxisTickTextOverflow === void 0) {
|
|
8763
|
+
withXAxisTickTextOverflow = !1;
|
|
8764
|
+
}
|
|
8742
8765
|
const $$ = this,
|
|
8743
8766
|
config = $$.config,
|
|
8744
8767
|
$el = $$.$el,
|
|
@@ -8757,6 +8780,7 @@ function getGroupedDataPointsFn(d) {
|
|
|
8757
8780
|
isAxisShow = axisId && config["axis_" + axisId + "_show"],
|
|
8758
8781
|
axesLen = axisId ? config["axis_" + axisId + "_axes"].length : 0;
|
|
8759
8782
|
let axisSize = axisId ? isLeftRight ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : $$.getHorizontalAxisHeight(axisId) : 0;
|
|
8783
|
+
const defaultPadding = 20;
|
|
8760
8784
|
let gap = 0;
|
|
8761
8785
|
if (!isFitPadding && isLeftRight) {
|
|
8762
8786
|
axisSize = ceil10(axisSize);
|
|
@@ -8764,10 +8788,11 @@ function getGroupedDataPointsFn(d) {
|
|
|
8764
8788
|
let padding = hasAxis && isLeftRight && (isAxisInner || isUndefined(paddingOption) && !isAxisShow) ? 0 : isFitPadding ? (isAxisShow ? axisSize : 0) + (paddingOption != null ? paddingOption : 0) : isUndefined(paddingOption) ? axisSize : paddingOption;
|
|
8765
8789
|
if (isLeftRight && hasAxis) {
|
|
8766
8790
|
if (axisId && (isFitPadding || isAxisInner) && config["axis_" + axisId + "_label"].text) {
|
|
8767
|
-
padding += $$.axis.getAxisLabelPosition(axisId).isOuter ?
|
|
8791
|
+
padding += $$.axis.getAxisLabelPosition(axisId).isOuter ? defaultPadding : 0;
|
|
8768
8792
|
}
|
|
8769
8793
|
if (type === "right") {
|
|
8770
8794
|
padding += isRotated ? !isFitPadding && isUndefined(paddingOption) ? 10 : 2 : !isAxisShow || isAxisInner ? isFitPadding ? 2 : 1 : 0;
|
|
8795
|
+
padding += withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(defaultPadding) : 0;
|
|
8771
8796
|
} else if (type === "left" && isRotated && isUndefined(paddingOption)) {
|
|
8772
8797
|
padding = !config.axis_x_show ? 1 : isFitPadding ? axisSize : Math.max(axisSize, 40);
|
|
8773
8798
|
}
|
|
@@ -8783,12 +8808,15 @@ function getGroupedDataPointsFn(d) {
|
|
|
8783
8808
|
}
|
|
8784
8809
|
return padding + axisSize * axesLen - gap;
|
|
8785
8810
|
},
|
|
8786
|
-
getCurrentPadding: function getCurrentPadding() {
|
|
8811
|
+
getCurrentPadding: function getCurrentPadding(withXAxisTickTextOverflow) {
|
|
8787
8812
|
var _this = this;
|
|
8813
|
+
if (withXAxisTickTextOverflow === void 0) {
|
|
8814
|
+
withXAxisTickTextOverflow = !1;
|
|
8815
|
+
}
|
|
8788
8816
|
const $$ = this,
|
|
8789
8817
|
_map = ["top", "bottom", "left", "right"].map(function (v) {
|
|
8790
8818
|
_newArrowCheck(this, _this);
|
|
8791
|
-
return $$.getCurrentPaddingByDirection(v);
|
|
8819
|
+
return $$.getCurrentPaddingByDirection(v, null, withXAxisTickTextOverflow);
|
|
8792
8820
|
}.bind(this)),
|
|
8793
8821
|
top = _map[0],
|
|
8794
8822
|
bottom = _map[1],
|
|
@@ -8848,14 +8876,14 @@ function getGroupedDataPointsFn(d) {
|
|
|
8848
8876
|
$$.updateXAxisTickClip();
|
|
8849
8877
|
}
|
|
8850
8878
|
const legendSize = {
|
|
8851
|
-
right: config.legend_show && state.isLegendRight ? $$.getLegendWidth() + 20 : 0,
|
|
8879
|
+
right: config.legend_show && state.isLegendRight ? $$.getLegendWidth() + (isFitPadding ? 0 : 20) : 0,
|
|
8852
8880
|
bottom: !config.legend_show || state.isLegendRight || state.isLegendInset ? 0 : currLegend.height
|
|
8853
8881
|
},
|
|
8854
8882
|
xAxisHeight = isRotated || isNonAxis ? 0 : $$.getHorizontalAxisHeight("x"),
|
|
8855
8883
|
subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30,
|
|
8856
8884
|
subchartHeight = config.subchart_show && !isNonAxis ? config.subchart_size_height + subchartXAxisHeight : 0,
|
|
8857
8885
|
gaugeHeight = $$.hasType("gauge") && config.arc_needle_show && !config.gauge_fullCircle && !config.gauge_label_show ? 10 : 0,
|
|
8858
|
-
padding = $$.getCurrentPadding(); // when needle is shown with legend, it need some bottom space to not overlap with legend text
|
|
8886
|
+
padding = $$.getCurrentPadding(!0); // when needle is shown with legend, it need some bottom space to not overlap with legend text
|
|
8859
8887
|
// for main
|
|
8860
8888
|
state.margin = !isNonAxis && isRotated ? {
|
|
8861
8889
|
top: padding.top,
|
|
@@ -9181,7 +9209,7 @@ function getTextPos(d, type) {
|
|
|
9181
9209
|
* @returns {string|null}
|
|
9182
9210
|
* @private
|
|
9183
9211
|
*/
|
|
9184
|
-
|
|
9212
|
+
updateTextBackgroundColor: function updateTextBackgroundColor(d) {
|
|
9185
9213
|
const $$ = this,
|
|
9186
9214
|
$el = $$.$el,
|
|
9187
9215
|
config = $$.config,
|
|
@@ -9216,7 +9244,7 @@ function getTextPos(d, type) {
|
|
|
9216
9244
|
angle = config.data_labels.rotate,
|
|
9217
9245
|
anchorString = getRotateAnchor(angle),
|
|
9218
9246
|
rotateString = angle ? "rotate(" + angle + ")" : "";
|
|
9219
|
-
$$.$el.text.style("fill", $$.getStylePropValue($$.updateTextColor)).attr("filter", $$.
|
|
9247
|
+
$$.$el.text.style("fill", $$.getStylePropValue($$.updateTextColor)).attr("filter", $$.updateTextBackgroundColor.bind($$)).style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$)).each(function (d, i) {
|
|
9220
9248
|
// do not apply transition for newly added text elements
|
|
9221
9249
|
const node = $T(hasTreemap && this.childElementCount ? this.parentNode : this, !!(withTransition && this.getAttribute("x")), t),
|
|
9222
9250
|
isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"];
|
|
@@ -9312,7 +9340,7 @@ function getTextPos(d, type) {
|
|
|
9312
9340
|
if (config.data_labels.centered && (isBarType || isTreemapType)) {
|
|
9313
9341
|
const rect = getBoundingRect(textElement);
|
|
9314
9342
|
if (isBarType) {
|
|
9315
|
-
const isPositive = d
|
|
9343
|
+
const isPositive = $$.getRangedData(d, null, "bar") >= 0;
|
|
9316
9344
|
if (isRotated) {
|
|
9317
9345
|
const w = (isPositive ? points[1][1] - points[0][1] : points[0][1] - points[1][1]) / 2 + rect.width / 2;
|
|
9318
9346
|
return isPositive ? -w - 3 : w + 2;
|
|
@@ -9771,12 +9799,10 @@ function getTextXPos(pos, width) {
|
|
|
9771
9799
|
value = "<b>Open:</b> " + open + " <b>High:</b> " + high + " <b>Low:</b> " + low + " <b>Close:</b> " + close + (volume ? " <b>Volume:</b> " + volume : "");
|
|
9772
9800
|
} else if ($$.isBarRangeType(row)) {
|
|
9773
9801
|
const _row = row,
|
|
9774
|
-
|
|
9775
|
-
start = _row$value[0],
|
|
9776
|
-
end = _row$value[1],
|
|
9802
|
+
rangeValue = _row.value,
|
|
9777
9803
|
id = _row.id,
|
|
9778
9804
|
index = _row.index;
|
|
9779
|
-
value =
|
|
9805
|
+
value = "" + valueFormat(rangeValue, undefined, id, index);
|
|
9780
9806
|
} else {
|
|
9781
9807
|
value = valueFormat.apply(void 0, [getRowValue(row)].concat(param));
|
|
9782
9808
|
}
|
|
@@ -10190,7 +10216,7 @@ function getTextXPos(pos, width) {
|
|
|
10190
10216
|
y = isRotated ? state.height + padding : 0;
|
|
10191
10217
|
} else if (target === "y2") {
|
|
10192
10218
|
x = isRotated ? 0 : state.width + padding;
|
|
10193
|
-
y = isRotated ?
|
|
10219
|
+
y = isRotated ? -padding - 1 : 0;
|
|
10194
10220
|
} else if (target === "subX") {
|
|
10195
10221
|
x = 0;
|
|
10196
10222
|
y = isRotated ? 0 : state.height2;
|
|
@@ -14924,11 +14950,12 @@ let Axis_Axis = /*#__PURE__*/function () {
|
|
|
14924
14950
|
svg = _$$$$el2.svg,
|
|
14925
14951
|
chart = _$$$$el2.chart,
|
|
14926
14952
|
currentTickMax = current.maxTickSize[id],
|
|
14953
|
+
configPrefix = "axis_" + id,
|
|
14927
14954
|
max = {
|
|
14928
14955
|
width: 0,
|
|
14929
14956
|
height: 0
|
|
14930
14957
|
};
|
|
14931
|
-
if (withoutRecompute || !config[
|
|
14958
|
+
if (withoutRecompute || !config[configPrefix + "_show"] || currentTickMax.width > 0 && $$.filterTargetsToShow().length === 0) {
|
|
14932
14959
|
return currentTickMax;
|
|
14933
14960
|
}
|
|
14934
14961
|
if (svg) {
|
|
@@ -14956,8 +14983,9 @@ let Axis_Axis = /*#__PURE__*/function () {
|
|
|
14956
14983
|
currentTickMax.ticks.splice(0);
|
|
14957
14984
|
}
|
|
14958
14985
|
const axis = this.getAxis(id, scale, !1, !1, !0),
|
|
14959
|
-
|
|
14960
|
-
|
|
14986
|
+
tickRotate = config[configPrefix + "_tick_rotate"],
|
|
14987
|
+
tickCount = config[configPrefix + "_tick_count"],
|
|
14988
|
+
tickValues = config[configPrefix + "_tick_values"];
|
|
14961
14989
|
// Make to generate the final tick text to be rendered
|
|
14962
14990
|
// https://github.com/naver/billboard.js/issues/920
|
|
14963
14991
|
// Do not generate if 'tick values' option is given
|
|
@@ -14968,7 +14996,7 @@ let Axis_Axis = /*#__PURE__*/function () {
|
|
|
14968
14996
|
isYAxis || this.updateXAxisTickValues(targetsToShow, axis);
|
|
14969
14997
|
const dummy = chart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0").style("left", "0");
|
|
14970
14998
|
axis.create(dummy);
|
|
14971
|
-
dummy.selectAll("text").each(function (d, i) {
|
|
14999
|
+
dummy.selectAll("text").attr("transform", isNumber(tickRotate) ? "rotate(" + tickRotate + ")" : null).each(function (d, i) {
|
|
14972
15000
|
const _this$getBoundingClie = this.getBoundingClientRect(),
|
|
14973
15001
|
width = _this$getBoundingClie.width,
|
|
14974
15002
|
height = _this$getBoundingClie.height;
|
|
@@ -14996,7 +15024,7 @@ let Axis_Axis = /*#__PURE__*/function () {
|
|
|
14996
15024
|
config = $$.config,
|
|
14997
15025
|
state = $$.state,
|
|
14998
15026
|
xAxisTickRotate = $$.getAxisTickRotate("x");
|
|
14999
|
-
if ((axis.isCategorized() || axis.isTimeSeries()) && config.axis_x_tick_fit && !config.axis_x_tick_culling && !config.axis_x_tick_multiline && xAxisTickRotate > 0 && xAxisTickRotate < 90) {
|
|
15027
|
+
if ((axis.isCategorized() || axis.isTimeSeries()) && config.axis_x_tick_fit && (!config.axis_x_tick_culling || isEmpty(config.axis_x_tick_culling)) && !config.axis_x_tick_multiline && xAxisTickRotate > 0 && xAxisTickRotate < 90) {
|
|
15000
15028
|
const widthWithoutCurrentPaddingLeft = state.current.width - $$.getCurrentPaddingByDirection("left"),
|
|
15001
15029
|
maxOverflow = this.getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft - defaultPadding),
|
|
15002
15030
|
xAxisTickTextY2Overflow = Math.max(0, maxOverflow) + defaultPadding;
|
|
@@ -16154,7 +16182,6 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
16154
16182
|
* @private
|
|
16155
16183
|
*/
|
|
16156
16184
|
setYAxisClipPath: function setYAxisClipPath(node) {
|
|
16157
|
-
var _config$padding;
|
|
16158
16185
|
const $$ = this,
|
|
16159
16186
|
config = $$.config,
|
|
16160
16187
|
_$$$state3 = $$.state,
|
|
@@ -16167,7 +16194,7 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
16167
16194
|
x = isInner && !isRotated ? config.axis_y_label.text ? -20 : -1 : isRotated ? -(1 + left) : -(left - 1),
|
|
16168
16195
|
y = -(isRotated ? 20 : margin.top),
|
|
16169
16196
|
w = (isRotated ? width + 15 + left : margin.left + 20) + (isInner ? 20 : 0),
|
|
16170
|
-
h = (isRotated ? margin.bottom +
|
|
16197
|
+
h = (isRotated ? margin.bottom + 10 : margin.top + height) + 10;
|
|
16171
16198
|
node.attr("x", x).attr("y", y).attr("width", w).attr("height", h);
|
|
16172
16199
|
},
|
|
16173
16200
|
updateXAxisTickClip: function updateXAxisTickClip() {
|
|
@@ -16802,7 +16829,6 @@ function smoothLines(el, type) {
|
|
|
16802
16829
|
config = $$.config,
|
|
16803
16830
|
state = $$.state,
|
|
16804
16831
|
_state = state,
|
|
16805
|
-
current = _state.current,
|
|
16806
16832
|
rotatedPadding = _state.rotatedPadding,
|
|
16807
16833
|
isLegendRight = _state.isLegendRight,
|
|
16808
16834
|
isLegendInset = _state.isLegendInset,
|
|
@@ -16823,17 +16849,8 @@ function smoothLines(el, type) {
|
|
|
16823
16849
|
if (id === "y2" && !config.axis_y2_show) {
|
|
16824
16850
|
return isFitPadding ? 0 : rotatedPadding.top;
|
|
16825
16851
|
}
|
|
16826
|
-
const maxtickSize = $$.axis.getMaxTickSize(id)
|
|
16827
|
-
|
|
16828
|
-
// Calculate x/y axis height when tick rotated
|
|
16829
|
-
if ((id === "x" && !isRotated || /y2?/.test(id) && isRotated) && rotate) {
|
|
16830
|
-
h += maxtickSize.width * Math.cos(Math.PI * (90 - Math.abs(rotate)) / 180);
|
|
16831
|
-
if (!config.axis_x_tick_multiline && current.height) {
|
|
16832
|
-
if (h > current.height / 2) {
|
|
16833
|
-
h = current.height / 2;
|
|
16834
|
-
}
|
|
16835
|
-
}
|
|
16836
|
-
} else if (maxtickSize.height > 13 && config.legend_show) {
|
|
16852
|
+
const maxtickSize = $$.axis.getMaxTickSize(id);
|
|
16853
|
+
if (maxtickSize.height > 13) {
|
|
16837
16854
|
h += maxtickSize.height - 13;
|
|
16838
16855
|
}
|
|
16839
16856
|
return h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id === "y2" && !isRotated ? -10 : 0);
|
|
@@ -16876,7 +16893,7 @@ function smoothLines(el, type) {
|
|
|
16876
16893
|
}
|
|
16877
16894
|
state.axis.x.tickCount = tickCount;
|
|
16878
16895
|
}
|
|
16879
|
-
if ($el.svg && config.
|
|
16896
|
+
if ($el.svg && config.axis_x_tick_autorotate && config.axis_x_tick_fit && !config.axis_x_tick_multiline && !config.axis_x_tick_culling && allowedXAxisTypes) {
|
|
16880
16897
|
rotate = $$.needToRotateXAxisTickTexts() ? config.axis_x_tick_rotate : 0;
|
|
16881
16898
|
}
|
|
16882
16899
|
}
|
|
@@ -19201,7 +19218,7 @@ function getAttrTweenFn(fn) {
|
|
|
19201
19218
|
const $$ = this,
|
|
19202
19219
|
hasGauge = $$.hasType("gauge");
|
|
19203
19220
|
if ($$.shouldShowArcLabel()) {
|
|
19204
|
-
selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.
|
|
19221
|
+
selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.updateTextBackgroundColor.bind($$)).each(function (d) {
|
|
19205
19222
|
var _filter;
|
|
19206
19223
|
const node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
19207
19224
|
updated = $$.updateAngle(d),
|
|
@@ -25543,7 +25560,7 @@ let _defaults = {};
|
|
|
25543
25560
|
|
|
25544
25561
|
/**
|
|
25545
25562
|
* @namespace bb
|
|
25546
|
-
* @version 3.10.
|
|
25563
|
+
* @version 3.10.3
|
|
25547
25564
|
*/
|
|
25548
25565
|
const bb = {
|
|
25549
25566
|
/**
|
|
@@ -25553,7 +25570,7 @@ const bb = {
|
|
|
25553
25570
|
* bb.version; // "1.0.0"
|
|
25554
25571
|
* @memberof bb
|
|
25555
25572
|
*/
|
|
25556
|
-
version: "3.10.
|
|
25573
|
+
version: "3.10.3",
|
|
25557
25574
|
/**
|
|
25558
25575
|
* Generate chart
|
|
25559
25576
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|
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.10.
|
|
8
|
+
* @version 3.10.3
|
|
9
9
|
*/.bb svg{-webkit-tap-highlight-color:rgba(0,0,0,0);font:10px sans-serif}.bb line,.bb path{fill:none;stroke:#000}.bb .bb-button,.bb text{-webkit-user-select:none;-moz-user-select:none;user-select:none}.bb-legend-item-tile,.bb-xgrid-focus,.bb-ygrid,.bb-ygrid-focus{shape-rendering:crispEdges}.bb-chart-arc .bb-gauge-value,.bb-chart-arcs .bb-needle{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-axis{shape-rendering:crispEdges}.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:grey;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-circles.bb-focused,.bb-target.bb-focused{opacity:1}.bb-circles.bb-focused path.bb-line,.bb-circles.bb-focused path.bb-step,.bb-target.bb-focused path.bb-line,.bb-target.bb-focused path.bb-step{stroke-width:2px}.bb-circles.bb-defocused,.bb-target.bb-defocused{opacity:.3!important}.bb-circles.bb-defocused .text-overlapping,.bb-target.bb-defocused .text-overlapping{opacity:.05!important}.bb-region rect{fill:#4682b4;fill-opacity:.1}.bb-brush .extent,.bb-zoom-brush{fill-opacity:.1}.bb-legend-item{font-size:12px;user-select:none}.bb-legend-item-hidden{opacity:.15}.bb-legend-background{fill:#fff;stroke:#d3d3d3;stroke-width:1;opacity:.75}.bb-title{font:14px sans-serif}.bb-chart-treemaps rect{stroke:#fff;stroke-width:1px}.bb-tooltip-container{user-select:none;z-index:10}.bb-tooltip{background-color:#fff;border-collapse:collapse;border-spacing:0;box-shadow:7px 7px 12px -9px #777;empty-cells:show;opacity:.9;white-space:nowrap}.bb-tooltip tr{border:1px solid #ccc}.bb-tooltip th{background-color:#aaa;color:#fff;font-size:14px;padding:2px 5px;text-align:left}.bb-tooltip td{background-color:#fff;border-left:1px dotted #999;font-size:13px;padding:3px 6px}.bb-tooltip td>span,.bb-tooltip td>svg{display:inline-block;height:10px;margin-right:6px;width:10px}.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{cursor:default;font-size:1.15em}.bb-chart-radars .bb-shapes polygon{fill-opacity:.2;stroke-width:1px}.bb-button{position:absolute;right:10px;top:10px}.bb-button .bb-zoom-reset{background-color:#fff;border:1px solid #ccc;border-radius:5px;cursor:pointer;font-size:11px;padding:5px}
|