billboard.js 3.7.0-next.1 → 3.7.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billboard.css +6 -1
- package/dist/billboard.js +1269 -767
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +2300 -1131
- package/dist/billboard.pkgd.min.js +6 -5
- 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 +29 -22
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +30 -23
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +15 -13
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +15 -13
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +264 -162
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +315 -242
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +367 -300
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +303 -235
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +509 -449
- package/dist/theme/datalab.css +6 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +6 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +6 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +634 -241
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -5
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +10 -9
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +12 -11
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +4 -8
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -5
- package/package.json +26 -25
- package/src/Chart/api/legend.ts +1 -0
- package/src/Chart/api/load.ts +1 -0
- package/src/Chart/api/selection.ts +54 -56
- package/src/Chart/api/tooltip.ts +11 -2
- package/src/ChartInternal/ChartInternal.ts +35 -25
- package/src/ChartInternal/data/IData.ts +8 -0
- package/src/ChartInternal/data/convert.helper.ts +35 -21
- package/src/ChartInternal/data/data.ts +5 -3
- package/src/ChartInternal/data/load.ts +3 -0
- package/src/ChartInternal/interactions/interaction.ts +44 -36
- package/src/ChartInternal/internals/class.ts +3 -4
- package/src/ChartInternal/internals/clip.ts +13 -10
- package/src/ChartInternal/internals/legend.ts +3 -2
- package/src/ChartInternal/internals/redraw.ts +12 -5
- package/src/ChartInternal/internals/scale.ts +7 -2
- package/src/ChartInternal/internals/selection.ts +8 -8
- package/src/ChartInternal/internals/size.ts +41 -26
- package/src/ChartInternal/internals/text.ts +60 -32
- package/src/ChartInternal/internals/tooltip.ts +12 -8
- package/src/ChartInternal/internals/transform.ts +2 -2
- package/src/ChartInternal/internals/type.ts +6 -1
- package/src/ChartInternal/shape/bar.ts +1 -1
- package/src/ChartInternal/shape/radar.ts +2 -2
- package/src/ChartInternal/shape/shape.ts +10 -5
- package/src/ChartInternal/shape/treemap.ts +293 -0
- package/src/Plugin/stanford/ColorScale.ts +2 -2
- package/src/config/Options/data/data.ts +6 -3
- package/src/config/Options/shape/arc.ts +1 -1
- package/src/config/Options/shape/pie.ts +1 -1
- package/src/config/Options/shape/polar.ts +1 -1
- package/src/config/Options/shape/radar.ts +1 -1
- package/src/config/Options/shape/spline.ts +1 -1
- package/src/config/Options/shape/treemap.ts +53 -0
- package/src/config/Store/State.ts +1 -0
- package/src/config/classes.ts +7 -0
- package/src/config/const.ts +4 -2
- package/src/config/resolver/shape.ts +9 -1
- package/src/index.esm.ts +2 -1
- package/src/scss/billboard.scss +6 -0
- package/src/scss/theme/datalab.scss +6 -0
- package/src/scss/theme/graph.scss +6 -0
- package/src/scss/theme/insight.scss +6 -0
- package/types/bb.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/options.d.ts +4 -1
- package/types/options.shape.d.ts +31 -0
- package/types/types.d.ts +2 -1
package/dist/billboard.js
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.7.0-next.
|
|
8
|
+
* @version 3.7.0-next.3
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
12
|
-
module.exports = factory(require("d3-axis"), require("d3-brush"), require("d3-drag"), require("d3-dsv"), require("d3-ease"), require("d3-interpolate"), require("d3-scale"), require("d3-selection"), require("d3-shape"), require("d3-time-format"), require("d3-transition"), require("d3-zoom"));
|
|
12
|
+
module.exports = factory(require("d3-axis"), require("d3-brush"), require("d3-drag"), require("d3-dsv"), require("d3-ease"), require("d3-hierarchy"), require("d3-interpolate"), require("d3-scale"), require("d3-selection"), require("d3-shape"), require("d3-time-format"), require("d3-transition"), require("d3-zoom"));
|
|
13
13
|
else if(typeof define === 'function' && define.amd)
|
|
14
|
-
define(["d3-axis", "d3-brush", "d3-drag", "d3-dsv", "d3-ease", "d3-interpolate", "d3-scale", "d3-selection", "d3-shape", "d3-time-format", "d3-transition", "d3-zoom"], factory);
|
|
14
|
+
define(["d3-axis", "d3-brush", "d3-drag", "d3-dsv", "d3-ease", "d3-hierarchy", "d3-interpolate", "d3-scale", "d3-selection", "d3-shape", "d3-time-format", "d3-transition", "d3-zoom"], factory);
|
|
15
15
|
else {
|
|
16
|
-
var a = typeof exports === 'object' ? factory(require("d3-axis"), require("d3-brush"), require("d3-drag"), require("d3-dsv"), require("d3-ease"), require("d3-interpolate"), require("d3-scale"), require("d3-selection"), require("d3-shape"), require("d3-time-format"), require("d3-transition"), require("d3-zoom")) : factory(root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"]);
|
|
16
|
+
var a = typeof exports === 'object' ? factory(require("d3-axis"), require("d3-brush"), require("d3-drag"), require("d3-dsv"), require("d3-ease"), require("d3-hierarchy"), require("d3-interpolate"), require("d3-scale"), require("d3-selection"), require("d3-shape"), require("d3-time-format"), require("d3-transition"), require("d3-zoom")) : factory(root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"]);
|
|
17
17
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
18
18
|
}
|
|
19
|
-
})(this, function(__WEBPACK_EXTERNAL_MODULE__10__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__5__, __WEBPACK_EXTERNAL_MODULE__11__, __WEBPACK_EXTERNAL_MODULE__12__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__9__, __WEBPACK_EXTERNAL_MODULE__4__, __WEBPACK_EXTERNAL_MODULE__8__,
|
|
19
|
+
})(this, function(__WEBPACK_EXTERNAL_MODULE__10__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__5__, __WEBPACK_EXTERNAL_MODULE__11__, __WEBPACK_EXTERNAL_MODULE__13__, __WEBPACK_EXTERNAL_MODULE__12__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__9__, __WEBPACK_EXTERNAL_MODULE__4__, __WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__14__) {
|
|
20
20
|
return /******/ (function() { // webpackBootstrap
|
|
21
21
|
/******/ "use strict";
|
|
22
22
|
/******/ var __webpack_modules__ = ([
|
|
@@ -93,6 +93,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
|
|
|
93
93
|
|
|
94
94
|
module.exports = __WEBPACK_EXTERNAL_MODULE__13__;
|
|
95
95
|
|
|
96
|
+
/***/ }),
|
|
97
|
+
/* 14 */
|
|
98
|
+
/***/ (function(module) {
|
|
99
|
+
|
|
100
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__14__;
|
|
101
|
+
|
|
96
102
|
/***/ })
|
|
97
103
|
/******/ ]);
|
|
98
104
|
/************************************************************************/
|
|
@@ -187,7 +193,8 @@ __webpack_require__.d(resolver_shape_namespaceObject, {
|
|
|
187
193
|
"radar": function() { return resolver_shape_radar; },
|
|
188
194
|
"scatter": function() { return shape_scatter; },
|
|
189
195
|
"spline": function() { return shape_spline; },
|
|
190
|
-
"step": function() { return step; }
|
|
196
|
+
"step": function() { return step; },
|
|
197
|
+
"treemap": function() { return resolver_shape_treemap; }
|
|
191
198
|
});
|
|
192
199
|
|
|
193
200
|
// NAMESPACE OBJECT: ./src/config/resolver/interaction.ts
|
|
@@ -266,7 +273,8 @@ var TYPE = {
|
|
|
266
273
|
RADAR: "radar",
|
|
267
274
|
SCATTER: "scatter",
|
|
268
275
|
SPLINE: "spline",
|
|
269
|
-
STEP: "step"
|
|
276
|
+
STEP: "step",
|
|
277
|
+
TREEMAP: "treemap"
|
|
270
278
|
};
|
|
271
279
|
|
|
272
280
|
/**
|
|
@@ -290,7 +298,8 @@ var TYPE_METHOD_NEEDED = {
|
|
|
290
298
|
RADAR: "initCircle",
|
|
291
299
|
SCATTER: "initCircle",
|
|
292
300
|
SPLINE: "initLine",
|
|
293
|
-
STEP: "initLine"
|
|
301
|
+
STEP: "initLine",
|
|
302
|
+
TREEMAP: "initTreemap"
|
|
294
303
|
};
|
|
295
304
|
|
|
296
305
|
/**
|
|
@@ -466,7 +475,8 @@ function hasValue(dict, value) {
|
|
|
466
475
|
* @private
|
|
467
476
|
*/
|
|
468
477
|
function callFn(fn, thisArg) {
|
|
469
|
-
|
|
478
|
+
var isFn = isFunction(fn);
|
|
479
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
470
480
|
args[_key - 2] = arguments[_key];
|
|
471
481
|
}
|
|
472
482
|
isFn && fn.call.apply(fn, [thisArg].concat(args));
|
|
@@ -638,8 +648,9 @@ function getPointer(event, element) {
|
|
|
638
648
|
function getBrushSelection(ctx) {
|
|
639
649
|
var event = ctx.event,
|
|
640
650
|
$el = ctx.$el,
|
|
641
|
-
main = $el.subchart.main || $el.main
|
|
642
|
-
|
|
651
|
+
main = $el.subchart.main || $el.main;
|
|
652
|
+
var selection;
|
|
653
|
+
|
|
643
654
|
// check from event
|
|
644
655
|
if (event && event.type === "brush") {
|
|
645
656
|
selection = event.selection;
|
|
@@ -698,8 +709,8 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
698
709
|
if (start > end) {
|
|
699
710
|
return -1;
|
|
700
711
|
}
|
|
701
|
-
var mid = Math.floor((start + end) / 2)
|
|
702
|
-
|
|
712
|
+
var mid = Math.floor((start + end) / 2);
|
|
713
|
+
var _arr$mid = arr[mid],
|
|
703
714
|
x = _arr$mid.x,
|
|
704
715
|
_arr$mid$w = _arr$mid.w,
|
|
705
716
|
w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
|
@@ -737,12 +748,12 @@ function brushEmpty(ctx) {
|
|
|
737
748
|
* @private
|
|
738
749
|
*/
|
|
739
750
|
function deepClone() {
|
|
740
|
-
for (var _this6 = this,
|
|
751
|
+
for (var _this6 = this, _clone = function clone(v) {
|
|
741
752
|
_newArrowCheck(this, _this6);
|
|
742
753
|
if (isObject(v) && v.constructor) {
|
|
743
754
|
var r = new v.constructor();
|
|
744
755
|
for (var k in v) {
|
|
745
|
-
r[k] =
|
|
756
|
+
r[k] = _clone(v[k]);
|
|
746
757
|
}
|
|
747
758
|
return r;
|
|
748
759
|
}
|
|
@@ -752,7 +763,7 @@ function deepClone() {
|
|
|
752
763
|
}
|
|
753
764
|
return objectN.map(function (v) {
|
|
754
765
|
_newArrowCheck(this, _this6);
|
|
755
|
-
return
|
|
766
|
+
return _clone(v);
|
|
756
767
|
}.bind(this)).reduce(function (a, c) {
|
|
757
768
|
_newArrowCheck(this, _this6);
|
|
758
769
|
return _objectSpread(_objectSpread({}, a), c);
|
|
@@ -1230,8 +1241,8 @@ function runUntil(fn, conditionFn) {
|
|
|
1230
1241
|
*/
|
|
1231
1242
|
function checkModuleImport(ctx) {
|
|
1232
1243
|
var $$ = ctx,
|
|
1233
|
-
config = $$.config
|
|
1234
|
-
|
|
1244
|
+
config = $$.config;
|
|
1245
|
+
var type = "";
|
|
1235
1246
|
if (isEmpty(config.data_type || config.data_types) && !$$[TYPE_METHOD_NEEDED.LINE]) {
|
|
1236
1247
|
type = "line";
|
|
1237
1248
|
} else {
|
|
@@ -1416,11 +1427,16 @@ var $TOOLTIP = {
|
|
|
1416
1427
|
tooltipContainer: "bb-tooltip-container",
|
|
1417
1428
|
tooltipName: "bb-tooltip-name"
|
|
1418
1429
|
};
|
|
1430
|
+
var $TREEMAP = {
|
|
1431
|
+
treemap: "bb-treemap",
|
|
1432
|
+
chartTreemap: "bb-chart-treemap",
|
|
1433
|
+
chartTreemaps: "bb-chart-treemaps"
|
|
1434
|
+
};
|
|
1419
1435
|
var $ZOOM = {
|
|
1420
1436
|
buttonZoomReset: "bb-zoom-reset",
|
|
1421
1437
|
zoomBrush: "bb-zoom-brush"
|
|
1422
1438
|
};
|
|
1423
|
-
/* harmony default export */ var classes = (classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $ZOOM));
|
|
1439
|
+
/* harmony default export */ var classes = (classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread(classes_objectSpread({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $TREEMAP), $ZOOM));
|
|
1424
1440
|
;// CONCATENATED MODULE: ./src/config/Store/Element.ts
|
|
1425
1441
|
/**
|
|
1426
1442
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -1539,6 +1555,7 @@ var State = function () {
|
|
|
1539
1555
|
xAxisHeight: 0,
|
|
1540
1556
|
hasAxis: !1,
|
|
1541
1557
|
hasRadar: !1,
|
|
1558
|
+
hasTreemap: !1,
|
|
1542
1559
|
// for data CSS rule index (used when boost.useCssRule is true)
|
|
1543
1560
|
cssRule: {},
|
|
1544
1561
|
current: {
|
|
@@ -2204,6 +2221,7 @@ var data_this = undefined;
|
|
|
2204
2221
|
* - scatter
|
|
2205
2222
|
* - spline
|
|
2206
2223
|
* - step
|
|
2224
|
+
* - treemap
|
|
2207
2225
|
* @name data․type
|
|
2208
2226
|
* @memberof Options
|
|
2209
2227
|
* @type {string}
|
|
@@ -2232,7 +2250,8 @@ var data_this = undefined;
|
|
|
2232
2250
|
* radar,
|
|
2233
2251
|
* scatter,
|
|
2234
2252
|
* spline,
|
|
2235
|
-
* step
|
|
2253
|
+
* step,
|
|
2254
|
+
* treemap
|
|
2236
2255
|
* }
|
|
2237
2256
|
*
|
|
2238
2257
|
* bb.generate({
|
|
@@ -2246,7 +2265,7 @@ var data_this = undefined;
|
|
|
2246
2265
|
/**
|
|
2247
2266
|
* Set chart type for each data.<br>
|
|
2248
2267
|
* This setting overwrites data.type setting.
|
|
2249
|
-
* - **NOTE:** `radar` type can't be combined with other types.
|
|
2268
|
+
* - **NOTE:** `radar` and `treemap` type can't be combined with other types.
|
|
2250
2269
|
* @name data․types
|
|
2251
2270
|
* @memberof Options
|
|
2252
2271
|
* @type {object}
|
|
@@ -2278,7 +2297,8 @@ var data_this = undefined;
|
|
|
2278
2297
|
* radar,
|
|
2279
2298
|
* scatter,
|
|
2280
2299
|
* spline,
|
|
2281
|
-
* step
|
|
2300
|
+
* step,
|
|
2301
|
+
* treemap
|
|
2282
2302
|
* }
|
|
2283
2303
|
*
|
|
2284
2304
|
* bb.generate({
|
|
@@ -3723,40 +3743,42 @@ function generateResize(option) {
|
|
|
3723
3743
|
* @private
|
|
3724
3744
|
*/
|
|
3725
3745
|
function generateWait() {
|
|
3726
|
-
var transitionsToWait = []
|
|
3727
|
-
f = function (selection, callback) {
|
|
3728
|
-
var _this5 = this;
|
|
3729
|
-
/**
|
|
3730
|
-
* Check if transition is complete
|
|
3731
|
-
* @returns {boolean} Whether transition is complete
|
|
3732
|
-
* @private
|
|
3733
|
-
*/
|
|
3734
|
-
function loop() {
|
|
3735
|
-
var done = 0;
|
|
3736
|
-
for (var i = 0, t; t = transitionsToWait[i]; i++) {
|
|
3737
|
-
if (t === !0 || t.empty != null && t.empty()) {
|
|
3738
|
-
done++;
|
|
3739
|
-
continue;
|
|
3740
|
-
}
|
|
3746
|
+
var transitionsToWait = [];
|
|
3741
3747
|
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3748
|
+
// 'f' is called as selection.call(f, ...);
|
|
3749
|
+
var f = function (selection, callback) {
|
|
3750
|
+
var _this5 = this;
|
|
3751
|
+
/**
|
|
3752
|
+
* Check if transition is complete
|
|
3753
|
+
* @returns {boolean} Whether transition is complete
|
|
3754
|
+
* @private
|
|
3755
|
+
*/
|
|
3756
|
+
function loop() {
|
|
3757
|
+
var done = 0;
|
|
3758
|
+
for (var i = 0, t; t = transitionsToWait[i]; i++) {
|
|
3759
|
+
if (t === !0 || t.empty != null && t.empty()) {
|
|
3760
|
+
done++;
|
|
3761
|
+
continue;
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3764
|
+
// when tab isn't visible exit loop
|
|
3765
|
+
if (isTabVisible() === !1) {
|
|
3766
|
+
done = transitionsToWait.length;
|
|
3767
|
+
break;
|
|
3768
|
+
}
|
|
3769
|
+
try {
|
|
3770
|
+
t.transition();
|
|
3771
|
+
} catch (e) {
|
|
3772
|
+
done++;
|
|
3752
3773
|
}
|
|
3753
|
-
return done === transitionsToWait.length;
|
|
3754
3774
|
}
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3775
|
+
return done === transitionsToWait.length;
|
|
3776
|
+
}
|
|
3777
|
+
runUntil(function () {
|
|
3778
|
+
_newArrowCheck(this, _this5);
|
|
3779
|
+
callback == null ? void 0 : callback();
|
|
3780
|
+
}.bind(this), loop);
|
|
3781
|
+
};
|
|
3760
3782
|
f.add = function (t) {
|
|
3761
3783
|
isArray(t) ? transitionsToWait = transitionsToWait.concat(t) : transitionsToWait.push(t);
|
|
3762
3784
|
};
|
|
@@ -3929,22 +3951,22 @@ function rows(rows) {
|
|
|
3929
3951
|
* @private
|
|
3930
3952
|
*/
|
|
3931
3953
|
function json(json, keysParam) {
|
|
3932
|
-
var newRows = []
|
|
3933
|
-
|
|
3954
|
+
var newRows = [];
|
|
3955
|
+
var targetKeys, data;
|
|
3956
|
+
if (Array.isArray(json)) {
|
|
3957
|
+
var findValueInJson = function (object, path) {
|
|
3934
3958
|
if (object[path] !== undefined) {
|
|
3935
3959
|
return object[path];
|
|
3936
3960
|
}
|
|
3937
3961
|
var convertedPath = path.replace(/\[(\w+)\]/g, ".$1"),
|
|
3938
|
-
pathArray = convertedPath.replace(/^\./, "").split(".")
|
|
3939
|
-
|
|
3962
|
+
pathArray = convertedPath.replace(/^\./, "").split("."); // convert indexes to properties (replace [] with .)
|
|
3963
|
+
// strip a leading dot
|
|
3964
|
+
var target = object;
|
|
3940
3965
|
pathArray.some(function (k) {
|
|
3941
3966
|
return !(target = target && k in target ? target[k] : undefined);
|
|
3942
3967
|
});
|
|
3943
3968
|
return target;
|
|
3944
|
-
}
|
|
3945
|
-
targetKeys,
|
|
3946
|
-
data;
|
|
3947
|
-
if (Array.isArray(json)) {
|
|
3969
|
+
};
|
|
3948
3970
|
if (keysParam.x) {
|
|
3949
3971
|
targetKeys = keysParam.value.concat(keysParam.x);
|
|
3950
3972
|
} else {
|
|
@@ -3966,13 +3988,25 @@ function json(json, keysParam) {
|
|
|
3966
3988
|
} else {
|
|
3967
3989
|
Object.keys(json).forEach(function (key) {
|
|
3968
3990
|
var tmp = json[key].concat();
|
|
3969
|
-
tmp.unshift(key);
|
|
3991
|
+
tmp.unshift == null ? void 0 : tmp.unshift(key);
|
|
3970
3992
|
newRows.push(tmp);
|
|
3971
3993
|
});
|
|
3972
3994
|
data = columns(newRows);
|
|
3973
3995
|
}
|
|
3974
3996
|
return data;
|
|
3975
3997
|
}
|
|
3998
|
+
function jsonTreemap(json) {
|
|
3999
|
+
var _this = this,
|
|
4000
|
+
_convertKey = function convertKey(v) {
|
|
4001
|
+
_newArrowCheck(this, _this);
|
|
4002
|
+
if (v.children) {
|
|
4003
|
+
v.children.forEach(_convertKey);
|
|
4004
|
+
}
|
|
4005
|
+
v.name = v.id;
|
|
4006
|
+
}.bind(this);
|
|
4007
|
+
json.forEach(_convertKey);
|
|
4008
|
+
return json;
|
|
4009
|
+
}
|
|
3976
4010
|
|
|
3977
4011
|
/***** Functions can't be executed on Web Worker *****/
|
|
3978
4012
|
/**
|
|
@@ -4021,13 +4055,13 @@ function url(url, mimeType, headers, keys, done) {
|
|
|
4021
4055
|
* @private
|
|
4022
4056
|
*/
|
|
4023
4057
|
function convertCsvTsvToData(parser, xsv) {
|
|
4024
|
-
var
|
|
4058
|
+
var _this2 = this,
|
|
4025
4059
|
rows = parser.rows(xsv),
|
|
4026
4060
|
d;
|
|
4027
4061
|
if (rows.length === 1) {
|
|
4028
4062
|
d = [{}];
|
|
4029
4063
|
rows[0].forEach(function (id) {
|
|
4030
|
-
_newArrowCheck(this,
|
|
4064
|
+
_newArrowCheck(this, _this2);
|
|
4031
4065
|
d[0][id] = null;
|
|
4032
4066
|
}.bind(this));
|
|
4033
4067
|
} else {
|
|
@@ -4126,8 +4160,9 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4126
4160
|
}
|
|
4127
4161
|
var dataKeys = Object.keys(data[0] || {}),
|
|
4128
4162
|
ids = dataKeys.length ? dataKeys.filter($$.isNotX, $$) : [],
|
|
4129
|
-
xs = dataKeys.length ? dataKeys.filter($$.isX, $$) : []
|
|
4130
|
-
|
|
4163
|
+
xs = dataKeys.length ? dataKeys.filter($$.isX, $$) : [];
|
|
4164
|
+
var xsData;
|
|
4165
|
+
|
|
4131
4166
|
// save x for update data by load when custom x and bb.x API
|
|
4132
4167
|
ids.forEach(function (id) {
|
|
4133
4168
|
var _this3 = this;
|
|
@@ -4189,8 +4224,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4189
4224
|
id_org: id,
|
|
4190
4225
|
values: data.map(function (d, i) {
|
|
4191
4226
|
_newArrowCheck(this, _this4);
|
|
4192
|
-
var rawX = d[xKey]
|
|
4193
|
-
|
|
4227
|
+
var rawX = d[xKey];
|
|
4228
|
+
var value = d[id],
|
|
4194
4229
|
x;
|
|
4195
4230
|
value = value !== null && !isNaN(value) && !isObject(value) ? +value : isArray(value) || isObject(value) ? value : null;
|
|
4196
4231
|
|
|
@@ -4363,8 +4398,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4363
4398
|
},
|
|
4364
4399
|
addName: function addName(data) {
|
|
4365
4400
|
var $$ = this,
|
|
4366
|
-
config = $$.config
|
|
4367
|
-
|
|
4401
|
+
config = $$.config;
|
|
4402
|
+
var name;
|
|
4368
4403
|
if (data) {
|
|
4369
4404
|
name = config.data_names[data.id];
|
|
4370
4405
|
data.name = name !== undefined ? name : data.id;
|
|
@@ -4383,11 +4418,11 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4383
4418
|
if (filterNull === void 0) {
|
|
4384
4419
|
filterNull = !1;
|
|
4385
4420
|
}
|
|
4386
|
-
var $$ = this
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4421
|
+
var $$ = this;
|
|
4422
|
+
var value = $$.filterTargetsToShow($$.data.targets).map(function (t) {
|
|
4423
|
+
_newArrowCheck(this, _this4);
|
|
4424
|
+
return $$.addName($$.getValueOnIndex(t.values, index));
|
|
4425
|
+
}.bind(this));
|
|
4391
4426
|
if (filterNull) {
|
|
4392
4427
|
value = value.filter(function (v) {
|
|
4393
4428
|
_newArrowCheck(this, _this4);
|
|
@@ -4427,8 +4462,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4427
4462
|
},
|
|
4428
4463
|
generateTargetX: function generateTargetX(rawX, id, index) {
|
|
4429
4464
|
var $$ = this,
|
|
4430
|
-
axis = $$.axis
|
|
4431
|
-
|
|
4465
|
+
axis = $$.axis;
|
|
4466
|
+
var x = axis != null && axis.isCategorized() ? index : rawX || index;
|
|
4432
4467
|
if (axis != null && axis.isTimeSeries()) {
|
|
4433
4468
|
var fn = parseDate.bind($$);
|
|
4434
4469
|
x = rawX ? fn(rawX) : fn($$.getXValue(id, index));
|
|
@@ -4462,8 +4497,9 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4462
4497
|
*/
|
|
4463
4498
|
getBaseValue: function getBaseValue(data) {
|
|
4464
4499
|
var $$ = this,
|
|
4465
|
-
hasAxis = $$.state.hasAxis
|
|
4466
|
-
|
|
4500
|
+
hasAxis = $$.state.hasAxis;
|
|
4501
|
+
var value = data.value;
|
|
4502
|
+
|
|
4467
4503
|
// In case of area-range, data is given as: [low, mid, high] or {low, mid, high}
|
|
4468
4504
|
// will take the 'mid' as the base value
|
|
4469
4505
|
if (value && hasAxis) {
|
|
@@ -4515,25 +4551,25 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4515
4551
|
_newArrowCheck(this, _this11);
|
|
4516
4552
|
return t.values;
|
|
4517
4553
|
}.bind(this)),
|
|
4518
|
-
minMax = $$.getMinMaxValue(data)
|
|
4519
|
-
|
|
4520
|
-
|
|
4554
|
+
minMax = $$.getMinMaxValue(data);
|
|
4555
|
+
var min = [],
|
|
4556
|
+
max = [];
|
|
4521
4557
|
data.forEach(function (v) {
|
|
4522
4558
|
_newArrowCheck(this, _this11);
|
|
4523
4559
|
var minData = $$.getFilteredDataByValue(v, minMax.min),
|
|
4524
4560
|
maxData = $$.getFilteredDataByValue(v, minMax.max);
|
|
4525
4561
|
if (minData.length) {
|
|
4526
|
-
|
|
4562
|
+
min = min.concat(minData);
|
|
4527
4563
|
}
|
|
4528
4564
|
if (maxData.length) {
|
|
4529
|
-
|
|
4565
|
+
max = max.concat(maxData);
|
|
4530
4566
|
}
|
|
4531
4567
|
}.bind(this));
|
|
4532
4568
|
|
|
4533
4569
|
// update the cached data
|
|
4534
4570
|
$$.cache.add(cacheKey, minMaxData = {
|
|
4535
|
-
min:
|
|
4536
|
-
max:
|
|
4571
|
+
min: min,
|
|
4572
|
+
max: max
|
|
4537
4573
|
});
|
|
4538
4574
|
}
|
|
4539
4575
|
return minMaxData;
|
|
@@ -4576,7 +4612,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4576
4612
|
cacheKey = KEY.dataTotalSum,
|
|
4577
4613
|
total = $$.cache.get(cacheKey);
|
|
4578
4614
|
if (!isNumber(total)) {
|
|
4579
|
-
var
|
|
4615
|
+
var sum = mergeArray($$.data.targets.map(function (t) {
|
|
4580
4616
|
_newArrowCheck(this, _this14);
|
|
4581
4617
|
return t.values;
|
|
4582
4618
|
}.bind(this))).map(function (v) {
|
|
@@ -4586,7 +4622,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4586
4622
|
_newArrowCheck(this, _this14);
|
|
4587
4623
|
return p + c;
|
|
4588
4624
|
}.bind(this));
|
|
4589
|
-
$$.cache.add(cacheKey, total =
|
|
4625
|
+
$$.cache.add(cacheKey, total = sum);
|
|
4590
4626
|
}
|
|
4591
4627
|
if (subtractHidden) {
|
|
4592
4628
|
total -= $$.getHiddenTotalDataSum();
|
|
@@ -4808,8 +4844,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4808
4844
|
return ys;
|
|
4809
4845
|
},
|
|
4810
4846
|
checkValueInTargets: function checkValueInTargets(targets, checker) {
|
|
4811
|
-
var ids = Object.keys(targets)
|
|
4812
|
-
|
|
4847
|
+
var ids = Object.keys(targets);
|
|
4848
|
+
var values;
|
|
4813
4849
|
for (var i = 0; i < ids.length; i++) {
|
|
4814
4850
|
values = targets[ids[i]].values;
|
|
4815
4851
|
for (var j = 0; j < values.length; j++) {
|
|
@@ -4853,21 +4889,21 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4853
4889
|
},
|
|
4854
4890
|
/**
|
|
4855
4891
|
* Get data.order compare function
|
|
4856
|
-
* @param {boolean}
|
|
4892
|
+
* @param {boolean} isReversed for Arc & Treemap type sort order needs to be reversed
|
|
4857
4893
|
* @returns {Function} compare function
|
|
4858
4894
|
* @private
|
|
4859
4895
|
*/
|
|
4860
|
-
getSortCompareFn: function getSortCompareFn(
|
|
4896
|
+
getSortCompareFn: function getSortCompareFn(isReversed) {
|
|
4861
4897
|
var _this29 = this;
|
|
4862
|
-
if (
|
|
4863
|
-
|
|
4898
|
+
if (isReversed === void 0) {
|
|
4899
|
+
isReversed = !1;
|
|
4864
4900
|
}
|
|
4865
4901
|
var $$ = this,
|
|
4866
4902
|
config = $$.config,
|
|
4867
4903
|
order = config.data_order,
|
|
4868
4904
|
orderAsc = /asc/i.test(order),
|
|
4869
|
-
orderDesc = /desc/i.test(order)
|
|
4870
|
-
|
|
4905
|
+
orderDesc = /desc/i.test(order);
|
|
4906
|
+
var fn;
|
|
4871
4907
|
if (orderAsc || orderDesc) {
|
|
4872
4908
|
var reducer = function (p, c) {
|
|
4873
4909
|
_newArrowCheck(this, _this29);
|
|
@@ -4877,7 +4913,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4877
4913
|
_newArrowCheck(this, _this29);
|
|
4878
4914
|
var t1Sum = "values" in t1 ? t1.values.reduce(reducer, 0) : t1.value,
|
|
4879
4915
|
t2Sum = "values" in t2 ? t2.values.reduce(reducer, 0) : t2.value;
|
|
4880
|
-
return
|
|
4916
|
+
return isReversed ? orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum : orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;
|
|
4881
4917
|
}.bind(this);
|
|
4882
4918
|
} else if (isFunction(order)) {
|
|
4883
4919
|
fn = order.bind($$.api);
|
|
@@ -4958,8 +4994,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4958
4994
|
},
|
|
4959
4995
|
findSameXOfValues: function findSameXOfValues(values, index) {
|
|
4960
4996
|
var targetX = values[index].x,
|
|
4961
|
-
sames = []
|
|
4962
|
-
|
|
4997
|
+
sames = [];
|
|
4998
|
+
var i;
|
|
4963
4999
|
for (i = index - 1; i >= 0; i--) {
|
|
4964
5000
|
if (targetX !== values[i].x) {
|
|
4965
5001
|
break;
|
|
@@ -5054,8 +5090,9 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5054
5090
|
// insert & append cloning first/last value to be fully rendered covering on each gap sides
|
|
5055
5091
|
var head = converted[0],
|
|
5056
5092
|
tail = converted[converted.length - 1],
|
|
5057
|
-
id = head.id
|
|
5058
|
-
|
|
5093
|
+
id = head.id;
|
|
5094
|
+
var x = head.x;
|
|
5095
|
+
|
|
5059
5096
|
// insert head
|
|
5060
5097
|
converted.unshift({
|
|
5061
5098
|
x: --x,
|
|
@@ -5180,8 +5217,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5180
5217
|
var $$ = this,
|
|
5181
5218
|
config = $$.config,
|
|
5182
5219
|
state = $$.state,
|
|
5183
|
-
api = $$.api
|
|
5184
|
-
|
|
5220
|
+
api = $$.api;
|
|
5221
|
+
var ratio = 0;
|
|
5185
5222
|
if (d && api.data.shown().length) {
|
|
5186
5223
|
ratio = d.ratio || d.value;
|
|
5187
5224
|
if (type === "arc") {
|
|
@@ -5196,8 +5233,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5196
5233
|
ratio = (d.endAngle - d.startAngle) / arcLength;
|
|
5197
5234
|
}
|
|
5198
5235
|
} else if (type === "index") {
|
|
5199
|
-
var dataValues = api.data.values.bind(api)
|
|
5200
|
-
|
|
5236
|
+
var dataValues = api.data.values.bind(api);
|
|
5237
|
+
var total = this.getTotalPerIndex();
|
|
5201
5238
|
if (state.hiddenTargetIds.length) {
|
|
5202
5239
|
var hiddenSum = dataValues(state.hiddenTargetIds, !1);
|
|
5203
5240
|
if (hiddenSum.length) {
|
|
@@ -5221,12 +5258,14 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5221
5258
|
ratio = parseFloat(Math.max(d.value, 0) + "") / state.current.dataMax * config.radar_size_ratio;
|
|
5222
5259
|
} else if (type === "bar") {
|
|
5223
5260
|
var yScale = $$.getYScaleById.bind($$)(d.id),
|
|
5224
|
-
|
|
5261
|
+
max = yScale.domain().reduce(function (a, c) {
|
|
5225
5262
|
_newArrowCheck(this, _this40);
|
|
5226
5263
|
return c - a;
|
|
5227
5264
|
}.bind(this));
|
|
5228
5265
|
// when all data are 0, return 0
|
|
5229
|
-
ratio =
|
|
5266
|
+
ratio = max === 0 ? 0 : Math.abs(d.value) / max;
|
|
5267
|
+
} else if (type === "treemap") {
|
|
5268
|
+
ratio /= $$.getTotalDataSum(!0);
|
|
5230
5269
|
}
|
|
5231
5270
|
}
|
|
5232
5271
|
return asPercent && ratio ? ratio * 100 : ratio;
|
|
@@ -5420,6 +5459,9 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5420
5459
|
}.bind(this));
|
|
5421
5460
|
}.bind(this));
|
|
5422
5461
|
|
|
5462
|
+
// since treemap uses different data types, it needs to be transformed
|
|
5463
|
+
state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
|
|
5464
|
+
|
|
5423
5465
|
// Update current state chart type and elements list after redraw
|
|
5424
5466
|
$$.updateTypesElements();
|
|
5425
5467
|
}
|
|
@@ -5442,7 +5484,9 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5442
5484
|
var _this = this,
|
|
5443
5485
|
$$ = this,
|
|
5444
5486
|
config = $$.config,
|
|
5445
|
-
|
|
5487
|
+
_$$$$el = $$.$el,
|
|
5488
|
+
main = _$$$$el.main,
|
|
5489
|
+
circle = _$$$$el.circle,
|
|
5446
5490
|
isSelectionEnabled = config.data_selection_enabled,
|
|
5447
5491
|
isSelectionGrouped = config.data_selection_grouped,
|
|
5448
5492
|
isSelectable = config.data_selection_isselectable,
|
|
@@ -5457,7 +5501,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5457
5501
|
}
|
|
5458
5502
|
|
|
5459
5503
|
// remove possible previous focused state
|
|
5460
|
-
main.selectAll("." + $COMMON.EXPANDED + ":not(." + $SHAPE.shape + "-" + index + ")").classed($COMMON.EXPANDED, !1);
|
|
5504
|
+
circle || main.selectAll("." + $COMMON.EXPANDED + ":not(." + $SHAPE.shape + "-" + index + ")").classed($COMMON.EXPANDED, !1);
|
|
5461
5505
|
var shapeAtIndex = main.selectAll("." + $SHAPE.shape + "-" + index).classed($COMMON.EXPANDED, !0).style("cursor", isSelectable ? "pointer" : null).filter(function (d) {
|
|
5462
5506
|
return $$.isWithinShape(this, d);
|
|
5463
5507
|
});
|
|
@@ -5533,15 +5577,18 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5533
5577
|
var _this5 = this,
|
|
5534
5578
|
$$ = this,
|
|
5535
5579
|
config = $$.config,
|
|
5536
|
-
|
|
5580
|
+
_$$$state = $$.state,
|
|
5581
|
+
hasRadar = _$$$state.hasRadar,
|
|
5582
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
5537
5583
|
main = $$.$el.main,
|
|
5538
|
-
|
|
5584
|
+
isArcTreemap = isObject(d);
|
|
5539
5585
|
// Call event handler
|
|
5540
|
-
if (
|
|
5586
|
+
if (isArcTreemap || d !== -1) {
|
|
5541
5587
|
var callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
|
|
5542
|
-
config.color_onover && $$.setOverColor(isOver, d,
|
|
5543
|
-
if (
|
|
5544
|
-
|
|
5588
|
+
config.color_onover && $$.setOverColor(isOver, d, isArcTreemap);
|
|
5589
|
+
if (isArcTreemap && "id") {
|
|
5590
|
+
var selector = hasTreemap ? $TREEMAP.treemap : $ARC.arc;
|
|
5591
|
+
callback(d, main.select("." + selector + $$.getTargetSelectorSuffix(d.id)).node());
|
|
5545
5592
|
} else if (!config.tooltip_grouped) {
|
|
5546
5593
|
var last = $$.cache.get(KEY.setOverOut) || [],
|
|
5547
5594
|
shapesAtIndex = main.selectAll("." + $SHAPE.shape + "-" + d).filter(function (d) {
|
|
@@ -5629,40 +5676,45 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5629
5676
|
* @param {Array} mouse x and y coordinate value
|
|
5630
5677
|
*/
|
|
5631
5678
|
dispatchEvent: function dispatchEvent(type, index, mouse) {
|
|
5632
|
-
var
|
|
5679
|
+
var _ref,
|
|
5680
|
+
_this7 = this,
|
|
5633
5681
|
$$ = this,
|
|
5634
5682
|
config = $$.config,
|
|
5635
|
-
_$$$
|
|
5636
|
-
eventReceiver = _$$$
|
|
5637
|
-
hasAxis = _$$$
|
|
5638
|
-
hasRadar = _$$$
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5683
|
+
_$$$state2 = $$.state,
|
|
5684
|
+
eventReceiver = _$$$state2.eventReceiver,
|
|
5685
|
+
hasAxis = _$$$state2.hasAxis,
|
|
5686
|
+
hasRadar = _$$$state2.hasRadar,
|
|
5687
|
+
hasTreemap = _$$$state2.hasTreemap,
|
|
5688
|
+
_$$$$el2 = $$.$el,
|
|
5689
|
+
eventRect = _$$$$el2.eventRect,
|
|
5690
|
+
arcs = _$$$$el2.arcs,
|
|
5691
|
+
radar = _$$$$el2.radar,
|
|
5692
|
+
treemap = _$$$$el2.treemap,
|
|
5693
|
+
element = (_ref = hasTreemap && eventReceiver.rect || hasRadar && radar.axes.select("." + $AXIS.axis + "-" + index + " text") || eventRect || (arcs == null ? void 0 : arcs.selectAll("." + $COMMON.target + " path").filter(function (d, i) {
|
|
5645
5694
|
_newArrowCheck(this, _this7);
|
|
5646
5695
|
return i === index;
|
|
5647
|
-
}.bind(this))).node()
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5696
|
+
}.bind(this)))) == null ? void 0 : _ref.node();
|
|
5697
|
+
if (element) {
|
|
5698
|
+
var isMultipleX = $$.isMultipleX();
|
|
5699
|
+
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
5700
|
+
width = _element$getBoundingC.width,
|
|
5701
|
+
left = _element$getBoundingC.left,
|
|
5702
|
+
top = _element$getBoundingC.top;
|
|
5703
|
+
if (hasAxis && !hasRadar && !isMultipleX) {
|
|
5704
|
+
var coords = eventReceiver.coords[index];
|
|
5705
|
+
width = coords.w;
|
|
5706
|
+
left += coords.x;
|
|
5707
|
+
top += coords.y;
|
|
5708
|
+
}
|
|
5709
|
+
var x = left + (mouse ? mouse[0] : 0) + (isMultipleX || config.axis_rotated ? 0 : width / 2),
|
|
5710
|
+
y = top + (mouse ? mouse[1] : 0);
|
|
5711
|
+
emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](hasTreemap ? treemap.node() : element, type, {
|
|
5712
|
+
screenX: x,
|
|
5713
|
+
screenY: y,
|
|
5714
|
+
clientX: x,
|
|
5715
|
+
clientY: y
|
|
5716
|
+
});
|
|
5717
|
+
}
|
|
5666
5718
|
},
|
|
5667
5719
|
setDragStatus: function setDragStatus(isDragging) {
|
|
5668
5720
|
this.state.dragging = isDragging;
|
|
@@ -5673,9 +5725,9 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5673
5725
|
*/
|
|
5674
5726
|
unbindZoomEvent: function unbindZoomEvent() {
|
|
5675
5727
|
var $$ = this,
|
|
5676
|
-
_$$$$
|
|
5677
|
-
eventRect = _$$$$
|
|
5678
|
-
zoomResetBtn = _$$$$
|
|
5728
|
+
_$$$$el3 = $$.$el,
|
|
5729
|
+
eventRect = _$$$$el3.eventRect,
|
|
5730
|
+
zoomResetBtn = _$$$$el3.zoomResetBtn;
|
|
5679
5731
|
eventRect == null ? void 0 : eventRect.on(".zoom wheel.zoom .drag", null);
|
|
5680
5732
|
zoomResetBtn == null ? void 0 : zoomResetBtn.on("click", null).style("display", "none");
|
|
5681
5733
|
},
|
|
@@ -5686,15 +5738,16 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5686
5738
|
unbindAllEvents: function unbindAllEvents() {
|
|
5687
5739
|
var _this8 = this,
|
|
5688
5740
|
$$ = this,
|
|
5689
|
-
_$$$$
|
|
5690
|
-
arcs = _$$$$
|
|
5691
|
-
eventRect = _$$$$
|
|
5692
|
-
legend = _$$$$
|
|
5693
|
-
region = _$$$$
|
|
5694
|
-
svg = _$$$$
|
|
5741
|
+
_$$$$el4 = $$.$el,
|
|
5742
|
+
arcs = _$$$$el4.arcs,
|
|
5743
|
+
eventRect = _$$$$el4.eventRect,
|
|
5744
|
+
legend = _$$$$el4.legend,
|
|
5745
|
+
region = _$$$$el4.region,
|
|
5746
|
+
svg = _$$$$el4.svg,
|
|
5747
|
+
treemap = _$$$$el4.treemap,
|
|
5695
5748
|
brush = $$.brush;
|
|
5696
5749
|
// detach all possible event types
|
|
5697
|
-
[svg, eventRect, region == null ? void 0 : region.list, brush == null ? void 0 : brush.getSelection(), arcs == null ? void 0 : arcs.selectAll("path"), legend == null ? void 0 : legend.selectAll("g")].forEach(function (v) {
|
|
5750
|
+
[svg, eventRect, region == null ? void 0 : region.list, brush == null ? void 0 : brush.getSelection(), arcs == null ? void 0 : arcs.selectAll("path"), legend == null ? void 0 : legend.selectAll("g"), treemap].forEach(function (v) {
|
|
5698
5751
|
_newArrowCheck(this, _this8);
|
|
5699
5752
|
return v == null ? void 0 : v.on("wheel click mouseover mousemove mouseout touchstart touchmove touchend touchstart.eventRect touchmove.eventRect touchend.eventRect .brush .drag .zoom wheel.zoom dblclick.zoom", null);
|
|
5700
5753
|
}.bind(this));
|
|
@@ -5722,7 +5775,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5722
5775
|
getClass: function getClass(type, withShape) {
|
|
5723
5776
|
var _this = this,
|
|
5724
5777
|
isPlural = /s$/.test(type),
|
|
5725
|
-
useIdKey = /^(area|arc|line)s?$/.test(type),
|
|
5778
|
+
useIdKey = /^(area|arc|line|treemap)s?$/.test(type),
|
|
5726
5779
|
key = isPlural ? "id" : "index";
|
|
5727
5780
|
return function (d) {
|
|
5728
5781
|
_newArrowCheck(this, _this);
|
|
@@ -5761,8 +5814,8 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5761
5814
|
return this.generateClass(classes.region, i) + " " + ("class" in d ? d.class : "");
|
|
5762
5815
|
},
|
|
5763
5816
|
classTarget: function classTarget(id) {
|
|
5764
|
-
var additionalClassSuffix = this.config.data_classes[id]
|
|
5765
|
-
|
|
5817
|
+
var additionalClassSuffix = this.config.data_classes[id];
|
|
5818
|
+
var additionalClass = "";
|
|
5766
5819
|
if (additionalClassSuffix) {
|
|
5767
5820
|
additionalClass = " " + classes.target + "-" + additionalClassSuffix;
|
|
5768
5821
|
}
|
|
@@ -5781,11 +5834,17 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5781
5834
|
var targetStr = targetId || targetId === 0 ? "-" + targetId : "";
|
|
5782
5835
|
return targetStr.replace(/([\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\])/g, "-");
|
|
5783
5836
|
},
|
|
5784
|
-
selectorTarget: function selectorTarget(id, prefix) {
|
|
5785
|
-
|
|
5786
|
-
|
|
5837
|
+
selectorTarget: function selectorTarget(id, prefix, postfix) {
|
|
5838
|
+
if (prefix === void 0) {
|
|
5839
|
+
prefix = "";
|
|
5840
|
+
}
|
|
5841
|
+
if (postfix === void 0) {
|
|
5842
|
+
postfix = "";
|
|
5843
|
+
}
|
|
5844
|
+
var target = this.getTargetSelectorSuffix(id);
|
|
5845
|
+
|
|
5787
5846
|
// select target & circle
|
|
5788
|
-
return
|
|
5847
|
+
return prefix + "." + (classes.target + target) + " " + postfix + ", " + prefix + "." + (classes.circles + target) + " " + postfix;
|
|
5789
5848
|
},
|
|
5790
5849
|
selectorTargets: function selectorTargets(idsValue, prefix) {
|
|
5791
5850
|
var _this3 = this,
|
|
@@ -5944,8 +6003,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
5944
6003
|
max = threshold.max || 100,
|
|
5945
6004
|
values = threshold.values && threshold.values.length ? threshold.values : [];
|
|
5946
6005
|
return notEmpty(threshold) ? function (value) {
|
|
5947
|
-
var v = asValue ? value : value * 100 / max
|
|
5948
|
-
|
|
6006
|
+
var v = asValue ? value : value * 100 / max;
|
|
6007
|
+
var color = colors[colors.length - 1];
|
|
5949
6008
|
for (var i = 0, l = values.length; i < l; i++) {
|
|
5950
6009
|
if (v <= values[i]) {
|
|
5951
6010
|
color = colors[i];
|
|
@@ -6167,8 +6226,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6167
6226
|
center = config[pfx + "_center"],
|
|
6168
6227
|
isInverted = config[pfx + "_inverted"],
|
|
6169
6228
|
showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated,
|
|
6170
|
-
showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated
|
|
6171
|
-
|
|
6229
|
+
showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated;
|
|
6230
|
+
var yDomainMin = $$.getYDomainMinMax(yTargets, "min"),
|
|
6172
6231
|
yDomainMax = $$.getYDomainMinMax(yTargets, "max"),
|
|
6173
6232
|
isZeroBased = [TYPE.BAR, TYPE.BUBBLE, TYPE.SCATTER].concat(TYPE_BY_CATEGORY.Line).some(function (v) {
|
|
6174
6233
|
_newArrowCheck(this, _this5);
|
|
@@ -6201,11 +6260,11 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6201
6260
|
isAllPositive && (yDomainMin = 0);
|
|
6202
6261
|
isAllNegative && (yDomainMax = 0);
|
|
6203
6262
|
}
|
|
6204
|
-
var domainLength = Math.abs(yDomainMax - yDomainMin)
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6263
|
+
var domainLength = Math.abs(yDomainMax - yDomainMin);
|
|
6264
|
+
var padding = {
|
|
6265
|
+
top: domainLength * .1,
|
|
6266
|
+
bottom: domainLength * .1
|
|
6267
|
+
};
|
|
6209
6268
|
if (isDefined(center)) {
|
|
6210
6269
|
var yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax));
|
|
6211
6270
|
yDomainMax = center + yDomainAbs;
|
|
@@ -6265,8 +6324,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6265
6324
|
return v.x;
|
|
6266
6325
|
}.bind(this)));
|
|
6267
6326
|
}.bind(this))),
|
|
6268
|
-
|
|
6269
|
-
|
|
6327
|
+
_$$$axis,
|
|
6328
|
+
value = isObject(configValue) ? configValue.value : configValue;
|
|
6270
6329
|
value = isDefined(value) && (_$$$axis = $$.axis) != null && _$$$axis.isTimeSeries() ? parseDate.bind(this)(value) : value;
|
|
6271
6330
|
if (isObject(configValue) && configValue.fit && (type === "min" && value < dataValue || type === "max" && value > dataValue)) {
|
|
6272
6331
|
value = undefined;
|
|
@@ -6286,8 +6345,9 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6286
6345
|
config = $$.config,
|
|
6287
6346
|
padding = config.axis_x_padding,
|
|
6288
6347
|
isTimeSeriesTickCount = axis.isTimeSeries() && tickCount,
|
|
6289
|
-
diff = diffDomain(domain)
|
|
6290
|
-
|
|
6348
|
+
diff = diffDomain(domain);
|
|
6349
|
+
var defaultValue;
|
|
6350
|
+
|
|
6291
6351
|
// determine default padding value
|
|
6292
6352
|
if (axis.isCategorized() || isTimeSeriesTickCount) {
|
|
6293
6353
|
defaultValue = 0;
|
|
@@ -6334,18 +6394,18 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6334
6394
|
var $$ = this,
|
|
6335
6395
|
axis = $$.axis,
|
|
6336
6396
|
x = $$.scale.x,
|
|
6337
|
-
domain = [$$.getXDomainMinMax(targets, "min"), $$.getXDomainMinMax(targets, "max")]
|
|
6338
|
-
|
|
6339
|
-
_domain$ = _domain[0],
|
|
6397
|
+
domain = [$$.getXDomainMinMax(targets, "min"), $$.getXDomainMinMax(targets, "max")];
|
|
6398
|
+
var _domain$ = domain[0],
|
|
6340
6399
|
min = _domain$ === void 0 ? 0 : _domain$,
|
|
6341
|
-
_domain$2 =
|
|
6400
|
+
_domain$2 = domain[1],
|
|
6342
6401
|
max = _domain$2 === void 0 ? 0 : _domain$2;
|
|
6343
6402
|
if (x.type !== "log") {
|
|
6344
6403
|
var isCategorized = axis.isCategorized(),
|
|
6345
6404
|
isTimeSeries = axis.isTimeSeries(),
|
|
6346
|
-
|
|
6347
|
-
|
|
6405
|
+
padding = $$.getXDomainPadding(domain);
|
|
6406
|
+
var firstX = domain[0],
|
|
6348
6407
|
lastX = domain[1];
|
|
6408
|
+
|
|
6349
6409
|
// show center of x domain if min and max are the same
|
|
6350
6410
|
if (firstX - lastX === 0 && !isCategorized) {
|
|
6351
6411
|
if (isTimeSeries) {
|
|
@@ -6357,10 +6417,10 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6357
6417
|
}
|
|
6358
6418
|
}
|
|
6359
6419
|
if (firstX || firstX === 0) {
|
|
6360
|
-
min = isTimeSeries ? new Date(firstX.getTime() -
|
|
6420
|
+
min = isTimeSeries ? new Date(firstX.getTime() - padding.left) : firstX - padding.left;
|
|
6361
6421
|
}
|
|
6362
6422
|
if (lastX || lastX === 0) {
|
|
6363
|
-
max = isTimeSeries ? new Date(lastX.getTime() +
|
|
6423
|
+
max = isTimeSeries ? new Date(lastX.getTime() + padding.right) : lastX + padding.right;
|
|
6364
6424
|
}
|
|
6365
6425
|
}
|
|
6366
6426
|
return [min, max];
|
|
@@ -6413,8 +6473,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6413
6473
|
getZoomDomain: function getZoomDomain() {
|
|
6414
6474
|
var $$ = this,
|
|
6415
6475
|
config = $$.config,
|
|
6416
|
-
org = $$.org
|
|
6417
|
-
|
|
6476
|
+
org = $$.org;
|
|
6477
|
+
var _org$xDomain = org.xDomain,
|
|
6418
6478
|
min = _org$xDomain[0],
|
|
6419
6479
|
max = _org$xDomain[1];
|
|
6420
6480
|
if (isDefined(config.zoom_x_min)) {
|
|
@@ -6437,8 +6497,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6437
6497
|
var $$ = this,
|
|
6438
6498
|
config = $$.config,
|
|
6439
6499
|
state = $$.state,
|
|
6440
|
-
isRotated = config.axis_rotated
|
|
6441
|
-
|
|
6500
|
+
isRotated = config.axis_rotated;
|
|
6501
|
+
var length;
|
|
6442
6502
|
if (type === "x") {
|
|
6443
6503
|
length = isRotated ? "height" : "width";
|
|
6444
6504
|
} else {
|
|
@@ -6580,7 +6640,8 @@ function getLegendColor(id) {
|
|
|
6580
6640
|
* @private
|
|
6581
6641
|
*/
|
|
6582
6642
|
updateLegend: function updateLegend(targetIds, options, transitions) {
|
|
6583
|
-
var
|
|
6643
|
+
var _$el$legend,
|
|
6644
|
+
$$ = this,
|
|
6584
6645
|
config = $$.config,
|
|
6585
6646
|
state = $$.state,
|
|
6586
6647
|
scale = $$.scale,
|
|
@@ -6594,12 +6655,12 @@ function getLegendColor(id) {
|
|
|
6594
6655
|
optionz.withTransitionForTransform = getOption(optionz, "withTransitionForTransform", !0);
|
|
6595
6656
|
if (config.legend_contents_bindto && config.legend_contents_template) {
|
|
6596
6657
|
$$.updateLegendTemplate();
|
|
6597
|
-
} else {
|
|
6658
|
+
} else if (!state.hasTreemap) {
|
|
6598
6659
|
$$.updateLegendElement(targetIds || $$.mapToIds($$.data.targets), optionz, transitions);
|
|
6599
6660
|
}
|
|
6600
6661
|
|
|
6601
6662
|
// toggle legend state
|
|
6602
|
-
$el.legend.selectAll("." + $LEGEND.legendItem).classed($LEGEND.legendItemHidden, function (id) {
|
|
6663
|
+
(_$el$legend = $el.legend) == null ? void 0 : _$el$legend.selectAll("." + $LEGEND.legendItem).classed($LEGEND.legendItemHidden, function (id) {
|
|
6603
6664
|
var hide = !$$.isTargetToShow(id);
|
|
6604
6665
|
if (hide) {
|
|
6605
6666
|
this.style.opacity = null;
|
|
@@ -6628,8 +6689,8 @@ function getLegendColor(id) {
|
|
|
6628
6689
|
template = config.legend_contents_template;
|
|
6629
6690
|
if (!wrapper.empty()) {
|
|
6630
6691
|
var targets = $$.mapToIds($$.data.targets),
|
|
6631
|
-
ids = []
|
|
6632
|
-
|
|
6692
|
+
ids = [];
|
|
6693
|
+
var html = "";
|
|
6633
6694
|
targets.forEach(function (v) {
|
|
6634
6695
|
_newArrowCheck(this, _this);
|
|
6635
6696
|
var content = isFunction(template) ? template.bind($$.api)(v, $$.color(v), $$.api.data(v)[0].values) : tplProcess(template, {
|
|
@@ -6833,9 +6894,11 @@ function getLegendColor(id) {
|
|
|
6833
6894
|
getLegendItemTextBox: function getLegendItemTextBox(id, textElement) {
|
|
6834
6895
|
var $$ = this,
|
|
6835
6896
|
cache = $$.cache,
|
|
6836
|
-
state = $$.state
|
|
6837
|
-
|
|
6838
|
-
|
|
6897
|
+
state = $$.state;
|
|
6898
|
+
var data;
|
|
6899
|
+
|
|
6900
|
+
// do not prefix w/'$', to not be resetted cache in .load() call
|
|
6901
|
+
var cacheKey = KEY.legendItemTextBox;
|
|
6839
6902
|
if (id) {
|
|
6840
6903
|
data = !state.redrawing && cache.get(cacheKey) || {};
|
|
6841
6904
|
if (!data[id]) {
|
|
@@ -7288,7 +7351,9 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7288
7351
|
config = $$.config,
|
|
7289
7352
|
state = $$.state,
|
|
7290
7353
|
$el = $$.$el,
|
|
7291
|
-
|
|
7354
|
+
_$el = $el,
|
|
7355
|
+
main = _$el.main,
|
|
7356
|
+
treemap = _$el.treemap;
|
|
7292
7357
|
state.redrawing = !0;
|
|
7293
7358
|
var targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
|
7294
7359
|
_options = options,
|
|
@@ -7304,7 +7369,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7304
7369
|
// update legend and transform each g
|
|
7305
7370
|
if (wth.Legend && config.legend_show) {
|
|
7306
7371
|
options.withTransition = !!duration;
|
|
7307
|
-
$$.updateLegend($$.mapToIds($$.data.targets), options, transitions);
|
|
7372
|
+
treemap || $$.updateLegend($$.mapToIds($$.data.targets), options, transitions);
|
|
7308
7373
|
} else if (wth.Dimension) {
|
|
7309
7374
|
// need to update dimension (e.g. axis.y.tick.values) because y tick values should change
|
|
7310
7375
|
// no need to update axis in it because they will be updated in redraw()
|
|
@@ -7312,7 +7377,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7312
7377
|
}
|
|
7313
7378
|
|
|
7314
7379
|
// update circleY based on updated parameters
|
|
7315
|
-
if (!$$.hasArcType() || state.hasRadar) {
|
|
7380
|
+
if (!treemap && (!$$.hasArcType() || state.hasRadar)) {
|
|
7316
7381
|
$$.updateCircleY && ($$.circleY = $$.updateCircleY());
|
|
7317
7382
|
}
|
|
7318
7383
|
|
|
@@ -7354,10 +7419,13 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7354
7419
|
|
|
7355
7420
|
// polar
|
|
7356
7421
|
$el.polar && $$.redrawPolar();
|
|
7422
|
+
|
|
7423
|
+
// treemap
|
|
7424
|
+
treemap && $$.updateTreemap(durationForExit);
|
|
7357
7425
|
}
|
|
7358
7426
|
|
|
7359
7427
|
// @TODO: Axis & Radar type
|
|
7360
|
-
if (!state.resizing && ($$.hasPointType() || state.hasRadar)) {
|
|
7428
|
+
if (!state.resizing && !treemap && ($$.hasPointType() || state.hasRadar)) {
|
|
7361
7429
|
$$.updateCircle();
|
|
7362
7430
|
}
|
|
7363
7431
|
|
|
@@ -7441,6 +7509,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7441
7509
|
_$$$state = $$.state,
|
|
7442
7510
|
hasAxis = _$$$state.hasAxis,
|
|
7443
7511
|
hasRadar = _$$$state.hasRadar,
|
|
7512
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
7444
7513
|
grid = $$.$el.grid,
|
|
7445
7514
|
_shape$pos = shape.pos,
|
|
7446
7515
|
cx = _shape$pos.cx,
|
|
@@ -7471,6 +7540,9 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7471
7540
|
if (($$.hasPointType() || hasRadar) && !config.point_focus_only) {
|
|
7472
7541
|
$$.redrawCircle && list.push($$.redrawCircle(cx, cy, withTransition, flowFn));
|
|
7473
7542
|
}
|
|
7543
|
+
if (hasTreemap) {
|
|
7544
|
+
list.push($$.redrawTreemap(withTransition));
|
|
7545
|
+
}
|
|
7474
7546
|
return list;
|
|
7475
7547
|
},
|
|
7476
7548
|
updateAndRedraw: function updateAndRedraw(options) {
|
|
@@ -7479,8 +7551,9 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7479
7551
|
}
|
|
7480
7552
|
var $$ = this,
|
|
7481
7553
|
config = $$.config,
|
|
7482
|
-
state = $$.state
|
|
7483
|
-
|
|
7554
|
+
state = $$.state;
|
|
7555
|
+
var transitions;
|
|
7556
|
+
|
|
7484
7557
|
// same with redraw
|
|
7485
7558
|
options.withTransition = getOption(options, "withTransition", !0);
|
|
7486
7559
|
options.withTransform = getOption(options, "withTransform", !1);
|
|
@@ -7599,10 +7672,11 @@ function getScale(type, min, max) {
|
|
|
7599
7672
|
* @private
|
|
7600
7673
|
*/
|
|
7601
7674
|
getYScaleById: function getYScaleById(id, isSub) {
|
|
7675
|
+
var _this$axis;
|
|
7602
7676
|
if (isSub === void 0) {
|
|
7603
7677
|
isSub = !1;
|
|
7604
7678
|
}
|
|
7605
|
-
var isY2 = this.axis.getId(id) === "y2",
|
|
7679
|
+
var isY2 = ((_this$axis = this.axis) == null ? void 0 : _this$axis.getId(id)) === "y2",
|
|
7606
7680
|
key = isSub ? isY2 ? "subY2" : "subY" : isY2 ? "y2" : "y";
|
|
7607
7681
|
return this.scale[key];
|
|
7608
7682
|
},
|
|
@@ -7669,11 +7743,13 @@ function getScale(type, min, max) {
|
|
|
7669
7743
|
org = $$.org,
|
|
7670
7744
|
scale = $$.scale,
|
|
7671
7745
|
_$$$state = $$.state,
|
|
7746
|
+
current = _$$$state.current,
|
|
7672
7747
|
width = _$$$state.width,
|
|
7673
7748
|
height = _$$$state.height,
|
|
7674
7749
|
width2 = _$$$state.width2,
|
|
7675
7750
|
height2 = _$$$state.height2,
|
|
7676
|
-
hasAxis = _$$$state.hasAxis
|
|
7751
|
+
hasAxis = _$$$state.hasAxis,
|
|
7752
|
+
hasTreemap = _$$$state.hasTreemap;
|
|
7677
7753
|
if (hasAxis) {
|
|
7678
7754
|
var _scale$x,
|
|
7679
7755
|
isRotated = config.axis_rotated,
|
|
@@ -7719,6 +7795,10 @@ function getScale(type, min, max) {
|
|
|
7719
7795
|
scale.subY2 = $$.getYScale("y2", min.subY, max.subY, scale.subY2 ? scale.subY2.domain() : config.axis_y2_default);
|
|
7720
7796
|
axis.setAxis("y2", scale.y2, config.axis_y2_tick_outer, isInit);
|
|
7721
7797
|
}
|
|
7798
|
+
} else if (hasTreemap) {
|
|
7799
|
+
var padding = $$.getCurrentPadding();
|
|
7800
|
+
scale.x = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear)().rangeRound([padding.left, current.width - padding.right]);
|
|
7801
|
+
scale.y = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear)().rangeRound([padding.top, current.height - padding.bottom]);
|
|
7722
7802
|
} else {
|
|
7723
7803
|
// update for arc
|
|
7724
7804
|
$$.updateArc == null ? void 0 : $$.updateArc();
|
|
@@ -7746,8 +7826,8 @@ function getScale(type, min, max) {
|
|
|
7746
7826
|
_$$$scale2 = $$.scale,
|
|
7747
7827
|
x = _$$$scale2.x,
|
|
7748
7828
|
zoom = _$$$scale2.zoom,
|
|
7749
|
-
fn = config.zoom_enabled && zoom ? zoom : x
|
|
7750
|
-
|
|
7829
|
+
fn = config.zoom_enabled && zoom ? zoom : x;
|
|
7830
|
+
var value = $$.getBaseValue(d);
|
|
7751
7831
|
if (axis.isTimeSeries()) {
|
|
7752
7832
|
value = parseDate.call($$, value);
|
|
7753
7833
|
} else if (axis.isCategorized() && isString(value)) {
|
|
@@ -7789,13 +7869,15 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
7789
7869
|
var _this = this,
|
|
7790
7870
|
$$ = this,
|
|
7791
7871
|
isRotated = $$.config.axis_rotated,
|
|
7792
|
-
|
|
7872
|
+
_$$$state = $$.state,
|
|
7873
|
+
hasRadar = _$$$state.hasRadar,
|
|
7874
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
7793
7875
|
shape = {
|
|
7794
7876
|
type: {},
|
|
7795
7877
|
indices: {},
|
|
7796
7878
|
pos: {}
|
|
7797
7879
|
};
|
|
7798
|
-
["bar", "candlestick", "line", "area"].forEach(function (v) {
|
|
7880
|
+
hasTreemap || ["bar", "candlestick", "line", "area"].forEach(function (v) {
|
|
7799
7881
|
_newArrowCheck(this, _this);
|
|
7800
7882
|
var name = capitalize(/^(bubble|scatter)$/.test(v) ? "line" : v);
|
|
7801
7883
|
if ($$.hasType(v) || $$.hasTypeOf(name) || v === "line" && ($$.hasType("bubble") || $$.hasType("scatter"))) {
|
|
@@ -7805,10 +7887,13 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
7805
7887
|
shape.type[v] = drawFn ? drawFn.bind($$)(indices, !1) : undefined;
|
|
7806
7888
|
}
|
|
7807
7889
|
}.bind(this));
|
|
7808
|
-
if (!$$.hasArcType() || hasRadar) {
|
|
7890
|
+
if (!$$.hasArcType() || hasRadar || hasTreemap) {
|
|
7891
|
+
var cx, cy;
|
|
7809
7892
|
// generate circle x/y functions depending on updated params
|
|
7810
|
-
|
|
7893
|
+
if (!hasTreemap) {
|
|
7894
|
+
cx = hasRadar ? $$.radarCircleX : isRotated ? $$.circleY : $$.circleX;
|
|
7811
7895
|
cy = hasRadar ? $$.radarCircleY : isRotated ? $$.circleX : $$.circleY;
|
|
7896
|
+
}
|
|
7812
7897
|
shape.pos = {
|
|
7813
7898
|
xForText: $$.generateXYForText(shape.indices, !0),
|
|
7814
7899
|
yForText: $$.generateXYForText(shape.indices, !1),
|
|
@@ -7935,8 +8020,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
7935
8020
|
_newArrowCheck(this, _this5);
|
|
7936
8021
|
var ind = $$.getIndices(indices, d, "getShapeX"),
|
|
7937
8022
|
index = d.id in ind ? ind[d.id] : 0,
|
|
7938
|
-
targetsNum = (ind.__max__ || 0) + 1
|
|
7939
|
-
|
|
8023
|
+
targetsNum = (ind.__max__ || 0) + 1;
|
|
8024
|
+
var x = 0;
|
|
7940
8025
|
if (notEmpty(d.x)) {
|
|
7941
8026
|
var xPos = currScale(d.x, !0);
|
|
7942
8027
|
if (halfWidth) {
|
|
@@ -8060,8 +8145,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8060
8145
|
return scale(value[0]);
|
|
8061
8146
|
}
|
|
8062
8147
|
var dataXAsNumber = +x,
|
|
8063
|
-
y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id))
|
|
8064
|
-
|
|
8148
|
+
y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id));
|
|
8149
|
+
var offset = y0;
|
|
8065
8150
|
shapeOffsetTargets.filter(function (t) {
|
|
8066
8151
|
_newArrowCheck(this, _this10);
|
|
8067
8152
|
return t.id !== id && ind[t.id] === ind[id];
|
|
@@ -8162,8 +8247,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8162
8247
|
},
|
|
8163
8248
|
isWithinShape: function isWithinShape(that, d) {
|
|
8164
8249
|
var $$ = this,
|
|
8165
|
-
shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that)
|
|
8166
|
-
|
|
8250
|
+
shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that);
|
|
8251
|
+
var isWithin;
|
|
8167
8252
|
if (!$$.isTargetToShow(d.id)) {
|
|
8168
8253
|
isWithin = !1;
|
|
8169
8254
|
} else if ($$.hasValidPointType != null && $$.hasValidPointType(that.nodeName)) {
|
|
@@ -8255,8 +8340,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8255
8340
|
config = $$.config,
|
|
8256
8341
|
hasAxis = $$.state.hasAxis,
|
|
8257
8342
|
$el = $$.$el,
|
|
8258
|
-
axesLen = hasAxis ? config.axis_y2_axes.length : 0
|
|
8259
|
-
|
|
8343
|
+
axesLen = hasAxis ? config.axis_y2_axes.length : 0;
|
|
8344
|
+
var padding = isValue(config.padding_top) ? config.padding_top : 0;
|
|
8260
8345
|
if ($el.title && $el.title.node()) {
|
|
8261
8346
|
padding += $$.getTitlePadding();
|
|
8262
8347
|
}
|
|
@@ -8281,8 +8366,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8281
8366
|
isRotated = config.axis_rotated,
|
|
8282
8367
|
axisId = isRotated ? "x" : "y",
|
|
8283
8368
|
axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0,
|
|
8284
|
-
axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0
|
|
8285
|
-
|
|
8369
|
+
axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0;
|
|
8370
|
+
var padding;
|
|
8286
8371
|
if (isValue(config.padding_left)) {
|
|
8287
8372
|
padding = config.padding_left;
|
|
8288
8373
|
} else if (hasAxis && isRotated) {
|
|
@@ -8305,10 +8390,10 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8305
8390
|
legendWidthOnRight = $$.state.isLegendRight ? $$.getLegendWidth() + 20 : 0,
|
|
8306
8391
|
axesLen = hasAxis ? config.axis_y2_axes.length : 0,
|
|
8307
8392
|
axisWidth = hasAxis ? $$.getAxisWidthByAxisId("y2") : 0,
|
|
8308
|
-
xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(10) : 0
|
|
8309
|
-
|
|
8393
|
+
xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(10) : 0;
|
|
8394
|
+
var padding;
|
|
8310
8395
|
if (isValue(config.padding_right)) {
|
|
8311
|
-
padding = config.padding_right + 1; // 1 is needed not to hide tick line
|
|
8396
|
+
padding = config.padding_right + (hasAxis ? 1 : 0); // 1 is needed not to hide tick line
|
|
8312
8397
|
} else if ($$.axis && config.axis_rotated) {
|
|
8313
8398
|
padding = 10 + legendWidthOnRight;
|
|
8314
8399
|
} else if ($$.axis && (!config.axis_y2_show || config.axis_y2_inner)) {
|
|
@@ -8326,8 +8411,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8326
8411
|
* @private
|
|
8327
8412
|
*/
|
|
8328
8413
|
getParentRectValue: function getParentRectValue(key) {
|
|
8329
|
-
var offsetName = "offset" + capitalize(key)
|
|
8330
|
-
|
|
8414
|
+
var offsetName = "offset" + capitalize(key);
|
|
8415
|
+
var parent = this.$el.chart.node(),
|
|
8331
8416
|
v = 0;
|
|
8332
8417
|
while (v < 30 && parent && parent.tagName !== "BODY") {
|
|
8333
8418
|
try {
|
|
@@ -8352,8 +8437,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8352
8437
|
return this.getParentRectValue("width");
|
|
8353
8438
|
},
|
|
8354
8439
|
getParentHeight: function getParentHeight() {
|
|
8355
|
-
var h = this.$el.chart.style("height")
|
|
8356
|
-
|
|
8440
|
+
var h = this.$el.chart.style("height");
|
|
8441
|
+
var height = 0;
|
|
8357
8442
|
if (h) {
|
|
8358
8443
|
height = /px$/.test(h) ? parseInt(h, 10) : this.getParentRectValue("height");
|
|
8359
8444
|
}
|
|
@@ -8415,6 +8500,15 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8415
8500
|
clip.idSubchart && svg.select("#" + clip.idSubchart).select("rect").attr("width", width).attr("height", brushSize.height);
|
|
8416
8501
|
}
|
|
8417
8502
|
},
|
|
8503
|
+
getCurrentPadding: function getCurrentPadding() {
|
|
8504
|
+
var $$ = this;
|
|
8505
|
+
return {
|
|
8506
|
+
top: $$.getCurrentPaddingTop(),
|
|
8507
|
+
bottom: $$.getCurrentPaddingBottom(),
|
|
8508
|
+
left: $$.getCurrentPaddingLeft(),
|
|
8509
|
+
right: $$.getCurrentPaddingRight()
|
|
8510
|
+
};
|
|
8511
|
+
},
|
|
8418
8512
|
/**
|
|
8419
8513
|
* Get resetted padding values when 'padding=false' option is set
|
|
8420
8514
|
* https://github.com/naver/billboard.js/issues/2367
|
|
@@ -8450,31 +8544,32 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8450
8544
|
state = $$.state,
|
|
8451
8545
|
legend = $$.$el.legend,
|
|
8452
8546
|
isRotated = config.axis_rotated,
|
|
8453
|
-
|
|
8547
|
+
isNonAxis = $$.hasArcType() || state.hasTreemap;
|
|
8454
8548
|
isInit || $$.setContainerSize();
|
|
8455
8549
|
var currLegend = {
|
|
8456
8550
|
width: legend ? $$.getLegendWidth() : 0,
|
|
8457
8551
|
height: legend ? $$.getLegendHeight() : 0
|
|
8458
8552
|
};
|
|
8459
|
-
if (!
|
|
8553
|
+
if (!isNonAxis && config.axis_x_show && config.axis_x_tick_autorotate) {
|
|
8460
8554
|
$$.updateXAxisTickClip();
|
|
8461
8555
|
}
|
|
8462
8556
|
var legendHeightForBottom = state.isLegendRight || state.isLegendInset ? 0 : currLegend.height,
|
|
8463
|
-
xAxisHeight = isRotated ||
|
|
8557
|
+
xAxisHeight = isRotated || isNonAxis ? 0 : $$.getHorizontalAxisHeight("x"),
|
|
8464
8558
|
subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30,
|
|
8465
|
-
subchartHeight = config.subchart_show && !
|
|
8559
|
+
subchartHeight = config.subchart_show && !isNonAxis ? config.subchart_size_height + subchartXAxisHeight : 0,
|
|
8560
|
+
padding = $$.getCurrentPadding();
|
|
8466
8561
|
// for main
|
|
8467
|
-
state.margin = !
|
|
8468
|
-
top: $$.getHorizontalAxisHeight("y2") +
|
|
8469
|
-
right:
|
|
8470
|
-
bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom +
|
|
8471
|
-
left: subchartHeight + (
|
|
8562
|
+
state.margin = !isNonAxis && isRotated ? {
|
|
8563
|
+
top: $$.getHorizontalAxisHeight("y2") + padding.top,
|
|
8564
|
+
right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0),
|
|
8565
|
+
bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + padding.bottom,
|
|
8566
|
+
left: subchartHeight + (isNonAxis ? 0 : padding.left)
|
|
8472
8567
|
} : {
|
|
8473
|
-
top: 4 +
|
|
8568
|
+
top: 4 + padding.top,
|
|
8474
8569
|
// for top tick text
|
|
8475
|
-
right:
|
|
8476
|
-
bottom: xAxisHeight + subchartHeight + legendHeightForBottom +
|
|
8477
|
-
left:
|
|
8570
|
+
right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0),
|
|
8571
|
+
bottom: xAxisHeight + subchartHeight + legendHeightForBottom + padding.bottom,
|
|
8572
|
+
left: isNonAxis ? 0 : padding.left
|
|
8478
8573
|
};
|
|
8479
8574
|
state.margin = $$.getResettedPadding(state.margin);
|
|
8480
8575
|
|
|
@@ -8517,15 +8612,17 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8517
8612
|
}
|
|
8518
8613
|
|
|
8519
8614
|
// for arc
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8615
|
+
if ($$.hasArcType()) {
|
|
8616
|
+
var hasGauge = $$.hasType("gauge"),
|
|
8617
|
+
isLegendRight = config.legend_show && state.isLegendRight;
|
|
8618
|
+
state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0);
|
|
8619
|
+
state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10);
|
|
8620
|
+
if (hasGauge && !config.gauge_fullCircle) {
|
|
8621
|
+
state.arcHeight += state.height - $$.getPaddingBottomForGauge();
|
|
8622
|
+
}
|
|
8623
|
+
$$.updateRadius == null ? void 0 : $$.updateRadius();
|
|
8624
|
+
}
|
|
8625
|
+
if (state.isLegendRight && isNonAxis) {
|
|
8529
8626
|
state.margin3.left = state.arcWidth / 2 + state.radiusExpanded * 1.1;
|
|
8530
8627
|
}
|
|
8531
8628
|
}
|
|
@@ -8630,27 +8727,26 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8630
8727
|
isNegative = isNumber(value) && value < 0 || isCandlestickType && !((_$$$getCandlestickDat = $$.getCandlestickData(d)) != null && _$$$getCandlestickDat._isUp),
|
|
8631
8728
|
x = pos.x,
|
|
8632
8729
|
y = pos.y,
|
|
8633
|
-
gap = 4,
|
|
8634
8730
|
doubleGap = 8;
|
|
8635
8731
|
if (isRotated) {
|
|
8636
8732
|
if (anchor === "start") {
|
|
8637
8733
|
x += isNegative ? 0 : doubleGap;
|
|
8638
|
-
y +=
|
|
8734
|
+
y += 4;
|
|
8639
8735
|
} else if (anchor === "middle") {
|
|
8640
8736
|
x += doubleGap;
|
|
8641
8737
|
y -= doubleGap;
|
|
8642
8738
|
} else if (anchor === "end") {
|
|
8643
8739
|
isNegative && (x -= doubleGap);
|
|
8644
|
-
y +=
|
|
8740
|
+
y += 4;
|
|
8645
8741
|
}
|
|
8646
8742
|
} else {
|
|
8647
8743
|
if (anchor === "start") {
|
|
8648
|
-
x +=
|
|
8744
|
+
x += 4;
|
|
8649
8745
|
isNegative && (y += doubleGap * 2);
|
|
8650
8746
|
} else if (anchor === "middle") {
|
|
8651
8747
|
y -= doubleGap;
|
|
8652
8748
|
} else if (anchor === "end") {
|
|
8653
|
-
x -=
|
|
8749
|
+
x -= 4;
|
|
8654
8750
|
isNegative && (y += doubleGap * 2);
|
|
8655
8751
|
}
|
|
8656
8752
|
if (isInverted) {
|
|
@@ -8673,7 +8769,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8673
8769
|
*/
|
|
8674
8770
|
initText: function initText() {
|
|
8675
8771
|
var $el = this.$el;
|
|
8676
|
-
$el.main.select("." + $COMMON.chart).append("g").attr("class", $TEXT.chartTexts);
|
|
8772
|
+
$el.main.select("." + $COMMON.chart).append("g").attr("class", $TEXT.chartTexts).style("pointer-events", $el.treemap ? "none" : null);
|
|
8677
8773
|
},
|
|
8678
8774
|
/**
|
|
8679
8775
|
* Update chartText
|
|
@@ -8688,7 +8784,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8688
8784
|
classFocus = $$.classFocus.bind($$),
|
|
8689
8785
|
mainTextUpdate = $$.$el.main.select("." + $TEXT.chartTexts).selectAll("." + $TEXT.chartText).data(targets).attr("class", function (d) {
|
|
8690
8786
|
_newArrowCheck(this, _this);
|
|
8691
|
-
return classChartText(d) + classFocus(d);
|
|
8787
|
+
return ("" + classChartText(d) + classFocus(d)).trim();
|
|
8692
8788
|
}.bind(this)),
|
|
8693
8789
|
mainTextEnter = mainTextUpdate.enter().append("g").style("opacity", "0").attr("class", classChartText).call($$.setCssRule(!0, " ." + $TEXT.text, ["fill", "pointer-events:none"], $$.updateTextColor));
|
|
8694
8790
|
mainTextEnter.append("g").attr("class", classTexts);
|
|
@@ -8704,6 +8800,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8704
8800
|
$T = $$.$T,
|
|
8705
8801
|
config = $$.config,
|
|
8706
8802
|
classText = $$.getClass("text", "index"),
|
|
8803
|
+
labelsCentered = config.data_labels.centered,
|
|
8707
8804
|
text = $el.main.selectAll("." + $TEXT.texts).selectAll("." + $TEXT.text).data($$.labelishData.bind($$));
|
|
8708
8805
|
$T(text.exit()).style("fill-opacity", "0").remove();
|
|
8709
8806
|
$el.text = text.enter().append("text").merge(text).attr("class", classText).attr("text-anchor", function (d) {
|
|
@@ -8713,11 +8810,13 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8713
8810
|
if ($$.isCandlestickType(d)) {
|
|
8714
8811
|
var data = $$.getCandlestickData(d);
|
|
8715
8812
|
isEndAnchor = !(data != null && data._isUp);
|
|
8813
|
+
} else if ($$.isTreemapType(d)) {
|
|
8814
|
+
return labelsCentered ? "middle" : "start";
|
|
8716
8815
|
}
|
|
8717
8816
|
return config.axis_rotated ? isEndAnchor ? "end" : "start" : "middle";
|
|
8718
8817
|
}.bind(this)).style("fill", $$.getStylePropValue($$.updateTextColor)).style("fill-opacity", "0").each(function (d, i, texts) {
|
|
8719
|
-
var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this)
|
|
8720
|
-
|
|
8818
|
+
var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
8819
|
+
var value = d.value;
|
|
8721
8820
|
if ($$.isBubbleZType(d)) {
|
|
8722
8821
|
value = $$.getBubbleZData(value, "z");
|
|
8723
8822
|
} else if ($$.isCandlestickType(d)) {
|
|
@@ -8726,7 +8825,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8726
8825
|
value = data.close;
|
|
8727
8826
|
}
|
|
8728
8827
|
}
|
|
8729
|
-
value = $$.dataLabelFormat(d.id)(value, d.id, i, texts);
|
|
8828
|
+
value = $$.isTreemapType(d) ? $$.treemapDataLabelFormat(d)(node) : $$.dataLabelFormat(d.id)(value, d.id, i, texts);
|
|
8730
8829
|
if (isNumber(value)) {
|
|
8731
8830
|
this.textContent = value;
|
|
8732
8831
|
} else {
|
|
@@ -8738,8 +8837,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8738
8837
|
var $$ = this,
|
|
8739
8838
|
config = $$.config,
|
|
8740
8839
|
labelColors = config.data_labels_colors,
|
|
8741
|
-
defaultColor = $$.isArcType(d) && !$$.isRadarType(d) ? null : $$.color(d)
|
|
8742
|
-
|
|
8840
|
+
defaultColor = $$.isArcType(d) && !$$.isRadarType(d) || $$.isTreemapType(d) ? null : $$.color(d);
|
|
8841
|
+
var color;
|
|
8743
8842
|
if (isString(labelColors)) {
|
|
8744
8843
|
color = labelColors;
|
|
8745
8844
|
} else if (isObject(labelColors)) {
|
|
@@ -8768,8 +8867,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8768
8867
|
var $$ = this,
|
|
8769
8868
|
$el = $$.$el,
|
|
8770
8869
|
config = $$.config,
|
|
8771
|
-
backgroundColor = config.data_labels_backgroundColors
|
|
8772
|
-
|
|
8870
|
+
backgroundColor = config.data_labels_backgroundColors;
|
|
8871
|
+
var color = "";
|
|
8773
8872
|
if (isString(backgroundColor) || isObject(backgroundColor)) {
|
|
8774
8873
|
var id = isString(backgroundColor) ? "" : $$.getTargetSelectorSuffix("id" in d ? d.id : d.data.id),
|
|
8775
8874
|
filter = $el.defs.select(["filter[id*='labels-bg", "']"].join(id));
|
|
@@ -8793,19 +8892,22 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8793
8892
|
$T = $$.$T,
|
|
8794
8893
|
axis = $$.axis,
|
|
8795
8894
|
config = $$.config,
|
|
8895
|
+
hasTreemap = $$.state.hasTreemap,
|
|
8796
8896
|
t = getRandom(!0),
|
|
8797
8897
|
isRotated = config.axis_rotated,
|
|
8798
8898
|
angle = config.data_labels.rotate,
|
|
8799
8899
|
anchorString = getRotateAnchor(angle),
|
|
8800
8900
|
rotateString = angle ? "rotate(" + angle + ")" : "";
|
|
8901
|
+
// $$.meetsLabelThreshold(ratio,
|
|
8902
|
+
|
|
8801
8903
|
$$.$el.text.style("fill", $$.getStylePropValue($$.updateTextColor)).attr("filter", $$.updateTextBacgroundColor.bind($$)).style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$)).each(function (d, i) {
|
|
8802
8904
|
// do not apply transition for newly added text elements
|
|
8803
|
-
var node = $T(this, !!(withTransition && this.getAttribute("x")), t),
|
|
8804
|
-
isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"]
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8905
|
+
var node = $T(hasTreemap && this.childElementCount ? this.parentNode : this, !!(withTransition && this.getAttribute("x")), t),
|
|
8906
|
+
isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"];
|
|
8907
|
+
var pos = {
|
|
8908
|
+
x: getX.bind(this)(d, i),
|
|
8909
|
+
y: getY.bind(this)(d, i)
|
|
8910
|
+
};
|
|
8809
8911
|
if (angle) {
|
|
8810
8912
|
pos = setRotatePos.bind($$)(d, pos, anchorString, isRotated, isInverted);
|
|
8811
8913
|
node.attr("text-anchor", anchorString);
|
|
@@ -8838,8 +8940,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8838
8940
|
base = base.querySelector("text");
|
|
8839
8941
|
}
|
|
8840
8942
|
var text = base.textContent,
|
|
8841
|
-
cacheKey = KEY.textRect + "-" + text.replace(/\W/g, "_")
|
|
8842
|
-
|
|
8943
|
+
cacheKey = KEY.textRect + "-" + text.replace(/\W/g, "_");
|
|
8944
|
+
var rect = $$.cache.get(cacheKey);
|
|
8843
8945
|
if (!rect) {
|
|
8844
8946
|
$$.$el.svg.append("text").style("visibility", "hidden").style("font", (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(base).style("font")).classed(className, !0).text(text).call(function (v) {
|
|
8845
8947
|
_newArrowCheck(this, _this3);
|
|
@@ -8859,16 +8961,20 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8859
8961
|
generateXYForText: function generateXYForText(indices, forX) {
|
|
8860
8962
|
var _this4 = this,
|
|
8861
8963
|
$$ = this,
|
|
8964
|
+
_$$$state = $$.state,
|
|
8965
|
+
hasRadar = _$$$state.hasRadar,
|
|
8966
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
8862
8967
|
types = Object.keys(indices),
|
|
8863
8968
|
points = {},
|
|
8864
8969
|
getter = forX ? $$.getXForText : $$.getYForText;
|
|
8865
|
-
|
|
8970
|
+
hasRadar && types.push("radar");
|
|
8971
|
+
hasTreemap && types.push("treemap");
|
|
8866
8972
|
types.forEach(function (v) {
|
|
8867
8973
|
_newArrowCheck(this, _this4);
|
|
8868
8974
|
points[v] = $$["generateGet" + capitalize(v) + "Points"](indices[v], !1);
|
|
8869
8975
|
}.bind(this));
|
|
8870
8976
|
return function (d, i) {
|
|
8871
|
-
var type = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar" || $$.isCandlestickType(d) && "candlestick" || $$.isRadarType(d) && "radar" || "line";
|
|
8977
|
+
var type = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar" || $$.isCandlestickType(d) && "candlestick" || $$.isRadarType(d) && "radar" || $$.isTreemapType(d) && "treemap" || "line";
|
|
8872
8978
|
return getter.call($$, points[type](d, i), d, this);
|
|
8873
8979
|
};
|
|
8874
8980
|
},
|
|
@@ -8877,22 +8983,29 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8877
8983
|
* @param {object} d Data object
|
|
8878
8984
|
* @param {Array} points Data points position
|
|
8879
8985
|
* @param {HTMLElement} textElement Data label text element
|
|
8986
|
+
* @param {string} type 'x' or 'y'
|
|
8880
8987
|
* @returns {number} Position value
|
|
8881
8988
|
* @private
|
|
8882
8989
|
*/
|
|
8883
|
-
getCenteredTextPos: function getCenteredTextPos(d, points, textElement) {
|
|
8990
|
+
getCenteredTextPos: function getCenteredTextPos(d, points, textElement, type) {
|
|
8884
8991
|
var $$ = this,
|
|
8885
8992
|
config = $$.config,
|
|
8886
|
-
isRotated = config.axis_rotated
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8993
|
+
isRotated = config.axis_rotated,
|
|
8994
|
+
isBarType = $$.isBarType(d),
|
|
8995
|
+
isTreemapType = $$.isTreemapType(d);
|
|
8996
|
+
if (config.data_labels.centered && (isBarType || isTreemapType)) {
|
|
8997
|
+
var rect = getBoundingRect(textElement);
|
|
8998
|
+
if (isBarType) {
|
|
8999
|
+
var isPositive = d.value >= 0;
|
|
9000
|
+
if (isRotated) {
|
|
9001
|
+
var w = (isPositive ? points[1][1] - points[0][1] : points[0][1] - points[1][1]) / 2 + rect.width / 2;
|
|
9002
|
+
return isPositive ? -w - 3 : w + 2;
|
|
9003
|
+
} else {
|
|
9004
|
+
var h = (isPositive ? points[0][1] - points[1][1] : points[1][1] - points[0][1]) / 2 + rect.height / 2;
|
|
9005
|
+
return isPositive ? h : -h - 2;
|
|
9006
|
+
}
|
|
9007
|
+
} else if (isTreemapType) {
|
|
9008
|
+
return type === "x" ? (points[1][0] - points[0][0]) / 2 : (points[1][1] - points[0][1]) / 2 + rect.height / 2;
|
|
8896
9009
|
}
|
|
8897
9010
|
}
|
|
8898
9011
|
return 0;
|
|
@@ -8921,7 +9034,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8921
9034
|
config = $$.config,
|
|
8922
9035
|
state = $$.state,
|
|
8923
9036
|
isRotated = config.axis_rotated,
|
|
8924
|
-
|
|
9037
|
+
isTreemapType = $$.isTreemapType(d);
|
|
9038
|
+
var xPos = points[0][0];
|
|
8925
9039
|
if ($$.isCandlestickType(d)) {
|
|
8926
9040
|
if (isRotated) {
|
|
8927
9041
|
var _$$$getCandlestickDat2;
|
|
@@ -8929,6 +9043,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8929
9043
|
} else {
|
|
8930
9044
|
xPos += (points[1][0] - xPos) / 2;
|
|
8931
9045
|
}
|
|
9046
|
+
} else if (isTreemapType) {
|
|
9047
|
+
xPos += config.data_labels.centered ? 0 : 5;
|
|
8932
9048
|
} else {
|
|
8933
9049
|
if (isRotated) {
|
|
8934
9050
|
var padding = $$.isBarType(d) ? 4 : 6;
|
|
@@ -8948,8 +9064,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8948
9064
|
xPos = 4;
|
|
8949
9065
|
}
|
|
8950
9066
|
}
|
|
8951
|
-
if (isRotated) {
|
|
8952
|
-
xPos += $$.getCenteredTextPos(d, points, textElement);
|
|
9067
|
+
if (isRotated || isTreemapType) {
|
|
9068
|
+
xPos += $$.getCenteredTextPos(d, points, textElement, "x");
|
|
8953
9069
|
}
|
|
8954
9070
|
return xPos + $$.getTextPos(d.id, "x");
|
|
8955
9071
|
},
|
|
@@ -8969,9 +9085,10 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8969
9085
|
isRotated = config.axis_rotated,
|
|
8970
9086
|
isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"],
|
|
8971
9087
|
isBarType = $$.isBarType(d),
|
|
9088
|
+
isTreemapType = $$.isTreemapType(d),
|
|
8972
9089
|
r = config.point_r,
|
|
8973
|
-
rect = getBoundingRect(textElement)
|
|
8974
|
-
|
|
9090
|
+
rect = getBoundingRect(textElement);
|
|
9091
|
+
var value = d.value,
|
|
8975
9092
|
baseY = 3,
|
|
8976
9093
|
yPos;
|
|
8977
9094
|
if ($$.isCandlestickType(d)) {
|
|
@@ -8985,6 +9102,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8985
9102
|
yPos += 15 * (value._isUp ? 1 : -1);
|
|
8986
9103
|
}
|
|
8987
9104
|
}
|
|
9105
|
+
} else if (isTreemapType) {
|
|
9106
|
+
yPos = points[0][1] + (config.data_labels.centered ? 0 : rect.height + 5);
|
|
8988
9107
|
} else {
|
|
8989
9108
|
if (isRotated) {
|
|
8990
9109
|
yPos = (points[0][0] + points[2][0] + rect.height * .6) / 2;
|
|
@@ -9019,8 +9138,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
9019
9138
|
yPos = state.height - 4;
|
|
9020
9139
|
}
|
|
9021
9140
|
}
|
|
9022
|
-
if (!isRotated) {
|
|
9023
|
-
yPos += $$.getCenteredTextPos(d, points, textElement);
|
|
9141
|
+
if (!isRotated || isTreemapType) {
|
|
9142
|
+
yPos += $$.getCenteredTextPos(d, points, textElement, "y");
|
|
9024
9143
|
}
|
|
9025
9144
|
return yPos + $$.getTextPos(d.id, "y");
|
|
9026
9145
|
},
|
|
@@ -9105,8 +9224,8 @@ function getTextPos(pos, width) {
|
|
|
9105
9224
|
if (pos === void 0) {
|
|
9106
9225
|
pos = "left";
|
|
9107
9226
|
}
|
|
9108
|
-
var isNum = isNumber(width)
|
|
9109
|
-
|
|
9227
|
+
var isNum = isNumber(width);
|
|
9228
|
+
var position;
|
|
9110
9229
|
if (pos.indexOf("center") > -1) {
|
|
9111
9230
|
position = isNum ? width / 2 : "middle";
|
|
9112
9231
|
} else if (pos.indexOf("right") > -1) {
|
|
@@ -9159,8 +9278,8 @@ function getTextPos(pos, width) {
|
|
|
9159
9278
|
config = $$.config,
|
|
9160
9279
|
current = $$.state.current,
|
|
9161
9280
|
position = config.title_position || "left",
|
|
9162
|
-
textRectWidth = $$.getTextRect($$.$el.title, $TEXT.title).width
|
|
9163
|
-
|
|
9281
|
+
textRectWidth = $$.getTextRect($$.$el.title, $TEXT.title).width;
|
|
9282
|
+
var x;
|
|
9164
9283
|
if (/(right|center)/.test(position)) {
|
|
9165
9284
|
x = current.width - textRectWidth;
|
|
9166
9285
|
if (position.indexOf("right") >= 0) {
|
|
@@ -9232,9 +9351,8 @@ function getTextPos(pos, width) {
|
|
|
9232
9351
|
_$$$axis2,
|
|
9233
9352
|
isArc = !(hasAxis && hasRadar);
|
|
9234
9353
|
if ((_$$$axis = $$.axis) != null && _$$$axis.isTimeSeries() && isString(config.tooltip_init_x)) {
|
|
9235
|
-
var targets = $$.data.targets[0]
|
|
9236
|
-
|
|
9237
|
-
val;
|
|
9354
|
+
var targets = $$.data.targets[0];
|
|
9355
|
+
var i, val;
|
|
9238
9356
|
config.tooltip_init_x = parseDate.call($$, config.tooltip_init_x);
|
|
9239
9357
|
for (i = 0; val = targets.values[i]; i++) {
|
|
9240
9358
|
if (val.x - config.tooltip_init_x === 0) {
|
|
@@ -9278,12 +9396,13 @@ function getTextPos(pos, width) {
|
|
|
9278
9396
|
* @returns {string} html
|
|
9279
9397
|
* @private
|
|
9280
9398
|
*/
|
|
9281
|
-
getTooltipContent: function getTooltipContent(d, defaultTitleFormat, defaultValueFormat,
|
|
9399
|
+
getTooltipContent: function getTooltipContent(d, defaultTitleFormat, defaultValueFormat, _color) {
|
|
9282
9400
|
var _this2 = this,
|
|
9283
9401
|
$$ = this,
|
|
9284
9402
|
api = $$.api,
|
|
9285
9403
|
config = $$.config,
|
|
9286
9404
|
state = $$.state,
|
|
9405
|
+
$el = $$.$el,
|
|
9287
9406
|
_map = ["title", "name", "value"].map(function (v) {
|
|
9288
9407
|
_newArrowCheck(this, _this2);
|
|
9289
9408
|
var fn = config["tooltip_format_" + v];
|
|
@@ -9297,7 +9416,7 @@ function getTextPos(pos, width) {
|
|
|
9297
9416
|
_newArrowCheck(this, _this2);
|
|
9298
9417
|
return name;
|
|
9299
9418
|
}.bind(this);
|
|
9300
|
-
valueFormat = valueFormat || ($$.isStackNormalized() ? function (v, ratio) {
|
|
9419
|
+
valueFormat = valueFormat || (state.hasTreemap || $$.isStackNormalized() ? function (v, ratio) {
|
|
9301
9420
|
_newArrowCheck(this, _this2);
|
|
9302
9421
|
return (ratio * 100).toFixed(2) + "%";
|
|
9303
9422
|
}.bind(this) : defaultValueFormat);
|
|
@@ -9311,7 +9430,7 @@ function getTextPos(pos, width) {
|
|
|
9311
9430
|
return $$.levelColor(row.value);
|
|
9312
9431
|
}.bind(this) : function (row) {
|
|
9313
9432
|
_newArrowCheck(this, _this2);
|
|
9314
|
-
return
|
|
9433
|
+
return _color(row);
|
|
9315
9434
|
}.bind(this),
|
|
9316
9435
|
contents = config.tooltip_contents,
|
|
9317
9436
|
tplStr = contents.template,
|
|
@@ -9343,16 +9462,13 @@ function getTextPos(pos, width) {
|
|
|
9343
9462
|
d.sort(order.bind(api));
|
|
9344
9463
|
}
|
|
9345
9464
|
var tpl = $$.getTooltipContentTemplate(tplStr),
|
|
9346
|
-
len = d.length
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
value,
|
|
9351
|
-
i;
|
|
9352
|
-
for (i = 0; i < len; i++) {
|
|
9465
|
+
len = d.length;
|
|
9466
|
+
var text, row, param, value, i;
|
|
9467
|
+
var _loop = function () {
|
|
9468
|
+
var _this3 = this;
|
|
9353
9469
|
row = d[i];
|
|
9354
9470
|
if (!row || !(getRowValue(row) || getRowValue(row) === 0)) {
|
|
9355
|
-
continue;
|
|
9471
|
+
return "continue";
|
|
9356
9472
|
}
|
|
9357
9473
|
if (isUndefined(text)) {
|
|
9358
9474
|
var title = (state.hasAxis || state.hasRadar) && sanitise(titleFormat ? titleFormat(row.x) : row.x);
|
|
@@ -9361,14 +9477,15 @@ function getTextPos(pos, width) {
|
|
|
9361
9477
|
TITLE: isValue(title) ? tplStr ? title : "<tr><th colspan=\"2\">" + title + "</th></tr>" : ""
|
|
9362
9478
|
});
|
|
9363
9479
|
}
|
|
9364
|
-
if (!row.ratio &&
|
|
9365
|
-
|
|
9480
|
+
if (!row.ratio && $el.arcs) {
|
|
9481
|
+
param = ["arc", $$.$el.arcs.select("path." + $ARC.arc + "-" + row.id).data()[0]];
|
|
9482
|
+
row.ratio = $$.getRatio.apply($$, param);
|
|
9366
9483
|
}
|
|
9367
9484
|
param = [row.ratio, row.id, row.index, d];
|
|
9368
9485
|
value = sanitise(valueFormat.apply(void 0, [getRowValue(row)].concat(param)));
|
|
9369
9486
|
if ($$.isAreaRangeType(row)) {
|
|
9370
9487
|
var _map2 = ["high", "low"].map(function (v) {
|
|
9371
|
-
_newArrowCheck(this,
|
|
9488
|
+
_newArrowCheck(this, _this3);
|
|
9372
9489
|
return sanitise(valueFormat.apply(void 0, [$$.getRangedData(row, v)].concat(param)));
|
|
9373
9490
|
}.bind(this)),
|
|
9374
9491
|
high = _map2[0],
|
|
@@ -9376,7 +9493,7 @@ function getTextPos(pos, width) {
|
|
|
9376
9493
|
value = "<b>Mid:</b> " + value + " <b>High:</b> " + high + " <b>Low:</b> " + low;
|
|
9377
9494
|
} else if ($$.isCandlestickType(row)) {
|
|
9378
9495
|
var _map3 = ["open", "high", "low", "close", "volume"].map(function (v) {
|
|
9379
|
-
_newArrowCheck(this,
|
|
9496
|
+
_newArrowCheck(this, _this3);
|
|
9380
9497
|
return sanitise(valueFormat.apply(void 0, [$$.getRangedData(row, v, "candlestick")].concat(param)));
|
|
9381
9498
|
}.bind(this)),
|
|
9382
9499
|
open = _map3[0],
|
|
@@ -9392,31 +9509,31 @@ function getTextPos(pos, width) {
|
|
|
9392
9509
|
value = valueFormat(start) + " ~ " + valueFormat(end);
|
|
9393
9510
|
}
|
|
9394
9511
|
if (value !== undefined) {
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
}
|
|
9416
|
-
text += tplProcess(tpl[1], contentValue);
|
|
9417
|
-
}();
|
|
9418
|
-
if (_ret === "continue") continue;
|
|
9512
|
+
// Skip elements when their name is set to null
|
|
9513
|
+
if (row.name === null) {
|
|
9514
|
+
return "continue";
|
|
9515
|
+
}
|
|
9516
|
+
var name = sanitise(nameFormat.apply(void 0, [row.name].concat(param))),
|
|
9517
|
+
_color = getBgColor(row),
|
|
9518
|
+
contentValue = {
|
|
9519
|
+
CLASS_TOOLTIP_NAME: $TOOLTIP.tooltipName + $$.getTargetSelectorSuffix(row.id),
|
|
9520
|
+
COLOR: tplStr || !$$.patterns ? _color : "<svg><rect style=\"fill:" + _color + "\" width=\"10\" height=\"10\"></rect></svg>",
|
|
9521
|
+
NAME: name,
|
|
9522
|
+
VALUE: value
|
|
9523
|
+
};
|
|
9524
|
+
if (tplStr && isObject(contents.text)) {
|
|
9525
|
+
var index = targetIds.indexOf(row.id);
|
|
9526
|
+
Object.keys(contents.text).forEach(function (key) {
|
|
9527
|
+
_newArrowCheck(this, _this3);
|
|
9528
|
+
contentValue[key] = contents.text[key][index];
|
|
9529
|
+
}.bind(this));
|
|
9530
|
+
}
|
|
9531
|
+
text += tplProcess(tpl[1], contentValue);
|
|
9419
9532
|
}
|
|
9533
|
+
};
|
|
9534
|
+
for (i = 0; i < len; i++) {
|
|
9535
|
+
var _ret = _loop();
|
|
9536
|
+
if (_ret === "continue") continue;
|
|
9420
9537
|
}
|
|
9421
9538
|
return text + "</table>";
|
|
9422
9539
|
},
|
|
@@ -9452,6 +9569,7 @@ function getTextPos(pos, width) {
|
|
|
9452
9569
|
inputType = _state.inputType,
|
|
9453
9570
|
event = _state.event,
|
|
9454
9571
|
hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
|
|
9572
|
+
hasTreemap = state.hasTreemap,
|
|
9455
9573
|
svgLeft = $$.getSvgLeft(!0),
|
|
9456
9574
|
chartRight = svgLeft + current.width - $$.getCurrentPaddingRight(),
|
|
9457
9575
|
chartLeft = $$.getCurrentPaddingLeft(!0),
|
|
@@ -9465,7 +9583,7 @@ function getTextPos(pos, width) {
|
|
|
9465
9583
|
y += hasGauge ? height : height / 2;
|
|
9466
9584
|
x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
|
|
9467
9585
|
}
|
|
9468
|
-
} else {
|
|
9586
|
+
} else if (!hasTreemap) {
|
|
9469
9587
|
var dataScale = scale.x(dataToShow[0].x);
|
|
9470
9588
|
if (config.axis_rotated) {
|
|
9471
9589
|
y = dataScale + 20;
|
|
@@ -9473,16 +9591,17 @@ function getTextPos(pos, width) {
|
|
|
9473
9591
|
chartRight -= svgLeft;
|
|
9474
9592
|
} else {
|
|
9475
9593
|
y -= 5;
|
|
9476
|
-
x = svgLeft + chartLeft + 20 + (
|
|
9594
|
+
x = svgLeft + chartLeft + 20 + (scale.zoom ? x : dataScale);
|
|
9477
9595
|
}
|
|
9478
9596
|
}
|
|
9479
9597
|
|
|
9480
9598
|
// when tooltip left + tWidth > chart's width
|
|
9481
9599
|
if (x + tWidth + 15 > chartRight) {
|
|
9482
|
-
x -= tWidth + chartLeft;
|
|
9600
|
+
x -= tWidth + (hasTreemap ? 0 : chartLeft);
|
|
9483
9601
|
}
|
|
9484
9602
|
if (y + tHeight > current.height) {
|
|
9485
|
-
|
|
9603
|
+
var gap = hasTreemap ? 0 : 30;
|
|
9604
|
+
y -= hasGauge ? tHeight * 3 : tHeight + gap;
|
|
9486
9605
|
}
|
|
9487
9606
|
var pos = {
|
|
9488
9607
|
top: y,
|
|
@@ -9524,8 +9643,8 @@ function getTextPos(pos, width) {
|
|
|
9524
9643
|
_ref$width = _ref.width,
|
|
9525
9644
|
width = _ref$width === void 0 ? 0 : _ref$width,
|
|
9526
9645
|
_ref$height = _ref.height,
|
|
9527
|
-
height = _ref$height === void 0 ? 0 : _ref$height
|
|
9528
|
-
|
|
9646
|
+
height = _ref$height === void 0 ? 0 : _ref$height;
|
|
9647
|
+
var dataStr = JSON.stringify(selectedData);
|
|
9529
9648
|
if (!datum || datum.current !== dataStr) {
|
|
9530
9649
|
var index = selectedData.concat().sort()[0].index;
|
|
9531
9650
|
callFn(config.tooltip_onshow, $$.api, selectedData);
|
|
@@ -9594,9 +9713,10 @@ function getTextPos(pos, width) {
|
|
|
9594
9713
|
var current = state.current,
|
|
9595
9714
|
_tooltip$datum = tooltip.datum(),
|
|
9596
9715
|
width = _tooltip$datum.width,
|
|
9597
|
-
xPosInPercent = _tooltip$datum.xPosInPercent
|
|
9598
|
-
|
|
9599
|
-
|
|
9716
|
+
xPosInPercent = _tooltip$datum.xPosInPercent;
|
|
9717
|
+
var _value = current.width / 100 * xPosInPercent;
|
|
9718
|
+
var diff = current.width - (_value + width);
|
|
9719
|
+
|
|
9600
9720
|
// if tooltip size overs current viewport size
|
|
9601
9721
|
if (diff < 0) {
|
|
9602
9722
|
_value += diff;
|
|
@@ -9680,8 +9800,8 @@ function getTextPos(pos, width) {
|
|
|
9680
9800
|
var $$ = this,
|
|
9681
9801
|
config = $$.config,
|
|
9682
9802
|
state = $$.state,
|
|
9683
|
-
isRotated = config.axis_rotated
|
|
9684
|
-
|
|
9803
|
+
isRotated = config.axis_rotated;
|
|
9804
|
+
var padding = 0,
|
|
9685
9805
|
x,
|
|
9686
9806
|
y;
|
|
9687
9807
|
if (index && /^(x|y2?)$/.test(target)) {
|
|
@@ -9738,9 +9858,11 @@ function getTextPos(pos, width) {
|
|
|
9738
9858
|
transformAll: function transformAll(withTransition, transitions) {
|
|
9739
9859
|
var $$ = this,
|
|
9740
9860
|
config = $$.config,
|
|
9741
|
-
|
|
9861
|
+
_$$$state = $$.state,
|
|
9862
|
+
hasAxis = _$$$state.hasAxis,
|
|
9863
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
9742
9864
|
$el = $$.$el;
|
|
9743
|
-
$$.transformMain(withTransition, transitions);
|
|
9865
|
+
hasTreemap || $$.transformMain(withTransition, transitions);
|
|
9744
9866
|
hasAxis && config.subchart_show && $$.transformContext(withTransition, transitions);
|
|
9745
9867
|
$el.legend && $$.transformLegend(withTransition);
|
|
9746
9868
|
}
|
|
@@ -9809,8 +9931,8 @@ function getTextPos(pos, width) {
|
|
|
9809
9931
|
config = $$.config,
|
|
9810
9932
|
current = $$.state.current,
|
|
9811
9933
|
types = config.data_types,
|
|
9812
|
-
targets = targetsValue || $$.data.targets
|
|
9813
|
-
|
|
9934
|
+
targets = targetsValue || $$.data.targets;
|
|
9935
|
+
var has = !1;
|
|
9814
9936
|
if (!checkFromData && ((_current$types = current.types) == null ? void 0 : _current$types.indexOf(type)) > -1) {
|
|
9815
9937
|
has = !0;
|
|
9816
9938
|
} else if (targets != null && targets.length) {
|
|
@@ -9914,6 +10036,9 @@ function getTextPos(pos, width) {
|
|
|
9914
10036
|
isScatterType: function isScatterType(d) {
|
|
9915
10037
|
return this.isTypeOf(d, "scatter");
|
|
9916
10038
|
},
|
|
10039
|
+
isTreemapType: function isTreemapType(d) {
|
|
10040
|
+
return this.isTypeOf(d, "treemap");
|
|
10041
|
+
},
|
|
9917
10042
|
isPieType: function isPieType(d) {
|
|
9918
10043
|
return this.isTypeOf(d, "pie");
|
|
9919
10044
|
},
|
|
@@ -9935,8 +10060,8 @@ function getTextPos(pos, width) {
|
|
|
9935
10060
|
// determine if is 'circle' data point
|
|
9936
10061
|
isCirclePoint: function isCirclePoint(node) {
|
|
9937
10062
|
var config = this.config,
|
|
9938
|
-
pattern = config.point_pattern
|
|
9939
|
-
|
|
10063
|
+
pattern = config.point_pattern;
|
|
10064
|
+
var isCircle = !1;
|
|
9940
10065
|
if ((node == null ? void 0 : node.tagName) === "circle") {
|
|
9941
10066
|
isCircle = !0;
|
|
9942
10067
|
} else {
|
|
@@ -9958,7 +10083,7 @@ function getTextPos(pos, width) {
|
|
|
9958
10083
|
*/
|
|
9959
10084
|
labelishData: function labelishData(d) {
|
|
9960
10085
|
var _this5 = this;
|
|
9961
|
-
return this.isBarType(d) || this.isLineType(d) || this.isScatterType(d) || this.isBubbleType(d) || this.isCandlestickType(d) || this.isRadarType(d) ? d.values.filter(function (v) {
|
|
10086
|
+
return this.isBarType(d) || this.isLineType(d) || this.isScatterType(d) || this.isBubbleType(d) || this.isCandlestickType(d) || this.isRadarType(d) || this.isTreemapType(d) ? d.values.filter(function (v) {
|
|
9962
10087
|
_newArrowCheck(this, _this5);
|
|
9963
10088
|
return isNumber(v.value) || !!v.value;
|
|
9964
10089
|
}.bind(this)) : [];
|
|
@@ -10106,8 +10231,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10106
10231
|
var config = this.config,
|
|
10107
10232
|
state = this.state,
|
|
10108
10233
|
duration = config.transition_duration,
|
|
10109
|
-
subchart = config.subchart_show
|
|
10110
|
-
|
|
10234
|
+
subchart = config.subchart_show;
|
|
10235
|
+
var t = selection;
|
|
10111
10236
|
if (t) {
|
|
10112
10237
|
// in case of non d3 selection, wrap with d3 selection
|
|
10113
10238
|
if ("tagName" in t) {
|
|
@@ -10145,8 +10270,9 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10145
10270
|
$el = $$.$el,
|
|
10146
10271
|
useCssRule = config.boost_useCssRule;
|
|
10147
10272
|
checkModuleImport($$);
|
|
10148
|
-
state.hasAxis = !$$.hasArcType();
|
|
10149
10273
|
state.hasRadar = !state.hasAxis && $$.hasType("radar");
|
|
10274
|
+
state.hasTreemap = !state.hasAxis && $$.hasType("treemap");
|
|
10275
|
+
state.hasAxis = !$$.hasArcType() && !state.hasTreemap;
|
|
10150
10276
|
|
|
10151
10277
|
// datetime to be used for uniqueness
|
|
10152
10278
|
state.datetimeId = "bb-" + +new Date() * getRandom();
|
|
@@ -10242,8 +10368,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10242
10368
|
if ($$.hasPointType()) {
|
|
10243
10369
|
$$.point = $$.generatePoint();
|
|
10244
10370
|
}
|
|
10371
|
+
$$.initClip();
|
|
10245
10372
|
if (state.hasAxis) {
|
|
10246
|
-
$$.initClip();
|
|
10247
10373
|
format.extraLineClasses = $$.generateExtraLineClass();
|
|
10248
10374
|
format.dataTime = config.data_xLocaltime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.timeParse : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.utcParse;
|
|
10249
10375
|
format.axisTime = config.axis_x_localtime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.timeFormat : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.utcFormat;
|
|
@@ -10274,7 +10400,9 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10274
10400
|
state = $$.state,
|
|
10275
10401
|
$el = $$.$el,
|
|
10276
10402
|
org = $$.org,
|
|
10277
|
-
|
|
10403
|
+
_state = state,
|
|
10404
|
+
hasAxis = _state.hasAxis,
|
|
10405
|
+
hasTreemap = _state.hasTreemap,
|
|
10278
10406
|
hasInteraction = config.interaction_enabled,
|
|
10279
10407
|
hasPolar = $$.hasType("polar");
|
|
10280
10408
|
// for arc type, set axes to not be shown
|
|
@@ -10305,28 +10433,30 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10305
10433
|
$$.updateScales(!0);
|
|
10306
10434
|
|
|
10307
10435
|
// retrieve scale after the 'updateScales()' is called
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
x
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10436
|
+
if (hasAxis) {
|
|
10437
|
+
var x = scale.x,
|
|
10438
|
+
y = scale.y,
|
|
10439
|
+
y2 = scale.y2,
|
|
10440
|
+
subX = scale.subX,
|
|
10441
|
+
subY = scale.subY,
|
|
10442
|
+
subY2 = scale.subY2;
|
|
10443
|
+
|
|
10444
|
+
// Set domains for each scale
|
|
10445
|
+
if (x) {
|
|
10446
|
+
x.domain(sortValue($$.getXDomain($$.data.targets)));
|
|
10447
|
+
subX.domain(x.domain());
|
|
10448
|
+
|
|
10449
|
+
// Save original x domain for zoom update
|
|
10450
|
+
org.xDomain = x.domain();
|
|
10451
|
+
}
|
|
10452
|
+
if (y) {
|
|
10453
|
+
y.domain($$.getYDomain($$.data.targets, "y"));
|
|
10454
|
+
subY.domain(y.domain());
|
|
10455
|
+
}
|
|
10456
|
+
if (y2) {
|
|
10457
|
+
y2.domain($$.getYDomain($$.data.targets, "y2"));
|
|
10458
|
+
subY2 && subY2.domain(y2.domain());
|
|
10459
|
+
}
|
|
10330
10460
|
}
|
|
10331
10461
|
|
|
10332
10462
|
// -- Basic Elements --
|
|
@@ -10342,7 +10472,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10342
10472
|
|
|
10343
10473
|
// Define defs
|
|
10344
10474
|
var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
|
10345
|
-
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors
|
|
10475
|
+
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || config.data_labels_backgroundColors) {
|
|
10346
10476
|
$el.defs = $el.svg.append("defs");
|
|
10347
10477
|
if (hasAxis) {
|
|
10348
10478
|
["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
|
@@ -10372,14 +10502,14 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10372
10502
|
$$.bindResize();
|
|
10373
10503
|
|
|
10374
10504
|
// Define regions
|
|
10375
|
-
var main = $el.svg.append("g").classed($COMMON.main, !0).attr("transform", $$.getTranslate("main"));
|
|
10505
|
+
var main = $el.svg.append("g").classed($COMMON.main, !0).attr("transform", hasTreemap ? null : $$.getTranslate("main"));
|
|
10376
10506
|
$el.main = main;
|
|
10377
10507
|
|
|
10378
10508
|
// initialize subchart when subchart show option is set
|
|
10379
10509
|
config.subchart_show && $$.initSubchart();
|
|
10380
10510
|
config.tooltip_show && $$.initTooltip();
|
|
10381
10511
|
config.title_text && $$.initTitle();
|
|
10382
|
-
config.legend_show && $$.initLegend();
|
|
10512
|
+
!hasTreemap && config.legend_show && $$.initLegend();
|
|
10383
10513
|
|
|
10384
10514
|
// -- Main Region --
|
|
10385
10515
|
|
|
@@ -10453,6 +10583,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10453
10583
|
_$$$state = $$.state,
|
|
10454
10584
|
hasAxis = _$$$state.hasAxis,
|
|
10455
10585
|
hasRadar = _$$$state.hasRadar,
|
|
10586
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
10456
10587
|
types = [];
|
|
10457
10588
|
if (hasAxis) {
|
|
10458
10589
|
["bar", "bubble", "candlestick", "line"].forEach(function (v) {
|
|
@@ -10462,6 +10593,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10462
10593
|
types.push(name);
|
|
10463
10594
|
}
|
|
10464
10595
|
}.bind(this));
|
|
10596
|
+
} else if (hasTreemap) {
|
|
10597
|
+
types.push("Treemap");
|
|
10465
10598
|
} else {
|
|
10466
10599
|
var hasPolar = $$.hasType("polar");
|
|
10467
10600
|
if (!hasRadar) {
|
|
@@ -10560,6 +10693,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10560
10693
|
_$$$state2 = $$.state,
|
|
10561
10694
|
hasAxis = _$$$state2.hasAxis,
|
|
10562
10695
|
hasRadar = _$$$state2.hasRadar,
|
|
10696
|
+
hasTreemap = _$$$state2.hasTreemap,
|
|
10563
10697
|
helper = function (type) {
|
|
10564
10698
|
_newArrowCheck(this, _this6);
|
|
10565
10699
|
return $$["updateTargetsFor" + type](targets.filter($$["is" + type + "Type"].bind($$)));
|
|
@@ -10587,6 +10721,9 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10587
10721
|
type = "Polar";
|
|
10588
10722
|
}
|
|
10589
10723
|
helper(type);
|
|
10724
|
+
// Arc, Polar, Radar
|
|
10725
|
+
} else if (hasTreemap) {
|
|
10726
|
+
helper("Treemap");
|
|
10590
10727
|
}
|
|
10591
10728
|
|
|
10592
10729
|
// Point types
|
|
@@ -10611,8 +10748,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10611
10748
|
}
|
|
10612
10749
|
var $$ = this,
|
|
10613
10750
|
svg = $$.$el.svg,
|
|
10614
|
-
$T = $$.$T
|
|
10615
|
-
|
|
10751
|
+
$T = $$.$T;
|
|
10752
|
+
var selector = "." + $COMMON.target;
|
|
10616
10753
|
if (hasPointType) {
|
|
10617
10754
|
selector += ", ." + $CIRCLE.chartCircles + " > ." + $CIRCLE.circles;
|
|
10618
10755
|
}
|
|
@@ -10738,12 +10875,12 @@ function loadConfig(config) {
|
|
|
10738
10875
|
target,
|
|
10739
10876
|
keys,
|
|
10740
10877
|
read,
|
|
10741
|
-
|
|
10878
|
+
_find = function find() {
|
|
10742
10879
|
_newArrowCheck(this, _this);
|
|
10743
10880
|
var key = keys.shift();
|
|
10744
10881
|
if (key && target && isObjectType(target) && key in target) {
|
|
10745
10882
|
target = target[key];
|
|
10746
|
-
return
|
|
10883
|
+
return _find();
|
|
10747
10884
|
} else if (!key) {
|
|
10748
10885
|
return target;
|
|
10749
10886
|
}
|
|
@@ -10753,7 +10890,7 @@ function loadConfig(config) {
|
|
|
10753
10890
|
_newArrowCheck(this, _this);
|
|
10754
10891
|
target = config;
|
|
10755
10892
|
keys = key.split("_");
|
|
10756
|
-
read =
|
|
10893
|
+
read = _find();
|
|
10757
10894
|
if (isDefined(read)) {
|
|
10758
10895
|
thisConfig[key] = read;
|
|
10759
10896
|
}
|
|
@@ -10946,8 +11083,8 @@ function loadConfig(config) {
|
|
|
10946
11083
|
var $$ = this.internal,
|
|
10947
11084
|
config = $$.config,
|
|
10948
11085
|
state = $$.state,
|
|
10949
|
-
key = name == null ? void 0 : name.replace(/\./g, "_")
|
|
10950
|
-
|
|
11086
|
+
key = name == null ? void 0 : name.replace(/\./g, "_");
|
|
11087
|
+
var res;
|
|
10951
11088
|
if (name && key in config) {
|
|
10952
11089
|
if (isDefined(value)) {
|
|
10953
11090
|
config[key] = value;
|
|
@@ -11615,6 +11752,7 @@ function renderText(ctx, glyph) {
|
|
|
11615
11752
|
var legend_legend = {
|
|
11616
11753
|
/**
|
|
11617
11754
|
* Show legend for each target.
|
|
11755
|
+
* - **NOTE:** Legend APIs aren't supported for `treemap` type.
|
|
11618
11756
|
* @function legend․show
|
|
11619
11757
|
* @instance
|
|
11620
11758
|
* @memberof Chart
|
|
@@ -11854,6 +11992,7 @@ var legend_legend = {
|
|
|
11854
11992
|
}.bind(this));
|
|
11855
11993
|
}.bind(this));
|
|
11856
11994
|
} else {
|
|
11995
|
+
$$.api.tooltip.hide();
|
|
11857
11996
|
$$.loadFromArgs(args);
|
|
11858
11997
|
}
|
|
11859
11998
|
},
|
|
@@ -12094,6 +12233,13 @@ var tooltip_tooltip = {
|
|
|
12094
12233
|
* x: new Date("2018-01-02 00:00")
|
|
12095
12234
|
* });
|
|
12096
12235
|
*
|
|
12236
|
+
* // treemap type can be shown by using "id" only.
|
|
12237
|
+
* chart.tooltip.show({
|
|
12238
|
+
* data: {
|
|
12239
|
+
* id: "data1" // data id
|
|
12240
|
+
* }
|
|
12241
|
+
* });
|
|
12242
|
+
*
|
|
12097
12243
|
* // when data.xs is used
|
|
12098
12244
|
* chart.tooltip.show({
|
|
12099
12245
|
* data: {
|
|
@@ -12115,8 +12261,12 @@ var tooltip_tooltip = {
|
|
|
12115
12261
|
show: function show(args) {
|
|
12116
12262
|
var _this = this,
|
|
12117
12263
|
$$ = this.internal,
|
|
12264
|
+
$el = $$.$el,
|
|
12118
12265
|
config = $$.config,
|
|
12119
|
-
|
|
12266
|
+
_$$$state = $$.state,
|
|
12267
|
+
eventReceiver = _$$$state.eventReceiver,
|
|
12268
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
12269
|
+
inputType = _$$$state.inputType,
|
|
12120
12270
|
index,
|
|
12121
12271
|
mouse;
|
|
12122
12272
|
// determine mouse position on the chart
|
|
@@ -12128,7 +12278,9 @@ var tooltip_tooltip = {
|
|
|
12128
12278
|
if (args.data) {
|
|
12129
12279
|
var data = args.data,
|
|
12130
12280
|
y = $$.getYScaleById(data.id)(data.value);
|
|
12131
|
-
if (
|
|
12281
|
+
if (hasTreemap && data.id) {
|
|
12282
|
+
eventReceiver.rect = $el.main.select("" + $$.selectorTarget(data.id, undefined, "rect"));
|
|
12283
|
+
} else if ($$.isMultipleX()) {
|
|
12132
12284
|
// if multiple xs, target point will be determined by mouse
|
|
12133
12285
|
mouse = [$$.scale.x(data.x), y];
|
|
12134
12286
|
} else {
|
|
@@ -13327,8 +13479,8 @@ var AxisRendererHelper = /*#__PURE__*/function () {
|
|
|
13327
13479
|
return isDefined(formatted) ? formatted : "";
|
|
13328
13480
|
};
|
|
13329
13481
|
_proto.transitionise = function transitionise(selection) {
|
|
13330
|
-
var config = this.config
|
|
13331
|
-
|
|
13482
|
+
var config = this.config;
|
|
13483
|
+
var transitionSelection = selection;
|
|
13332
13484
|
if (config.withoutTransition) {
|
|
13333
13485
|
transitionSelection = selection.interrupt();
|
|
13334
13486
|
} else if (config.transition || !this.owner.params.noTransition) {
|
|
@@ -13419,8 +13571,8 @@ var AxisRenderer = /*#__PURE__*/function () {
|
|
|
13419
13571
|
tickShow = {
|
|
13420
13572
|
tick: axisShow ? params.config[prefix + "_tick_show"] : !1,
|
|
13421
13573
|
text: axisShow ? params.config[prefix + "_tick_text_show"] : !1
|
|
13422
|
-
}
|
|
13423
|
-
|
|
13574
|
+
}; // // get the axis' tick position configuration
|
|
13575
|
+
var $g;
|
|
13424
13576
|
g.each(function () {
|
|
13425
13577
|
var _this = this,
|
|
13426
13578
|
g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
@@ -13449,28 +13601,30 @@ var AxisRenderer = /*#__PURE__*/function () {
|
|
|
13449
13601
|
ctx.generatedTicks = ticks;
|
|
13450
13602
|
|
|
13451
13603
|
// update selection
|
|
13452
|
-
var tick = g.selectAll(".tick").data(ticks, scale1)
|
|
13453
|
-
|
|
13454
|
-
|
|
13604
|
+
var tick = g.selectAll(".tick").data(ticks, scale1);
|
|
13605
|
+
|
|
13606
|
+
// enter selection
|
|
13607
|
+
var tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick"),
|
|
13608
|
+
tickExit = tick.exit().remove(); // MEMO: No exit transition. The reason is this transition affects max tick width calculation because old tick will be included in the ticks.
|
|
13455
13609
|
// enter + update selection
|
|
13456
13610
|
tick = tickEnter.merge(tick);
|
|
13457
13611
|
tickShow.tick && tickEnter.append("line");
|
|
13458
13612
|
tickShow.text && tickEnter.append("text");
|
|
13459
13613
|
var sizeFor1Char = AxisRendererHelper.getSizeFor1Char(tick),
|
|
13460
|
-
counts = []
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
|
|
13470
|
-
|
|
13471
|
-
|
|
13472
|
-
}.bind(this));
|
|
13614
|
+
counts = [];
|
|
13615
|
+
var tspan = tick.select("text").selectAll("tspan").data(function (d, index) {
|
|
13616
|
+
var _this2 = this;
|
|
13617
|
+
_newArrowCheck(this, _this);
|
|
13618
|
+
var split = params.tickMultiline ? splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w) : isArray(helper.textFormatted(d)) ? helper.textFormatted(d).concat() : [helper.textFormatted(d)];
|
|
13619
|
+
counts[index] = split.length;
|
|
13620
|
+
return split.map(function (splitted) {
|
|
13621
|
+
_newArrowCheck(this, _this2);
|
|
13622
|
+
return {
|
|
13623
|
+
index: index,
|
|
13624
|
+
splitted: splitted
|
|
13625
|
+
};
|
|
13473
13626
|
}.bind(this));
|
|
13627
|
+
}.bind(this));
|
|
13474
13628
|
tspan.exit().remove();
|
|
13475
13629
|
tspan = tspan.enter().append("tspan").merge(tspan).text(function (d) {
|
|
13476
13630
|
_newArrowCheck(this, _this);
|
|
@@ -13542,9 +13696,9 @@ var AxisRenderer = /*#__PURE__*/function () {
|
|
|
13542
13696
|
*/;
|
|
13543
13697
|
_proto.getGeneratedTicks = function getGeneratedTicks(count) {
|
|
13544
13698
|
var _this$generatedTicks,
|
|
13699
|
+
_this3 = this,
|
|
13545
13700
|
len = ((_this$generatedTicks = this.generatedTicks) == null ? void 0 : _this$generatedTicks.length) - 1,
|
|
13546
|
-
res = this.generatedTicks
|
|
13547
|
-
_this3 = this;
|
|
13701
|
+
res = this.generatedTicks;
|
|
13548
13702
|
if (len > count) {
|
|
13549
13703
|
var interval = Math.round(len / count + .1);
|
|
13550
13704
|
res = this.generatedTicks.map(function (v, i) {
|
|
@@ -13754,7 +13908,8 @@ var AxisRenderer = /*#__PURE__*/function () {
|
|
|
13754
13908
|
return interval === Infinity ? 0 : interval;
|
|
13755
13909
|
};
|
|
13756
13910
|
_proto.ticks = function ticks() {
|
|
13757
|
-
|
|
13911
|
+
var config = this.config;
|
|
13912
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
13758
13913
|
args[_key] = arguments[_key];
|
|
13759
13914
|
}
|
|
13760
13915
|
if (!args.length) {
|
|
@@ -13997,8 +14152,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
13997
14152
|
}.bind(this))) {
|
|
13998
14153
|
v.scale().range(range);
|
|
13999
14154
|
}
|
|
14000
|
-
var className = this.getAxisClassName(id) + "-" + (i + 1)
|
|
14001
|
-
|
|
14155
|
+
var className = this.getAxisClassName(id) + "-" + (i + 1);
|
|
14156
|
+
var g = main.select("." + className.replace(/\s/, "."));
|
|
14002
14157
|
if (g.empty()) {
|
|
14003
14158
|
g = main.append("g").attr("class", className).style("visibility", config["axis_" + id + "_show"] ? null : "hidden").call(v);
|
|
14004
14159
|
} else {
|
|
@@ -14052,21 +14207,21 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14052
14207
|
tickFormat = fn.bind($$.api);
|
|
14053
14208
|
}
|
|
14054
14209
|
}
|
|
14055
|
-
var tickValues = this.tick[type]
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
|
|
14061
|
-
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14210
|
+
var tickValues = this.tick[type];
|
|
14211
|
+
var axisParams = mergeObj({
|
|
14212
|
+
outerTick: outerTick,
|
|
14213
|
+
noTransition: noTransition,
|
|
14214
|
+
config: config,
|
|
14215
|
+
id: id,
|
|
14216
|
+
tickTextRotate: tickTextRotate,
|
|
14217
|
+
owner: $$
|
|
14218
|
+
}, isX && {
|
|
14219
|
+
isCategory: isCategory,
|
|
14220
|
+
tickMultiline: config.axis_x_tick_multiline,
|
|
14221
|
+
tickWidth: config.axis_x_tick_width,
|
|
14222
|
+
tickTitle: isCategory && config.axis_x_tick_tooltip && $$.api.categories(),
|
|
14223
|
+
orgXScale: $$.scale.x
|
|
14224
|
+
});
|
|
14070
14225
|
if (!isX) {
|
|
14071
14226
|
axisParams.tickStepSize = config["axis_" + type + "_tick_stepSize"];
|
|
14072
14227
|
}
|
|
@@ -14102,8 +14257,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14102
14257
|
_proto.updateXAxisTickValues = function updateXAxisTickValues(targets, axis) {
|
|
14103
14258
|
var $$ = this.owner,
|
|
14104
14259
|
config = $$.config,
|
|
14105
|
-
fit = config.axis_x_tick_fit
|
|
14106
|
-
|
|
14260
|
+
fit = config.axis_x_tick_fit;
|
|
14261
|
+
var count = config.axis_x_tick_count,
|
|
14107
14262
|
values;
|
|
14108
14263
|
if (fit || count && fit) {
|
|
14109
14264
|
values = $$.mapTargetsToUniqueXs(targets);
|
|
@@ -14126,8 +14281,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14126
14281
|
_proto.getId = function getId(id) {
|
|
14127
14282
|
var _this$owner2 = this.owner,
|
|
14128
14283
|
config = _this$owner2.config,
|
|
14129
|
-
scale = _this$owner2.scale
|
|
14130
|
-
|
|
14284
|
+
scale = _this$owner2.scale;
|
|
14285
|
+
var axis = config.data_axes[id];
|
|
14286
|
+
|
|
14131
14287
|
// when data.axes option has 'y2', but 'axis.y2.show=true' isn't set will return 'y'
|
|
14132
14288
|
if (!axis || !scale[axis]) {
|
|
14133
14289
|
axis = "y";
|
|
@@ -14217,8 +14373,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14217
14373
|
_$$$state = $$.state,
|
|
14218
14374
|
width = _$$$state.width,
|
|
14219
14375
|
height = _$$$state.height,
|
|
14220
|
-
position = this.getAxisLabelPosition(id)
|
|
14221
|
-
|
|
14376
|
+
position = this.getAxisLabelPosition(id);
|
|
14377
|
+
var x = position.isMiddle ? -height / 2 : 0;
|
|
14222
14378
|
if (this.isHorizontal($$, id !== "x")) {
|
|
14223
14379
|
x = position.isLeft ? 0 : position.isCenter ? width / 2 : width;
|
|
14224
14380
|
} else if (position.isBottom) {
|
|
@@ -14228,8 +14384,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14228
14384
|
};
|
|
14229
14385
|
_proto.dxForAxisLabel = function dxForAxisLabel(id) {
|
|
14230
14386
|
var $$ = this.owner,
|
|
14231
|
-
position = this.getAxisLabelPosition(id)
|
|
14232
|
-
|
|
14387
|
+
position = this.getAxisLabelPosition(id);
|
|
14388
|
+
var dx = position.isBottom ? "0.5em" : "0";
|
|
14233
14389
|
if (this.isHorizontal($$, id !== "x")) {
|
|
14234
14390
|
dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0";
|
|
14235
14391
|
} else if (position.isTop) {
|
|
@@ -14239,8 +14395,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14239
14395
|
};
|
|
14240
14396
|
_proto.textAnchorForAxisLabel = function textAnchorForAxisLabel(id) {
|
|
14241
14397
|
var $$ = this.owner,
|
|
14242
|
-
position = this.getAxisLabelPosition(id)
|
|
14243
|
-
|
|
14398
|
+
position = this.getAxisLabelPosition(id);
|
|
14399
|
+
var anchor = position.isMiddle ? "middle" : "end";
|
|
14244
14400
|
if (this.isHorizontal($$, id !== "x")) {
|
|
14245
14401
|
anchor = position.isLeft ? "start" : position.isCenter ? "middle" : "end";
|
|
14246
14402
|
} else if (position.isBottom) {
|
|
@@ -14254,8 +14410,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14254
14410
|
isRotated = config.axis_rotated,
|
|
14255
14411
|
isInner = this.getAxisLabelPosition(id).isInner,
|
|
14256
14412
|
tickRotate = config["axis_" + id + "_tick_rotate"] ? $$.getHorizontalAxisHeight(id) : 0,
|
|
14257
|
-
maxTickWidth = this.getMaxTickWidth(id)
|
|
14258
|
-
|
|
14413
|
+
maxTickWidth = this.getMaxTickWidth(id);
|
|
14414
|
+
var dy;
|
|
14259
14415
|
if (id === "x") {
|
|
14260
14416
|
var xHeight = config.axis_x_height;
|
|
14261
14417
|
if (isRotated) {
|
|
@@ -14304,8 +14460,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14304
14460
|
if (svg) {
|
|
14305
14461
|
var isYAxis = /^y2?$/.test(id),
|
|
14306
14462
|
targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
|
14307
|
-
|
|
14308
|
-
domain =
|
|
14463
|
+
scale = $$.scale[id].copy().domain($$["get" + (isYAxis ? "Y" : "X") + "Domain"](targetsToShow, id)),
|
|
14464
|
+
domain = scale.domain(),
|
|
14309
14465
|
isDomainSame = domain[0] === domain[1] && domain.every(function (v) {
|
|
14310
14466
|
_newArrowCheck(this, _this11);
|
|
14311
14467
|
return v > 0;
|
|
@@ -14325,7 +14481,7 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14325
14481
|
if (!isYAxis) {
|
|
14326
14482
|
currentTickMax.ticks.splice(0);
|
|
14327
14483
|
}
|
|
14328
|
-
var axis = this.getAxis(id,
|
|
14484
|
+
var axis = this.getAxis(id, scale, !1, !1, !0),
|
|
14329
14485
|
tickCount = config["axis_" + id + "_tick_count"],
|
|
14330
14486
|
tickValues = config["axis_" + id + "_tick_values"];
|
|
14331
14487
|
// Make to generate the final tick text to be rendered
|
|
@@ -14379,9 +14535,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14379
14535
|
tickCount = tickTextWidths.length,
|
|
14380
14536
|
_state$axis$x$padding = state.axis.x.padding,
|
|
14381
14537
|
left = _state$axis$x$padding.left,
|
|
14382
|
-
right = _state$axis$x$padding.right
|
|
14383
|
-
|
|
14384
|
-
|
|
14538
|
+
right = _state$axis$x$padding.right;
|
|
14539
|
+
var maxOverflow = 0;
|
|
14540
|
+
var remaining = tickCount - (isTimeSeries && config.axis_x_tick_fit ? .5 : 0);
|
|
14385
14541
|
for (var i = 0; i < tickCount; i++) {
|
|
14386
14542
|
var tickIndex = i + 1,
|
|
14387
14543
|
rotatedTickTextWidth = Math.cos(Math.PI * xAxisTickRotate / 180) * tickTextWidths[i],
|
|
@@ -14398,8 +14554,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14398
14554
|
overflow = rotatedTickTextWidth - tickLength / 2 - remainingTickWidth;
|
|
14399
14555
|
maxOverflow = Math.max(maxOverflow, overflow);
|
|
14400
14556
|
}
|
|
14401
|
-
var filteredTargets = $$.filterTargetsToShow($$.data.targets)
|
|
14402
|
-
|
|
14557
|
+
var filteredTargets = $$.filterTargetsToShow($$.data.targets);
|
|
14558
|
+
var tickOffset = 0;
|
|
14403
14559
|
if (!isTimeSeries && config.axis_x_tick_count <= filteredTargets.length && filteredTargets[0].values.length) {
|
|
14404
14560
|
var _scale2 = getScale($$.axis.getAxisType("x"), 0, widthWithoutCurrentPaddingLeft - maxOverflow).domain([left * -1, $$.getXDomainMax($$.data.targets) + 1 + right]);
|
|
14405
14561
|
tickOffset = Math.ceil((_scale2(1) - _scale2(0)) / 2);
|
|
@@ -14472,8 +14628,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14472
14628
|
var isCategorized = this.isCategorized(),
|
|
14473
14629
|
count = targetCount - 2,
|
|
14474
14630
|
start = values[0],
|
|
14475
|
-
end = values[values.length - 1]
|
|
14476
|
-
|
|
14631
|
+
end = values[values.length - 1];
|
|
14632
|
+
var tickValue;
|
|
14633
|
+
|
|
14477
14634
|
// re-construct unique values
|
|
14478
14635
|
tickValues = [start];
|
|
14479
14636
|
for (var i = 0; i < count; i++) {
|
|
@@ -14627,8 +14784,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14627
14784
|
tickValues = sortValue(tickNodes.data()),
|
|
14628
14785
|
tickSize = tickValues.length,
|
|
14629
14786
|
cullingMax = config[cullingOptionPrefix + "_max"],
|
|
14630
|
-
lines = config[cullingOptionPrefix + "_lines"]
|
|
14631
|
-
|
|
14787
|
+
lines = config[cullingOptionPrefix + "_lines"];
|
|
14788
|
+
var intervalForCulling;
|
|
14632
14789
|
if (tickSize) {
|
|
14633
14790
|
for (var i = 1; i < tickSize; i++) {
|
|
14634
14791
|
if (tickSize / i < cullingMax) {
|
|
@@ -14874,8 +15031,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14874
15031
|
var _this4 = this;
|
|
14875
15032
|
_newArrowCheck(this, _this3);
|
|
14876
15033
|
var x = getPrevNextX(d),
|
|
14877
|
-
xDomain = xScale.domain()
|
|
14878
|
-
|
|
15034
|
+
xDomain = xScale.domain();
|
|
15035
|
+
var val;
|
|
15036
|
+
|
|
14879
15037
|
// if there this is a single data point make the eventRect full width (or height)
|
|
14880
15038
|
if (x.prev === null && x.next === null) {
|
|
14881
15039
|
val = isRotated ? state.height : state.width;
|
|
@@ -14895,8 +15053,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14895
15053
|
}.bind(this);
|
|
14896
15054
|
rectX = function (d) {
|
|
14897
15055
|
_newArrowCheck(this, _this3);
|
|
14898
|
-
var x = getPrevNextX(d)
|
|
14899
|
-
|
|
15056
|
+
var x = getPrevNextX(d);
|
|
15057
|
+
var val;
|
|
15058
|
+
|
|
14900
15059
|
// if there this is a single data point position the eventRect at 0
|
|
14901
15060
|
if (x.prev === null && x.next === null) {
|
|
14902
15061
|
val = 0;
|
|
@@ -15027,8 +15186,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
15027
15186
|
if (!d) {
|
|
15028
15187
|
return;
|
|
15029
15188
|
}
|
|
15030
|
-
var index = d.index
|
|
15031
|
-
|
|
15189
|
+
var index = d.index;
|
|
15190
|
+
var stepType = config.line_step_type;
|
|
15191
|
+
|
|
15032
15192
|
// tooltip position match for step-before & step-after
|
|
15033
15193
|
if (config.line_step_tooltipMatch && $$.hasType("step") && /^step\-(before|after)$/.test(stepType)) {
|
|
15034
15194
|
var scale = $$.scale.zoom || $$.scale.x,
|
|
@@ -15189,8 +15349,8 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15189
15349
|
["axis.x", "grid.x", "gridLines.x", "region.list", "text", "bar", "line", "area", "circle"].forEach(function (v) {
|
|
15190
15350
|
var _node;
|
|
15191
15351
|
_newArrowCheck(this, _this);
|
|
15192
|
-
var name = v.split(".")
|
|
15193
|
-
|
|
15352
|
+
var name = v.split(".");
|
|
15353
|
+
var node = $el[name[0]];
|
|
15194
15354
|
if (node && name.length > 1) {
|
|
15195
15355
|
node = node[name[1]];
|
|
15196
15356
|
}
|
|
@@ -15382,18 +15542,22 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15382
15542
|
/* harmony default export */ var clip = ({
|
|
15383
15543
|
initClip: function initClip() {
|
|
15384
15544
|
var $$ = this,
|
|
15385
|
-
|
|
15545
|
+
_$$$state = $$.state,
|
|
15546
|
+
clip = _$$$state.clip,
|
|
15547
|
+
hasAxis = _$$$state.hasAxis;
|
|
15386
15548
|
// MEMO: clipId needs to be unique because it conflicts when multiple charts exist
|
|
15387
15549
|
clip.id = $$.state.datetimeId + "-clip";
|
|
15388
|
-
|
|
15389
|
-
|
|
15390
|
-
|
|
15550
|
+
if (hasAxis) {
|
|
15551
|
+
clip.idXAxis = clip.id + "-xaxis";
|
|
15552
|
+
clip.idYAxis = clip.id + "-yaxis";
|
|
15553
|
+
clip.idGrid = clip.id + "-grid";
|
|
15391
15554
|
|
|
15392
|
-
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
|
|
15555
|
+
// Define 'clip-path' attribute values
|
|
15556
|
+
clip.path = $$.getClipPath(clip.id);
|
|
15557
|
+
clip.pathXAxis = $$.getClipPath(clip.idXAxis);
|
|
15558
|
+
clip.pathYAxis = $$.getClipPath(clip.idYAxis);
|
|
15559
|
+
clip.pathGrid = $$.getClipPath(clip.idGrid);
|
|
15560
|
+
}
|
|
15397
15561
|
},
|
|
15398
15562
|
getClipPath: function getClipPath(id) {
|
|
15399
15563
|
var $$ = this,
|
|
@@ -15415,10 +15579,10 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15415
15579
|
setXAxisClipPath: function setXAxisClipPath(node) {
|
|
15416
15580
|
var $$ = this,
|
|
15417
15581
|
config = $$.config,
|
|
15418
|
-
_$$$
|
|
15419
|
-
margin = _$$$
|
|
15420
|
-
width = _$$$
|
|
15421
|
-
height = _$$$
|
|
15582
|
+
_$$$state2 = $$.state,
|
|
15583
|
+
margin = _$$$state2.margin,
|
|
15584
|
+
width = _$$$state2.width,
|
|
15585
|
+
height = _$$$state2.height,
|
|
15422
15586
|
isRotated = config.axis_rotated,
|
|
15423
15587
|
left = Math.max(30, margin.left) - (isRotated ? 0 : 20),
|
|
15424
15588
|
x = isRotated ? -(1 + left) : -(left - 1),
|
|
@@ -15435,10 +15599,10 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15435
15599
|
setYAxisClipPath: function setYAxisClipPath(node) {
|
|
15436
15600
|
var $$ = this,
|
|
15437
15601
|
config = $$.config,
|
|
15438
|
-
_$$$
|
|
15439
|
-
margin = _$$$
|
|
15440
|
-
width = _$$$
|
|
15441
|
-
height = _$$$
|
|
15602
|
+
_$$$state3 = $$.state,
|
|
15603
|
+
margin = _$$$state3.margin,
|
|
15604
|
+
width = _$$$state3.width,
|
|
15605
|
+
height = _$$$state3.height,
|
|
15442
15606
|
isRotated = config.axis_rotated,
|
|
15443
15607
|
left = Math.max(30, margin.left) - (isRotated ? 20 : 0),
|
|
15444
15608
|
isInner = config.axis_y_inner,
|
|
@@ -15451,9 +15615,9 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15451
15615
|
updateXAxisTickClip: function updateXAxisTickClip() {
|
|
15452
15616
|
var $$ = this,
|
|
15453
15617
|
config = $$.config,
|
|
15454
|
-
_$$$
|
|
15455
|
-
clip = _$$$
|
|
15456
|
-
xAxisHeight = _$$$
|
|
15618
|
+
_$$$state4 = $$.state,
|
|
15619
|
+
clip = _$$$state4.clip,
|
|
15620
|
+
xAxisHeight = _$$$state4.xAxisHeight,
|
|
15457
15621
|
defs = $$.$el.defs,
|
|
15458
15622
|
newXAxisHeight = $$.getHorizontalAxisHeight("x");
|
|
15459
15623
|
if (defs && !clip.idXAxisTickTexts) {
|
|
@@ -15482,9 +15646,9 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15482
15646
|
},
|
|
15483
15647
|
setXAxisTickTextClipPathWidth: function setXAxisTickTextClipPathWidth() {
|
|
15484
15648
|
var $$ = this,
|
|
15485
|
-
_$$$
|
|
15486
|
-
clip = _$$$
|
|
15487
|
-
current = _$$$
|
|
15649
|
+
_$$$state5 = $$.state,
|
|
15650
|
+
clip = _$$$state5.clip,
|
|
15651
|
+
current = _$$$state5.current,
|
|
15488
15652
|
svg = $$.$el.svg;
|
|
15489
15653
|
if (svg) {
|
|
15490
15654
|
svg.select("#" + clip.idXAxisTickTexts + " rect").attr("width", current.maxTickWidths.x.clipPath).attr("height", 30);
|
|
@@ -15980,8 +16144,8 @@ function smoothLines(el, type) {
|
|
|
15980
16144
|
config = $$.config,
|
|
15981
16145
|
scale = $$.scale,
|
|
15982
16146
|
isRotated = config.axis_rotated,
|
|
15983
|
-
isX = type === "x"
|
|
15984
|
-
|
|
16147
|
+
isX = type === "x";
|
|
16148
|
+
var key = "start",
|
|
15985
16149
|
currScale,
|
|
15986
16150
|
pos = 0;
|
|
15987
16151
|
if (d.axis === "y" || d.axis === "y2") {
|
|
@@ -16011,8 +16175,8 @@ function smoothLines(el, type) {
|
|
|
16011
16175
|
state = $$.state,
|
|
16012
16176
|
isRotated = config.axis_rotated,
|
|
16013
16177
|
isWidth = type === "width",
|
|
16014
|
-
start = $$[isWidth ? "regionX" : "regionY"](d)
|
|
16015
|
-
|
|
16178
|
+
start = $$[isWidth ? "regionX" : "regionY"](d);
|
|
16179
|
+
var currScale,
|
|
16016
16180
|
key = "end",
|
|
16017
16181
|
end = state[type];
|
|
16018
16182
|
if (d.axis === "y" || d.axis === "y2") {
|
|
@@ -16078,8 +16242,8 @@ function smoothLines(el, type) {
|
|
|
16078
16242
|
rotatedPadding = _state.rotatedPadding,
|
|
16079
16243
|
isLegendRight = _state.isLegendRight,
|
|
16080
16244
|
isLegendInset = _state.isLegendInset,
|
|
16081
|
-
isRotated = config.axis_rotated
|
|
16082
|
-
|
|
16245
|
+
isRotated = config.axis_rotated;
|
|
16246
|
+
var h = 30;
|
|
16083
16247
|
if (id === "x" && !config.axis_x_show) {
|
|
16084
16248
|
return 8;
|
|
16085
16249
|
}
|
|
@@ -16119,14 +16283,14 @@ function smoothLines(el, type) {
|
|
|
16119
16283
|
axis = $$.axis,
|
|
16120
16284
|
config = $$.config,
|
|
16121
16285
|
state = $$.state,
|
|
16122
|
-
$el = $$.$el
|
|
16123
|
-
|
|
16286
|
+
$el = $$.$el;
|
|
16287
|
+
var rotate = config["axis_" + id + "_tick_rotate"];
|
|
16124
16288
|
if (id === "x") {
|
|
16125
16289
|
var allowedXAxisTypes = axis.isCategorized() || axis.isTimeSeries();
|
|
16126
16290
|
if (config.axis_x_tick_fit && allowedXAxisTypes) {
|
|
16127
16291
|
var xTickCount = config.axis_x_tick_count,
|
|
16128
|
-
currentXTicksLength = state.current.maxTickWidths.x.ticks.length
|
|
16129
|
-
|
|
16292
|
+
currentXTicksLength = state.current.maxTickWidths.x.ticks.length;
|
|
16293
|
+
var tickCount = 0;
|
|
16130
16294
|
if (xTickCount) {
|
|
16131
16295
|
tickCount = xTickCount > currentXTicksLength ? currentXTicksLength : xTickCount;
|
|
16132
16296
|
} else if (currentXTicksLength) {
|
|
@@ -18095,8 +18259,8 @@ function getRadiusFn(expandRate) {
|
|
|
18095
18259
|
*/
|
|
18096
18260
|
outer: function outer(d) {
|
|
18097
18261
|
var _$$$getRadius2 = $$.getRadius(d),
|
|
18098
|
-
outerRadius = _$$$getRadius2.outerRadius
|
|
18099
|
-
|
|
18262
|
+
outerRadius = _$$$getRadius2.outerRadius;
|
|
18263
|
+
var radius;
|
|
18100
18264
|
if (hasMultiArcGauge) {
|
|
18101
18265
|
radius = state.radius - singleArcWidth * d.index + expandWidth;
|
|
18102
18266
|
} else if ($$.hasType("polar") && !expandRate) {
|
|
@@ -18126,8 +18290,8 @@ function getRadiusFn(expandRate) {
|
|
|
18126
18290
|
_config$arc_cornerRad2 = config.arc_cornerRadius,
|
|
18127
18291
|
cornerRadius = _config$arc_cornerRad2 === void 0 ? 0 : _config$arc_cornerRad2,
|
|
18128
18292
|
id = d.data.id,
|
|
18129
|
-
value = d.value
|
|
18130
|
-
|
|
18293
|
+
value = d.value;
|
|
18294
|
+
var corner = 0;
|
|
18131
18295
|
if (ratio) {
|
|
18132
18296
|
corner = ratio * outerRadius;
|
|
18133
18297
|
} else {
|
|
@@ -18199,8 +18363,8 @@ function getAttrTweenFn(fn) {
|
|
|
18199
18363
|
*/
|
|
18200
18364
|
getRadius: function getRadius(d) {
|
|
18201
18365
|
var $$ = this,
|
|
18202
|
-
data = d == null ? void 0 : d.data
|
|
18203
|
-
|
|
18366
|
+
data = d == null ? void 0 : d.data;
|
|
18367
|
+
var _$$$state = $$.state,
|
|
18204
18368
|
innerRadius = _$$$state.innerRadius,
|
|
18205
18369
|
outerRadius = _$$$state.outerRadius;
|
|
18206
18370
|
if (!isNumber(innerRadius) && data) {
|
|
@@ -18225,8 +18389,8 @@ function getAttrTweenFn(fn) {
|
|
|
18225
18389
|
getArcLength: function getArcLength() {
|
|
18226
18390
|
var $$ = this,
|
|
18227
18391
|
config = $$.config,
|
|
18228
|
-
arcLengthInPercent = config.gauge_arcLength * 3.6
|
|
18229
|
-
|
|
18392
|
+
arcLengthInPercent = config.gauge_arcLength * 3.6;
|
|
18393
|
+
var len = 2 * (arcLengthInPercent / 360);
|
|
18230
18394
|
if (arcLengthInPercent < -360) {
|
|
18231
18395
|
len = -2;
|
|
18232
18396
|
} else if (arcLengthInPercent > 360) {
|
|
@@ -18239,8 +18403,8 @@ function getAttrTweenFn(fn) {
|
|
|
18239
18403
|
config = $$.config,
|
|
18240
18404
|
isFullCircle = config.gauge_fullCircle,
|
|
18241
18405
|
defaultStartAngle = -1 * Math.PI / 2,
|
|
18242
|
-
defaultEndAngle = Math.PI / 2
|
|
18243
|
-
|
|
18406
|
+
defaultEndAngle = Math.PI / 2;
|
|
18407
|
+
var startAngle = config.gauge_startingAngle;
|
|
18244
18408
|
if (!isFullCircle && startAngle <= defaultStartAngle) {
|
|
18245
18409
|
startAngle = defaultStartAngle;
|
|
18246
18410
|
} else if (!isFullCircle && startAngle >= defaultEndAngle) {
|
|
@@ -18334,8 +18498,8 @@ function getAttrTweenFn(fn) {
|
|
|
18334
18498
|
return function (d) {
|
|
18335
18499
|
_newArrowCheck(this, _this5);
|
|
18336
18500
|
var updated = $$.updateAngle(d),
|
|
18337
|
-
outerR = outer(updated)
|
|
18338
|
-
|
|
18501
|
+
outerR = outer(updated);
|
|
18502
|
+
var cornerR = 0;
|
|
18339
18503
|
if (updated) {
|
|
18340
18504
|
cornerR = corner(updated, outerR);
|
|
18341
18505
|
}
|
|
@@ -18378,11 +18542,11 @@ function getAttrTweenFn(fn) {
|
|
|
18378
18542
|
}.bind(this)),
|
|
18379
18543
|
x = _c$map[0],
|
|
18380
18544
|
y = _c$map[1],
|
|
18381
|
-
h = Math.sqrt(x * x + y * y)
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18545
|
+
h = Math.sqrt(x * x + y * y);
|
|
18546
|
+
var ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
|
|
18547
|
+
_newArrowCheck(this, _this6);
|
|
18548
|
+
return config[v + "_label_ratio"];
|
|
18549
|
+
}.bind(this))) == null ? void 0 : _filter$map[0];
|
|
18386
18550
|
if (ratio) {
|
|
18387
18551
|
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
|
18388
18552
|
} else {
|
|
@@ -18471,8 +18635,8 @@ function getAttrTweenFn(fn) {
|
|
|
18471
18635
|
*/
|
|
18472
18636
|
getExpandConfig: function getExpandConfig(id, key) {
|
|
18473
18637
|
var $$ = this,
|
|
18474
|
-
config = $$.config
|
|
18475
|
-
|
|
18638
|
+
config = $$.config;
|
|
18639
|
+
var type;
|
|
18476
18640
|
if ($$.isDonutType(id)) {
|
|
18477
18641
|
type = "donut";
|
|
18478
18642
|
} else if ($$.isGaugeType(id)) {
|
|
@@ -18633,8 +18797,8 @@ function getAttrTweenFn(fn) {
|
|
|
18633
18797
|
.style("opacity", null).call(endall, function () {
|
|
18634
18798
|
if ($$.levelColor) {
|
|
18635
18799
|
var path = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
18636
|
-
|
|
18637
|
-
$$.updateLegendItemColor(
|
|
18800
|
+
d = path.datum();
|
|
18801
|
+
$$.updateLegendItemColor(d.data.id, path.style("fill"));
|
|
18638
18802
|
}
|
|
18639
18803
|
state.transiting = !1;
|
|
18640
18804
|
callFn(config.onrendered, $$.api);
|
|
@@ -18718,8 +18882,8 @@ function getAttrTweenFn(fn) {
|
|
|
18718
18882
|
$$.hideTooltip();
|
|
18719
18883
|
}
|
|
18720
18884
|
arc.on("click", function (event, d, i) {
|
|
18721
|
-
var updated = $$.updateAngle(d)
|
|
18722
|
-
|
|
18885
|
+
var updated = $$.updateAngle(d);
|
|
18886
|
+
var arcData;
|
|
18723
18887
|
if (updated) {
|
|
18724
18888
|
arcData = $$.convertToArcData(updated);
|
|
18725
18889
|
$$.toggleShape == null ? void 0 : $$.toggleShape(this, arcData, i);
|
|
@@ -18969,8 +19133,9 @@ function getAttrTweenFn(fn) {
|
|
|
18969
19133
|
var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
|
18970
19134
|
offset = areaOffset(d, i) || y0,
|
|
18971
19135
|
posX = x(d),
|
|
18972
|
-
value = d.value
|
|
18973
|
-
|
|
19136
|
+
value = d.value;
|
|
19137
|
+
var posY = y(d);
|
|
19138
|
+
|
|
18974
19139
|
// fix posY not to overflow opposite quadrant
|
|
18975
19140
|
if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
|
|
18976
19141
|
posY = y0;
|
|
@@ -19020,7 +19185,7 @@ function getAttrTweenFn(fn) {
|
|
|
19020
19185
|
if (!$el.bar) {
|
|
19021
19186
|
$$.initBar();
|
|
19022
19187
|
}
|
|
19023
|
-
var mainBarUpdate =
|
|
19188
|
+
var mainBarUpdate = $el.main.select("." + $BAR.chartBars).selectAll("." + $BAR.chartBar).data(
|
|
19024
19189
|
// remove
|
|
19025
19190
|
targets.filter(function (v) {
|
|
19026
19191
|
var _this2 = this;
|
|
@@ -19139,10 +19304,10 @@ function getAttrTweenFn(fn) {
|
|
|
19139
19304
|
indexX = +isRotated,
|
|
19140
19305
|
indexY = +!indexX,
|
|
19141
19306
|
isNegative = d.value < 0,
|
|
19142
|
-
pathRadius = ["", ""],
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
isRadiusData = getRadius && isGrouped ? $$.isStackingRadiusData(d) : !1; //
|
|
19307
|
+
pathRadius = ["", ""]; // switch points if axis is rotated, not applicable for sub chart
|
|
19308
|
+
var radius = 0;
|
|
19309
|
+
var isGrouped = $$.isGrouped(d.id),
|
|
19310
|
+
isRadiusData = getRadius && isGrouped ? $$.isStackingRadiusData(d) : !1; // const hasRadius = d.value !== 0 && getRadius;
|
|
19146
19311
|
if (getRadius && (!isGrouped || isRadiusData)) {
|
|
19147
19312
|
var index = isRotated ? indexY : indexX,
|
|
19148
19313
|
barW = points[2][index] - points[0][index];
|
|
@@ -19230,8 +19395,9 @@ function getAttrTweenFn(fn) {
|
|
|
19230
19395
|
offset = barOffset(d, i) || y0,
|
|
19231
19396
|
width = isNumber(barW) ? barW : barW[d.id] || barW._$width,
|
|
19232
19397
|
value = d.value,
|
|
19233
|
-
posX = barX(d)
|
|
19234
|
-
|
|
19398
|
+
posX = barX(d);
|
|
19399
|
+
var posY = barY(d);
|
|
19400
|
+
|
|
19235
19401
|
// fix posY not to overflow opposite quadrant
|
|
19236
19402
|
if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
|
|
19237
19403
|
posY = y0;
|
|
@@ -19391,8 +19557,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19391
19557
|
var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
|
19392
19558
|
offset = shapeOffset(d, i) || y0,
|
|
19393
19559
|
width = isNumber(barW) ? barW : barW[d.id] || barW._$width,
|
|
19394
|
-
value = $$.getCandlestickData(d)
|
|
19395
|
-
|
|
19560
|
+
value = $$.getCandlestickData(d);
|
|
19561
|
+
var points;
|
|
19396
19562
|
if (value) {
|
|
19397
19563
|
var posX = {
|
|
19398
19564
|
start: x(d),
|
|
@@ -19533,9 +19699,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19533
19699
|
_newArrowCheck(this, _this2);
|
|
19534
19700
|
return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data);
|
|
19535
19701
|
}.bind(this)).style("display", config.gauge_label_show ? null : "none").each(function (d) {
|
|
19536
|
-
var lineLength = 0
|
|
19537
|
-
|
|
19538
|
-
x = 0,
|
|
19702
|
+
var lineLength = 0;
|
|
19703
|
+
var x = 0,
|
|
19539
19704
|
y = 0,
|
|
19540
19705
|
transform = "";
|
|
19541
19706
|
if (hiddenTargetIds.indexOf(d.data.id) < 0) {
|
|
@@ -19549,7 +19714,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19549
19714
|
y = Math.sin(linePositioningAngle) * arcInnerRadius;
|
|
19550
19715
|
transform = "rotate(" + lineAngle * 180 / Math.PI + ", " + x + ", " + y + ")";
|
|
19551
19716
|
}
|
|
19552
|
-
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).attr("x", x).attr("y", y).attr("width", lineLength).attr("height",
|
|
19717
|
+
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).attr("x", x).attr("y", y).attr("width", lineLength).attr("height", 2).attr("transform", transform).style("stroke-dasharray", "0, " + (lineLength + 2) + ", 0");
|
|
19553
19718
|
});
|
|
19554
19719
|
},
|
|
19555
19720
|
textForGaugeMinMax: function textForGaugeMinMax(value, isMax) {
|
|
@@ -19599,8 +19764,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19599
19764
|
_$$$state = $$.state,
|
|
19600
19765
|
width = _$$$state.width,
|
|
19601
19766
|
height = _$$$state.height,
|
|
19602
|
-
cacheKey = KEY.bubbleBaseLength
|
|
19603
|
-
|
|
19767
|
+
cacheKey = KEY.bubbleBaseLength;
|
|
19768
|
+
var baseLength = $$.cache.get(cacheKey);
|
|
19604
19769
|
if (!baseLength) {
|
|
19605
19770
|
$$.cache.add(cacheKey, baseLength = getMinMax("min", [width, height]));
|
|
19606
19771
|
}
|
|
@@ -19793,8 +19958,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19793
19958
|
var x = isSub ? scale.subX : scale.x;
|
|
19794
19959
|
return function (d) {
|
|
19795
19960
|
_newArrowCheck(this, _this4);
|
|
19796
|
-
var y = yScale(d.id, isSub)
|
|
19797
|
-
|
|
19961
|
+
var y = yScale(d.id, isSub);
|
|
19962
|
+
var values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
|
19798
19963
|
x0 = 0,
|
|
19799
19964
|
y0 = 0,
|
|
19800
19965
|
path;
|
|
@@ -19884,12 +20049,13 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19884
20049
|
axisType = {
|
|
19885
20050
|
x: $$.axis.getAxisType("x"),
|
|
19886
20051
|
y: $$.axis.getAxisType("y")
|
|
19887
|
-
}
|
|
19888
|
-
|
|
20052
|
+
};
|
|
20053
|
+
var path = "";
|
|
19889
20054
|
for (var _i = 0, data; data = d[_i]; _i++) {
|
|
19890
20055
|
var prevData = d[_i - 1],
|
|
19891
|
-
hasPrevData = prevData && isValue(prevData.value)
|
|
19892
|
-
|
|
20056
|
+
hasPrevData = prevData && isValue(prevData.value);
|
|
20057
|
+
var style = $$.isWithinRegions(data.x, regions);
|
|
20058
|
+
|
|
19893
20059
|
// https://github.com/naver/billboard.js/issues/1172
|
|
19894
20060
|
if (!isValue(data.value)) {
|
|
19895
20061
|
continue;
|
|
@@ -19966,16 +20132,16 @@ var getTransitionName = function () {
|
|
|
19966
20132
|
},
|
|
19967
20133
|
initialOpacityForCircle: function initialOpacityForCircle(d) {
|
|
19968
20134
|
var config = this.config,
|
|
19969
|
-
withoutFadeIn = this.state.withoutFadeIn
|
|
19970
|
-
|
|
20135
|
+
withoutFadeIn = this.state.withoutFadeIn;
|
|
20136
|
+
var opacity = config.point_opacity;
|
|
19971
20137
|
if (isUndefined(opacity)) {
|
|
19972
20138
|
opacity = this.getBaseValue(d) !== null && withoutFadeIn[d.id] ? this.opacityForCircle(d) : "0";
|
|
19973
20139
|
}
|
|
19974
20140
|
return opacity;
|
|
19975
20141
|
},
|
|
19976
20142
|
opacityForCircle: function opacityForCircle(d) {
|
|
19977
|
-
var config = this.config
|
|
19978
|
-
|
|
20143
|
+
var config = this.config;
|
|
20144
|
+
var opacity = config.point_opacity;
|
|
19979
20145
|
if (isUndefined(opacity)) {
|
|
19980
20146
|
opacity = config.point_show && !config.point_focus_only ? null : "0";
|
|
19981
20147
|
opacity = isValue(this.getBaseValue(d)) ? this.isBubbleType(d) || this.isScatterType(d) ? "0.5" : opacity : "0";
|
|
@@ -20101,8 +20267,8 @@ var getTransitionName = function () {
|
|
|
20101
20267
|
resizing = _$$$state.resizing,
|
|
20102
20268
|
toggling = _$$$state.toggling,
|
|
20103
20269
|
transiting = _$$$state.transiting,
|
|
20104
|
-
$el = $$.$el
|
|
20105
|
-
|
|
20270
|
+
$el = $$.$el;
|
|
20271
|
+
var circle = $el.circle;
|
|
20106
20272
|
if (transiting === !1 && config.point_focus_only && circle) {
|
|
20107
20273
|
var cx = (hasRadar ? $$.radarCircleX : $$.circleX).bind($$),
|
|
20108
20274
|
cy = (hasRadar ? $$.radarCircleY : $$.circleY).bind($$),
|
|
@@ -20121,8 +20287,8 @@ var getTransitionName = function () {
|
|
|
20121
20287
|
circle.attr("class", this.updatePointClass.bind(this)).style("opacity", null).each(function (d) {
|
|
20122
20288
|
var id = d.id,
|
|
20123
20289
|
index = d.index,
|
|
20124
|
-
value = d.value
|
|
20125
|
-
|
|
20290
|
+
value = d.value;
|
|
20291
|
+
var visibility = "hidden";
|
|
20126
20292
|
if (isValue(value)) {
|
|
20127
20293
|
fn.bind(this)(d);
|
|
20128
20294
|
$$.expandCircles(index, id);
|
|
@@ -20202,8 +20368,8 @@ var getTransitionName = function () {
|
|
|
20202
20368
|
pointR: function (d) {
|
|
20203
20369
|
var $$ = this,
|
|
20204
20370
|
config = $$.config,
|
|
20205
|
-
pointR = config.point_r
|
|
20206
|
-
|
|
20371
|
+
pointR = config.point_r;
|
|
20372
|
+
var r = pointR;
|
|
20207
20373
|
if ($$.isBubbleType(d)) {
|
|
20208
20374
|
r = $$.getBubbleR(d);
|
|
20209
20375
|
} else if (isFunction(pointR)) {
|
|
@@ -20225,8 +20391,8 @@ var getTransitionName = function () {
|
|
|
20225
20391
|
isWithinCircle: function isWithinCircle(node, r) {
|
|
20226
20392
|
var mouse = getPointer(this.state.event, node),
|
|
20227
20393
|
element = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(node),
|
|
20228
|
-
prefix = this.isCirclePoint(node) ? "c" : ""
|
|
20229
|
-
|
|
20394
|
+
prefix = this.isCirclePoint(node) ? "c" : "";
|
|
20395
|
+
var cx = +element.attr(prefix + "x"),
|
|
20230
20396
|
cy = +element.attr(prefix + "y");
|
|
20231
20397
|
// if node don't have cx/y or x/y attribute value
|
|
20232
20398
|
if (!(cx || cy) && node.nodeType === 1) {
|
|
@@ -20274,8 +20440,8 @@ var getTransitionName = function () {
|
|
|
20274
20440
|
},
|
|
20275
20441
|
updatePointClass: function updatePointClass(d) {
|
|
20276
20442
|
var $$ = this,
|
|
20277
|
-
circle = $$.$el.circle
|
|
20278
|
-
|
|
20443
|
+
circle = $$.$el.circle;
|
|
20444
|
+
var pointClass = !1;
|
|
20279
20445
|
if (isObject(d) || circle) {
|
|
20280
20446
|
pointClass = d === !0 ? circle.each(function (d) {
|
|
20281
20447
|
var className = $$.getClass("circle", !0)(d);
|
|
@@ -20299,8 +20465,9 @@ var getTransitionName = function () {
|
|
|
20299
20465
|
_newArrowCheck(this, _this8);
|
|
20300
20466
|
var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
|
20301
20467
|
offset = lineOffset(d, i) || y0,
|
|
20302
|
-
posX = x(d)
|
|
20303
|
-
|
|
20468
|
+
posX = x(d);
|
|
20469
|
+
var posY = y(d);
|
|
20470
|
+
|
|
20304
20471
|
// fix posY not to overflow opposite quadrant
|
|
20305
20472
|
if (config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY)) {
|
|
20306
20473
|
posY = y0;
|
|
@@ -20380,8 +20547,9 @@ var getTransitionName = function () {
|
|
|
20380
20547
|
return element.append("circle").attr("class", this.updatePointClass.bind(this)).attr("r", sizeFn).style("fill", fillStyleFn).node();
|
|
20381
20548
|
},
|
|
20382
20549
|
update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
|
20383
|
-
var $$ = this
|
|
20384
|
-
|
|
20550
|
+
var $$ = this;
|
|
20551
|
+
var mainCircles = element;
|
|
20552
|
+
|
|
20385
20553
|
// when '.load()' called, bubble size should be updated
|
|
20386
20554
|
if ($$.hasType("bubble")) {
|
|
20387
20555
|
mainCircles.attr("r", $$.pointR.bind($$));
|
|
@@ -20443,8 +20611,9 @@ var getTransitionName = function () {
|
|
|
20443
20611
|
* @private
|
|
20444
20612
|
*/
|
|
20445
20613
|
function getDataMax($$) {
|
|
20446
|
-
var levelMax = $$.config.polar_level_max
|
|
20447
|
-
|
|
20614
|
+
var levelMax = $$.config.polar_level_max;
|
|
20615
|
+
var dataMax = $$.getMinMaxData().max[0].value;
|
|
20616
|
+
|
|
20448
20617
|
// Apply level max only when is greater than the data max value
|
|
20449
20618
|
if (levelMax && levelMax > dataMax) {
|
|
20450
20619
|
dataMax = levelMax;
|
|
@@ -20828,9 +20997,9 @@ var cacheKey = KEY.radarPoints;
|
|
|
20828
20997
|
return "translate(" + posX + " " + posY + ")";
|
|
20829
20998
|
});
|
|
20830
20999
|
}
|
|
20831
|
-
$$.
|
|
21000
|
+
$$.bindRadarEvent();
|
|
20832
21001
|
},
|
|
20833
|
-
|
|
21002
|
+
bindRadarEvent: function bindRadarEvent() {
|
|
20834
21003
|
var _this9 = this,
|
|
20835
21004
|
$$ = this,
|
|
20836
21005
|
config = $$.config,
|
|
@@ -20922,6 +21091,271 @@ var cacheKey = KEY.radarPoints;
|
|
|
20922
21091
|
return this.cache.get(cacheKey)[d.id][d.index][1];
|
|
20923
21092
|
}
|
|
20924
21093
|
});
|
|
21094
|
+
// EXTERNAL MODULE: external {"commonjs":"d3-hierarchy","commonjs2":"d3-hierarchy","amd":"d3-hierarchy","root":"d3"}
|
|
21095
|
+
var external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_ = __webpack_require__(13);
|
|
21096
|
+
;// CONCATENATED MODULE: ./src/ChartInternal/shape/treemap.ts
|
|
21097
|
+
|
|
21098
|
+
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: !0 }; return { done: !1, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21099
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21100
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21101
|
+
/**
|
|
21102
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
21103
|
+
* billboard.js project is licensed under the MIT license
|
|
21104
|
+
*/
|
|
21105
|
+
|
|
21106
|
+
|
|
21107
|
+
|
|
21108
|
+
|
|
21109
|
+
/**
|
|
21110
|
+
* Get treemap elements' position
|
|
21111
|
+
* @param {d3Selection} group Root selection
|
|
21112
|
+
* @param {object} root Root data
|
|
21113
|
+
* @private
|
|
21114
|
+
*/
|
|
21115
|
+
function position(group, root) {
|
|
21116
|
+
var _this = this,
|
|
21117
|
+
$$ = this,
|
|
21118
|
+
_$$$scale = $$.scale,
|
|
21119
|
+
x = _$$$scale.x,
|
|
21120
|
+
y = _$$$scale.y,
|
|
21121
|
+
width = $$.state.width;
|
|
21122
|
+
group.selectAll("g").attr("transform", function (d) {
|
|
21123
|
+
_newArrowCheck(this, _this);
|
|
21124
|
+
return "translate(" + (d === root ? "0,0" : x(d.x0) + "," + y(d.y0)) + ")";
|
|
21125
|
+
}.bind(this)).select("rect").attr("width", function (d) {
|
|
21126
|
+
_newArrowCheck(this, _this);
|
|
21127
|
+
return d === root ? width : x(d.x1) - x(d.x0);
|
|
21128
|
+
}.bind(this)).attr("height", function (d) {
|
|
21129
|
+
_newArrowCheck(this, _this);
|
|
21130
|
+
return d === root ? 0 : y(d.y1) - y(d.y0);
|
|
21131
|
+
}.bind(this));
|
|
21132
|
+
}
|
|
21133
|
+
|
|
21134
|
+
/**
|
|
21135
|
+
* Convert data for treemap hierarchy
|
|
21136
|
+
* @param {object} data Data object
|
|
21137
|
+
* @returns {Array} Array of data for treemap hierarchy
|
|
21138
|
+
* @private
|
|
21139
|
+
*/
|
|
21140
|
+
function convertDataToTreemapData(data) {
|
|
21141
|
+
var _this2 = this,
|
|
21142
|
+
$$ = this;
|
|
21143
|
+
return data.map(function (d) {
|
|
21144
|
+
_newArrowCheck(this, _this2);
|
|
21145
|
+
var id = d.id,
|
|
21146
|
+
values = d.values,
|
|
21147
|
+
value = values[0].value;
|
|
21148
|
+
return {
|
|
21149
|
+
name: id,
|
|
21150
|
+
id: id,
|
|
21151
|
+
// needed to keep compatibility on whole code logic
|
|
21152
|
+
value: value,
|
|
21153
|
+
ratio: $$.getRatio("treemap", values[0])
|
|
21154
|
+
};
|
|
21155
|
+
}.bind(this));
|
|
21156
|
+
}
|
|
21157
|
+
/* harmony default export */ var treemap = ({
|
|
21158
|
+
initTreemap: function initTreemap() {
|
|
21159
|
+
var _this3 = this,
|
|
21160
|
+
$$ = this,
|
|
21161
|
+
$el = $$.$el,
|
|
21162
|
+
_$$$state = $$.state,
|
|
21163
|
+
_$$$state$current = _$$$state.current,
|
|
21164
|
+
width = _$$$state$current.width,
|
|
21165
|
+
height = _$$$state$current.height,
|
|
21166
|
+
clip = _$$$state.clip,
|
|
21167
|
+
clipId = clip.id;
|
|
21168
|
+
$$.treemap = (0,external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemap)().tile($$.getTreemapTile());
|
|
21169
|
+
$$.treemapFn = function (data) {
|
|
21170
|
+
var _this4 = this;
|
|
21171
|
+
_newArrowCheck(this, _this3);
|
|
21172
|
+
var hierarchyData = (0,external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.hierarchy)(data).sum(function (d) {
|
|
21173
|
+
_newArrowCheck(this, _this4);
|
|
21174
|
+
return d.value;
|
|
21175
|
+
}.bind(this)),
|
|
21176
|
+
sortFn = $$.getSortCompareFn(!0);
|
|
21177
|
+
return $$.treemap(sortFn ? hierarchyData.sort(sortFn) : hierarchyData);
|
|
21178
|
+
}.bind(this);
|
|
21179
|
+
$el.defs.append("clipPath").attr("id", clipId).append("rect").attr("width", width).attr("height", height);
|
|
21180
|
+
$el.treemap = $el.main.select("." + $COMMON.chart).attr("clip-path", "url(#" + clipId + ")").append("g").classed($TREEMAP.chartTreemaps, !0);
|
|
21181
|
+
$$.bindTreemapEvent();
|
|
21182
|
+
},
|
|
21183
|
+
/**
|
|
21184
|
+
* Bind events
|
|
21185
|
+
* @private
|
|
21186
|
+
*/
|
|
21187
|
+
bindTreemapEvent: function bindTreemapEvent() {
|
|
21188
|
+
var _this5 = this,
|
|
21189
|
+
$$ = this,
|
|
21190
|
+
$el = $$.$el,
|
|
21191
|
+
config = $$.config,
|
|
21192
|
+
state = $$.state,
|
|
21193
|
+
getTarget = function (event) {
|
|
21194
|
+
var _state$eventReceiver$, _data;
|
|
21195
|
+
_newArrowCheck(this, _this5);
|
|
21196
|
+
var target = event.isTrusted ? event.target : (_state$eventReceiver$ = state.eventReceiver.rect) == null ? void 0 : _state$eventReceiver$.node(),
|
|
21197
|
+
data;
|
|
21198
|
+
if (/^rect$/i.test(target.tagName)) {
|
|
21199
|
+
state.event = event;
|
|
21200
|
+
data = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum();
|
|
21201
|
+
}
|
|
21202
|
+
return (_data = data) == null ? void 0 : _data.data;
|
|
21203
|
+
}.bind(this);
|
|
21204
|
+
if (config.interaction_enabled) {
|
|
21205
|
+
var isTouch = state.inputType === "touch";
|
|
21206
|
+
$el.treemap.on(isTouch ? "touchstart" : "mousemove", function (event) {
|
|
21207
|
+
_newArrowCheck(this, _this5);
|
|
21208
|
+
var data = getTarget(event);
|
|
21209
|
+
if (data) {
|
|
21210
|
+
$$.showTooltip([data], event.currentTarget);
|
|
21211
|
+
event.type === "mouseover" && $$.setOverOut(!0, data);
|
|
21212
|
+
}
|
|
21213
|
+
}.bind(this)).on(isTouch ? "touchend" : "mouseout", function (event) {
|
|
21214
|
+
_newArrowCheck(this, _this5);
|
|
21215
|
+
var data = getTarget(event);
|
|
21216
|
+
$$.hideTooltip();
|
|
21217
|
+
$$.setOverOut(!1, data);
|
|
21218
|
+
}.bind(this));
|
|
21219
|
+
}
|
|
21220
|
+
},
|
|
21221
|
+
/**
|
|
21222
|
+
* Get tiling function
|
|
21223
|
+
* @returns {Function}
|
|
21224
|
+
* @private
|
|
21225
|
+
*/
|
|
21226
|
+
getTreemapTile: function getTreemapTile() {
|
|
21227
|
+
var _binary$dice$slice$sl,
|
|
21228
|
+
_config$treemap_tile,
|
|
21229
|
+
$$ = this,
|
|
21230
|
+
config = $$.config,
|
|
21231
|
+
_$$$state$current2 = $$.state.current,
|
|
21232
|
+
width = _$$$state$current2.width,
|
|
21233
|
+
height = _$$$state$current2.height,
|
|
21234
|
+
tile = (_binary$dice$slice$sl = {
|
|
21235
|
+
"binary": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapBinary,
|
|
21236
|
+
"dice": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapDice,
|
|
21237
|
+
"slice": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapSlice,
|
|
21238
|
+
"sliceDice": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapSliceDice,
|
|
21239
|
+
"squarify": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapSquarify,
|
|
21240
|
+
"resquarify": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapResquarify
|
|
21241
|
+
}[(_config$treemap_tile = config.treemap_tile) != null ? _config$treemap_tile : "binary"]) != null ? _binary$dice$slice$sl : external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapBinary,
|
|
21242
|
+
_this6 = this;
|
|
21243
|
+
return function (node, x0, y0, x1, y1) {
|
|
21244
|
+
_newArrowCheck(this, _this6);
|
|
21245
|
+
tile(node, 0, 0, width, height);
|
|
21246
|
+
for (var _iterator = _createForOfIteratorHelperLoose(node.children), _step; !(_step = _iterator()).done;) {
|
|
21247
|
+
var child = _step.value;
|
|
21248
|
+
child.x0 = x0 + child.x0 / width * (x1 - x0);
|
|
21249
|
+
child.x1 = x0 + child.x1 / width * (x1 - x0);
|
|
21250
|
+
child.y0 = y0 + child.y0 / height * (y1 - y0);
|
|
21251
|
+
child.y1 = y0 + child.y1 / height * (y1 - y0);
|
|
21252
|
+
}
|
|
21253
|
+
}.bind(this);
|
|
21254
|
+
},
|
|
21255
|
+
/**
|
|
21256
|
+
* Get treemap hierarchy data
|
|
21257
|
+
* @param {Array} targets Data targets
|
|
21258
|
+
* @returns {object}
|
|
21259
|
+
* @private
|
|
21260
|
+
*/
|
|
21261
|
+
getTreemapData: function getTreemapData(targets) {
|
|
21262
|
+
var $$ = this;
|
|
21263
|
+
return {
|
|
21264
|
+
name: "root",
|
|
21265
|
+
children: convertDataToTreemapData.bind($$)($$.filterTargetsToShow(targets.filter($$.isTreemapType, $$)))
|
|
21266
|
+
};
|
|
21267
|
+
},
|
|
21268
|
+
/**
|
|
21269
|
+
* Update treemap data
|
|
21270
|
+
* @param {Array} targets Data targets
|
|
21271
|
+
* @private
|
|
21272
|
+
*/
|
|
21273
|
+
updateTargetsForTreemap: function updateTargetsForTreemap(targets) {
|
|
21274
|
+
var $$ = this,
|
|
21275
|
+
treemap = $$.$el.treemap,
|
|
21276
|
+
treemapData = $$.treemapFn($$.getTreemapData(targets != null ? targets : $$.data.targets));
|
|
21277
|
+
// using $el.treemap reference can alter data, so select treemap <g> again
|
|
21278
|
+
treemap.data(treemapData);
|
|
21279
|
+
},
|
|
21280
|
+
/**
|
|
21281
|
+
* Render treemap
|
|
21282
|
+
* @param {number} durationForExit Duration for exit transition
|
|
21283
|
+
* @private
|
|
21284
|
+
*/
|
|
21285
|
+
updateTreemap: function updateTreemap(durationForExit) {
|
|
21286
|
+
var _this7 = this,
|
|
21287
|
+
$$ = this,
|
|
21288
|
+
$el = $$.$el,
|
|
21289
|
+
$T = $$.$T,
|
|
21290
|
+
data = $el.treemap.datum(),
|
|
21291
|
+
classChartTreemap = $$.getChartClass("Treemap"),
|
|
21292
|
+
treemap = $el.treemap.selectAll("g").data(data.children);
|
|
21293
|
+
$T(treemap.exit(), durationForExit).style("opacity", "0").remove();
|
|
21294
|
+
treemap.enter().append("g").append("rect");
|
|
21295
|
+
$el.treemap.selectAll("g").attr("class", classChartTreemap).select("rect").attr("fill", function (d) {
|
|
21296
|
+
_newArrowCheck(this, _this7);
|
|
21297
|
+
return $$.color(d.data.name);
|
|
21298
|
+
}.bind(this));
|
|
21299
|
+
},
|
|
21300
|
+
/**
|
|
21301
|
+
* Generate treemap coordinate points data
|
|
21302
|
+
* @returns {Array} Array of coordinate points
|
|
21303
|
+
* @private
|
|
21304
|
+
*/
|
|
21305
|
+
generateGetTreemapPoints: function generateGetTreemapPoints() {
|
|
21306
|
+
var _this8 = this,
|
|
21307
|
+
$$ = this,
|
|
21308
|
+
$el = $$.$el,
|
|
21309
|
+
_$$$scale2 = $$.scale,
|
|
21310
|
+
x = _$$$scale2.x,
|
|
21311
|
+
y = _$$$scale2.y,
|
|
21312
|
+
points = {};
|
|
21313
|
+
$el.treemap.selectAll("g").each(function (d) {
|
|
21314
|
+
_newArrowCheck(this, _this8);
|
|
21315
|
+
points[d.data.name] = [[x(d.x0), y(d.y0)], [x(d.x1), y(d.y1)]];
|
|
21316
|
+
}.bind(this));
|
|
21317
|
+
return function (d) {
|
|
21318
|
+
_newArrowCheck(this, _this8);
|
|
21319
|
+
return points[d.id];
|
|
21320
|
+
}.bind(this);
|
|
21321
|
+
},
|
|
21322
|
+
/**
|
|
21323
|
+
* Redraw treemap
|
|
21324
|
+
* @param {boolean} withTransition With or without transition
|
|
21325
|
+
* @returns {Array} Selections
|
|
21326
|
+
* @private
|
|
21327
|
+
*/
|
|
21328
|
+
redrawTreemap: function redrawTreemap(withTransition) {
|
|
21329
|
+
var $$ = this,
|
|
21330
|
+
$el = $$.$el,
|
|
21331
|
+
_$$$state$current3 = $$.state.current,
|
|
21332
|
+
width = _$$$state$current3.width,
|
|
21333
|
+
height = _$$$state$current3.height;
|
|
21334
|
+
// update defs
|
|
21335
|
+
$el.defs.select("rect").attr("width", width).attr("height", height);
|
|
21336
|
+
return [$$.$T($el.treemap, withTransition, getRandom()).call(position.bind($$), $el.treemap.datum())];
|
|
21337
|
+
},
|
|
21338
|
+
/**
|
|
21339
|
+
* Get treemap data label format function
|
|
21340
|
+
* @param {object} d Data object
|
|
21341
|
+
* @returns {Function}
|
|
21342
|
+
* @private
|
|
21343
|
+
*/
|
|
21344
|
+
treemapDataLabelFormat: function treemapDataLabelFormat(d) {
|
|
21345
|
+
var $$ = this,
|
|
21346
|
+
config = $$.config,
|
|
21347
|
+
id = d.id,
|
|
21348
|
+
value = d.value,
|
|
21349
|
+
format = config.treemap_label_format,
|
|
21350
|
+
ratio = $$.getRatio("treemap", d),
|
|
21351
|
+
percentValue = (ratio * 100).toFixed(2),
|
|
21352
|
+
meetLabelThreshold = config.treemap_label_show && $$.meetsLabelThreshold(ratio, "treemap") ? null : "0";
|
|
21353
|
+
return function (node) {
|
|
21354
|
+
node.style("opacity", meetLabelThreshold);
|
|
21355
|
+
return isFunction(format) ? format.bind($$.api)(value, ratio, id) : id + "\n" + percentValue + "%";
|
|
21356
|
+
};
|
|
21357
|
+
}
|
|
21358
|
+
});
|
|
20925
21359
|
;// CONCATENATED MODULE: ./src/config/Options/common/point.ts
|
|
20926
21360
|
/**
|
|
20927
21361
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -21417,7 +21851,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
21417
21851
|
* billboard.js project is licensed under the MIT license
|
|
21418
21852
|
*/
|
|
21419
21853
|
/**
|
|
21420
|
-
*
|
|
21854
|
+
* spline config options
|
|
21421
21855
|
*/
|
|
21422
21856
|
/* harmony default export */ var spline = ({
|
|
21423
21857
|
/**
|
|
@@ -21463,7 +21897,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
21463
21897
|
* billboard.js project is licensed under the MIT license
|
|
21464
21898
|
*/
|
|
21465
21899
|
/**
|
|
21466
|
-
*
|
|
21900
|
+
* arc config options
|
|
21467
21901
|
*/
|
|
21468
21902
|
/* harmony default export */ var shape_arc = ({
|
|
21469
21903
|
/**
|
|
@@ -21714,7 +22148,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
21714
22148
|
* billboard.js project is licensed under the MIT license
|
|
21715
22149
|
*/
|
|
21716
22150
|
/**
|
|
21717
|
-
*
|
|
22151
|
+
* pie config options
|
|
21718
22152
|
*/
|
|
21719
22153
|
/* harmony default export */ var pie = ({
|
|
21720
22154
|
/**
|
|
@@ -21816,7 +22250,7 @@ var polar_this = undefined;
|
|
|
21816
22250
|
* billboard.js project is licensed under the MIT license
|
|
21817
22251
|
*/
|
|
21818
22252
|
/**
|
|
21819
|
-
*
|
|
22253
|
+
* polar config options
|
|
21820
22254
|
*/
|
|
21821
22255
|
/* harmony default export */ var shape_polar = ({
|
|
21822
22256
|
/**
|
|
@@ -21903,7 +22337,7 @@ var radar_this = undefined;
|
|
|
21903
22337
|
* billboard.js project is licensed under the MIT license
|
|
21904
22338
|
*/
|
|
21905
22339
|
/**
|
|
21906
|
-
*
|
|
22340
|
+
* radar config options
|
|
21907
22341
|
*/
|
|
21908
22342
|
/* harmony default export */ var shape_radar = ({
|
|
21909
22343
|
/**
|
|
@@ -21976,6 +22410,60 @@ var radar_this = undefined;
|
|
|
21976
22410
|
radar_size_ratio: .87,
|
|
21977
22411
|
radar_direction_clockwise: !1
|
|
21978
22412
|
});
|
|
22413
|
+
;// CONCATENATED MODULE: ./src/config/Options/shape/treemap.ts
|
|
22414
|
+
/**
|
|
22415
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
22416
|
+
* billboard.js project is licensed under the MIT license
|
|
22417
|
+
*/
|
|
22418
|
+
/**
|
|
22419
|
+
* treemap config options
|
|
22420
|
+
*/
|
|
22421
|
+
/* harmony default export */ var shape_treemap = ({
|
|
22422
|
+
/**
|
|
22423
|
+
* Set treemap options
|
|
22424
|
+
* @name treemap
|
|
22425
|
+
* @memberof Options
|
|
22426
|
+
* @type {object}
|
|
22427
|
+
* @property {object} treemap Treemap object
|
|
22428
|
+
* @property {string} [treemap.tile="binary"] Treemap tile type
|
|
22429
|
+
* - **Available tile type values:**
|
|
22430
|
+
* - binary ([d3.treemapBinary](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapBinary))
|
|
22431
|
+
* - dice ([d3.treemapDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapDice))
|
|
22432
|
+
* - slice ([d3.treemapSlice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSlice))
|
|
22433
|
+
* - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
|
|
22434
|
+
* - squrify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
|
|
22435
|
+
* - resquarify ([d3.treemapResquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapResquarify))
|
|
22436
|
+
* @property {Function} [treemap.label.format] Set formatter for the label text.
|
|
22437
|
+
* @property {number} [treemap.label.threshold=0.05] Set threshold ratio to show/hide labels text.
|
|
22438
|
+
* @property {number} [treemap.label.show=true] Show or hide label text.
|
|
22439
|
+
* @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
|
|
22440
|
+
* @example
|
|
22441
|
+
* treemap: {
|
|
22442
|
+
* // "binary", "dice", "slice", "sliceDice", "squrify", "resquarify"
|
|
22443
|
+
* tile: "dice",
|
|
22444
|
+
*
|
|
22445
|
+
* label: {
|
|
22446
|
+
* // show or hide label text
|
|
22447
|
+
* show: false,
|
|
22448
|
+
*
|
|
22449
|
+
* // set label text formatter
|
|
22450
|
+
* format: function(value, ratio, id) {
|
|
22451
|
+
* return d3.format("$")(value);
|
|
22452
|
+
*
|
|
22453
|
+
* // to multiline, return with '\n' character
|
|
22454
|
+
* // return value +"%\nLine1\n2Line2";
|
|
22455
|
+
* },
|
|
22456
|
+
*
|
|
22457
|
+
* // set ratio number
|
|
22458
|
+
* ratio: 0.05
|
|
22459
|
+
* }
|
|
22460
|
+
* }
|
|
22461
|
+
*/
|
|
22462
|
+
treemap_tile: "binary",
|
|
22463
|
+
treemap_label_format: undefined,
|
|
22464
|
+
treemap_label_threshold: .05,
|
|
22465
|
+
treemap_label_show: !0
|
|
22466
|
+
});
|
|
21979
22467
|
;// CONCATENATED MODULE: ./src/config/resolver/shape.ts
|
|
21980
22468
|
|
|
21981
22469
|
var shape_this = undefined;
|
|
@@ -22004,6 +22492,7 @@ var shape_this = undefined;
|
|
|
22004
22492
|
|
|
22005
22493
|
|
|
22006
22494
|
|
|
22495
|
+
|
|
22007
22496
|
// Options
|
|
22008
22497
|
|
|
22009
22498
|
|
|
@@ -22023,6 +22512,7 @@ var shape_this = undefined;
|
|
|
22023
22512
|
|
|
22024
22513
|
|
|
22025
22514
|
|
|
22515
|
+
|
|
22026
22516
|
/**
|
|
22027
22517
|
* Extend Axis
|
|
22028
22518
|
* @param {Array} module Module to be extended
|
|
@@ -22193,6 +22683,14 @@ var _area = function area() {
|
|
|
22193
22683
|
_newArrowCheck(this, _this18);
|
|
22194
22684
|
return TYPE.SCATTER;
|
|
22195
22685
|
}.bind(this))();
|
|
22686
|
+
}.bind(undefined),
|
|
22687
|
+
resolver_shape_treemap = function () {
|
|
22688
|
+
var _this19 = this;
|
|
22689
|
+
_newArrowCheck(this, shape_this);
|
|
22690
|
+
return extendAxis([treemap], [shape_treemap]), (resolver_shape_treemap = function () {
|
|
22691
|
+
_newArrowCheck(this, _this19);
|
|
22692
|
+
return TYPE.TREEMAP;
|
|
22693
|
+
}.bind(this))();
|
|
22196
22694
|
}.bind(undefined);
|
|
22197
22695
|
;// CONCATENATED MODULE: ./src/Chart/api/selection.ts
|
|
22198
22696
|
|
|
@@ -22203,6 +22701,52 @@ var _area = function area() {
|
|
|
22203
22701
|
|
|
22204
22702
|
|
|
22205
22703
|
|
|
22704
|
+
/**
|
|
22705
|
+
* Toggler function to select or unselect
|
|
22706
|
+
* @param {boolean} isSelection Weather select or unselect
|
|
22707
|
+
* @param {Array} ids Target ids
|
|
22708
|
+
* @param {Array} indices Indices number
|
|
22709
|
+
* @param {boolean} resetOther Weather reset other selected points (only for selection)
|
|
22710
|
+
* @private
|
|
22711
|
+
*/
|
|
22712
|
+
function setSelection(isSelection, ids, indices, resetOther) {
|
|
22713
|
+
if (isSelection === void 0) {
|
|
22714
|
+
isSelection = !1;
|
|
22715
|
+
}
|
|
22716
|
+
var $$ = this,
|
|
22717
|
+
config = $$.config,
|
|
22718
|
+
main = $$.$el.main,
|
|
22719
|
+
selectionGrouped = config.data_selection_grouped,
|
|
22720
|
+
isSelectable = config.data_selection_isselectable.bind($$.api);
|
|
22721
|
+
if (!config.data_selection_enabled) {
|
|
22722
|
+
return;
|
|
22723
|
+
}
|
|
22724
|
+
main.selectAll("." + $SHAPE.shapes).selectAll("." + $SHAPE.shape).each(function (d) {
|
|
22725
|
+
var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
22726
|
+
_ref = d.data ? d.data : d,
|
|
22727
|
+
id = _ref.id,
|
|
22728
|
+
index = _ref.index,
|
|
22729
|
+
toggle = $$.getToggle(this, d).bind($$),
|
|
22730
|
+
isTargetId = selectionGrouped || !ids || ids.indexOf(id) >= 0,
|
|
22731
|
+
isTargetIndex = !indices || indices.indexOf(index) >= 0,
|
|
22732
|
+
isSelected = shape.classed($SELECT.SELECTED);
|
|
22733
|
+
// line/area selection not supported yet
|
|
22734
|
+
if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
|
|
22735
|
+
return;
|
|
22736
|
+
}
|
|
22737
|
+
if (isSelection) {
|
|
22738
|
+
if (isTargetId && isTargetIndex && isSelectable(d) && !isSelected) {
|
|
22739
|
+
toggle(!0, shape.classed($SELECT.SELECTED, !0), d, index);
|
|
22740
|
+
} else if (isDefined(resetOther) && resetOther && isSelected) {
|
|
22741
|
+
toggle(!1, shape.classed($SELECT.SELECTED, !1), d, index);
|
|
22742
|
+
}
|
|
22743
|
+
} else {
|
|
22744
|
+
if (isTargetId && isTargetIndex && isSelectable(d) && isSelected) {
|
|
22745
|
+
toggle(!1, shape.classed($SELECT.SELECTED, !1), d, index);
|
|
22746
|
+
}
|
|
22747
|
+
}
|
|
22748
|
+
});
|
|
22749
|
+
}
|
|
22206
22750
|
/* harmony default export */ var selection = ({
|
|
22207
22751
|
/**
|
|
22208
22752
|
* Get selected data points.<br><br>
|
|
@@ -22257,31 +22801,8 @@ var _area = function area() {
|
|
|
22257
22801
|
* chart.select("data1", [0, 3, 5]);
|
|
22258
22802
|
*/
|
|
22259
22803
|
select: function select(ids, indices, resetOther) {
|
|
22260
|
-
var $$ = this.internal
|
|
22261
|
-
|
|
22262
|
-
$el = $$.$el;
|
|
22263
|
-
if (!config.data_selection_enabled) {
|
|
22264
|
-
return;
|
|
22265
|
-
}
|
|
22266
|
-
$el.main.selectAll("." + $SHAPE.shapes).selectAll("." + $SHAPE.shape).each(function (d, i) {
|
|
22267
|
-
var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
22268
|
-
id = d.data ? d.data.id : d.id,
|
|
22269
|
-
toggle = $$.getToggle(this, d).bind($$),
|
|
22270
|
-
isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
|
|
22271
|
-
isTargetIndex = !indices || indices.indexOf(i) >= 0,
|
|
22272
|
-
isSelected = shape.classed($SELECT.SELECTED);
|
|
22273
|
-
// line/area selection not supported yet
|
|
22274
|
-
if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
|
|
22275
|
-
return;
|
|
22276
|
-
}
|
|
22277
|
-
if (isTargetId && isTargetIndex) {
|
|
22278
|
-
if (config.data_selection_isselectable.bind($$.api)(d) && !isSelected) {
|
|
22279
|
-
toggle(!0, shape.classed($SELECT.SELECTED, !0), d, i);
|
|
22280
|
-
}
|
|
22281
|
-
} else if (isDefined(resetOther) && resetOther && isSelected) {
|
|
22282
|
-
toggle(!1, shape.classed($SELECT.SELECTED, !1), d, i);
|
|
22283
|
-
}
|
|
22284
|
-
});
|
|
22804
|
+
var $$ = this.internal;
|
|
22805
|
+
setSelection.bind($$)(!0, ids, indices, resetOther);
|
|
22285
22806
|
},
|
|
22286
22807
|
/**
|
|
22287
22808
|
* Set data points to be un-selected.
|
|
@@ -22301,27 +22822,8 @@ var _area = function area() {
|
|
|
22301
22822
|
* chart.unselect("data1", [2]);
|
|
22302
22823
|
*/
|
|
22303
22824
|
unselect: function unselect(ids, indices) {
|
|
22304
|
-
var $$ = this.internal
|
|
22305
|
-
|
|
22306
|
-
$el = $$.$el;
|
|
22307
|
-
if (!config.data_selection_enabled) {
|
|
22308
|
-
return;
|
|
22309
|
-
}
|
|
22310
|
-
$el.main.selectAll("." + $SHAPE.shapes).selectAll("." + $SHAPE.shape).each(function (d, i) {
|
|
22311
|
-
var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
22312
|
-
id = d.data ? d.data.id : d.id,
|
|
22313
|
-
toggle = $$.getToggle(this, d).bind($$),
|
|
22314
|
-
isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0,
|
|
22315
|
-
isTargetIndex = !indices || indices.indexOf(i) >= 0,
|
|
22316
|
-
isSelected = shape.classed($SELECT.SELECTED);
|
|
22317
|
-
// line/area selection not supported yet
|
|
22318
|
-
if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
|
|
22319
|
-
return;
|
|
22320
|
-
}
|
|
22321
|
-
if (isTargetId && isTargetIndex && config.data_selection_isselectable.bind($$.api)(d) && isSelected) {
|
|
22322
|
-
toggle(!1, shape.classed($SELECT.SELECTED, !1), d, i);
|
|
22323
|
-
}
|
|
22324
|
-
});
|
|
22825
|
+
var $$ = this.internal;
|
|
22826
|
+
setSelection.bind($$)(!1, ids, indices);
|
|
22325
22827
|
}
|
|
22326
22828
|
});
|
|
22327
22829
|
;// CONCATENATED MODULE: ./src/Chart/api/subchart.ts
|
|
@@ -22418,7 +22920,7 @@ var _area = function area() {
|
|
|
22418
22920
|
}
|
|
22419
22921
|
});
|
|
22420
22922
|
// EXTERNAL MODULE: external {"commonjs":"d3-zoom","commonjs2":"d3-zoom","amd":"d3-zoom","root":"d3"}
|
|
22421
|
-
var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack_require__(
|
|
22923
|
+
var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack_require__(14);
|
|
22422
22924
|
;// CONCATENATED MODULE: ./src/Chart/api/zoom.ts
|
|
22423
22925
|
|
|
22424
22926
|
/**
|
|
@@ -22704,8 +23206,8 @@ extend(zoom, {
|
|
|
22704
23206
|
}.bind(this)).each(function (d, i) {
|
|
22705
23207
|
var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
22706
23208
|
isSelected = shape.classed($SELECT.SELECTED),
|
|
22707
|
-
isIncluded = shape.classed($DRAG.INCLUDED)
|
|
22708
|
-
|
|
23209
|
+
isIncluded = shape.classed($DRAG.INCLUDED);
|
|
23210
|
+
var isWithin = !1,
|
|
22709
23211
|
toggle;
|
|
22710
23212
|
if (shape.classed($CIRCLE.circle)) {
|
|
22711
23213
|
var x = +shape.attr("cx") * 1,
|
|
@@ -22825,7 +23327,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments.
|
|
|
22825
23327
|
config = $$.config,
|
|
22826
23328
|
main = $$.$el.main,
|
|
22827
23329
|
$T = $$.$T;
|
|
22828
|
-
callFn(config.data_onunselected, $$.api, d, target.node());
|
|
23330
|
+
callFn(config.data_onunselected, $$.api, d, target == null ? void 0 : target.node());
|
|
22829
23331
|
|
|
22830
23332
|
// remove selected-circle from low layer g
|
|
22831
23333
|
$T(main.select("." + $SELECT.selectedCircles + $$.getTargetSelectorSuffix(d.id)).selectAll("." + $SELECT.selectedCircle + "-" + i)).attr("r", 0).remove();
|
|
@@ -22911,19 +23413,18 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments.
|
|
|
22911
23413
|
if (config.data_selection_enabled && config.data_selection_isselectable.bind($$.api)(d)) {
|
|
22912
23414
|
var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that),
|
|
22913
23415
|
isSelected = shape.classed($SELECT.SELECTED),
|
|
22914
|
-
toggle = $$.getToggle(that, d).bind($$)
|
|
22915
|
-
|
|
23416
|
+
toggle = $$.getToggle(that, d).bind($$);
|
|
23417
|
+
var toggledShape;
|
|
22916
23418
|
if (!config.data_selection_multiple) {
|
|
22917
|
-
var
|
|
23419
|
+
var focusOnly = config.point_focus_only;
|
|
23420
|
+
var selector = "." + (focusOnly ? $SELECT.selectedCircles : $SHAPE.shapes);
|
|
22918
23421
|
if (config.data_selection_grouped) {
|
|
22919
23422
|
selector += $$.getTargetSelectorSuffix(d.id);
|
|
22920
23423
|
}
|
|
22921
|
-
main.selectAll(selector).selectAll("." + $SHAPE.shape).each(function (d
|
|
23424
|
+
main.selectAll(selector).selectAll(focusOnly ? "." + $SELECT.selectedCircle : "." + $SHAPE.shape + "." + $SELECT.SELECTED).classed($SELECT.SELECTED, !1).each(function (d) {
|
|
22922
23425
|
var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
22923
|
-
|
|
22924
|
-
|
|
22925
|
-
toggle(!1, shape.classed($SELECT.SELECTED, !1), d, i);
|
|
22926
|
-
}
|
|
23426
|
+
toggledShape = shape;
|
|
23427
|
+
toggle(!1, shape, d, d.index);
|
|
22927
23428
|
});
|
|
22928
23429
|
}
|
|
22929
23430
|
if (!toggledShape || toggledShape.node() !== shape.node()) {
|
|
@@ -23985,147 +24486,148 @@ var _selectionModule = function selectionModule() {
|
|
|
23985
24486
|
|
|
23986
24487
|
// eslint-disable-next-line no-use-before-define
|
|
23987
24488
|
|
|
23988
|
-
var _defaults = {}
|
|
23989
|
-
|
|
23990
|
-
/**
|
|
23991
|
-
* Version information
|
|
23992
|
-
* @property {string} version version
|
|
23993
|
-
* @example
|
|
23994
|
-
* bb.version; // "1.0.0"
|
|
23995
|
-
* @memberof bb
|
|
23996
|
-
*/
|
|
23997
|
-
version: "3.7.0-next.1",
|
|
23998
|
-
/**
|
|
23999
|
-
* Generate chart
|
|
24000
|
-
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|
|
24001
|
-
* - Unused option value is given.
|
|
24002
|
-
* - ex) For `data.type="pie"` option, setting 'axis' option can cause unexpected generation error.
|
|
24003
|
-
* - Insufficient value is given for certain option used.
|
|
24004
|
-
* - ex) `data: { x: "x", columns: [["x"], ["data1", 30, 200, 100]] }`
|
|
24005
|
-
* @param {Options} config chart options
|
|
24006
|
-
* @memberof bb
|
|
24007
|
-
* @returns {Chart}
|
|
24008
|
-
* @see {@link Options} for different generation options
|
|
24009
|
-
* @see {@link Chart} for different methods API
|
|
24010
|
-
* @example
|
|
24011
|
-
* <!-- chart holder -->
|
|
24012
|
-
* <div id="LineChart"></div>
|
|
24013
|
-
* @example
|
|
24014
|
-
* // Generate chart with options
|
|
24015
|
-
* var chart = bb.generate({
|
|
24016
|
-
* "bindto": "#LineChart"
|
|
24017
|
-
* "data": {
|
|
24018
|
-
* "columns": [
|
|
24019
|
-
* ["data1", 30, 200, 100, 400, 150, 250],
|
|
24020
|
-
* ["data2", 50, 20, 10, 40, 15, 25]
|
|
24021
|
-
* ],
|
|
24022
|
-
* "type": "line"
|
|
24023
|
-
* }
|
|
24024
|
-
* });
|
|
24025
|
-
*
|
|
24026
|
-
* // call some API
|
|
24027
|
-
* // ex) get the data of 'data1'
|
|
24028
|
-
* chart.data("data1");
|
|
24029
|
-
* @example
|
|
24030
|
-
* // Generate chart by importing ESM
|
|
24031
|
-
* // Import types to be used only, where this will make smaller bundle size.
|
|
24032
|
-
* import bb, {
|
|
24033
|
-
* area,
|
|
24034
|
-
* areaLineRange,
|
|
24035
|
-
* areaSpline,
|
|
24036
|
-
* areaSplineRange,
|
|
24037
|
-
* areaStep,
|
|
24038
|
-
* bar,
|
|
24039
|
-
* bubble,
|
|
24040
|
-
* donut,
|
|
24041
|
-
* gauge,
|
|
24042
|
-
* line,
|
|
24043
|
-
* pie,
|
|
24044
|
-
* polar,
|
|
24045
|
-
* radar,
|
|
24046
|
-
* scatter,
|
|
24047
|
-
* spline,
|
|
24048
|
-
* step
|
|
24049
|
-
* }
|
|
24050
|
-
*
|
|
24051
|
-
* bb.generate({
|
|
24052
|
-
* "bindto": "#LineChart"
|
|
24053
|
-
* "data": {
|
|
24054
|
-
* "columns": [
|
|
24055
|
-
* ["data1", 30, 200, 100, 400, 150, 250],
|
|
24056
|
-
* ["data2", 50, 20, 10, 40, 15, 25]
|
|
24057
|
-
* ]
|
|
24058
|
-
* },
|
|
24059
|
-
* type: line(),
|
|
24060
|
-
*
|
|
24061
|
-
* // or
|
|
24062
|
-
* types: {
|
|
24063
|
-
* data1: bar(),
|
|
24064
|
-
* data2: step()
|
|
24065
|
-
* }
|
|
24066
|
-
* });
|
|
24067
|
-
*/
|
|
24068
|
-
generate: function generate(config) {
|
|
24069
|
-
var options = mergeObj({}, _defaults, config),
|
|
24070
|
-
inst = new Chart(options);
|
|
24071
|
-
inst.internal.charts = this.instance;
|
|
24072
|
-
this.instance.push(inst);
|
|
24073
|
-
return inst;
|
|
24074
|
-
},
|
|
24075
|
-
/**
|
|
24076
|
-
* Set or get global default options.
|
|
24077
|
-
* - **NOTE:**
|
|
24078
|
-
* - The options values settings are valid within page context only.
|
|
24079
|
-
* - If is called multiple times, will override the last value.
|
|
24080
|
-
* @param {Options} options chart options
|
|
24081
|
-
* @memberof bb
|
|
24082
|
-
* @returns {Options}
|
|
24083
|
-
* @see {@link Options}
|
|
24084
|
-
* @example
|
|
24085
|
-
* // Set same option value as for `.generate()`
|
|
24086
|
-
* bb.defaults({
|
|
24087
|
-
* data: {
|
|
24088
|
-
* type: "bar"
|
|
24089
|
-
* }
|
|
24090
|
-
* });
|
|
24091
|
-
*
|
|
24092
|
-
* bb.defaults(); // {data:{type: "bar"}}
|
|
24093
|
-
*
|
|
24094
|
-
* // data.type defaults to 'bar'
|
|
24095
|
-
* var chart = bb.generate({ ... });
|
|
24096
|
-
*/
|
|
24097
|
-
defaults: function defaults(options) {
|
|
24098
|
-
if (isObject(options)) {
|
|
24099
|
-
_defaults = options;
|
|
24100
|
-
}
|
|
24101
|
-
return _defaults;
|
|
24102
|
-
},
|
|
24103
|
-
/**
|
|
24104
|
-
* An array containing instance created
|
|
24105
|
-
* @property {Array} instance instance array
|
|
24106
|
-
* @example
|
|
24107
|
-
* // generate charts
|
|
24108
|
-
* var chart1 = bb.generate(...);
|
|
24109
|
-
* var chart2 = bb.generate(...);
|
|
24110
|
-
*
|
|
24111
|
-
* bb.instance; // [ chart1, chart2, ... ]
|
|
24112
|
-
* @memberof bb
|
|
24113
|
-
*/
|
|
24114
|
-
instance: [],
|
|
24115
|
-
/**
|
|
24116
|
-
* Namespace for plugins
|
|
24117
|
-
* @property {object} plugin plugin namespace
|
|
24118
|
-
* @example
|
|
24119
|
-
* // Stanford diagram plugin
|
|
24120
|
-
* bb.plugin.stanford;
|
|
24121
|
-
* @memberof bb
|
|
24122
|
-
*/
|
|
24123
|
-
plugin: {}
|
|
24124
|
-
};
|
|
24489
|
+
var _defaults = {};
|
|
24490
|
+
|
|
24125
24491
|
/**
|
|
24126
24492
|
* @namespace bb
|
|
24127
|
-
* @version 3.7.0-next.
|
|
24493
|
+
* @version 3.7.0-next.3
|
|
24128
24494
|
*/
|
|
24495
|
+
var bb = {
|
|
24496
|
+
/**
|
|
24497
|
+
* Version information
|
|
24498
|
+
* @property {string} version version
|
|
24499
|
+
* @example
|
|
24500
|
+
* bb.version; // "1.0.0"
|
|
24501
|
+
* @memberof bb
|
|
24502
|
+
*/
|
|
24503
|
+
version: "3.7.0-next.3",
|
|
24504
|
+
/**
|
|
24505
|
+
* Generate chart
|
|
24506
|
+
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|
|
24507
|
+
* - Unused option value is given.
|
|
24508
|
+
* - ex) For `data.type="pie"` option, setting 'axis' option can cause unexpected generation error.
|
|
24509
|
+
* - Insufficient value is given for certain option used.
|
|
24510
|
+
* - ex) `data: { x: "x", columns: [["x"], ["data1", 30, 200, 100]] }`
|
|
24511
|
+
* @param {Options} config chart options
|
|
24512
|
+
* @memberof bb
|
|
24513
|
+
* @returns {Chart}
|
|
24514
|
+
* @see {@link Options} for different generation options
|
|
24515
|
+
* @see {@link Chart} for different methods API
|
|
24516
|
+
* @example
|
|
24517
|
+
* <!-- chart holder -->
|
|
24518
|
+
* <div id="LineChart"></div>
|
|
24519
|
+
* @example
|
|
24520
|
+
* // Generate chart with options
|
|
24521
|
+
* var chart = bb.generate({
|
|
24522
|
+
* "bindto": "#LineChart"
|
|
24523
|
+
* "data": {
|
|
24524
|
+
* "columns": [
|
|
24525
|
+
* ["data1", 30, 200, 100, 400, 150, 250],
|
|
24526
|
+
* ["data2", 50, 20, 10, 40, 15, 25]
|
|
24527
|
+
* ],
|
|
24528
|
+
* "type": "line"
|
|
24529
|
+
* }
|
|
24530
|
+
* });
|
|
24531
|
+
*
|
|
24532
|
+
* // call some API
|
|
24533
|
+
* // ex) get the data of 'data1'
|
|
24534
|
+
* chart.data("data1");
|
|
24535
|
+
* @example
|
|
24536
|
+
* // Generate chart by importing ESM
|
|
24537
|
+
* // Import types to be used only, where this will make smaller bundle size.
|
|
24538
|
+
* import bb, {
|
|
24539
|
+
* area,
|
|
24540
|
+
* areaLineRange,
|
|
24541
|
+
* areaSpline,
|
|
24542
|
+
* areaSplineRange,
|
|
24543
|
+
* areaStep,
|
|
24544
|
+
* bar,
|
|
24545
|
+
* bubble,
|
|
24546
|
+
* donut,
|
|
24547
|
+
* gauge,
|
|
24548
|
+
* line,
|
|
24549
|
+
* pie,
|
|
24550
|
+
* polar,
|
|
24551
|
+
* radar,
|
|
24552
|
+
* scatter,
|
|
24553
|
+
* spline,
|
|
24554
|
+
* step
|
|
24555
|
+
* }
|
|
24556
|
+
*
|
|
24557
|
+
* bb.generate({
|
|
24558
|
+
* "bindto": "#LineChart"
|
|
24559
|
+
* "data": {
|
|
24560
|
+
* "columns": [
|
|
24561
|
+
* ["data1", 30, 200, 100, 400, 150, 250],
|
|
24562
|
+
* ["data2", 50, 20, 10, 40, 15, 25]
|
|
24563
|
+
* ]
|
|
24564
|
+
* },
|
|
24565
|
+
* type: line(),
|
|
24566
|
+
*
|
|
24567
|
+
* // or
|
|
24568
|
+
* types: {
|
|
24569
|
+
* data1: bar(),
|
|
24570
|
+
* data2: step()
|
|
24571
|
+
* }
|
|
24572
|
+
* });
|
|
24573
|
+
*/
|
|
24574
|
+
generate: function generate(config) {
|
|
24575
|
+
var options = mergeObj({}, _defaults, config),
|
|
24576
|
+
inst = new Chart(options);
|
|
24577
|
+
inst.internal.charts = this.instance;
|
|
24578
|
+
this.instance.push(inst);
|
|
24579
|
+
return inst;
|
|
24580
|
+
},
|
|
24581
|
+
/**
|
|
24582
|
+
* Set or get global default options.
|
|
24583
|
+
* - **NOTE:**
|
|
24584
|
+
* - The options values settings are valid within page context only.
|
|
24585
|
+
* - If is called multiple times, will override the last value.
|
|
24586
|
+
* @param {Options} options chart options
|
|
24587
|
+
* @memberof bb
|
|
24588
|
+
* @returns {Options}
|
|
24589
|
+
* @see {@link Options}
|
|
24590
|
+
* @example
|
|
24591
|
+
* // Set same option value as for `.generate()`
|
|
24592
|
+
* bb.defaults({
|
|
24593
|
+
* data: {
|
|
24594
|
+
* type: "bar"
|
|
24595
|
+
* }
|
|
24596
|
+
* });
|
|
24597
|
+
*
|
|
24598
|
+
* bb.defaults(); // {data:{type: "bar"}}
|
|
24599
|
+
*
|
|
24600
|
+
* // data.type defaults to 'bar'
|
|
24601
|
+
* var chart = bb.generate({ ... });
|
|
24602
|
+
*/
|
|
24603
|
+
defaults: function defaults(options) {
|
|
24604
|
+
if (isObject(options)) {
|
|
24605
|
+
_defaults = options;
|
|
24606
|
+
}
|
|
24607
|
+
return _defaults;
|
|
24608
|
+
},
|
|
24609
|
+
/**
|
|
24610
|
+
* An array containing instance created
|
|
24611
|
+
* @property {Array} instance instance array
|
|
24612
|
+
* @example
|
|
24613
|
+
* // generate charts
|
|
24614
|
+
* var chart1 = bb.generate(...);
|
|
24615
|
+
* var chart2 = bb.generate(...);
|
|
24616
|
+
*
|
|
24617
|
+
* bb.instance; // [ chart1, chart2, ... ]
|
|
24618
|
+
* @memberof bb
|
|
24619
|
+
*/
|
|
24620
|
+
instance: [],
|
|
24621
|
+
/**
|
|
24622
|
+
* Namespace for plugins
|
|
24623
|
+
* @property {object} plugin plugin namespace
|
|
24624
|
+
* @example
|
|
24625
|
+
* // Stanford diagram plugin
|
|
24626
|
+
* bb.plugin.stanford;
|
|
24627
|
+
* @memberof bb
|
|
24628
|
+
*/
|
|
24629
|
+
plugin: {}
|
|
24630
|
+
};
|
|
24129
24631
|
;// CONCATENATED MODULE: ./src/index.ts
|
|
24130
24632
|
|
|
24131
24633
|
var src_this = undefined;
|