billboard.js 3.6.3 → 3.7.0-next.2
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 +1704 -843
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +3819 -2263
- package/dist/billboard.pkgd.min.js +6 -3
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +62 -23
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +62 -23
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +48 -14
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +48 -14
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +1087 -1031
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1171 -1112
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +1222 -1169
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1159 -1105
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1365 -1319
- 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 +942 -277
- 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 +10 -9
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +4 -8
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -5
- package/package.json +44 -38
- package/src/Chart/api/chart.ts +13 -4
- package/src/Chart/api/export.ts +159 -14
- package/src/Chart/api/legend.ts +1 -0
- package/src/Chart/api/load.ts +1 -0
- package/src/Chart/api/tooltip.ts +11 -2
- package/src/ChartInternal/Axis/Axis.ts +1 -1
- package/src/ChartInternal/ChartInternal.ts +35 -25
- package/src/ChartInternal/data/IData.ts +9 -0
- package/src/ChartInternal/data/convert.helper.ts +35 -21
- package/src/ChartInternal/data/data.ts +26 -5
- package/src/ChartInternal/data/load.ts +3 -0
- package/src/ChartInternal/interactions/interaction.ts +42 -33
- package/src/ChartInternal/internals/class.ts +3 -4
- package/src/ChartInternal/internals/clip.ts +13 -10
- package/src/ChartInternal/internals/domain.ts +11 -4
- package/src/ChartInternal/internals/format.ts +1 -1
- package/src/ChartInternal/internals/grid.ts +1 -1
- 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/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/arc.ts +145 -68
- package/src/ChartInternal/shape/area.ts +3 -0
- package/src/ChartInternal/shape/bar.ts +4 -1
- package/src/ChartInternal/shape/line.ts +12 -15
- 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/config/Options/common/tooltip.ts +11 -8
- package/src/config/Options/data/data.ts +6 -3
- package/src/config/Options/shape/arc.ts +47 -0
- package/src/config/Options/shape/gauge.ts +2 -2
- 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 +22 -5
- package/src/index.esm.ts +2 -1
- package/src/module/util.ts +1 -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/chart.d.ts +7 -0
- package/types/index.d.ts +1 -0
- package/types/options.d.ts +42 -624
- package/types/options.shape.d.ts +664 -0
- package/types/types.d.ts +4 -3
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.
|
|
8
|
+
* @version 3.7.0-next.2
|
|
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
|
/**
|
|
@@ -305,8 +314,39 @@ var TYPE_BY_CATEGORY = {
|
|
|
305
314
|
Step: [TYPE.STEP, TYPE.AREA_STEP],
|
|
306
315
|
Spline: [TYPE.SPLINE, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE]
|
|
307
316
|
};
|
|
317
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
318
|
+
function _typeof(obj) {
|
|
319
|
+
"@babel/helpers - typeof";
|
|
320
|
+
|
|
321
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
322
|
+
return typeof obj;
|
|
323
|
+
} : function (obj) {
|
|
324
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
325
|
+
}, _typeof(obj);
|
|
326
|
+
}
|
|
327
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
328
|
+
|
|
329
|
+
function _toPrimitive(input, hint) {
|
|
330
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
331
|
+
var prim = input[Symbol.toPrimitive];
|
|
332
|
+
if (prim !== undefined) {
|
|
333
|
+
var res = prim.call(input, hint || "default");
|
|
334
|
+
if (_typeof(res) !== "object") return res;
|
|
335
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
336
|
+
}
|
|
337
|
+
return (hint === "string" ? String : Number)(input);
|
|
338
|
+
}
|
|
339
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
function _toPropertyKey(arg) {
|
|
343
|
+
var key = _toPrimitive(arg, "string");
|
|
344
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
345
|
+
}
|
|
308
346
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
347
|
+
|
|
309
348
|
function _defineProperty(obj, key, value) {
|
|
349
|
+
key = _toPropertyKey(key);
|
|
310
350
|
if (key in obj) {
|
|
311
351
|
Object.defineProperty(obj, key, {
|
|
312
352
|
value: value,
|
|
@@ -435,7 +475,8 @@ function hasValue(dict, value) {
|
|
|
435
475
|
* @private
|
|
436
476
|
*/
|
|
437
477
|
function callFn(fn, thisArg) {
|
|
438
|
-
|
|
478
|
+
var isFn = isFunction(fn);
|
|
479
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
439
480
|
args[_key - 2] = arguments[_key];
|
|
440
481
|
}
|
|
441
482
|
isFn && fn.call.apply(fn, [thisArg].concat(args));
|
|
@@ -607,8 +648,9 @@ function getPointer(event, element) {
|
|
|
607
648
|
function getBrushSelection(ctx) {
|
|
608
649
|
var event = ctx.event,
|
|
609
650
|
$el = ctx.$el,
|
|
610
|
-
main = $el.subchart.main || $el.main
|
|
611
|
-
|
|
651
|
+
main = $el.subchart.main || $el.main;
|
|
652
|
+
var selection;
|
|
653
|
+
|
|
612
654
|
// check from event
|
|
613
655
|
if (event && event.type === "brush") {
|
|
614
656
|
selection = event.selection;
|
|
@@ -667,8 +709,8 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
667
709
|
if (start > end) {
|
|
668
710
|
return -1;
|
|
669
711
|
}
|
|
670
|
-
var mid = Math.floor((start + end) / 2)
|
|
671
|
-
|
|
712
|
+
var mid = Math.floor((start + end) / 2);
|
|
713
|
+
var _arr$mid = arr[mid],
|
|
672
714
|
x = _arr$mid.x,
|
|
673
715
|
_arr$mid$w = _arr$mid.w,
|
|
674
716
|
w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
|
@@ -706,12 +748,12 @@ function brushEmpty(ctx) {
|
|
|
706
748
|
* @private
|
|
707
749
|
*/
|
|
708
750
|
function deepClone() {
|
|
709
|
-
for (var _this6 = this,
|
|
751
|
+
for (var _this6 = this, _clone = function clone(v) {
|
|
710
752
|
_newArrowCheck(this, _this6);
|
|
711
753
|
if (isObject(v) && v.constructor) {
|
|
712
754
|
var r = new v.constructor();
|
|
713
755
|
for (var k in v) {
|
|
714
|
-
r[k] =
|
|
756
|
+
r[k] = _clone(v[k]);
|
|
715
757
|
}
|
|
716
758
|
return r;
|
|
717
759
|
}
|
|
@@ -721,7 +763,7 @@ function deepClone() {
|
|
|
721
763
|
}
|
|
722
764
|
return objectN.map(function (v) {
|
|
723
765
|
_newArrowCheck(this, _this6);
|
|
724
|
-
return
|
|
766
|
+
return _clone(v);
|
|
725
767
|
}.bind(this)).reduce(function (a, c) {
|
|
726
768
|
_newArrowCheck(this, _this6);
|
|
727
769
|
return _objectSpread(_objectSpread({}, a), c);
|
|
@@ -833,7 +875,8 @@ function getCssRules(styleSheets) {
|
|
|
833
875
|
rules = rules.concat(toArray(sheet.cssRules));
|
|
834
876
|
}
|
|
835
877
|
} catch (e) {
|
|
836
|
-
console
|
|
878
|
+
var _window$console;
|
|
879
|
+
(_window$console = win.console) == null ? void 0 : _window$console.warn("Error while reading rules from " + sheet.href + ": " + e.toString());
|
|
837
880
|
}
|
|
838
881
|
}.bind(this));
|
|
839
882
|
return rules;
|
|
@@ -1198,8 +1241,8 @@ function runUntil(fn, conditionFn) {
|
|
|
1198
1241
|
*/
|
|
1199
1242
|
function checkModuleImport(ctx) {
|
|
1200
1243
|
var $$ = ctx,
|
|
1201
|
-
config = $$.config
|
|
1202
|
-
|
|
1244
|
+
config = $$.config;
|
|
1245
|
+
var type = "";
|
|
1203
1246
|
if (isEmpty(config.data_type || config.data_types) && !$$[TYPE_METHOD_NEEDED.LINE]) {
|
|
1204
1247
|
type = "line";
|
|
1205
1248
|
} else {
|
|
@@ -1384,11 +1427,16 @@ var $TOOLTIP = {
|
|
|
1384
1427
|
tooltipContainer: "bb-tooltip-container",
|
|
1385
1428
|
tooltipName: "bb-tooltip-name"
|
|
1386
1429
|
};
|
|
1430
|
+
var $TREEMAP = {
|
|
1431
|
+
treemap: "bb-treemap",
|
|
1432
|
+
chartTreemap: "bb-chart-treemap",
|
|
1433
|
+
chartTreemaps: "bb-chart-treemaps"
|
|
1434
|
+
};
|
|
1387
1435
|
var $ZOOM = {
|
|
1388
1436
|
buttonZoomReset: "bb-zoom-reset",
|
|
1389
1437
|
zoomBrush: "bb-zoom-brush"
|
|
1390
1438
|
};
|
|
1391
|
-
/* 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));
|
|
1392
1440
|
;// CONCATENATED MODULE: ./src/config/Store/Element.ts
|
|
1393
1441
|
/**
|
|
1394
1442
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -1507,6 +1555,7 @@ var State = function () {
|
|
|
1507
1555
|
xAxisHeight: 0,
|
|
1508
1556
|
hasAxis: !1,
|
|
1509
1557
|
hasRadar: !1,
|
|
1558
|
+
hasTreemap: !1,
|
|
1510
1559
|
// for data CSS rule index (used when boost.useCssRule is true)
|
|
1511
1560
|
cssRule: {},
|
|
1512
1561
|
current: {
|
|
@@ -2172,6 +2221,7 @@ var data_this = undefined;
|
|
|
2172
2221
|
* - scatter
|
|
2173
2222
|
* - spline
|
|
2174
2223
|
* - step
|
|
2224
|
+
* - treemap
|
|
2175
2225
|
* @name data․type
|
|
2176
2226
|
* @memberof Options
|
|
2177
2227
|
* @type {string}
|
|
@@ -2200,7 +2250,8 @@ var data_this = undefined;
|
|
|
2200
2250
|
* radar,
|
|
2201
2251
|
* scatter,
|
|
2202
2252
|
* spline,
|
|
2203
|
-
* step
|
|
2253
|
+
* step,
|
|
2254
|
+
* treemap
|
|
2204
2255
|
* }
|
|
2205
2256
|
*
|
|
2206
2257
|
* bb.generate({
|
|
@@ -2214,7 +2265,7 @@ var data_this = undefined;
|
|
|
2214
2265
|
/**
|
|
2215
2266
|
* Set chart type for each data.<br>
|
|
2216
2267
|
* This setting overwrites data.type setting.
|
|
2217
|
-
* - **NOTE:** `radar` type can't be combined with other types.
|
|
2268
|
+
* - **NOTE:** `radar` and `treemap` type can't be combined with other types.
|
|
2218
2269
|
* @name data․types
|
|
2219
2270
|
* @memberof Options
|
|
2220
2271
|
* @type {object}
|
|
@@ -2246,7 +2297,8 @@ var data_this = undefined;
|
|
|
2246
2297
|
* radar,
|
|
2247
2298
|
* scatter,
|
|
2248
2299
|
* spline,
|
|
2249
|
-
* step
|
|
2300
|
+
* step,
|
|
2301
|
+
* treemap
|
|
2250
2302
|
* }
|
|
2251
2303
|
*
|
|
2252
2304
|
* bb.generate({
|
|
@@ -3247,17 +3299,20 @@ var tooltip_this = undefined;
|
|
|
3247
3299
|
* Specified function receives x of the data point to show.
|
|
3248
3300
|
* @property {Function} [tooltip.format.name] Set format for the name of each data in tooltip.<br>
|
|
3249
3301
|
* Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not donut/pie/gauge.
|
|
3250
|
-
* @property {Function} [tooltip.format.value] Set format for the value of each data in tooltip
|
|
3251
|
-
*
|
|
3252
|
-
*
|
|
3302
|
+
* @property {Function} [tooltip.format.value] Set format for the value of each data in tooltip. If undefined returned, the row of that value will be skipped to be called.
|
|
3303
|
+
* - Will pass following arguments to the given function:
|
|
3304
|
+
* - `value {string}`: Value of the data point
|
|
3305
|
+
* - `ratio {number}`: Ratio of the data point in the `pie/donut/gauge` and `area/bar` when contains grouped data. Otherwise is `undefined`.
|
|
3306
|
+
* - `id {string}`: id of the data point
|
|
3307
|
+
* - `index {number}`: Index of the data point
|
|
3253
3308
|
* @property {Function} [tooltip.position] Set custom position function for the tooltip.<br>
|
|
3254
3309
|
* This option can be used to modify the tooltip position by returning object that has top and left.
|
|
3255
3310
|
* - Will pass following arguments to the given function:
|
|
3256
|
-
*
|
|
3257
|
-
*
|
|
3258
|
-
*
|
|
3259
|
-
*
|
|
3260
|
-
*
|
|
3311
|
+
* - `data {Array}`: Current selected data array object.
|
|
3312
|
+
* - `width {number}`: Width of tooltip.
|
|
3313
|
+
* - `height {number}`: Height of tooltip.
|
|
3314
|
+
* - `element {SVGElement}`: Tooltip event bound element
|
|
3315
|
+
* - `pos {object}`: Current position of the tooltip.
|
|
3261
3316
|
* @property {Function|object} [tooltip.contents] Set custom HTML for the tooltip.<br>
|
|
3262
3317
|
* If tooltip.grouped is true, data includes multiple data points.<br><br>
|
|
3263
3318
|
* Specified function receives `data` array and `defaultTitleFormat`, `defaultValueFormat` and `color` functions of the data point to show.
|
|
@@ -3688,40 +3743,42 @@ function generateResize(option) {
|
|
|
3688
3743
|
* @private
|
|
3689
3744
|
*/
|
|
3690
3745
|
function generateWait() {
|
|
3691
|
-
var transitionsToWait = []
|
|
3692
|
-
f = function (selection, callback) {
|
|
3693
|
-
var _this5 = this;
|
|
3694
|
-
/**
|
|
3695
|
-
* Check if transition is complete
|
|
3696
|
-
* @returns {boolean} Whether transition is complete
|
|
3697
|
-
* @private
|
|
3698
|
-
*/
|
|
3699
|
-
function loop() {
|
|
3700
|
-
var done = 0;
|
|
3701
|
-
for (var i = 0, t; t = transitionsToWait[i]; i++) {
|
|
3702
|
-
if (t === !0 || t.empty != null && t.empty()) {
|
|
3703
|
-
done++;
|
|
3704
|
-
continue;
|
|
3705
|
-
}
|
|
3746
|
+
var transitionsToWait = [];
|
|
3706
3747
|
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
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++;
|
|
3717
3773
|
}
|
|
3718
|
-
return done === transitionsToWait.length;
|
|
3719
3774
|
}
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3775
|
+
return done === transitionsToWait.length;
|
|
3776
|
+
}
|
|
3777
|
+
runUntil(function () {
|
|
3778
|
+
_newArrowCheck(this, _this5);
|
|
3779
|
+
callback == null ? void 0 : callback();
|
|
3780
|
+
}.bind(this), loop);
|
|
3781
|
+
};
|
|
3725
3782
|
f.add = function (t) {
|
|
3726
3783
|
isArray(t) ? transitionsToWait = transitionsToWait.concat(t) : transitionsToWait.push(t);
|
|
3727
3784
|
};
|
|
@@ -3894,22 +3951,22 @@ function rows(rows) {
|
|
|
3894
3951
|
* @private
|
|
3895
3952
|
*/
|
|
3896
3953
|
function json(json, keysParam) {
|
|
3897
|
-
var newRows = []
|
|
3898
|
-
|
|
3954
|
+
var newRows = [];
|
|
3955
|
+
var targetKeys, data;
|
|
3956
|
+
if (Array.isArray(json)) {
|
|
3957
|
+
var findValueInJson = function (object, path) {
|
|
3899
3958
|
if (object[path] !== undefined) {
|
|
3900
3959
|
return object[path];
|
|
3901
3960
|
}
|
|
3902
3961
|
var convertedPath = path.replace(/\[(\w+)\]/g, ".$1"),
|
|
3903
|
-
pathArray = convertedPath.replace(/^\./, "").split(".")
|
|
3904
|
-
|
|
3962
|
+
pathArray = convertedPath.replace(/^\./, "").split("."); // convert indexes to properties (replace [] with .)
|
|
3963
|
+
// strip a leading dot
|
|
3964
|
+
var target = object;
|
|
3905
3965
|
pathArray.some(function (k) {
|
|
3906
3966
|
return !(target = target && k in target ? target[k] : undefined);
|
|
3907
3967
|
});
|
|
3908
3968
|
return target;
|
|
3909
|
-
}
|
|
3910
|
-
targetKeys,
|
|
3911
|
-
data;
|
|
3912
|
-
if (Array.isArray(json)) {
|
|
3969
|
+
};
|
|
3913
3970
|
if (keysParam.x) {
|
|
3914
3971
|
targetKeys = keysParam.value.concat(keysParam.x);
|
|
3915
3972
|
} else {
|
|
@@ -3931,13 +3988,25 @@ function json(json, keysParam) {
|
|
|
3931
3988
|
} else {
|
|
3932
3989
|
Object.keys(json).forEach(function (key) {
|
|
3933
3990
|
var tmp = json[key].concat();
|
|
3934
|
-
tmp.unshift(key);
|
|
3991
|
+
tmp.unshift == null ? void 0 : tmp.unshift(key);
|
|
3935
3992
|
newRows.push(tmp);
|
|
3936
3993
|
});
|
|
3937
3994
|
data = columns(newRows);
|
|
3938
3995
|
}
|
|
3939
3996
|
return data;
|
|
3940
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
|
+
}
|
|
3941
4010
|
|
|
3942
4011
|
/***** Functions can't be executed on Web Worker *****/
|
|
3943
4012
|
/**
|
|
@@ -3986,13 +4055,13 @@ function url(url, mimeType, headers, keys, done) {
|
|
|
3986
4055
|
* @private
|
|
3987
4056
|
*/
|
|
3988
4057
|
function convertCsvTsvToData(parser, xsv) {
|
|
3989
|
-
var
|
|
4058
|
+
var _this2 = this,
|
|
3990
4059
|
rows = parser.rows(xsv),
|
|
3991
4060
|
d;
|
|
3992
4061
|
if (rows.length === 1) {
|
|
3993
4062
|
d = [{}];
|
|
3994
4063
|
rows[0].forEach(function (id) {
|
|
3995
|
-
_newArrowCheck(this,
|
|
4064
|
+
_newArrowCheck(this, _this2);
|
|
3996
4065
|
d[0][id] = null;
|
|
3997
4066
|
}.bind(this));
|
|
3998
4067
|
} else {
|
|
@@ -4091,8 +4160,9 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4091
4160
|
}
|
|
4092
4161
|
var dataKeys = Object.keys(data[0] || {}),
|
|
4093
4162
|
ids = dataKeys.length ? dataKeys.filter($$.isNotX, $$) : [],
|
|
4094
|
-
xs = dataKeys.length ? dataKeys.filter($$.isX, $$) : []
|
|
4095
|
-
|
|
4163
|
+
xs = dataKeys.length ? dataKeys.filter($$.isX, $$) : [];
|
|
4164
|
+
var xsData;
|
|
4165
|
+
|
|
4096
4166
|
// save x for update data by load when custom x and bb.x API
|
|
4097
4167
|
ids.forEach(function (id) {
|
|
4098
4168
|
var _this3 = this;
|
|
@@ -4154,8 +4224,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4154
4224
|
id_org: id,
|
|
4155
4225
|
values: data.map(function (d, i) {
|
|
4156
4226
|
_newArrowCheck(this, _this4);
|
|
4157
|
-
var rawX = d[xKey]
|
|
4158
|
-
|
|
4227
|
+
var rawX = d[xKey];
|
|
4228
|
+
var value = d[id],
|
|
4159
4229
|
x;
|
|
4160
4230
|
value = value !== null && !isNaN(value) && !isObject(value) ? +value : isArray(value) || isObject(value) ? value : null;
|
|
4161
4231
|
|
|
@@ -4328,8 +4398,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4328
4398
|
},
|
|
4329
4399
|
addName: function addName(data) {
|
|
4330
4400
|
var $$ = this,
|
|
4331
|
-
config = $$.config
|
|
4332
|
-
|
|
4401
|
+
config = $$.config;
|
|
4402
|
+
var name;
|
|
4333
4403
|
if (data) {
|
|
4334
4404
|
name = config.data_names[data.id];
|
|
4335
4405
|
data.name = name !== undefined ? name : data.id;
|
|
@@ -4348,11 +4418,11 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4348
4418
|
if (filterNull === void 0) {
|
|
4349
4419
|
filterNull = !1;
|
|
4350
4420
|
}
|
|
4351
|
-
var $$ = this
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
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));
|
|
4356
4426
|
if (filterNull) {
|
|
4357
4427
|
value = value.filter(function (v) {
|
|
4358
4428
|
_newArrowCheck(this, _this4);
|
|
@@ -4392,8 +4462,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4392
4462
|
},
|
|
4393
4463
|
generateTargetX: function generateTargetX(rawX, id, index) {
|
|
4394
4464
|
var $$ = this,
|
|
4395
|
-
axis = $$.axis
|
|
4396
|
-
|
|
4465
|
+
axis = $$.axis;
|
|
4466
|
+
var x = axis != null && axis.isCategorized() ? index : rawX || index;
|
|
4397
4467
|
if (axis != null && axis.isTimeSeries()) {
|
|
4398
4468
|
var fn = parseDate.bind($$);
|
|
4399
4469
|
x = rawX ? fn(rawX) : fn($$.getXValue(id, index));
|
|
@@ -4427,8 +4497,9 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4427
4497
|
*/
|
|
4428
4498
|
getBaseValue: function getBaseValue(data) {
|
|
4429
4499
|
var $$ = this,
|
|
4430
|
-
hasAxis = $$.state.hasAxis
|
|
4431
|
-
|
|
4500
|
+
hasAxis = $$.state.hasAxis;
|
|
4501
|
+
var value = data.value;
|
|
4502
|
+
|
|
4432
4503
|
// In case of area-range, data is given as: [low, mid, high] or {low, mid, high}
|
|
4433
4504
|
// will take the 'mid' as the base value
|
|
4434
4505
|
if (value && hasAxis) {
|
|
@@ -4480,25 +4551,25 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4480
4551
|
_newArrowCheck(this, _this11);
|
|
4481
4552
|
return t.values;
|
|
4482
4553
|
}.bind(this)),
|
|
4483
|
-
minMax = $$.getMinMaxValue(data)
|
|
4484
|
-
|
|
4485
|
-
|
|
4554
|
+
minMax = $$.getMinMaxValue(data);
|
|
4555
|
+
var min = [],
|
|
4556
|
+
max = [];
|
|
4486
4557
|
data.forEach(function (v) {
|
|
4487
4558
|
_newArrowCheck(this, _this11);
|
|
4488
4559
|
var minData = $$.getFilteredDataByValue(v, minMax.min),
|
|
4489
4560
|
maxData = $$.getFilteredDataByValue(v, minMax.max);
|
|
4490
4561
|
if (minData.length) {
|
|
4491
|
-
|
|
4562
|
+
min = min.concat(minData);
|
|
4492
4563
|
}
|
|
4493
4564
|
if (maxData.length) {
|
|
4494
|
-
|
|
4565
|
+
max = max.concat(maxData);
|
|
4495
4566
|
}
|
|
4496
4567
|
}.bind(this));
|
|
4497
4568
|
|
|
4498
4569
|
// update the cached data
|
|
4499
4570
|
$$.cache.add(cacheKey, minMaxData = {
|
|
4500
|
-
min:
|
|
4501
|
-
max:
|
|
4571
|
+
min: min,
|
|
4572
|
+
max: max
|
|
4502
4573
|
});
|
|
4503
4574
|
}
|
|
4504
4575
|
return minMaxData;
|
|
@@ -4513,7 +4584,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4513
4584
|
$$ = this,
|
|
4514
4585
|
cacheKey = KEY.dataTotalPerIndex,
|
|
4515
4586
|
sum = $$.cache.get(cacheKey);
|
|
4516
|
-
if ($$.isStackNormalized() && !sum) {
|
|
4587
|
+
if (($$.config.data_groups.length || $$.isStackNormalized()) && !sum) {
|
|
4517
4588
|
sum = [];
|
|
4518
4589
|
$$.data.targets.forEach(function (row) {
|
|
4519
4590
|
var _this13 = this;
|
|
@@ -4541,7 +4612,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4541
4612
|
cacheKey = KEY.dataTotalSum,
|
|
4542
4613
|
total = $$.cache.get(cacheKey);
|
|
4543
4614
|
if (!isNumber(total)) {
|
|
4544
|
-
var
|
|
4615
|
+
var sum = mergeArray($$.data.targets.map(function (t) {
|
|
4545
4616
|
_newArrowCheck(this, _this14);
|
|
4546
4617
|
return t.values;
|
|
4547
4618
|
}.bind(this))).map(function (v) {
|
|
@@ -4551,7 +4622,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4551
4622
|
_newArrowCheck(this, _this14);
|
|
4552
4623
|
return p + c;
|
|
4553
4624
|
}.bind(this));
|
|
4554
|
-
$$.cache.add(cacheKey, total =
|
|
4625
|
+
$$.cache.add(cacheKey, total = sum);
|
|
4555
4626
|
}
|
|
4556
4627
|
if (subtractHidden) {
|
|
4557
4628
|
total -= $$.getHiddenTotalDataSum();
|
|
@@ -4773,8 +4844,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4773
4844
|
return ys;
|
|
4774
4845
|
},
|
|
4775
4846
|
checkValueInTargets: function checkValueInTargets(targets, checker) {
|
|
4776
|
-
var ids = Object.keys(targets)
|
|
4777
|
-
|
|
4847
|
+
var ids = Object.keys(targets);
|
|
4848
|
+
var values;
|
|
4778
4849
|
for (var i = 0; i < ids.length; i++) {
|
|
4779
4850
|
values = targets[ids[i]].values;
|
|
4780
4851
|
for (var j = 0; j < values.length; j++) {
|
|
@@ -4818,21 +4889,21 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4818
4889
|
},
|
|
4819
4890
|
/**
|
|
4820
4891
|
* Get data.order compare function
|
|
4821
|
-
* @param {boolean}
|
|
4892
|
+
* @param {boolean} isReversed for Arc & Treemap type sort order needs to be reversed
|
|
4822
4893
|
* @returns {Function} compare function
|
|
4823
4894
|
* @private
|
|
4824
4895
|
*/
|
|
4825
|
-
getSortCompareFn: function getSortCompareFn(
|
|
4896
|
+
getSortCompareFn: function getSortCompareFn(isReversed) {
|
|
4826
4897
|
var _this29 = this;
|
|
4827
|
-
if (
|
|
4828
|
-
|
|
4898
|
+
if (isReversed === void 0) {
|
|
4899
|
+
isReversed = !1;
|
|
4829
4900
|
}
|
|
4830
4901
|
var $$ = this,
|
|
4831
4902
|
config = $$.config,
|
|
4832
4903
|
order = config.data_order,
|
|
4833
4904
|
orderAsc = /asc/i.test(order),
|
|
4834
|
-
orderDesc = /desc/i.test(order)
|
|
4835
|
-
|
|
4905
|
+
orderDesc = /desc/i.test(order);
|
|
4906
|
+
var fn;
|
|
4836
4907
|
if (orderAsc || orderDesc) {
|
|
4837
4908
|
var reducer = function (p, c) {
|
|
4838
4909
|
_newArrowCheck(this, _this29);
|
|
@@ -4842,7 +4913,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4842
4913
|
_newArrowCheck(this, _this29);
|
|
4843
4914
|
var t1Sum = "values" in t1 ? t1.values.reduce(reducer, 0) : t1.value,
|
|
4844
4915
|
t2Sum = "values" in t2 ? t2.values.reduce(reducer, 0) : t2.value;
|
|
4845
|
-
return
|
|
4916
|
+
return isReversed ? orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum : orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;
|
|
4846
4917
|
}.bind(this);
|
|
4847
4918
|
} else if (isFunction(order)) {
|
|
4848
4919
|
fn = order.bind($$.api);
|
|
@@ -4923,8 +4994,8 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4923
4994
|
},
|
|
4924
4995
|
findSameXOfValues: function findSameXOfValues(values, index) {
|
|
4925
4996
|
var targetX = values[index].x,
|
|
4926
|
-
sames = []
|
|
4927
|
-
|
|
4997
|
+
sames = [];
|
|
4998
|
+
var i;
|
|
4928
4999
|
for (i = index - 1; i >= 0; i--) {
|
|
4929
5000
|
if (targetX !== values[i].x) {
|
|
4930
5001
|
break;
|
|
@@ -5019,8 +5090,9 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5019
5090
|
// insert & append cloning first/last value to be fully rendered covering on each gap sides
|
|
5020
5091
|
var head = converted[0],
|
|
5021
5092
|
tail = converted[converted.length - 1],
|
|
5022
|
-
id = head.id
|
|
5023
|
-
|
|
5093
|
+
id = head.id;
|
|
5094
|
+
var x = head.x;
|
|
5095
|
+
|
|
5024
5096
|
// insert head
|
|
5025
5097
|
converted.unshift({
|
|
5026
5098
|
x: --x,
|
|
@@ -5105,6 +5177,30 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5105
5177
|
}
|
|
5106
5178
|
return value;
|
|
5107
5179
|
},
|
|
5180
|
+
/**
|
|
5181
|
+
* Set ratio for grouped data
|
|
5182
|
+
* @param {Array} data Data array
|
|
5183
|
+
* @private
|
|
5184
|
+
*/
|
|
5185
|
+
setRatioForGroupedData: function setRatioForGroupedData(data) {
|
|
5186
|
+
var _this39 = this,
|
|
5187
|
+
$$ = this,
|
|
5188
|
+
config = $$.config;
|
|
5189
|
+
// calculate ratio if grouped data exists
|
|
5190
|
+
if (config.data_groups.length && data.some(function (d) {
|
|
5191
|
+
_newArrowCheck(this, _this39);
|
|
5192
|
+
return $$.isGrouped(d.id);
|
|
5193
|
+
}.bind(this))) {
|
|
5194
|
+
var setter = function (d) {
|
|
5195
|
+
_newArrowCheck(this, _this39);
|
|
5196
|
+
return $$.getRatio("index", d, !0);
|
|
5197
|
+
}.bind(this);
|
|
5198
|
+
data.forEach(function (v) {
|
|
5199
|
+
_newArrowCheck(this, _this39);
|
|
5200
|
+
"values" in v ? v.values.forEach(setter) : setter(v);
|
|
5201
|
+
}.bind(this));
|
|
5202
|
+
}
|
|
5203
|
+
},
|
|
5108
5204
|
/**
|
|
5109
5205
|
* Get ratio value
|
|
5110
5206
|
* @param {string} type Ratio for given type
|
|
@@ -5114,15 +5210,15 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5114
5210
|
* @private
|
|
5115
5211
|
*/
|
|
5116
5212
|
getRatio: function getRatio(type, d, asPercent) {
|
|
5117
|
-
var
|
|
5213
|
+
var _this40 = this;
|
|
5118
5214
|
if (asPercent === void 0) {
|
|
5119
5215
|
asPercent = !1;
|
|
5120
5216
|
}
|
|
5121
5217
|
var $$ = this,
|
|
5122
5218
|
config = $$.config,
|
|
5123
5219
|
state = $$.state,
|
|
5124
|
-
api = $$.api
|
|
5125
|
-
|
|
5220
|
+
api = $$.api;
|
|
5221
|
+
var ratio = 0;
|
|
5126
5222
|
if (d && api.data.shown().length) {
|
|
5127
5223
|
ratio = d.ratio || d.value;
|
|
5128
5224
|
if (type === "arc") {
|
|
@@ -5137,37 +5233,39 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5137
5233
|
ratio = (d.endAngle - d.startAngle) / arcLength;
|
|
5138
5234
|
}
|
|
5139
5235
|
} else if (type === "index") {
|
|
5140
|
-
var dataValues = api.data.values.bind(api)
|
|
5141
|
-
|
|
5236
|
+
var dataValues = api.data.values.bind(api);
|
|
5237
|
+
var total = this.getTotalPerIndex();
|
|
5142
5238
|
if (state.hiddenTargetIds.length) {
|
|
5143
5239
|
var hiddenSum = dataValues(state.hiddenTargetIds, !1);
|
|
5144
5240
|
if (hiddenSum.length) {
|
|
5145
5241
|
hiddenSum = hiddenSum.reduce(function (acc, curr) {
|
|
5146
|
-
var
|
|
5147
|
-
_newArrowCheck(this,
|
|
5242
|
+
var _this41 = this;
|
|
5243
|
+
_newArrowCheck(this, _this40);
|
|
5148
5244
|
return acc.map(function (v, i) {
|
|
5149
|
-
_newArrowCheck(this,
|
|
5245
|
+
_newArrowCheck(this, _this41);
|
|
5150
5246
|
return (isNumber(v) ? v : 0) + curr[i];
|
|
5151
5247
|
}.bind(this));
|
|
5152
5248
|
}.bind(this));
|
|
5153
5249
|
total = total.map(function (v, i) {
|
|
5154
|
-
_newArrowCheck(this,
|
|
5250
|
+
_newArrowCheck(this, _this40);
|
|
5155
5251
|
return v - hiddenSum[i];
|
|
5156
5252
|
}.bind(this));
|
|
5157
5253
|
}
|
|
5158
5254
|
}
|
|
5159
|
-
d.ratio = isNumber(d.value) && total
|
|
5255
|
+
d.ratio = isNumber(d.value) && total ? d.value / total[d.index] : 0;
|
|
5160
5256
|
ratio = d.ratio;
|
|
5161
5257
|
} else if (type === "radar") {
|
|
5162
5258
|
ratio = parseFloat(Math.max(d.value, 0) + "") / state.current.dataMax * config.radar_size_ratio;
|
|
5163
5259
|
} else if (type === "bar") {
|
|
5164
5260
|
var yScale = $$.getYScaleById.bind($$)(d.id),
|
|
5165
|
-
|
|
5166
|
-
_newArrowCheck(this,
|
|
5261
|
+
max = yScale.domain().reduce(function (a, c) {
|
|
5262
|
+
_newArrowCheck(this, _this40);
|
|
5167
5263
|
return c - a;
|
|
5168
5264
|
}.bind(this));
|
|
5169
5265
|
// when all data are 0, return 0
|
|
5170
|
-
ratio =
|
|
5266
|
+
ratio = max === 0 ? 0 : Math.abs(d.value) / max;
|
|
5267
|
+
} else if (type === "treemap") {
|
|
5268
|
+
ratio /= $$.getTotalDataSum(!0);
|
|
5171
5269
|
}
|
|
5172
5270
|
}
|
|
5173
5271
|
return asPercent && ratio ? ratio * 100 : ratio;
|
|
@@ -5178,18 +5276,18 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5178
5276
|
* @private
|
|
5179
5277
|
*/
|
|
5180
5278
|
updateDataIndexByX: function updateDataIndexByX(tickValues) {
|
|
5181
|
-
var
|
|
5279
|
+
var _this42 = this,
|
|
5182
5280
|
$$ = this,
|
|
5183
5281
|
tickValueMap = tickValues.reduce(function (out, tick, index) {
|
|
5184
|
-
_newArrowCheck(this,
|
|
5282
|
+
_newArrowCheck(this, _this42);
|
|
5185
5283
|
out[+tick.x] = index;
|
|
5186
5284
|
return out;
|
|
5187
5285
|
}.bind(this), {});
|
|
5188
5286
|
$$.data.targets.forEach(function (t) {
|
|
5189
|
-
var
|
|
5190
|
-
_newArrowCheck(this,
|
|
5287
|
+
var _this43 = this;
|
|
5288
|
+
_newArrowCheck(this, _this42);
|
|
5191
5289
|
t.values.forEach(function (value, valueIndex) {
|
|
5192
|
-
_newArrowCheck(this,
|
|
5290
|
+
_newArrowCheck(this, _this43);
|
|
5193
5291
|
var index = tickValueMap[+value.x];
|
|
5194
5292
|
if (index === undefined) {
|
|
5195
5293
|
index = valueIndex;
|
|
@@ -5215,11 +5313,11 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5215
5313
|
* @private
|
|
5216
5314
|
*/
|
|
5217
5315
|
isBarRangeType: function isBarRangeType(d) {
|
|
5218
|
-
var
|
|
5316
|
+
var _this44 = this,
|
|
5219
5317
|
$$ = this,
|
|
5220
5318
|
value = d.value;
|
|
5221
5319
|
return $$.isBarType(d) && isArray(value) && value.length === 2 && value.every(function (v) {
|
|
5222
|
-
_newArrowCheck(this,
|
|
5320
|
+
_newArrowCheck(this, _this44);
|
|
5223
5321
|
return isNumber(v);
|
|
5224
5322
|
}.bind(this));
|
|
5225
5323
|
},
|
|
@@ -5361,6 +5459,9 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5361
5459
|
}.bind(this));
|
|
5362
5460
|
}.bind(this));
|
|
5363
5461
|
|
|
5462
|
+
// since treemap uses different data types, it needs to be transformed
|
|
5463
|
+
state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
|
|
5464
|
+
|
|
5364
5465
|
// Update current state chart type and elements list after redraw
|
|
5365
5466
|
$$.updateTypesElements();
|
|
5366
5467
|
}
|
|
@@ -5474,15 +5575,18 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5474
5575
|
var _this5 = this,
|
|
5475
5576
|
$$ = this,
|
|
5476
5577
|
config = $$.config,
|
|
5477
|
-
|
|
5578
|
+
_$$$state = $$.state,
|
|
5579
|
+
hasRadar = _$$$state.hasRadar,
|
|
5580
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
5478
5581
|
main = $$.$el.main,
|
|
5479
|
-
|
|
5582
|
+
isArcTreemap = isObject(d);
|
|
5480
5583
|
// Call event handler
|
|
5481
|
-
if (
|
|
5584
|
+
if (isArcTreemap || d !== -1) {
|
|
5482
5585
|
var callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
|
|
5483
|
-
config.color_onover && $$.setOverColor(isOver, d,
|
|
5484
|
-
if (
|
|
5485
|
-
|
|
5586
|
+
config.color_onover && $$.setOverColor(isOver, d, isArcTreemap);
|
|
5587
|
+
if (isArcTreemap && "id") {
|
|
5588
|
+
var selector = hasTreemap ? $TREEMAP.treemap : $ARC.arc;
|
|
5589
|
+
callback(d, main.select("." + selector + $$.getTargetSelectorSuffix(d.id)).node());
|
|
5486
5590
|
} else if (!config.tooltip_grouped) {
|
|
5487
5591
|
var last = $$.cache.get(KEY.setOverOut) || [],
|
|
5488
5592
|
shapesAtIndex = main.selectAll("." + $SHAPE.shape + "-" + d).filter(function (d) {
|
|
@@ -5570,40 +5674,45 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5570
5674
|
* @param {Array} mouse x and y coordinate value
|
|
5571
5675
|
*/
|
|
5572
5676
|
dispatchEvent: function dispatchEvent(type, index, mouse) {
|
|
5573
|
-
var
|
|
5677
|
+
var _ref,
|
|
5678
|
+
_this7 = this,
|
|
5574
5679
|
$$ = this,
|
|
5575
5680
|
config = $$.config,
|
|
5576
|
-
_$$$
|
|
5577
|
-
eventReceiver = _$$$
|
|
5578
|
-
hasAxis = _$$$
|
|
5579
|
-
hasRadar = _$$$
|
|
5681
|
+
_$$$state2 = $$.state,
|
|
5682
|
+
eventReceiver = _$$$state2.eventReceiver,
|
|
5683
|
+
hasAxis = _$$$state2.hasAxis,
|
|
5684
|
+
hasRadar = _$$$state2.hasRadar,
|
|
5685
|
+
hasTreemap = _$$$state2.hasTreemap,
|
|
5580
5686
|
_$$$$el = $$.$el,
|
|
5581
5687
|
eventRect = _$$$$el.eventRect,
|
|
5582
5688
|
arcs = _$$$$el.arcs,
|
|
5583
5689
|
radar = _$$$$el.radar,
|
|
5584
|
-
|
|
5585
|
-
element = (hasRadar
|
|
5690
|
+
treemap = _$$$$el.treemap,
|
|
5691
|
+
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) {
|
|
5586
5692
|
_newArrowCheck(this, _this7);
|
|
5587
5693
|
return i === index;
|
|
5588
|
-
}.bind(this))).node()
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5694
|
+
}.bind(this)))) == null ? void 0 : _ref.node();
|
|
5695
|
+
if (element) {
|
|
5696
|
+
var isMultipleX = $$.isMultipleX();
|
|
5697
|
+
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
5698
|
+
width = _element$getBoundingC.width,
|
|
5699
|
+
left = _element$getBoundingC.left,
|
|
5700
|
+
top = _element$getBoundingC.top;
|
|
5701
|
+
if (hasAxis && !hasRadar && !isMultipleX) {
|
|
5702
|
+
var coords = eventReceiver.coords[index];
|
|
5703
|
+
width = coords.w;
|
|
5704
|
+
left += coords.x;
|
|
5705
|
+
top += coords.y;
|
|
5706
|
+
}
|
|
5707
|
+
var x = left + (mouse ? mouse[0] : 0) + (isMultipleX || config.axis_rotated ? 0 : width / 2),
|
|
5708
|
+
y = top + (mouse ? mouse[1] : 0);
|
|
5709
|
+
emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](hasTreemap ? treemap.node() : element, type, {
|
|
5710
|
+
screenX: x,
|
|
5711
|
+
screenY: y,
|
|
5712
|
+
clientX: x,
|
|
5713
|
+
clientY: y
|
|
5714
|
+
});
|
|
5715
|
+
}
|
|
5607
5716
|
},
|
|
5608
5717
|
setDragStatus: function setDragStatus(isDragging) {
|
|
5609
5718
|
this.state.dragging = isDragging;
|
|
@@ -5633,9 +5742,10 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5633
5742
|
legend = _$$$$el3.legend,
|
|
5634
5743
|
region = _$$$$el3.region,
|
|
5635
5744
|
svg = _$$$$el3.svg,
|
|
5745
|
+
treemap = _$$$$el3.treemap,
|
|
5636
5746
|
brush = $$.brush;
|
|
5637
5747
|
// detach all possible event types
|
|
5638
|
-
[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) {
|
|
5748
|
+
[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) {
|
|
5639
5749
|
_newArrowCheck(this, _this8);
|
|
5640
5750
|
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);
|
|
5641
5751
|
}.bind(this));
|
|
@@ -5663,7 +5773,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5663
5773
|
getClass: function getClass(type, withShape) {
|
|
5664
5774
|
var _this = this,
|
|
5665
5775
|
isPlural = /s$/.test(type),
|
|
5666
|
-
useIdKey = /^(area|arc|line)s?$/.test(type),
|
|
5776
|
+
useIdKey = /^(area|arc|line|treemap)s?$/.test(type),
|
|
5667
5777
|
key = isPlural ? "id" : "index";
|
|
5668
5778
|
return function (d) {
|
|
5669
5779
|
_newArrowCheck(this, _this);
|
|
@@ -5702,8 +5812,8 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5702
5812
|
return this.generateClass(classes.region, i) + " " + ("class" in d ? d.class : "");
|
|
5703
5813
|
},
|
|
5704
5814
|
classTarget: function classTarget(id) {
|
|
5705
|
-
var additionalClassSuffix = this.config.data_classes[id]
|
|
5706
|
-
|
|
5815
|
+
var additionalClassSuffix = this.config.data_classes[id];
|
|
5816
|
+
var additionalClass = "";
|
|
5707
5817
|
if (additionalClassSuffix) {
|
|
5708
5818
|
additionalClass = " " + classes.target + "-" + additionalClassSuffix;
|
|
5709
5819
|
}
|
|
@@ -5722,11 +5832,17 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
5722
5832
|
var targetStr = targetId || targetId === 0 ? "-" + targetId : "";
|
|
5723
5833
|
return targetStr.replace(/([\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\])/g, "-");
|
|
5724
5834
|
},
|
|
5725
|
-
selectorTarget: function selectorTarget(id, prefix) {
|
|
5726
|
-
|
|
5727
|
-
|
|
5835
|
+
selectorTarget: function selectorTarget(id, prefix, postfix) {
|
|
5836
|
+
if (prefix === void 0) {
|
|
5837
|
+
prefix = "";
|
|
5838
|
+
}
|
|
5839
|
+
if (postfix === void 0) {
|
|
5840
|
+
postfix = "";
|
|
5841
|
+
}
|
|
5842
|
+
var target = this.getTargetSelectorSuffix(id);
|
|
5843
|
+
|
|
5728
5844
|
// select target & circle
|
|
5729
|
-
return
|
|
5845
|
+
return prefix + "." + (classes.target + target) + " " + postfix + ", " + prefix + "." + (classes.circles + target) + " " + postfix;
|
|
5730
5846
|
},
|
|
5731
5847
|
selectorTargets: function selectorTargets(idsValue, prefix) {
|
|
5732
5848
|
var _this3 = this,
|
|
@@ -5885,8 +6001,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
5885
6001
|
max = threshold.max || 100,
|
|
5886
6002
|
values = threshold.values && threshold.values.length ? threshold.values : [];
|
|
5887
6003
|
return notEmpty(threshold) ? function (value) {
|
|
5888
|
-
var v = asValue ? value : value * 100 / max
|
|
5889
|
-
|
|
6004
|
+
var v = asValue ? value : value * 100 / max;
|
|
6005
|
+
var color = colors[colors.length - 1];
|
|
5890
6006
|
for (var i = 0, l = values.length; i < l; i++) {
|
|
5891
6007
|
if (v <= values[i]) {
|
|
5892
6008
|
color = colors[i];
|
|
@@ -6108,8 +6224,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6108
6224
|
center = config[pfx + "_center"],
|
|
6109
6225
|
isInverted = config[pfx + "_inverted"],
|
|
6110
6226
|
showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated,
|
|
6111
|
-
showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated
|
|
6112
|
-
|
|
6227
|
+
showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated;
|
|
6228
|
+
var yDomainMin = $$.getYDomainMinMax(yTargets, "min"),
|
|
6113
6229
|
yDomainMax = $$.getYDomainMinMax(yTargets, "max"),
|
|
6114
6230
|
isZeroBased = [TYPE.BAR, TYPE.BUBBLE, TYPE.SCATTER].concat(TYPE_BY_CATEGORY.Line).some(function (v) {
|
|
6115
6231
|
_newArrowCheck(this, _this5);
|
|
@@ -6117,8 +6233,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6117
6233
|
return $$.hasType(v, yTargets, !0) && config[type + "_zerobased"];
|
|
6118
6234
|
}.bind(this));
|
|
6119
6235
|
// MEMO: avoid inverting domain unexpectedly
|
|
6120
|
-
yDomainMin = isValue(yMin) ? yMin : isValue(yMax) ? yDomainMin
|
|
6121
|
-
yDomainMax = isValue(yMax) ? yMax : isValue(yMin) ? yMin
|
|
6236
|
+
yDomainMin = isValue(yMin) ? yMin : isValue(yMax) ? yDomainMin <= yMax ? yDomainMin : yMax - 10 : yDomainMin;
|
|
6237
|
+
yDomainMax = isValue(yMax) ? yMax : isValue(yMin) ? yMin <= yDomainMax ? yDomainMax : yMin + 10 : yDomainMax;
|
|
6122
6238
|
if (isNaN(yDomainMin)) {
|
|
6123
6239
|
// set minimum to zero when not number
|
|
6124
6240
|
yDomainMin = 0;
|
|
@@ -6142,11 +6258,11 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6142
6258
|
isAllPositive && (yDomainMin = 0);
|
|
6143
6259
|
isAllNegative && (yDomainMax = 0);
|
|
6144
6260
|
}
|
|
6145
|
-
var domainLength = Math.abs(yDomainMax - yDomainMin)
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6261
|
+
var domainLength = Math.abs(yDomainMax - yDomainMin);
|
|
6262
|
+
var padding = {
|
|
6263
|
+
top: domainLength * .1,
|
|
6264
|
+
bottom: domainLength * .1
|
|
6265
|
+
};
|
|
6150
6266
|
if (isDefined(center)) {
|
|
6151
6267
|
var yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax));
|
|
6152
6268
|
yDomainMax = center + yDomainAbs;
|
|
@@ -6206,8 +6322,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6206
6322
|
return v.x;
|
|
6207
6323
|
}.bind(this)));
|
|
6208
6324
|
}.bind(this))),
|
|
6209
|
-
|
|
6210
|
-
|
|
6325
|
+
_$$$axis,
|
|
6326
|
+
value = isObject(configValue) ? configValue.value : configValue;
|
|
6211
6327
|
value = isDefined(value) && (_$$$axis = $$.axis) != null && _$$$axis.isTimeSeries() ? parseDate.bind(this)(value) : value;
|
|
6212
6328
|
if (isObject(configValue) && configValue.fit && (type === "min" && value < dataValue || type === "max" && value > dataValue)) {
|
|
6213
6329
|
value = undefined;
|
|
@@ -6227,8 +6343,9 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6227
6343
|
config = $$.config,
|
|
6228
6344
|
padding = config.axis_x_padding,
|
|
6229
6345
|
isTimeSeriesTickCount = axis.isTimeSeries() && tickCount,
|
|
6230
|
-
diff = diffDomain(domain)
|
|
6231
|
-
|
|
6346
|
+
diff = diffDomain(domain);
|
|
6347
|
+
var defaultValue;
|
|
6348
|
+
|
|
6232
6349
|
// determine default padding value
|
|
6233
6350
|
if (axis.isCategorized() || isTimeSeriesTickCount) {
|
|
6234
6351
|
defaultValue = 0;
|
|
@@ -6275,18 +6392,18 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6275
6392
|
var $$ = this,
|
|
6276
6393
|
axis = $$.axis,
|
|
6277
6394
|
x = $$.scale.x,
|
|
6278
|
-
domain = [$$.getXDomainMinMax(targets, "min"), $$.getXDomainMinMax(targets, "max")]
|
|
6279
|
-
|
|
6280
|
-
_domain$ = _domain[0],
|
|
6395
|
+
domain = [$$.getXDomainMinMax(targets, "min"), $$.getXDomainMinMax(targets, "max")];
|
|
6396
|
+
var _domain$ = domain[0],
|
|
6281
6397
|
min = _domain$ === void 0 ? 0 : _domain$,
|
|
6282
|
-
_domain$2 =
|
|
6398
|
+
_domain$2 = domain[1],
|
|
6283
6399
|
max = _domain$2 === void 0 ? 0 : _domain$2;
|
|
6284
6400
|
if (x.type !== "log") {
|
|
6285
6401
|
var isCategorized = axis.isCategorized(),
|
|
6286
6402
|
isTimeSeries = axis.isTimeSeries(),
|
|
6287
|
-
|
|
6288
|
-
|
|
6403
|
+
padding = $$.getXDomainPadding(domain);
|
|
6404
|
+
var firstX = domain[0],
|
|
6289
6405
|
lastX = domain[1];
|
|
6406
|
+
|
|
6290
6407
|
// show center of x domain if min and max are the same
|
|
6291
6408
|
if (firstX - lastX === 0 && !isCategorized) {
|
|
6292
6409
|
if (isTimeSeries) {
|
|
@@ -6298,10 +6415,10 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6298
6415
|
}
|
|
6299
6416
|
}
|
|
6300
6417
|
if (firstX || firstX === 0) {
|
|
6301
|
-
min = isTimeSeries ? new Date(firstX.getTime() -
|
|
6418
|
+
min = isTimeSeries ? new Date(firstX.getTime() - padding.left) : firstX - padding.left;
|
|
6302
6419
|
}
|
|
6303
6420
|
if (lastX || lastX === 0) {
|
|
6304
|
-
max = isTimeSeries ? new Date(lastX.getTime() +
|
|
6421
|
+
max = isTimeSeries ? new Date(lastX.getTime() + padding.right) : lastX + padding.right;
|
|
6305
6422
|
}
|
|
6306
6423
|
}
|
|
6307
6424
|
return [min, max];
|
|
@@ -6354,8 +6471,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6354
6471
|
getZoomDomain: function getZoomDomain() {
|
|
6355
6472
|
var $$ = this,
|
|
6356
6473
|
config = $$.config,
|
|
6357
|
-
org = $$.org
|
|
6358
|
-
|
|
6474
|
+
org = $$.org;
|
|
6475
|
+
var _org$xDomain = org.xDomain,
|
|
6359
6476
|
min = _org$xDomain[0],
|
|
6360
6477
|
max = _org$xDomain[1];
|
|
6361
6478
|
if (isDefined(config.zoom_x_min)) {
|
|
@@ -6378,8 +6495,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6378
6495
|
var $$ = this,
|
|
6379
6496
|
config = $$.config,
|
|
6380
6497
|
state = $$.state,
|
|
6381
|
-
isRotated = config.axis_rotated
|
|
6382
|
-
|
|
6498
|
+
isRotated = config.axis_rotated;
|
|
6499
|
+
var length;
|
|
6383
6500
|
if (type === "x") {
|
|
6384
6501
|
length = isRotated ? "height" : "width";
|
|
6385
6502
|
} else {
|
|
@@ -6407,7 +6524,7 @@ function getFormat($$, typeValue, v) {
|
|
|
6407
6524
|
var config = $$.config,
|
|
6408
6525
|
type = "axis_" + typeValue + "_tick_format",
|
|
6409
6526
|
format = config[type] ? config[type] : $$.defaultValueFormat;
|
|
6410
|
-
return format(v);
|
|
6527
|
+
return format.call($$.api, v);
|
|
6411
6528
|
}
|
|
6412
6529
|
/* harmony default export */ var format = ({
|
|
6413
6530
|
yFormat: function yFormat(v) {
|
|
@@ -6521,7 +6638,8 @@ function getLegendColor(id) {
|
|
|
6521
6638
|
* @private
|
|
6522
6639
|
*/
|
|
6523
6640
|
updateLegend: function updateLegend(targetIds, options, transitions) {
|
|
6524
|
-
var
|
|
6641
|
+
var _$el$legend,
|
|
6642
|
+
$$ = this,
|
|
6525
6643
|
config = $$.config,
|
|
6526
6644
|
state = $$.state,
|
|
6527
6645
|
scale = $$.scale,
|
|
@@ -6535,12 +6653,12 @@ function getLegendColor(id) {
|
|
|
6535
6653
|
optionz.withTransitionForTransform = getOption(optionz, "withTransitionForTransform", !0);
|
|
6536
6654
|
if (config.legend_contents_bindto && config.legend_contents_template) {
|
|
6537
6655
|
$$.updateLegendTemplate();
|
|
6538
|
-
} else {
|
|
6656
|
+
} else if (!state.hasTreemap) {
|
|
6539
6657
|
$$.updateLegendElement(targetIds || $$.mapToIds($$.data.targets), optionz, transitions);
|
|
6540
6658
|
}
|
|
6541
6659
|
|
|
6542
6660
|
// toggle legend state
|
|
6543
|
-
$el.legend.selectAll("." + $LEGEND.legendItem).classed($LEGEND.legendItemHidden, function (id) {
|
|
6661
|
+
(_$el$legend = $el.legend) == null ? void 0 : _$el$legend.selectAll("." + $LEGEND.legendItem).classed($LEGEND.legendItemHidden, function (id) {
|
|
6544
6662
|
var hide = !$$.isTargetToShow(id);
|
|
6545
6663
|
if (hide) {
|
|
6546
6664
|
this.style.opacity = null;
|
|
@@ -6569,8 +6687,8 @@ function getLegendColor(id) {
|
|
|
6569
6687
|
template = config.legend_contents_template;
|
|
6570
6688
|
if (!wrapper.empty()) {
|
|
6571
6689
|
var targets = $$.mapToIds($$.data.targets),
|
|
6572
|
-
ids = []
|
|
6573
|
-
|
|
6690
|
+
ids = [];
|
|
6691
|
+
var html = "";
|
|
6574
6692
|
targets.forEach(function (v) {
|
|
6575
6693
|
_newArrowCheck(this, _this);
|
|
6576
6694
|
var content = isFunction(template) ? template.bind($$.api)(v, $$.color(v), $$.api.data(v)[0].values) : tplProcess(template, {
|
|
@@ -6774,9 +6892,11 @@ function getLegendColor(id) {
|
|
|
6774
6892
|
getLegendItemTextBox: function getLegendItemTextBox(id, textElement) {
|
|
6775
6893
|
var $$ = this,
|
|
6776
6894
|
cache = $$.cache,
|
|
6777
|
-
state = $$.state
|
|
6778
|
-
|
|
6779
|
-
|
|
6895
|
+
state = $$.state;
|
|
6896
|
+
var data;
|
|
6897
|
+
|
|
6898
|
+
// do not prefix w/'$', to not be resetted cache in .load() call
|
|
6899
|
+
var cacheKey = KEY.legendItemTextBox;
|
|
6780
6900
|
if (id) {
|
|
6781
6901
|
data = !state.redrawing && cache.get(cacheKey) || {};
|
|
6782
6902
|
if (!data[id]) {
|
|
@@ -7229,7 +7349,9 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7229
7349
|
config = $$.config,
|
|
7230
7350
|
state = $$.state,
|
|
7231
7351
|
$el = $$.$el,
|
|
7232
|
-
|
|
7352
|
+
_$el = $el,
|
|
7353
|
+
main = _$el.main,
|
|
7354
|
+
treemap = _$el.treemap;
|
|
7233
7355
|
state.redrawing = !0;
|
|
7234
7356
|
var targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
|
7235
7357
|
_options = options,
|
|
@@ -7245,7 +7367,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7245
7367
|
// update legend and transform each g
|
|
7246
7368
|
if (wth.Legend && config.legend_show) {
|
|
7247
7369
|
options.withTransition = !!duration;
|
|
7248
|
-
$$.updateLegend($$.mapToIds($$.data.targets), options, transitions);
|
|
7370
|
+
treemap || $$.updateLegend($$.mapToIds($$.data.targets), options, transitions);
|
|
7249
7371
|
} else if (wth.Dimension) {
|
|
7250
7372
|
// need to update dimension (e.g. axis.y.tick.values) because y tick values should change
|
|
7251
7373
|
// no need to update axis in it because they will be updated in redraw()
|
|
@@ -7253,7 +7375,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7253
7375
|
}
|
|
7254
7376
|
|
|
7255
7377
|
// update circleY based on updated parameters
|
|
7256
|
-
if (!$$.hasArcType() || state.hasRadar) {
|
|
7378
|
+
if (!treemap && (!$$.hasArcType() || state.hasRadar)) {
|
|
7257
7379
|
$$.updateCircleY && ($$.circleY = $$.updateCircleY());
|
|
7258
7380
|
}
|
|
7259
7381
|
|
|
@@ -7295,10 +7417,13 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7295
7417
|
|
|
7296
7418
|
// polar
|
|
7297
7419
|
$el.polar && $$.redrawPolar();
|
|
7420
|
+
|
|
7421
|
+
// treemap
|
|
7422
|
+
treemap && $$.updateTreemap(durationForExit);
|
|
7298
7423
|
}
|
|
7299
7424
|
|
|
7300
7425
|
// @TODO: Axis & Radar type
|
|
7301
|
-
if (!state.resizing && ($$.hasPointType() || state.hasRadar)) {
|
|
7426
|
+
if (!state.resizing && !treemap && ($$.hasPointType() || state.hasRadar)) {
|
|
7302
7427
|
$$.updateCircle();
|
|
7303
7428
|
}
|
|
7304
7429
|
|
|
@@ -7382,6 +7507,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7382
7507
|
_$$$state = $$.state,
|
|
7383
7508
|
hasAxis = _$$$state.hasAxis,
|
|
7384
7509
|
hasRadar = _$$$state.hasRadar,
|
|
7510
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
7385
7511
|
grid = $$.$el.grid,
|
|
7386
7512
|
_shape$pos = shape.pos,
|
|
7387
7513
|
cx = _shape$pos.cx,
|
|
@@ -7412,6 +7538,9 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7412
7538
|
if (($$.hasPointType() || hasRadar) && !config.point_focus_only) {
|
|
7413
7539
|
$$.redrawCircle && list.push($$.redrawCircle(cx, cy, withTransition, flowFn));
|
|
7414
7540
|
}
|
|
7541
|
+
if (hasTreemap) {
|
|
7542
|
+
list.push($$.redrawTreemap(withTransition));
|
|
7543
|
+
}
|
|
7415
7544
|
return list;
|
|
7416
7545
|
},
|
|
7417
7546
|
updateAndRedraw: function updateAndRedraw(options) {
|
|
@@ -7420,8 +7549,9 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7420
7549
|
}
|
|
7421
7550
|
var $$ = this,
|
|
7422
7551
|
config = $$.config,
|
|
7423
|
-
state = $$.state
|
|
7424
|
-
|
|
7552
|
+
state = $$.state;
|
|
7553
|
+
var transitions;
|
|
7554
|
+
|
|
7425
7555
|
// same with redraw
|
|
7426
7556
|
options.withTransition = getOption(options, "withTransition", !0);
|
|
7427
7557
|
options.withTransform = getOption(options, "withTransform", !1);
|
|
@@ -7540,10 +7670,11 @@ function getScale(type, min, max) {
|
|
|
7540
7670
|
* @private
|
|
7541
7671
|
*/
|
|
7542
7672
|
getYScaleById: function getYScaleById(id, isSub) {
|
|
7673
|
+
var _this$axis;
|
|
7543
7674
|
if (isSub === void 0) {
|
|
7544
7675
|
isSub = !1;
|
|
7545
7676
|
}
|
|
7546
|
-
var isY2 = this.axis.getId(id) === "y2",
|
|
7677
|
+
var isY2 = ((_this$axis = this.axis) == null ? void 0 : _this$axis.getId(id)) === "y2",
|
|
7547
7678
|
key = isSub ? isY2 ? "subY2" : "subY" : isY2 ? "y2" : "y";
|
|
7548
7679
|
return this.scale[key];
|
|
7549
7680
|
},
|
|
@@ -7610,11 +7741,13 @@ function getScale(type, min, max) {
|
|
|
7610
7741
|
org = $$.org,
|
|
7611
7742
|
scale = $$.scale,
|
|
7612
7743
|
_$$$state = $$.state,
|
|
7744
|
+
current = _$$$state.current,
|
|
7613
7745
|
width = _$$$state.width,
|
|
7614
7746
|
height = _$$$state.height,
|
|
7615
7747
|
width2 = _$$$state.width2,
|
|
7616
7748
|
height2 = _$$$state.height2,
|
|
7617
|
-
hasAxis = _$$$state.hasAxis
|
|
7749
|
+
hasAxis = _$$$state.hasAxis,
|
|
7750
|
+
hasTreemap = _$$$state.hasTreemap;
|
|
7618
7751
|
if (hasAxis) {
|
|
7619
7752
|
var _scale$x,
|
|
7620
7753
|
isRotated = config.axis_rotated,
|
|
@@ -7660,6 +7793,10 @@ function getScale(type, min, max) {
|
|
|
7660
7793
|
scale.subY2 = $$.getYScale("y2", min.subY, max.subY, scale.subY2 ? scale.subY2.domain() : config.axis_y2_default);
|
|
7661
7794
|
axis.setAxis("y2", scale.y2, config.axis_y2_tick_outer, isInit);
|
|
7662
7795
|
}
|
|
7796
|
+
} else if (hasTreemap) {
|
|
7797
|
+
var padding = $$.getCurrentPadding();
|
|
7798
|
+
scale.x = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear)().rangeRound([padding.left, current.width - padding.right]);
|
|
7799
|
+
scale.y = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear)().rangeRound([padding.top, current.height - padding.bottom]);
|
|
7663
7800
|
} else {
|
|
7664
7801
|
// update for arc
|
|
7665
7802
|
$$.updateArc == null ? void 0 : $$.updateArc();
|
|
@@ -7687,8 +7824,8 @@ function getScale(type, min, max) {
|
|
|
7687
7824
|
_$$$scale2 = $$.scale,
|
|
7688
7825
|
x = _$$$scale2.x,
|
|
7689
7826
|
zoom = _$$$scale2.zoom,
|
|
7690
|
-
fn = config.zoom_enabled && zoom ? zoom : x
|
|
7691
|
-
|
|
7827
|
+
fn = config.zoom_enabled && zoom ? zoom : x;
|
|
7828
|
+
var value = $$.getBaseValue(d);
|
|
7692
7829
|
if (axis.isTimeSeries()) {
|
|
7693
7830
|
value = parseDate.call($$, value);
|
|
7694
7831
|
} else if (axis.isCategorized() && isString(value)) {
|
|
@@ -7730,13 +7867,15 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
7730
7867
|
var _this = this,
|
|
7731
7868
|
$$ = this,
|
|
7732
7869
|
isRotated = $$.config.axis_rotated,
|
|
7733
|
-
|
|
7870
|
+
_$$$state = $$.state,
|
|
7871
|
+
hasRadar = _$$$state.hasRadar,
|
|
7872
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
7734
7873
|
shape = {
|
|
7735
7874
|
type: {},
|
|
7736
7875
|
indices: {},
|
|
7737
7876
|
pos: {}
|
|
7738
7877
|
};
|
|
7739
|
-
["bar", "candlestick", "line", "area"].forEach(function (v) {
|
|
7878
|
+
hasTreemap || ["bar", "candlestick", "line", "area"].forEach(function (v) {
|
|
7740
7879
|
_newArrowCheck(this, _this);
|
|
7741
7880
|
var name = capitalize(/^(bubble|scatter)$/.test(v) ? "line" : v);
|
|
7742
7881
|
if ($$.hasType(v) || $$.hasTypeOf(name) || v === "line" && ($$.hasType("bubble") || $$.hasType("scatter"))) {
|
|
@@ -7746,10 +7885,13 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
7746
7885
|
shape.type[v] = drawFn ? drawFn.bind($$)(indices, !1) : undefined;
|
|
7747
7886
|
}
|
|
7748
7887
|
}.bind(this));
|
|
7749
|
-
if (!$$.hasArcType() || hasRadar) {
|
|
7888
|
+
if (!$$.hasArcType() || hasRadar || hasTreemap) {
|
|
7889
|
+
var cx, cy;
|
|
7750
7890
|
// generate circle x/y functions depending on updated params
|
|
7751
|
-
|
|
7891
|
+
if (!hasTreemap) {
|
|
7892
|
+
cx = hasRadar ? $$.radarCircleX : isRotated ? $$.circleY : $$.circleX;
|
|
7752
7893
|
cy = hasRadar ? $$.radarCircleY : isRotated ? $$.circleX : $$.circleY;
|
|
7894
|
+
}
|
|
7753
7895
|
shape.pos = {
|
|
7754
7896
|
xForText: $$.generateXYForText(shape.indices, !0),
|
|
7755
7897
|
yForText: $$.generateXYForText(shape.indices, !1),
|
|
@@ -7876,8 +8018,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
7876
8018
|
_newArrowCheck(this, _this5);
|
|
7877
8019
|
var ind = $$.getIndices(indices, d, "getShapeX"),
|
|
7878
8020
|
index = d.id in ind ? ind[d.id] : 0,
|
|
7879
|
-
targetsNum = (ind.__max__ || 0) + 1
|
|
7880
|
-
|
|
8021
|
+
targetsNum = (ind.__max__ || 0) + 1;
|
|
8022
|
+
var x = 0;
|
|
7881
8023
|
if (notEmpty(d.x)) {
|
|
7882
8024
|
var xPos = currScale(d.x, !0);
|
|
7883
8025
|
if (halfWidth) {
|
|
@@ -8001,8 +8143,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8001
8143
|
return scale(value[0]);
|
|
8002
8144
|
}
|
|
8003
8145
|
var dataXAsNumber = +x,
|
|
8004
|
-
y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id))
|
|
8005
|
-
|
|
8146
|
+
y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id));
|
|
8147
|
+
var offset = y0;
|
|
8006
8148
|
shapeOffsetTargets.filter(function (t) {
|
|
8007
8149
|
_newArrowCheck(this, _this10);
|
|
8008
8150
|
return t.id !== id && ind[t.id] === ind[id];
|
|
@@ -8103,8 +8245,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8103
8245
|
},
|
|
8104
8246
|
isWithinShape: function isWithinShape(that, d) {
|
|
8105
8247
|
var $$ = this,
|
|
8106
|
-
shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that)
|
|
8107
|
-
|
|
8248
|
+
shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that);
|
|
8249
|
+
var isWithin;
|
|
8108
8250
|
if (!$$.isTargetToShow(d.id)) {
|
|
8109
8251
|
isWithin = !1;
|
|
8110
8252
|
} else if ($$.hasValidPointType != null && $$.hasValidPointType(that.nodeName)) {
|
|
@@ -8196,8 +8338,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8196
8338
|
config = $$.config,
|
|
8197
8339
|
hasAxis = $$.state.hasAxis,
|
|
8198
8340
|
$el = $$.$el,
|
|
8199
|
-
axesLen = hasAxis ? config.axis_y2_axes.length : 0
|
|
8200
|
-
|
|
8341
|
+
axesLen = hasAxis ? config.axis_y2_axes.length : 0;
|
|
8342
|
+
var padding = isValue(config.padding_top) ? config.padding_top : 0;
|
|
8201
8343
|
if ($el.title && $el.title.node()) {
|
|
8202
8344
|
padding += $$.getTitlePadding();
|
|
8203
8345
|
}
|
|
@@ -8222,8 +8364,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8222
8364
|
isRotated = config.axis_rotated,
|
|
8223
8365
|
axisId = isRotated ? "x" : "y",
|
|
8224
8366
|
axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0,
|
|
8225
|
-
axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0
|
|
8226
|
-
|
|
8367
|
+
axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0;
|
|
8368
|
+
var padding;
|
|
8227
8369
|
if (isValue(config.padding_left)) {
|
|
8228
8370
|
padding = config.padding_left;
|
|
8229
8371
|
} else if (hasAxis && isRotated) {
|
|
@@ -8246,10 +8388,10 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8246
8388
|
legendWidthOnRight = $$.state.isLegendRight ? $$.getLegendWidth() + 20 : 0,
|
|
8247
8389
|
axesLen = hasAxis ? config.axis_y2_axes.length : 0,
|
|
8248
8390
|
axisWidth = hasAxis ? $$.getAxisWidthByAxisId("y2") : 0,
|
|
8249
|
-
xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(10) : 0
|
|
8250
|
-
|
|
8391
|
+
xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(10) : 0;
|
|
8392
|
+
var padding;
|
|
8251
8393
|
if (isValue(config.padding_right)) {
|
|
8252
|
-
padding = config.padding_right + 1; // 1 is needed not to hide tick line
|
|
8394
|
+
padding = config.padding_right + (hasAxis ? 1 : 0); // 1 is needed not to hide tick line
|
|
8253
8395
|
} else if ($$.axis && config.axis_rotated) {
|
|
8254
8396
|
padding = 10 + legendWidthOnRight;
|
|
8255
8397
|
} else if ($$.axis && (!config.axis_y2_show || config.axis_y2_inner)) {
|
|
@@ -8267,8 +8409,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8267
8409
|
* @private
|
|
8268
8410
|
*/
|
|
8269
8411
|
getParentRectValue: function getParentRectValue(key) {
|
|
8270
|
-
var offsetName = "offset" + capitalize(key)
|
|
8271
|
-
|
|
8412
|
+
var offsetName = "offset" + capitalize(key);
|
|
8413
|
+
var parent = this.$el.chart.node(),
|
|
8272
8414
|
v = 0;
|
|
8273
8415
|
while (v < 30 && parent && parent.tagName !== "BODY") {
|
|
8274
8416
|
try {
|
|
@@ -8293,8 +8435,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8293
8435
|
return this.getParentRectValue("width");
|
|
8294
8436
|
},
|
|
8295
8437
|
getParentHeight: function getParentHeight() {
|
|
8296
|
-
var h = this.$el.chart.style("height")
|
|
8297
|
-
|
|
8438
|
+
var h = this.$el.chart.style("height");
|
|
8439
|
+
var height = 0;
|
|
8298
8440
|
if (h) {
|
|
8299
8441
|
height = /px$/.test(h) ? parseInt(h, 10) : this.getParentRectValue("height");
|
|
8300
8442
|
}
|
|
@@ -8356,6 +8498,15 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8356
8498
|
clip.idSubchart && svg.select("#" + clip.idSubchart).select("rect").attr("width", width).attr("height", brushSize.height);
|
|
8357
8499
|
}
|
|
8358
8500
|
},
|
|
8501
|
+
getCurrentPadding: function getCurrentPadding() {
|
|
8502
|
+
var $$ = this;
|
|
8503
|
+
return {
|
|
8504
|
+
top: $$.getCurrentPaddingTop(),
|
|
8505
|
+
bottom: $$.getCurrentPaddingBottom(),
|
|
8506
|
+
left: $$.getCurrentPaddingLeft(),
|
|
8507
|
+
right: $$.getCurrentPaddingRight()
|
|
8508
|
+
};
|
|
8509
|
+
},
|
|
8359
8510
|
/**
|
|
8360
8511
|
* Get resetted padding values when 'padding=false' option is set
|
|
8361
8512
|
* https://github.com/naver/billboard.js/issues/2367
|
|
@@ -8391,31 +8542,32 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8391
8542
|
state = $$.state,
|
|
8392
8543
|
legend = $$.$el.legend,
|
|
8393
8544
|
isRotated = config.axis_rotated,
|
|
8394
|
-
|
|
8545
|
+
isNonAxis = $$.hasArcType() || state.hasTreemap;
|
|
8395
8546
|
isInit || $$.setContainerSize();
|
|
8396
8547
|
var currLegend = {
|
|
8397
8548
|
width: legend ? $$.getLegendWidth() : 0,
|
|
8398
8549
|
height: legend ? $$.getLegendHeight() : 0
|
|
8399
8550
|
};
|
|
8400
|
-
if (!
|
|
8551
|
+
if (!isNonAxis && config.axis_x_show && config.axis_x_tick_autorotate) {
|
|
8401
8552
|
$$.updateXAxisTickClip();
|
|
8402
8553
|
}
|
|
8403
8554
|
var legendHeightForBottom = state.isLegendRight || state.isLegendInset ? 0 : currLegend.height,
|
|
8404
|
-
xAxisHeight = isRotated ||
|
|
8555
|
+
xAxisHeight = isRotated || isNonAxis ? 0 : $$.getHorizontalAxisHeight("x"),
|
|
8405
8556
|
subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30,
|
|
8406
|
-
subchartHeight = config.subchart_show && !
|
|
8557
|
+
subchartHeight = config.subchart_show && !isNonAxis ? config.subchart_size_height + subchartXAxisHeight : 0,
|
|
8558
|
+
padding = $$.getCurrentPadding();
|
|
8407
8559
|
// for main
|
|
8408
|
-
state.margin = !
|
|
8409
|
-
top: $$.getHorizontalAxisHeight("y2") +
|
|
8410
|
-
right:
|
|
8411
|
-
bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom +
|
|
8412
|
-
left: subchartHeight + (
|
|
8560
|
+
state.margin = !isNonAxis && isRotated ? {
|
|
8561
|
+
top: $$.getHorizontalAxisHeight("y2") + padding.top,
|
|
8562
|
+
right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0),
|
|
8563
|
+
bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + padding.bottom,
|
|
8564
|
+
left: subchartHeight + (isNonAxis ? 0 : padding.left)
|
|
8413
8565
|
} : {
|
|
8414
|
-
top: 4 +
|
|
8566
|
+
top: 4 + padding.top,
|
|
8415
8567
|
// for top tick text
|
|
8416
|
-
right:
|
|
8417
|
-
bottom: xAxisHeight + subchartHeight + legendHeightForBottom +
|
|
8418
|
-
left:
|
|
8568
|
+
right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0),
|
|
8569
|
+
bottom: xAxisHeight + subchartHeight + legendHeightForBottom + padding.bottom,
|
|
8570
|
+
left: isNonAxis ? 0 : padding.left
|
|
8419
8571
|
};
|
|
8420
8572
|
state.margin = $$.getResettedPadding(state.margin);
|
|
8421
8573
|
|
|
@@ -8458,15 +8610,17 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8458
8610
|
}
|
|
8459
8611
|
|
|
8460
8612
|
// for arc
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8613
|
+
if ($$.hasArcType()) {
|
|
8614
|
+
var hasGauge = $$.hasType("gauge"),
|
|
8615
|
+
isLegendRight = config.legend_show && state.isLegendRight;
|
|
8616
|
+
state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0);
|
|
8617
|
+
state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10);
|
|
8618
|
+
if (hasGauge && !config.gauge_fullCircle) {
|
|
8619
|
+
state.arcHeight += state.height - $$.getPaddingBottomForGauge();
|
|
8620
|
+
}
|
|
8621
|
+
$$.updateRadius == null ? void 0 : $$.updateRadius();
|
|
8622
|
+
}
|
|
8623
|
+
if (state.isLegendRight && isNonAxis) {
|
|
8470
8624
|
state.margin3.left = state.arcWidth / 2 + state.radiusExpanded * 1.1;
|
|
8471
8625
|
}
|
|
8472
8626
|
}
|
|
@@ -8571,27 +8725,26 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8571
8725
|
isNegative = isNumber(value) && value < 0 || isCandlestickType && !((_$$$getCandlestickDat = $$.getCandlestickData(d)) != null && _$$$getCandlestickDat._isUp),
|
|
8572
8726
|
x = pos.x,
|
|
8573
8727
|
y = pos.y,
|
|
8574
|
-
gap = 4,
|
|
8575
8728
|
doubleGap = 8;
|
|
8576
8729
|
if (isRotated) {
|
|
8577
8730
|
if (anchor === "start") {
|
|
8578
8731
|
x += isNegative ? 0 : doubleGap;
|
|
8579
|
-
y +=
|
|
8732
|
+
y += 4;
|
|
8580
8733
|
} else if (anchor === "middle") {
|
|
8581
8734
|
x += doubleGap;
|
|
8582
8735
|
y -= doubleGap;
|
|
8583
8736
|
} else if (anchor === "end") {
|
|
8584
8737
|
isNegative && (x -= doubleGap);
|
|
8585
|
-
y +=
|
|
8738
|
+
y += 4;
|
|
8586
8739
|
}
|
|
8587
8740
|
} else {
|
|
8588
8741
|
if (anchor === "start") {
|
|
8589
|
-
x +=
|
|
8742
|
+
x += 4;
|
|
8590
8743
|
isNegative && (y += doubleGap * 2);
|
|
8591
8744
|
} else if (anchor === "middle") {
|
|
8592
8745
|
y -= doubleGap;
|
|
8593
8746
|
} else if (anchor === "end") {
|
|
8594
|
-
x -=
|
|
8747
|
+
x -= 4;
|
|
8595
8748
|
isNegative && (y += doubleGap * 2);
|
|
8596
8749
|
}
|
|
8597
8750
|
if (isInverted) {
|
|
@@ -8614,7 +8767,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8614
8767
|
*/
|
|
8615
8768
|
initText: function initText() {
|
|
8616
8769
|
var $el = this.$el;
|
|
8617
|
-
$el.main.select("." + $COMMON.chart).append("g").attr("class", $TEXT.chartTexts);
|
|
8770
|
+
$el.main.select("." + $COMMON.chart).append("g").attr("class", $TEXT.chartTexts).style("pointer-events", $el.treemap ? "none" : null);
|
|
8618
8771
|
},
|
|
8619
8772
|
/**
|
|
8620
8773
|
* Update chartText
|
|
@@ -8629,7 +8782,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8629
8782
|
classFocus = $$.classFocus.bind($$),
|
|
8630
8783
|
mainTextUpdate = $$.$el.main.select("." + $TEXT.chartTexts).selectAll("." + $TEXT.chartText).data(targets).attr("class", function (d) {
|
|
8631
8784
|
_newArrowCheck(this, _this);
|
|
8632
|
-
return classChartText(d) + classFocus(d);
|
|
8785
|
+
return ("" + classChartText(d) + classFocus(d)).trim();
|
|
8633
8786
|
}.bind(this)),
|
|
8634
8787
|
mainTextEnter = mainTextUpdate.enter().append("g").style("opacity", "0").attr("class", classChartText).call($$.setCssRule(!0, " ." + $TEXT.text, ["fill", "pointer-events:none"], $$.updateTextColor));
|
|
8635
8788
|
mainTextEnter.append("g").attr("class", classTexts);
|
|
@@ -8645,6 +8798,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8645
8798
|
$T = $$.$T,
|
|
8646
8799
|
config = $$.config,
|
|
8647
8800
|
classText = $$.getClass("text", "index"),
|
|
8801
|
+
labelsCentered = config.data_labels.centered,
|
|
8648
8802
|
text = $el.main.selectAll("." + $TEXT.texts).selectAll("." + $TEXT.text).data($$.labelishData.bind($$));
|
|
8649
8803
|
$T(text.exit()).style("fill-opacity", "0").remove();
|
|
8650
8804
|
$el.text = text.enter().append("text").merge(text).attr("class", classText).attr("text-anchor", function (d) {
|
|
@@ -8654,11 +8808,13 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8654
8808
|
if ($$.isCandlestickType(d)) {
|
|
8655
8809
|
var data = $$.getCandlestickData(d);
|
|
8656
8810
|
isEndAnchor = !(data != null && data._isUp);
|
|
8811
|
+
} else if ($$.isTreemapType(d)) {
|
|
8812
|
+
return labelsCentered ? "middle" : "start";
|
|
8657
8813
|
}
|
|
8658
8814
|
return config.axis_rotated ? isEndAnchor ? "end" : "start" : "middle";
|
|
8659
8815
|
}.bind(this)).style("fill", $$.getStylePropValue($$.updateTextColor)).style("fill-opacity", "0").each(function (d, i, texts) {
|
|
8660
|
-
var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this)
|
|
8661
|
-
|
|
8816
|
+
var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
8817
|
+
var value = d.value;
|
|
8662
8818
|
if ($$.isBubbleZType(d)) {
|
|
8663
8819
|
value = $$.getBubbleZData(value, "z");
|
|
8664
8820
|
} else if ($$.isCandlestickType(d)) {
|
|
@@ -8667,7 +8823,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8667
8823
|
value = data.close;
|
|
8668
8824
|
}
|
|
8669
8825
|
}
|
|
8670
|
-
value = $$.dataLabelFormat(d.id)(value, d.id, i, texts);
|
|
8826
|
+
value = $$.isTreemapType(d) ? $$.treemapDataLabelFormat(d)(node) : $$.dataLabelFormat(d.id)(value, d.id, i, texts);
|
|
8671
8827
|
if (isNumber(value)) {
|
|
8672
8828
|
this.textContent = value;
|
|
8673
8829
|
} else {
|
|
@@ -8679,8 +8835,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8679
8835
|
var $$ = this,
|
|
8680
8836
|
config = $$.config,
|
|
8681
8837
|
labelColors = config.data_labels_colors,
|
|
8682
|
-
defaultColor = $$.isArcType(d) && !$$.isRadarType(d) ? null : $$.color(d)
|
|
8683
|
-
|
|
8838
|
+
defaultColor = $$.isArcType(d) && !$$.isRadarType(d) || $$.isTreemapType(d) ? null : $$.color(d);
|
|
8839
|
+
var color;
|
|
8684
8840
|
if (isString(labelColors)) {
|
|
8685
8841
|
color = labelColors;
|
|
8686
8842
|
} else if (isObject(labelColors)) {
|
|
@@ -8709,8 +8865,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8709
8865
|
var $$ = this,
|
|
8710
8866
|
$el = $$.$el,
|
|
8711
8867
|
config = $$.config,
|
|
8712
|
-
backgroundColor = config.data_labels_backgroundColors
|
|
8713
|
-
|
|
8868
|
+
backgroundColor = config.data_labels_backgroundColors;
|
|
8869
|
+
var color = "";
|
|
8714
8870
|
if (isString(backgroundColor) || isObject(backgroundColor)) {
|
|
8715
8871
|
var id = isString(backgroundColor) ? "" : $$.getTargetSelectorSuffix("id" in d ? d.id : d.data.id),
|
|
8716
8872
|
filter = $el.defs.select(["filter[id*='labels-bg", "']"].join(id));
|
|
@@ -8734,19 +8890,22 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8734
8890
|
$T = $$.$T,
|
|
8735
8891
|
axis = $$.axis,
|
|
8736
8892
|
config = $$.config,
|
|
8893
|
+
hasTreemap = $$.state.hasTreemap,
|
|
8737
8894
|
t = getRandom(!0),
|
|
8738
8895
|
isRotated = config.axis_rotated,
|
|
8739
8896
|
angle = config.data_labels.rotate,
|
|
8740
8897
|
anchorString = getRotateAnchor(angle),
|
|
8741
8898
|
rotateString = angle ? "rotate(" + angle + ")" : "";
|
|
8899
|
+
// $$.meetsLabelThreshold(ratio,
|
|
8900
|
+
|
|
8742
8901
|
$$.$el.text.style("fill", $$.getStylePropValue($$.updateTextColor)).attr("filter", $$.updateTextBacgroundColor.bind($$)).style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$)).each(function (d, i) {
|
|
8743
8902
|
// do not apply transition for newly added text elements
|
|
8744
|
-
var node = $T(this, !!(withTransition && this.getAttribute("x")), t),
|
|
8745
|
-
isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"]
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8903
|
+
var node = $T(hasTreemap && this.childElementCount ? this.parentNode : this, !!(withTransition && this.getAttribute("x")), t),
|
|
8904
|
+
isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"];
|
|
8905
|
+
var pos = {
|
|
8906
|
+
x: getX.bind(this)(d, i),
|
|
8907
|
+
y: getY.bind(this)(d, i)
|
|
8908
|
+
};
|
|
8750
8909
|
if (angle) {
|
|
8751
8910
|
pos = setRotatePos.bind($$)(d, pos, anchorString, isRotated, isInverted);
|
|
8752
8911
|
node.attr("text-anchor", anchorString);
|
|
@@ -8779,8 +8938,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8779
8938
|
base = base.querySelector("text");
|
|
8780
8939
|
}
|
|
8781
8940
|
var text = base.textContent,
|
|
8782
|
-
cacheKey = KEY.textRect + "-" + text.replace(/\W/g, "_")
|
|
8783
|
-
|
|
8941
|
+
cacheKey = KEY.textRect + "-" + text.replace(/\W/g, "_");
|
|
8942
|
+
var rect = $$.cache.get(cacheKey);
|
|
8784
8943
|
if (!rect) {
|
|
8785
8944
|
$$.$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) {
|
|
8786
8945
|
_newArrowCheck(this, _this3);
|
|
@@ -8800,16 +8959,20 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8800
8959
|
generateXYForText: function generateXYForText(indices, forX) {
|
|
8801
8960
|
var _this4 = this,
|
|
8802
8961
|
$$ = this,
|
|
8962
|
+
_$$$state = $$.state,
|
|
8963
|
+
hasRadar = _$$$state.hasRadar,
|
|
8964
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
8803
8965
|
types = Object.keys(indices),
|
|
8804
8966
|
points = {},
|
|
8805
8967
|
getter = forX ? $$.getXForText : $$.getYForText;
|
|
8806
|
-
|
|
8968
|
+
hasRadar && types.push("radar");
|
|
8969
|
+
hasTreemap && types.push("treemap");
|
|
8807
8970
|
types.forEach(function (v) {
|
|
8808
8971
|
_newArrowCheck(this, _this4);
|
|
8809
8972
|
points[v] = $$["generateGet" + capitalize(v) + "Points"](indices[v], !1);
|
|
8810
8973
|
}.bind(this));
|
|
8811
8974
|
return function (d, i) {
|
|
8812
|
-
var type = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar" || $$.isCandlestickType(d) && "candlestick" || $$.isRadarType(d) && "radar" || "line";
|
|
8975
|
+
var type = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar" || $$.isCandlestickType(d) && "candlestick" || $$.isRadarType(d) && "radar" || $$.isTreemapType(d) && "treemap" || "line";
|
|
8813
8976
|
return getter.call($$, points[type](d, i), d, this);
|
|
8814
8977
|
};
|
|
8815
8978
|
},
|
|
@@ -8818,22 +8981,29 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8818
8981
|
* @param {object} d Data object
|
|
8819
8982
|
* @param {Array} points Data points position
|
|
8820
8983
|
* @param {HTMLElement} textElement Data label text element
|
|
8984
|
+
* @param {string} type 'x' or 'y'
|
|
8821
8985
|
* @returns {number} Position value
|
|
8822
8986
|
* @private
|
|
8823
8987
|
*/
|
|
8824
|
-
getCenteredTextPos: function getCenteredTextPos(d, points, textElement) {
|
|
8988
|
+
getCenteredTextPos: function getCenteredTextPos(d, points, textElement, type) {
|
|
8825
8989
|
var $$ = this,
|
|
8826
8990
|
config = $$.config,
|
|
8827
|
-
isRotated = config.axis_rotated
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8991
|
+
isRotated = config.axis_rotated,
|
|
8992
|
+
isBarType = $$.isBarType(d),
|
|
8993
|
+
isTreemapType = $$.isTreemapType(d);
|
|
8994
|
+
if (config.data_labels.centered && (isBarType || isTreemapType)) {
|
|
8995
|
+
var rect = getBoundingRect(textElement);
|
|
8996
|
+
if (isBarType) {
|
|
8997
|
+
var isPositive = d.value >= 0;
|
|
8998
|
+
if (isRotated) {
|
|
8999
|
+
var w = (isPositive ? points[1][1] - points[0][1] : points[0][1] - points[1][1]) / 2 + rect.width / 2;
|
|
9000
|
+
return isPositive ? -w - 3 : w + 2;
|
|
9001
|
+
} else {
|
|
9002
|
+
var h = (isPositive ? points[0][1] - points[1][1] : points[1][1] - points[0][1]) / 2 + rect.height / 2;
|
|
9003
|
+
return isPositive ? h : -h - 2;
|
|
9004
|
+
}
|
|
9005
|
+
} else if (isTreemapType) {
|
|
9006
|
+
return type === "x" ? (points[1][0] - points[0][0]) / 2 : (points[1][1] - points[0][1]) / 2 + rect.height / 2;
|
|
8837
9007
|
}
|
|
8838
9008
|
}
|
|
8839
9009
|
return 0;
|
|
@@ -8862,7 +9032,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8862
9032
|
config = $$.config,
|
|
8863
9033
|
state = $$.state,
|
|
8864
9034
|
isRotated = config.axis_rotated,
|
|
8865
|
-
|
|
9035
|
+
isTreemapType = $$.isTreemapType(d);
|
|
9036
|
+
var xPos = points[0][0];
|
|
8866
9037
|
if ($$.isCandlestickType(d)) {
|
|
8867
9038
|
if (isRotated) {
|
|
8868
9039
|
var _$$$getCandlestickDat2;
|
|
@@ -8870,6 +9041,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8870
9041
|
} else {
|
|
8871
9042
|
xPos += (points[1][0] - xPos) / 2;
|
|
8872
9043
|
}
|
|
9044
|
+
} else if (isTreemapType) {
|
|
9045
|
+
xPos += config.data_labels.centered ? 0 : 5;
|
|
8873
9046
|
} else {
|
|
8874
9047
|
if (isRotated) {
|
|
8875
9048
|
var padding = $$.isBarType(d) ? 4 : 6;
|
|
@@ -8889,8 +9062,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8889
9062
|
xPos = 4;
|
|
8890
9063
|
}
|
|
8891
9064
|
}
|
|
8892
|
-
if (isRotated) {
|
|
8893
|
-
xPos += $$.getCenteredTextPos(d, points, textElement);
|
|
9065
|
+
if (isRotated || isTreemapType) {
|
|
9066
|
+
xPos += $$.getCenteredTextPos(d, points, textElement, "x");
|
|
8894
9067
|
}
|
|
8895
9068
|
return xPos + $$.getTextPos(d.id, "x");
|
|
8896
9069
|
},
|
|
@@ -8910,9 +9083,10 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8910
9083
|
isRotated = config.axis_rotated,
|
|
8911
9084
|
isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"],
|
|
8912
9085
|
isBarType = $$.isBarType(d),
|
|
9086
|
+
isTreemapType = $$.isTreemapType(d),
|
|
8913
9087
|
r = config.point_r,
|
|
8914
|
-
rect = getBoundingRect(textElement)
|
|
8915
|
-
|
|
9088
|
+
rect = getBoundingRect(textElement);
|
|
9089
|
+
var value = d.value,
|
|
8916
9090
|
baseY = 3,
|
|
8917
9091
|
yPos;
|
|
8918
9092
|
if ($$.isCandlestickType(d)) {
|
|
@@ -8926,6 +9100,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8926
9100
|
yPos += 15 * (value._isUp ? 1 : -1);
|
|
8927
9101
|
}
|
|
8928
9102
|
}
|
|
9103
|
+
} else if (isTreemapType) {
|
|
9104
|
+
yPos = points[0][1] + (config.data_labels.centered ? 0 : rect.height + 5);
|
|
8929
9105
|
} else {
|
|
8930
9106
|
if (isRotated) {
|
|
8931
9107
|
yPos = (points[0][0] + points[2][0] + rect.height * .6) / 2;
|
|
@@ -8960,8 +9136,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8960
9136
|
yPos = state.height - 4;
|
|
8961
9137
|
}
|
|
8962
9138
|
}
|
|
8963
|
-
if (!isRotated) {
|
|
8964
|
-
yPos += $$.getCenteredTextPos(d, points, textElement);
|
|
9139
|
+
if (!isRotated || isTreemapType) {
|
|
9140
|
+
yPos += $$.getCenteredTextPos(d, points, textElement, "y");
|
|
8965
9141
|
}
|
|
8966
9142
|
return yPos + $$.getTextPos(d.id, "y");
|
|
8967
9143
|
},
|
|
@@ -9046,8 +9222,8 @@ function getTextPos(pos, width) {
|
|
|
9046
9222
|
if (pos === void 0) {
|
|
9047
9223
|
pos = "left";
|
|
9048
9224
|
}
|
|
9049
|
-
var isNum = isNumber(width)
|
|
9050
|
-
|
|
9225
|
+
var isNum = isNumber(width);
|
|
9226
|
+
var position;
|
|
9051
9227
|
if (pos.indexOf("center") > -1) {
|
|
9052
9228
|
position = isNum ? width / 2 : "middle";
|
|
9053
9229
|
} else if (pos.indexOf("right") > -1) {
|
|
@@ -9100,8 +9276,8 @@ function getTextPos(pos, width) {
|
|
|
9100
9276
|
config = $$.config,
|
|
9101
9277
|
current = $$.state.current,
|
|
9102
9278
|
position = config.title_position || "left",
|
|
9103
|
-
textRectWidth = $$.getTextRect($$.$el.title, $TEXT.title).width
|
|
9104
|
-
|
|
9279
|
+
textRectWidth = $$.getTextRect($$.$el.title, $TEXT.title).width;
|
|
9280
|
+
var x;
|
|
9105
9281
|
if (/(right|center)/.test(position)) {
|
|
9106
9282
|
x = current.width - textRectWidth;
|
|
9107
9283
|
if (position.indexOf("right") >= 0) {
|
|
@@ -9173,9 +9349,8 @@ function getTextPos(pos, width) {
|
|
|
9173
9349
|
_$$$axis2,
|
|
9174
9350
|
isArc = !(hasAxis && hasRadar);
|
|
9175
9351
|
if ((_$$$axis = $$.axis) != null && _$$$axis.isTimeSeries() && isString(config.tooltip_init_x)) {
|
|
9176
|
-
var targets = $$.data.targets[0]
|
|
9177
|
-
|
|
9178
|
-
val;
|
|
9352
|
+
var targets = $$.data.targets[0];
|
|
9353
|
+
var i, val;
|
|
9179
9354
|
config.tooltip_init_x = parseDate.call($$, config.tooltip_init_x);
|
|
9180
9355
|
for (i = 0; val = targets.values[i]; i++) {
|
|
9181
9356
|
if (val.x - config.tooltip_init_x === 0) {
|
|
@@ -9219,12 +9394,13 @@ function getTextPos(pos, width) {
|
|
|
9219
9394
|
* @returns {string} html
|
|
9220
9395
|
* @private
|
|
9221
9396
|
*/
|
|
9222
|
-
getTooltipContent: function getTooltipContent(d, defaultTitleFormat, defaultValueFormat,
|
|
9397
|
+
getTooltipContent: function getTooltipContent(d, defaultTitleFormat, defaultValueFormat, _color) {
|
|
9223
9398
|
var _this2 = this,
|
|
9224
9399
|
$$ = this,
|
|
9225
9400
|
api = $$.api,
|
|
9226
9401
|
config = $$.config,
|
|
9227
9402
|
state = $$.state,
|
|
9403
|
+
$el = $$.$el,
|
|
9228
9404
|
_map = ["title", "name", "value"].map(function (v) {
|
|
9229
9405
|
_newArrowCheck(this, _this2);
|
|
9230
9406
|
var fn = config["tooltip_format_" + v];
|
|
@@ -9238,7 +9414,7 @@ function getTextPos(pos, width) {
|
|
|
9238
9414
|
_newArrowCheck(this, _this2);
|
|
9239
9415
|
return name;
|
|
9240
9416
|
}.bind(this);
|
|
9241
|
-
valueFormat = valueFormat || ($$.isStackNormalized() ? function (v, ratio) {
|
|
9417
|
+
valueFormat = valueFormat || (state.hasTreemap || $$.isStackNormalized() ? function (v, ratio) {
|
|
9242
9418
|
_newArrowCheck(this, _this2);
|
|
9243
9419
|
return (ratio * 100).toFixed(2) + "%";
|
|
9244
9420
|
}.bind(this) : defaultValueFormat);
|
|
@@ -9252,7 +9428,7 @@ function getTextPos(pos, width) {
|
|
|
9252
9428
|
return $$.levelColor(row.value);
|
|
9253
9429
|
}.bind(this) : function (row) {
|
|
9254
9430
|
_newArrowCheck(this, _this2);
|
|
9255
|
-
return
|
|
9431
|
+
return _color(row);
|
|
9256
9432
|
}.bind(this),
|
|
9257
9433
|
contents = config.tooltip_contents,
|
|
9258
9434
|
tplStr = contents.template,
|
|
@@ -9284,16 +9460,13 @@ function getTextPos(pos, width) {
|
|
|
9284
9460
|
d.sort(order.bind(api));
|
|
9285
9461
|
}
|
|
9286
9462
|
var tpl = $$.getTooltipContentTemplate(tplStr),
|
|
9287
|
-
len = d.length
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
value,
|
|
9292
|
-
i;
|
|
9293
|
-
for (i = 0; i < len; i++) {
|
|
9463
|
+
len = d.length;
|
|
9464
|
+
var text, row, param, value, i;
|
|
9465
|
+
var _loop = function () {
|
|
9466
|
+
var _this3 = this;
|
|
9294
9467
|
row = d[i];
|
|
9295
9468
|
if (!row || !(getRowValue(row) || getRowValue(row) === 0)) {
|
|
9296
|
-
continue;
|
|
9469
|
+
return "continue";
|
|
9297
9470
|
}
|
|
9298
9471
|
if (isUndefined(text)) {
|
|
9299
9472
|
var title = (state.hasAxis || state.hasRadar) && sanitise(titleFormat ? titleFormat(row.x) : row.x);
|
|
@@ -9302,14 +9475,15 @@ function getTextPos(pos, width) {
|
|
|
9302
9475
|
TITLE: isValue(title) ? tplStr ? title : "<tr><th colspan=\"2\">" + title + "</th></tr>" : ""
|
|
9303
9476
|
});
|
|
9304
9477
|
}
|
|
9305
|
-
if (!row.ratio &&
|
|
9306
|
-
|
|
9478
|
+
if (!row.ratio && $el.arcs) {
|
|
9479
|
+
param = ["arc", $$.$el.arcs.select("path." + $ARC.arc + "-" + row.id).data()[0]];
|
|
9480
|
+
row.ratio = $$.getRatio.apply($$, param);
|
|
9307
9481
|
}
|
|
9308
9482
|
param = [row.ratio, row.id, row.index, d];
|
|
9309
9483
|
value = sanitise(valueFormat.apply(void 0, [getRowValue(row)].concat(param)));
|
|
9310
9484
|
if ($$.isAreaRangeType(row)) {
|
|
9311
9485
|
var _map2 = ["high", "low"].map(function (v) {
|
|
9312
|
-
_newArrowCheck(this,
|
|
9486
|
+
_newArrowCheck(this, _this3);
|
|
9313
9487
|
return sanitise(valueFormat.apply(void 0, [$$.getRangedData(row, v)].concat(param)));
|
|
9314
9488
|
}.bind(this)),
|
|
9315
9489
|
high = _map2[0],
|
|
@@ -9317,7 +9491,7 @@ function getTextPos(pos, width) {
|
|
|
9317
9491
|
value = "<b>Mid:</b> " + value + " <b>High:</b> " + high + " <b>Low:</b> " + low;
|
|
9318
9492
|
} else if ($$.isCandlestickType(row)) {
|
|
9319
9493
|
var _map3 = ["open", "high", "low", "close", "volume"].map(function (v) {
|
|
9320
|
-
_newArrowCheck(this,
|
|
9494
|
+
_newArrowCheck(this, _this3);
|
|
9321
9495
|
return sanitise(valueFormat.apply(void 0, [$$.getRangedData(row, v, "candlestick")].concat(param)));
|
|
9322
9496
|
}.bind(this)),
|
|
9323
9497
|
open = _map3[0],
|
|
@@ -9333,31 +9507,31 @@ function getTextPos(pos, width) {
|
|
|
9333
9507
|
value = valueFormat(start) + " ~ " + valueFormat(end);
|
|
9334
9508
|
}
|
|
9335
9509
|
if (value !== undefined) {
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
}
|
|
9357
|
-
text += tplProcess(tpl[1], contentValue);
|
|
9358
|
-
}();
|
|
9359
|
-
if (_ret === "continue") continue;
|
|
9510
|
+
// Skip elements when their name is set to null
|
|
9511
|
+
if (row.name === null) {
|
|
9512
|
+
return "continue";
|
|
9513
|
+
}
|
|
9514
|
+
var name = sanitise(nameFormat.apply(void 0, [row.name].concat(param))),
|
|
9515
|
+
_color = getBgColor(row),
|
|
9516
|
+
contentValue = {
|
|
9517
|
+
CLASS_TOOLTIP_NAME: $TOOLTIP.tooltipName + $$.getTargetSelectorSuffix(row.id),
|
|
9518
|
+
COLOR: tplStr || !$$.patterns ? _color : "<svg><rect style=\"fill:" + _color + "\" width=\"10\" height=\"10\"></rect></svg>",
|
|
9519
|
+
NAME: name,
|
|
9520
|
+
VALUE: value
|
|
9521
|
+
};
|
|
9522
|
+
if (tplStr && isObject(contents.text)) {
|
|
9523
|
+
var index = targetIds.indexOf(row.id);
|
|
9524
|
+
Object.keys(contents.text).forEach(function (key) {
|
|
9525
|
+
_newArrowCheck(this, _this3);
|
|
9526
|
+
contentValue[key] = contents.text[key][index];
|
|
9527
|
+
}.bind(this));
|
|
9528
|
+
}
|
|
9529
|
+
text += tplProcess(tpl[1], contentValue);
|
|
9360
9530
|
}
|
|
9531
|
+
};
|
|
9532
|
+
for (i = 0; i < len; i++) {
|
|
9533
|
+
var _ret = _loop();
|
|
9534
|
+
if (_ret === "continue") continue;
|
|
9361
9535
|
}
|
|
9362
9536
|
return text + "</table>";
|
|
9363
9537
|
},
|
|
@@ -9393,6 +9567,7 @@ function getTextPos(pos, width) {
|
|
|
9393
9567
|
inputType = _state.inputType,
|
|
9394
9568
|
event = _state.event,
|
|
9395
9569
|
hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
|
|
9570
|
+
hasTreemap = state.hasTreemap,
|
|
9396
9571
|
svgLeft = $$.getSvgLeft(!0),
|
|
9397
9572
|
chartRight = svgLeft + current.width - $$.getCurrentPaddingRight(),
|
|
9398
9573
|
chartLeft = $$.getCurrentPaddingLeft(!0),
|
|
@@ -9406,7 +9581,7 @@ function getTextPos(pos, width) {
|
|
|
9406
9581
|
y += hasGauge ? height : height / 2;
|
|
9407
9582
|
x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
|
|
9408
9583
|
}
|
|
9409
|
-
} else {
|
|
9584
|
+
} else if (!hasTreemap) {
|
|
9410
9585
|
var dataScale = scale.x(dataToShow[0].x);
|
|
9411
9586
|
if (config.axis_rotated) {
|
|
9412
9587
|
y = dataScale + 20;
|
|
@@ -9414,16 +9589,17 @@ function getTextPos(pos, width) {
|
|
|
9414
9589
|
chartRight -= svgLeft;
|
|
9415
9590
|
} else {
|
|
9416
9591
|
y -= 5;
|
|
9417
|
-
x = svgLeft + chartLeft + 20 + (
|
|
9592
|
+
x = svgLeft + chartLeft + 20 + (scale.zoom ? x : dataScale);
|
|
9418
9593
|
}
|
|
9419
9594
|
}
|
|
9420
9595
|
|
|
9421
9596
|
// when tooltip left + tWidth > chart's width
|
|
9422
9597
|
if (x + tWidth + 15 > chartRight) {
|
|
9423
|
-
x -= tWidth + chartLeft;
|
|
9598
|
+
x -= tWidth + (hasTreemap ? 0 : chartLeft);
|
|
9424
9599
|
}
|
|
9425
9600
|
if (y + tHeight > current.height) {
|
|
9426
|
-
|
|
9601
|
+
var gap = hasTreemap ? 0 : 30;
|
|
9602
|
+
y -= hasGauge ? tHeight * 3 : tHeight + gap;
|
|
9427
9603
|
}
|
|
9428
9604
|
var pos = {
|
|
9429
9605
|
top: y,
|
|
@@ -9465,8 +9641,8 @@ function getTextPos(pos, width) {
|
|
|
9465
9641
|
_ref$width = _ref.width,
|
|
9466
9642
|
width = _ref$width === void 0 ? 0 : _ref$width,
|
|
9467
9643
|
_ref$height = _ref.height,
|
|
9468
|
-
height = _ref$height === void 0 ? 0 : _ref$height
|
|
9469
|
-
|
|
9644
|
+
height = _ref$height === void 0 ? 0 : _ref$height;
|
|
9645
|
+
var dataStr = JSON.stringify(selectedData);
|
|
9470
9646
|
if (!datum || datum.current !== dataStr) {
|
|
9471
9647
|
var index = selectedData.concat().sort()[0].index;
|
|
9472
9648
|
callFn(config.tooltip_onshow, $$.api, selectedData);
|
|
@@ -9535,9 +9711,10 @@ function getTextPos(pos, width) {
|
|
|
9535
9711
|
var current = state.current,
|
|
9536
9712
|
_tooltip$datum = tooltip.datum(),
|
|
9537
9713
|
width = _tooltip$datum.width,
|
|
9538
|
-
xPosInPercent = _tooltip$datum.xPosInPercent
|
|
9539
|
-
|
|
9540
|
-
|
|
9714
|
+
xPosInPercent = _tooltip$datum.xPosInPercent;
|
|
9715
|
+
var _value = current.width / 100 * xPosInPercent;
|
|
9716
|
+
var diff = current.width - (_value + width);
|
|
9717
|
+
|
|
9541
9718
|
// if tooltip size overs current viewport size
|
|
9542
9719
|
if (diff < 0) {
|
|
9543
9720
|
_value += diff;
|
|
@@ -9621,8 +9798,8 @@ function getTextPos(pos, width) {
|
|
|
9621
9798
|
var $$ = this,
|
|
9622
9799
|
config = $$.config,
|
|
9623
9800
|
state = $$.state,
|
|
9624
|
-
isRotated = config.axis_rotated
|
|
9625
|
-
|
|
9801
|
+
isRotated = config.axis_rotated;
|
|
9802
|
+
var padding = 0,
|
|
9626
9803
|
x,
|
|
9627
9804
|
y;
|
|
9628
9805
|
if (index && /^(x|y2?)$/.test(target)) {
|
|
@@ -9679,9 +9856,11 @@ function getTextPos(pos, width) {
|
|
|
9679
9856
|
transformAll: function transformAll(withTransition, transitions) {
|
|
9680
9857
|
var $$ = this,
|
|
9681
9858
|
config = $$.config,
|
|
9682
|
-
|
|
9859
|
+
_$$$state = $$.state,
|
|
9860
|
+
hasAxis = _$$$state.hasAxis,
|
|
9861
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
9683
9862
|
$el = $$.$el;
|
|
9684
|
-
$$.transformMain(withTransition, transitions);
|
|
9863
|
+
hasTreemap || $$.transformMain(withTransition, transitions);
|
|
9685
9864
|
hasAxis && config.subchart_show && $$.transformContext(withTransition, transitions);
|
|
9686
9865
|
$el.legend && $$.transformLegend(withTransition);
|
|
9687
9866
|
}
|
|
@@ -9750,8 +9929,8 @@ function getTextPos(pos, width) {
|
|
|
9750
9929
|
config = $$.config,
|
|
9751
9930
|
current = $$.state.current,
|
|
9752
9931
|
types = config.data_types,
|
|
9753
|
-
targets = targetsValue || $$.data.targets
|
|
9754
|
-
|
|
9932
|
+
targets = targetsValue || $$.data.targets;
|
|
9933
|
+
var has = !1;
|
|
9755
9934
|
if (!checkFromData && ((_current$types = current.types) == null ? void 0 : _current$types.indexOf(type)) > -1) {
|
|
9756
9935
|
has = !0;
|
|
9757
9936
|
} else if (targets != null && targets.length) {
|
|
@@ -9855,6 +10034,9 @@ function getTextPos(pos, width) {
|
|
|
9855
10034
|
isScatterType: function isScatterType(d) {
|
|
9856
10035
|
return this.isTypeOf(d, "scatter");
|
|
9857
10036
|
},
|
|
10037
|
+
isTreemapType: function isTreemapType(d) {
|
|
10038
|
+
return this.isTypeOf(d, "treemap");
|
|
10039
|
+
},
|
|
9858
10040
|
isPieType: function isPieType(d) {
|
|
9859
10041
|
return this.isTypeOf(d, "pie");
|
|
9860
10042
|
},
|
|
@@ -9876,8 +10058,8 @@ function getTextPos(pos, width) {
|
|
|
9876
10058
|
// determine if is 'circle' data point
|
|
9877
10059
|
isCirclePoint: function isCirclePoint(node) {
|
|
9878
10060
|
var config = this.config,
|
|
9879
|
-
pattern = config.point_pattern
|
|
9880
|
-
|
|
10061
|
+
pattern = config.point_pattern;
|
|
10062
|
+
var isCircle = !1;
|
|
9881
10063
|
if ((node == null ? void 0 : node.tagName) === "circle") {
|
|
9882
10064
|
isCircle = !0;
|
|
9883
10065
|
} else {
|
|
@@ -9899,7 +10081,7 @@ function getTextPos(pos, width) {
|
|
|
9899
10081
|
*/
|
|
9900
10082
|
labelishData: function labelishData(d) {
|
|
9901
10083
|
var _this5 = this;
|
|
9902
|
-
return this.isBarType(d) || this.isLineType(d) || this.isScatterType(d) || this.isBubbleType(d) || this.isCandlestickType(d) || this.isRadarType(d) ? d.values.filter(function (v) {
|
|
10084
|
+
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) {
|
|
9903
10085
|
_newArrowCheck(this, _this5);
|
|
9904
10086
|
return isNumber(v.value) || !!v.value;
|
|
9905
10087
|
}.bind(this)) : [];
|
|
@@ -10047,8 +10229,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10047
10229
|
var config = this.config,
|
|
10048
10230
|
state = this.state,
|
|
10049
10231
|
duration = config.transition_duration,
|
|
10050
|
-
subchart = config.subchart_show
|
|
10051
|
-
|
|
10232
|
+
subchart = config.subchart_show;
|
|
10233
|
+
var t = selection;
|
|
10052
10234
|
if (t) {
|
|
10053
10235
|
// in case of non d3 selection, wrap with d3 selection
|
|
10054
10236
|
if ("tagName" in t) {
|
|
@@ -10086,8 +10268,9 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10086
10268
|
$el = $$.$el,
|
|
10087
10269
|
useCssRule = config.boost_useCssRule;
|
|
10088
10270
|
checkModuleImport($$);
|
|
10089
|
-
state.hasAxis = !$$.hasArcType();
|
|
10090
10271
|
state.hasRadar = !state.hasAxis && $$.hasType("radar");
|
|
10272
|
+
state.hasTreemap = !state.hasAxis && $$.hasType("treemap");
|
|
10273
|
+
state.hasAxis = !$$.hasArcType() && !state.hasTreemap;
|
|
10091
10274
|
|
|
10092
10275
|
// datetime to be used for uniqueness
|
|
10093
10276
|
state.datetimeId = "bb-" + +new Date() * getRandom();
|
|
@@ -10183,8 +10366,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10183
10366
|
if ($$.hasPointType()) {
|
|
10184
10367
|
$$.point = $$.generatePoint();
|
|
10185
10368
|
}
|
|
10369
|
+
$$.initClip();
|
|
10186
10370
|
if (state.hasAxis) {
|
|
10187
|
-
$$.initClip();
|
|
10188
10371
|
format.extraLineClasses = $$.generateExtraLineClass();
|
|
10189
10372
|
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;
|
|
10190
10373
|
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;
|
|
@@ -10215,7 +10398,9 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10215
10398
|
state = $$.state,
|
|
10216
10399
|
$el = $$.$el,
|
|
10217
10400
|
org = $$.org,
|
|
10218
|
-
|
|
10401
|
+
_state = state,
|
|
10402
|
+
hasAxis = _state.hasAxis,
|
|
10403
|
+
hasTreemap = _state.hasTreemap,
|
|
10219
10404
|
hasInteraction = config.interaction_enabled,
|
|
10220
10405
|
hasPolar = $$.hasType("polar");
|
|
10221
10406
|
// for arc type, set axes to not be shown
|
|
@@ -10246,28 +10431,30 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10246
10431
|
$$.updateScales(!0);
|
|
10247
10432
|
|
|
10248
10433
|
// retrieve scale after the 'updateScales()' is called
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
x
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10434
|
+
if (hasAxis) {
|
|
10435
|
+
var x = scale.x,
|
|
10436
|
+
y = scale.y,
|
|
10437
|
+
y2 = scale.y2,
|
|
10438
|
+
subX = scale.subX,
|
|
10439
|
+
subY = scale.subY,
|
|
10440
|
+
subY2 = scale.subY2;
|
|
10441
|
+
|
|
10442
|
+
// Set domains for each scale
|
|
10443
|
+
if (x) {
|
|
10444
|
+
x.domain(sortValue($$.getXDomain($$.data.targets)));
|
|
10445
|
+
subX.domain(x.domain());
|
|
10446
|
+
|
|
10447
|
+
// Save original x domain for zoom update
|
|
10448
|
+
org.xDomain = x.domain();
|
|
10449
|
+
}
|
|
10450
|
+
if (y) {
|
|
10451
|
+
y.domain($$.getYDomain($$.data.targets, "y"));
|
|
10452
|
+
subY.domain(y.domain());
|
|
10453
|
+
}
|
|
10454
|
+
if (y2) {
|
|
10455
|
+
y2.domain($$.getYDomain($$.data.targets, "y2"));
|
|
10456
|
+
subY2 && subY2.domain(y2.domain());
|
|
10457
|
+
}
|
|
10271
10458
|
}
|
|
10272
10459
|
|
|
10273
10460
|
// -- Basic Elements --
|
|
@@ -10283,7 +10470,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10283
10470
|
|
|
10284
10471
|
// Define defs
|
|
10285
10472
|
var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
|
10286
|
-
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors
|
|
10473
|
+
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || config.data_labels_backgroundColors) {
|
|
10287
10474
|
$el.defs = $el.svg.append("defs");
|
|
10288
10475
|
if (hasAxis) {
|
|
10289
10476
|
["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
|
@@ -10313,14 +10500,14 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10313
10500
|
$$.bindResize();
|
|
10314
10501
|
|
|
10315
10502
|
// Define regions
|
|
10316
|
-
var main = $el.svg.append("g").classed($COMMON.main, !0).attr("transform", $$.getTranslate("main"));
|
|
10503
|
+
var main = $el.svg.append("g").classed($COMMON.main, !0).attr("transform", hasTreemap ? null : $$.getTranslate("main"));
|
|
10317
10504
|
$el.main = main;
|
|
10318
10505
|
|
|
10319
10506
|
// initialize subchart when subchart show option is set
|
|
10320
10507
|
config.subchart_show && $$.initSubchart();
|
|
10321
10508
|
config.tooltip_show && $$.initTooltip();
|
|
10322
10509
|
config.title_text && $$.initTitle();
|
|
10323
|
-
config.legend_show && $$.initLegend();
|
|
10510
|
+
!hasTreemap && config.legend_show && $$.initLegend();
|
|
10324
10511
|
|
|
10325
10512
|
// -- Main Region --
|
|
10326
10513
|
|
|
@@ -10394,6 +10581,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10394
10581
|
_$$$state = $$.state,
|
|
10395
10582
|
hasAxis = _$$$state.hasAxis,
|
|
10396
10583
|
hasRadar = _$$$state.hasRadar,
|
|
10584
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
10397
10585
|
types = [];
|
|
10398
10586
|
if (hasAxis) {
|
|
10399
10587
|
["bar", "bubble", "candlestick", "line"].forEach(function (v) {
|
|
@@ -10403,6 +10591,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10403
10591
|
types.push(name);
|
|
10404
10592
|
}
|
|
10405
10593
|
}.bind(this));
|
|
10594
|
+
} else if (hasTreemap) {
|
|
10595
|
+
types.push("Treemap");
|
|
10406
10596
|
} else {
|
|
10407
10597
|
var hasPolar = $$.hasType("polar");
|
|
10408
10598
|
if (!hasRadar) {
|
|
@@ -10501,6 +10691,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10501
10691
|
_$$$state2 = $$.state,
|
|
10502
10692
|
hasAxis = _$$$state2.hasAxis,
|
|
10503
10693
|
hasRadar = _$$$state2.hasRadar,
|
|
10694
|
+
hasTreemap = _$$$state2.hasTreemap,
|
|
10504
10695
|
helper = function (type) {
|
|
10505
10696
|
_newArrowCheck(this, _this6);
|
|
10506
10697
|
return $$["updateTargetsFor" + type](targets.filter($$["is" + type + "Type"].bind($$)));
|
|
@@ -10528,6 +10719,9 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10528
10719
|
type = "Polar";
|
|
10529
10720
|
}
|
|
10530
10721
|
helper(type);
|
|
10722
|
+
// Arc, Polar, Radar
|
|
10723
|
+
} else if (hasTreemap) {
|
|
10724
|
+
helper("Treemap");
|
|
10531
10725
|
}
|
|
10532
10726
|
|
|
10533
10727
|
// Point types
|
|
@@ -10552,8 +10746,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10552
10746
|
}
|
|
10553
10747
|
var $$ = this,
|
|
10554
10748
|
svg = $$.$el.svg,
|
|
10555
|
-
$T = $$.$T
|
|
10556
|
-
|
|
10749
|
+
$T = $$.$T;
|
|
10750
|
+
var selector = "." + $COMMON.target;
|
|
10557
10751
|
if (hasPointType) {
|
|
10558
10752
|
selector += ", ." + $CIRCLE.chartCircles + " > ." + $CIRCLE.circles;
|
|
10559
10753
|
}
|
|
@@ -10679,12 +10873,12 @@ function loadConfig(config) {
|
|
|
10679
10873
|
target,
|
|
10680
10874
|
keys,
|
|
10681
10875
|
read,
|
|
10682
|
-
|
|
10876
|
+
_find = function find() {
|
|
10683
10877
|
_newArrowCheck(this, _this);
|
|
10684
10878
|
var key = keys.shift();
|
|
10685
10879
|
if (key && target && isObjectType(target) && key in target) {
|
|
10686
10880
|
target = target[key];
|
|
10687
|
-
return
|
|
10881
|
+
return _find();
|
|
10688
10882
|
} else if (!key) {
|
|
10689
10883
|
return target;
|
|
10690
10884
|
}
|
|
@@ -10694,7 +10888,7 @@ function loadConfig(config) {
|
|
|
10694
10888
|
_newArrowCheck(this, _this);
|
|
10695
10889
|
target = config;
|
|
10696
10890
|
keys = key.split("_");
|
|
10697
|
-
read =
|
|
10891
|
+
read = _find();
|
|
10698
10892
|
if (isDefined(read)) {
|
|
10699
10893
|
thisConfig[key] = read;
|
|
10700
10894
|
}
|
|
@@ -10850,8 +11044,9 @@ function loadConfig(config) {
|
|
|
10850
11044
|
},
|
|
10851
11045
|
/**
|
|
10852
11046
|
* Get or set config option value.
|
|
10853
|
-
* - **NOTE
|
|
10854
|
-
*
|
|
11047
|
+
* - **NOTE**
|
|
11048
|
+
* - The option key name must be specified as the last level.
|
|
11049
|
+
* - when no argument is given, will return all specified generation options object only. (will exclude any other options not specified at the initialization)
|
|
10855
11050
|
* @function config
|
|
10856
11051
|
* @instance
|
|
10857
11052
|
* @memberof Chart
|
|
@@ -10865,12 +11060,20 @@ function loadConfig(config) {
|
|
|
10865
11060
|
* // Getter
|
|
10866
11061
|
* chart.config("gauge.max");
|
|
10867
11062
|
*
|
|
11063
|
+
* // Getter specified with top level key name will not work.
|
|
11064
|
+
* // The option key name must be specified as the last level.
|
|
11065
|
+
* // chart.config("gauge"); // will not work
|
|
11066
|
+
*
|
|
10868
11067
|
* // without any arguments, it returns generation config object
|
|
10869
11068
|
* chart.config(); // {data: { ... }, axis: { ... }, ...}
|
|
10870
11069
|
*
|
|
10871
11070
|
* // Setter
|
|
10872
11071
|
* chart.config("gauge.max", 100);
|
|
10873
11072
|
*
|
|
11073
|
+
* // Setter specified with top level key name will not work.
|
|
11074
|
+
* // The option key name must be specified as the last level.
|
|
11075
|
+
* // chart.config("gauge", {min: 10, max: 20}); // will not work
|
|
11076
|
+
*
|
|
10874
11077
|
* // Setter & redraw with the new option
|
|
10875
11078
|
* chart.config("gauge.max", 100, true);
|
|
10876
11079
|
*/
|
|
@@ -10878,8 +11081,8 @@ function loadConfig(config) {
|
|
|
10878
11081
|
var $$ = this.internal,
|
|
10879
11082
|
config = $$.config,
|
|
10880
11083
|
state = $$.state,
|
|
10881
|
-
key = name == null ? void 0 : name.replace(/\./g, "_")
|
|
10882
|
-
|
|
11084
|
+
key = name == null ? void 0 : name.replace(/\./g, "_");
|
|
11085
|
+
var res;
|
|
10883
11086
|
if (name && key in config) {
|
|
10884
11087
|
if (isDefined(value)) {
|
|
10885
11088
|
config[key] = value;
|
|
@@ -10888,7 +11091,7 @@ function loadConfig(config) {
|
|
|
10888
11091
|
} else {
|
|
10889
11092
|
res = config[key];
|
|
10890
11093
|
}
|
|
10891
|
-
} else {
|
|
11094
|
+
} else if (arguments.length === 0 || isEmpty(name)) {
|
|
10892
11095
|
res = state.orgConfig;
|
|
10893
11096
|
}
|
|
10894
11097
|
return res;
|
|
@@ -11131,7 +11334,7 @@ var export_this = undefined;
|
|
|
11131
11334
|
var b64EncodeUnicode = function (str) {
|
|
11132
11335
|
var _this2 = this;
|
|
11133
11336
|
_newArrowCheck(this, export_this);
|
|
11134
|
-
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p) {
|
|
11337
|
+
return win.btoa == null ? void 0 : win.btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p) {
|
|
11135
11338
|
_newArrowCheck(this, _this2);
|
|
11136
11339
|
return String.fromCharCode(+("0x" + p));
|
|
11137
11340
|
}.bind(this)));
|
|
@@ -11160,6 +11363,18 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
11160
11363
|
return r.cssText;
|
|
11161
11364
|
}.bind(this));
|
|
11162
11365
|
clone.setAttribute("xmlns", external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.xhtml);
|
|
11366
|
+
|
|
11367
|
+
// remove padding & margin
|
|
11368
|
+
clone.style.margin = "0";
|
|
11369
|
+
clone.style.padding = "0";
|
|
11370
|
+
|
|
11371
|
+
// remove text nodes
|
|
11372
|
+
if (option.preserveFontStyle) {
|
|
11373
|
+
clone.querySelectorAll("text").forEach(function (t) {
|
|
11374
|
+
_newArrowCheck(this, _this3);
|
|
11375
|
+
t.innerHTML = "";
|
|
11376
|
+
}.bind(this));
|
|
11377
|
+
}
|
|
11163
11378
|
var nodeXml = serializer.serializeToString(clone),
|
|
11164
11379
|
style = browser_doc.createElement("style"); // escape css for XML
|
|
11165
11380
|
style.appendChild(browser_doc.createTextNode(cssText.join("\n")));
|
|
@@ -11168,12 +11383,154 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
11168
11383
|
// https://msdn.microsoft.com/en-us/library/hh834675(v=vs.85).aspx
|
|
11169
11384
|
return "data:image/svg+xml;base64," + b64EncodeUnicode(dataStr);
|
|
11170
11385
|
}
|
|
11386
|
+
|
|
11387
|
+
/**
|
|
11388
|
+
* Get coordinate of the element
|
|
11389
|
+
* @param {SVGElement} elem Target element
|
|
11390
|
+
* @param {object} svgOffset SVG offset
|
|
11391
|
+
* @returns {object}
|
|
11392
|
+
* @private
|
|
11393
|
+
*/
|
|
11394
|
+
function getCoords(elem, svgOffset) {
|
|
11395
|
+
var top = svgOffset.top,
|
|
11396
|
+
left = svgOffset.left,
|
|
11397
|
+
_elem$getBBox = elem.getBBox(),
|
|
11398
|
+
x = _elem$getBBox.x,
|
|
11399
|
+
y = _elem$getBBox.y,
|
|
11400
|
+
_elem$getScreenCTM = elem.getScreenCTM(),
|
|
11401
|
+
a = _elem$getScreenCTM.a,
|
|
11402
|
+
b = _elem$getScreenCTM.b,
|
|
11403
|
+
c = _elem$getScreenCTM.c,
|
|
11404
|
+
d = _elem$getScreenCTM.d,
|
|
11405
|
+
e = _elem$getScreenCTM.e,
|
|
11406
|
+
f = _elem$getScreenCTM.f,
|
|
11407
|
+
_elem$getBoundingClie = elem.getBoundingClientRect(),
|
|
11408
|
+
width = _elem$getBoundingClie.width,
|
|
11409
|
+
height = _elem$getBoundingClie.height;
|
|
11410
|
+
return {
|
|
11411
|
+
x: a * x + c * y + e - left,
|
|
11412
|
+
y: b * x + d * y + f - top + (height - Math.round(height / 4)),
|
|
11413
|
+
width: width,
|
|
11414
|
+
height: height
|
|
11415
|
+
};
|
|
11416
|
+
}
|
|
11417
|
+
|
|
11418
|
+
/**
|
|
11419
|
+
* Get text glyph
|
|
11420
|
+
* @param {SVGTextElement} svg Target svg node
|
|
11421
|
+
* @returns {Array}
|
|
11422
|
+
* @private
|
|
11423
|
+
*/
|
|
11424
|
+
function getGlyph(svg) {
|
|
11425
|
+
var _this4 = this,
|
|
11426
|
+
_svg$getBoundingClien = svg.getBoundingClientRect(),
|
|
11427
|
+
left = _svg$getBoundingClien.left,
|
|
11428
|
+
top = _svg$getBoundingClien.top,
|
|
11429
|
+
filterFn = function (t) {
|
|
11430
|
+
_newArrowCheck(this, _this4);
|
|
11431
|
+
return t.textContent || t.childElementCount;
|
|
11432
|
+
}.bind(this),
|
|
11433
|
+
glyph = [];
|
|
11434
|
+
toArray(svg.querySelectorAll("text")).filter(filterFn).forEach(function (t) {
|
|
11435
|
+
var _this5 = this;
|
|
11436
|
+
_newArrowCheck(this, _this4);
|
|
11437
|
+
// eslint-disable-line
|
|
11438
|
+
var getStyleFn = function (ts) {
|
|
11439
|
+
var _ref2;
|
|
11440
|
+
_newArrowCheck(this, _this5);
|
|
11441
|
+
var _window$getComputedSt = win.getComputedStyle(ts),
|
|
11442
|
+
fill = _window$getComputedSt.fill,
|
|
11443
|
+
fontFamily = _window$getComputedSt.fontFamily,
|
|
11444
|
+
fontSize = _window$getComputedSt.fontSize,
|
|
11445
|
+
textAnchor = _window$getComputedSt.textAnchor,
|
|
11446
|
+
transform = _window$getComputedSt.transform,
|
|
11447
|
+
_getCoords = getCoords(ts, {
|
|
11448
|
+
left: left,
|
|
11449
|
+
top: top
|
|
11450
|
+
}),
|
|
11451
|
+
x = _getCoords.x,
|
|
11452
|
+
y = _getCoords.y,
|
|
11453
|
+
width = _getCoords.width,
|
|
11454
|
+
height = _getCoords.height;
|
|
11455
|
+
return _ref2 = {}, _ref2[ts.textContent] = {
|
|
11456
|
+
x: x,
|
|
11457
|
+
y: y,
|
|
11458
|
+
width: width,
|
|
11459
|
+
height: height,
|
|
11460
|
+
fill: fill,
|
|
11461
|
+
fontFamily: fontFamily,
|
|
11462
|
+
fontSize: fontSize,
|
|
11463
|
+
textAnchor: textAnchor,
|
|
11464
|
+
transform: transform
|
|
11465
|
+
}, _ref2;
|
|
11466
|
+
}.bind(this);
|
|
11467
|
+
if (t.childElementCount > 1) {
|
|
11468
|
+
toArray(t.querySelectorAll("tspan")).filter(filterFn).forEach(function (ts) {
|
|
11469
|
+
_newArrowCheck(this, _this5);
|
|
11470
|
+
glyph.push(getStyleFn(ts));
|
|
11471
|
+
}.bind(this));
|
|
11472
|
+
return [];
|
|
11473
|
+
} else {
|
|
11474
|
+
glyph.push(getStyleFn(t));
|
|
11475
|
+
}
|
|
11476
|
+
}.bind(this));
|
|
11477
|
+
return glyph;
|
|
11478
|
+
}
|
|
11479
|
+
|
|
11480
|
+
/**
|
|
11481
|
+
* Render text glyph
|
|
11482
|
+
* - NOTE: Called when the 'preserveFontStyle' option is true
|
|
11483
|
+
* @param {CanvasRenderingContext2D} ctx Canvas context
|
|
11484
|
+
* @param {Array} glyph Text glyph array
|
|
11485
|
+
* @private
|
|
11486
|
+
*/
|
|
11487
|
+
function renderText(ctx, glyph) {
|
|
11488
|
+
var _this6 = this;
|
|
11489
|
+
glyph.forEach(function (g) {
|
|
11490
|
+
var _this7 = this;
|
|
11491
|
+
_newArrowCheck(this, _this6);
|
|
11492
|
+
Object.keys(g).forEach(function (key) {
|
|
11493
|
+
var _this8 = this;
|
|
11494
|
+
_newArrowCheck(this, _this7);
|
|
11495
|
+
var _g$key = g[key],
|
|
11496
|
+
x = _g$key.x,
|
|
11497
|
+
y = _g$key.y,
|
|
11498
|
+
width = _g$key.width,
|
|
11499
|
+
height = _g$key.height,
|
|
11500
|
+
fill = _g$key.fill,
|
|
11501
|
+
fontFamily = _g$key.fontFamily,
|
|
11502
|
+
fontSize = _g$key.fontSize,
|
|
11503
|
+
transform = _g$key.transform;
|
|
11504
|
+
ctx.save();
|
|
11505
|
+
ctx.font = fontSize + " " + fontFamily;
|
|
11506
|
+
ctx.fillStyle = fill;
|
|
11507
|
+
if (transform === "none") {
|
|
11508
|
+
ctx.fillText(key, x, y);
|
|
11509
|
+
} else {
|
|
11510
|
+
var args = transform.replace(/(matrix|\(|\))/g, "").split(",");
|
|
11511
|
+
if (args.splice(4).every(function (v) {
|
|
11512
|
+
_newArrowCheck(this, _this8);
|
|
11513
|
+
return +v === 0;
|
|
11514
|
+
}.bind(this))) {
|
|
11515
|
+
args.push(x + width - width / 4);
|
|
11516
|
+
args.push(y - height + height / 3);
|
|
11517
|
+
} else {
|
|
11518
|
+
args.push(x);
|
|
11519
|
+
args.push(y);
|
|
11520
|
+
}
|
|
11521
|
+
ctx.transform.apply(ctx, args);
|
|
11522
|
+
ctx.fillText(key, 0, 0);
|
|
11523
|
+
}
|
|
11524
|
+
ctx.restore();
|
|
11525
|
+
}.bind(this));
|
|
11526
|
+
}.bind(this));
|
|
11527
|
+
}
|
|
11171
11528
|
/* harmony default export */ var api_export = ({
|
|
11172
11529
|
/**
|
|
11173
11530
|
* Export chart as an image.
|
|
11174
11531
|
* - **NOTE:**
|
|
11175
11532
|
* - IE11 and below not work properly due to the lack of the feature(<a href="https://msdn.microsoft.com/en-us/library/hh834675(v=vs.85).aspx">foreignObject</a>) support
|
|
11176
|
-
* -
|
|
11533
|
+
* - Every style applied to the chart & the basic CSS file(ex. billboard.css) should be at same domain as API call context to get correct styled export image.
|
|
11177
11534
|
* @function export
|
|
11178
11535
|
* @instance
|
|
11179
11536
|
* @memberof Chart
|
|
@@ -11182,6 +11539,12 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
11182
11539
|
* @param {number} [option.width={currentWidth}] width
|
|
11183
11540
|
* @param {number} [option.height={currentHeigth}] height
|
|
11184
11541
|
* @param {boolean} [option.preserveAspectRatio=true] Preserve aspect ratio on given size
|
|
11542
|
+
* @param {boolean} [option.preserveFontStyle=false] Preserve font style(font-family).<br>
|
|
11543
|
+
* **NOTE:**
|
|
11544
|
+
* - This option is useful when outlink web font style's `font-family` are applied to chart's text element.
|
|
11545
|
+
* - Text element's position(especially "transformed") can't be preserved correctly according the page's layout condition.
|
|
11546
|
+
* - If need to preserve accurate text position, embed the web font data within to the page and set `preserveFontStyle=false`.
|
|
11547
|
+
* - Checkout the embed example: <a href="https://stackblitz.com/edit/zfbya9-8nf9nn?file=index.html">https://stackblitz.com/edit/zfbya9-8nf9nn?file=index.html</a>
|
|
11185
11548
|
* @param {Function} [callback] The callback to be invoked when export is ready.
|
|
11186
11549
|
* @returns {string} dataURI
|
|
11187
11550
|
* @example
|
|
@@ -11205,16 +11568,19 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
11205
11568
|
* width: 800,
|
|
11206
11569
|
* height: 600,
|
|
11207
11570
|
* preserveAspectRatio: false,
|
|
11571
|
+
* preserveFontStyle: false,
|
|
11208
11572
|
* mimeType: "image/png"
|
|
11209
11573
|
* },
|
|
11210
11574
|
* dataUrl => { ... }
|
|
11211
11575
|
* );
|
|
11212
11576
|
*/
|
|
11213
11577
|
export: function _export(option, callback) {
|
|
11214
|
-
var
|
|
11578
|
+
var _this9 = this,
|
|
11215
11579
|
$$ = this.internal,
|
|
11216
11580
|
state = $$.state,
|
|
11217
|
-
|
|
11581
|
+
_$$$$el = $$.$el,
|
|
11582
|
+
chart = _$$$$el.chart,
|
|
11583
|
+
svg = _$$$$el.svg,
|
|
11218
11584
|
_state$current = state.current,
|
|
11219
11585
|
width = _state$current.width,
|
|
11220
11586
|
height = _state$current.height,
|
|
@@ -11222,22 +11588,30 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
11222
11588
|
width: width,
|
|
11223
11589
|
height: height,
|
|
11224
11590
|
preserveAspectRatio: !0,
|
|
11591
|
+
preserveFontStyle: !1,
|
|
11225
11592
|
mimeType: "image/png"
|
|
11226
11593
|
}, option),
|
|
11227
11594
|
svgDataUrl = nodeToSvgDataUrl(chart.node(), opt, {
|
|
11228
11595
|
width: width,
|
|
11229
11596
|
height: height
|
|
11230
|
-
})
|
|
11597
|
+
}),
|
|
11598
|
+
glyph = opt.preserveFontStyle ? getGlyph(svg.node()) : [];
|
|
11231
11599
|
if (callback && isFunction(callback)) {
|
|
11232
11600
|
var img = new Image();
|
|
11233
11601
|
img.crossOrigin = "Anonymous";
|
|
11234
11602
|
img.onload = function () {
|
|
11235
|
-
_newArrowCheck(this,
|
|
11603
|
+
_newArrowCheck(this, _this9);
|
|
11236
11604
|
var canvas = browser_doc.createElement("canvas"),
|
|
11237
11605
|
ctx = canvas.getContext("2d");
|
|
11238
11606
|
canvas.width = opt.width || width;
|
|
11239
11607
|
canvas.height = opt.height || height;
|
|
11240
11608
|
ctx.drawImage(img, 0, 0);
|
|
11609
|
+
if (glyph.length) {
|
|
11610
|
+
renderText(ctx, glyph);
|
|
11611
|
+
|
|
11612
|
+
// release glyph array
|
|
11613
|
+
glyph.length = 0;
|
|
11614
|
+
}
|
|
11241
11615
|
callback.bind(this)(canvas.toDataURL(opt.mimeType));
|
|
11242
11616
|
}.bind(this);
|
|
11243
11617
|
img.src = svgDataUrl;
|
|
@@ -11376,6 +11750,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
11376
11750
|
var legend_legend = {
|
|
11377
11751
|
/**
|
|
11378
11752
|
* Show legend for each target.
|
|
11753
|
+
* - **NOTE:** Legend APIs aren't supported for `treemap` type.
|
|
11379
11754
|
* @function legend․show
|
|
11380
11755
|
* @instance
|
|
11381
11756
|
* @memberof Chart
|
|
@@ -11615,6 +11990,7 @@ var legend_legend = {
|
|
|
11615
11990
|
}.bind(this));
|
|
11616
11991
|
}.bind(this));
|
|
11617
11992
|
} else {
|
|
11993
|
+
$$.api.tooltip.hide();
|
|
11618
11994
|
$$.loadFromArgs(args);
|
|
11619
11995
|
}
|
|
11620
11996
|
},
|
|
@@ -11855,6 +12231,13 @@ var tooltip_tooltip = {
|
|
|
11855
12231
|
* x: new Date("2018-01-02 00:00")
|
|
11856
12232
|
* });
|
|
11857
12233
|
*
|
|
12234
|
+
* // treemap type can be shown by using "id" only.
|
|
12235
|
+
* chart.tooltip.show({
|
|
12236
|
+
* data: {
|
|
12237
|
+
* id: "data1" // data id
|
|
12238
|
+
* }
|
|
12239
|
+
* });
|
|
12240
|
+
*
|
|
11858
12241
|
* // when data.xs is used
|
|
11859
12242
|
* chart.tooltip.show({
|
|
11860
12243
|
* data: {
|
|
@@ -11876,8 +12259,12 @@ var tooltip_tooltip = {
|
|
|
11876
12259
|
show: function show(args) {
|
|
11877
12260
|
var _this = this,
|
|
11878
12261
|
$$ = this.internal,
|
|
12262
|
+
$el = $$.$el,
|
|
11879
12263
|
config = $$.config,
|
|
11880
|
-
|
|
12264
|
+
_$$$state = $$.state,
|
|
12265
|
+
eventReceiver = _$$$state.eventReceiver,
|
|
12266
|
+
hasTreemap = _$$$state.hasTreemap,
|
|
12267
|
+
inputType = _$$$state.inputType,
|
|
11881
12268
|
index,
|
|
11882
12269
|
mouse;
|
|
11883
12270
|
// determine mouse position on the chart
|
|
@@ -11889,7 +12276,9 @@ var tooltip_tooltip = {
|
|
|
11889
12276
|
if (args.data) {
|
|
11890
12277
|
var data = args.data,
|
|
11891
12278
|
y = $$.getYScaleById(data.id)(data.value);
|
|
11892
|
-
if (
|
|
12279
|
+
if (hasTreemap && data.id) {
|
|
12280
|
+
eventReceiver.rect = $el.main.select("" + $$.selectorTarget(data.id, undefined, "rect"));
|
|
12281
|
+
} else if ($$.isMultipleX()) {
|
|
11893
12282
|
// if multiple xs, target point will be determined by mouse
|
|
11894
12283
|
mouse = [$$.scale.x(data.x), y];
|
|
11895
12284
|
} else {
|
|
@@ -13088,8 +13477,8 @@ var AxisRendererHelper = /*#__PURE__*/function () {
|
|
|
13088
13477
|
return isDefined(formatted) ? formatted : "";
|
|
13089
13478
|
};
|
|
13090
13479
|
_proto.transitionise = function transitionise(selection) {
|
|
13091
|
-
var config = this.config
|
|
13092
|
-
|
|
13480
|
+
var config = this.config;
|
|
13481
|
+
var transitionSelection = selection;
|
|
13093
13482
|
if (config.withoutTransition) {
|
|
13094
13483
|
transitionSelection = selection.interrupt();
|
|
13095
13484
|
} else if (config.transition || !this.owner.params.noTransition) {
|
|
@@ -13180,8 +13569,8 @@ var AxisRenderer = /*#__PURE__*/function () {
|
|
|
13180
13569
|
tickShow = {
|
|
13181
13570
|
tick: axisShow ? params.config[prefix + "_tick_show"] : !1,
|
|
13182
13571
|
text: axisShow ? params.config[prefix + "_tick_text_show"] : !1
|
|
13183
|
-
}
|
|
13184
|
-
|
|
13572
|
+
}; // // get the axis' tick position configuration
|
|
13573
|
+
var $g;
|
|
13185
13574
|
g.each(function () {
|
|
13186
13575
|
var _this = this,
|
|
13187
13576
|
g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
@@ -13210,28 +13599,30 @@ var AxisRenderer = /*#__PURE__*/function () {
|
|
|
13210
13599
|
ctx.generatedTicks = ticks;
|
|
13211
13600
|
|
|
13212
13601
|
// update selection
|
|
13213
|
-
var tick = g.selectAll(".tick").data(ticks, scale1)
|
|
13214
|
-
|
|
13215
|
-
|
|
13602
|
+
var tick = g.selectAll(".tick").data(ticks, scale1);
|
|
13603
|
+
|
|
13604
|
+
// enter selection
|
|
13605
|
+
var tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick"),
|
|
13606
|
+
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.
|
|
13216
13607
|
// enter + update selection
|
|
13217
13608
|
tick = tickEnter.merge(tick);
|
|
13218
13609
|
tickShow.tick && tickEnter.append("line");
|
|
13219
13610
|
tickShow.text && tickEnter.append("text");
|
|
13220
13611
|
var sizeFor1Char = AxisRendererHelper.getSizeFor1Char(tick),
|
|
13221
|
-
counts = []
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
|
|
13226
|
-
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
}.bind(this));
|
|
13612
|
+
counts = [];
|
|
13613
|
+
var tspan = tick.select("text").selectAll("tspan").data(function (d, index) {
|
|
13614
|
+
var _this2 = this;
|
|
13615
|
+
_newArrowCheck(this, _this);
|
|
13616
|
+
var split = params.tickMultiline ? splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w) : isArray(helper.textFormatted(d)) ? helper.textFormatted(d).concat() : [helper.textFormatted(d)];
|
|
13617
|
+
counts[index] = split.length;
|
|
13618
|
+
return split.map(function (splitted) {
|
|
13619
|
+
_newArrowCheck(this, _this2);
|
|
13620
|
+
return {
|
|
13621
|
+
index: index,
|
|
13622
|
+
splitted: splitted
|
|
13623
|
+
};
|
|
13234
13624
|
}.bind(this));
|
|
13625
|
+
}.bind(this));
|
|
13235
13626
|
tspan.exit().remove();
|
|
13236
13627
|
tspan = tspan.enter().append("tspan").merge(tspan).text(function (d) {
|
|
13237
13628
|
_newArrowCheck(this, _this);
|
|
@@ -13303,9 +13694,9 @@ var AxisRenderer = /*#__PURE__*/function () {
|
|
|
13303
13694
|
*/;
|
|
13304
13695
|
_proto.getGeneratedTicks = function getGeneratedTicks(count) {
|
|
13305
13696
|
var _this$generatedTicks,
|
|
13697
|
+
_this3 = this,
|
|
13306
13698
|
len = ((_this$generatedTicks = this.generatedTicks) == null ? void 0 : _this$generatedTicks.length) - 1,
|
|
13307
|
-
res = this.generatedTicks
|
|
13308
|
-
_this3 = this;
|
|
13699
|
+
res = this.generatedTicks;
|
|
13309
13700
|
if (len > count) {
|
|
13310
13701
|
var interval = Math.round(len / count + .1);
|
|
13311
13702
|
res = this.generatedTicks.map(function (v, i) {
|
|
@@ -13515,7 +13906,8 @@ var AxisRenderer = /*#__PURE__*/function () {
|
|
|
13515
13906
|
return interval === Infinity ? 0 : interval;
|
|
13516
13907
|
};
|
|
13517
13908
|
_proto.ticks = function ticks() {
|
|
13518
|
-
|
|
13909
|
+
var config = this.config;
|
|
13910
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
13519
13911
|
args[_key] = arguments[_key];
|
|
13520
13912
|
}
|
|
13521
13913
|
if (!args.length) {
|
|
@@ -13758,8 +14150,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
13758
14150
|
}.bind(this))) {
|
|
13759
14151
|
v.scale().range(range);
|
|
13760
14152
|
}
|
|
13761
|
-
var className = this.getAxisClassName(id) + "-" + (i + 1)
|
|
13762
|
-
|
|
14153
|
+
var className = this.getAxisClassName(id) + "-" + (i + 1);
|
|
14154
|
+
var g = main.select("." + className.replace(/\s/, "."));
|
|
13763
14155
|
if (g.empty()) {
|
|
13764
14156
|
g = main.append("g").attr("class", className).style("visibility", config["axis_" + id + "_show"] ? null : "hidden").call(v);
|
|
13765
14157
|
} else {
|
|
@@ -13813,21 +14205,21 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
13813
14205
|
tickFormat = fn.bind($$.api);
|
|
13814
14206
|
}
|
|
13815
14207
|
}
|
|
13816
|
-
var tickValues = this.tick[type]
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
13829
|
-
|
|
13830
|
-
|
|
14208
|
+
var tickValues = this.tick[type];
|
|
14209
|
+
var axisParams = mergeObj({
|
|
14210
|
+
outerTick: outerTick,
|
|
14211
|
+
noTransition: noTransition,
|
|
14212
|
+
config: config,
|
|
14213
|
+
id: id,
|
|
14214
|
+
tickTextRotate: tickTextRotate,
|
|
14215
|
+
owner: $$
|
|
14216
|
+
}, isX && {
|
|
14217
|
+
isCategory: isCategory,
|
|
14218
|
+
tickMultiline: config.axis_x_tick_multiline,
|
|
14219
|
+
tickWidth: config.axis_x_tick_width,
|
|
14220
|
+
tickTitle: isCategory && config.axis_x_tick_tooltip && $$.api.categories(),
|
|
14221
|
+
orgXScale: $$.scale.x
|
|
14222
|
+
});
|
|
13831
14223
|
if (!isX) {
|
|
13832
14224
|
axisParams.tickStepSize = config["axis_" + type + "_tick_stepSize"];
|
|
13833
14225
|
}
|
|
@@ -13863,8 +14255,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
13863
14255
|
_proto.updateXAxisTickValues = function updateXAxisTickValues(targets, axis) {
|
|
13864
14256
|
var $$ = this.owner,
|
|
13865
14257
|
config = $$.config,
|
|
13866
|
-
fit = config.axis_x_tick_fit
|
|
13867
|
-
|
|
14258
|
+
fit = config.axis_x_tick_fit;
|
|
14259
|
+
var count = config.axis_x_tick_count,
|
|
13868
14260
|
values;
|
|
13869
14261
|
if (fit || count && fit) {
|
|
13870
14262
|
values = $$.mapTargetsToUniqueXs(targets);
|
|
@@ -13887,8 +14279,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
13887
14279
|
_proto.getId = function getId(id) {
|
|
13888
14280
|
var _this$owner2 = this.owner,
|
|
13889
14281
|
config = _this$owner2.config,
|
|
13890
|
-
scale = _this$owner2.scale
|
|
13891
|
-
|
|
14282
|
+
scale = _this$owner2.scale;
|
|
14283
|
+
var axis = config.data_axes[id];
|
|
14284
|
+
|
|
13892
14285
|
// when data.axes option has 'y2', but 'axis.y2.show=true' isn't set will return 'y'
|
|
13893
14286
|
if (!axis || !scale[axis]) {
|
|
13894
14287
|
axis = "y";
|
|
@@ -13978,8 +14371,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
13978
14371
|
_$$$state = $$.state,
|
|
13979
14372
|
width = _$$$state.width,
|
|
13980
14373
|
height = _$$$state.height,
|
|
13981
|
-
position = this.getAxisLabelPosition(id)
|
|
13982
|
-
|
|
14374
|
+
position = this.getAxisLabelPosition(id);
|
|
14375
|
+
var x = position.isMiddle ? -height / 2 : 0;
|
|
13983
14376
|
if (this.isHorizontal($$, id !== "x")) {
|
|
13984
14377
|
x = position.isLeft ? 0 : position.isCenter ? width / 2 : width;
|
|
13985
14378
|
} else if (position.isBottom) {
|
|
@@ -13989,8 +14382,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
13989
14382
|
};
|
|
13990
14383
|
_proto.dxForAxisLabel = function dxForAxisLabel(id) {
|
|
13991
14384
|
var $$ = this.owner,
|
|
13992
|
-
position = this.getAxisLabelPosition(id)
|
|
13993
|
-
|
|
14385
|
+
position = this.getAxisLabelPosition(id);
|
|
14386
|
+
var dx = position.isBottom ? "0.5em" : "0";
|
|
13994
14387
|
if (this.isHorizontal($$, id !== "x")) {
|
|
13995
14388
|
dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0";
|
|
13996
14389
|
} else if (position.isTop) {
|
|
@@ -14000,8 +14393,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14000
14393
|
};
|
|
14001
14394
|
_proto.textAnchorForAxisLabel = function textAnchorForAxisLabel(id) {
|
|
14002
14395
|
var $$ = this.owner,
|
|
14003
|
-
position = this.getAxisLabelPosition(id)
|
|
14004
|
-
|
|
14396
|
+
position = this.getAxisLabelPosition(id);
|
|
14397
|
+
var anchor = position.isMiddle ? "middle" : "end";
|
|
14005
14398
|
if (this.isHorizontal($$, id !== "x")) {
|
|
14006
14399
|
anchor = position.isLeft ? "start" : position.isCenter ? "middle" : "end";
|
|
14007
14400
|
} else if (position.isBottom) {
|
|
@@ -14015,8 +14408,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14015
14408
|
isRotated = config.axis_rotated,
|
|
14016
14409
|
isInner = this.getAxisLabelPosition(id).isInner,
|
|
14017
14410
|
tickRotate = config["axis_" + id + "_tick_rotate"] ? $$.getHorizontalAxisHeight(id) : 0,
|
|
14018
|
-
maxTickWidth = this.getMaxTickWidth(id)
|
|
14019
|
-
|
|
14411
|
+
maxTickWidth = this.getMaxTickWidth(id);
|
|
14412
|
+
var dy;
|
|
14020
14413
|
if (id === "x") {
|
|
14021
14414
|
var xHeight = config.axis_x_height;
|
|
14022
14415
|
if (isRotated) {
|
|
@@ -14059,14 +14452,14 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14059
14452
|
chart = _$$$$el2.chart,
|
|
14060
14453
|
currentTickMax = current.maxTickWidths[id],
|
|
14061
14454
|
maxWidth = 0;
|
|
14062
|
-
if (withoutRecompute || !config["axis_" + id + "_show"] || $$.filterTargetsToShow().length === 0) {
|
|
14455
|
+
if (withoutRecompute || !config["axis_" + id + "_show"] || currentTickMax.size > 0 && $$.filterTargetsToShow().length === 0) {
|
|
14063
14456
|
return currentTickMax.size;
|
|
14064
14457
|
}
|
|
14065
14458
|
if (svg) {
|
|
14066
14459
|
var isYAxis = /^y2?$/.test(id),
|
|
14067
14460
|
targetsToShow = $$.filterTargetsToShow($$.data.targets),
|
|
14068
|
-
|
|
14069
|
-
domain =
|
|
14461
|
+
scale = $$.scale[id].copy().domain($$["get" + (isYAxis ? "Y" : "X") + "Domain"](targetsToShow, id)),
|
|
14462
|
+
domain = scale.domain(),
|
|
14070
14463
|
isDomainSame = domain[0] === domain[1] && domain.every(function (v) {
|
|
14071
14464
|
_newArrowCheck(this, _this11);
|
|
14072
14465
|
return v > 0;
|
|
@@ -14086,7 +14479,7 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14086
14479
|
if (!isYAxis) {
|
|
14087
14480
|
currentTickMax.ticks.splice(0);
|
|
14088
14481
|
}
|
|
14089
|
-
var axis = this.getAxis(id,
|
|
14482
|
+
var axis = this.getAxis(id, scale, !1, !1, !0),
|
|
14090
14483
|
tickCount = config["axis_" + id + "_tick_count"],
|
|
14091
14484
|
tickValues = config["axis_" + id + "_tick_values"];
|
|
14092
14485
|
// Make to generate the final tick text to be rendered
|
|
@@ -14140,9 +14533,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14140
14533
|
tickCount = tickTextWidths.length,
|
|
14141
14534
|
_state$axis$x$padding = state.axis.x.padding,
|
|
14142
14535
|
left = _state$axis$x$padding.left,
|
|
14143
|
-
right = _state$axis$x$padding.right
|
|
14144
|
-
|
|
14145
|
-
|
|
14536
|
+
right = _state$axis$x$padding.right;
|
|
14537
|
+
var maxOverflow = 0;
|
|
14538
|
+
var remaining = tickCount - (isTimeSeries && config.axis_x_tick_fit ? .5 : 0);
|
|
14146
14539
|
for (var i = 0; i < tickCount; i++) {
|
|
14147
14540
|
var tickIndex = i + 1,
|
|
14148
14541
|
rotatedTickTextWidth = Math.cos(Math.PI * xAxisTickRotate / 180) * tickTextWidths[i],
|
|
@@ -14159,8 +14552,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14159
14552
|
overflow = rotatedTickTextWidth - tickLength / 2 - remainingTickWidth;
|
|
14160
14553
|
maxOverflow = Math.max(maxOverflow, overflow);
|
|
14161
14554
|
}
|
|
14162
|
-
var filteredTargets = $$.filterTargetsToShow($$.data.targets)
|
|
14163
|
-
|
|
14555
|
+
var filteredTargets = $$.filterTargetsToShow($$.data.targets);
|
|
14556
|
+
var tickOffset = 0;
|
|
14164
14557
|
if (!isTimeSeries && config.axis_x_tick_count <= filteredTargets.length && filteredTargets[0].values.length) {
|
|
14165
14558
|
var _scale2 = getScale($$.axis.getAxisType("x"), 0, widthWithoutCurrentPaddingLeft - maxOverflow).domain([left * -1, $$.getXDomainMax($$.data.targets) + 1 + right]);
|
|
14166
14559
|
tickOffset = Math.ceil((_scale2(1) - _scale2(0)) / 2);
|
|
@@ -14233,8 +14626,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14233
14626
|
var isCategorized = this.isCategorized(),
|
|
14234
14627
|
count = targetCount - 2,
|
|
14235
14628
|
start = values[0],
|
|
14236
|
-
end = values[values.length - 1]
|
|
14237
|
-
|
|
14629
|
+
end = values[values.length - 1];
|
|
14630
|
+
var tickValue;
|
|
14631
|
+
|
|
14238
14632
|
// re-construct unique values
|
|
14239
14633
|
tickValues = [start];
|
|
14240
14634
|
for (var i = 0; i < count; i++) {
|
|
@@ -14388,8 +14782,8 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14388
14782
|
tickValues = sortValue(tickNodes.data()),
|
|
14389
14783
|
tickSize = tickValues.length,
|
|
14390
14784
|
cullingMax = config[cullingOptionPrefix + "_max"],
|
|
14391
|
-
lines = config[cullingOptionPrefix + "_lines"]
|
|
14392
|
-
|
|
14785
|
+
lines = config[cullingOptionPrefix + "_lines"];
|
|
14786
|
+
var intervalForCulling;
|
|
14393
14787
|
if (tickSize) {
|
|
14394
14788
|
for (var i = 1; i < tickSize; i++) {
|
|
14395
14789
|
if (tickSize / i < cullingMax) {
|
|
@@ -14635,8 +15029,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14635
15029
|
var _this4 = this;
|
|
14636
15030
|
_newArrowCheck(this, _this3);
|
|
14637
15031
|
var x = getPrevNextX(d),
|
|
14638
|
-
xDomain = xScale.domain()
|
|
14639
|
-
|
|
15032
|
+
xDomain = xScale.domain();
|
|
15033
|
+
var val;
|
|
15034
|
+
|
|
14640
15035
|
// if there this is a single data point make the eventRect full width (or height)
|
|
14641
15036
|
if (x.prev === null && x.next === null) {
|
|
14642
15037
|
val = isRotated ? state.height : state.width;
|
|
@@ -14656,8 +15051,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14656
15051
|
}.bind(this);
|
|
14657
15052
|
rectX = function (d) {
|
|
14658
15053
|
_newArrowCheck(this, _this3);
|
|
14659
|
-
var x = getPrevNextX(d)
|
|
14660
|
-
|
|
15054
|
+
var x = getPrevNextX(d);
|
|
15055
|
+
var val;
|
|
15056
|
+
|
|
14661
15057
|
// if there this is a single data point position the eventRect at 0
|
|
14662
15058
|
if (x.prev === null && x.next === null) {
|
|
14663
15059
|
val = 0;
|
|
@@ -14788,8 +15184,9 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
14788
15184
|
if (!d) {
|
|
14789
15185
|
return;
|
|
14790
15186
|
}
|
|
14791
|
-
var index = d.index
|
|
14792
|
-
|
|
15187
|
+
var index = d.index;
|
|
15188
|
+
var stepType = config.line_step_type;
|
|
15189
|
+
|
|
14793
15190
|
// tooltip position match for step-before & step-after
|
|
14794
15191
|
if (config.line_step_tooltipMatch && $$.hasType("step") && /^step\-(before|after)$/.test(stepType)) {
|
|
14795
15192
|
var scale = $$.scale.zoom || $$.scale.x,
|
|
@@ -14950,8 +15347,8 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
14950
15347
|
["axis.x", "grid.x", "gridLines.x", "region.list", "text", "bar", "line", "area", "circle"].forEach(function (v) {
|
|
14951
15348
|
var _node;
|
|
14952
15349
|
_newArrowCheck(this, _this);
|
|
14953
|
-
var name = v.split(".")
|
|
14954
|
-
|
|
15350
|
+
var name = v.split(".");
|
|
15351
|
+
var node = $el[name[0]];
|
|
14955
15352
|
if (node && name.length > 1) {
|
|
14956
15353
|
node = node[name[1]];
|
|
14957
15354
|
}
|
|
@@ -15143,18 +15540,22 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15143
15540
|
/* harmony default export */ var clip = ({
|
|
15144
15541
|
initClip: function initClip() {
|
|
15145
15542
|
var $$ = this,
|
|
15146
|
-
|
|
15543
|
+
_$$$state = $$.state,
|
|
15544
|
+
clip = _$$$state.clip,
|
|
15545
|
+
hasAxis = _$$$state.hasAxis;
|
|
15147
15546
|
// MEMO: clipId needs to be unique because it conflicts when multiple charts exist
|
|
15148
15547
|
clip.id = $$.state.datetimeId + "-clip";
|
|
15149
|
-
|
|
15150
|
-
|
|
15151
|
-
|
|
15548
|
+
if (hasAxis) {
|
|
15549
|
+
clip.idXAxis = clip.id + "-xaxis";
|
|
15550
|
+
clip.idYAxis = clip.id + "-yaxis";
|
|
15551
|
+
clip.idGrid = clip.id + "-grid";
|
|
15152
15552
|
|
|
15153
|
-
|
|
15154
|
-
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
|
|
15553
|
+
// Define 'clip-path' attribute values
|
|
15554
|
+
clip.path = $$.getClipPath(clip.id);
|
|
15555
|
+
clip.pathXAxis = $$.getClipPath(clip.idXAxis);
|
|
15556
|
+
clip.pathYAxis = $$.getClipPath(clip.idYAxis);
|
|
15557
|
+
clip.pathGrid = $$.getClipPath(clip.idGrid);
|
|
15558
|
+
}
|
|
15158
15559
|
},
|
|
15159
15560
|
getClipPath: function getClipPath(id) {
|
|
15160
15561
|
var $$ = this,
|
|
@@ -15176,10 +15577,10 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15176
15577
|
setXAxisClipPath: function setXAxisClipPath(node) {
|
|
15177
15578
|
var $$ = this,
|
|
15178
15579
|
config = $$.config,
|
|
15179
|
-
_$$$
|
|
15180
|
-
margin = _$$$
|
|
15181
|
-
width = _$$$
|
|
15182
|
-
height = _$$$
|
|
15580
|
+
_$$$state2 = $$.state,
|
|
15581
|
+
margin = _$$$state2.margin,
|
|
15582
|
+
width = _$$$state2.width,
|
|
15583
|
+
height = _$$$state2.height,
|
|
15183
15584
|
isRotated = config.axis_rotated,
|
|
15184
15585
|
left = Math.max(30, margin.left) - (isRotated ? 0 : 20),
|
|
15185
15586
|
x = isRotated ? -(1 + left) : -(left - 1),
|
|
@@ -15196,10 +15597,10 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15196
15597
|
setYAxisClipPath: function setYAxisClipPath(node) {
|
|
15197
15598
|
var $$ = this,
|
|
15198
15599
|
config = $$.config,
|
|
15199
|
-
_$$$
|
|
15200
|
-
margin = _$$$
|
|
15201
|
-
width = _$$$
|
|
15202
|
-
height = _$$$
|
|
15600
|
+
_$$$state3 = $$.state,
|
|
15601
|
+
margin = _$$$state3.margin,
|
|
15602
|
+
width = _$$$state3.width,
|
|
15603
|
+
height = _$$$state3.height,
|
|
15203
15604
|
isRotated = config.axis_rotated,
|
|
15204
15605
|
left = Math.max(30, margin.left) - (isRotated ? 20 : 0),
|
|
15205
15606
|
isInner = config.axis_y_inner,
|
|
@@ -15212,9 +15613,9 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15212
15613
|
updateXAxisTickClip: function updateXAxisTickClip() {
|
|
15213
15614
|
var $$ = this,
|
|
15214
15615
|
config = $$.config,
|
|
15215
|
-
_$$$
|
|
15216
|
-
clip = _$$$
|
|
15217
|
-
xAxisHeight = _$$$
|
|
15616
|
+
_$$$state4 = $$.state,
|
|
15617
|
+
clip = _$$$state4.clip,
|
|
15618
|
+
xAxisHeight = _$$$state4.xAxisHeight,
|
|
15218
15619
|
defs = $$.$el.defs,
|
|
15219
15620
|
newXAxisHeight = $$.getHorizontalAxisHeight("x");
|
|
15220
15621
|
if (defs && !clip.idXAxisTickTexts) {
|
|
@@ -15243,9 +15644,9 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
15243
15644
|
},
|
|
15244
15645
|
setXAxisTickTextClipPathWidth: function setXAxisTickTextClipPathWidth() {
|
|
15245
15646
|
var $$ = this,
|
|
15246
|
-
_$$$
|
|
15247
|
-
clip = _$$$
|
|
15248
|
-
current = _$$$
|
|
15647
|
+
_$$$state5 = $$.state,
|
|
15648
|
+
clip = _$$$state5.clip,
|
|
15649
|
+
current = _$$$state5.current,
|
|
15249
15650
|
svg = $$.$el.svg;
|
|
15250
15651
|
if (svg) {
|
|
15251
15652
|
svg.select("#" + clip.idXAxisTickTexts + " rect").attr("width", current.maxTickWidths.x.clipPath).attr("height", 30);
|
|
@@ -15440,7 +15841,7 @@ function smoothLines(el, type) {
|
|
|
15440
15841
|
// enter
|
|
15441
15842
|
var xgridLine = xLines.enter().append("g");
|
|
15442
15843
|
xgridLine.append("line").style("opacity", "0");
|
|
15443
|
-
xgridLine.append("text").attr("transform", isRotated ?
|
|
15844
|
+
xgridLine.append("text").attr("transform", isRotated ? null : "rotate(-90)").attr("dy", -5).style("opacity", "0");
|
|
15444
15845
|
xLines = xgridLine.merge(xLines);
|
|
15445
15846
|
$T(xLines.attr("class", function (d) {
|
|
15446
15847
|
_newArrowCheck(this, _this9);
|
|
@@ -15741,8 +16142,8 @@ function smoothLines(el, type) {
|
|
|
15741
16142
|
config = $$.config,
|
|
15742
16143
|
scale = $$.scale,
|
|
15743
16144
|
isRotated = config.axis_rotated,
|
|
15744
|
-
isX = type === "x"
|
|
15745
|
-
|
|
16145
|
+
isX = type === "x";
|
|
16146
|
+
var key = "start",
|
|
15746
16147
|
currScale,
|
|
15747
16148
|
pos = 0;
|
|
15748
16149
|
if (d.axis === "y" || d.axis === "y2") {
|
|
@@ -15772,8 +16173,8 @@ function smoothLines(el, type) {
|
|
|
15772
16173
|
state = $$.state,
|
|
15773
16174
|
isRotated = config.axis_rotated,
|
|
15774
16175
|
isWidth = type === "width",
|
|
15775
|
-
start = $$[isWidth ? "regionX" : "regionY"](d)
|
|
15776
|
-
|
|
16176
|
+
start = $$[isWidth ? "regionX" : "regionY"](d);
|
|
16177
|
+
var currScale,
|
|
15777
16178
|
key = "end",
|
|
15778
16179
|
end = state[type];
|
|
15779
16180
|
if (d.axis === "y" || d.axis === "y2") {
|
|
@@ -15839,8 +16240,8 @@ function smoothLines(el, type) {
|
|
|
15839
16240
|
rotatedPadding = _state.rotatedPadding,
|
|
15840
16241
|
isLegendRight = _state.isLegendRight,
|
|
15841
16242
|
isLegendInset = _state.isLegendInset,
|
|
15842
|
-
isRotated = config.axis_rotated
|
|
15843
|
-
|
|
16243
|
+
isRotated = config.axis_rotated;
|
|
16244
|
+
var h = 30;
|
|
15844
16245
|
if (id === "x" && !config.axis_x_show) {
|
|
15845
16246
|
return 8;
|
|
15846
16247
|
}
|
|
@@ -15880,14 +16281,14 @@ function smoothLines(el, type) {
|
|
|
15880
16281
|
axis = $$.axis,
|
|
15881
16282
|
config = $$.config,
|
|
15882
16283
|
state = $$.state,
|
|
15883
|
-
$el = $$.$el
|
|
15884
|
-
|
|
16284
|
+
$el = $$.$el;
|
|
16285
|
+
var rotate = config["axis_" + id + "_tick_rotate"];
|
|
15885
16286
|
if (id === "x") {
|
|
15886
16287
|
var allowedXAxisTypes = axis.isCategorized() || axis.isTimeSeries();
|
|
15887
16288
|
if (config.axis_x_tick_fit && allowedXAxisTypes) {
|
|
15888
16289
|
var xTickCount = config.axis_x_tick_count,
|
|
15889
|
-
currentXTicksLength = state.current.maxTickWidths.x.ticks.length
|
|
15890
|
-
|
|
16290
|
+
currentXTicksLength = state.current.maxTickWidths.x.ticks.length;
|
|
16291
|
+
var tickCount = 0;
|
|
15891
16292
|
if (xTickCount) {
|
|
15892
16293
|
tickCount = xTickCount > currentXTicksLength ? currentXTicksLength : xTickCount;
|
|
15893
16294
|
} else if (currentXTicksLength) {
|
|
@@ -17818,6 +18219,103 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17818
18219
|
|
|
17819
18220
|
|
|
17820
18221
|
|
|
18222
|
+
/**
|
|
18223
|
+
* Get radius functions
|
|
18224
|
+
* @param {number} expandRate Expand rate number.
|
|
18225
|
+
* - If 0, means for "normal" radius.
|
|
18226
|
+
* - If > 0, means for "expanded" radius.
|
|
18227
|
+
* @returns {object} radius functions
|
|
18228
|
+
* @private
|
|
18229
|
+
*/
|
|
18230
|
+
function getRadiusFn(expandRate) {
|
|
18231
|
+
if (expandRate === void 0) {
|
|
18232
|
+
expandRate = 0;
|
|
18233
|
+
}
|
|
18234
|
+
var $$ = this,
|
|
18235
|
+
config = $$.config,
|
|
18236
|
+
state = $$.state,
|
|
18237
|
+
hasMultiArcGauge = $$.hasMultiArcGauge(),
|
|
18238
|
+
singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
|
|
18239
|
+
expandWidth = expandRate ? Math.min(state.radiusExpanded * expandRate - state.radius, singleArcWidth * .8 - (1 - expandRate) * 100) : 0;
|
|
18240
|
+
return {
|
|
18241
|
+
/**
|
|
18242
|
+
* Getter of arc innerRadius value
|
|
18243
|
+
* @param {IArcData} d Data object
|
|
18244
|
+
* @returns {number} innerRadius value
|
|
18245
|
+
* @private
|
|
18246
|
+
*/
|
|
18247
|
+
inner: function inner(d) {
|
|
18248
|
+
var _$$$getRadius = $$.getRadius(d),
|
|
18249
|
+
innerRadius = _$$$getRadius.innerRadius;
|
|
18250
|
+
return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : isNumber(innerRadius) ? innerRadius : 0;
|
|
18251
|
+
},
|
|
18252
|
+
/**
|
|
18253
|
+
* Getter of arc outerRadius value
|
|
18254
|
+
* @param {IArcData} d Data object
|
|
18255
|
+
* @returns {number} outerRadius value
|
|
18256
|
+
* @private
|
|
18257
|
+
*/
|
|
18258
|
+
outer: function outer(d) {
|
|
18259
|
+
var _$$$getRadius2 = $$.getRadius(d),
|
|
18260
|
+
outerRadius = _$$$getRadius2.outerRadius;
|
|
18261
|
+
var radius;
|
|
18262
|
+
if (hasMultiArcGauge) {
|
|
18263
|
+
radius = state.radius - singleArcWidth * d.index + expandWidth;
|
|
18264
|
+
} else if ($$.hasType("polar") && !expandRate) {
|
|
18265
|
+
radius = $$.getPolarOuterRadius(d, outerRadius);
|
|
18266
|
+
} else {
|
|
18267
|
+
radius = outerRadius;
|
|
18268
|
+
if (expandRate) {
|
|
18269
|
+
var radiusExpanded = state.radiusExpanded;
|
|
18270
|
+
if (state.radius !== outerRadius) {
|
|
18271
|
+
radiusExpanded -= Math.abs(state.radius - outerRadius);
|
|
18272
|
+
}
|
|
18273
|
+
radius = radiusExpanded * expandRate;
|
|
18274
|
+
}
|
|
18275
|
+
}
|
|
18276
|
+
return radius;
|
|
18277
|
+
},
|
|
18278
|
+
/**
|
|
18279
|
+
* Getter of arc cornerRadius value
|
|
18280
|
+
* @param {IArcData} d Data object
|
|
18281
|
+
* @param {number} outerRadius outer radius value
|
|
18282
|
+
* @returns {number} cornerRadius value
|
|
18283
|
+
* @private
|
|
18284
|
+
*/
|
|
18285
|
+
corner: function (d, outerRadius) {
|
|
18286
|
+
var _config$arc_cornerRad = config.arc_cornerRadius_ratio,
|
|
18287
|
+
ratio = _config$arc_cornerRad === void 0 ? 0 : _config$arc_cornerRad,
|
|
18288
|
+
_config$arc_cornerRad2 = config.arc_cornerRadius,
|
|
18289
|
+
cornerRadius = _config$arc_cornerRad2 === void 0 ? 0 : _config$arc_cornerRad2,
|
|
18290
|
+
id = d.data.id,
|
|
18291
|
+
value = d.value;
|
|
18292
|
+
var corner = 0;
|
|
18293
|
+
if (ratio) {
|
|
18294
|
+
corner = ratio * outerRadius;
|
|
18295
|
+
} else {
|
|
18296
|
+
corner = isNumber(cornerRadius) ? cornerRadius : cornerRadius.call($$.api, id, value, outerRadius);
|
|
18297
|
+
}
|
|
18298
|
+
return corner;
|
|
18299
|
+
}
|
|
18300
|
+
};
|
|
18301
|
+
}
|
|
18302
|
+
|
|
18303
|
+
/**
|
|
18304
|
+
* Get attrTween function to get interpolated value on transition
|
|
18305
|
+
* @param {Function} fn Arc function to execute
|
|
18306
|
+
* @returns {Function} attrTween function
|
|
18307
|
+
* @private
|
|
18308
|
+
*/
|
|
18309
|
+
function getAttrTweenFn(fn) {
|
|
18310
|
+
return function (d) {
|
|
18311
|
+
var interpolate = (0,external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_.interpolate)(this._current, d);
|
|
18312
|
+
this._current = d;
|
|
18313
|
+
return function (t) {
|
|
18314
|
+
var interpolated = interpolate(t);
|
|
18315
|
+
return fn(interpolated);
|
|
18316
|
+
};
|
|
18317
|
+
};
|
|
18318
|
+
}
|
|
17821
18319
|
/* harmony default export */ var arc = ({
|
|
17822
18320
|
initPie: function initPie() {
|
|
17823
18321
|
var _this2 = this,
|
|
@@ -17863,8 +18361,8 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17863
18361
|
*/
|
|
17864
18362
|
getRadius: function getRadius(d) {
|
|
17865
18363
|
var $$ = this,
|
|
17866
|
-
data = d == null ? void 0 : d.data
|
|
17867
|
-
|
|
18364
|
+
data = d == null ? void 0 : d.data;
|
|
18365
|
+
var _$$$state = $$.state,
|
|
17868
18366
|
innerRadius = _$$$state.innerRadius,
|
|
17869
18367
|
outerRadius = _$$$state.outerRadius;
|
|
17870
18368
|
if (!isNumber(innerRadius) && data) {
|
|
@@ -17889,8 +18387,8 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17889
18387
|
getArcLength: function getArcLength() {
|
|
17890
18388
|
var $$ = this,
|
|
17891
18389
|
config = $$.config,
|
|
17892
|
-
arcLengthInPercent = config.gauge_arcLength * 3.6
|
|
17893
|
-
|
|
18390
|
+
arcLengthInPercent = config.gauge_arcLength * 3.6;
|
|
18391
|
+
var len = 2 * (arcLengthInPercent / 360);
|
|
17894
18392
|
if (arcLengthInPercent < -360) {
|
|
17895
18393
|
len = -2;
|
|
17896
18394
|
} else if (arcLengthInPercent > 360) {
|
|
@@ -17903,8 +18401,8 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17903
18401
|
config = $$.config,
|
|
17904
18402
|
isFullCircle = config.gauge_fullCircle,
|
|
17905
18403
|
defaultStartAngle = -1 * Math.PI / 2,
|
|
17906
|
-
defaultEndAngle = Math.PI / 2
|
|
17907
|
-
|
|
18404
|
+
defaultEndAngle = Math.PI / 2;
|
|
18405
|
+
var startAngle = config.gauge_startingAngle;
|
|
17908
18406
|
if (!isFullCircle && startAngle <= defaultStartAngle) {
|
|
17909
18407
|
startAngle = defaultStartAngle;
|
|
17910
18408
|
} else if (!isFullCircle && startAngle >= defaultEndAngle) {
|
|
@@ -17957,37 +18455,19 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17957
18455
|
return found ? d : null;
|
|
17958
18456
|
},
|
|
17959
18457
|
getSvgArc: function getSvgArc() {
|
|
17960
|
-
var
|
|
17961
|
-
|
|
17962
|
-
|
|
17963
|
-
|
|
17964
|
-
|
|
17965
|
-
|
|
17966
|
-
arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(function (d) {
|
|
17967
|
-
_newArrowCheck(this, _this5);
|
|
17968
|
-
var _$$$getRadius = $$.getRadius(d),
|
|
17969
|
-
innerRadius = _$$$getRadius.innerRadius;
|
|
17970
|
-
return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : isNumber(innerRadius) ? innerRadius : 0;
|
|
17971
|
-
}.bind(this)).outerRadius(function (d) {
|
|
17972
|
-
_newArrowCheck(this, _this5);
|
|
17973
|
-
var _$$$getRadius2 = $$.getRadius(d),
|
|
17974
|
-
outerRadius = _$$$getRadius2.outerRadius,
|
|
17975
|
-
radius = outerRadius;
|
|
17976
|
-
if (hasMultiArcGauge) {
|
|
17977
|
-
radius = state.radius - singleArcWidth * d.index;
|
|
17978
|
-
} else if (hasPolar) {
|
|
17979
|
-
radius = $$.getPolarOuterRadius(d, outerRadius);
|
|
17980
|
-
}
|
|
17981
|
-
return radius;
|
|
17982
|
-
}.bind(this)),
|
|
18458
|
+
var $$ = this,
|
|
18459
|
+
_getRadiusFn$call = getRadiusFn.call($$),
|
|
18460
|
+
inner = _getRadiusFn$call.inner,
|
|
18461
|
+
outer = _getRadiusFn$call.outer,
|
|
18462
|
+
corner = _getRadiusFn$call.corner,
|
|
18463
|
+
arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(inner).outerRadius(outer),
|
|
17983
18464
|
newArc = function (d, withoutUpdate) {
|
|
17984
18465
|
var path = "M 0 0";
|
|
17985
18466
|
if (d.value || d.data) {
|
|
17986
|
-
var
|
|
17987
|
-
|
|
17988
|
-
|
|
17989
|
-
|
|
17990
|
-
path = arc(updated);
|
|
18467
|
+
var _$$$updateAngle,
|
|
18468
|
+
data = withoutUpdate ? d : (_$$$updateAngle = $$.updateAngle(d)) != null ? _$$$updateAngle : null;
|
|
18469
|
+
if (data) {
|
|
18470
|
+
path = arc.cornerRadius(corner(data, outer(data)))(data);
|
|
17991
18471
|
}
|
|
17992
18472
|
}
|
|
17993
18473
|
return path;
|
|
@@ -17996,37 +18476,33 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17996
18476
|
newArc.centroid = arc.centroid;
|
|
17997
18477
|
return newArc;
|
|
17998
18478
|
},
|
|
18479
|
+
/**
|
|
18480
|
+
* Get expanded arc path function
|
|
18481
|
+
* @param {number} rate Expand rate
|
|
18482
|
+
* @returns {Function} Expanded arc path getter function
|
|
18483
|
+
* @private
|
|
18484
|
+
*/
|
|
17999
18485
|
getSvgArcExpanded: function getSvgArcExpanded(rate) {
|
|
18000
|
-
var
|
|
18001
|
-
|
|
18002
|
-
|
|
18003
|
-
|
|
18004
|
-
|
|
18005
|
-
|
|
18006
|
-
|
|
18007
|
-
|
|
18008
|
-
|
|
18009
|
-
|
|
18010
|
-
}.bind(this)).outerRadius(function (d) {
|
|
18011
|
-
_newArrowCheck(this, _this6);
|
|
18012
|
-
var radius;
|
|
18013
|
-
if (hasMultiArcGauge) {
|
|
18014
|
-
radius = state.radius - singleArcWidth * d.index + expandWidth;
|
|
18015
|
-
} else {
|
|
18016
|
-
var _$$$getRadius3 = $$.getRadius(d),
|
|
18017
|
-
outerRadius = _$$$getRadius3.outerRadius,
|
|
18018
|
-
radiusExpanded = state.radiusExpanded;
|
|
18019
|
-
if (state.radius !== outerRadius) {
|
|
18020
|
-
radiusExpanded -= Math.abs(state.radius - outerRadius);
|
|
18021
|
-
}
|
|
18022
|
-
radius = radiusExpanded * newRate;
|
|
18023
|
-
}
|
|
18024
|
-
return radius;
|
|
18025
|
-
}.bind(this));
|
|
18486
|
+
var _this5 = this;
|
|
18487
|
+
if (rate === void 0) {
|
|
18488
|
+
rate = 1;
|
|
18489
|
+
}
|
|
18490
|
+
var $$ = this,
|
|
18491
|
+
_getRadiusFn$call2 = getRadiusFn.call($$, rate),
|
|
18492
|
+
inner = _getRadiusFn$call2.inner,
|
|
18493
|
+
outer = _getRadiusFn$call2.outer,
|
|
18494
|
+
corner = _getRadiusFn$call2.corner,
|
|
18495
|
+
arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(inner).outerRadius(outer);
|
|
18026
18496
|
return function (d) {
|
|
18027
|
-
|
|
18028
|
-
|
|
18029
|
-
|
|
18497
|
+
_newArrowCheck(this, _this5);
|
|
18498
|
+
var updated = $$.updateAngle(d),
|
|
18499
|
+
outerR = outer(updated);
|
|
18500
|
+
var cornerR = 0;
|
|
18501
|
+
if (updated) {
|
|
18502
|
+
cornerR = corner(updated, outerR);
|
|
18503
|
+
}
|
|
18504
|
+
return updated ? arc.cornerRadius(cornerR)(updated) : "M 0 0";
|
|
18505
|
+
}.bind(this);
|
|
18030
18506
|
},
|
|
18031
18507
|
getArc: function getArc(d, withoutUpdate, force) {
|
|
18032
18508
|
return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
|
|
@@ -18038,7 +18514,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18038
18514
|
* @private
|
|
18039
18515
|
*/
|
|
18040
18516
|
transformForArcLabel: function transformForArcLabel(d) {
|
|
18041
|
-
var
|
|
18517
|
+
var _this6 = this,
|
|
18042
18518
|
$$ = this,
|
|
18043
18519
|
config = $$.config,
|
|
18044
18520
|
radiusExpanded = $$.state.radiusExpanded,
|
|
@@ -18052,23 +18528,23 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18052
18528
|
translate = "translate(" + x + "," + y + ")";
|
|
18053
18529
|
} else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
18054
18530
|
var _filter$map,
|
|
18055
|
-
_$$$
|
|
18056
|
-
outerRadius = _$$$
|
|
18531
|
+
_$$$getRadius3 = $$.getRadius(d),
|
|
18532
|
+
outerRadius = _$$$getRadius3.outerRadius;
|
|
18057
18533
|
if ($$.hasType("polar")) {
|
|
18058
18534
|
outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
18059
18535
|
}
|
|
18060
18536
|
var c = this.svgArc.centroid(updated),
|
|
18061
18537
|
_c$map = c.map(function (v) {
|
|
18062
|
-
_newArrowCheck(this,
|
|
18538
|
+
_newArrowCheck(this, _this6);
|
|
18063
18539
|
return isNaN(v) ? 0 : v;
|
|
18064
18540
|
}.bind(this)),
|
|
18065
18541
|
x = _c$map[0],
|
|
18066
18542
|
y = _c$map[1],
|
|
18067
|
-
h = Math.sqrt(x * x + y * y)
|
|
18068
|
-
|
|
18069
|
-
|
|
18070
|
-
|
|
18071
|
-
|
|
18543
|
+
h = Math.sqrt(x * x + y * y);
|
|
18544
|
+
var ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
|
|
18545
|
+
_newArrowCheck(this, _this6);
|
|
18546
|
+
return config[v + "_label_ratio"];
|
|
18547
|
+
}.bind(this))) == null ? void 0 : _filter$map[0];
|
|
18072
18548
|
if (ratio) {
|
|
18073
18549
|
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
|
18074
18550
|
} else {
|
|
@@ -18081,7 +18557,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18081
18557
|
},
|
|
18082
18558
|
convertToArcData: function convertToArcData(d) {
|
|
18083
18559
|
return this.addName({
|
|
18084
|
-
id:
|
|
18560
|
+
id: "data" in d ? d.data.id : d.id,
|
|
18085
18561
|
value: d.value,
|
|
18086
18562
|
ratio: this.getRatio("arc", d),
|
|
18087
18563
|
index: d.index
|
|
@@ -18108,14 +18584,14 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18108
18584
|
}
|
|
18109
18585
|
},
|
|
18110
18586
|
expandArc: function expandArc(targetIds) {
|
|
18111
|
-
var
|
|
18587
|
+
var _this7 = this,
|
|
18112
18588
|
$$ = this,
|
|
18113
18589
|
transiting = $$.state.transiting,
|
|
18114
18590
|
$el = $$.$el;
|
|
18115
18591
|
// MEMO: avoid to cancel transition
|
|
18116
18592
|
if (transiting) {
|
|
18117
18593
|
var interval = setInterval(function () {
|
|
18118
|
-
_newArrowCheck(this,
|
|
18594
|
+
_newArrowCheck(this, _this7);
|
|
18119
18595
|
if (!transiting) {
|
|
18120
18596
|
clearInterval(interval);
|
|
18121
18597
|
$el.legend.selectAll("." + $FOCUS.legendItemFocused).size() > 0 && $$.expandArc(targetIds);
|
|
@@ -18130,11 +18606,11 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18130
18606
|
}
|
|
18131
18607
|
var expandDuration = $$.getExpandConfig(d.data.id, "duration"),
|
|
18132
18608
|
svgArcExpandedSub = $$.getSvgArcExpanded($$.getExpandConfig(d.data.id, "rate"));
|
|
18133
|
-
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).selectAll("path").transition().duration(expandDuration).
|
|
18609
|
+
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).selectAll("path").transition().duration(expandDuration).attrTween("d", getAttrTweenFn($$.svgArcExpanded.bind($$))).transition().duration(expandDuration * 2).attrTween("d", getAttrTweenFn(svgArcExpandedSub.bind($$)));
|
|
18134
18610
|
});
|
|
18135
18611
|
},
|
|
18136
18612
|
unexpandArc: function unexpandArc(targetIds) {
|
|
18137
|
-
var
|
|
18613
|
+
var _this8 = this,
|
|
18138
18614
|
$$ = this,
|
|
18139
18615
|
transiting = $$.state.transiting,
|
|
18140
18616
|
svg = $$.$el.svg;
|
|
@@ -18143,9 +18619,9 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18143
18619
|
}
|
|
18144
18620
|
var newTargetIds = $$.mapToTargetIds(targetIds);
|
|
18145
18621
|
svg.selectAll($$.selectorTargets(newTargetIds, "." + $ARC.chartArc)).selectAll("path").transition().duration(function (d) {
|
|
18146
|
-
_newArrowCheck(this,
|
|
18622
|
+
_newArrowCheck(this, _this8);
|
|
18147
18623
|
return $$.getExpandConfig(d.data.id, "duration");
|
|
18148
|
-
}.bind(this)).
|
|
18624
|
+
}.bind(this)).attrTween("d", getAttrTweenFn($$.svgArc.bind($$)));
|
|
18149
18625
|
svg.selectAll("" + $ARC.arc).style("opacity", null);
|
|
18150
18626
|
},
|
|
18151
18627
|
/**
|
|
@@ -18157,8 +18633,8 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18157
18633
|
*/
|
|
18158
18634
|
getExpandConfig: function getExpandConfig(id, key) {
|
|
18159
18635
|
var $$ = this,
|
|
18160
|
-
config = $$.config
|
|
18161
|
-
|
|
18636
|
+
config = $$.config;
|
|
18637
|
+
var type;
|
|
18162
18638
|
if ($$.isDonutType(id)) {
|
|
18163
18639
|
type = "donut";
|
|
18164
18640
|
} else if ($$.isGaugeType(id)) {
|
|
@@ -18177,24 +18653,24 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18177
18653
|
return $$.isDonutType(id) && config.donut_expand || $$.isGaugeType(id) && config.gauge_expand || $$.isPieType(id) && config.pie_expand;
|
|
18178
18654
|
},
|
|
18179
18655
|
shouldShowArcLabel: function shouldShowArcLabel() {
|
|
18180
|
-
var
|
|
18656
|
+
var _this9 = this,
|
|
18181
18657
|
$$ = this,
|
|
18182
18658
|
config = $$.config;
|
|
18183
18659
|
return ["donut", "gauge", "pie", "polar"].some(function (v) {
|
|
18184
|
-
_newArrowCheck(this,
|
|
18660
|
+
_newArrowCheck(this, _this9);
|
|
18185
18661
|
return $$.hasType(v) && config[v + "_label_show"];
|
|
18186
18662
|
}.bind(this));
|
|
18187
18663
|
},
|
|
18188
18664
|
getArcLabelFormat: function getArcLabelFormat() {
|
|
18189
|
-
var
|
|
18665
|
+
var _this10 = this,
|
|
18190
18666
|
$$ = this,
|
|
18191
18667
|
config = $$.config,
|
|
18192
18668
|
format = function (v) {
|
|
18193
|
-
_newArrowCheck(this,
|
|
18669
|
+
_newArrowCheck(this, _this10);
|
|
18194
18670
|
return v;
|
|
18195
18671
|
}.bind(this);
|
|
18196
18672
|
["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).forEach(function (v) {
|
|
18197
|
-
_newArrowCheck(this,
|
|
18673
|
+
_newArrowCheck(this, _this10);
|
|
18198
18674
|
format = config[v + "_label_format"];
|
|
18199
18675
|
}.bind(this));
|
|
18200
18676
|
return isFunction(format) ? format.bind($$.api) : format;
|
|
@@ -18205,7 +18681,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18205
18681
|
return type ? $$.config[type + "_title"] : "";
|
|
18206
18682
|
},
|
|
18207
18683
|
updateTargetsForArc: function updateTargetsForArc(targets) {
|
|
18208
|
-
var
|
|
18684
|
+
var _this11 = this,
|
|
18209
18685
|
$$ = this,
|
|
18210
18686
|
$el = $$.$el,
|
|
18211
18687
|
hasGauge = $$.hasType("gauge"),
|
|
@@ -18214,7 +18690,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18214
18690
|
classFocus = $$.classFocus.bind($$),
|
|
18215
18691
|
chartArcs = $el.main.select("." + $ARC.chartArcs),
|
|
18216
18692
|
mainPieUpdate = chartArcs.selectAll("." + $ARC.chartArc).data($$.pie(targets)).attr("class", function (d) {
|
|
18217
|
-
_newArrowCheck(this,
|
|
18693
|
+
_newArrowCheck(this, _this11);
|
|
18218
18694
|
return classChartArc(d) + classFocus(d.data);
|
|
18219
18695
|
}.bind(this)),
|
|
18220
18696
|
mainPieEnter = mainPieUpdate.enter().append("g").attr("class", classChartArc).call(this.setCssRule(!1, "." + $ARC.chartArcs + " text", ["pointer-events:none", "text-anchor:middle"]));
|
|
@@ -18245,7 +18721,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18245
18721
|
}
|
|
18246
18722
|
},
|
|
18247
18723
|
redrawArc: function redrawArc(duration, durationForExit, withTransform) {
|
|
18248
|
-
var
|
|
18724
|
+
var _this12 = this,
|
|
18249
18725
|
$$ = this,
|
|
18250
18726
|
config = $$.config,
|
|
18251
18727
|
state = $$.state,
|
|
@@ -18255,10 +18731,10 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18255
18731
|
mainArc = main.selectAll("." + $ARC.arcs).selectAll("." + $ARC.arc).data($$.arcData.bind($$));
|
|
18256
18732
|
mainArc.exit().transition().duration(durationForExit).style("opacity", "0").remove();
|
|
18257
18733
|
mainArc = mainArc.enter().append("path").attr("class", $$.getClass("arc", !0)).style("fill", function (d) {
|
|
18258
|
-
_newArrowCheck(this,
|
|
18734
|
+
_newArrowCheck(this, _this12);
|
|
18259
18735
|
return $$.color(d.data);
|
|
18260
18736
|
}.bind(this)).style("cursor", function (d) {
|
|
18261
|
-
_newArrowCheck(this,
|
|
18737
|
+
_newArrowCheck(this, _this12);
|
|
18262
18738
|
return isSelectable != null && isSelectable.bind != null && isSelectable.bind($$.api)(d) ? "pointer" : null;
|
|
18263
18739
|
}.bind(this)).style("opacity", "0").each(function (d) {
|
|
18264
18740
|
if ($$.isGaugeType(d.data)) {
|
|
@@ -18272,19 +18748,19 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18272
18748
|
$$.hasMultiArcGauge() && $$.redrawMultiArcGauge();
|
|
18273
18749
|
}
|
|
18274
18750
|
mainArc.attr("transform", function (d) {
|
|
18275
|
-
_newArrowCheck(this,
|
|
18751
|
+
_newArrowCheck(this, _this12);
|
|
18276
18752
|
return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : "";
|
|
18277
18753
|
}.bind(this)).style("opacity", function (d) {
|
|
18278
18754
|
return d === this._current ? "0" : null;
|
|
18279
18755
|
}).each(function () {
|
|
18280
|
-
_newArrowCheck(this,
|
|
18756
|
+
_newArrowCheck(this, _this12);
|
|
18281
18757
|
state.transiting = !0;
|
|
18282
18758
|
}.bind(this)).transition().duration(duration).attrTween("d", function (d) {
|
|
18283
|
-
var
|
|
18759
|
+
var _this13 = this,
|
|
18284
18760
|
updated = $$.updateAngle(d);
|
|
18285
18761
|
if (!updated) {
|
|
18286
18762
|
return function () {
|
|
18287
|
-
_newArrowCheck(this,
|
|
18763
|
+
_newArrowCheck(this, _this13);
|
|
18288
18764
|
return "M 0 0";
|
|
18289
18765
|
}.bind(this);
|
|
18290
18766
|
}
|
|
@@ -18303,7 +18779,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18303
18779
|
return $$.getArc(interpolated, !0);
|
|
18304
18780
|
};
|
|
18305
18781
|
}).attr("transform", withTransform ? "scale(1)" : "").style("fill", function (d) {
|
|
18306
|
-
_newArrowCheck(this,
|
|
18782
|
+
_newArrowCheck(this, _this12);
|
|
18307
18783
|
var color;
|
|
18308
18784
|
if ($$.levelColor) {
|
|
18309
18785
|
color = $$.levelColor(d.data.values[0].value);
|
|
@@ -18333,7 +18809,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18333
18809
|
$$.redrawArcText(duration);
|
|
18334
18810
|
},
|
|
18335
18811
|
redrawBackgroundArcs: function redrawBackgroundArcs() {
|
|
18336
|
-
var
|
|
18812
|
+
var _this14 = this,
|
|
18337
18813
|
$$ = this,
|
|
18338
18814
|
config = $$.config,
|
|
18339
18815
|
state = $$.state,
|
|
@@ -18346,11 +18822,11 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18346
18822
|
var index = 0;
|
|
18347
18823
|
backgroundArc = backgroundArc.selectAll("path." + $ARC.chartArcsBackground).data($$.data.targets);
|
|
18348
18824
|
backgroundArc.enter().append("path").attr("class", function (d, i) {
|
|
18349
|
-
_newArrowCheck(this,
|
|
18825
|
+
_newArrowCheck(this, _this14);
|
|
18350
18826
|
return $ARC.chartArcsBackground + " " + $ARC.chartArcsBackground + "-" + i;
|
|
18351
18827
|
}.bind(this)).merge(backgroundArc).style("fill", config.gauge_background || null).attr("d", function (_ref2) {
|
|
18352
18828
|
var id = _ref2.id;
|
|
18353
|
-
_newArrowCheck(this,
|
|
18829
|
+
_newArrowCheck(this, _this14);
|
|
18354
18830
|
if (state.hiddenTargetIds.indexOf(id) >= 0) {
|
|
18355
18831
|
return "M 0 0";
|
|
18356
18832
|
}
|
|
@@ -18367,7 +18843,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18367
18843
|
backgroundArc.exit().remove();
|
|
18368
18844
|
} else {
|
|
18369
18845
|
backgroundArc.attr("d", function () {
|
|
18370
|
-
_newArrowCheck(this,
|
|
18846
|
+
_newArrowCheck(this, _this14);
|
|
18371
18847
|
var d = {
|
|
18372
18848
|
data: [{
|
|
18373
18849
|
value: config.gauge_max
|
|
@@ -18380,7 +18856,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18380
18856
|
}
|
|
18381
18857
|
},
|
|
18382
18858
|
bindArcEvent: function bindArcEvent(arc) {
|
|
18383
|
-
var
|
|
18859
|
+
var _this15 = this,
|
|
18384
18860
|
$$ = this,
|
|
18385
18861
|
config = $$.config,
|
|
18386
18862
|
state = $$.state,
|
|
@@ -18404,8 +18880,8 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18404
18880
|
$$.hideTooltip();
|
|
18405
18881
|
}
|
|
18406
18882
|
arc.on("click", function (event, d, i) {
|
|
18407
|
-
var updated = $$.updateAngle(d)
|
|
18408
|
-
|
|
18883
|
+
var updated = $$.updateAngle(d);
|
|
18884
|
+
var arcData;
|
|
18409
18885
|
if (updated) {
|
|
18410
18886
|
arcData = $$.convertToArcData(updated);
|
|
18411
18887
|
$$.toggleShape == null ? void 0 : $$.toggleShape(this, arcData, i);
|
|
@@ -18428,7 +18904,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18428
18904
|
selectArc(this, arcData, id);
|
|
18429
18905
|
$$.setOverOut(!0, arcData);
|
|
18430
18906
|
}).on("mouseout", function (event, d) {
|
|
18431
|
-
_newArrowCheck(this,
|
|
18907
|
+
_newArrowCheck(this, _this15);
|
|
18432
18908
|
if (state.transiting) {
|
|
18433
18909
|
// skip while transiting
|
|
18434
18910
|
return;
|
|
@@ -18449,7 +18925,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18449
18925
|
// touch events
|
|
18450
18926
|
if (isTouch && $$.hasArcType() && !$$.radars) {
|
|
18451
18927
|
var getEventArc = function (event) {
|
|
18452
|
-
_newArrowCheck(this,
|
|
18928
|
+
_newArrowCheck(this, _this15);
|
|
18453
18929
|
var touch = event.changedTouches[0],
|
|
18454
18930
|
eventArc = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(browser_doc.elementFromPoint(touch.clientX, touch.clientY));
|
|
18455
18931
|
return eventArc;
|
|
@@ -18472,7 +18948,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18472
18948
|
}
|
|
18473
18949
|
},
|
|
18474
18950
|
redrawArcText: function redrawArcText(duration) {
|
|
18475
|
-
var
|
|
18951
|
+
var _this16 = this,
|
|
18476
18952
|
$$ = this,
|
|
18477
18953
|
config = $$.config,
|
|
18478
18954
|
state = $$.state,
|
|
@@ -18485,13 +18961,13 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18485
18961
|
// for gauge type, update text when has no title & multi data
|
|
18486
18962
|
if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) {
|
|
18487
18963
|
text = main.selectAll("." + $ARC.chartArc).select("text").style("opacity", "0").attr("class", function (d) {
|
|
18488
|
-
_newArrowCheck(this,
|
|
18964
|
+
_newArrowCheck(this, _this16);
|
|
18489
18965
|
return $$.isGaugeType(d.data) ? $GAUGE.gaugeValue : null;
|
|
18490
18966
|
}.bind(this)).call($$.textForArcLabel.bind($$)).attr("transform", $$.transformForArcLabel.bind($$)).style("font-size", function (d) {
|
|
18491
|
-
_newArrowCheck(this,
|
|
18967
|
+
_newArrowCheck(this, _this16);
|
|
18492
18968
|
return $$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ? Math.round(state.radius / 5) + "px" : null;
|
|
18493
18969
|
}.bind(this)).transition().duration(duration).style("opacity", function (d) {
|
|
18494
|
-
_newArrowCheck(this,
|
|
18970
|
+
_newArrowCheck(this, _this16);
|
|
18495
18971
|
return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? null : "0";
|
|
18496
18972
|
}.bind(this));
|
|
18497
18973
|
hasMultiArcGauge && text.attr("dy", "-.1em");
|
|
@@ -18561,6 +19037,9 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18561
19037
|
return "0";
|
|
18562
19038
|
}).merge(area);
|
|
18563
19039
|
area.style("opacity", state.orgAreaOpacity);
|
|
19040
|
+
|
|
19041
|
+
// calculate ratio if grouped data exists
|
|
19042
|
+
$$.setRatioForGroupedData($root.area.data());
|
|
18564
19043
|
},
|
|
18565
19044
|
/**
|
|
18566
19045
|
* Redraw function
|
|
@@ -18652,8 +19131,9 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18652
19131
|
var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
|
18653
19132
|
offset = areaOffset(d, i) || y0,
|
|
18654
19133
|
posX = x(d),
|
|
18655
|
-
value = d.value
|
|
18656
|
-
|
|
19134
|
+
value = d.value;
|
|
19135
|
+
var posY = y(d);
|
|
19136
|
+
|
|
18657
19137
|
// fix posY not to overflow opposite quadrant
|
|
18658
19138
|
if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
|
|
18659
19139
|
posY = y0;
|
|
@@ -18703,7 +19183,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18703
19183
|
if (!$el.bar) {
|
|
18704
19184
|
$$.initBar();
|
|
18705
19185
|
}
|
|
18706
|
-
var mainBarUpdate =
|
|
19186
|
+
var mainBarUpdate = $el.main.select("." + $BAR.chartBars).selectAll("." + $BAR.chartBar).data(
|
|
18707
19187
|
// remove
|
|
18708
19188
|
targets.filter(function (v) {
|
|
18709
19189
|
var _this2 = this;
|
|
@@ -18744,6 +19224,9 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18744
19224
|
var bar = $root.main.selectAll("." + $BAR.bars).selectAll("." + $BAR.bar).data($$.labelishData.bind($$));
|
|
18745
19225
|
$T(bar.exit(), withTransition).style("opacity", "0").remove();
|
|
18746
19226
|
$root.bar = bar.enter().append("path").attr("class", classBar).style("fill", $$.updateBarColor.bind($$)).merge(bar).style("opacity", initialOpacity);
|
|
19227
|
+
|
|
19228
|
+
// calculate ratio if grouped data exists
|
|
19229
|
+
$$.setRatioForGroupedData($root.bar.data());
|
|
18747
19230
|
},
|
|
18748
19231
|
/**
|
|
18749
19232
|
* Update bar color
|
|
@@ -18819,10 +19302,10 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18819
19302
|
indexX = +isRotated,
|
|
18820
19303
|
indexY = +!indexX,
|
|
18821
19304
|
isNegative = d.value < 0,
|
|
18822
|
-
pathRadius = ["", ""],
|
|
18823
|
-
|
|
18824
|
-
|
|
18825
|
-
isRadiusData = getRadius && isGrouped ? $$.isStackingRadiusData(d) : !1; //
|
|
19305
|
+
pathRadius = ["", ""]; // switch points if axis is rotated, not applicable for sub chart
|
|
19306
|
+
var radius = 0;
|
|
19307
|
+
var isGrouped = $$.isGrouped(d.id),
|
|
19308
|
+
isRadiusData = getRadius && isGrouped ? $$.isStackingRadiusData(d) : !1; // const hasRadius = d.value !== 0 && getRadius;
|
|
18826
19309
|
if (getRadius && (!isGrouped || isRadiusData)) {
|
|
18827
19310
|
var index = isRotated ? indexY : indexX,
|
|
18828
19311
|
barW = points[2][index] - points[0][index];
|
|
@@ -18910,8 +19393,9 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
18910
19393
|
offset = barOffset(d, i) || y0,
|
|
18911
19394
|
width = isNumber(barW) ? barW : barW[d.id] || barW._$width,
|
|
18912
19395
|
value = d.value,
|
|
18913
|
-
posX = barX(d)
|
|
18914
|
-
|
|
19396
|
+
posX = barX(d);
|
|
19397
|
+
var posY = barY(d);
|
|
19398
|
+
|
|
18915
19399
|
// fix posY not to overflow opposite quadrant
|
|
18916
19400
|
if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
|
|
18917
19401
|
posY = y0;
|
|
@@ -19071,8 +19555,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19071
19555
|
var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
|
19072
19556
|
offset = shapeOffset(d, i) || y0,
|
|
19073
19557
|
width = isNumber(barW) ? barW : barW[d.id] || barW._$width,
|
|
19074
|
-
value = $$.getCandlestickData(d)
|
|
19075
|
-
|
|
19558
|
+
value = $$.getCandlestickData(d);
|
|
19559
|
+
var points;
|
|
19076
19560
|
if (value) {
|
|
19077
19561
|
var posX = {
|
|
19078
19562
|
start: x(d),
|
|
@@ -19213,9 +19697,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19213
19697
|
_newArrowCheck(this, _this2);
|
|
19214
19698
|
return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data);
|
|
19215
19699
|
}.bind(this)).style("display", config.gauge_label_show ? null : "none").each(function (d) {
|
|
19216
|
-
var lineLength = 0
|
|
19217
|
-
|
|
19218
|
-
x = 0,
|
|
19700
|
+
var lineLength = 0;
|
|
19701
|
+
var x = 0,
|
|
19219
19702
|
y = 0,
|
|
19220
19703
|
transform = "";
|
|
19221
19704
|
if (hiddenTargetIds.indexOf(d.data.id) < 0) {
|
|
@@ -19229,7 +19712,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19229
19712
|
y = Math.sin(linePositioningAngle) * arcInnerRadius;
|
|
19230
19713
|
transform = "rotate(" + lineAngle * 180 / Math.PI + ", " + x + ", " + y + ")";
|
|
19231
19714
|
}
|
|
19232
|
-
(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",
|
|
19715
|
+
(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");
|
|
19233
19716
|
});
|
|
19234
19717
|
},
|
|
19235
19718
|
textForGaugeMinMax: function textForGaugeMinMax(value, isMax) {
|
|
@@ -19279,8 +19762,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19279
19762
|
_$$$state = $$.state,
|
|
19280
19763
|
width = _$$$state.width,
|
|
19281
19764
|
height = _$$$state.height,
|
|
19282
|
-
cacheKey = KEY.bubbleBaseLength
|
|
19283
|
-
|
|
19765
|
+
cacheKey = KEY.bubbleBaseLength;
|
|
19766
|
+
var baseLength = $$.cache.get(cacheKey);
|
|
19284
19767
|
if (!baseLength) {
|
|
19285
19768
|
$$.cache.add(cacheKey, baseLength = getMinMax("min", [width, height]));
|
|
19286
19769
|
}
|
|
@@ -19473,8 +19956,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19473
19956
|
var x = isSub ? scale.subX : scale.x;
|
|
19474
19957
|
return function (d) {
|
|
19475
19958
|
_newArrowCheck(this, _this4);
|
|
19476
|
-
var y = yScale(d.id, isSub)
|
|
19477
|
-
|
|
19959
|
+
var y = yScale(d.id, isSub);
|
|
19960
|
+
var values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
|
19478
19961
|
x0 = 0,
|
|
19479
19962
|
y0 = 0,
|
|
19480
19963
|
path;
|
|
@@ -19504,22 +19987,11 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19504
19987
|
config = $$.config,
|
|
19505
19988
|
isRotated = config.axis_rotated,
|
|
19506
19989
|
isTimeSeries = $$.axis.isTimeSeries(),
|
|
19507
|
-
xOffset = $$.axis.isCategorized() ? .5 : 0,
|
|
19508
19990
|
regions = [],
|
|
19509
|
-
dasharray = "2 2",
|
|
19510
19991
|
xp,
|
|
19511
19992
|
yp,
|
|
19512
19993
|
diff,
|
|
19513
|
-
diffx2
|
|
19514
|
-
isWithinRegions = function (withinX, withinRegions) {
|
|
19515
|
-
_newArrowCheck(this, _this5);
|
|
19516
|
-
for (var i = 0, reg; reg = withinRegions[i]; i++) {
|
|
19517
|
-
if (reg.start < withinX && withinX <= reg.end) {
|
|
19518
|
-
return reg.style;
|
|
19519
|
-
}
|
|
19520
|
-
}
|
|
19521
|
-
return !1;
|
|
19522
|
-
}.bind(this);
|
|
19994
|
+
diffx2;
|
|
19523
19995
|
// Check start/end of regions
|
|
19524
19996
|
if (isDefined(_regions)) {
|
|
19525
19997
|
var getValue = function (v, def) {
|
|
@@ -19530,7 +20002,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19530
20002
|
var start = getValue(reg.start, d[0].x),
|
|
19531
20003
|
end = getValue(reg.end, d[d.length - 1].x),
|
|
19532
20004
|
style = reg.style || {
|
|
19533
|
-
dasharray:
|
|
20005
|
+
dasharray: "2 2"
|
|
19534
20006
|
};
|
|
19535
20007
|
regions[i] = {
|
|
19536
20008
|
start: start,
|
|
@@ -19575,12 +20047,13 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19575
20047
|
axisType = {
|
|
19576
20048
|
x: $$.axis.getAxisType("x"),
|
|
19577
20049
|
y: $$.axis.getAxisType("y")
|
|
19578
|
-
}
|
|
19579
|
-
|
|
20050
|
+
};
|
|
20051
|
+
var path = "";
|
|
19580
20052
|
for (var _i = 0, data; data = d[_i]; _i++) {
|
|
19581
20053
|
var prevData = d[_i - 1],
|
|
19582
|
-
hasPrevData = prevData && isValue(prevData.value)
|
|
19583
|
-
|
|
20054
|
+
hasPrevData = prevData && isValue(prevData.value);
|
|
20055
|
+
var style = $$.isWithinRegions(data.x, regions);
|
|
20056
|
+
|
|
19584
20057
|
// https://github.com/naver/billboard.js/issues/1172
|
|
19585
20058
|
if (!isValue(data.value)) {
|
|
19586
20059
|
continue;
|
|
@@ -19593,11 +20066,11 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19593
20066
|
try {
|
|
19594
20067
|
style = style.dasharray.split(" ");
|
|
19595
20068
|
} catch (e) {
|
|
19596
|
-
style =
|
|
20069
|
+
style = "2 2".split(" ");
|
|
19597
20070
|
}
|
|
19598
20071
|
|
|
19599
20072
|
// Draw with region // TODO: Fix for horizotal charts
|
|
19600
|
-
xp = getScale(axisType.x, prevData.x
|
|
20073
|
+
xp = getScale(axisType.x, prevData.x, data.x);
|
|
19601
20074
|
yp = getScale(axisType.y, prevData.value, data.value);
|
|
19602
20075
|
var dx = x(data.x) - x(prevData.x),
|
|
19603
20076
|
dy = y(data.value) - y(prevData.value),
|
|
@@ -19616,6 +20089,14 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
|
|
|
19616
20089
|
}
|
|
19617
20090
|
return path;
|
|
19618
20091
|
},
|
|
20092
|
+
isWithinRegions: function isWithinRegions(withinX, withinRegions) {
|
|
20093
|
+
for (var i = 0, reg; reg = withinRegions[i]; i++) {
|
|
20094
|
+
if (reg.start < withinX && withinX <= reg.end) {
|
|
20095
|
+
return reg.style;
|
|
20096
|
+
}
|
|
20097
|
+
}
|
|
20098
|
+
return !1;
|
|
20099
|
+
},
|
|
19619
20100
|
isWithinStep: function isWithinStep(that, y) {
|
|
19620
20101
|
return Math.abs(y - getPointer(this.state.event, that)[1]) < 30;
|
|
19621
20102
|
},
|
|
@@ -19649,16 +20130,16 @@ var getTransitionName = function () {
|
|
|
19649
20130
|
},
|
|
19650
20131
|
initialOpacityForCircle: function initialOpacityForCircle(d) {
|
|
19651
20132
|
var config = this.config,
|
|
19652
|
-
withoutFadeIn = this.state.withoutFadeIn
|
|
19653
|
-
|
|
20133
|
+
withoutFadeIn = this.state.withoutFadeIn;
|
|
20134
|
+
var opacity = config.point_opacity;
|
|
19654
20135
|
if (isUndefined(opacity)) {
|
|
19655
20136
|
opacity = this.getBaseValue(d) !== null && withoutFadeIn[d.id] ? this.opacityForCircle(d) : "0";
|
|
19656
20137
|
}
|
|
19657
20138
|
return opacity;
|
|
19658
20139
|
},
|
|
19659
20140
|
opacityForCircle: function opacityForCircle(d) {
|
|
19660
|
-
var config = this.config
|
|
19661
|
-
|
|
20141
|
+
var config = this.config;
|
|
20142
|
+
var opacity = config.point_opacity;
|
|
19662
20143
|
if (isUndefined(opacity)) {
|
|
19663
20144
|
opacity = config.point_show && !config.point_focus_only ? null : "0";
|
|
19664
20145
|
opacity = isValue(this.getBaseValue(d)) ? this.isBubbleType(d) || this.isScatterType(d) ? "0.5" : opacity : "0";
|
|
@@ -19784,8 +20265,8 @@ var getTransitionName = function () {
|
|
|
19784
20265
|
resizing = _$$$state.resizing,
|
|
19785
20266
|
toggling = _$$$state.toggling,
|
|
19786
20267
|
transiting = _$$$state.transiting,
|
|
19787
|
-
$el = $$.$el
|
|
19788
|
-
|
|
20268
|
+
$el = $$.$el;
|
|
20269
|
+
var circle = $el.circle;
|
|
19789
20270
|
if (transiting === !1 && config.point_focus_only && circle) {
|
|
19790
20271
|
var cx = (hasRadar ? $$.radarCircleX : $$.circleX).bind($$),
|
|
19791
20272
|
cy = (hasRadar ? $$.radarCircleY : $$.circleY).bind($$),
|
|
@@ -19804,8 +20285,8 @@ var getTransitionName = function () {
|
|
|
19804
20285
|
circle.attr("class", this.updatePointClass.bind(this)).style("opacity", null).each(function (d) {
|
|
19805
20286
|
var id = d.id,
|
|
19806
20287
|
index = d.index,
|
|
19807
|
-
value = d.value
|
|
19808
|
-
|
|
20288
|
+
value = d.value;
|
|
20289
|
+
var visibility = "hidden";
|
|
19809
20290
|
if (isValue(value)) {
|
|
19810
20291
|
fn.bind(this)(d);
|
|
19811
20292
|
$$.expandCircles(index, id);
|
|
@@ -19885,8 +20366,8 @@ var getTransitionName = function () {
|
|
|
19885
20366
|
pointR: function (d) {
|
|
19886
20367
|
var $$ = this,
|
|
19887
20368
|
config = $$.config,
|
|
19888
|
-
pointR = config.point_r
|
|
19889
|
-
|
|
20369
|
+
pointR = config.point_r;
|
|
20370
|
+
var r = pointR;
|
|
19890
20371
|
if ($$.isBubbleType(d)) {
|
|
19891
20372
|
r = $$.getBubbleR(d);
|
|
19892
20373
|
} else if (isFunction(pointR)) {
|
|
@@ -19908,8 +20389,8 @@ var getTransitionName = function () {
|
|
|
19908
20389
|
isWithinCircle: function isWithinCircle(node, r) {
|
|
19909
20390
|
var mouse = getPointer(this.state.event, node),
|
|
19910
20391
|
element = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(node),
|
|
19911
|
-
prefix = this.isCirclePoint(node) ? "c" : ""
|
|
19912
|
-
|
|
20392
|
+
prefix = this.isCirclePoint(node) ? "c" : "";
|
|
20393
|
+
var cx = +element.attr(prefix + "x"),
|
|
19913
20394
|
cy = +element.attr(prefix + "y");
|
|
19914
20395
|
// if node don't have cx/y or x/y attribute value
|
|
19915
20396
|
if (!(cx || cy) && node.nodeType === 1) {
|
|
@@ -19957,8 +20438,8 @@ var getTransitionName = function () {
|
|
|
19957
20438
|
},
|
|
19958
20439
|
updatePointClass: function updatePointClass(d) {
|
|
19959
20440
|
var $$ = this,
|
|
19960
|
-
circle = $$.$el.circle
|
|
19961
|
-
|
|
20441
|
+
circle = $$.$el.circle;
|
|
20442
|
+
var pointClass = !1;
|
|
19962
20443
|
if (isObject(d) || circle) {
|
|
19963
20444
|
pointClass = d === !0 ? circle.each(function (d) {
|
|
19964
20445
|
var className = $$.getClass("circle", !0)(d);
|
|
@@ -19982,8 +20463,9 @@ var getTransitionName = function () {
|
|
|
19982
20463
|
_newArrowCheck(this, _this8);
|
|
19983
20464
|
var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
|
|
19984
20465
|
offset = lineOffset(d, i) || y0,
|
|
19985
|
-
posX = x(d)
|
|
19986
|
-
|
|
20466
|
+
posX = x(d);
|
|
20467
|
+
var posY = y(d);
|
|
20468
|
+
|
|
19987
20469
|
// fix posY not to overflow opposite quadrant
|
|
19988
20470
|
if (config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY)) {
|
|
19989
20471
|
posY = y0;
|
|
@@ -20063,8 +20545,9 @@ var getTransitionName = function () {
|
|
|
20063
20545
|
return element.append("circle").attr("class", this.updatePointClass.bind(this)).attr("r", sizeFn).style("fill", fillStyleFn).node();
|
|
20064
20546
|
},
|
|
20065
20547
|
update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
|
20066
|
-
var $$ = this
|
|
20067
|
-
|
|
20548
|
+
var $$ = this;
|
|
20549
|
+
var mainCircles = element;
|
|
20550
|
+
|
|
20068
20551
|
// when '.load()' called, bubble size should be updated
|
|
20069
20552
|
if ($$.hasType("bubble")) {
|
|
20070
20553
|
mainCircles.attr("r", $$.pointR.bind($$));
|
|
@@ -20126,8 +20609,9 @@ var getTransitionName = function () {
|
|
|
20126
20609
|
* @private
|
|
20127
20610
|
*/
|
|
20128
20611
|
function getDataMax($$) {
|
|
20129
|
-
var levelMax = $$.config.polar_level_max
|
|
20130
|
-
|
|
20612
|
+
var levelMax = $$.config.polar_level_max;
|
|
20613
|
+
var dataMax = $$.getMinMaxData().max[0].value;
|
|
20614
|
+
|
|
20131
20615
|
// Apply level max only when is greater than the data max value
|
|
20132
20616
|
if (levelMax && levelMax > dataMax) {
|
|
20133
20617
|
dataMax = levelMax;
|
|
@@ -20511,9 +20995,9 @@ var cacheKey = KEY.radarPoints;
|
|
|
20511
20995
|
return "translate(" + posX + " " + posY + ")";
|
|
20512
20996
|
});
|
|
20513
20997
|
}
|
|
20514
|
-
$$.
|
|
20998
|
+
$$.bindRadarEvent();
|
|
20515
20999
|
},
|
|
20516
|
-
|
|
21000
|
+
bindRadarEvent: function bindRadarEvent() {
|
|
20517
21001
|
var _this9 = this,
|
|
20518
21002
|
$$ = this,
|
|
20519
21003
|
config = $$.config,
|
|
@@ -20605,6 +21089,271 @@ var cacheKey = KEY.radarPoints;
|
|
|
20605
21089
|
return this.cache.get(cacheKey)[d.id][d.index][1];
|
|
20606
21090
|
}
|
|
20607
21091
|
});
|
|
21092
|
+
// EXTERNAL MODULE: external {"commonjs":"d3-hierarchy","commonjs2":"d3-hierarchy","amd":"d3-hierarchy","root":"d3"}
|
|
21093
|
+
var external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_ = __webpack_require__(13);
|
|
21094
|
+
;// CONCATENATED MODULE: ./src/ChartInternal/shape/treemap.ts
|
|
21095
|
+
|
|
21096
|
+
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."); }
|
|
21097
|
+
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); }
|
|
21098
|
+
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; }
|
|
21099
|
+
/**
|
|
21100
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
21101
|
+
* billboard.js project is licensed under the MIT license
|
|
21102
|
+
*/
|
|
21103
|
+
|
|
21104
|
+
|
|
21105
|
+
|
|
21106
|
+
|
|
21107
|
+
/**
|
|
21108
|
+
* Get treemap elements' position
|
|
21109
|
+
* @param {d3Selection} group Root selection
|
|
21110
|
+
* @param {object} root Root data
|
|
21111
|
+
* @private
|
|
21112
|
+
*/
|
|
21113
|
+
function position(group, root) {
|
|
21114
|
+
var _this = this,
|
|
21115
|
+
$$ = this,
|
|
21116
|
+
_$$$scale = $$.scale,
|
|
21117
|
+
x = _$$$scale.x,
|
|
21118
|
+
y = _$$$scale.y,
|
|
21119
|
+
width = $$.state.width;
|
|
21120
|
+
group.selectAll("g").attr("transform", function (d) {
|
|
21121
|
+
_newArrowCheck(this, _this);
|
|
21122
|
+
return "translate(" + (d === root ? "0,0" : x(d.x0) + "," + y(d.y0)) + ")";
|
|
21123
|
+
}.bind(this)).select("rect").attr("width", function (d) {
|
|
21124
|
+
_newArrowCheck(this, _this);
|
|
21125
|
+
return d === root ? width : x(d.x1) - x(d.x0);
|
|
21126
|
+
}.bind(this)).attr("height", function (d) {
|
|
21127
|
+
_newArrowCheck(this, _this);
|
|
21128
|
+
return d === root ? 0 : y(d.y1) - y(d.y0);
|
|
21129
|
+
}.bind(this));
|
|
21130
|
+
}
|
|
21131
|
+
|
|
21132
|
+
/**
|
|
21133
|
+
* Convert data for treemap hierarchy
|
|
21134
|
+
* @param {object} data Data object
|
|
21135
|
+
* @returns {Array} Array of data for treemap hierarchy
|
|
21136
|
+
* @private
|
|
21137
|
+
*/
|
|
21138
|
+
function convertDataToTreemapData(data) {
|
|
21139
|
+
var _this2 = this,
|
|
21140
|
+
$$ = this;
|
|
21141
|
+
return data.map(function (d) {
|
|
21142
|
+
_newArrowCheck(this, _this2);
|
|
21143
|
+
var id = d.id,
|
|
21144
|
+
values = d.values,
|
|
21145
|
+
value = values[0].value;
|
|
21146
|
+
return {
|
|
21147
|
+
name: id,
|
|
21148
|
+
id: id,
|
|
21149
|
+
// needed to keep compatibility on whole code logic
|
|
21150
|
+
value: value,
|
|
21151
|
+
ratio: $$.getRatio("treemap", values[0])
|
|
21152
|
+
};
|
|
21153
|
+
}.bind(this));
|
|
21154
|
+
}
|
|
21155
|
+
/* harmony default export */ var treemap = ({
|
|
21156
|
+
initTreemap: function initTreemap() {
|
|
21157
|
+
var _this3 = this,
|
|
21158
|
+
$$ = this,
|
|
21159
|
+
$el = $$.$el,
|
|
21160
|
+
_$$$state = $$.state,
|
|
21161
|
+
_$$$state$current = _$$$state.current,
|
|
21162
|
+
width = _$$$state$current.width,
|
|
21163
|
+
height = _$$$state$current.height,
|
|
21164
|
+
clip = _$$$state.clip,
|
|
21165
|
+
clipId = clip.id;
|
|
21166
|
+
$$.treemap = (0,external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemap)().tile($$.getTreemapTile());
|
|
21167
|
+
$$.treemapFn = function (data) {
|
|
21168
|
+
var _this4 = this;
|
|
21169
|
+
_newArrowCheck(this, _this3);
|
|
21170
|
+
var hierarchyData = (0,external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.hierarchy)(data).sum(function (d) {
|
|
21171
|
+
_newArrowCheck(this, _this4);
|
|
21172
|
+
return d.value;
|
|
21173
|
+
}.bind(this)),
|
|
21174
|
+
sortFn = $$.getSortCompareFn(!0);
|
|
21175
|
+
return $$.treemap(sortFn ? hierarchyData.sort(sortFn) : hierarchyData);
|
|
21176
|
+
}.bind(this);
|
|
21177
|
+
$el.defs.append("clipPath").attr("id", clipId).append("rect").attr("width", width).attr("height", height);
|
|
21178
|
+
$el.treemap = $el.main.select("." + $COMMON.chart).attr("clip-path", "url(#" + clipId + ")").append("g").classed($TREEMAP.chartTreemaps, !0);
|
|
21179
|
+
$$.bindTreemapEvent();
|
|
21180
|
+
},
|
|
21181
|
+
/**
|
|
21182
|
+
* Bind events
|
|
21183
|
+
* @private
|
|
21184
|
+
*/
|
|
21185
|
+
bindTreemapEvent: function bindTreemapEvent() {
|
|
21186
|
+
var _this5 = this,
|
|
21187
|
+
$$ = this,
|
|
21188
|
+
$el = $$.$el,
|
|
21189
|
+
config = $$.config,
|
|
21190
|
+
state = $$.state,
|
|
21191
|
+
getTarget = function (event) {
|
|
21192
|
+
var _state$eventReceiver$, _data;
|
|
21193
|
+
_newArrowCheck(this, _this5);
|
|
21194
|
+
var target = event.isTrusted ? event.target : (_state$eventReceiver$ = state.eventReceiver.rect) == null ? void 0 : _state$eventReceiver$.node(),
|
|
21195
|
+
data;
|
|
21196
|
+
if (/^rect$/i.test(target.tagName)) {
|
|
21197
|
+
state.event = event;
|
|
21198
|
+
data = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum();
|
|
21199
|
+
}
|
|
21200
|
+
return (_data = data) == null ? void 0 : _data.data;
|
|
21201
|
+
}.bind(this);
|
|
21202
|
+
if (config.interaction_enabled) {
|
|
21203
|
+
var isTouch = state.inputType === "touch";
|
|
21204
|
+
$el.treemap.on(isTouch ? "touchstart" : "mousemove", function (event) {
|
|
21205
|
+
_newArrowCheck(this, _this5);
|
|
21206
|
+
var data = getTarget(event);
|
|
21207
|
+
if (data) {
|
|
21208
|
+
$$.showTooltip([data], event.currentTarget);
|
|
21209
|
+
event.type === "mouseover" && $$.setOverOut(!0, data);
|
|
21210
|
+
}
|
|
21211
|
+
}.bind(this)).on(isTouch ? "touchend" : "mouseout", function (event) {
|
|
21212
|
+
_newArrowCheck(this, _this5);
|
|
21213
|
+
var data = getTarget(event);
|
|
21214
|
+
$$.hideTooltip();
|
|
21215
|
+
$$.setOverOut(!1, data);
|
|
21216
|
+
}.bind(this));
|
|
21217
|
+
}
|
|
21218
|
+
},
|
|
21219
|
+
/**
|
|
21220
|
+
* Get tiling function
|
|
21221
|
+
* @returns {Function}
|
|
21222
|
+
* @private
|
|
21223
|
+
*/
|
|
21224
|
+
getTreemapTile: function getTreemapTile() {
|
|
21225
|
+
var _binary$dice$slice$sl,
|
|
21226
|
+
_config$treemap_tile,
|
|
21227
|
+
$$ = this,
|
|
21228
|
+
config = $$.config,
|
|
21229
|
+
_$$$state$current2 = $$.state.current,
|
|
21230
|
+
width = _$$$state$current2.width,
|
|
21231
|
+
height = _$$$state$current2.height,
|
|
21232
|
+
tile = (_binary$dice$slice$sl = {
|
|
21233
|
+
"binary": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapBinary,
|
|
21234
|
+
"dice": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapDice,
|
|
21235
|
+
"slice": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapSlice,
|
|
21236
|
+
"sliceDice": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapSliceDice,
|
|
21237
|
+
"squarify": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapSquarify,
|
|
21238
|
+
"resquarify": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapResquarify
|
|
21239
|
+
}[(_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,
|
|
21240
|
+
_this6 = this;
|
|
21241
|
+
return function (node, x0, y0, x1, y1) {
|
|
21242
|
+
_newArrowCheck(this, _this6);
|
|
21243
|
+
tile(node, 0, 0, width, height);
|
|
21244
|
+
for (var _iterator = _createForOfIteratorHelperLoose(node.children), _step; !(_step = _iterator()).done;) {
|
|
21245
|
+
var child = _step.value;
|
|
21246
|
+
child.x0 = x0 + child.x0 / width * (x1 - x0);
|
|
21247
|
+
child.x1 = x0 + child.x1 / width * (x1 - x0);
|
|
21248
|
+
child.y0 = y0 + child.y0 / height * (y1 - y0);
|
|
21249
|
+
child.y1 = y0 + child.y1 / height * (y1 - y0);
|
|
21250
|
+
}
|
|
21251
|
+
}.bind(this);
|
|
21252
|
+
},
|
|
21253
|
+
/**
|
|
21254
|
+
* Get treemap hierarchy data
|
|
21255
|
+
* @param {Array} targets Data targets
|
|
21256
|
+
* @returns {object}
|
|
21257
|
+
* @private
|
|
21258
|
+
*/
|
|
21259
|
+
getTreemapData: function getTreemapData(targets) {
|
|
21260
|
+
var $$ = this;
|
|
21261
|
+
return {
|
|
21262
|
+
name: "root",
|
|
21263
|
+
children: convertDataToTreemapData.bind($$)($$.filterTargetsToShow(targets.filter($$.isTreemapType, $$)))
|
|
21264
|
+
};
|
|
21265
|
+
},
|
|
21266
|
+
/**
|
|
21267
|
+
* Update treemap data
|
|
21268
|
+
* @param {Array} targets Data targets
|
|
21269
|
+
* @private
|
|
21270
|
+
*/
|
|
21271
|
+
updateTargetsForTreemap: function updateTargetsForTreemap(targets) {
|
|
21272
|
+
var $$ = this,
|
|
21273
|
+
treemap = $$.$el.treemap,
|
|
21274
|
+
treemapData = $$.treemapFn($$.getTreemapData(targets != null ? targets : $$.data.targets));
|
|
21275
|
+
// using $el.treemap reference can alter data, so select treemap <g> again
|
|
21276
|
+
treemap.data(treemapData);
|
|
21277
|
+
},
|
|
21278
|
+
/**
|
|
21279
|
+
* Render treemap
|
|
21280
|
+
* @param {number} durationForExit Duration for exit transition
|
|
21281
|
+
* @private
|
|
21282
|
+
*/
|
|
21283
|
+
updateTreemap: function updateTreemap(durationForExit) {
|
|
21284
|
+
var _this7 = this,
|
|
21285
|
+
$$ = this,
|
|
21286
|
+
$el = $$.$el,
|
|
21287
|
+
$T = $$.$T,
|
|
21288
|
+
data = $el.treemap.datum(),
|
|
21289
|
+
classChartTreemap = $$.getChartClass("Treemap"),
|
|
21290
|
+
treemap = $el.treemap.selectAll("g").data(data.children);
|
|
21291
|
+
$T(treemap.exit(), durationForExit).style("opacity", "0").remove();
|
|
21292
|
+
treemap.enter().append("g").append("rect");
|
|
21293
|
+
$el.treemap.selectAll("g").attr("class", classChartTreemap).select("rect").attr("fill", function (d) {
|
|
21294
|
+
_newArrowCheck(this, _this7);
|
|
21295
|
+
return $$.color(d.data.name);
|
|
21296
|
+
}.bind(this));
|
|
21297
|
+
},
|
|
21298
|
+
/**
|
|
21299
|
+
* Generate treemap coordinate points data
|
|
21300
|
+
* @returns {Array} Array of coordinate points
|
|
21301
|
+
* @private
|
|
21302
|
+
*/
|
|
21303
|
+
generateGetTreemapPoints: function generateGetTreemapPoints() {
|
|
21304
|
+
var _this8 = this,
|
|
21305
|
+
$$ = this,
|
|
21306
|
+
$el = $$.$el,
|
|
21307
|
+
_$$$scale2 = $$.scale,
|
|
21308
|
+
x = _$$$scale2.x,
|
|
21309
|
+
y = _$$$scale2.y,
|
|
21310
|
+
points = {};
|
|
21311
|
+
$el.treemap.selectAll("g").each(function (d) {
|
|
21312
|
+
_newArrowCheck(this, _this8);
|
|
21313
|
+
points[d.data.name] = [[x(d.x0), y(d.y0)], [x(d.x1), y(d.y1)]];
|
|
21314
|
+
}.bind(this));
|
|
21315
|
+
return function (d) {
|
|
21316
|
+
_newArrowCheck(this, _this8);
|
|
21317
|
+
return points[d.id];
|
|
21318
|
+
}.bind(this);
|
|
21319
|
+
},
|
|
21320
|
+
/**
|
|
21321
|
+
* Redraw treemap
|
|
21322
|
+
* @param {boolean} withTransition With or without transition
|
|
21323
|
+
* @returns {Array} Selections
|
|
21324
|
+
* @private
|
|
21325
|
+
*/
|
|
21326
|
+
redrawTreemap: function redrawTreemap(withTransition) {
|
|
21327
|
+
var $$ = this,
|
|
21328
|
+
$el = $$.$el,
|
|
21329
|
+
_$$$state$current3 = $$.state.current,
|
|
21330
|
+
width = _$$$state$current3.width,
|
|
21331
|
+
height = _$$$state$current3.height;
|
|
21332
|
+
// update defs
|
|
21333
|
+
$el.defs.select("rect").attr("width", width).attr("height", height);
|
|
21334
|
+
return [$$.$T($el.treemap, withTransition, getRandom()).call(position.bind($$), $el.treemap.datum())];
|
|
21335
|
+
},
|
|
21336
|
+
/**
|
|
21337
|
+
* Get treemap data label format function
|
|
21338
|
+
* @param {object} d Data object
|
|
21339
|
+
* @returns {Function}
|
|
21340
|
+
* @private
|
|
21341
|
+
*/
|
|
21342
|
+
treemapDataLabelFormat: function treemapDataLabelFormat(d) {
|
|
21343
|
+
var $$ = this,
|
|
21344
|
+
config = $$.config,
|
|
21345
|
+
id = d.id,
|
|
21346
|
+
value = d.value,
|
|
21347
|
+
format = config.treemap_label_format,
|
|
21348
|
+
ratio = $$.getRatio("treemap", d),
|
|
21349
|
+
percentValue = (ratio * 100).toFixed(2),
|
|
21350
|
+
meetLabelThreshold = config.treemap_label_show && $$.meetsLabelThreshold(ratio, "treemap") ? null : "0";
|
|
21351
|
+
return function (node) {
|
|
21352
|
+
node.style("opacity", meetLabelThreshold);
|
|
21353
|
+
return isFunction(format) ? format.bind($$.api)(value, ratio, id) : id + "\n" + percentValue + "%";
|
|
21354
|
+
};
|
|
21355
|
+
}
|
|
21356
|
+
});
|
|
20608
21357
|
;// CONCATENATED MODULE: ./src/config/Options/common/point.ts
|
|
20609
21358
|
/**
|
|
20610
21359
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -21100,7 +21849,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
21100
21849
|
* billboard.js project is licensed under the MIT license
|
|
21101
21850
|
*/
|
|
21102
21851
|
/**
|
|
21103
|
-
*
|
|
21852
|
+
* spline config options
|
|
21104
21853
|
*/
|
|
21105
21854
|
/* harmony default export */ var spline = ({
|
|
21106
21855
|
/**
|
|
@@ -21140,6 +21889,52 @@ var cacheKey = KEY.radarPoints;
|
|
|
21140
21889
|
*/
|
|
21141
21890
|
spline_interpolation_type: "cardinal"
|
|
21142
21891
|
});
|
|
21892
|
+
;// CONCATENATED MODULE: ./src/config/Options/shape/arc.ts
|
|
21893
|
+
/**
|
|
21894
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
21895
|
+
* billboard.js project is licensed under the MIT license
|
|
21896
|
+
*/
|
|
21897
|
+
/**
|
|
21898
|
+
* arc config options
|
|
21899
|
+
*/
|
|
21900
|
+
/* harmony default export */ var shape_arc = ({
|
|
21901
|
+
/**
|
|
21902
|
+
* Set arc options
|
|
21903
|
+
* @name arc
|
|
21904
|
+
* @memberof Options
|
|
21905
|
+
* @type {object}
|
|
21906
|
+
* @property {object} arc Arc object
|
|
21907
|
+
* @property {number|Function} [arc.cornerRadius=0] Set corner radius of Arc(donut/gauge/pie/polar) shape.
|
|
21908
|
+
* - **NOTE:**
|
|
21909
|
+
* - Corner radius can't surpass the `(outerRadius - innerRadius) /2` of indicated shape.
|
|
21910
|
+
* @property {number} [arc.cornerRadius.ratio=0] Set ratio relative of outer radius.
|
|
21911
|
+
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutCornerRadius)
|
|
21912
|
+
* @see [Demo: Gauge corner radius](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeCornerRadius)
|
|
21913
|
+
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#PieChartOptions.CornerRadius)
|
|
21914
|
+
* @example
|
|
21915
|
+
* arc: {
|
|
21916
|
+
* cornerRadius: 12,
|
|
21917
|
+
*
|
|
21918
|
+
* // can customize corner radius for each data with function callback
|
|
21919
|
+
* //
|
|
21920
|
+
* // The function will receive:
|
|
21921
|
+
* // - id {string}: Data id
|
|
21922
|
+
* // - value {number}: Data value
|
|
21923
|
+
* // - outerRadius {number}: Outer radius value
|
|
21924
|
+
* cornerRadius: function(id, value, outerRadius) {
|
|
21925
|
+
* return (id === "data1" && value > 10) ?
|
|
21926
|
+
* 50 : outerRadius * 1.2;
|
|
21927
|
+
* },
|
|
21928
|
+
*
|
|
21929
|
+
* // set ratio relative of outer radius
|
|
21930
|
+
* cornerRadius: {
|
|
21931
|
+
* ratio: 0.5
|
|
21932
|
+
* }
|
|
21933
|
+
* }
|
|
21934
|
+
*/
|
|
21935
|
+
arc_cornerRadius: 0,
|
|
21936
|
+
arc_cornerRadius_ratio: 0
|
|
21937
|
+
});
|
|
21143
21938
|
;// CONCATENATED MODULE: ./src/config/Options/shape/donut.ts
|
|
21144
21939
|
/**
|
|
21145
21940
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -21264,7 +22059,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
21264
22059
|
* - `startingAngle < -1 * Math.PI` defaults to `Math.PI`
|
|
21265
22060
|
* - `startingAngle > Math.PI` defaults to `Math.PI`
|
|
21266
22061
|
* @property {number} [gauge.arcLength=100] Set the length of the arc to be drawn in percent from -100 to 100.<br>
|
|
21267
|
-
* Negative value will draw the arc **counterclockwise**.
|
|
22062
|
+
* Negative value will draw the arc **counterclockwise**. Need to be used in conjunction with `gauge.fullCircle=true`.
|
|
21268
22063
|
*
|
|
21269
22064
|
* **Limitations:**
|
|
21270
22065
|
* - -100 <= arcLength (in percent) <= 100
|
|
@@ -21277,7 +22072,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
21277
22072
|
* **Available Values:**
|
|
21278
22073
|
* - single
|
|
21279
22074
|
* - multi
|
|
21280
|
-
* @property {
|
|
22075
|
+
* @property {number} [gauge.arcs.minWidth=5] Set minimal width of gauge arcs until the innerRadius disappears.
|
|
21281
22076
|
* @see [Demo: archLength](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeArcLength)
|
|
21282
22077
|
* @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeStartingAngle)
|
|
21283
22078
|
* @example
|
|
@@ -21351,7 +22146,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
21351
22146
|
* billboard.js project is licensed under the MIT license
|
|
21352
22147
|
*/
|
|
21353
22148
|
/**
|
|
21354
|
-
*
|
|
22149
|
+
* pie config options
|
|
21355
22150
|
*/
|
|
21356
22151
|
/* harmony default export */ var pie = ({
|
|
21357
22152
|
/**
|
|
@@ -21453,7 +22248,7 @@ var polar_this = undefined;
|
|
|
21453
22248
|
* billboard.js project is licensed under the MIT license
|
|
21454
22249
|
*/
|
|
21455
22250
|
/**
|
|
21456
|
-
*
|
|
22251
|
+
* polar config options
|
|
21457
22252
|
*/
|
|
21458
22253
|
/* harmony default export */ var shape_polar = ({
|
|
21459
22254
|
/**
|
|
@@ -21540,7 +22335,7 @@ var radar_this = undefined;
|
|
|
21540
22335
|
* billboard.js project is licensed under the MIT license
|
|
21541
22336
|
*/
|
|
21542
22337
|
/**
|
|
21543
|
-
*
|
|
22338
|
+
* radar config options
|
|
21544
22339
|
*/
|
|
21545
22340
|
/* harmony default export */ var shape_radar = ({
|
|
21546
22341
|
/**
|
|
@@ -21613,6 +22408,60 @@ var radar_this = undefined;
|
|
|
21613
22408
|
radar_size_ratio: .87,
|
|
21614
22409
|
radar_direction_clockwise: !1
|
|
21615
22410
|
});
|
|
22411
|
+
;// CONCATENATED MODULE: ./src/config/Options/shape/treemap.ts
|
|
22412
|
+
/**
|
|
22413
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
22414
|
+
* billboard.js project is licensed under the MIT license
|
|
22415
|
+
*/
|
|
22416
|
+
/**
|
|
22417
|
+
* treemap config options
|
|
22418
|
+
*/
|
|
22419
|
+
/* harmony default export */ var shape_treemap = ({
|
|
22420
|
+
/**
|
|
22421
|
+
* Set treemap options
|
|
22422
|
+
* @name treemap
|
|
22423
|
+
* @memberof Options
|
|
22424
|
+
* @type {object}
|
|
22425
|
+
* @property {object} treemap Treemap object
|
|
22426
|
+
* @property {string} [treemap.tile="binary"] Treemap tile type
|
|
22427
|
+
* - **Available tile type values:**
|
|
22428
|
+
* - binary ([d3.treemapBinary](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapBinary))
|
|
22429
|
+
* - dice ([d3.treemapDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapDice))
|
|
22430
|
+
* - slice ([d3.treemapSlice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSlice))
|
|
22431
|
+
* - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
|
|
22432
|
+
* - squrify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
|
|
22433
|
+
* - resquarify ([d3.treemapResquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapResquarify))
|
|
22434
|
+
* @property {Function} [treemap.label.format] Set formatter for the label text.
|
|
22435
|
+
* @property {number} [treemap.label.threshold=0.05] Set threshold ratio to show/hide labels text.
|
|
22436
|
+
* @property {number} [treemap.label.show=true] Show or hide label text.
|
|
22437
|
+
* @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
|
|
22438
|
+
* @example
|
|
22439
|
+
* treemap: {
|
|
22440
|
+
* // "binary", "dice", "slice", "sliceDice", "squrify", "resquarify"
|
|
22441
|
+
* tile: "dice",
|
|
22442
|
+
*
|
|
22443
|
+
* label: {
|
|
22444
|
+
* // show or hide label text
|
|
22445
|
+
* show: false,
|
|
22446
|
+
*
|
|
22447
|
+
* // set label text formatter
|
|
22448
|
+
* format: function(value, ratio, id) {
|
|
22449
|
+
* return d3.format("$")(value);
|
|
22450
|
+
*
|
|
22451
|
+
* // to multiline, return with '\n' character
|
|
22452
|
+
* // return value +"%\nLine1\n2Line2";
|
|
22453
|
+
* },
|
|
22454
|
+
*
|
|
22455
|
+
* // set ratio number
|
|
22456
|
+
* ratio: 0.05
|
|
22457
|
+
* }
|
|
22458
|
+
* }
|
|
22459
|
+
*/
|
|
22460
|
+
treemap_tile: "binary",
|
|
22461
|
+
treemap_label_format: undefined,
|
|
22462
|
+
treemap_label_threshold: .05,
|
|
22463
|
+
treemap_label_show: !0
|
|
22464
|
+
});
|
|
21616
22465
|
;// CONCATENATED MODULE: ./src/config/resolver/shape.ts
|
|
21617
22466
|
|
|
21618
22467
|
var shape_this = undefined;
|
|
@@ -21641,6 +22490,7 @@ var shape_this = undefined;
|
|
|
21641
22490
|
|
|
21642
22491
|
|
|
21643
22492
|
|
|
22493
|
+
|
|
21644
22494
|
// Options
|
|
21645
22495
|
|
|
21646
22496
|
|
|
@@ -21659,6 +22509,8 @@ var shape_this = undefined;
|
|
|
21659
22509
|
|
|
21660
22510
|
|
|
21661
22511
|
|
|
22512
|
+
|
|
22513
|
+
|
|
21662
22514
|
/**
|
|
21663
22515
|
* Extend Axis
|
|
21664
22516
|
* @param {Array} module Module to be extended
|
|
@@ -21761,7 +22613,7 @@ var _area = function area() {
|
|
|
21761
22613
|
shape_donut = function () {
|
|
21762
22614
|
var _this10 = this;
|
|
21763
22615
|
_newArrowCheck(this, shape_this);
|
|
21764
|
-
return extendArc(undefined, [donut]), (shape_donut = function () {
|
|
22616
|
+
return extendArc(undefined, [shape_arc, donut]), (shape_donut = function () {
|
|
21765
22617
|
_newArrowCheck(this, _this10);
|
|
21766
22618
|
return TYPE.DONUT;
|
|
21767
22619
|
}.bind(this))();
|
|
@@ -21769,7 +22621,7 @@ var _area = function area() {
|
|
|
21769
22621
|
resolver_shape_gauge = function () {
|
|
21770
22622
|
var _this11 = this;
|
|
21771
22623
|
_newArrowCheck(this, shape_this);
|
|
21772
|
-
return extendArc([gauge], [shape_gauge]), (resolver_shape_gauge = function () {
|
|
22624
|
+
return extendArc([gauge], [shape_arc, shape_gauge]), (resolver_shape_gauge = function () {
|
|
21773
22625
|
_newArrowCheck(this, _this11);
|
|
21774
22626
|
return TYPE.GAUGE;
|
|
21775
22627
|
}.bind(this))();
|
|
@@ -21777,7 +22629,7 @@ var _area = function area() {
|
|
|
21777
22629
|
shape_pie = function () {
|
|
21778
22630
|
var _this12 = this;
|
|
21779
22631
|
_newArrowCheck(this, shape_this);
|
|
21780
|
-
return extendArc(undefined, [pie]), (shape_pie = function () {
|
|
22632
|
+
return extendArc(undefined, [shape_arc, pie]), (shape_pie = function () {
|
|
21781
22633
|
_newArrowCheck(this, _this12);
|
|
21782
22634
|
return TYPE.PIE;
|
|
21783
22635
|
}.bind(this))();
|
|
@@ -21785,7 +22637,7 @@ var _area = function area() {
|
|
|
21785
22637
|
resolver_shape_polar = function () {
|
|
21786
22638
|
var _this13 = this;
|
|
21787
22639
|
_newArrowCheck(this, shape_this);
|
|
21788
|
-
return extendArc([polar], [shape_polar]), (resolver_shape_polar = function () {
|
|
22640
|
+
return extendArc([polar], [shape_arc, shape_polar]), (resolver_shape_polar = function () {
|
|
21789
22641
|
_newArrowCheck(this, _this13);
|
|
21790
22642
|
return TYPE.POLAR;
|
|
21791
22643
|
}.bind(this))();
|
|
@@ -21829,6 +22681,14 @@ var _area = function area() {
|
|
|
21829
22681
|
_newArrowCheck(this, _this18);
|
|
21830
22682
|
return TYPE.SCATTER;
|
|
21831
22683
|
}.bind(this))();
|
|
22684
|
+
}.bind(undefined),
|
|
22685
|
+
resolver_shape_treemap = function () {
|
|
22686
|
+
var _this19 = this;
|
|
22687
|
+
_newArrowCheck(this, shape_this);
|
|
22688
|
+
return extendAxis([treemap], [shape_treemap]), (resolver_shape_treemap = function () {
|
|
22689
|
+
_newArrowCheck(this, _this19);
|
|
22690
|
+
return TYPE.TREEMAP;
|
|
22691
|
+
}.bind(this))();
|
|
21832
22692
|
}.bind(undefined);
|
|
21833
22693
|
;// CONCATENATED MODULE: ./src/Chart/api/selection.ts
|
|
21834
22694
|
|
|
@@ -22054,7 +22914,7 @@ var _area = function area() {
|
|
|
22054
22914
|
}
|
|
22055
22915
|
});
|
|
22056
22916
|
// EXTERNAL MODULE: external {"commonjs":"d3-zoom","commonjs2":"d3-zoom","amd":"d3-zoom","root":"d3"}
|
|
22057
|
-
var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack_require__(
|
|
22917
|
+
var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack_require__(14);
|
|
22058
22918
|
;// CONCATENATED MODULE: ./src/Chart/api/zoom.ts
|
|
22059
22919
|
|
|
22060
22920
|
/**
|
|
@@ -22340,8 +23200,8 @@ extend(zoom, {
|
|
|
22340
23200
|
}.bind(this)).each(function (d, i) {
|
|
22341
23201
|
var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
22342
23202
|
isSelected = shape.classed($SELECT.SELECTED),
|
|
22343
|
-
isIncluded = shape.classed($DRAG.INCLUDED)
|
|
22344
|
-
|
|
23203
|
+
isIncluded = shape.classed($DRAG.INCLUDED);
|
|
23204
|
+
var isWithin = !1,
|
|
22345
23205
|
toggle;
|
|
22346
23206
|
if (shape.classed($CIRCLE.circle)) {
|
|
22347
23207
|
var x = +shape.attr("cx") * 1,
|
|
@@ -22547,8 +23407,8 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments.
|
|
|
22547
23407
|
if (config.data_selection_enabled && config.data_selection_isselectable.bind($$.api)(d)) {
|
|
22548
23408
|
var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that),
|
|
22549
23409
|
isSelected = shape.classed($SELECT.SELECTED),
|
|
22550
|
-
toggle = $$.getToggle(that, d).bind($$)
|
|
22551
|
-
|
|
23410
|
+
toggle = $$.getToggle(that, d).bind($$);
|
|
23411
|
+
var toggledShape;
|
|
22552
23412
|
if (!config.data_selection_multiple) {
|
|
22553
23413
|
var selector = "." + $SHAPE.shapes;
|
|
22554
23414
|
if (config.data_selection_grouped) {
|
|
@@ -23621,147 +24481,148 @@ var _selectionModule = function selectionModule() {
|
|
|
23621
24481
|
|
|
23622
24482
|
// eslint-disable-next-line no-use-before-define
|
|
23623
24483
|
|
|
23624
|
-
var _defaults = {}
|
|
23625
|
-
|
|
23626
|
-
/**
|
|
23627
|
-
* Version information
|
|
23628
|
-
* @property {string} version version
|
|
23629
|
-
* @example
|
|
23630
|
-
* bb.version; // "1.0.0"
|
|
23631
|
-
* @memberof bb
|
|
23632
|
-
*/
|
|
23633
|
-
version: "3.6.3",
|
|
23634
|
-
/**
|
|
23635
|
-
* Generate chart
|
|
23636
|
-
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|
|
23637
|
-
* - Unused option value is given.
|
|
23638
|
-
* - ex) For `data.type="pie"` option, setting 'axis' option can cause unexpected generation error.
|
|
23639
|
-
* - Insufficient value is given for certain option used.
|
|
23640
|
-
* - ex) `data: { x: "x", columns: [["x"], ["data1", 30, 200, 100]] }`
|
|
23641
|
-
* @param {Options} config chart options
|
|
23642
|
-
* @memberof bb
|
|
23643
|
-
* @returns {Chart}
|
|
23644
|
-
* @see {@link Options} for different generation options
|
|
23645
|
-
* @see {@link Chart} for different methods API
|
|
23646
|
-
* @example
|
|
23647
|
-
* <!-- chart holder -->
|
|
23648
|
-
* <div id="LineChart"></div>
|
|
23649
|
-
* @example
|
|
23650
|
-
* // Generate chart with options
|
|
23651
|
-
* var chart = bb.generate({
|
|
23652
|
-
* "bindto": "#LineChart"
|
|
23653
|
-
* "data": {
|
|
23654
|
-
* "columns": [
|
|
23655
|
-
* ["data1", 30, 200, 100, 400, 150, 250],
|
|
23656
|
-
* ["data2", 50, 20, 10, 40, 15, 25]
|
|
23657
|
-
* ],
|
|
23658
|
-
* "type": "line"
|
|
23659
|
-
* }
|
|
23660
|
-
* });
|
|
23661
|
-
*
|
|
23662
|
-
* // call some API
|
|
23663
|
-
* // ex) get the data of 'data1'
|
|
23664
|
-
* chart.data("data1");
|
|
23665
|
-
* @example
|
|
23666
|
-
* // Generate chart by importing ESM
|
|
23667
|
-
* // Import types to be used only, where this will make smaller bundle size.
|
|
23668
|
-
* import bb, {
|
|
23669
|
-
* area,
|
|
23670
|
-
* areaLineRange,
|
|
23671
|
-
* areaSpline,
|
|
23672
|
-
* areaSplineRange,
|
|
23673
|
-
* areaStep,
|
|
23674
|
-
* bar,
|
|
23675
|
-
* bubble,
|
|
23676
|
-
* donut,
|
|
23677
|
-
* gauge,
|
|
23678
|
-
* line,
|
|
23679
|
-
* pie,
|
|
23680
|
-
* polar,
|
|
23681
|
-
* radar,
|
|
23682
|
-
* scatter,
|
|
23683
|
-
* spline,
|
|
23684
|
-
* step
|
|
23685
|
-
* }
|
|
23686
|
-
*
|
|
23687
|
-
* bb.generate({
|
|
23688
|
-
* "bindto": "#LineChart"
|
|
23689
|
-
* "data": {
|
|
23690
|
-
* "columns": [
|
|
23691
|
-
* ["data1", 30, 200, 100, 400, 150, 250],
|
|
23692
|
-
* ["data2", 50, 20, 10, 40, 15, 25]
|
|
23693
|
-
* ]
|
|
23694
|
-
* },
|
|
23695
|
-
* type: line(),
|
|
23696
|
-
*
|
|
23697
|
-
* // or
|
|
23698
|
-
* types: {
|
|
23699
|
-
* data1: bar(),
|
|
23700
|
-
* data2: step()
|
|
23701
|
-
* }
|
|
23702
|
-
* });
|
|
23703
|
-
*/
|
|
23704
|
-
generate: function generate(config) {
|
|
23705
|
-
var options = mergeObj({}, _defaults, config),
|
|
23706
|
-
inst = new Chart(options);
|
|
23707
|
-
inst.internal.charts = this.instance;
|
|
23708
|
-
this.instance.push(inst);
|
|
23709
|
-
return inst;
|
|
23710
|
-
},
|
|
23711
|
-
/**
|
|
23712
|
-
* Set or get global default options.
|
|
23713
|
-
* - **NOTE:**
|
|
23714
|
-
* - The options values settings are valid within page context only.
|
|
23715
|
-
* - If is called multiple times, will override the last value.
|
|
23716
|
-
* @param {Options} options chart options
|
|
23717
|
-
* @memberof bb
|
|
23718
|
-
* @returns {Options}
|
|
23719
|
-
* @see {@link Options}
|
|
23720
|
-
* @example
|
|
23721
|
-
* // Set same option value as for `.generate()`
|
|
23722
|
-
* bb.defaults({
|
|
23723
|
-
* data: {
|
|
23724
|
-
* type: "bar"
|
|
23725
|
-
* }
|
|
23726
|
-
* });
|
|
23727
|
-
*
|
|
23728
|
-
* bb.defaults(); // {data:{type: "bar"}}
|
|
23729
|
-
*
|
|
23730
|
-
* // data.type defaults to 'bar'
|
|
23731
|
-
* var chart = bb.generate({ ... });
|
|
23732
|
-
*/
|
|
23733
|
-
defaults: function defaults(options) {
|
|
23734
|
-
if (isObject(options)) {
|
|
23735
|
-
_defaults = options;
|
|
23736
|
-
}
|
|
23737
|
-
return _defaults;
|
|
23738
|
-
},
|
|
23739
|
-
/**
|
|
23740
|
-
* An array containing instance created
|
|
23741
|
-
* @property {Array} instance instance array
|
|
23742
|
-
* @example
|
|
23743
|
-
* // generate charts
|
|
23744
|
-
* var chart1 = bb.generate(...);
|
|
23745
|
-
* var chart2 = bb.generate(...);
|
|
23746
|
-
*
|
|
23747
|
-
* bb.instance; // [ chart1, chart2, ... ]
|
|
23748
|
-
* @memberof bb
|
|
23749
|
-
*/
|
|
23750
|
-
instance: [],
|
|
23751
|
-
/**
|
|
23752
|
-
* Namespace for plugins
|
|
23753
|
-
* @property {object} plugin plugin namespace
|
|
23754
|
-
* @example
|
|
23755
|
-
* // Stanford diagram plugin
|
|
23756
|
-
* bb.plugin.stanford;
|
|
23757
|
-
* @memberof bb
|
|
23758
|
-
*/
|
|
23759
|
-
plugin: {}
|
|
23760
|
-
};
|
|
24484
|
+
var _defaults = {};
|
|
24485
|
+
|
|
23761
24486
|
/**
|
|
23762
24487
|
* @namespace bb
|
|
23763
|
-
* @version 3.
|
|
24488
|
+
* @version 3.7.0-next.2
|
|
23764
24489
|
*/
|
|
24490
|
+
var bb = {
|
|
24491
|
+
/**
|
|
24492
|
+
* Version information
|
|
24493
|
+
* @property {string} version version
|
|
24494
|
+
* @example
|
|
24495
|
+
* bb.version; // "1.0.0"
|
|
24496
|
+
* @memberof bb
|
|
24497
|
+
*/
|
|
24498
|
+
version: "3.7.0-next.2",
|
|
24499
|
+
/**
|
|
24500
|
+
* Generate chart
|
|
24501
|
+
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|
|
24502
|
+
* - Unused option value is given.
|
|
24503
|
+
* - ex) For `data.type="pie"` option, setting 'axis' option can cause unexpected generation error.
|
|
24504
|
+
* - Insufficient value is given for certain option used.
|
|
24505
|
+
* - ex) `data: { x: "x", columns: [["x"], ["data1", 30, 200, 100]] }`
|
|
24506
|
+
* @param {Options} config chart options
|
|
24507
|
+
* @memberof bb
|
|
24508
|
+
* @returns {Chart}
|
|
24509
|
+
* @see {@link Options} for different generation options
|
|
24510
|
+
* @see {@link Chart} for different methods API
|
|
24511
|
+
* @example
|
|
24512
|
+
* <!-- chart holder -->
|
|
24513
|
+
* <div id="LineChart"></div>
|
|
24514
|
+
* @example
|
|
24515
|
+
* // Generate chart with options
|
|
24516
|
+
* var chart = bb.generate({
|
|
24517
|
+
* "bindto": "#LineChart"
|
|
24518
|
+
* "data": {
|
|
24519
|
+
* "columns": [
|
|
24520
|
+
* ["data1", 30, 200, 100, 400, 150, 250],
|
|
24521
|
+
* ["data2", 50, 20, 10, 40, 15, 25]
|
|
24522
|
+
* ],
|
|
24523
|
+
* "type": "line"
|
|
24524
|
+
* }
|
|
24525
|
+
* });
|
|
24526
|
+
*
|
|
24527
|
+
* // call some API
|
|
24528
|
+
* // ex) get the data of 'data1'
|
|
24529
|
+
* chart.data("data1");
|
|
24530
|
+
* @example
|
|
24531
|
+
* // Generate chart by importing ESM
|
|
24532
|
+
* // Import types to be used only, where this will make smaller bundle size.
|
|
24533
|
+
* import bb, {
|
|
24534
|
+
* area,
|
|
24535
|
+
* areaLineRange,
|
|
24536
|
+
* areaSpline,
|
|
24537
|
+
* areaSplineRange,
|
|
24538
|
+
* areaStep,
|
|
24539
|
+
* bar,
|
|
24540
|
+
* bubble,
|
|
24541
|
+
* donut,
|
|
24542
|
+
* gauge,
|
|
24543
|
+
* line,
|
|
24544
|
+
* pie,
|
|
24545
|
+
* polar,
|
|
24546
|
+
* radar,
|
|
24547
|
+
* scatter,
|
|
24548
|
+
* spline,
|
|
24549
|
+
* step
|
|
24550
|
+
* }
|
|
24551
|
+
*
|
|
24552
|
+
* bb.generate({
|
|
24553
|
+
* "bindto": "#LineChart"
|
|
24554
|
+
* "data": {
|
|
24555
|
+
* "columns": [
|
|
24556
|
+
* ["data1", 30, 200, 100, 400, 150, 250],
|
|
24557
|
+
* ["data2", 50, 20, 10, 40, 15, 25]
|
|
24558
|
+
* ]
|
|
24559
|
+
* },
|
|
24560
|
+
* type: line(),
|
|
24561
|
+
*
|
|
24562
|
+
* // or
|
|
24563
|
+
* types: {
|
|
24564
|
+
* data1: bar(),
|
|
24565
|
+
* data2: step()
|
|
24566
|
+
* }
|
|
24567
|
+
* });
|
|
24568
|
+
*/
|
|
24569
|
+
generate: function generate(config) {
|
|
24570
|
+
var options = mergeObj({}, _defaults, config),
|
|
24571
|
+
inst = new Chart(options);
|
|
24572
|
+
inst.internal.charts = this.instance;
|
|
24573
|
+
this.instance.push(inst);
|
|
24574
|
+
return inst;
|
|
24575
|
+
},
|
|
24576
|
+
/**
|
|
24577
|
+
* Set or get global default options.
|
|
24578
|
+
* - **NOTE:**
|
|
24579
|
+
* - The options values settings are valid within page context only.
|
|
24580
|
+
* - If is called multiple times, will override the last value.
|
|
24581
|
+
* @param {Options} options chart options
|
|
24582
|
+
* @memberof bb
|
|
24583
|
+
* @returns {Options}
|
|
24584
|
+
* @see {@link Options}
|
|
24585
|
+
* @example
|
|
24586
|
+
* // Set same option value as for `.generate()`
|
|
24587
|
+
* bb.defaults({
|
|
24588
|
+
* data: {
|
|
24589
|
+
* type: "bar"
|
|
24590
|
+
* }
|
|
24591
|
+
* });
|
|
24592
|
+
*
|
|
24593
|
+
* bb.defaults(); // {data:{type: "bar"}}
|
|
24594
|
+
*
|
|
24595
|
+
* // data.type defaults to 'bar'
|
|
24596
|
+
* var chart = bb.generate({ ... });
|
|
24597
|
+
*/
|
|
24598
|
+
defaults: function defaults(options) {
|
|
24599
|
+
if (isObject(options)) {
|
|
24600
|
+
_defaults = options;
|
|
24601
|
+
}
|
|
24602
|
+
return _defaults;
|
|
24603
|
+
},
|
|
24604
|
+
/**
|
|
24605
|
+
* An array containing instance created
|
|
24606
|
+
* @property {Array} instance instance array
|
|
24607
|
+
* @example
|
|
24608
|
+
* // generate charts
|
|
24609
|
+
* var chart1 = bb.generate(...);
|
|
24610
|
+
* var chart2 = bb.generate(...);
|
|
24611
|
+
*
|
|
24612
|
+
* bb.instance; // [ chart1, chart2, ... ]
|
|
24613
|
+
* @memberof bb
|
|
24614
|
+
*/
|
|
24615
|
+
instance: [],
|
|
24616
|
+
/**
|
|
24617
|
+
* Namespace for plugins
|
|
24618
|
+
* @property {object} plugin plugin namespace
|
|
24619
|
+
* @example
|
|
24620
|
+
* // Stanford diagram plugin
|
|
24621
|
+
* bb.plugin.stanford;
|
|
24622
|
+
* @memberof bb
|
|
24623
|
+
*/
|
|
24624
|
+
plugin: {}
|
|
24625
|
+
};
|
|
23765
24626
|
;// CONCATENATED MODULE: ./src/index.ts
|
|
23766
24627
|
|
|
23767
24628
|
var src_this = undefined;
|