billboard.js 3.7.5 → 3.8.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 +368 -221
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +371 -224
- package/dist/billboard.pkgd.min.js +3 -3
- 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 +20 -18
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +20 -18
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +20 -18
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +20 -18
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +4 -4
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +22 -20
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +22 -20
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +22 -20
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +49 -30
- 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-esm/billboard.js +339 -204
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +4 -9
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +6 -11
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +7 -12
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -7
- package/package.json +25 -25
- package/src/Chart/api/focus.ts +4 -4
- package/src/Chart/api/grid.ts +206 -0
- package/src/Chart/api/load.ts +31 -21
- package/src/Chart/api/regions.ts +28 -24
- package/src/Chart/api/zoom.ts +18 -3
- package/src/ChartInternal/Axis/Axis.ts +1 -0
- package/src/ChartInternal/Axis/AxisRenderer.ts +7 -2
- package/src/ChartInternal/ChartInternal.ts +1 -1
- package/src/ChartInternal/data/convert.ts +6 -3
- package/src/ChartInternal/data/data.ts +19 -15
- package/src/ChartInternal/data/load.ts +19 -4
- package/src/ChartInternal/interactions/eventrect.ts +3 -2
- package/src/ChartInternal/interactions/subchart.ts +3 -2
- package/src/ChartInternal/interactions/zoom.ts +10 -3
- package/src/ChartInternal/internals/clip.ts +3 -2
- package/src/ChartInternal/internals/domain.ts +17 -8
- package/src/ChartInternal/internals/legend.ts +4 -1
- package/src/ChartInternal/internals/redraw.ts +0 -16
- package/src/ChartInternal/internals/scale.ts +7 -4
- package/src/ChartInternal/internals/size.axis.ts +14 -4
- package/src/ChartInternal/internals/size.ts +41 -18
- package/src/ChartInternal/internals/transform.ts +1 -1
- package/src/ChartInternal/internals/type.ts +10 -0
- package/src/config/Options/axis/x.ts +17 -0
- package/src/config/Options/axis/y.ts +2 -1
- package/src/config/Options/axis/y2.ts +2 -1
- package/src/config/Options/common/main.ts +19 -1
- package/src/config/resolver/axis.ts +2 -4
- package/src/module/browser.ts +13 -5
- package/src/module/generator.ts +3 -3
- package/src/module/util.ts +2 -2
- package/types/axis.d.ts +8 -7
- package/types/chart.d.ts +6 -1
- package/types/options.d.ts +6 -0
- package/src/Chart/api/grid.x.ts +0 -90
- package/src/Chart/api/grid.y.ts +0 -92
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.8.0-next.1
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -230,23 +230,25 @@ var _this = undefined;
|
|
|
230
230
|
/* eslint-disable no-new-func, no-undef */
|
|
231
231
|
|
|
232
232
|
var win = function () {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}.bind(undefined)()
|
|
233
|
+
_newArrowCheck(this, _this);
|
|
234
|
+
var root = typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis || typeof global === "object" && global !== null && global.Object === Object && global || typeof self === "object" && self !== null && self.Object === Object && self;
|
|
235
|
+
return root || Function("return this")();
|
|
236
|
+
}.bind(undefined)(),
|
|
237
|
+
hasRAF = typeof win.requestAnimationFrame === "function",
|
|
238
|
+
hasRIC = typeof win.requestIdleCallback === "function",
|
|
239
|
+
requestAnimationFrame = hasRAF ? win.requestAnimationFrame : function (cb) {
|
|
240
|
+
_newArrowCheck(this, _this);
|
|
241
|
+
return setTimeout(cb, 1);
|
|
242
|
+
}.bind(undefined),
|
|
243
|
+
cancelAnimationFrame = hasRAF ? win.cancelAnimationFrame : function (id) {
|
|
244
|
+
_newArrowCheck(this, _this);
|
|
245
|
+
return clearTimeout(id);
|
|
246
|
+
}.bind(undefined),
|
|
247
|
+
requestIdleCallback = hasRIC ? win.requestIdleCallback : requestAnimationFrame,
|
|
248
|
+
cancelIdleCallback = hasRIC ? win.cancelIdleCallback : cancelAnimationFrame,
|
|
249
|
+
browser_doc = win == null ? void 0 : win.document;
|
|
237
250
|
/* eslint-enable no-new-func, no-undef */
|
|
238
|
-
|
|
239
251
|
// fallback for non-supported environments
|
|
240
|
-
win.requestIdleCallback = win.requestIdleCallback || function (cb) {
|
|
241
|
-
_newArrowCheck(this, _this);
|
|
242
|
-
return setTimeout(cb, 1);
|
|
243
|
-
}.bind(undefined);
|
|
244
|
-
// win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
|
|
245
|
-
win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
|
|
246
|
-
_newArrowCheck(this, _this);
|
|
247
|
-
return setTimeout(cb, 1);
|
|
248
|
-
}.bind(undefined);
|
|
249
|
-
var browser_doc = win == null ? void 0 : win.document;
|
|
250
252
|
;// CONCATENATED MODULE: ./src/config/const.ts
|
|
251
253
|
/**
|
|
252
254
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -1215,7 +1217,7 @@ function convertInputType(mouse, touch) {
|
|
|
1215
1217
|
function runUntil(fn, conditionFn) {
|
|
1216
1218
|
var _this18 = this;
|
|
1217
1219
|
if (conditionFn() === !1) {
|
|
1218
|
-
|
|
1220
|
+
requestAnimationFrame(function () {
|
|
1219
1221
|
_newArrowCheck(this, _this18);
|
|
1220
1222
|
return runUntil(fn, conditionFn);
|
|
1221
1223
|
}.bind(this));
|
|
@@ -1827,15 +1829,30 @@ var Store = /*#__PURE__*/function () {
|
|
|
1827
1829
|
* - `false`: Remove padding completely and make shape to fully occupy the container element.
|
|
1828
1830
|
* - In this case, axes and subchart will be hidden.
|
|
1829
1831
|
* - To adjust some padding from this state, use `axis.[x|y].padding` option.
|
|
1832
|
+
* @property {string} [padding.mode] padding mode
|
|
1833
|
+
* - `"fit"`: Reduce padding as much as possible to make chart fit to the container element for chart types w/axis.<br>When specified, all padding values will be relative from fitted value.
|
|
1830
1834
|
* @property {number} [padding.top] padding on the top of chart
|
|
1831
1835
|
* @property {number} [padding.right] padding on the right of chart
|
|
1832
1836
|
* @property {number} [padding.bottom] padding on the bottom of chart
|
|
1833
1837
|
* @property {number} [padding.left] padding on the left of chart
|
|
1834
1838
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.Padding)
|
|
1839
|
+
* @see [Demo: Fit padding](https://naver.github.io/billboard.js/demo/#ChartOptions.FitPadding)
|
|
1835
1840
|
* @example
|
|
1836
1841
|
* // remove padding completely.
|
|
1837
1842
|
* padding: false,
|
|
1838
1843
|
*
|
|
1844
|
+
* padding: {
|
|
1845
|
+
* // specifying mode value, will reduce padding and make fit to the container element.
|
|
1846
|
+
* mode: "fit"
|
|
1847
|
+
*
|
|
1848
|
+
* // when mode is "fit", all padding values will be relative from fitted value.
|
|
1849
|
+
* // so, 0 will be initial fitted value.
|
|
1850
|
+
* top: 20,
|
|
1851
|
+
* right: 20,
|
|
1852
|
+
* bottom: 20,
|
|
1853
|
+
* left: 20
|
|
1854
|
+
* }
|
|
1855
|
+
*
|
|
1839
1856
|
* // or specify padding value for each side
|
|
1840
1857
|
* padding: {
|
|
1841
1858
|
* top: 20,
|
|
@@ -1845,6 +1862,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
1845
1862
|
* }
|
|
1846
1863
|
*/
|
|
1847
1864
|
padding: !0,
|
|
1865
|
+
padding_mode: undefined,
|
|
1848
1866
|
padding_left: undefined,
|
|
1849
1867
|
padding_right: undefined,
|
|
1850
1868
|
padding_top: undefined,
|
|
@@ -1858,7 +1876,9 @@ var Store = /*#__PURE__*/function () {
|
|
|
1858
1876
|
* @property {boolean} [resize.auto=true] Set chart resize automatically on viewport changes.
|
|
1859
1877
|
* @property {boolean|number} [resize.timer=true] Set resize timer option.
|
|
1860
1878
|
* - **NOTE:**
|
|
1861
|
-
* - The resize function will be called using:
|
|
1879
|
+
* - The resize function will be called using:
|
|
1880
|
+
* - true: `setTimeout()`
|
|
1881
|
+
* - false: `requestIdleCallback()`
|
|
1862
1882
|
* - Given number(delay in ms) value, resize function will be triggered using `setTimer()` with given delay.
|
|
1863
1883
|
* @example
|
|
1864
1884
|
* resize: {
|
|
@@ -3699,7 +3719,7 @@ function generateResize(option) {
|
|
|
3699
3719
|
var _this = this;
|
|
3700
3720
|
// Delay all resize functions call, to prevent unintended excessive call from resize event
|
|
3701
3721
|
callResizeFn.clear();
|
|
3702
|
-
if (option === !1
|
|
3722
|
+
if (option === !1) {
|
|
3703
3723
|
requestIdleCallback(function () {
|
|
3704
3724
|
var _this2 = this;
|
|
3705
3725
|
_newArrowCheck(this, _this);
|
|
@@ -4151,6 +4171,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4151
4171
|
axis = $$.axis,
|
|
4152
4172
|
config = $$.config,
|
|
4153
4173
|
state = $$.state,
|
|
4174
|
+
chartType = config.data_type,
|
|
4154
4175
|
isCategorized = !1,
|
|
4155
4176
|
isTimeSeries = !1,
|
|
4156
4177
|
isCustomX = !1;
|
|
@@ -4294,11 +4315,12 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4294
4315
|
state.hasPositiveValue = $$.hasPositiveValueInTargets(targets);
|
|
4295
4316
|
|
|
4296
4317
|
// set target types
|
|
4297
|
-
if (
|
|
4298
|
-
$$.
|
|
4318
|
+
if (chartType && $$.isValidChartType(chartType)) {
|
|
4319
|
+
var targetIds = $$.mapToIds(targets).filter(function (id) {
|
|
4299
4320
|
_newArrowCheck(this, _this2);
|
|
4300
|
-
return !(id in config.data_types);
|
|
4301
|
-
}.bind(this))
|
|
4321
|
+
return !(id in config.data_types) || !$$.isValidChartType(config.data_types[id]);
|
|
4322
|
+
}.bind(this));
|
|
4323
|
+
$$.setTargetType(targetIds, chartType);
|
|
4302
4324
|
}
|
|
4303
4325
|
|
|
4304
4326
|
// cache as original id keyed
|
|
@@ -4679,7 +4701,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4679
4701
|
getMaxDataCountTarget: function getMaxDataCountTarget() {
|
|
4680
4702
|
var _this18 = this,
|
|
4681
4703
|
target = this.filterTargetsToShow() || [],
|
|
4682
|
-
length = target.length
|
|
4704
|
+
length = target.length,
|
|
4705
|
+
isInverted = this.config.axis_x_inverted;
|
|
4683
4706
|
if (length > 1) {
|
|
4684
4707
|
target = target.map(function (t) {
|
|
4685
4708
|
_newArrowCheck(this, _this18);
|
|
@@ -4691,11 +4714,11 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4691
4714
|
_newArrowCheck(this, _this18);
|
|
4692
4715
|
return v.x;
|
|
4693
4716
|
}.bind(this));
|
|
4694
|
-
target = sortValue(getUnique(target)).map(function (x, index) {
|
|
4717
|
+
target = sortValue(getUnique(target)).map(function (x, index, array) {
|
|
4695
4718
|
_newArrowCheck(this, _this18);
|
|
4696
4719
|
return {
|
|
4697
4720
|
x: x,
|
|
4698
|
-
index: index
|
|
4721
|
+
index: isInverted ? array.length - index - 1 : index
|
|
4699
4722
|
};
|
|
4700
4723
|
}.bind(this));
|
|
4701
4724
|
} else if (length) {
|
|
@@ -5089,36 +5112,40 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5089
5112
|
return values;
|
|
5090
5113
|
}
|
|
5091
5114
|
|
|
5092
|
-
//
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5115
|
+
// when all datas are null, return empty array
|
|
5116
|
+
// https://github.com/naver/billboard.js/issues/3124
|
|
5117
|
+
if (converted.length) {
|
|
5118
|
+
// insert & append cloning first/last value to be fully rendered covering on each gap sides
|
|
5119
|
+
var head = converted[0],
|
|
5120
|
+
tail = converted[converted.length - 1],
|
|
5121
|
+
id = head.id;
|
|
5122
|
+
var x = head.x;
|
|
5123
|
+
|
|
5124
|
+
// insert head
|
|
5125
|
+
converted.unshift({
|
|
5126
|
+
x: --x,
|
|
5127
|
+
value: head.value,
|
|
5128
|
+
id: id
|
|
5129
|
+
});
|
|
5130
|
+
isCategorized && stepType === "step-after" && converted.unshift({
|
|
5131
|
+
x: --x,
|
|
5132
|
+
value: head.value,
|
|
5133
|
+
id: id
|
|
5134
|
+
});
|
|
5109
5135
|
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5136
|
+
// append tail
|
|
5137
|
+
x = tail.x;
|
|
5138
|
+
converted.push({
|
|
5139
|
+
x: ++x,
|
|
5140
|
+
value: tail.value,
|
|
5141
|
+
id: id
|
|
5142
|
+
});
|
|
5143
|
+
isCategorized && stepType === "step-before" && converted.push({
|
|
5144
|
+
x: ++x,
|
|
5145
|
+
value: tail.value,
|
|
5146
|
+
id: id
|
|
5147
|
+
});
|
|
5148
|
+
}
|
|
5122
5149
|
return converted;
|
|
5123
5150
|
},
|
|
5124
5151
|
convertValuesToRange: function convertValuesToRange(values) {
|
|
@@ -5344,11 +5371,27 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5344
5371
|
*/
|
|
5345
5372
|
|
|
5346
5373
|
|
|
5374
|
+
|
|
5375
|
+
/**
|
|
5376
|
+
* Call done callback with resize after transition
|
|
5377
|
+
* @param {Function} fn Callback function
|
|
5378
|
+
* @param {boolean} resizeAfter Weather to resize chart after the load
|
|
5379
|
+
* @private
|
|
5380
|
+
*/
|
|
5381
|
+
function callDone(fn, resizeAfter) {
|
|
5382
|
+
if (resizeAfter === void 0) {
|
|
5383
|
+
resizeAfter = !1;
|
|
5384
|
+
}
|
|
5385
|
+
var $$ = this,
|
|
5386
|
+
api = $$.api;
|
|
5387
|
+
resizeAfter && $$.api.flush(!0);
|
|
5388
|
+
fn == null ? void 0 : fn.call(api);
|
|
5389
|
+
}
|
|
5347
5390
|
/* harmony default export */ var load = ({
|
|
5348
5391
|
load: function load(rawTargets, args) {
|
|
5349
5392
|
var _this = this,
|
|
5350
|
-
_args$done,
|
|
5351
5393
|
$$ = this,
|
|
5394
|
+
data = $$.data,
|
|
5352
5395
|
append = args.append,
|
|
5353
5396
|
targets = rawTargets;
|
|
5354
5397
|
if (targets) {
|
|
@@ -5368,7 +5411,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5368
5411
|
}
|
|
5369
5412
|
|
|
5370
5413
|
// Update/Add data
|
|
5371
|
-
|
|
5414
|
+
data.targets.forEach(function (d) {
|
|
5372
5415
|
_newArrowCheck(this, _this);
|
|
5373
5416
|
for (var i = 0; i < targets.length; i++) {
|
|
5374
5417
|
if (d.id === targets[i].id) {
|
|
@@ -5378,11 +5421,11 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5378
5421
|
}
|
|
5379
5422
|
}
|
|
5380
5423
|
}.bind(this));
|
|
5381
|
-
|
|
5424
|
+
data.targets = data.targets.concat(targets); // add remained
|
|
5382
5425
|
}
|
|
5383
5426
|
|
|
5384
5427
|
// Set targets
|
|
5385
|
-
$$.updateTargets(
|
|
5428
|
+
$$.updateTargets(data.targets);
|
|
5386
5429
|
|
|
5387
5430
|
// Redraw with new targets
|
|
5388
5431
|
$$.redraw({
|
|
@@ -5393,7 +5436,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5393
5436
|
|
|
5394
5437
|
// Update current state chart type and elements list after redraw
|
|
5395
5438
|
$$.updateTypesElements();
|
|
5396
|
-
(
|
|
5439
|
+
callDone.call($$, args.done, args.resizeAfter);
|
|
5397
5440
|
},
|
|
5398
5441
|
loadFromArgs: function loadFromArgs(args) {
|
|
5399
5442
|
var _this2 = this,
|
|
@@ -6396,7 +6439,9 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6396
6439
|
getXDomain: function getXDomain(targets) {
|
|
6397
6440
|
var $$ = this,
|
|
6398
6441
|
axis = $$.axis,
|
|
6442
|
+
config = $$.config,
|
|
6399
6443
|
x = $$.scale.x,
|
|
6444
|
+
isInverted = config.axis_x_inverted,
|
|
6400
6445
|
domain = [$$.getXDomainMinMax(targets, "min"), $$.getXDomainMinMax(targets, "max")];
|
|
6401
6446
|
var _domain$ = domain[0],
|
|
6402
6447
|
min = _domain$ === void 0 ? 0 : _domain$,
|
|
@@ -6426,7 +6471,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6426
6471
|
max = isTimeSeries ? new Date(lastX.getTime() + padding.right) : lastX + padding.right;
|
|
6427
6472
|
}
|
|
6428
6473
|
}
|
|
6429
|
-
return [min, max];
|
|
6474
|
+
return isInverted ? [max, min] : [min, max];
|
|
6430
6475
|
},
|
|
6431
6476
|
updateXDomain: function updateXDomain(targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) {
|
|
6432
6477
|
var $$ = this,
|
|
@@ -6438,7 +6483,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6438
6483
|
zoomEnabled = config.zoom_enabled;
|
|
6439
6484
|
if (withUpdateOrgXDomain) {
|
|
6440
6485
|
var _$$$brush;
|
|
6441
|
-
x.domain(domain || sortValue($$.getXDomain(targets)));
|
|
6486
|
+
x.domain(domain || sortValue($$.getXDomain(targets), !config.axis_x_inverted));
|
|
6442
6487
|
org.xDomain = x.domain();
|
|
6443
6488
|
zoomEnabled && $$.zoom.updateScaleExtent();
|
|
6444
6489
|
subX.domain(x.domain());
|
|
@@ -6454,15 +6499,24 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6454
6499
|
withTrim && x.domain($$.trimXDomain(x.orgDomain()));
|
|
6455
6500
|
return x.domain();
|
|
6456
6501
|
},
|
|
6502
|
+
/**
|
|
6503
|
+
* Trim x domain when given domain surpasses the range
|
|
6504
|
+
* @param {Array} domain Domain value
|
|
6505
|
+
* @returns {Array} Trimed domain if given domain is out of range
|
|
6506
|
+
* @private
|
|
6507
|
+
*/
|
|
6457
6508
|
trimXDomain: function trimXDomain(domain) {
|
|
6458
|
-
var
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6509
|
+
var $$ = this,
|
|
6510
|
+
isInverted = $$.config.axis_x_inverted,
|
|
6511
|
+
zoomDomain = $$.getZoomDomain(),
|
|
6512
|
+
_zoomDomain = zoomDomain,
|
|
6513
|
+
min = _zoomDomain[0],
|
|
6514
|
+
max = _zoomDomain[1];
|
|
6515
|
+
if (isInverted ? domain[0] >= min : domain[0] <= min) {
|
|
6463
6516
|
domain[0] = min;
|
|
6517
|
+
domain[1] = +domain[1] + (min - domain[0]);
|
|
6464
6518
|
}
|
|
6465
|
-
if (
|
|
6519
|
+
if (isInverted ? domain[1] <= max : domain[1] >= max) {
|
|
6466
6520
|
domain[0] = +domain[0] - (domain[1] - max);
|
|
6467
6521
|
domain[1] = max;
|
|
6468
6522
|
}
|
|
@@ -6807,13 +6861,15 @@ function getLegendColor(id) {
|
|
|
6807
6861
|
* @private
|
|
6808
6862
|
*/
|
|
6809
6863
|
getLegendHeight: function getLegendHeight() {
|
|
6810
|
-
var
|
|
6864
|
+
var _$$$config$padding,
|
|
6865
|
+
$$ = this,
|
|
6811
6866
|
_$$$state3 = $$.state,
|
|
6812
6867
|
current = _$$$state3.current,
|
|
6813
6868
|
isLegendRight = _$$$state3.isLegendRight,
|
|
6814
6869
|
legendItemHeight = _$$$state3.legendItemHeight,
|
|
6815
|
-
legendStep = _$$$state3.legendStep
|
|
6816
|
-
|
|
6870
|
+
legendStep = _$$$state3.legendStep,
|
|
6871
|
+
isFitPadding = ((_$$$config$padding = $$.config.padding) == null ? void 0 : _$$$config$padding.mode) === "fit";
|
|
6872
|
+
return $$.config.legend_show ? isLegendRight ? current.height : (isFitPadding ? 10 : Math.max(20, legendItemHeight)) * (legendStep + 1) : 0;
|
|
6817
6873
|
},
|
|
6818
6874
|
/**
|
|
6819
6875
|
* Get the opacity of the legend that is unfocused
|
|
@@ -7584,20 +7640,6 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7584
7640
|
|
|
7585
7641
|
// Draw with new sizes & scales
|
|
7586
7642
|
$$.redraw(options, transitions);
|
|
7587
|
-
},
|
|
7588
|
-
/**
|
|
7589
|
-
* Redraw without rescale
|
|
7590
|
-
* @private
|
|
7591
|
-
*/
|
|
7592
|
-
redrawWithoutRescale: function redrawWithoutRescale() {
|
|
7593
|
-
this.redraw({
|
|
7594
|
-
withY: !1,
|
|
7595
|
-
withDimension: !1,
|
|
7596
|
-
withLegend: !1,
|
|
7597
|
-
withSubchart: !1,
|
|
7598
|
-
withEventRect: !1,
|
|
7599
|
-
withTransitionForAxis: !1
|
|
7600
|
-
});
|
|
7601
7643
|
}
|
|
7602
7644
|
});
|
|
7603
7645
|
;// CONCATENATED MODULE: ./src/ChartInternal/internals/scale.ts
|
|
@@ -7650,7 +7692,7 @@ function getScale(type, min, max) {
|
|
|
7650
7692
|
getXScale: function getXScale(min, max, domain, offset) {
|
|
7651
7693
|
var $$ = this,
|
|
7652
7694
|
scale = $$.scale.zoom || getScale($$.axis.getAxisType("x"), min, max);
|
|
7653
|
-
return $$.
|
|
7695
|
+
return $$.getCustomizedXScale(domain ? scale.domain(domain) : scale, offset);
|
|
7654
7696
|
},
|
|
7655
7697
|
/**
|
|
7656
7698
|
* Get y Axis scale function
|
|
@@ -7684,19 +7726,20 @@ function getScale(type, min, max) {
|
|
|
7684
7726
|
return this.scale[key];
|
|
7685
7727
|
},
|
|
7686
7728
|
/**
|
|
7687
|
-
* Get customized scale
|
|
7729
|
+
* Get customized x axis scale
|
|
7688
7730
|
* @param {d3.scaleLinear|d3.scaleTime} scaleValue Scale function
|
|
7689
7731
|
* @param {Function} offsetValue Offset getter to be sum
|
|
7690
7732
|
* @returns {Function} Scale function
|
|
7691
7733
|
* @private
|
|
7692
7734
|
*/
|
|
7693
|
-
|
|
7735
|
+
getCustomizedXScale: function getCustomizedXScale(scaleValue, offsetValue) {
|
|
7694
7736
|
var _this = this,
|
|
7695
7737
|
$$ = this,
|
|
7696
7738
|
offset = offsetValue || function () {
|
|
7697
7739
|
_newArrowCheck(this, _this);
|
|
7698
7740
|
return $$.axis.x.tickOffset();
|
|
7699
7741
|
}.bind(this),
|
|
7742
|
+
isInverted = $$.config.axis_x_inverted,
|
|
7700
7743
|
scale = function (d, raw) {
|
|
7701
7744
|
var v = scaleValue(d) + offset();
|
|
7702
7745
|
return raw ? v : Math.ceil(v);
|
|
@@ -7720,7 +7763,7 @@ function getScale(type, min, max) {
|
|
|
7720
7763
|
var domain = domainValue;
|
|
7721
7764
|
if (!arguments.length) {
|
|
7722
7765
|
domain = this.orgDomain();
|
|
7723
|
-
return [domain[0], domain[1] + 1];
|
|
7766
|
+
return isInverted ? [domain[0] + 1, domain[1]] : [domain[0], domain[1] + 1];
|
|
7724
7767
|
}
|
|
7725
7768
|
scaleValue.domain(domain);
|
|
7726
7769
|
return scale;
|
|
@@ -8363,47 +8406,60 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8363
8406
|
return padding + (axesLen ? $$.getHorizontalAxisHeight(axisId) * axesLen : 0);
|
|
8364
8407
|
},
|
|
8365
8408
|
getCurrentPaddingLeft: function getCurrentPaddingLeft(withoutRecompute) {
|
|
8366
|
-
var
|
|
8409
|
+
var _config$padding,
|
|
8410
|
+
$$ = this,
|
|
8367
8411
|
config = $$.config,
|
|
8368
8412
|
hasAxis = $$.state.hasAxis,
|
|
8369
8413
|
isRotated = config.axis_rotated,
|
|
8414
|
+
isFitPadding = ((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit",
|
|
8370
8415
|
axisId = isRotated ? "x" : "y",
|
|
8371
8416
|
axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0,
|
|
8372
8417
|
axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0;
|
|
8373
|
-
|
|
8418
|
+
if (!isFitPadding) {
|
|
8419
|
+
axisWidth = ceil10(axisWidth);
|
|
8420
|
+
}
|
|
8421
|
+
var padding = config["axis_" + axisId + "_inner"] || !config["axis_" + axisId + "_show"] ? 0 : axisWidth;
|
|
8374
8422
|
if (isValue(config.padding_left)) {
|
|
8375
|
-
padding = config.padding_left;
|
|
8423
|
+
padding = config.padding_left + (isFitPadding && isRotated ? axisWidth : 0);
|
|
8376
8424
|
} else if (hasAxis && isRotated) {
|
|
8377
|
-
padding = !config.axis_x_show ? 1 : Math.max(
|
|
8378
|
-
}
|
|
8379
|
-
|
|
8380
|
-
padding
|
|
8381
|
-
} else {
|
|
8382
|
-
padding = ceil10(axisWidth);
|
|
8425
|
+
padding = !config.axis_x_show ? 1 : isFitPadding ? axisWidth : Math.max(axisWidth, 40);
|
|
8426
|
+
}
|
|
8427
|
+
if (hasAxis && (isFitPadding || config["axis_" + axisId + "_inner"]) && config["axis_" + axisId + "_label"].text) {
|
|
8428
|
+
padding += $$.axis.getAxisLabelPosition("y").isOuter ? 20 : 0;
|
|
8383
8429
|
}
|
|
8384
8430
|
return padding + axisWidth * axesLen;
|
|
8385
8431
|
},
|
|
8386
8432
|
getCurrentPaddingRight: function getCurrentPaddingRight(withXAxisTickTextOverflow) {
|
|
8433
|
+
var _config$padding2, _$$$axis;
|
|
8387
8434
|
if (withXAxisTickTextOverflow === void 0) {
|
|
8388
8435
|
withXAxisTickTextOverflow = !1;
|
|
8389
8436
|
}
|
|
8390
8437
|
var $$ = this,
|
|
8391
8438
|
config = $$.config,
|
|
8392
8439
|
hasAxis = $$.state.hasAxis,
|
|
8440
|
+
isRotated = config.axis_rotated,
|
|
8441
|
+
isFitPadding = ((_config$padding2 = config.padding) == null ? void 0 : _config$padding2.mode) === "fit",
|
|
8442
|
+
defaultPadding = isFitPadding ? 2 : 10,
|
|
8393
8443
|
legendWidthOnRight = $$.state.isLegendRight ? $$.getLegendWidth() + 20 : 0,
|
|
8394
8444
|
axesLen = hasAxis ? config.axis_y2_axes.length : 0,
|
|
8395
|
-
|
|
8396
|
-
xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(
|
|
8397
|
-
var
|
|
8445
|
+
axisLabelWidth = (_$$$axis = $$.axis) != null && _$$$axis.getAxisLabelPosition("y2").isOuter ? 20 : 0,
|
|
8446
|
+
xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(defaultPadding) : 0;
|
|
8447
|
+
var axisWidth = hasAxis && !config.axis_y2_inner ? $$.getAxisWidthByAxisId("y2") : 1;
|
|
8448
|
+
if (!isFitPadding) {
|
|
8449
|
+
axisWidth = ceil10(axisWidth);
|
|
8450
|
+
}
|
|
8451
|
+
var padding = isRotated ? 0 : Math.max(axisWidth + legendWidthOnRight, xAxisTickTextOverflow);
|
|
8398
8452
|
if (isValue(config.padding_right)) {
|
|
8399
|
-
padding = config.padding_right + (hasAxis ? 1 : 0); // 1 is needed not to hide tick line
|
|
8400
|
-
|
|
8401
|
-
padding =
|
|
8453
|
+
// padding = config.padding_right + (hasAxis ? 1 : 0); // 1 is needed not to hide tick line
|
|
8454
|
+
|
|
8455
|
+
padding = config.padding_right + (isFitPadding && (isRotated || !config.axis_y2_show ? defaultPadding : padding)) + (hasAxis && !isFitPadding ? 1 : 0); // 1 is needed not to hide tick line
|
|
8456
|
+
} else if ($$.axis && isRotated) {
|
|
8457
|
+
padding = defaultPadding + legendWidthOnRight;
|
|
8402
8458
|
} else if ($$.axis && (!config.axis_y2_show || config.axis_y2_inner)) {
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
padding
|
|
8459
|
+
padding = Math.max((isFitPadding && !config.axis_y2_show ? 2 : 1) + legendWidthOnRight + axisLabelWidth, xAxisTickTextOverflow);
|
|
8460
|
+
}
|
|
8461
|
+
if (hasAxis && !isRotated && isFitPadding && config.axis_y2_show && !config.axis_y2_inner && config.axis_y2_label.text) {
|
|
8462
|
+
padding += axisLabelWidth;
|
|
8407
8463
|
}
|
|
8408
8464
|
return padding + axisWidth * axesLen;
|
|
8409
8465
|
},
|
|
@@ -8542,12 +8598,14 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8542
8598
|
* @private
|
|
8543
8599
|
*/
|
|
8544
8600
|
updateSizes: function updateSizes(isInit) {
|
|
8545
|
-
var
|
|
8601
|
+
var _config$padding3,
|
|
8602
|
+
$$ = this,
|
|
8546
8603
|
config = $$.config,
|
|
8547
8604
|
state = $$.state,
|
|
8548
8605
|
legend = $$.$el.legend,
|
|
8549
8606
|
isRotated = config.axis_rotated,
|
|
8550
|
-
isNonAxis = $$.hasArcType() || state.hasTreemap
|
|
8607
|
+
isNonAxis = $$.hasArcType() || state.hasTreemap,
|
|
8608
|
+
isFitPadding = ((_config$padding3 = config.padding) == null ? void 0 : _config$padding3.mode) === "fit";
|
|
8551
8609
|
isInit || $$.setContainerSize();
|
|
8552
8610
|
var currLegend = {
|
|
8553
8611
|
width: legend ? $$.getLegendWidth() : 0,
|
|
@@ -8568,7 +8626,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8568
8626
|
bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + padding.bottom,
|
|
8569
8627
|
left: subchartHeight + (isNonAxis ? 0 : padding.left)
|
|
8570
8628
|
} : {
|
|
8571
|
-
top: 4 + padding.top,
|
|
8629
|
+
top: (isFitPadding ? 0 : 4) + padding.top,
|
|
8572
8630
|
// for top tick text
|
|
8573
8631
|
right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0),
|
|
8574
8632
|
bottom: xAxisHeight + subchartHeight + legendHeightForBottom + padding.bottom,
|
|
@@ -9837,7 +9895,7 @@ function getTextPos(pos, width) {
|
|
|
9837
9895
|
y = isRotated ? state.height + padding : 0;
|
|
9838
9896
|
} else if (target === "y2") {
|
|
9839
9897
|
x = isRotated ? 0 : state.width + padding;
|
|
9840
|
-
y = isRotated ? 1 - padding : 0;
|
|
9898
|
+
y = isRotated && padding ? 1 - padding : 0;
|
|
9841
9899
|
} else if (target === "subX") {
|
|
9842
9900
|
x = 0;
|
|
9843
9901
|
y = isRotated ? 0 : state.height2;
|
|
@@ -9889,6 +9947,15 @@ function getTextPos(pos, width) {
|
|
|
9889
9947
|
|
|
9890
9948
|
|
|
9891
9949
|
/* harmony default export */ var type = ({
|
|
9950
|
+
/**
|
|
9951
|
+
* Check if the given chart type is valid
|
|
9952
|
+
* @param {string} type Chart type string
|
|
9953
|
+
* @returns {boolean}
|
|
9954
|
+
* @private
|
|
9955
|
+
*/
|
|
9956
|
+
isValidChartType: function isValidChartType(type) {
|
|
9957
|
+
return !!(type && Object.values(TYPE).indexOf(type) > -1);
|
|
9958
|
+
},
|
|
9892
9959
|
setTargetType: function setTargetType(targetIds, type) {
|
|
9893
9960
|
var _this = this,
|
|
9894
9961
|
$$ = this,
|
|
@@ -10456,7 +10523,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10456
10523
|
|
|
10457
10524
|
// Set domains for each scale
|
|
10458
10525
|
if (x) {
|
|
10459
|
-
x.domain(sortValue($$.getXDomain($$.data.targets)));
|
|
10526
|
+
x.domain(sortValue($$.getXDomain($$.data.targets), !config.axis_x_inverted));
|
|
10460
10527
|
subX.domain(x.domain());
|
|
10461
10528
|
|
|
10462
10529
|
// Save original x domain for zoom update
|
|
@@ -11716,17 +11783,17 @@ function renderText(ctx, glyph) {
|
|
|
11716
11783
|
state.defocusedTargetIds = targetIds;
|
|
11717
11784
|
},
|
|
11718
11785
|
/**
|
|
11719
|
-
*
|
|
11720
|
-
* You can specify multiple targets by giving an array that includes id as
|
|
11786
|
+
* Revert focused or defocused state to initial state.<br><br>
|
|
11787
|
+
* You can specify multiple targets by giving an array that includes id as string. If no argument is given, all of targets will be reverted.
|
|
11721
11788
|
* @function revert
|
|
11722
11789
|
* @instance
|
|
11723
11790
|
* @memberof Chart
|
|
11724
11791
|
* @param {string|Array} targetIdsValue Target ids to be reverted
|
|
11725
11792
|
* @example
|
|
11726
|
-
* // data1 will be reverted.
|
|
11793
|
+
* // 'data1' will be reverted.
|
|
11727
11794
|
* chart.revert("data1");
|
|
11728
11795
|
*
|
|
11729
|
-
* // data1 and data2 will be reverted.
|
|
11796
|
+
* // 'data1' and 'data2' will be reverted.
|
|
11730
11797
|
* chart.revert(["data1", "data2"]);
|
|
11731
11798
|
*
|
|
11732
11799
|
* // all targets will be reverted.
|
|
@@ -11828,6 +11895,7 @@ var legend_legend = {
|
|
|
11828
11895
|
*/
|
|
11829
11896
|
|
|
11830
11897
|
|
|
11898
|
+
|
|
11831
11899
|
/* harmony default export */ var api_load = ({
|
|
11832
11900
|
/**
|
|
11833
11901
|
* Load data to the chart.<br><br>
|
|
@@ -11842,23 +11910,29 @@ var legend_legend = {
|
|
|
11842
11910
|
* @memberof Chart
|
|
11843
11911
|
* @param {object} args The object can consist with following members:<br>
|
|
11844
11912
|
*
|
|
11845
|
-
* | Key | Description |
|
|
11846
|
-
* | --- | --- |
|
|
11847
|
-
* |
|
|
11848
|
-
* |
|
|
11849
|
-
* |
|
|
11850
|
-
* |
|
|
11851
|
-
* |
|
|
11852
|
-
* |
|
|
11853
|
-
* |
|
|
11854
|
-
* |
|
|
11855
|
-
* |
|
|
11856
|
-
* |
|
|
11857
|
-
* |
|
|
11858
|
-
* |
|
|
11859
|
-
* |
|
|
11860
|
-
* |
|
|
11861
|
-
* |
|
|
11913
|
+
* | Key | Type | Description |
|
|
11914
|
+
* | --- | --- | --- |
|
|
11915
|
+
* | columns | Array | The `columns` data will be loaded. If data that has the same target id is given, the chart will be updated. Otherwise, new target will be added |
|
|
11916
|
+
* | json | Array | The `json` data will be loaded. If data that has the same target id is given, the chart will be updated. Otherwise, new target will be added |
|
|
11917
|
+
* | rows | Array | The `rows` data will be loaded. If data that has the same target id is given, the chart will be updated. Otherwise, new target will be added |
|
|
11918
|
+
* | url | string | The data from `url` will be loaded. If data that has the same target id is given, the chart will be updated. Otherwise, new target will be added |
|
|
11919
|
+
* | | | |
|
|
11920
|
+
* | append | boolean | Load data appending it to the current dataseries.<br>If the existing chart has`x` value, should provide with corresponding `x` value for newly loaded data. |
|
|
11921
|
+
* | axes | Object | The axes specified by data.axes will be updated. axes must be Object that has target id as keys. |
|
|
11922
|
+
* | categories | Array | The categories specified by axis.x.categories or data.x will be updated. categories must be Array. |
|
|
11923
|
+
* | classes | Object | The classes specified by data.classes will be updated. classes must be Object that has target id as keys. |
|
|
11924
|
+
* | colors | Object | The colors specified by data.colors will be updated. colors must be Object that has target id as keys. |
|
|
11925
|
+
* | data | Obejct | Data objects to be loaded. Checkout the example. |
|
|
11926
|
+
* | done | Function | The specified function will be called after data loaded.|
|
|
11927
|
+
* | headers | string | Set request header if loading via `data.url`.<br>@see [data․headers](Options.html#.data%25E2%2580%25A4headers) |
|
|
11928
|
+
* | keys | Object | Choose which JSON objects keys correspond to desired data.<br>**NOTE:** Only for JSON object given as array.<br>@see [data․keys](Options.html#.data%25E2%2580%25A4keys) |
|
|
11929
|
+
* | mimeType | string | Set 'json' if loading JSON via url.<br>@see [data․mimeType](Options.html#.data%25E2%2580%25A4mimeType) |
|
|
11930
|
+
* | names | Object | Same as data.names() |
|
|
11931
|
+
* | resizeAfter | boolean | Resize after the load. Default value is `false`.<br>- This option won't call `onresize` neither `onresized`.<br>- When set to 'true', will call `.flush(true)` at the end of load. |
|
|
11932
|
+
* | type | string | The type of targets will be updated. |
|
|
11933
|
+
* | types | Object | The types of targets will be updated. |
|
|
11934
|
+
* | unload | Array | Specify the data will be unloaded before loading new data. If true given, all of data will be unloaded. If target ids given as String or Array, specified targets will be unloaded. If absent or false given, unload will not occur. |
|
|
11935
|
+
* | xs | string | Same as data.xs option |
|
|
11862
11936
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataFromURL)
|
|
11863
11937
|
* @example
|
|
11864
11938
|
* // Load data1 and unload data2 and data3
|
|
@@ -11870,6 +11944,7 @@ var legend_legend = {
|
|
|
11870
11944
|
* unload: ["data2", "data3"],
|
|
11871
11945
|
* url: "...",
|
|
11872
11946
|
* done: function() { ... }
|
|
11947
|
+
* resizeAfter: true // will resize after load
|
|
11873
11948
|
* });
|
|
11874
11949
|
* @example
|
|
11875
11950
|
* const chart = bb.generate({
|
|
@@ -11999,7 +12074,7 @@ var legend_legend = {
|
|
|
11999
12074
|
_newArrowCheck(this, _this);
|
|
12000
12075
|
// to mitigate improper rendering for multiple consecutive calls
|
|
12001
12076
|
// https://github.com/naver/billboard.js/issues/2121
|
|
12002
|
-
|
|
12077
|
+
requestIdleCallback(function () {
|
|
12003
12078
|
_newArrowCheck(this, _this2);
|
|
12004
12079
|
return $$.loadFromArgs(args);
|
|
12005
12080
|
}.bind(this));
|
|
@@ -12023,13 +12098,15 @@ var legend_legend = {
|
|
|
12023
12098
|
* | --- | --- | --- |
|
|
12024
12099
|
* | ids | String | Array | Target id data to be unloaded. If not given, all data will be unloaded. |
|
|
12025
12100
|
* | done | Fuction | Callback after data is unloaded. |
|
|
12101
|
+
* | resizeAfter | boolean | Resize after the unload. Default value is `false`.<br>- This option won't call `onresize` neither `onresized`.<br>- When set to 'true', will call `.flush(true)` at the end of unload. |
|
|
12026
12102
|
* @example
|
|
12027
12103
|
* // Unload data2 and data3
|
|
12028
12104
|
* chart.unload({
|
|
12029
12105
|
* ids: ["data2", "data3"],
|
|
12030
12106
|
* done: function() {
|
|
12031
12107
|
* // called after the unloaded
|
|
12032
|
-
* }
|
|
12108
|
+
* },
|
|
12109
|
+
* resizeAfter: true // will resize after unload
|
|
12033
12110
|
* });
|
|
12034
12111
|
*/
|
|
12035
12112
|
unload: function unload(argsValue) {
|
|
@@ -12054,7 +12131,7 @@ var legend_legend = {
|
|
|
12054
12131
|
withLegend: !0
|
|
12055
12132
|
});
|
|
12056
12133
|
$$.cache.remove(ids);
|
|
12057
|
-
args.done
|
|
12134
|
+
callDone.call($$, args.done, args.resizeAfter);
|
|
12058
12135
|
}.bind(this));
|
|
12059
12136
|
}
|
|
12060
12137
|
});
|
|
@@ -12741,19 +12818,61 @@ var axis = {
|
|
|
12741
12818
|
return config.axis_x_categories;
|
|
12742
12819
|
}
|
|
12743
12820
|
});
|
|
12744
|
-
;// CONCATENATED MODULE: ./src/Chart/api/grid.
|
|
12821
|
+
;// CONCATENATED MODULE: ./src/Chart/api/grid.ts
|
|
12745
12822
|
/**
|
|
12746
12823
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
12747
12824
|
* billboard.js project is licensed under the MIT license
|
|
12748
12825
|
*/
|
|
12749
12826
|
|
|
12827
|
+
/**
|
|
12828
|
+
* Update grid lines.
|
|
12829
|
+
* @param {Array} grids grid lines to update
|
|
12830
|
+
* @param {string} axisId axis' id: "x" or "y"
|
|
12831
|
+
* @returns {Array}
|
|
12832
|
+
* @private
|
|
12833
|
+
*/
|
|
12834
|
+
function grid(grids, axisId) {
|
|
12835
|
+
var $$ = this.internal,
|
|
12836
|
+
config = $$.config,
|
|
12837
|
+
withTransition = config.transition_duration && isTabVisible(),
|
|
12838
|
+
gridPropLines = "grid_" + axisId + "_lines";
|
|
12839
|
+
if (!grids) {
|
|
12840
|
+
return config[gridPropLines];
|
|
12841
|
+
}
|
|
12842
|
+
config[gridPropLines] = grids;
|
|
12843
|
+
$$.updateGrid();
|
|
12844
|
+
$$.redrawGrid(withTransition);
|
|
12845
|
+
return config[gridPropLines];
|
|
12846
|
+
}
|
|
12847
|
+
|
|
12848
|
+
/**
|
|
12849
|
+
* Add grid lines.
|
|
12850
|
+
* @param {Array|object} grids grid lines to add
|
|
12851
|
+
* @param {string} axisId axis' id: "x" or "y"
|
|
12852
|
+
* @returns {Array}
|
|
12853
|
+
* @private
|
|
12854
|
+
*/
|
|
12855
|
+
function _add(grids, axisId) {
|
|
12856
|
+
return grid.bind(this)(this.internal.config["grid_" + axisId + "_lines"].concat(grids || []), axisId);
|
|
12857
|
+
}
|
|
12858
|
+
|
|
12859
|
+
/**
|
|
12860
|
+
* Remove grid lines.
|
|
12861
|
+
* @param {object} grids grid lines to remove
|
|
12862
|
+
* @param {boolean} isXAxis weather is x axis or not
|
|
12863
|
+
* @private
|
|
12864
|
+
*/
|
|
12865
|
+
function _remove(grids, isXAxis) {
|
|
12866
|
+
this.internal.removeGridLines(grids, isXAxis);
|
|
12867
|
+
}
|
|
12868
|
+
|
|
12750
12869
|
/**
|
|
12751
12870
|
* Update x grid lines.
|
|
12752
12871
|
* @function xgrids
|
|
12753
12872
|
* @instance
|
|
12754
12873
|
* @memberof Chart
|
|
12755
12874
|
* @param {Array} grids X grid lines will be replaced with this argument. The format of this argument is the same as grid.x.lines.
|
|
12756
|
-
* @returns {
|
|
12875
|
+
* @returns {Array}
|
|
12757
12876
|
* @example
|
|
12758
12877
|
* // Show 2 x grid lines
|
|
12759
12878
|
* chart.xgrids([
|
|
@@ -12763,14 +12882,7 @@ var axis = {
|
|
|
12763
12882
|
* // --> Returns: [{value: 1, text: "Label 1"}, {value: 4, text: "Label 4"}]
|
|
12764
12883
|
*/
|
|
12765
12884
|
var xgrids = function (grids) {
|
|
12766
|
-
|
|
12767
|
-
config = $$.config;
|
|
12768
|
-
if (!grids) {
|
|
12769
|
-
return config.grid_x_lines;
|
|
12770
|
-
}
|
|
12771
|
-
config.grid_x_lines = grids;
|
|
12772
|
-
$$.redrawWithoutRescale();
|
|
12773
|
-
return config.grid_x_lines;
|
|
12885
|
+
return grid.bind(this)(grids, "x");
|
|
12774
12886
|
};
|
|
12775
12887
|
extend(xgrids, {
|
|
12776
12888
|
/**
|
|
@@ -12780,7 +12892,7 @@ extend(xgrids, {
|
|
|
12780
12892
|
* @instance
|
|
12781
12893
|
* @memberof Chart
|
|
12782
12894
|
* @param {Array|object} grids New x grid lines will be added. The format of this argument is the same as grid.x.lines and it's possible to give an Object if only one line will be added.
|
|
12783
|
-
* @returns {
|
|
12895
|
+
* @returns {Array}
|
|
12784
12896
|
* @example
|
|
12785
12897
|
* // Add a new x grid line
|
|
12786
12898
|
* chart.xgrids.add(
|
|
@@ -12794,7 +12906,7 @@ extend(xgrids, {
|
|
|
12794
12906
|
* ]);
|
|
12795
12907
|
*/
|
|
12796
12908
|
add: function add(grids) {
|
|
12797
|
-
return
|
|
12909
|
+
return _add.bind(this)(grids, "x");
|
|
12798
12910
|
},
|
|
12799
12911
|
/**
|
|
12800
12912
|
* Remove x grid lines.<br>
|
|
@@ -12802,7 +12914,10 @@ extend(xgrids, {
|
|
|
12802
12914
|
* @function xgrids․remove
|
|
12803
12915
|
* @instance
|
|
12804
12916
|
* @memberof Chart
|
|
12805
|
-
* @param {object}
|
|
12917
|
+
* @param {object} grids This argument should include value or class. If value is given, the x grid lines that have specified x value will be removed. If class is given, the x grid lines that have specified class will be removed. If args is not given, all of x grid lines will be removed.
|
|
12918
|
+
* @param {number} [grids.value] target value
|
|
12919
|
+
* @param {string} [grids.class] target class
|
|
12920
|
+
* @returns {void}
|
|
12806
12921
|
* @example
|
|
12807
12922
|
* // x grid line on x = 2 will be removed
|
|
12808
12923
|
* chart.xgrids.remove({value: 2});
|
|
@@ -12815,20 +12930,11 @@ extend(xgrids, {
|
|
|
12815
12930
|
* // all of x grid lines will be removed
|
|
12816
12931
|
* chart.xgrids.remove();
|
|
12817
12932
|
*/
|
|
12818
|
-
remove: function remove(
|
|
12933
|
+
remove: function remove(grids) {
|
|
12819
12934
|
// TODO: multiple
|
|
12820
|
-
|
|
12935
|
+
return _remove.bind(this)(grids, !0);
|
|
12821
12936
|
}
|
|
12822
12937
|
});
|
|
12823
|
-
/* harmony default export */ var grid_x = ({
|
|
12824
|
-
xgrids: xgrids
|
|
12825
|
-
});
|
|
12826
|
-
;// CONCATENATED MODULE: ./src/Chart/api/grid.y.ts
|
|
12827
|
-
/**
|
|
12828
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
12829
|
-
* billboard.js project is licensed under the MIT license
|
|
12830
|
-
*/
|
|
12831
|
-
|
|
12832
12938
|
|
|
12833
12939
|
/**
|
|
12834
12940
|
* Update y grid lines.
|
|
@@ -12846,14 +12952,7 @@ extend(xgrids, {
|
|
|
12846
12952
|
* // --> Returns: [{value: 100, text: "Label 1"}, {value: 400, text: "Label 4"}]
|
|
12847
12953
|
*/
|
|
12848
12954
|
var ygrids = function (grids) {
|
|
12849
|
-
|
|
12850
|
-
config = $$.config;
|
|
12851
|
-
if (!grids) {
|
|
12852
|
-
return config.grid_y_lines;
|
|
12853
|
-
}
|
|
12854
|
-
config.grid_y_lines = grids;
|
|
12855
|
-
$$.redrawWithoutRescale();
|
|
12856
|
-
return config.grid_y_lines;
|
|
12955
|
+
return grid.bind(this)(grids, "y");
|
|
12857
12956
|
};
|
|
12858
12957
|
extend(ygrids, {
|
|
12859
12958
|
/**
|
|
@@ -12877,7 +12976,7 @@ extend(ygrids, {
|
|
|
12877
12976
|
* ]);
|
|
12878
12977
|
*/
|
|
12879
12978
|
add: function add(grids) {
|
|
12880
|
-
return
|
|
12979
|
+
return _add.bind(this)(grids, "y");
|
|
12881
12980
|
},
|
|
12882
12981
|
/**
|
|
12883
12982
|
* Remove y grid lines.<br>
|
|
@@ -12885,9 +12984,10 @@ extend(ygrids, {
|
|
|
12885
12984
|
* @function ygrids․remove
|
|
12886
12985
|
* @instance
|
|
12887
12986
|
* @memberof Chart
|
|
12888
|
-
* @param {object}
|
|
12889
|
-
* @param {number} [
|
|
12890
|
-
* @param {string} [
|
|
12987
|
+
* @param {object} grids This argument should include value or class. If value is given, the y grid lines that have specified y value will be removed. If class is given, the y grid lines that have specified class will be removed. If args is not given, all of y grid lines will be removed.
|
|
12988
|
+
* @param {number} [grids.value] target value
|
|
12989
|
+
* @param {string} [grids.class] target class
|
|
12990
|
+
* @returns {void}
|
|
12891
12991
|
* @example
|
|
12892
12992
|
* // y grid line on y = 200 will be removed
|
|
12893
12993
|
* chart.ygrids.remove({value: 200});
|
|
@@ -12900,12 +13000,13 @@ extend(ygrids, {
|
|
|
12900
13000
|
* // all of y grid lines will be removed
|
|
12901
13001
|
* chart.ygrids.remove();
|
|
12902
13002
|
*/
|
|
12903
|
-
remove: function remove(
|
|
13003
|
+
remove: function remove(grids) {
|
|
12904
13004
|
// TODO: multiple
|
|
12905
|
-
|
|
13005
|
+
return _remove.bind(this)(grids, !1);
|
|
12906
13006
|
}
|
|
12907
13007
|
});
|
|
12908
|
-
/* harmony default export */ var
|
|
13008
|
+
/* harmony default export */ var api_grid = ({
|
|
13009
|
+
xgrids: xgrids,
|
|
12909
13010
|
ygrids: ygrids
|
|
12910
13011
|
});
|
|
12911
13012
|
;// CONCATENATED MODULE: ./src/Chart/api/group.ts
|
|
@@ -12947,6 +13048,29 @@ extend(ygrids, {
|
|
|
12947
13048
|
*/
|
|
12948
13049
|
|
|
12949
13050
|
|
|
13051
|
+
/**
|
|
13052
|
+
* Region add/update function
|
|
13053
|
+
* @param {Array} regions Regions will be replaced with this argument. The format of this argument is the same as regions.
|
|
13054
|
+
* @param {boolean} isAdd If true, add new regions, otherwise update regions
|
|
13055
|
+
* @returns {Array} regions
|
|
13056
|
+
* @private
|
|
13057
|
+
*/
|
|
13058
|
+
function regionsFn(regions, isAdd) {
|
|
13059
|
+
if (isAdd === void 0) {
|
|
13060
|
+
isAdd = !1;
|
|
13061
|
+
}
|
|
13062
|
+
var $$ = this.internal,
|
|
13063
|
+
config = $$.config,
|
|
13064
|
+
withTransition = config.transition_duration && isTabVisible();
|
|
13065
|
+
if (!regions) {
|
|
13066
|
+
return config.regions;
|
|
13067
|
+
}
|
|
13068
|
+
config.regions = isAdd ? config.regions.concat(regions) : regions;
|
|
13069
|
+
$$.updateRegion();
|
|
13070
|
+
$$.redrawRegion(withTransition);
|
|
13071
|
+
return isAdd ? config.regions : regions;
|
|
13072
|
+
}
|
|
13073
|
+
|
|
12950
13074
|
/**
|
|
12951
13075
|
* Update regions.
|
|
12952
13076
|
* @function regions
|
|
@@ -12962,14 +13086,7 @@ extend(ygrids, {
|
|
|
12962
13086
|
* ]);
|
|
12963
13087
|
*/
|
|
12964
13088
|
var regions = function (_regions) {
|
|
12965
|
-
|
|
12966
|
-
config = $$.config;
|
|
12967
|
-
if (!_regions) {
|
|
12968
|
-
return config.regions;
|
|
12969
|
-
}
|
|
12970
|
-
config.regions = _regions;
|
|
12971
|
-
$$.redrawWithoutRescale();
|
|
12972
|
-
return _regions;
|
|
13089
|
+
return regionsFn.bind(this)(_regions);
|
|
12973
13090
|
};
|
|
12974
13091
|
extend(regions, {
|
|
12975
13092
|
/**
|
|
@@ -12993,14 +13110,7 @@ extend(regions, {
|
|
|
12993
13110
|
*]);
|
|
12994
13111
|
*/
|
|
12995
13112
|
add: function add(regions) {
|
|
12996
|
-
|
|
12997
|
-
config = $$.config;
|
|
12998
|
-
if (!regions) {
|
|
12999
|
-
return config.regions;
|
|
13000
|
-
}
|
|
13001
|
-
config.regions = config.regions.concat(regions);
|
|
13002
|
-
$$.redrawWithoutRescale();
|
|
13003
|
-
return config.regions;
|
|
13113
|
+
return regionsFn.bind(this)(regions, !0);
|
|
13004
13114
|
},
|
|
13005
13115
|
/**
|
|
13006
13116
|
* Remove regions.<br><br>
|
|
@@ -13822,7 +13932,7 @@ var AxisRenderer = /*#__PURE__*/function () {
|
|
|
13822
13932
|
}
|
|
13823
13933
|
var tickWidth = params.tickWidth;
|
|
13824
13934
|
if (!tickWidth || tickWidth <= 0) {
|
|
13825
|
-
tickWidth = isLeftRight ? 95 : params.isCategory ? Math.ceil(scale(ticks[1]) - scale(ticks[0])) - 12 : 110;
|
|
13935
|
+
tickWidth = isLeftRight ? 95 : params.isCategory ? Math.ceil(params.isInverted ? scale(ticks[0]) - scale(ticks[1]) : scale(ticks[1]) - scale(ticks[0])) - 12 : 110;
|
|
13826
13936
|
}
|
|
13827
13937
|
|
|
13828
13938
|
// split given text by tick width size
|
|
@@ -14230,6 +14340,7 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14230
14340
|
owner: $$
|
|
14231
14341
|
}, isX && {
|
|
14232
14342
|
isCategory: isCategory,
|
|
14343
|
+
isInverted: config.axis_x_inverted,
|
|
14233
14344
|
tickMultiline: config.axis_x_tick_multiline,
|
|
14234
14345
|
tickWidth: config.axis_x_tick_width,
|
|
14235
14346
|
tickTitle: isCategory && config.axis_x_tick_tooltip && $$.api.categories(),
|
|
@@ -14854,7 +14965,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14854
14965
|
config = $$.config,
|
|
14855
14966
|
state = $$.state,
|
|
14856
14967
|
$el = $$.$el,
|
|
14857
|
-
isMultipleX = $$.isMultipleX()
|
|
14968
|
+
isMultipleX = $$.isMultipleX(),
|
|
14969
|
+
isInverted = config.axis_x_inverted;
|
|
14858
14970
|
if ($el.eventRect) {
|
|
14859
14971
|
$$.updateEventRect($el.eventRect, !0);
|
|
14860
14972
|
} else {
|
|
@@ -14875,10 +14987,10 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14875
14987
|
if (!isMultipleX) {
|
|
14876
14988
|
// Set data and update eventReceiver.data
|
|
14877
14989
|
var xAxisTickValues = $$.getMaxDataCountTarget();
|
|
14878
|
-
if (!config.data_xSort) {
|
|
14990
|
+
if (!config.data_xSort || isInverted) {
|
|
14879
14991
|
xAxisTickValues.sort(function (a, b) {
|
|
14880
14992
|
_newArrowCheck(this, _this);
|
|
14881
|
-
return a.x - b.x;
|
|
14993
|
+
return isInverted ? b.x - a.x : a.x - b.x;
|
|
14882
14994
|
}.bind(this));
|
|
14883
14995
|
}
|
|
14884
14996
|
|
|
@@ -15615,7 +15727,8 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15615
15727
|
* @private
|
|
15616
15728
|
*/
|
|
15617
15729
|
setYAxisClipPath: function setYAxisClipPath(node) {
|
|
15618
|
-
var
|
|
15730
|
+
var _config$padding,
|
|
15731
|
+
$$ = this,
|
|
15619
15732
|
config = $$.config,
|
|
15620
15733
|
_$$$state3 = $$.state,
|
|
15621
15734
|
margin = _$$$state3.margin,
|
|
@@ -15624,10 +15737,10 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15624
15737
|
isRotated = config.axis_rotated,
|
|
15625
15738
|
left = Math.max(30, margin.left) - (isRotated ? 20 : 0),
|
|
15626
15739
|
isInner = config.axis_y_inner,
|
|
15627
|
-
x = isInner ? -1 : isRotated ? -(1 + left) : -(left - 1),
|
|
15740
|
+
x = isInner && !isRotated ? config.axis_y_label.text ? -20 : -1 : isRotated ? -(1 + left) : -(left - 1),
|
|
15628
15741
|
y = -(isRotated ? 20 : margin.top),
|
|
15629
15742
|
w = (isRotated ? width + 15 + left : margin.left + 20) + (isInner ? 20 : 0),
|
|
15630
|
-
h = (isRotated ? margin.bottom : margin.top + height) + 10;
|
|
15743
|
+
h = (isRotated ? margin.bottom + (((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit" ? 10 : 0) : margin.top + height) + 10;
|
|
15631
15744
|
node.attr("x", x).attr("y", y).attr("width", w).attr("height", h);
|
|
15632
15745
|
},
|
|
15633
15746
|
updateXAxisTickClip: function updateXAxisTickClip() {
|
|
@@ -15733,7 +15846,7 @@ function smoothLines(el, type) {
|
|
|
15733
15846
|
});
|
|
15734
15847
|
}
|
|
15735
15848
|
}
|
|
15736
|
-
/* harmony default export */ var
|
|
15849
|
+
/* harmony default export */ var internals_grid = ({
|
|
15737
15850
|
hasGrid: function hasGrid() {
|
|
15738
15851
|
var _this4 = this,
|
|
15739
15852
|
config = this.config;
|
|
@@ -16245,14 +16358,16 @@ function smoothLines(el, type) {
|
|
|
16245
16358
|
var _$$$axis,
|
|
16246
16359
|
position = (_$$$axis = $$.axis) == null ? void 0 : _$$$axis.getLabelPositionById(id),
|
|
16247
16360
|
width = $$.axis.getMaxTickWidth(id, withoutRecompute),
|
|
16248
|
-
gap = width === 0 ? .5 : 0
|
|
16249
|
-
|
|
16361
|
+
gap = width === 0 ? .5 : 0,
|
|
16362
|
+
_$$$config$padding;
|
|
16363
|
+
return width + (((_$$$config$padding = $$.config.padding) == null ? void 0 : _$$$config$padding.mode) === "fit" ? position.isInner ? 10 + gap : 10 : position.isInner ? 20 + gap : 40);
|
|
16250
16364
|
} else {
|
|
16251
16365
|
return 40;
|
|
16252
16366
|
}
|
|
16253
16367
|
},
|
|
16254
16368
|
getHorizontalAxisHeight: function getHorizontalAxisHeight(id) {
|
|
16255
|
-
var
|
|
16369
|
+
var _config$padding,
|
|
16370
|
+
$$ = this,
|
|
16256
16371
|
config = $$.config,
|
|
16257
16372
|
state = $$.state,
|
|
16258
16373
|
_state = state,
|
|
@@ -16260,8 +16375,12 @@ function smoothLines(el, type) {
|
|
|
16260
16375
|
rotatedPadding = _state.rotatedPadding,
|
|
16261
16376
|
isLegendRight = _state.isLegendRight,
|
|
16262
16377
|
isLegendInset = _state.isLegendInset,
|
|
16263
|
-
isRotated = config.axis_rotated
|
|
16264
|
-
|
|
16378
|
+
isRotated = config.axis_rotated,
|
|
16379
|
+
isFitPadding = ((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit",
|
|
16380
|
+
isInner = config["axis_" + id + "_inner"],
|
|
16381
|
+
hasLabelText = config["axis_" + id + "_label"].text,
|
|
16382
|
+
_config$padding2,
|
|
16383
|
+
h = ((_config$padding2 = config.padding) == null ? void 0 : _config$padding2.mode) === "fit" ? isInner && !hasLabelText ? id === "y" ? 1 : 0 : 20 : 30;
|
|
16265
16384
|
if (id === "x" && !config.axis_x_show) {
|
|
16266
16385
|
return 8;
|
|
16267
16386
|
}
|
|
@@ -16272,7 +16391,7 @@ function smoothLines(el, type) {
|
|
|
16272
16391
|
return config.legend_show && !isLegendRight && !isLegendInset ? 10 : 1;
|
|
16273
16392
|
}
|
|
16274
16393
|
if (id === "y2" && !config.axis_y2_show) {
|
|
16275
|
-
return rotatedPadding.top;
|
|
16394
|
+
return isFitPadding ? 0 : rotatedPadding.top;
|
|
16276
16395
|
}
|
|
16277
16396
|
var rotate = $$.getAxisTickRotate(id);
|
|
16278
16397
|
|
|
@@ -16288,7 +16407,12 @@ function smoothLines(el, type) {
|
|
|
16288
16407
|
return h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id === "y2" && !isRotated ? -10 : 0);
|
|
16289
16408
|
},
|
|
16290
16409
|
getEventRectWidth: function getEventRectWidth() {
|
|
16291
|
-
|
|
16410
|
+
var $$ = this,
|
|
16411
|
+
config = $$.config,
|
|
16412
|
+
axis = $$.axis,
|
|
16413
|
+
isInverted = config.axis_x_inverted,
|
|
16414
|
+
tickInterval = axis.x.tickInterval();
|
|
16415
|
+
return Math.max(0, isInverted ? Math.abs(tickInterval) : tickInterval);
|
|
16292
16416
|
},
|
|
16293
16417
|
/**
|
|
16294
16418
|
* Get axis tick test rotate value
|
|
@@ -16981,6 +17105,22 @@ function smoothLines(el, type) {
|
|
|
16981
17105
|
* }
|
|
16982
17106
|
*/
|
|
16983
17107
|
axis_x_min: undefined,
|
|
17108
|
+
/**
|
|
17109
|
+
* Change the direction of x axis.<br><br>
|
|
17110
|
+
* If true set, the direction will be `right -> left`.
|
|
17111
|
+
* @name axis․x․inverted
|
|
17112
|
+
* @memberof Options
|
|
17113
|
+
* @type {boolean}
|
|
17114
|
+
* @default false
|
|
17115
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.InvertedAxis)
|
|
17116
|
+
* @example
|
|
17117
|
+
* axis: {
|
|
17118
|
+
* x: {
|
|
17119
|
+
* inverted: true
|
|
17120
|
+
* }
|
|
17121
|
+
* }
|
|
17122
|
+
*/
|
|
17123
|
+
axis_x_inverted: !1,
|
|
16984
17124
|
/**
|
|
16985
17125
|
* Set padding for x axis.<br><br>
|
|
16986
17126
|
* If this option is set, the range of x axis will increase/decrease according to the values.
|
|
@@ -17243,11 +17383,12 @@ function smoothLines(el, type) {
|
|
|
17243
17383
|
axis_y_min: undefined,
|
|
17244
17384
|
/**
|
|
17245
17385
|
* Change the direction of y axis.<br><br>
|
|
17246
|
-
* If true set, the direction will be
|
|
17386
|
+
* If true set, the direction will be `top -> bottom`.
|
|
17247
17387
|
* @name axis․y․inverted
|
|
17248
17388
|
* @memberof Options
|
|
17249
17389
|
* @type {boolean}
|
|
17250
17390
|
* @default false
|
|
17391
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.InvertedAxis)
|
|
17251
17392
|
* @example
|
|
17252
17393
|
* axis: {
|
|
17253
17394
|
* y: {
|
|
@@ -17721,11 +17862,12 @@ function smoothLines(el, type) {
|
|
|
17721
17862
|
axis_y2_min: undefined,
|
|
17722
17863
|
/**
|
|
17723
17864
|
* Change the direction of y2 axis.<br><br>
|
|
17724
|
-
* If true set, the direction will be
|
|
17865
|
+
* If true set, the direction will be `top -> bottom`.
|
|
17725
17866
|
* @name axis․y2․inverted
|
|
17726
17867
|
* @memberof Options
|
|
17727
17868
|
* @type {boolean}
|
|
17728
17869
|
* @default false
|
|
17870
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.InvertedAxis)
|
|
17729
17871
|
* @example
|
|
17730
17872
|
* axis: {
|
|
17731
17873
|
* y2: {
|
|
@@ -18217,7 +18359,6 @@ function axis_objectSpread(target) { for (var i = 1, source; i < arguments.lengt
|
|
|
18217
18359
|
|
|
18218
18360
|
|
|
18219
18361
|
|
|
18220
|
-
|
|
18221
18362
|
// ChartInternal
|
|
18222
18363
|
|
|
18223
18364
|
|
|
@@ -18231,8 +18372,8 @@ function axis_objectSpread(target) { for (var i = 1, source; i < arguments.lengt
|
|
|
18231
18372
|
|
|
18232
18373
|
|
|
18233
18374
|
|
|
18234
|
-
var api = [api_axis, api_category,
|
|
18235
|
-
var internal = [Axis, clip, eventrect, interactions_flow,
|
|
18375
|
+
var api = [api_axis, api_category, flow, api_grid, group, api_regions, x];
|
|
18376
|
+
var internal = [Axis, clip, eventrect, interactions_flow, internals_grid, region, size_axis];
|
|
18236
18377
|
var options = [data_axis, axis_axis, common_grid];
|
|
18237
18378
|
// EXTERNAL MODULE: external {"commonjs":"d3-interpolate","commonjs2":"d3-interpolate","amd":"d3-interpolate","root":"d3"}
|
|
18238
18379
|
var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(12);
|
|
@@ -22968,17 +23109,21 @@ var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack
|
|
|
22968
23109
|
* @param {Array} domain Target domain value
|
|
22969
23110
|
* @param {Array} current Current zoom domain value
|
|
22970
23111
|
* @param {Array} range Zoom range value
|
|
23112
|
+
* @param {boolean} isInverted Whether the axis is inverted or not
|
|
22971
23113
|
* @returns {boolean}
|
|
22972
23114
|
* @private
|
|
22973
23115
|
*/
|
|
22974
|
-
function withinRange(domain, current, range) {
|
|
22975
|
-
var _this = this
|
|
22976
|
-
|
|
23116
|
+
function withinRange(domain, current, range, isInverted) {
|
|
23117
|
+
var _this = this;
|
|
23118
|
+
if (isInverted === void 0) {
|
|
23119
|
+
isInverted = !1;
|
|
23120
|
+
}
|
|
23121
|
+
var min = range[0],
|
|
22977
23122
|
max = range[1];
|
|
22978
23123
|
return domain.every(function (v, i) {
|
|
22979
23124
|
var _this2 = this;
|
|
22980
23125
|
_newArrowCheck(this, _this);
|
|
22981
|
-
return (i === 0 ? v >= min : v <= max) && !domain.every(function (v, i) {
|
|
23126
|
+
return (i === 0 ? isInverted ? +v <= min : +v >= min : isInverted ? +v >= max : +v <= max) && !domain.every(function (v, i) {
|
|
22982
23127
|
_newArrowCheck(this, _this2);
|
|
22983
23128
|
return v === current[i];
|
|
22984
23129
|
}.bind(this));
|
|
@@ -23014,6 +23159,7 @@ var zoom = function (domainValue) {
|
|
|
23014
23159
|
org = $$.org,
|
|
23015
23160
|
scale = $$.scale,
|
|
23016
23161
|
isRotated = config.axis_rotated,
|
|
23162
|
+
isInverted = config.axis_x_inverted,
|
|
23017
23163
|
isCategorized = axis.isCategorized(),
|
|
23018
23164
|
domain = domainValue;
|
|
23019
23165
|
if (config.zoom_enabled && domain) {
|
|
@@ -23023,7 +23169,8 @@ var zoom = function (domainValue) {
|
|
|
23023
23169
|
return parseDate.bind($$)(x);
|
|
23024
23170
|
}.bind(this));
|
|
23025
23171
|
}
|
|
23026
|
-
|
|
23172
|
+
var isWithinRange = withinRange(domain, $$.getZoomDomain(!0), $$.getZoomDomain(), isInverted);
|
|
23173
|
+
if (isWithinRange) {
|
|
23027
23174
|
if (isCategorized) {
|
|
23028
23175
|
domain = domain.map(function (v, i) {
|
|
23029
23176
|
_newArrowCheck(this, _this3);
|
|
@@ -23914,7 +24061,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments.
|
|
|
23914
24061
|
if (!$$.state.xTickOffset) {
|
|
23915
24062
|
$$.state.xTickOffset = $$.axis.x.tickOffset();
|
|
23916
24063
|
}
|
|
23917
|
-
scale.zoom = $$.
|
|
24064
|
+
scale.zoom = $$.getCustomizedXScale(newScale);
|
|
23918
24065
|
$$.axis.x.scale(scale.zoom);
|
|
23919
24066
|
if (rescale) {
|
|
23920
24067
|
// copy current initial x scale in case of rescale option is used
|
|
@@ -24046,7 +24193,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments.
|
|
|
24046
24193
|
var zoomDomain = zoom.domain(),
|
|
24047
24194
|
xDomain = subX.domain(),
|
|
24048
24195
|
delta = .015,
|
|
24049
|
-
isfullyShown = (zoomDomain[0] <= xDomain[0] || zoomDomain[0] - delta <= xDomain[0]) && (xDomain[1] <= zoomDomain[1] || xDomain[1] <= zoomDomain[1] - delta);
|
|
24196
|
+
isfullyShown = $$.config.axis_x_inverted ? (zoomDomain[0] >= xDomain[0] || zoomDomain[0] + delta >= xDomain[0]) && (xDomain[1] >= zoomDomain[1] || xDomain[1] >= zoomDomain[1] + delta) : (zoomDomain[0] <= xDomain[0] || zoomDomain[0] - delta <= xDomain[0]) && (xDomain[1] <= zoomDomain[1] || xDomain[1] <= zoomDomain[1] - delta);
|
|
24050
24197
|
// check if the zoomed chart is fully shown, then reset scale when zoom is out as initial
|
|
24051
24198
|
if (force || isfullyShown) {
|
|
24052
24199
|
$$.axis.x.scale(subX);
|
|
@@ -24523,7 +24670,7 @@ var _defaults = {};
|
|
|
24523
24670
|
|
|
24524
24671
|
/**
|
|
24525
24672
|
* @namespace bb
|
|
24526
|
-
* @version 3.
|
|
24673
|
+
* @version 3.8.0-next.1
|
|
24527
24674
|
*/
|
|
24528
24675
|
var bb = {
|
|
24529
24676
|
/**
|
|
@@ -24533,7 +24680,7 @@ var bb = {
|
|
|
24533
24680
|
* bb.version; // "1.0.0"
|
|
24534
24681
|
* @memberof bb
|
|
24535
24682
|
*/
|
|
24536
|
-
version: "3.
|
|
24683
|
+
version: "3.8.0-next.1",
|
|
24537
24684
|
/**
|
|
24538
24685
|
* Generate chart
|
|
24539
24686
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|