billboard.js 3.10.2 → 3.11.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +411 -184
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +2680 -2567
- package/dist/billboard.pkgd.min.js +2 -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 +27 -13
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +27 -13
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +27 -13
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +27 -13
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2261 -2361
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2286 -2372
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2287 -2373
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2288 -2374
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2288 -2374
- 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 +2 -2
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +2 -2
- package/dist-esm/billboard.js +381 -170
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -4
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +6 -9
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -4
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -4
- package/package.json +39 -43
- package/src/Chart/api/zoom.ts +5 -20
- package/src/ChartInternal/Axis/Axis.ts +12 -7
- package/src/ChartInternal/Axis/AxisRenderer.ts +14 -0
- package/src/ChartInternal/ChartInternal.ts +1 -1
- package/src/ChartInternal/data/data.ts +21 -11
- package/src/ChartInternal/data/load.ts +37 -1
- package/src/ChartInternal/interactions/eventrect.ts +11 -4
- package/src/ChartInternal/interactions/interaction.ts +2 -1
- package/src/ChartInternal/interactions/zoom.ts +28 -0
- package/src/ChartInternal/internals/clip.ts +1 -2
- package/src/ChartInternal/internals/domain.ts +24 -1
- package/src/ChartInternal/internals/format.ts +15 -4
- package/src/ChartInternal/internals/legend.ts +28 -2
- package/src/ChartInternal/internals/scale.ts +3 -3
- package/src/ChartInternal/internals/size.axis.ts +11 -19
- package/src/ChartInternal/internals/size.ts +14 -6
- package/src/ChartInternal/internals/text.ts +3 -3
- package/src/ChartInternal/internals/tooltip.ts +14 -8
- package/src/ChartInternal/internals/transform.ts +3 -3
- package/src/ChartInternal/internals/type.ts +1 -1
- package/src/ChartInternal/shape/arc.ts +1 -1
- package/src/ChartInternal/shape/radar.ts +58 -45
- package/src/ChartInternal/shape/shape.ts +2 -0
- package/src/config/Options/axis/x.ts +27 -1
- package/src/config/Options/axis/y2.ts +13 -0
- package/src/config/Options/common/legend.ts +17 -0
- package/src/module/Cache.ts +1 -0
- package/src/module/util.ts +14 -0
- package/types/options.d.ts +28 -4
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.11.0-next.1
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -344,27 +344,27 @@ function _typeof(o) {
|
|
|
344
344
|
}
|
|
345
345
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
346
346
|
|
|
347
|
-
function
|
|
348
|
-
if (
|
|
349
|
-
var
|
|
350
|
-
if (
|
|
351
|
-
var
|
|
352
|
-
if (
|
|
347
|
+
function toPrimitive(t, r) {
|
|
348
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
349
|
+
var e = t[Symbol.toPrimitive];
|
|
350
|
+
if (void 0 !== e) {
|
|
351
|
+
var i = e.call(t, r || "default");
|
|
352
|
+
if ("object" != _typeof(i)) return i;
|
|
353
353
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
354
354
|
}
|
|
355
|
-
return (
|
|
355
|
+
return ("string" === r ? String : Number)(t);
|
|
356
356
|
}
|
|
357
357
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
358
358
|
|
|
359
359
|
|
|
360
|
-
function
|
|
361
|
-
var
|
|
362
|
-
return _typeof(
|
|
360
|
+
function toPropertyKey(t) {
|
|
361
|
+
var i = toPrimitive(t, "string");
|
|
362
|
+
return "symbol" == _typeof(i) ? i : String(i);
|
|
363
363
|
}
|
|
364
364
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
365
365
|
|
|
366
366
|
function _defineProperty(obj, key, value) {
|
|
367
|
-
key =
|
|
367
|
+
key = toPropertyKey(key);
|
|
368
368
|
if (key in obj) {
|
|
369
369
|
Object.defineProperty(obj, key, {
|
|
370
370
|
value: value,
|
|
@@ -919,6 +919,20 @@ function getCssRules(styleSheets) {
|
|
|
919
919
|
return rules;
|
|
920
920
|
}
|
|
921
921
|
|
|
922
|
+
/**
|
|
923
|
+
* Get current window and container scroll position
|
|
924
|
+
* @param {HTMLElement} node Target element
|
|
925
|
+
* @returns {object} window scroll position
|
|
926
|
+
* @private
|
|
927
|
+
*/
|
|
928
|
+
function getScrollPosition(node) {
|
|
929
|
+
var _ref2, _ref3, _window$pageXOffset, _ref4, _ref5, _window$pageYOffset;
|
|
930
|
+
return {
|
|
931
|
+
x: (_ref2 = ((_ref3 = (_window$pageXOffset = win.pageXOffset) != null ? _window$pageXOffset : win.scrollX) != null ? _ref3 : 0) + node.scrollLeft) != null ? _ref2 : 0,
|
|
932
|
+
y: (_ref4 = ((_ref5 = (_window$pageYOffset = win.pageYOffset) != null ? _window$pageYOffset : win.scrollY) != null ? _ref5 : 0) + node.scrollTop) != null ? _ref4 : 0
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
|
|
922
936
|
/**
|
|
923
937
|
* Gets the SVGMatrix of an SVGGElement
|
|
924
938
|
* @param {SVGElement} node Node element
|
|
@@ -1511,7 +1525,6 @@ let Element = function () {
|
|
|
1511
1525
|
// $$.contextLine
|
|
1512
1526
|
area: null // $$.contextArea
|
|
1513
1527
|
},
|
|
1514
|
-
|
|
1515
1528
|
arcs: null,
|
|
1516
1529
|
bar: null,
|
|
1517
1530
|
// mainBar,
|
|
@@ -1532,7 +1545,6 @@ let Element = function () {
|
|
|
1532
1545
|
// xgrid,
|
|
1533
1546
|
y: null // ygrid,
|
|
1534
1547
|
},
|
|
1535
|
-
|
|
1536
1548
|
gridLines: {
|
|
1537
1549
|
main: null,
|
|
1538
1550
|
// gridLines
|
|
@@ -1540,13 +1552,11 @@ let Element = function () {
|
|
|
1540
1552
|
// xgridLines,
|
|
1541
1553
|
y: null // ygridLines
|
|
1542
1554
|
},
|
|
1543
|
-
|
|
1544
1555
|
region: {
|
|
1545
1556
|
main: null,
|
|
1546
1557
|
// region
|
|
1547
1558
|
list: null // mainRegion
|
|
1548
1559
|
},
|
|
1549
|
-
|
|
1550
1560
|
eventRect: null,
|
|
1551
1561
|
zoomResetBtn: null // drag zoom reset button
|
|
1552
1562
|
};
|
|
@@ -1626,7 +1636,6 @@ let State = function () {
|
|
|
1626
1636
|
types: [],
|
|
1627
1637
|
needle: undefined // arc needle current value
|
|
1628
1638
|
},
|
|
1629
|
-
|
|
1630
1639
|
// legend
|
|
1631
1640
|
isLegendRight: !1,
|
|
1632
1641
|
isLegendInset: !1,
|
|
@@ -1645,7 +1654,6 @@ let State = function () {
|
|
|
1645
1654
|
// event data bound of previoous eventRect
|
|
1646
1655
|
coords: [] // coordination value of previous eventRect
|
|
1647
1656
|
},
|
|
1648
|
-
|
|
1649
1657
|
axis: {
|
|
1650
1658
|
x: {
|
|
1651
1659
|
padding: {
|
|
@@ -3261,7 +3269,12 @@ var data_this = undefined;
|
|
|
3261
3269
|
* - **Available Values:**
|
|
3262
3270
|
* - circle
|
|
3263
3271
|
* - rectangle
|
|
3272
|
+
* @property {boolean} [legend.format] Set formatter function for legend text.
|
|
3273
|
+
* The argument:<br>
|
|
3274
|
+
* - `id`: legend text(which is data id) value
|
|
3275
|
+
* @property {boolean} [legend.tooltip=false] Show full legend text value using system tooltip(via `<title>` element).
|
|
3264
3276
|
* @property {boolean} [legend.usePoint=false] Whether to use custom points in legend.
|
|
3277
|
+
* @see [Demo: format](https://naver.github.io/billboard.js/demo/#Legend.LegendFormat)
|
|
3265
3278
|
* @see [Demo: item.interaction](https://naver.github.io/billboard.js/demo/#Legend.LegendItemInteraction)
|
|
3266
3279
|
* @see [Demo: item.tile.type](https://naver.github.io/billboard.js/demo/#Legend.LegendItemTileType)
|
|
3267
3280
|
* @see [Demo: position](https://naver.github.io/billboard.js/demo/#Legend.LegendPosition)
|
|
@@ -3324,6 +3337,16 @@ var data_this = undefined;
|
|
|
3324
3337
|
* r: 10
|
|
3325
3338
|
* }
|
|
3326
3339
|
* },
|
|
3340
|
+
* format: function(id) {
|
|
3341
|
+
* // set ellipsis string when length is > 5
|
|
3342
|
+
* // to get full legend value, combine with 'legend.tooltip=true'
|
|
3343
|
+
* if (id.length > 5) {
|
|
3344
|
+
* id = id.substr(0, 5) + "...";
|
|
3345
|
+
* }
|
|
3346
|
+
*
|
|
3347
|
+
* return id;
|
|
3348
|
+
* },
|
|
3349
|
+
* tooltip: true,
|
|
3327
3350
|
* usePoint: true
|
|
3328
3351
|
* }
|
|
3329
3352
|
*/
|
|
@@ -3344,9 +3367,11 @@ var data_this = undefined;
|
|
|
3344
3367
|
legend_item_tile_height: 10,
|
|
3345
3368
|
legend_item_tile_r: 5,
|
|
3346
3369
|
legend_item_tile_type: "rectangle",
|
|
3370
|
+
legend_format: undefined,
|
|
3347
3371
|
legend_padding: 0,
|
|
3348
3372
|
legend_position: "bottom",
|
|
3349
3373
|
legend_show: !0,
|
|
3374
|
+
legend_tooltip: !1,
|
|
3350
3375
|
legend_usePoint: !1
|
|
3351
3376
|
});
|
|
3352
3377
|
;// CONCATENATED MODULE: ./src/config/Options/common/title.ts
|
|
@@ -3716,6 +3741,7 @@ const KEY = {
|
|
|
3716
3741
|
dataTotalPerIndex: "$totalPerIndex",
|
|
3717
3742
|
legendItemTextBox: "legendItemTextBox",
|
|
3718
3743
|
radarPoints: "$radarPoints",
|
|
3744
|
+
radarTextWidth: "$radarTextWidth",
|
|
3719
3745
|
setOverOut: "setOverOut",
|
|
3720
3746
|
callOverOutForTouch: "callOverOutForTouch",
|
|
3721
3747
|
textRect: "textRect"
|
|
@@ -4034,7 +4060,6 @@ function runWorker(useWorker, fn, callback, depsFn) {
|
|
|
4034
4060
|
// });
|
|
4035
4061
|
};
|
|
4036
4062
|
}
|
|
4037
|
-
|
|
4038
4063
|
return runFn;
|
|
4039
4064
|
}
|
|
4040
4065
|
// EXTERNAL MODULE: external {"commonjs":"d3-dsv","commonjs2":"d3-dsv","amd":"d3-dsv","root":"d3"}
|
|
@@ -5122,6 +5147,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5122
5147
|
*/
|
|
5123
5148
|
getDataIndexFromEvent: function getDataIndexFromEvent(event) {
|
|
5124
5149
|
const $$ = this,
|
|
5150
|
+
$el = $$.$el,
|
|
5125
5151
|
config = $$.config,
|
|
5126
5152
|
_$$$state = $$.state,
|
|
5127
5153
|
hasRadar = _$$$state.hasRadar,
|
|
@@ -5141,8 +5167,9 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5141
5167
|
index = d && Object.keys(d).length === 1 ? d.index : undefined;
|
|
5142
5168
|
} else {
|
|
5143
5169
|
const isRotated = config.axis_rotated,
|
|
5170
|
+
scrollPos = getScrollPosition($el.chart.node()),
|
|
5144
5171
|
e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event; // get data based on the mouse coords
|
|
5145
|
-
index = findIndex(coords, isRotated ? e.clientY - rect.top : e.clientX - rect.left, 0, coords.length - 1, isRotated);
|
|
5172
|
+
index = findIndex(coords, isRotated ? e.clientY + scrollPos.y - rect.top : e.clientX + scrollPos.x - rect.left, 0, coords.length - 1, isRotated);
|
|
5146
5173
|
}
|
|
5147
5174
|
return index;
|
|
5148
5175
|
},
|
|
@@ -5190,6 +5217,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5190
5217
|
return $$.findClosest(target.values, pos);
|
|
5191
5218
|
}.bind(this));
|
|
5192
5219
|
// map to array of closest points of each target
|
|
5220
|
+
|
|
5193
5221
|
// decide closest point and return
|
|
5194
5222
|
return $$.findClosest(candidates, pos);
|
|
5195
5223
|
},
|
|
@@ -5334,6 +5362,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5334
5362
|
return current;
|
|
5335
5363
|
},
|
|
5336
5364
|
getRangedData: function getRangedData(d, key, type) {
|
|
5365
|
+
var _this39 = this;
|
|
5337
5366
|
if (key === void 0) {
|
|
5338
5367
|
key = "";
|
|
5339
5368
|
}
|
|
@@ -5342,13 +5371,20 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5342
5371
|
}
|
|
5343
5372
|
const value = d == null ? void 0 : d.value;
|
|
5344
5373
|
if (isArray(value)) {
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5374
|
+
if (type === "bar") {
|
|
5375
|
+
return value.reduce(function (a, c) {
|
|
5376
|
+
_newArrowCheck(this, _this39);
|
|
5377
|
+
return c - a;
|
|
5378
|
+
}.bind(this));
|
|
5379
|
+
} else {
|
|
5380
|
+
// @ts-ignore
|
|
5381
|
+
const index = {
|
|
5382
|
+
areaRange: ["high", "mid", "low"],
|
|
5383
|
+
candlestick: ["open", "high", "low", "close", "volume"]
|
|
5384
|
+
}[type].indexOf(key);
|
|
5385
|
+
return index >= 0 && value ? value[index] : undefined;
|
|
5386
|
+
}
|
|
5387
|
+
} else if (value && key) {
|
|
5352
5388
|
return value[key];
|
|
5353
5389
|
}
|
|
5354
5390
|
return value;
|
|
@@ -5359,20 +5395,20 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5359
5395
|
* @private
|
|
5360
5396
|
*/
|
|
5361
5397
|
setRatioForGroupedData: function setRatioForGroupedData(data) {
|
|
5362
|
-
var
|
|
5398
|
+
var _this40 = this;
|
|
5363
5399
|
const $$ = this,
|
|
5364
5400
|
config = $$.config;
|
|
5365
5401
|
// calculate ratio if grouped data exists
|
|
5366
5402
|
if (config.data_groups.length && data.some(function (d) {
|
|
5367
|
-
_newArrowCheck(this,
|
|
5403
|
+
_newArrowCheck(this, _this40);
|
|
5368
5404
|
return $$.isGrouped(d.id);
|
|
5369
5405
|
}.bind(this))) {
|
|
5370
5406
|
const setter = function (d) {
|
|
5371
|
-
_newArrowCheck(this,
|
|
5407
|
+
_newArrowCheck(this, _this40);
|
|
5372
5408
|
return $$.getRatio("index", d, !0);
|
|
5373
5409
|
}.bind(this);
|
|
5374
5410
|
data.forEach(function (v) {
|
|
5375
|
-
_newArrowCheck(this,
|
|
5411
|
+
_newArrowCheck(this, _this40);
|
|
5376
5412
|
"values" in v ? v.values.forEach(setter) : setter(v);
|
|
5377
5413
|
}.bind(this));
|
|
5378
5414
|
}
|
|
@@ -5386,7 +5422,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5386
5422
|
* @private
|
|
5387
5423
|
*/
|
|
5388
5424
|
getRatio: function getRatio(type, d, asPercent) {
|
|
5389
|
-
var
|
|
5425
|
+
var _this41 = this;
|
|
5390
5426
|
if (asPercent === void 0) {
|
|
5391
5427
|
asPercent = !1;
|
|
5392
5428
|
}
|
|
@@ -5415,15 +5451,15 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5415
5451
|
let hiddenSum = dataValues(state.hiddenTargetIds, !1);
|
|
5416
5452
|
if (hiddenSum.length) {
|
|
5417
5453
|
hiddenSum = hiddenSum.reduce(function (acc, curr) {
|
|
5418
|
-
var
|
|
5419
|
-
_newArrowCheck(this,
|
|
5454
|
+
var _this42 = this;
|
|
5455
|
+
_newArrowCheck(this, _this41);
|
|
5420
5456
|
return acc.map(function (v, i) {
|
|
5421
|
-
_newArrowCheck(this,
|
|
5457
|
+
_newArrowCheck(this, _this42);
|
|
5422
5458
|
return (isNumber(v) ? v : 0) + curr[i];
|
|
5423
5459
|
}.bind(this));
|
|
5424
5460
|
}.bind(this));
|
|
5425
5461
|
total = total.map(function (v, i) {
|
|
5426
|
-
_newArrowCheck(this,
|
|
5462
|
+
_newArrowCheck(this, _this41);
|
|
5427
5463
|
return v - hiddenSum[i];
|
|
5428
5464
|
}.bind(this));
|
|
5429
5465
|
}
|
|
@@ -5436,11 +5472,11 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5436
5472
|
} else if (type === "bar") {
|
|
5437
5473
|
const yScale = $$.getYScaleById.bind($$)(d.id),
|
|
5438
5474
|
max = yScale.domain().reduce(function (a, c) {
|
|
5439
|
-
_newArrowCheck(this,
|
|
5475
|
+
_newArrowCheck(this, _this41);
|
|
5440
5476
|
return c - a;
|
|
5441
5477
|
}.bind(this));
|
|
5442
5478
|
// when all data are 0, return 0
|
|
5443
|
-
ratio = max === 0 ? 0 : Math.abs(d
|
|
5479
|
+
ratio = max === 0 ? 0 : Math.abs($$.getRangedData(d, null, type) / max);
|
|
5444
5480
|
} else if (type === "treemap") {
|
|
5445
5481
|
ratio /= $$.getTotalDataSum(!0);
|
|
5446
5482
|
}
|
|
@@ -5453,18 +5489,18 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5453
5489
|
* @private
|
|
5454
5490
|
*/
|
|
5455
5491
|
updateDataIndexByX: function updateDataIndexByX(tickValues) {
|
|
5456
|
-
var
|
|
5492
|
+
var _this43 = this;
|
|
5457
5493
|
const $$ = this,
|
|
5458
5494
|
tickValueMap = tickValues.reduce(function (out, tick, index) {
|
|
5459
|
-
_newArrowCheck(this,
|
|
5495
|
+
_newArrowCheck(this, _this43);
|
|
5460
5496
|
out[+tick.x] = index;
|
|
5461
5497
|
return out;
|
|
5462
5498
|
}.bind(this), {});
|
|
5463
5499
|
$$.data.targets.forEach(function (t) {
|
|
5464
|
-
var
|
|
5465
|
-
_newArrowCheck(this,
|
|
5500
|
+
var _this44 = this;
|
|
5501
|
+
_newArrowCheck(this, _this43);
|
|
5466
5502
|
t.values.forEach(function (value, valueIndex) {
|
|
5467
|
-
_newArrowCheck(this,
|
|
5503
|
+
_newArrowCheck(this, _this44);
|
|
5468
5504
|
let index = tickValueMap[+value.x];
|
|
5469
5505
|
if (index === undefined) {
|
|
5470
5506
|
index = valueIndex;
|
|
@@ -5490,11 +5526,11 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5490
5526
|
* @private
|
|
5491
5527
|
*/
|
|
5492
5528
|
isBarRangeType: function isBarRangeType(d) {
|
|
5493
|
-
var
|
|
5529
|
+
var _this45 = this;
|
|
5494
5530
|
const $$ = this,
|
|
5495
5531
|
value = d.value;
|
|
5496
5532
|
return $$.isBarType(d) && isArray(value) && value.length >= 2 && value.every(function (v) {
|
|
5497
|
-
_newArrowCheck(this,
|
|
5533
|
+
_newArrowCheck(this, _this45);
|
|
5498
5534
|
return isNumber(v);
|
|
5499
5535
|
}.bind(this));
|
|
5500
5536
|
},
|
|
@@ -5538,8 +5574,16 @@ function callDone(fn, resizeAfter) {
|
|
|
5538
5574
|
load: function load(rawTargets, args) {
|
|
5539
5575
|
var _this = this;
|
|
5540
5576
|
const $$ = this,
|
|
5577
|
+
axis = $$.axis,
|
|
5541
5578
|
data = $$.data,
|
|
5542
|
-
|
|
5579
|
+
org = $$.org,
|
|
5580
|
+
scale = $$.scale,
|
|
5581
|
+
append = args.append,
|
|
5582
|
+
zoomState = {
|
|
5583
|
+
domain: null,
|
|
5584
|
+
currentDomain: null,
|
|
5585
|
+
x: null
|
|
5586
|
+
};
|
|
5543
5587
|
let targets = rawTargets;
|
|
5544
5588
|
if (targets) {
|
|
5545
5589
|
// filter loading targets if needed
|
|
@@ -5573,6 +5617,20 @@ function callDone(fn, resizeAfter) {
|
|
|
5573
5617
|
|
|
5574
5618
|
// Set targets
|
|
5575
5619
|
$$.updateTargets(data.targets);
|
|
5620
|
+
if (scale.zoom) {
|
|
5621
|
+
zoomState.x = axis.isCategorized() ? scale.x.orgScale() : (org.xScale || scale.x).copy();
|
|
5622
|
+
zoomState.domain = $$.getXDomain(data.targets); // get updated xDomain
|
|
5623
|
+
|
|
5624
|
+
zoomState.x.domain(zoomState.domain);
|
|
5625
|
+
zoomState.currentDomain = $$.zoom.getDomain(); // current zoomed domain
|
|
5626
|
+
|
|
5627
|
+
// reset zoom state when new data loaded is out of range
|
|
5628
|
+
if (!$$.withinRange(zoomState.currentDomain, undefined, zoomState.domain)) {
|
|
5629
|
+
scale.x.domain(zoomState.domain);
|
|
5630
|
+
scale.zoom = null;
|
|
5631
|
+
$$.$el.eventRect.property("__zoom", null);
|
|
5632
|
+
}
|
|
5633
|
+
}
|
|
5576
5634
|
|
|
5577
5635
|
// Redraw with new targets
|
|
5578
5636
|
$$.redraw({
|
|
@@ -5581,6 +5639,20 @@ function callDone(fn, resizeAfter) {
|
|
|
5581
5639
|
withLegend: !0
|
|
5582
5640
|
});
|
|
5583
5641
|
|
|
5642
|
+
// when load happens on zoom state
|
|
5643
|
+
if (scale.zoom) {
|
|
5644
|
+
// const x = (axis.isCategorized() ? scale.x.orgScale() : (org.xScale || scale.x)).copy();
|
|
5645
|
+
|
|
5646
|
+
org.xDomain = zoomState.domain;
|
|
5647
|
+
org.xScale = zoomState.x;
|
|
5648
|
+
if (axis.isCategorized()) {
|
|
5649
|
+
zoomState.currentDomain = $$.getZoomDomainValue(zoomState.currentDomain);
|
|
5650
|
+
org.xDomain = $$.getZoomDomainValue(org.xDomain);
|
|
5651
|
+
org.xScale = zoomState.x.domain(org.xDomain);
|
|
5652
|
+
}
|
|
5653
|
+
$$.updateCurrentZoomTransform(zoomState.x, zoomState.currentDomain);
|
|
5654
|
+
}
|
|
5655
|
+
|
|
5584
5656
|
// Update current state chart type and elements list after redraw
|
|
5585
5657
|
$$.updateTypesElements();
|
|
5586
5658
|
callDone.call($$, args.done, args.resizeAfter);
|
|
@@ -5861,7 +5933,8 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5861
5933
|
screenX: x,
|
|
5862
5934
|
screenY: y,
|
|
5863
5935
|
clientX: x,
|
|
5864
|
-
clientY: y
|
|
5936
|
+
clientY: y,
|
|
5937
|
+
bubbles: hasRadar // radar type needs to bubble up event
|
|
5865
5938
|
});
|
|
5866
5939
|
}
|
|
5867
5940
|
},
|
|
@@ -6626,7 +6699,6 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
|
|
|
6626
6699
|
x.domain(domainValue);
|
|
6627
6700
|
// zoomEnabled && $$.zoom.updateScaleExtent();
|
|
6628
6701
|
}
|
|
6629
|
-
|
|
6630
6702
|
if (withUpdateOrgXDomain || withUpdateXDomain) {
|
|
6631
6703
|
zoomEnabled && $$.zoom.updateScaleExtent();
|
|
6632
6704
|
}
|
|
@@ -6689,6 +6761,28 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
|
|
|
6689
6761
|
}
|
|
6690
6762
|
return [min, max];
|
|
6691
6763
|
},
|
|
6764
|
+
/**
|
|
6765
|
+
* Return zoom domain from given domain
|
|
6766
|
+
* - 'category' type need to add offset to original value
|
|
6767
|
+
* @param {Array} domainValue domain value
|
|
6768
|
+
* @returns {Array} Zoom domain
|
|
6769
|
+
* @private
|
|
6770
|
+
*/
|
|
6771
|
+
getZoomDomainValue: function getZoomDomainValue(domainValue) {
|
|
6772
|
+
var _this8 = this;
|
|
6773
|
+
const $$ = this,
|
|
6774
|
+
config = $$.config,
|
|
6775
|
+
axis = $$.axis;
|
|
6776
|
+
if (axis.isCategorized() && Array.isArray(domainValue)) {
|
|
6777
|
+
const isInverted = config.axis_x_inverted,
|
|
6778
|
+
domain = domainValue.map(function (v, i) {
|
|
6779
|
+
_newArrowCheck(this, _this8);
|
|
6780
|
+
return +v + (i === 0 ? +isInverted : +!isInverted);
|
|
6781
|
+
}.bind(this)); // need to add offset to original value for 'category' type
|
|
6782
|
+
return domain;
|
|
6783
|
+
}
|
|
6784
|
+
return domainValue;
|
|
6785
|
+
},
|
|
6692
6786
|
/**
|
|
6693
6787
|
* Converts pixels to axis' scale values
|
|
6694
6788
|
* @param {string} type Axis type
|
|
@@ -6719,7 +6813,10 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
|
|
|
6719
6813
|
* @private
|
|
6720
6814
|
*/
|
|
6721
6815
|
withinRange: function withinRange(domain, current, range) {
|
|
6722
|
-
var
|
|
6816
|
+
var _this9 = this;
|
|
6817
|
+
if (current === void 0) {
|
|
6818
|
+
current = [0, 0];
|
|
6819
|
+
}
|
|
6723
6820
|
const $$ = this,
|
|
6724
6821
|
isInverted = $$.config.axis_x_inverted,
|
|
6725
6822
|
_ref3 = range,
|
|
@@ -6730,10 +6827,10 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
|
|
|
6730
6827
|
isInverted && target.reverse();
|
|
6731
6828
|
if (target[0] < target[1]) {
|
|
6732
6829
|
return domain.every(function (v, i) {
|
|
6733
|
-
var
|
|
6734
|
-
_newArrowCheck(this,
|
|
6830
|
+
var _this10 = this;
|
|
6831
|
+
_newArrowCheck(this, _this9);
|
|
6735
6832
|
return (i === 0 ? isInverted ? +v <= min : +v >= min : isInverted ? +v >= max : +v <= max) && !domain.every(function (v, i) {
|
|
6736
|
-
_newArrowCheck(this,
|
|
6833
|
+
_newArrowCheck(this, _this10);
|
|
6737
6834
|
return v === current[i];
|
|
6738
6835
|
}.bind(this));
|
|
6739
6836
|
}.bind(this));
|
|
@@ -6787,7 +6884,7 @@ function getFormat($$, typeValue, v) {
|
|
|
6787
6884
|
};
|
|
6788
6885
|
},
|
|
6789
6886
|
defaultValueFormat: function defaultValueFormat(v) {
|
|
6790
|
-
return isValue(v) ? +v : "";
|
|
6887
|
+
return isArray(v) ? v.join("~") : isValue(v) ? +v : "";
|
|
6791
6888
|
},
|
|
6792
6889
|
defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
|
|
6793
6890
|
return (ratio * 100).toFixed(1) + "%";
|
|
@@ -6801,7 +6898,14 @@ function getFormat($$, typeValue, v) {
|
|
|
6801
6898
|
dataLabels = $$.config.data_labels,
|
|
6802
6899
|
defaultFormat = function (v) {
|
|
6803
6900
|
_newArrowCheck(this, _this);
|
|
6804
|
-
|
|
6901
|
+
const delimiter = "~";
|
|
6902
|
+
let res = v;
|
|
6903
|
+
if (isArray(v)) {
|
|
6904
|
+
res = v.join(delimiter);
|
|
6905
|
+
} else if (isObject(v)) {
|
|
6906
|
+
res = Object.values(v).join(delimiter);
|
|
6907
|
+
}
|
|
6908
|
+
return res;
|
|
6805
6909
|
}.bind(this);
|
|
6806
6910
|
let format = defaultFormat;
|
|
6807
6911
|
|
|
@@ -6845,6 +6949,21 @@ function getLegendColor(id) {
|
|
|
6845
6949
|
color = $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data);
|
|
6846
6950
|
return color;
|
|
6847
6951
|
}
|
|
6952
|
+
|
|
6953
|
+
/**
|
|
6954
|
+
* Get formatted text value
|
|
6955
|
+
* @param {string} id Legend text id
|
|
6956
|
+
* @returns {string} Formatted legend text
|
|
6957
|
+
*/
|
|
6958
|
+
function getFormattedText(id) {
|
|
6959
|
+
var _config$data_names$id;
|
|
6960
|
+
const config = this.config;
|
|
6961
|
+
let text = (_config$data_names$id = config.data_names[id]) != null ? _config$data_names$id : id;
|
|
6962
|
+
if (isFunction(config.legend_format)) {
|
|
6963
|
+
text = config.legend_format(text);
|
|
6964
|
+
}
|
|
6965
|
+
return text;
|
|
6966
|
+
}
|
|
6848
6967
|
/* harmony default export */ var internals_legend = ({
|
|
6849
6968
|
/**
|
|
6850
6969
|
* Initialize the legend.
|
|
@@ -7342,10 +7461,13 @@ function getLegendColor(id) {
|
|
|
7342
7461
|
if (state.isLegendInset && dimension.max.width > 0 && background.size() === 0) {
|
|
7343
7462
|
background = legend.insert("g", "." + $LEGEND.legendItem).attr("class", $LEGEND.legendBackground).append("rect");
|
|
7344
7463
|
}
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7464
|
+
if (config.legend_tooltip) {
|
|
7465
|
+
legend.selectAll("title").data(targetIdz).text(function (id) {
|
|
7466
|
+
_newArrowCheck(this, _this4);
|
|
7467
|
+
return id;
|
|
7468
|
+
}.bind(this));
|
|
7469
|
+
}
|
|
7470
|
+
const texts = legend.selectAll("text").data(targetIdz).text(getFormattedText.bind($$)) // MEMO: needed for update
|
|
7349
7471
|
.each(function (id, i) {
|
|
7350
7472
|
updatePositions(this, id, i);
|
|
7351
7473
|
});
|
|
@@ -7480,10 +7602,13 @@ function getLegendColor(id) {
|
|
|
7480
7602
|
// Define g for legend area
|
|
7481
7603
|
|
|
7482
7604
|
$$.setLegendItem(l);
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7605
|
+
if (config.legend_tooltip) {
|
|
7606
|
+
l.append("title").text(function (id) {
|
|
7607
|
+
_newArrowCheck(this, _this6);
|
|
7608
|
+
return id;
|
|
7609
|
+
}.bind(this));
|
|
7610
|
+
}
|
|
7611
|
+
l.append("text").text(getFormattedText.bind($$)).each(function (id, i) {
|
|
7487
7612
|
updatePositions(this, id, i);
|
|
7488
7613
|
}).style("pointer-events", $$.getStylePropValue("none")).attr("x", isLegendRightOrInset ? posFn.xText : -200).attr("y", isLegendRightOrInset ? -200 : posFn.yText);
|
|
7489
7614
|
l.append("rect").attr("class", $LEGEND.legendItemEvent).style("fill-opacity", $$.getStylePropValue("0")).attr("x", isLegendRightOrInset ? posFn.xRect : -200).attr("y", isLegendRightOrInset ? -200 : posFn.yRect);
|
|
@@ -7875,8 +8000,8 @@ function getScale(type, min, max) {
|
|
|
7875
8000
|
/* harmony default export */ var scale = ({
|
|
7876
8001
|
/**
|
|
7877
8002
|
* Get x Axis scale function
|
|
7878
|
-
* @param {number} min Min value
|
|
7879
|
-
* @param {number} max Max value
|
|
8003
|
+
* @param {number} min Min range value
|
|
8004
|
+
* @param {number} max Max range value
|
|
7880
8005
|
* @param {Array} domain Domain value
|
|
7881
8006
|
* @param {Function} offset The offset getter to be sum
|
|
7882
8007
|
* @returns {Function} scale
|
|
@@ -7884,7 +8009,7 @@ function getScale(type, min, max) {
|
|
|
7884
8009
|
*/
|
|
7885
8010
|
getXScale: function getXScale(min, max, domain, offset) {
|
|
7886
8011
|
const $$ = this,
|
|
7887
|
-
scale = $$.scale.zoom || getScale($$.axis.getAxisType("x"), min, max);
|
|
8012
|
+
scale = $$.state.loading !== "append" && $$.scale.zoom || getScale($$.axis.getAxisType("x"), min, max);
|
|
7888
8013
|
return $$.getCustomizedXScale(domain ? scale.domain(domain) : scale, offset);
|
|
7889
8014
|
},
|
|
7890
8015
|
/**
|
|
@@ -8323,6 +8448,8 @@ function getGroupedDataPointsFn(d) {
|
|
|
8323
8448
|
let value = d.value;
|
|
8324
8449
|
if (isNumber(d)) {
|
|
8325
8450
|
value = d;
|
|
8451
|
+
} else if ($$.isAreaRangeType(d)) {
|
|
8452
|
+
value = $$.getBaseValue(d, "mid");
|
|
8326
8453
|
} else if (isStackNormalized) {
|
|
8327
8454
|
value = $$.getRatio("index", d, !0);
|
|
8328
8455
|
} else if ($$.isBubbleZType(d)) {
|
|
@@ -8600,6 +8727,7 @@ function getGroupedDataPointsFn(d) {
|
|
|
8600
8727
|
|
|
8601
8728
|
|
|
8602
8729
|
|
|
8730
|
+
|
|
8603
8731
|
/* harmony default export */ var size = ({
|
|
8604
8732
|
/**
|
|
8605
8733
|
* Update container size
|
|
@@ -8733,14 +8861,18 @@ function getGroupedDataPointsFn(d) {
|
|
|
8733
8861
|
* Get padding by the direction.
|
|
8734
8862
|
* @param {string} type "top" | "bottom" | "left" | "right"
|
|
8735
8863
|
* @param {boolean} [withoutRecompute=false] If set true, do not recompute the padding value.
|
|
8864
|
+
* @param {boolean} [withXAxisTickTextOverflow=false] If set true, calculate x axis tick text overflow.
|
|
8736
8865
|
* @returns {number} padding value
|
|
8737
8866
|
* @private
|
|
8738
8867
|
*/
|
|
8739
|
-
getCurrentPaddingByDirection: function getCurrentPaddingByDirection(type, withoutRecompute) {
|
|
8868
|
+
getCurrentPaddingByDirection: function getCurrentPaddingByDirection(type, withoutRecompute, withXAxisTickTextOverflow) {
|
|
8740
8869
|
var _config$padding;
|
|
8741
8870
|
if (withoutRecompute === void 0) {
|
|
8742
8871
|
withoutRecompute = !1;
|
|
8743
8872
|
}
|
|
8873
|
+
if (withXAxisTickTextOverflow === void 0) {
|
|
8874
|
+
withXAxisTickTextOverflow = !1;
|
|
8875
|
+
}
|
|
8744
8876
|
const $$ = this,
|
|
8745
8877
|
config = $$.config,
|
|
8746
8878
|
$el = $$.$el,
|
|
@@ -8759,6 +8891,7 @@ function getGroupedDataPointsFn(d) {
|
|
|
8759
8891
|
isAxisShow = axisId && config["axis_" + axisId + "_show"],
|
|
8760
8892
|
axesLen = axisId ? config["axis_" + axisId + "_axes"].length : 0;
|
|
8761
8893
|
let axisSize = axisId ? isLeftRight ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : $$.getHorizontalAxisHeight(axisId) : 0;
|
|
8894
|
+
const defaultPadding = 20;
|
|
8762
8895
|
let gap = 0;
|
|
8763
8896
|
if (!isFitPadding && isLeftRight) {
|
|
8764
8897
|
axisSize = ceil10(axisSize);
|
|
@@ -8766,10 +8899,11 @@ function getGroupedDataPointsFn(d) {
|
|
|
8766
8899
|
let padding = hasAxis && isLeftRight && (isAxisInner || isUndefined(paddingOption) && !isAxisShow) ? 0 : isFitPadding ? (isAxisShow ? axisSize : 0) + (paddingOption != null ? paddingOption : 0) : isUndefined(paddingOption) ? axisSize : paddingOption;
|
|
8767
8900
|
if (isLeftRight && hasAxis) {
|
|
8768
8901
|
if (axisId && (isFitPadding || isAxisInner) && config["axis_" + axisId + "_label"].text) {
|
|
8769
|
-
padding += $$.axis.getAxisLabelPosition(axisId).isOuter ?
|
|
8902
|
+
padding += $$.axis.getAxisLabelPosition(axisId).isOuter ? defaultPadding : 0;
|
|
8770
8903
|
}
|
|
8771
8904
|
if (type === "right") {
|
|
8772
8905
|
padding += isRotated ? !isFitPadding && isUndefined(paddingOption) ? 10 : 2 : !isAxisShow || isAxisInner ? isFitPadding ? 2 : 1 : 0;
|
|
8906
|
+
padding += withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(defaultPadding) : 0;
|
|
8773
8907
|
} else if (type === "left" && isRotated && isUndefined(paddingOption)) {
|
|
8774
8908
|
padding = !config.axis_x_show ? 1 : isFitPadding ? axisSize : Math.max(axisSize, 40);
|
|
8775
8909
|
}
|
|
@@ -8785,12 +8919,15 @@ function getGroupedDataPointsFn(d) {
|
|
|
8785
8919
|
}
|
|
8786
8920
|
return padding + axisSize * axesLen - gap;
|
|
8787
8921
|
},
|
|
8788
|
-
getCurrentPadding: function getCurrentPadding() {
|
|
8922
|
+
getCurrentPadding: function getCurrentPadding(withXAxisTickTextOverflow) {
|
|
8789
8923
|
var _this = this;
|
|
8924
|
+
if (withXAxisTickTextOverflow === void 0) {
|
|
8925
|
+
withXAxisTickTextOverflow = !1;
|
|
8926
|
+
}
|
|
8790
8927
|
const $$ = this,
|
|
8791
8928
|
_map = ["top", "bottom", "left", "right"].map(function (v) {
|
|
8792
8929
|
_newArrowCheck(this, _this);
|
|
8793
|
-
return $$.getCurrentPaddingByDirection(v);
|
|
8930
|
+
return $$.getCurrentPaddingByDirection(v, null, withXAxisTickTextOverflow);
|
|
8794
8931
|
}.bind(this)),
|
|
8795
8932
|
top = _map[0],
|
|
8796
8933
|
bottom = _map[1],
|
|
@@ -8850,14 +8987,14 @@ function getGroupedDataPointsFn(d) {
|
|
|
8850
8987
|
$$.updateXAxisTickClip();
|
|
8851
8988
|
}
|
|
8852
8989
|
const legendSize = {
|
|
8853
|
-
right: config.legend_show && state.isLegendRight ? $$.getLegendWidth() + 20 : 0,
|
|
8990
|
+
right: config.legend_show && state.isLegendRight ? $$.getLegendWidth() + (isFitPadding ? 0 : 20) : 0,
|
|
8854
8991
|
bottom: !config.legend_show || state.isLegendRight || state.isLegendInset ? 0 : currLegend.height
|
|
8855
8992
|
},
|
|
8856
8993
|
xAxisHeight = isRotated || isNonAxis ? 0 : $$.getHorizontalAxisHeight("x"),
|
|
8857
8994
|
subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30,
|
|
8858
8995
|
subchartHeight = config.subchart_show && !isNonAxis ? config.subchart_size_height + subchartXAxisHeight : 0,
|
|
8859
8996
|
gaugeHeight = $$.hasType("gauge") && config.arc_needle_show && !config.gauge_fullCircle && !config.gauge_label_show ? 10 : 0,
|
|
8860
|
-
padding = $$.getCurrentPadding(); // when needle is shown with legend, it need some bottom space to not overlap with legend text
|
|
8997
|
+
padding = $$.getCurrentPadding(!0); // when needle is shown with legend, it need some bottom space to not overlap with legend text
|
|
8861
8998
|
// for main
|
|
8862
8999
|
state.margin = !isNonAxis && isRotated ? {
|
|
8863
9000
|
top: padding.top,
|
|
@@ -8913,9 +9050,11 @@ function getGroupedDataPointsFn(d) {
|
|
|
8913
9050
|
|
|
8914
9051
|
// for arc
|
|
8915
9052
|
if ($$.hasArcType()) {
|
|
9053
|
+
var _ref;
|
|
8916
9054
|
const hasGauge = $$.hasType("gauge"),
|
|
8917
|
-
isLegendRight = config.legend_show && state.isLegendRight
|
|
8918
|
-
|
|
9055
|
+
isLegendRight = config.legend_show && state.isLegendRight,
|
|
9056
|
+
textWidth = (_ref = state.hasRadar && $$.cache.get(KEY.radarTextWidth)) != null ? _ref : 0;
|
|
9057
|
+
state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0) - textWidth;
|
|
8919
9058
|
state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10);
|
|
8920
9059
|
if (hasGauge && !config.gauge_fullCircle) {
|
|
8921
9060
|
state.arcHeight += state.height - $$.getPaddingBottomForGauge();
|
|
@@ -9183,7 +9322,7 @@ function getTextPos(d, type) {
|
|
|
9183
9322
|
* @returns {string|null}
|
|
9184
9323
|
* @private
|
|
9185
9324
|
*/
|
|
9186
|
-
|
|
9325
|
+
updateTextBackgroundColor: function updateTextBackgroundColor(d) {
|
|
9187
9326
|
const $$ = this,
|
|
9188
9327
|
$el = $$.$el,
|
|
9189
9328
|
config = $$.config,
|
|
@@ -9218,7 +9357,7 @@ function getTextPos(d, type) {
|
|
|
9218
9357
|
angle = config.data_labels.rotate,
|
|
9219
9358
|
anchorString = getRotateAnchor(angle),
|
|
9220
9359
|
rotateString = angle ? "rotate(" + angle + ")" : "";
|
|
9221
|
-
$$.$el.text.style("fill", $$.getStylePropValue($$.updateTextColor)).attr("filter", $$.
|
|
9360
|
+
$$.$el.text.style("fill", $$.getStylePropValue($$.updateTextColor)).attr("filter", $$.updateTextBackgroundColor.bind($$)).style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$)).each(function (d, i) {
|
|
9222
9361
|
// do not apply transition for newly added text elements
|
|
9223
9362
|
const node = $T(hasTreemap && this.childElementCount ? this.parentNode : this, !!(withTransition && this.getAttribute("x")), t),
|
|
9224
9363
|
isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"];
|
|
@@ -9314,7 +9453,7 @@ function getTextPos(d, type) {
|
|
|
9314
9453
|
if (config.data_labels.centered && (isBarType || isTreemapType)) {
|
|
9315
9454
|
const rect = getBoundingRect(textElement);
|
|
9316
9455
|
if (isBarType) {
|
|
9317
|
-
const isPositive = d
|
|
9456
|
+
const isPositive = $$.getRangedData(d, null, "bar") >= 0;
|
|
9318
9457
|
if (isRotated) {
|
|
9319
9458
|
const w = (isPositive ? points[1][1] - points[0][1] : points[0][1] - points[1][1]) / 2 + rect.width / 2;
|
|
9320
9459
|
return isPositive ? -w - 3 : w + 2;
|
|
@@ -9773,12 +9912,10 @@ function getTextXPos(pos, width) {
|
|
|
9773
9912
|
value = "<b>Open:</b> " + open + " <b>High:</b> " + high + " <b>Low:</b> " + low + " <b>Close:</b> " + close + (volume ? " <b>Volume:</b> " + volume : "");
|
|
9774
9913
|
} else if ($$.isBarRangeType(row)) {
|
|
9775
9914
|
const _row = row,
|
|
9776
|
-
|
|
9777
|
-
start = _row$value[0],
|
|
9778
|
-
end = _row$value[1],
|
|
9915
|
+
rangeValue = _row.value,
|
|
9779
9916
|
id = _row.id,
|
|
9780
9917
|
index = _row.index;
|
|
9781
|
-
value =
|
|
9918
|
+
value = "" + valueFormat(rangeValue, undefined, id, index);
|
|
9782
9919
|
} else {
|
|
9783
9920
|
value = valueFormat.apply(void 0, [getRowValue(row)].concat(param));
|
|
9784
9921
|
}
|
|
@@ -9907,6 +10044,7 @@ function getTextXPos(pos, width) {
|
|
|
9907
10044
|
inputType = _state.inputType,
|
|
9908
10045
|
hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
|
|
9909
10046
|
hasTreemap = state.hasTreemap,
|
|
10047
|
+
hasRadar = state.hasRadar,
|
|
9910
10048
|
isRotated = config.axis_rotated,
|
|
9911
10049
|
hasArcType = $$.hasArcType(),
|
|
9912
10050
|
svgLeft = $$.getSvgLeft(!0);
|
|
@@ -9916,13 +10054,17 @@ function getTextXPos(pos, width) {
|
|
|
9916
10054
|
y = currPos.y;
|
|
9917
10055
|
|
|
9918
10056
|
// Determine tooltip position
|
|
9919
|
-
if (
|
|
9920
|
-
|
|
9921
|
-
|
|
10057
|
+
if (hasRadar) {
|
|
10058
|
+
x += x >= width / 2 ? 15 : -(tWidth + 15);
|
|
10059
|
+
y += 15;
|
|
10060
|
+
} else if (hasArcType) {
|
|
10061
|
+
if (!(inputType === "touch")) {
|
|
9922
10062
|
x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
|
|
9923
|
-
y += hasGauge ? height : height / 2;
|
|
10063
|
+
y += hasGauge ? height : height / 2 + tHeight;
|
|
9924
10064
|
}
|
|
9925
|
-
} else if (
|
|
10065
|
+
} else if (hasTreemap) {
|
|
10066
|
+
y += tHeight;
|
|
10067
|
+
} else {
|
|
9926
10068
|
const padding = {
|
|
9927
10069
|
top: $$.getCurrentPaddingByDirection("top", !0),
|
|
9928
10070
|
left: $$.getCurrentPaddingByDirection("left", !0)
|
|
@@ -9942,8 +10084,8 @@ function getTextXPos(pos, width) {
|
|
|
9942
10084
|
x -= tWidth + (hasTreemap || hasArcType ? 0 : isRotated ? 40 : 38);
|
|
9943
10085
|
}
|
|
9944
10086
|
if (y + tHeight > current.height) {
|
|
9945
|
-
const gap = hasTreemap ?
|
|
9946
|
-
y -= hasGauge ? tHeight *
|
|
10087
|
+
const gap = hasTreemap ? tHeight + 10 : 30;
|
|
10088
|
+
y -= hasGauge ? tHeight * 1.5 : tHeight + gap;
|
|
9947
10089
|
}
|
|
9948
10090
|
const pos = {
|
|
9949
10091
|
top: y,
|
|
@@ -10192,7 +10334,7 @@ function getTextXPos(pos, width) {
|
|
|
10192
10334
|
y = isRotated ? state.height + padding : 0;
|
|
10193
10335
|
} else if (target === "y2") {
|
|
10194
10336
|
x = isRotated ? 0 : state.width + padding;
|
|
10195
|
-
y = isRotated ?
|
|
10337
|
+
y = isRotated ? -padding - 1 : 0;
|
|
10196
10338
|
} else if (target === "subX") {
|
|
10197
10339
|
x = 0;
|
|
10198
10340
|
y = isRotated ? 0 : state.height2;
|
|
@@ -10204,9 +10346,10 @@ function getTextXPos(pos, width) {
|
|
|
10204
10346
|
y = state.arcHeight / 2;
|
|
10205
10347
|
} else if (target === "radar") {
|
|
10206
10348
|
const _$$$getRadarSize = $$.getRadarSize(),
|
|
10207
|
-
width = _$$$getRadarSize[0]
|
|
10349
|
+
width = _$$$getRadarSize[0],
|
|
10350
|
+
height = _$$$getRadarSize[1];
|
|
10208
10351
|
x = state.width / 2 - width;
|
|
10209
|
-
y =
|
|
10352
|
+
y = state.height / 2 - height;
|
|
10210
10353
|
}
|
|
10211
10354
|
return "translate(" + x + ", " + y + ")";
|
|
10212
10355
|
},
|
|
@@ -10364,8 +10507,9 @@ function getTextXPos(pos, width) {
|
|
|
10364
10507
|
* @private
|
|
10365
10508
|
*/
|
|
10366
10509
|
isTypeOf: function isTypeOf(d, type) {
|
|
10510
|
+
var _this$config$data_typ;
|
|
10367
10511
|
const id = isString(d) ? d : d.id,
|
|
10368
|
-
dataType = this.config.data_types[id] || this.config.data_type;
|
|
10512
|
+
dataType = this.config && (((_this$config$data_typ = this.config.data_types) == null ? void 0 : _this$config$data_typ[id]) || this.config.data_type);
|
|
10369
10513
|
return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type;
|
|
10370
10514
|
},
|
|
10371
10515
|
hasPointType: function hasPointType() {
|
|
@@ -10577,7 +10721,6 @@ let ChartInternal = /*#__PURE__*/function () {
|
|
|
10577
10721
|
// defaultAxisTimeFormat
|
|
10578
10722
|
axisTime: null // axisTimeFormat
|
|
10579
10723
|
};
|
|
10580
|
-
|
|
10581
10724
|
const $$ = this;
|
|
10582
10725
|
$$.api = api; // Chart class instance alias
|
|
10583
10726
|
$$.config = new Options();
|
|
@@ -10777,6 +10920,7 @@ let ChartInternal = /*#__PURE__*/function () {
|
|
|
10777
10920
|
hasPolar = $$.hasType("polar");
|
|
10778
10921
|
// for arc type, set axes to not be shown
|
|
10779
10922
|
// $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
|
|
10923
|
+
|
|
10780
10924
|
if (hasAxis) {
|
|
10781
10925
|
$$.axis = $$.getAxisInstance();
|
|
10782
10926
|
config.zoom_enabled && $$.initZoom();
|
|
@@ -10844,7 +10988,7 @@ let ChartInternal = /*#__PURE__*/function () {
|
|
|
10844
10988
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || config.data_labels_backgroundColors) {
|
|
10845
10989
|
$el.defs = $el.svg.append("defs");
|
|
10846
10990
|
if (hasAxis) {
|
|
10847
|
-
["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
|
10991
|
+
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(function (v) {
|
|
10848
10992
|
_newArrowCheck(this, _this3);
|
|
10849
10993
|
$$.appendClip($el.defs, state.clip[v]);
|
|
10850
10994
|
}.bind(this));
|
|
@@ -10887,7 +11031,6 @@ let ChartInternal = /*#__PURE__*/function () {
|
|
|
10887
11031
|
main.append("text").attr("class", $TEXT.text + " " + $COMMON.empty).attr("text-anchor", "middle") // horizontal centering of text at x position in all browsers.
|
|
10888
11032
|
.attr("dominant-baseline", "middle"); // vertical centering of text at y position in all browsers, except IE.
|
|
10889
11033
|
}
|
|
10890
|
-
|
|
10891
11034
|
if (hasAxis) {
|
|
10892
11035
|
// Regions
|
|
10893
11036
|
config.regions.length && $$.initRegion();
|
|
@@ -14235,11 +14378,23 @@ let AxisRenderer = /*#__PURE__*/function () {
|
|
|
14235
14378
|
_newArrowCheck(this, _this4);
|
|
14236
14379
|
const r2 = r / (orient === "bottom" ? 15 : 23);
|
|
14237
14380
|
return r ? 11.5 - 2.5 * r2 * (r > 0 ? 1 : -1) : tickLength;
|
|
14238
|
-
}.bind(this)
|
|
14381
|
+
}.bind(this),
|
|
14382
|
+
_this$params$owner$co = this.params.owner.config,
|
|
14383
|
+
isRotated = _this$params$owner$co.axis_rotated,
|
|
14384
|
+
inner = _this$params$owner$co.axis_x_tick_text_inner;
|
|
14239
14385
|
switch (orient) {
|
|
14240
14386
|
case "bottom":
|
|
14241
14387
|
lineUpdate.attr("x1", tickPos.x).attr("x2", tickPos.x).attr("y2", this.getTickSize.bind(this));
|
|
14242
|
-
textUpdate.attr("x", 0).attr("y", yForText(rotate)).style("text-anchor", textAnchorForText(rotate)).
|
|
14388
|
+
textUpdate.attr("x", 0).attr("y", yForText(rotate)).style("text-anchor", textAnchorForText(rotate)).style("text-anchor", function (d, i, _ref) {
|
|
14389
|
+
let length = _ref.length;
|
|
14390
|
+
_newArrowCheck(this, _this4);
|
|
14391
|
+
if (!isRotated && i === 0 && (inner === !0 || inner.first)) {
|
|
14392
|
+
return "start";
|
|
14393
|
+
} else if (!isRotated && i === length - 1 && (inner === !0 || inner.last)) {
|
|
14394
|
+
return "end";
|
|
14395
|
+
}
|
|
14396
|
+
return textAnchorForText(rotate);
|
|
14397
|
+
}.bind(this)).attr("transform", textTransform(rotate));
|
|
14243
14398
|
break;
|
|
14244
14399
|
case "top":
|
|
14245
14400
|
lineUpdate.attr("x2", 0).attr("y2", -innerTickSize);
|
|
@@ -14926,11 +15081,12 @@ let Axis_Axis = /*#__PURE__*/function () {
|
|
|
14926
15081
|
svg = _$$$$el2.svg,
|
|
14927
15082
|
chart = _$$$$el2.chart,
|
|
14928
15083
|
currentTickMax = current.maxTickSize[id],
|
|
15084
|
+
configPrefix = "axis_" + id,
|
|
14929
15085
|
max = {
|
|
14930
15086
|
width: 0,
|
|
14931
15087
|
height: 0
|
|
14932
15088
|
};
|
|
14933
|
-
if (withoutRecompute || !config[
|
|
15089
|
+
if (withoutRecompute || !config[configPrefix + "_show"] || currentTickMax.width > 0 && $$.filterTargetsToShow().length === 0) {
|
|
14934
15090
|
return currentTickMax;
|
|
14935
15091
|
}
|
|
14936
15092
|
if (svg) {
|
|
@@ -14958,8 +15114,9 @@ let Axis_Axis = /*#__PURE__*/function () {
|
|
|
14958
15114
|
currentTickMax.ticks.splice(0);
|
|
14959
15115
|
}
|
|
14960
15116
|
const axis = this.getAxis(id, scale, !1, !1, !0),
|
|
14961
|
-
|
|
14962
|
-
|
|
15117
|
+
tickRotate = config[configPrefix + "_tick_rotate"],
|
|
15118
|
+
tickCount = config[configPrefix + "_tick_count"],
|
|
15119
|
+
tickValues = config[configPrefix + "_tick_values"];
|
|
14963
15120
|
// Make to generate the final tick text to be rendered
|
|
14964
15121
|
// https://github.com/naver/billboard.js/issues/920
|
|
14965
15122
|
// Do not generate if 'tick values' option is given
|
|
@@ -14970,7 +15127,7 @@ let Axis_Axis = /*#__PURE__*/function () {
|
|
|
14970
15127
|
isYAxis || this.updateXAxisTickValues(targetsToShow, axis);
|
|
14971
15128
|
const dummy = chart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0").style("left", "0");
|
|
14972
15129
|
axis.create(dummy);
|
|
14973
|
-
dummy.selectAll("text").each(function (d, i) {
|
|
15130
|
+
dummy.selectAll("text").attr("transform", isNumber(tickRotate) ? "rotate(" + tickRotate + ")" : null).each(function (d, i) {
|
|
14974
15131
|
const _this$getBoundingClie = this.getBoundingClientRect(),
|
|
14975
15132
|
width = _this$getBoundingClie.width,
|
|
14976
15133
|
height = _this$getBoundingClie.height;
|
|
@@ -14996,11 +15153,15 @@ let Axis_Axis = /*#__PURE__*/function () {
|
|
|
14996
15153
|
const $$ = this.owner,
|
|
14997
15154
|
axis = $$.axis,
|
|
14998
15155
|
config = $$.config,
|
|
14999
|
-
|
|
15156
|
+
_$$$state2 = $$.state,
|
|
15157
|
+
current = _$$$state2.current,
|
|
15158
|
+
isLegendRight = _$$$state2.isLegendRight,
|
|
15159
|
+
legendItemWidth = _$$$state2.legendItemWidth,
|
|
15000
15160
|
xAxisTickRotate = $$.getAxisTickRotate("x");
|
|
15001
|
-
if ((axis.isCategorized() || axis.isTimeSeries()) && config.axis_x_tick_fit && !config.axis_x_tick_culling && !config.axis_x_tick_multiline && xAxisTickRotate > 0 && xAxisTickRotate < 90) {
|
|
15002
|
-
const
|
|
15003
|
-
|
|
15161
|
+
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) {
|
|
15162
|
+
const y2AxisWidth = config.axis_y2_show && current.maxTickSize.y2.width || 0,
|
|
15163
|
+
widthWithoutCurrentPaddingLeft = current.width - $$.getCurrentPaddingByDirection("left"),
|
|
15164
|
+
maxOverflow = this.getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft - defaultPadding) - y2AxisWidth - (isLegendRight && legendItemWidth || 0),
|
|
15004
15165
|
xAxisTickTextY2Overflow = Math.max(0, maxOverflow) + defaultPadding;
|
|
15005
15166
|
// for display inconsistencies between browsers
|
|
15006
15167
|
|
|
@@ -15247,9 +15408,9 @@ let Axis_Axis = /*#__PURE__*/function () {
|
|
|
15247
15408
|
var _this19 = this;
|
|
15248
15409
|
const $$ = this.owner,
|
|
15249
15410
|
config = $$.config,
|
|
15250
|
-
_$$$
|
|
15251
|
-
clip = _$$$
|
|
15252
|
-
current = _$$$
|
|
15411
|
+
_$$$state3 = $$.state,
|
|
15412
|
+
clip = _$$$state3.clip,
|
|
15413
|
+
current = _$$$state3.current,
|
|
15253
15414
|
$el = $$.$el;
|
|
15254
15415
|
["subX", "x", "y", "y2"].forEach(function (type) {
|
|
15255
15416
|
_newArrowCheck(this, _this19);
|
|
@@ -15472,7 +15633,12 @@ let Axis_Axis = /*#__PURE__*/function () {
|
|
|
15472
15633
|
rectElement = eventRect || $el.eventRect,
|
|
15473
15634
|
updateClientRect = function () {
|
|
15474
15635
|
_newArrowCheck(this, _this3);
|
|
15475
|
-
|
|
15636
|
+
if (eventReceiver) {
|
|
15637
|
+
const scrollPos = getScrollPosition($el.chart.node());
|
|
15638
|
+
eventReceiver.rect = rectElement.node().getBoundingClientRect().toJSON();
|
|
15639
|
+
eventReceiver.rect.top += scrollPos.y;
|
|
15640
|
+
eventReceiver.rect.left += scrollPos.x;
|
|
15641
|
+
}
|
|
15476
15642
|
}.bind(this);
|
|
15477
15643
|
if (!rendered || resizing || force) {
|
|
15478
15644
|
rectElement.attr("x", 0).attr("y", 0).attr("width", width).attr("height", height);
|
|
@@ -16156,7 +16322,6 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
16156
16322
|
* @private
|
|
16157
16323
|
*/
|
|
16158
16324
|
setYAxisClipPath: function setYAxisClipPath(node) {
|
|
16159
|
-
var _config$padding;
|
|
16160
16325
|
const $$ = this,
|
|
16161
16326
|
config = $$.config,
|
|
16162
16327
|
_$$$state3 = $$.state,
|
|
@@ -16169,7 +16334,7 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
16169
16334
|
x = isInner && !isRotated ? config.axis_y_label.text ? -20 : -1 : isRotated ? -(1 + left) : -(left - 1),
|
|
16170
16335
|
y = -(isRotated ? 20 : margin.top),
|
|
16171
16336
|
w = (isRotated ? width + 15 + left : margin.left + 20) + (isInner ? 20 : 0),
|
|
16172
|
-
h = (isRotated ? margin.bottom +
|
|
16337
|
+
h = (isRotated ? margin.bottom + 10 : margin.top + height) + 10;
|
|
16173
16338
|
node.attr("x", x).attr("y", y).attr("width", w).attr("height", h);
|
|
16174
16339
|
},
|
|
16175
16340
|
updateXAxisTickClip: function updateXAxisTickClip() {
|
|
@@ -16804,7 +16969,6 @@ function smoothLines(el, type) {
|
|
|
16804
16969
|
config = $$.config,
|
|
16805
16970
|
state = $$.state,
|
|
16806
16971
|
_state = state,
|
|
16807
|
-
current = _state.current,
|
|
16808
16972
|
rotatedPadding = _state.rotatedPadding,
|
|
16809
16973
|
isLegendRight = _state.isLegendRight,
|
|
16810
16974
|
isLegendInset = _state.isLegendInset,
|
|
@@ -16826,16 +16990,8 @@ function smoothLines(el, type) {
|
|
|
16826
16990
|
return isFitPadding ? 0 : rotatedPadding.top;
|
|
16827
16991
|
}
|
|
16828
16992
|
const maxtickSize = $$.axis.getMaxTickSize(id),
|
|
16829
|
-
|
|
16830
|
-
|
|
16831
|
-
if ((id === "x" && !isRotated || /y2?/.test(id) && isRotated) && rotate) {
|
|
16832
|
-
h += maxtickSize.width * Math.cos(Math.PI * (90 - Math.abs(rotate)) / 180);
|
|
16833
|
-
if (!config.axis_x_tick_multiline && current.height) {
|
|
16834
|
-
if (h > current.height / 2) {
|
|
16835
|
-
h = current.height / 2;
|
|
16836
|
-
}
|
|
16837
|
-
}
|
|
16838
|
-
} else if (maxtickSize.height > 13 && config.legend_show) {
|
|
16993
|
+
isXAxisTickRotated = config.axis_x_tick_rotate > 0 && (!config.axis_x_tick_autorotate || $$.needToRotateXAxisTickTexts());
|
|
16994
|
+
if ((config.axis_x_tick_multiline || isXAxisTickRotated) && maxtickSize.height > 13) {
|
|
16839
16995
|
h += maxtickSize.height - 13;
|
|
16840
16996
|
}
|
|
16841
16997
|
return h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id === "y2" && !isRotated ? -10 : 0);
|
|
@@ -16878,7 +17034,7 @@ function smoothLines(el, type) {
|
|
|
16878
17034
|
}
|
|
16879
17035
|
state.axis.x.tickCount = tickCount;
|
|
16880
17036
|
}
|
|
16881
|
-
if ($el.svg && config.
|
|
17037
|
+
if ($el.svg && config.axis_x_tick_autorotate && config.axis_x_tick_fit && !config.axis_x_tick_multiline && !config.axis_x_tick_culling && allowedXAxisTypes) {
|
|
16882
17038
|
rotate = $$.needToRotateXAxisTickTexts() ? config.axis_x_tick_rotate : 0;
|
|
16883
17039
|
}
|
|
16884
17040
|
}
|
|
@@ -16894,7 +17050,9 @@ function smoothLines(el, type) {
|
|
|
16894
17050
|
_$$$state = $$.state,
|
|
16895
17051
|
axis = _$$$state.axis,
|
|
16896
17052
|
current = _$$$state.current,
|
|
16897
|
-
|
|
17053
|
+
isLegendRight = _$$$state.isLegendRight,
|
|
17054
|
+
legendItemWidth = _$$$state.legendItemWidth,
|
|
17055
|
+
xAxisLength = current.width - (isLegendRight && legendItemWidth) - $$.getCurrentPaddingByDirection("left") - $$.getCurrentPaddingByDirection("right"),
|
|
16898
17056
|
tickCountWithPadding = axis.x.tickCount + axis.x.padding.left + axis.x.padding.right,
|
|
16899
17057
|
_$$$axis$getMaxTickSi2 = $$.axis.getMaxTickSize("x"),
|
|
16900
17058
|
width = _$$$axis$getMaxTickSi2.width,
|
|
@@ -17299,6 +17457,31 @@ function smoothLines(el, type) {
|
|
|
17299
17457
|
* }
|
|
17300
17458
|
*/
|
|
17301
17459
|
axis_x_tick_text_show: !0,
|
|
17460
|
+
/**
|
|
17461
|
+
* Set the first/last axis tick text to be positioned inside of the chart on non-rotated axis.
|
|
17462
|
+
* @name axis․x․tick․text․inner
|
|
17463
|
+
* @memberof Options
|
|
17464
|
+
* @type {boolean|object}
|
|
17465
|
+
* @default false
|
|
17466
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.XAxisTickInner)
|
|
17467
|
+
* @example
|
|
17468
|
+
* axis: {
|
|
17469
|
+
* x: {
|
|
17470
|
+
* tick: {
|
|
17471
|
+
* text: {
|
|
17472
|
+
* inner: true,
|
|
17473
|
+
*
|
|
17474
|
+
* // or specify each position of the first and last tick text
|
|
17475
|
+
* inner: {
|
|
17476
|
+
* first: true,
|
|
17477
|
+
* last: true
|
|
17478
|
+
* }
|
|
17479
|
+
* }
|
|
17480
|
+
* }
|
|
17481
|
+
* }
|
|
17482
|
+
* }
|
|
17483
|
+
*/
|
|
17484
|
+
axis_x_tick_text_inner: !1,
|
|
17302
17485
|
/**
|
|
17303
17486
|
* Set the x Axis tick text's position relatively its original position
|
|
17304
17487
|
* @name axis․x․tick․text․position
|
|
@@ -17478,7 +17661,7 @@ function smoothLines(el, type) {
|
|
|
17478
17661
|
*/
|
|
17479
17662
|
axis_x_tick_width: null,
|
|
17480
17663
|
/**
|
|
17481
|
-
* Set to display system tooltip(via
|
|
17664
|
+
* Set to display system tooltip(via `<title>` element) for tick text
|
|
17482
17665
|
* - **NOTE:** Only available for category axis type (`axis.x.type='category'`)
|
|
17483
17666
|
* @name axis․x․tick․tooltip
|
|
17484
17667
|
* @memberof Options
|
|
@@ -18226,6 +18409,18 @@ function smoothLines(el, type) {
|
|
|
18226
18409
|
* y2 Axis config options
|
|
18227
18410
|
*/
|
|
18228
18411
|
/* harmony default export */ var y2 = ({
|
|
18412
|
+
/**
|
|
18413
|
+
* Set clip-path attribute for y2 axis element
|
|
18414
|
+
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
18415
|
+
* @name axis․y2․clipPath
|
|
18416
|
+
* @memberof Options
|
|
18417
|
+
* @type {boolean}
|
|
18418
|
+
* @default true
|
|
18419
|
+
* @example
|
|
18420
|
+
* // don't set 'clip-path' attribute
|
|
18421
|
+
* clipPath: false
|
|
18422
|
+
*/
|
|
18423
|
+
axis_y2_clipPath: !0,
|
|
18229
18424
|
/**
|
|
18230
18425
|
* Show or hide y2 axis.
|
|
18231
18426
|
* - **NOTE**:
|
|
@@ -19203,7 +19398,7 @@ function getAttrTweenFn(fn) {
|
|
|
19203
19398
|
const $$ = this,
|
|
19204
19399
|
hasGauge = $$.hasType("gauge");
|
|
19205
19400
|
if ($$.shouldShowArcLabel()) {
|
|
19206
|
-
selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.
|
|
19401
|
+
selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.updateTextBackgroundColor.bind($$)).each(function (d) {
|
|
19207
19402
|
var _filter;
|
|
19208
19403
|
const node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
19209
19404
|
updated = $$.updateAngle(d),
|
|
@@ -21571,7 +21766,8 @@ function getPosition(isClockwise, type, edge, pos, range, ratio) {
|
|
|
21571
21766
|
}
|
|
21572
21767
|
|
|
21573
21768
|
// cache key
|
|
21574
|
-
const
|
|
21769
|
+
const cacheKeyPoints = KEY.radarPoints,
|
|
21770
|
+
cacheKeyTextWidth = KEY.radarTextWidth;
|
|
21575
21771
|
/* harmony default export */ var radar = ({
|
|
21576
21772
|
initRadar: function initRadar() {
|
|
21577
21773
|
const $$ = this,
|
|
@@ -21590,6 +21786,13 @@ const cacheKey = KEY.radarPoints;
|
|
|
21590
21786
|
// shapes
|
|
21591
21787
|
$el.radar.shapes = $el.radar.append("g").attr("class", $SHAPE.shapes);
|
|
21592
21788
|
current.dataMax = config.radar_axis_max || $$.getMinMaxData().max[0].value;
|
|
21789
|
+
if (config.radar_axis_text_show) {
|
|
21790
|
+
config.interaction_enabled && $$.bindRadarEvent();
|
|
21791
|
+
|
|
21792
|
+
// it needs to calculate dimension at the initialization
|
|
21793
|
+
$$.updateRadarLevel();
|
|
21794
|
+
$$.updateRadarAxes();
|
|
21795
|
+
}
|
|
21593
21796
|
}
|
|
21594
21797
|
},
|
|
21595
21798
|
getRadarSize: function getRadarSize() {
|
|
@@ -21640,7 +21843,7 @@ const cacheKey = KEY.radarPoints;
|
|
|
21640
21843
|
_$$$getRadarSize2 = $$.getRadarSize(),
|
|
21641
21844
|
width = _$$$getRadarSize2[0],
|
|
21642
21845
|
height = _$$$getRadarSize2[1],
|
|
21643
|
-
points = $$.cache.get(
|
|
21846
|
+
points = $$.cache.get(cacheKeyPoints) || {},
|
|
21644
21847
|
size = points._size;
|
|
21645
21848
|
// recalculate position only when the previous dimension has been changed
|
|
21646
21849
|
if (!size || size.width !== width && size.height !== height) {
|
|
@@ -21656,7 +21859,7 @@ const cacheKey = KEY.radarPoints;
|
|
|
21656
21859
|
width: width,
|
|
21657
21860
|
height: height
|
|
21658
21861
|
};
|
|
21659
|
-
$$.cache.add(
|
|
21862
|
+
$$.cache.add(cacheKeyPoints, points);
|
|
21660
21863
|
}
|
|
21661
21864
|
},
|
|
21662
21865
|
redrawRadar: function redrawRadar() {
|
|
@@ -21677,7 +21880,7 @@ const cacheKey = KEY.radarPoints;
|
|
|
21677
21880
|
},
|
|
21678
21881
|
generateGetRadarPoints: function generateGetRadarPoints() {
|
|
21679
21882
|
var _this5 = this;
|
|
21680
|
-
const points = this.cache.get(
|
|
21883
|
+
const points = this.cache.get(cacheKeyPoints);
|
|
21681
21884
|
return function (d, i) {
|
|
21682
21885
|
_newArrowCheck(this, _this5);
|
|
21683
21886
|
const point = points[d.id][i];
|
|
@@ -21791,7 +21994,8 @@ const cacheKey = KEY.radarPoints;
|
|
|
21791
21994
|
_config$radar_axis_te2 = _config$radar_axis_te.x,
|
|
21792
21995
|
x = _config$radar_axis_te2 === void 0 ? 0 : _config$radar_axis_te2,
|
|
21793
21996
|
_config$radar_axis_te3 = _config$radar_axis_te.y,
|
|
21794
|
-
y = _config$radar_axis_te3 === void 0 ? 0 : _config$radar_axis_te3
|
|
21997
|
+
y = _config$radar_axis_te3 === void 0 ? 0 : _config$radar_axis_te3,
|
|
21998
|
+
textWidth = $$.cache.get(cacheKeyTextWidth) || 0;
|
|
21795
21999
|
axis.select("text").style("text-anchor", "middle").attr("dy", ".5em").call(function (selection) {
|
|
21796
22000
|
_newArrowCheck(this, _this8);
|
|
21797
22001
|
selection.each(function (d) {
|
|
@@ -21825,13 +22029,23 @@ const cacheKey = KEY.radarPoints;
|
|
|
21825
22029
|
}
|
|
21826
22030
|
return "translate(" + posX + " " + posY + ")";
|
|
21827
22031
|
});
|
|
22032
|
+
if (!textWidth) {
|
|
22033
|
+
const widths = [radar.axes, radar.levels].map(function (v) {
|
|
22034
|
+
_newArrowCheck(this, _this8);
|
|
22035
|
+
return getPathBox(v.node()).width;
|
|
22036
|
+
}.bind(this));
|
|
22037
|
+
if (widths.every(function (v) {
|
|
22038
|
+
_newArrowCheck(this, _this8);
|
|
22039
|
+
return v > 0;
|
|
22040
|
+
}.bind(this))) {
|
|
22041
|
+
$$.cache.add(cacheKeyTextWidth, widths[0] - widths[1]);
|
|
22042
|
+
}
|
|
22043
|
+
}
|
|
21828
22044
|
}
|
|
21829
|
-
$$.bindRadarEvent();
|
|
21830
22045
|
},
|
|
21831
22046
|
bindRadarEvent: function bindRadarEvent() {
|
|
21832
22047
|
var _this9 = this;
|
|
21833
22048
|
const $$ = this,
|
|
21834
|
-
config = $$.config,
|
|
21835
22049
|
state = $$.state,
|
|
21836
22050
|
_$$$$el2 = $$.$el,
|
|
21837
22051
|
radar = _$$$$el2.radar,
|
|
@@ -21839,40 +22053,38 @@ const cacheKey = KEY.radarPoints;
|
|
|
21839
22053
|
focusOnly = $$.isPointFocusOnly(),
|
|
21840
22054
|
_state = state,
|
|
21841
22055
|
inputType = _state.inputType,
|
|
21842
|
-
transiting = _state.transiting
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
|
|
21847
|
-
state.event = event;
|
|
22056
|
+
transiting = _state.transiting,
|
|
22057
|
+
isMouse = inputType === "mouse",
|
|
22058
|
+
hide = function (event) {
|
|
22059
|
+
_newArrowCheck(this, _this9);
|
|
22060
|
+
state.event = event;
|
|
21848
22061
|
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
21858
|
-
|
|
21859
|
-
}
|
|
22062
|
+
// const index = getIndex(event);
|
|
22063
|
+
const index = $$.getDataIndexFromEvent(event),
|
|
22064
|
+
noIndex = isUndefined(index);
|
|
22065
|
+
if (isMouse || noIndex) {
|
|
22066
|
+
$$.hideTooltip();
|
|
22067
|
+
focusOnly ? $$.hideCircleFocus() : $$.unexpandCircles();
|
|
22068
|
+
if (isMouse) {
|
|
22069
|
+
$$.setOverOut(!1, index);
|
|
22070
|
+
} else if (noIndex) {
|
|
22071
|
+
$$.callOverOutForTouch();
|
|
21860
22072
|
}
|
|
21861
|
-
}.bind(this);
|
|
21862
|
-
radar.axes.selectAll("text").on(isMouse ? "mouseover " : "touchstart", function (event) {
|
|
21863
|
-
_newArrowCheck(this, _this9);
|
|
21864
|
-
if (transiting) {
|
|
21865
|
-
// skip while transiting
|
|
21866
|
-
return;
|
|
21867
22073
|
}
|
|
21868
|
-
|
|
21869
|
-
|
|
21870
|
-
|
|
21871
|
-
|
|
21872
|
-
|
|
21873
|
-
|
|
21874
|
-
svg.on("touchstart", hide);
|
|
22074
|
+
}.bind(this);
|
|
22075
|
+
radar.axes.on(isMouse ? "mouseover " : "touchstart", function (event) {
|
|
22076
|
+
_newArrowCheck(this, _this9);
|
|
22077
|
+
if (transiting) {
|
|
22078
|
+
// skip while transiting
|
|
22079
|
+
return;
|
|
21875
22080
|
}
|
|
22081
|
+
state.event = event;
|
|
22082
|
+
const index = $$.getDataIndexFromEvent(event);
|
|
22083
|
+
$$.selectRectForSingle(svg.node(), index);
|
|
22084
|
+
isMouse ? $$.setOverOut(!0, index) : $$.callOverOutForTouch(index);
|
|
22085
|
+
}.bind(this)).on("mouseout", isMouse ? hide : null);
|
|
22086
|
+
if (!isMouse) {
|
|
22087
|
+
svg.on("touchstart", hide);
|
|
21876
22088
|
}
|
|
21877
22089
|
},
|
|
21878
22090
|
updateRadarShape: function updateRadarShape() {
|
|
@@ -21882,7 +22094,7 @@ const cacheKey = KEY.radarPoints;
|
|
|
21882
22094
|
_newArrowCheck(this, _this10);
|
|
21883
22095
|
return $$.isRadarType(d);
|
|
21884
22096
|
}.bind(this)),
|
|
21885
|
-
points = $$.cache.get(
|
|
22097
|
+
points = $$.cache.get(cacheKeyPoints),
|
|
21886
22098
|
areas = $$.$el.radar.shapes.selectAll("polygon").data(targets),
|
|
21887
22099
|
areasEnter = areas.enter().append("g").attr("class", $$.getChartClass("Radar"));
|
|
21888
22100
|
$$.$T(areas.exit()).remove();
|
|
@@ -21899,7 +22111,7 @@ const cacheKey = KEY.radarPoints;
|
|
|
21899
22111
|
* @private
|
|
21900
22112
|
*/
|
|
21901
22113
|
radarCircleX: function radarCircleX(d) {
|
|
21902
|
-
return this.cache.get(
|
|
22114
|
+
return this.cache.get(cacheKeyPoints)[d.id][d.index][0];
|
|
21903
22115
|
},
|
|
21904
22116
|
/**
|
|
21905
22117
|
* Get data point y coordinate
|
|
@@ -21908,7 +22120,7 @@ const cacheKey = KEY.radarPoints;
|
|
|
21908
22120
|
* @private
|
|
21909
22121
|
*/
|
|
21910
22122
|
radarCircleY: function radarCircleY(d) {
|
|
21911
|
-
return this.cache.get(
|
|
22123
|
+
return this.cache.get(cacheKeyPoints)[d.id][d.index][1];
|
|
21912
22124
|
}
|
|
21913
22125
|
});
|
|
21914
22126
|
// EXTERNAL MODULE: external {"commonjs":"d3-hierarchy","commonjs2":"d3-hierarchy","amd":"d3-hierarchy","root":"d3"}
|
|
@@ -23829,7 +24041,8 @@ function setSelection(isSelection, ids, indices, resetOther) {
|
|
|
23829
24041
|
* // Get the current subchart selection domain range
|
|
23830
24042
|
* // Domain value may not be exact returning approximately values.
|
|
23831
24043
|
* chart.subchart();
|
|
23832
|
-
*/
|
|
24044
|
+
*/
|
|
24045
|
+
// NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
|
|
23833
24046
|
const subchart = function (domainValue) {
|
|
23834
24047
|
var _this = this;
|
|
23835
24048
|
const $$ = this.internal,
|
|
@@ -23999,18 +24212,17 @@ var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack
|
|
|
23999
24212
|
* // Get the current zoomed domain range
|
|
24000
24213
|
* // Domain value may not be exact returning approximately values.
|
|
24001
24214
|
* chart.zoom();
|
|
24002
|
-
*/
|
|
24215
|
+
*/
|
|
24216
|
+
// NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
|
|
24003
24217
|
const zoom = function (domainValue) {
|
|
24004
24218
|
var _this = this,
|
|
24005
24219
|
_state$domain;
|
|
24006
24220
|
const $$ = this.internal,
|
|
24007
|
-
$el = $$.$el,
|
|
24008
24221
|
axis = $$.axis,
|
|
24009
24222
|
config = $$.config,
|
|
24010
24223
|
org = $$.org,
|
|
24011
24224
|
scale = $$.scale,
|
|
24012
24225
|
state = $$.state,
|
|
24013
|
-
isRotated = config.axis_rotated,
|
|
24014
24226
|
isCategorized = axis.isCategorized();
|
|
24015
24227
|
let domain;
|
|
24016
24228
|
if (config.zoom_enabled) {
|
|
@@ -24025,12 +24237,7 @@ const zoom = function (domainValue) {
|
|
|
24025
24237
|
const isWithinRange = $$.withinRange(domain, $$.getZoomDomain("zoom", !0), $$.getZoomDomain("zoom"));
|
|
24026
24238
|
if (isWithinRange) {
|
|
24027
24239
|
state.domain = domain;
|
|
24028
|
-
|
|
24029
|
-
domain = domain.map(function (v, i) {
|
|
24030
|
-
_newArrowCheck(this, _this);
|
|
24031
|
-
return +v + (i === 0 ? 0 : 1);
|
|
24032
|
-
}.bind(this));
|
|
24033
|
-
}
|
|
24240
|
+
domain = $$.getZoomDomainValue(domain);
|
|
24034
24241
|
|
|
24035
24242
|
// hide any possible tooltip show before the zoom
|
|
24036
24243
|
$$.api.tooltip.hide();
|
|
@@ -24039,13 +24246,9 @@ const zoom = function (domainValue) {
|
|
|
24039
24246
|
$$.brush.getSelection().call($$.brush.move, domain.map(x));
|
|
24040
24247
|
// resultDomain = domain;
|
|
24041
24248
|
} else {
|
|
24042
|
-
var _d3ZoomIdentity$scale;
|
|
24043
24249
|
// in case of 'config.zoom_rescale=true', use org.xScale
|
|
24044
|
-
const x = isCategorized ? scale.x.orgScale() : org.xScale || scale.x
|
|
24045
|
-
|
|
24046
|
-
transform = (_d3ZoomIdentity$scale = external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity.scale(x.range()[1] / (x(domain[1]) - x(domain[0])))).translate.apply(_d3ZoomIdentity$scale, isRotated ? translate.reverse() : translate); // Get transform from given domain value
|
|
24047
|
-
// https://github.com/d3/d3-zoom/issues/57#issuecomment-246434951
|
|
24048
|
-
$el.eventRect.call($$.zoom.transform, transform);
|
|
24250
|
+
const x = isCategorized ? scale.x.orgScale() : org.xScale || scale.x;
|
|
24251
|
+
$$.updateCurrentZoomTransform(x, domain);
|
|
24049
24252
|
}
|
|
24050
24253
|
$$.setZoomResetButton();
|
|
24051
24254
|
}
|
|
@@ -24177,8 +24380,9 @@ extend(zoom, {
|
|
|
24177
24380
|
_$$$$el = $$.$el,
|
|
24178
24381
|
eventRect = _$$$$el.eventRect,
|
|
24179
24382
|
zoomResetBtn = _$$$$el.zoomResetBtn,
|
|
24383
|
+
zoom = $$.scale.zoom,
|
|
24180
24384
|
state = $$.state;
|
|
24181
|
-
if (
|
|
24385
|
+
if (zoom) {
|
|
24182
24386
|
config.subchart_show ? $$.brush.getSelection().call($$.brush.move, null) : $$.zoom.updateTransformScale(external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity);
|
|
24183
24387
|
$$.updateZoom(!0);
|
|
24184
24388
|
zoomResetBtn == null || zoomResetBtn.style("display", "none");
|
|
@@ -24940,6 +25144,9 @@ function selection_objectSpread(e) { for (var r = 1, t; r < arguments.length; r+
|
|
|
24940
25144
|
// copy current initial x scale in case of rescale option is used
|
|
24941
25145
|
org.xScale || (org.xScale = scale.x.copy());
|
|
24942
25146
|
scale.x.domain(domain);
|
|
25147
|
+
} else if (org.xScale) {
|
|
25148
|
+
scale.x.domain(org.xScale.domain());
|
|
25149
|
+
org.xScale = null;
|
|
24943
25150
|
}
|
|
24944
25151
|
}.bind(this);
|
|
24945
25152
|
|
|
@@ -25077,6 +25284,26 @@ function selection_objectSpread(e) { for (var r = 1, t; r < arguments.length; r+
|
|
|
25077
25284
|
}
|
|
25078
25285
|
}
|
|
25079
25286
|
},
|
|
25287
|
+
/**
|
|
25288
|
+
* Set zoom transform to event rect
|
|
25289
|
+
* @param {Function} x x Axis scale function
|
|
25290
|
+
* @param {Array} domain Domain value to be set
|
|
25291
|
+
* @private
|
|
25292
|
+
*/
|
|
25293
|
+
updateCurrentZoomTransform: function updateCurrentZoomTransform(x, domain) {
|
|
25294
|
+
var _d3ZoomIdentity$scale;
|
|
25295
|
+
const $$ = this,
|
|
25296
|
+
eventRect = $$.$el.eventRect,
|
|
25297
|
+
config = $$.config,
|
|
25298
|
+
isRotated = config.axis_rotated,
|
|
25299
|
+
translate = [-x(domain[0]), 0],
|
|
25300
|
+
transform = (_d3ZoomIdentity$scale = external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity.scale(x.range()[1] / (x(domain[1]) - x(domain[0])))).translate.apply(_d3ZoomIdentity$scale, isRotated ? translate.reverse() : translate);
|
|
25301
|
+
|
|
25302
|
+
// Get transform from given domain value
|
|
25303
|
+
// https://github.com/d3/d3-zoom/issues/57#issuecomment-246434951
|
|
25304
|
+
|
|
25305
|
+
eventRect.call($$.zoom.transform, transform);
|
|
25306
|
+
},
|
|
25080
25307
|
/**
|
|
25081
25308
|
* Attach zoom event on <rect>
|
|
25082
25309
|
* @private
|
|
@@ -25545,7 +25772,7 @@ let _defaults = {};
|
|
|
25545
25772
|
|
|
25546
25773
|
/**
|
|
25547
25774
|
* @namespace bb
|
|
25548
|
-
* @version 3.
|
|
25775
|
+
* @version 3.11.0-next.1
|
|
25549
25776
|
*/
|
|
25550
25777
|
const bb = {
|
|
25551
25778
|
/**
|
|
@@ -25555,7 +25782,7 @@ const bb = {
|
|
|
25555
25782
|
* bb.version; // "1.0.0"
|
|
25556
25783
|
* @memberof bb
|
|
25557
25784
|
*/
|
|
25558
|
-
version: "3.
|
|
25785
|
+
version: "3.11.0-next.1",
|
|
25559
25786
|
/**
|
|
25560
25787
|
* Generate chart
|
|
25561
25788
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|