billboard.js 3.2.1 → 3.3.0
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 +2 -3
- package/dist/billboard.js +424 -114
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +5415 -3250
- package/dist/billboard.pkgd.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-bubblecompare.d.ts +7 -0
- 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.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-sparkline.js +19 -14
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-stanford.js +17 -12
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-tableview.js +19 -14
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.d.ts +7 -0
- package/dist/plugin/billboardjs-plugin-textoverlap.js +17 -12
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +5056 -3201
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +5082 -3222
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +5081 -3221
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +5075 -3215
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +5074 -3214
- package/dist/theme/datalab.css +2 -2
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +2 -2
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +2 -2
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +737 -456
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +8 -8
- package/dist-esm/plugin/billboardjs-plugin-stanford.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +15 -15
- package/dist-esm/plugin/billboardjs-plugin-tableview.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +6 -6
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.d.ts +7 -0
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +4 -4
- package/package.json +52 -52
- package/src/Chart/api/chart.ts +7 -1
- package/src/Chart/api/data.ts +3 -4
- package/src/ChartInternal/Axis/Axis.ts +15 -9
- package/src/ChartInternal/ChartInternal.ts +13 -2
- package/src/ChartInternal/data/IData.ts +9 -0
- package/src/ChartInternal/data/convert.ts +1 -1
- package/src/ChartInternal/data/data.ts +28 -11
- package/src/ChartInternal/interactions/interaction.ts +36 -4
- package/src/ChartInternal/internals/domain.ts +4 -2
- package/src/ChartInternal/internals/legend.ts +2 -1
- package/src/ChartInternal/internals/redraw.ts +2 -2
- package/src/ChartInternal/internals/scale.ts +3 -2
- package/src/ChartInternal/internals/size.ts +32 -1
- package/src/ChartInternal/internals/text.ts +2 -2
- package/src/ChartInternal/internals/tooltip.ts +4 -1
- package/src/ChartInternal/shape/arc.ts +3 -5
- package/src/ChartInternal/shape/bar.ts +89 -34
- package/src/ChartInternal/shape/radar.ts +2 -0
- package/src/ChartInternal/shape/shape.ts +72 -11
- package/src/Plugin/sparkline/index.ts +2 -2
- package/src/Plugin/tableview/index.ts +1 -1
- package/src/config/Options/axis/x.ts +27 -7
- package/src/config/Options/axis/y.ts +24 -3
- package/src/config/Options/axis/y2.ts +24 -3
- package/src/config/Options/common/main.ts +11 -1
- package/src/config/Options/data/data.ts +22 -0
- package/src/config/Options/shape/bar.ts +9 -2
- package/src/module/util.ts +19 -20
- package/src/scss/billboard.scss +1 -13
- package/src/scss/theme/datalab.scss +1 -7
- package/src/scss/theme/graph.scss +1 -2
- package/src/scss/theme/insight.scss +1 -2
- package/types/axis.d.ts +22 -8
- package/types/chart.d.ts +1 -1
- package/types/options.d.ts +40 -33
- package/types/plugin/tableview/index.d.ts +3 -3
- package/types/plugin/tableview/options.d.ts +1 -1
- package/types/types.d.ts +9 -6
package/dist-esm/billboard.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.3.0
|
|
9
9
|
*/
|
|
10
10
|
import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
|
|
11
11
|
import { pointer, select, namespaces, selectAll } from 'd3-selection';
|
|
@@ -338,17 +338,18 @@ function hasValue(dict, value) {
|
|
|
338
338
|
/**
|
|
339
339
|
* Call function with arguments
|
|
340
340
|
* @param {Function} fn Function to be called
|
|
341
|
-
* @param {*}
|
|
341
|
+
* @param {*} thisArg "this" value for fn
|
|
342
|
+
* @param {*} args Arguments for fn
|
|
342
343
|
* @returns {boolean} true: fn is function, false: fn is not function
|
|
343
344
|
* @private
|
|
344
345
|
*/
|
|
345
|
-
function callFn(fn) {
|
|
346
|
+
function callFn(fn, thisArg) {
|
|
346
347
|
var args = [];
|
|
347
|
-
for (var _i =
|
|
348
|
-
args[_i -
|
|
348
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
349
|
+
args[_i - 2] = arguments[_i];
|
|
349
350
|
}
|
|
350
351
|
var isFn = isFunction(fn);
|
|
351
|
-
isFn && fn.call.apply(fn, args);
|
|
352
|
+
isFn && fn.call.apply(fn, __spreadArray([thisArg], args, false));
|
|
352
353
|
return isFn;
|
|
353
354
|
}
|
|
354
355
|
/**
|
|
@@ -414,7 +415,7 @@ function setTextValue(node, text, dy, toMiddle) {
|
|
|
414
415
|
multiline.forEach(function (v, i) {
|
|
415
416
|
node.append("tspan")
|
|
416
417
|
.attr("x", 0)
|
|
417
|
-
.attr("dy", (i === 0 ? dy[0] * len_1 : dy[1]
|
|
418
|
+
.attr("dy", "".concat(i === 0 ? dy[0] * len_1 : dy[1], "em"))
|
|
418
419
|
.text(v);
|
|
419
420
|
});
|
|
420
421
|
}
|
|
@@ -468,11 +469,10 @@ function getPathBox(path) {
|
|
|
468
469
|
* @private
|
|
469
470
|
*/
|
|
470
471
|
function getPointer(event, element) {
|
|
471
|
-
var
|
|
472
|
-
var
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
return pointer$1;
|
|
472
|
+
var _a;
|
|
473
|
+
var touches = event && ((_a = (event.touches || (event.sourceEvent && event.sourceEvent.touches))) === null || _a === void 0 ? void 0 : _a[0]);
|
|
474
|
+
var pointer$1 = pointer(touches || event, element);
|
|
475
|
+
return pointer$1.map(function (v) { return (isNaN(v) ? 0 : v); });
|
|
476
476
|
}
|
|
477
477
|
/**
|
|
478
478
|
* Return brush selection array
|
|
@@ -489,7 +489,7 @@ function getBrushSelection(ctx) {
|
|
|
489
489
|
selection = event.selection;
|
|
490
490
|
// check from brush area selection
|
|
491
491
|
}
|
|
492
|
-
else if (main && (selection = main.select("."
|
|
492
|
+
else if (main && (selection = main.select(".".concat(CLASS.brush)).node())) {
|
|
493
493
|
selection = brushSelection(selection);
|
|
494
494
|
}
|
|
495
495
|
return selection;
|
|
@@ -647,7 +647,7 @@ function getCssRules(styleSheets) {
|
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
649
|
catch (e) {
|
|
650
|
-
console.error("Error while reading rules from "
|
|
650
|
+
console.error("Error while reading rules from ".concat(sheet.href, ": ").concat(e.toString()));
|
|
651
651
|
}
|
|
652
652
|
});
|
|
653
653
|
return rules;
|
|
@@ -834,7 +834,7 @@ var emulateEvent = {
|
|
|
834
834
|
function tplProcess(tpl, data) {
|
|
835
835
|
var res = tpl;
|
|
836
836
|
for (var x in data) {
|
|
837
|
-
res = res.replace(new RegExp("{="
|
|
837
|
+
res = res.replace(new RegExp("{=".concat(x, "}"), "g"), data[x]);
|
|
838
838
|
}
|
|
839
839
|
return res;
|
|
840
840
|
}
|
|
@@ -859,7 +859,7 @@ function parseDate(date) {
|
|
|
859
859
|
}
|
|
860
860
|
if (!parsedDate || isNaN(+parsedDate)) {
|
|
861
861
|
console && console.error &&
|
|
862
|
-
console.error("Failed to parse x '"
|
|
862
|
+
console.error("Failed to parse x '".concat(date, "' to Date object"));
|
|
863
863
|
}
|
|
864
864
|
return parsedDate;
|
|
865
865
|
}
|
|
@@ -914,7 +914,7 @@ function checkModuleImport(ctx) {
|
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
|
-
type && logError("Please, make sure if %c"
|
|
917
|
+
type && logError("Please, make sure if %c".concat(camelize(type)), "module has been imported and specified correctly.");
|
|
918
918
|
}
|
|
919
919
|
/**
|
|
920
920
|
* Log error and throw error
|
|
@@ -928,10 +928,10 @@ function logError(head, tail) {
|
|
|
928
928
|
var info = "https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality";
|
|
929
929
|
var hasConsole = (_a = win.console) === null || _a === void 0 ? void 0 : _a.error;
|
|
930
930
|
if (hasConsole) {
|
|
931
|
-
console.error("\u274C "
|
|
931
|
+
console.error("\u274C ".concat(prefix, " ").concat(head), "background:red;color:white;display:block;font-size:15px", tail);
|
|
932
932
|
console.info("%cℹ️", "font-size:15px", info);
|
|
933
933
|
}
|
|
934
|
-
throw Error(prefix
|
|
934
|
+
throw Error("".concat(prefix, " ").concat(head.replace(/\%c([a-z-]+)/i, "'$1' "), " ").concat(tail));
|
|
935
935
|
}
|
|
936
936
|
|
|
937
937
|
/**
|
|
@@ -1263,12 +1263,21 @@ var main = {
|
|
|
1263
1263
|
* @name padding
|
|
1264
1264
|
* @memberof Options
|
|
1265
1265
|
* @type {object}
|
|
1266
|
-
* @property {object} [padding] padding object
|
|
1266
|
+
* @property {object|boolean} [padding=true] Set padding of chart, and accepts object or boolean type.
|
|
1267
|
+
* - `Object`: Specify each side's padding.
|
|
1268
|
+
* - `false`: Remove padding completely and make shape to fully occupy the container element.
|
|
1269
|
+
* - In this case, axes and subchart will be hidden.
|
|
1270
|
+
* - To adjust some padding from this state, use `axis.[x|y].padding` option.
|
|
1267
1271
|
* @property {number} [padding.top] padding on the top of chart
|
|
1268
1272
|
* @property {number} [padding.right] padding on the right of chart
|
|
1269
1273
|
* @property {number} [padding.bottom] padding on the bottom of chart
|
|
1270
1274
|
* @property {number} [padding.left] padding on the left of chart
|
|
1275
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.Padding)
|
|
1271
1276
|
* @example
|
|
1277
|
+
* // remove padding completely.
|
|
1278
|
+
* padding: false,
|
|
1279
|
+
*
|
|
1280
|
+
* // or specify padding value for each side
|
|
1272
1281
|
* padding: {
|
|
1273
1282
|
* top: 20,
|
|
1274
1283
|
* right: 20,
|
|
@@ -1276,6 +1285,7 @@ var main = {
|
|
|
1276
1285
|
* left: 20
|
|
1277
1286
|
* }
|
|
1278
1287
|
*/
|
|
1288
|
+
padding: true,
|
|
1279
1289
|
padding_left: undefined,
|
|
1280
1290
|
padding_right: undefined,
|
|
1281
1291
|
padding_top: undefined,
|
|
@@ -2091,6 +2101,18 @@ var data$2 = {
|
|
|
2091
2101
|
* ]
|
|
2092
2102
|
* }
|
|
2093
2103
|
*
|
|
2104
|
+
* // for 'bar' type, data can contain:
|
|
2105
|
+
* // - an array of [start, end] data following the order
|
|
2106
|
+
* data: {
|
|
2107
|
+
* rows: [
|
|
2108
|
+
* ["data1", "data2"],
|
|
2109
|
+
* [[100, 150], 120],
|
|
2110
|
+
* [[200, 300], 55],
|
|
2111
|
+
* [[-400, 500], 60]
|
|
2112
|
+
* ],
|
|
2113
|
+
* type: "bar"
|
|
2114
|
+
* }
|
|
2115
|
+
*
|
|
2094
2116
|
* // for 'range' types('area-line-range' or 'area-spline-range'), data should contain:
|
|
2095
2117
|
* // - an array of [high, mid, low] data following the order
|
|
2096
2118
|
* // - or an object with 'high', 'mid' and 'low' key value
|
|
@@ -2166,6 +2188,16 @@ var data$2 = {
|
|
|
2166
2188
|
* ]
|
|
2167
2189
|
* }
|
|
2168
2190
|
*
|
|
2191
|
+
* // for 'bar' type, data can contain:
|
|
2192
|
+
* // - an array of [start, end] data following the order
|
|
2193
|
+
* data: {
|
|
2194
|
+
* columns: [
|
|
2195
|
+
* ["data1", -100, 50, [100, 200], [200, 300]],
|
|
2196
|
+
* ["data2", -200, 300, [-100, 100], [-50, -30]],
|
|
2197
|
+
* ],
|
|
2198
|
+
* type: "bar"
|
|
2199
|
+
* }
|
|
2200
|
+
*
|
|
2169
2201
|
* // for 'range' types('area-line-range' or 'area-spline-range'), data should contain:
|
|
2170
2202
|
* // - an array of [high, mid, low] data following the order
|
|
2171
2203
|
* // - or an object with 'high', 'mid' and 'low' key value
|
|
@@ -2987,7 +3019,7 @@ var dataConvert = {
|
|
|
2987
3019
|
data = {};
|
|
2988
3020
|
["url", "mimeType", "headers", "keys", "json", "keys", "rows", "columns"]
|
|
2989
3021
|
.forEach(function (v) {
|
|
2990
|
-
var key = "data_"
|
|
3022
|
+
var key = "data_".concat(v);
|
|
2991
3023
|
if (key in args) {
|
|
2992
3024
|
data[v] = args[key];
|
|
2993
3025
|
}
|
|
@@ -3036,10 +3068,10 @@ var dataConvert = {
|
|
|
3036
3068
|
if (req.readyState === 4) {
|
|
3037
3069
|
if (req.status === 200) {
|
|
3038
3070
|
var response = req.responseText;
|
|
3039
|
-
response && done.call(_this, _this["convert"
|
|
3071
|
+
response && done.call(_this, _this["convert".concat(capitalize(mimeType), "ToData")](mimeType === "json" ? JSON.parse(response) : response, keys));
|
|
3040
3072
|
}
|
|
3041
3073
|
else {
|
|
3042
|
-
throw new Error(url
|
|
3074
|
+
throw new Error("".concat(url, ": Something went wrong loading!"));
|
|
3043
3075
|
}
|
|
3044
3076
|
}
|
|
3045
3077
|
};
|
|
@@ -3136,7 +3168,7 @@ var dataConvert = {
|
|
|
3136
3168
|
var newRow_1 = {};
|
|
3137
3169
|
row.forEach(function (v, j) {
|
|
3138
3170
|
if (isUndefined(v)) {
|
|
3139
|
-
throw new Error("Source data is missing a component at ("
|
|
3171
|
+
throw new Error("Source data is missing a component at (".concat(i, ", ").concat(j, ")!"));
|
|
3140
3172
|
}
|
|
3141
3173
|
newRow_1[keys[j]] = v;
|
|
3142
3174
|
});
|
|
@@ -3155,7 +3187,7 @@ var dataConvert = {
|
|
|
3155
3187
|
newRows[j - 1] = {};
|
|
3156
3188
|
}
|
|
3157
3189
|
if (isUndefined(v)) {
|
|
3158
|
-
throw new Error("Source data is missing a component at ("
|
|
3190
|
+
throw new Error("Source data is missing a component at (".concat(i, ", ").concat(j, ")!"));
|
|
3159
3191
|
}
|
|
3160
3192
|
newRows[j - 1][key] = v;
|
|
3161
3193
|
}
|
|
@@ -3208,7 +3240,7 @@ var dataConvert = {
|
|
|
3208
3240
|
// check x is defined
|
|
3209
3241
|
ids.forEach(function (id) {
|
|
3210
3242
|
if (!_this.data.xs[id]) {
|
|
3211
|
-
throw new Error("x is not defined for id = \""
|
|
3243
|
+
throw new Error("x is not defined for id = \"".concat(id, "\"."));
|
|
3212
3244
|
}
|
|
3213
3245
|
});
|
|
3214
3246
|
// convert to target
|
|
@@ -3384,7 +3416,7 @@ var data$1 = {
|
|
|
3384
3416
|
var value = $$.filterTargetsToShow($$.data.targets)
|
|
3385
3417
|
.map(function (t) { return $$.addName($$.getValueOnIndex(t.values, index)); });
|
|
3386
3418
|
if (filterNull) {
|
|
3387
|
-
value = value.filter(function (v) { return isValue(v.value); });
|
|
3419
|
+
value = value.filter(function (v) { return v && "value" in v && isValue(v.value); });
|
|
3388
3420
|
}
|
|
3389
3421
|
return value;
|
|
3390
3422
|
},
|
|
@@ -3736,6 +3768,7 @@ var data$1 = {
|
|
|
3736
3768
|
},
|
|
3737
3769
|
/**
|
|
3738
3770
|
* Sort targets data
|
|
3771
|
+
* Note: For stacked bar, will sort from the total sum of data series, not for each stacked bar
|
|
3739
3772
|
* @param {Array} targetsValue Target value
|
|
3740
3773
|
* @returns {Array}
|
|
3741
3774
|
* @private
|
|
@@ -3764,8 +3797,8 @@ var data$1 = {
|
|
|
3764
3797
|
if (orderAsc || orderDesc) {
|
|
3765
3798
|
var reducer_1 = function (p, c) { return p + Math.abs(c.value); };
|
|
3766
3799
|
fn = function (t1, t2) {
|
|
3767
|
-
var t1Sum = t1.values.reduce(reducer_1, 0);
|
|
3768
|
-
var t2Sum = t2.values.reduce(reducer_1, 0);
|
|
3800
|
+
var t1Sum = "values" in t1 ? t1.values.reduce(reducer_1, 0) : t1.value;
|
|
3801
|
+
var t2Sum = "values" in t2 ? t2.values.reduce(reducer_1, 0) : t2.value;
|
|
3769
3802
|
return isArc ?
|
|
3770
3803
|
(orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum) :
|
|
3771
3804
|
(orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum);
|
|
@@ -3860,18 +3893,21 @@ var data$1 = {
|
|
|
3860
3893
|
var data = values.filter(function (v) { return v && isValue(v.value); });
|
|
3861
3894
|
var minDist = config.point_sensitivity;
|
|
3862
3895
|
var closest;
|
|
3863
|
-
// find mouseovering bar
|
|
3896
|
+
// find mouseovering bar/candlestick
|
|
3897
|
+
// https://github.com/naver/billboard.js/issues/2434
|
|
3864
3898
|
data
|
|
3865
|
-
.filter(function (v) { return $$.isBarType(v.id); })
|
|
3899
|
+
.filter(function (v) { return $$.isBarType(v.id) || $$.isCandlestickType(v.id); })
|
|
3866
3900
|
.forEach(function (v) {
|
|
3867
|
-
var
|
|
3868
|
-
|
|
3901
|
+
var selector = $$.isBarType(v.id) ?
|
|
3902
|
+
".".concat(CLASS.chartBar, ".").concat(CLASS.target).concat($$.getTargetSelectorSuffix(v.id), " .").concat(CLASS.bar, "-").concat(v.index) :
|
|
3903
|
+
".".concat(CLASS.chartCandlestick, ".").concat(CLASS.target).concat($$.getTargetSelectorSuffix(v.id), " .").concat(CLASS.candlestick, "-").concat(v.index, " path");
|
|
3904
|
+
if (!closest && $$.isWithinBar(main.select(selector).node())) {
|
|
3869
3905
|
closest = v;
|
|
3870
3906
|
}
|
|
3871
3907
|
});
|
|
3872
|
-
// find closest point from non-bar
|
|
3908
|
+
// find closest point from non-bar/candlestick
|
|
3873
3909
|
data
|
|
3874
|
-
.filter(function (v) { return !$$.isBarType(v.id); })
|
|
3910
|
+
.filter(function (v) { return !$$.isBarType(v.id) && !$$.isCandlestickType(v.id); })
|
|
3875
3911
|
.forEach(function (v) {
|
|
3876
3912
|
var d = $$.dist(v, pos);
|
|
3877
3913
|
if (d < minDist) {
|
|
@@ -3942,7 +3978,7 @@ var data$1 = {
|
|
|
3942
3978
|
updateDataAttributes: function (name, attrs) {
|
|
3943
3979
|
var $$ = this;
|
|
3944
3980
|
var config = $$.config;
|
|
3945
|
-
var current = config["data_"
|
|
3981
|
+
var current = config["data_".concat(name)];
|
|
3946
3982
|
if (isUndefined(attrs)) {
|
|
3947
3983
|
return current;
|
|
3948
3984
|
}
|
|
@@ -4056,6 +4092,17 @@ var data$1 = {
|
|
|
4056
4092
|
return $$.isBubbleType(d) && ((isObject(d.value) && ("z" in d.value || "y" in d.value)) ||
|
|
4057
4093
|
(isArray(d.value) && d.value.length === 2));
|
|
4058
4094
|
},
|
|
4095
|
+
/**
|
|
4096
|
+
* Determine if bar has ranged data
|
|
4097
|
+
* @param {Array} d data value
|
|
4098
|
+
* @returns {boolean}
|
|
4099
|
+
* @private
|
|
4100
|
+
*/
|
|
4101
|
+
isBarRangeType: function (d) {
|
|
4102
|
+
var $$ = this;
|
|
4103
|
+
var value = d.value;
|
|
4104
|
+
return $$.isBarType(d) && isArray(value) && value.length === 2 && value.every(function (v) { return isNumber(v); });
|
|
4105
|
+
},
|
|
4059
4106
|
/**
|
|
4060
4107
|
* Get data object by id
|
|
4061
4108
|
* @param {string} id data id
|
|
@@ -4156,7 +4203,7 @@ var dataLoad = {
|
|
|
4156
4203
|
state.withoutFadeIn[id] = false;
|
|
4157
4204
|
// Remove target's elements
|
|
4158
4205
|
if ($el.legend) {
|
|
4159
|
-
$el.legend.selectAll("."
|
|
4206
|
+
$el.legend.selectAll(".".concat(CLASS.legendItem).concat($$.getTargetSelectorSuffix(id))).remove();
|
|
4160
4207
|
}
|
|
4161
4208
|
// Remove target
|
|
4162
4209
|
$$.data.targets = $$.data.targets.filter(function (t) { return t.id !== id; });
|
|
@@ -4187,7 +4234,7 @@ var interaction = {
|
|
|
4187
4234
|
return;
|
|
4188
4235
|
}
|
|
4189
4236
|
}
|
|
4190
|
-
main.selectAll("."
|
|
4237
|
+
main.selectAll(".".concat(CLASS.shape, "-").concat(index))
|
|
4191
4238
|
.each(function () {
|
|
4192
4239
|
var _a;
|
|
4193
4240
|
select(this).classed(CLASS.EXPANDED, true);
|
|
@@ -4266,11 +4313,11 @@ var interaction = {
|
|
|
4266
4313
|
var callback_1 = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
|
|
4267
4314
|
config.color_onover && $$.setOverColor(isOver, d, isArc);
|
|
4268
4315
|
if (isArc) {
|
|
4269
|
-
callback_1(d, main.select("."
|
|
4316
|
+
callback_1(d, main.select(".".concat(CLASS.arc).concat($$.getTargetSelectorSuffix(d.id))).node());
|
|
4270
4317
|
}
|
|
4271
4318
|
else if (!config.tooltip_grouped) {
|
|
4272
4319
|
var last_1 = $$.cache.get(KEY.setOverOut) || [];
|
|
4273
|
-
var shape = main.selectAll("."
|
|
4320
|
+
var shape = main.selectAll(".".concat(CLASS.shape, "-").concat(d))
|
|
4274
4321
|
.filter(function (d) {
|
|
4275
4322
|
return $$.isWithinShape(this, d);
|
|
4276
4323
|
});
|
|
@@ -4295,7 +4342,7 @@ var interaction = {
|
|
|
4295
4342
|
$$.showCircleFocus($$.getAllValuesOnIndex(d, true)) :
|
|
4296
4343
|
$$.setExpand(d, null, true);
|
|
4297
4344
|
}
|
|
4298
|
-
!$$.isMultipleX() && main.selectAll("."
|
|
4345
|
+
!$$.isMultipleX() && main.selectAll(".".concat(CLASS.shape, "-").concat(d))
|
|
4299
4346
|
.each(function (d) {
|
|
4300
4347
|
callback_1(d, this);
|
|
4301
4348
|
});
|
|
@@ -4350,7 +4397,7 @@ var interaction = {
|
|
|
4350
4397
|
var $$ = this;
|
|
4351
4398
|
var config = $$.config, _a = $$.state, eventReceiver = _a.eventReceiver, hasAxis = _a.hasAxis, hasRadar = _a.hasRadar, _b = $$.$el, eventRect = _b.eventRect, arcs = _b.arcs, radar = _b.radar;
|
|
4352
4399
|
var isMultipleX = $$.isMultipleX();
|
|
4353
|
-
var element = (hasRadar ? radar.axes.select("."
|
|
4400
|
+
var element = (hasRadar ? radar.axes.select(".".concat(CLASS.axis, "-").concat(index, " text")) : (eventRect || arcs.selectAll(".".concat(CLASS.target, " path")).filter(function (d, i) { return i === index; }))).node();
|
|
4354
4401
|
var _c = element.getBoundingClientRect(), width = _c.width, left = _c.left, top = _c.top;
|
|
4355
4402
|
if (hasAxis && !hasRadar && !isMultipleX) {
|
|
4356
4403
|
var coords = eventReceiver.coords[index];
|
|
@@ -4378,10 +4425,39 @@ var interaction = {
|
|
|
4378
4425
|
unbindZoomEvent: function () {
|
|
4379
4426
|
var $$ = this;
|
|
4380
4427
|
var _a = $$.$el, eventRect = _a.eventRect, zoomResetBtn = _a.zoomResetBtn;
|
|
4381
|
-
eventRect
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4428
|
+
eventRect === null || eventRect === void 0 ? void 0 : eventRect.on(".zoom wheel.zoom .drag", null);
|
|
4429
|
+
zoomResetBtn === null || zoomResetBtn === void 0 ? void 0 : zoomResetBtn.on("click", null).style("display", "none");
|
|
4430
|
+
},
|
|
4431
|
+
/**
|
|
4432
|
+
* Unbind all attached events
|
|
4433
|
+
* @private
|
|
4434
|
+
*/
|
|
4435
|
+
unbindAllEvents: function () {
|
|
4436
|
+
var _a;
|
|
4437
|
+
var $$ = this;
|
|
4438
|
+
var _b = $$.$el, arcs = _b.arcs, eventRect = _b.eventRect, legend = _b.legend, region = _b.region, svg = _b.svg, brush = $$.brush;
|
|
4439
|
+
var list = [
|
|
4440
|
+
"wheel",
|
|
4441
|
+
"click",
|
|
4442
|
+
"mouseover",
|
|
4443
|
+
"mousemove",
|
|
4444
|
+
"mouseout",
|
|
4445
|
+
"touchstart",
|
|
4446
|
+
"touchmove",
|
|
4447
|
+
"touchend",
|
|
4448
|
+
"touchstart.eventRect",
|
|
4449
|
+
"touchmove.eventRect",
|
|
4450
|
+
"touchend.eventRect",
|
|
4451
|
+
".brush",
|
|
4452
|
+
".drag",
|
|
4453
|
+
".zoom",
|
|
4454
|
+
"wheel.zoom",
|
|
4455
|
+
"dblclick.zoom"
|
|
4456
|
+
].join(" ");
|
|
4457
|
+
// detach all possible event types
|
|
4458
|
+
[svg, eventRect, region === null || region === void 0 ? void 0 : region.list, brush === null || brush === void 0 ? void 0 : brush.getSelection(), arcs === null || arcs === void 0 ? void 0 : arcs.selectAll("path"), legend === null || legend === void 0 ? void 0 : legend.selectAll("g")]
|
|
4459
|
+
.forEach(function (v) { return v === null || v === void 0 ? void 0 : v.on(list, null); });
|
|
4460
|
+
(_a = $$.unbindZoomEvent) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
4385
4461
|
}
|
|
4386
4462
|
};
|
|
4387
4463
|
|
|
@@ -4391,7 +4467,7 @@ var interaction = {
|
|
|
4391
4467
|
*/
|
|
4392
4468
|
var classModule = {
|
|
4393
4469
|
generateClass: function (prefix, targetId) {
|
|
4394
|
-
return " "
|
|
4470
|
+
return " ".concat(prefix, " ").concat(prefix + this.getTargetSelectorSuffix(targetId));
|
|
4395
4471
|
},
|
|
4396
4472
|
/**
|
|
4397
4473
|
* Get class string
|
|
@@ -4419,7 +4495,7 @@ var classModule = {
|
|
|
4419
4495
|
*/
|
|
4420
4496
|
getChartClass: function (type) {
|
|
4421
4497
|
var _this = this;
|
|
4422
|
-
return function (d) { return CLASS["chart"
|
|
4498
|
+
return function (d) { return CLASS["chart".concat(type)] + _this.classTarget((d.data ? d.data : d).id); };
|
|
4423
4499
|
},
|
|
4424
4500
|
generateExtraLineClass: function () {
|
|
4425
4501
|
var $$ = this;
|
|
@@ -4435,13 +4511,13 @@ var classModule = {
|
|
|
4435
4511
|
};
|
|
4436
4512
|
},
|
|
4437
4513
|
classRegion: function (d, i) {
|
|
4438
|
-
return this.generateClass(CLASS.region, i)
|
|
4514
|
+
return "".concat(this.generateClass(CLASS.region, i), " ").concat("class" in d ? d["class"] : "");
|
|
4439
4515
|
},
|
|
4440
4516
|
classTarget: function (id) {
|
|
4441
4517
|
var additionalClassSuffix = this.config.data_classes[id];
|
|
4442
4518
|
var additionalClass = "";
|
|
4443
4519
|
if (additionalClassSuffix) {
|
|
4444
|
-
additionalClass = " "
|
|
4520
|
+
additionalClass = " ".concat(CLASS.target, "-").concat(additionalClassSuffix);
|
|
4445
4521
|
}
|
|
4446
4522
|
return this.generateClass(CLASS.target, id) + additionalClass;
|
|
4447
4523
|
},
|
|
@@ -4449,20 +4525,20 @@ var classModule = {
|
|
|
4449
4525
|
return this.classFocused(d) + this.classDefocused(d);
|
|
4450
4526
|
},
|
|
4451
4527
|
classFocused: function (d) {
|
|
4452
|
-
return " "
|
|
4528
|
+
return " ".concat(this.state.focusedTargetIds.indexOf(d.id) >= 0 ? CLASS.focused : "");
|
|
4453
4529
|
},
|
|
4454
4530
|
classDefocused: function (d) {
|
|
4455
|
-
return " "
|
|
4531
|
+
return " ".concat(this.state.defocusedTargetIds.indexOf(d.id) >= 0 ? CLASS.defocused : "");
|
|
4456
4532
|
},
|
|
4457
4533
|
getTargetSelectorSuffix: function (targetId) {
|
|
4458
|
-
var targetStr = targetId || targetId === 0 ? "-"
|
|
4534
|
+
var targetStr = targetId || targetId === 0 ? "-".concat(targetId) : "";
|
|
4459
4535
|
return targetStr.replace(/([\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\])/g, "-");
|
|
4460
4536
|
},
|
|
4461
4537
|
selectorTarget: function (id, prefix) {
|
|
4462
4538
|
var pfx = prefix || "";
|
|
4463
4539
|
var target = this.getTargetSelectorSuffix(id);
|
|
4464
4540
|
// select target & circle
|
|
4465
|
-
return pfx
|
|
4541
|
+
return "".concat(pfx, ".").concat(CLASS.target + target, ", ").concat(pfx, ".").concat(CLASS.circles + target);
|
|
4466
4542
|
},
|
|
4467
4543
|
selectorTargets: function (idsValue, prefix) {
|
|
4468
4544
|
var _this = this;
|
|
@@ -4471,7 +4547,7 @@ var classModule = {
|
|
|
4471
4547
|
ids.map(function (id) { return _this.selectorTarget(id, prefix); }) : null;
|
|
4472
4548
|
},
|
|
4473
4549
|
selectorLegend: function (id) {
|
|
4474
|
-
return "."
|
|
4550
|
+
return ".".concat(CLASS.legendItem + this.getTargetSelectorSuffix(id));
|
|
4475
4551
|
},
|
|
4476
4552
|
selectorLegends: function (ids) {
|
|
4477
4553
|
var _this = this;
|
|
@@ -4570,10 +4646,10 @@ var color = {
|
|
|
4570
4646
|
// Add background color to patterns
|
|
4571
4647
|
var colorizedPatterns = pattern.map(function (p, index) {
|
|
4572
4648
|
var color = p.replace(/[#\(\)\s,]/g, "");
|
|
4573
|
-
var id = $$.state.datetimeId
|
|
4649
|
+
var id = "".concat($$.state.datetimeId, "-pattern-").concat(color, "-").concat(index);
|
|
4574
4650
|
return colorizePattern(tiles_1[index % tiles_1.length], p, id);
|
|
4575
4651
|
});
|
|
4576
|
-
pattern = colorizedPatterns.map(function (p) { return "url(#"
|
|
4652
|
+
pattern = colorizedPatterns.map(function (p) { return "url(#".concat(p.id, ")"); });
|
|
4577
4653
|
$$.patterns = colorizedPatterns;
|
|
4578
4654
|
}
|
|
4579
4655
|
return function (d) {
|
|
@@ -4640,14 +4716,14 @@ var color = {
|
|
|
4640
4716
|
ids = Object.keys(backgroundColors);
|
|
4641
4717
|
}
|
|
4642
4718
|
ids.forEach(function (v) {
|
|
4643
|
-
var id = state.datetimeId
|
|
4719
|
+
var id = "".concat(state.datetimeId, "-labels-bg").concat($$.getTargetSelectorSuffix(v));
|
|
4644
4720
|
$el.defs.append("filter")
|
|
4645
4721
|
.attr("x", "0")
|
|
4646
4722
|
.attr("y", "0")
|
|
4647
4723
|
.attr("width", "1")
|
|
4648
4724
|
.attr("height", "1")
|
|
4649
4725
|
.attr("id", id)
|
|
4650
|
-
.html("<feFlood flood-color=\""
|
|
4726
|
+
.html("<feFlood flood-color=\"".concat(v === "" ? backgroundColors : backgroundColors[v], "\" /><feComposite in=\"SourceGraphic\"/>"));
|
|
4651
4727
|
});
|
|
4652
4728
|
}
|
|
4653
4729
|
},
|
|
@@ -4677,8 +4753,8 @@ var color = {
|
|
|
4677
4753
|
}
|
|
4678
4754
|
main.selectAll(isObject(d) ?
|
|
4679
4755
|
// when is Arc type
|
|
4680
|
-
"."
|
|
4681
|
-
"."
|
|
4756
|
+
".".concat(CLASS.arc).concat($$.getTargetSelectorSuffix(d.id)) :
|
|
4757
|
+
".".concat(CLASS.shape, "-").concat(d)).style("fill", color);
|
|
4682
4758
|
}
|
|
4683
4759
|
};
|
|
4684
4760
|
|
|
@@ -4691,7 +4767,7 @@ var domain = {
|
|
|
4691
4767
|
var ids = $$.mapToIds(targets);
|
|
4692
4768
|
var ys = $$.getValuesAsIdKeyed(targets);
|
|
4693
4769
|
if (dataGroups.length > 0) {
|
|
4694
|
-
var hasValue_1 = $$["has"
|
|
4770
|
+
var hasValue_1 = $$["has".concat(isMin ? "Negative" : "Positive", "ValueInTargets")](targets);
|
|
4695
4771
|
dataGroups.forEach(function (groupIds) {
|
|
4696
4772
|
// Determine baseId
|
|
4697
4773
|
var idsInGroup = groupIds
|
|
@@ -4737,7 +4813,7 @@ var domain = {
|
|
|
4737
4813
|
getYDomain: function (targets, axisId, xDomain) {
|
|
4738
4814
|
var $$ = this;
|
|
4739
4815
|
var axis = $$.axis, config = $$.config, scale = $$.scale;
|
|
4740
|
-
var pfx = "axis_"
|
|
4816
|
+
var pfx = "axis_".concat(axisId);
|
|
4741
4817
|
if ($$.isStackNormalized()) {
|
|
4742
4818
|
return [0, 100];
|
|
4743
4819
|
}
|
|
@@ -4756,17 +4832,17 @@ var domain = {
|
|
|
4756
4832
|
$$.getYDomain(targets, "y2", xDomain);
|
|
4757
4833
|
}
|
|
4758
4834
|
}
|
|
4759
|
-
var yMin = config[pfx
|
|
4760
|
-
var yMax = config[pfx
|
|
4761
|
-
var center = config[pfx
|
|
4762
|
-
var isInverted = config[pfx
|
|
4835
|
+
var yMin = config["".concat(pfx, "_min")];
|
|
4836
|
+
var yMax = config["".concat(pfx, "_max")];
|
|
4837
|
+
var center = config["".concat(pfx, "_center")];
|
|
4838
|
+
var isInverted = config["".concat(pfx, "_inverted")];
|
|
4763
4839
|
var showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated;
|
|
4764
4840
|
var showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated;
|
|
4765
4841
|
var yDomainMin = $$.getYDomainMinMax(yTargets, "min");
|
|
4766
4842
|
var yDomainMax = $$.getYDomainMinMax(yTargets, "max");
|
|
4767
4843
|
var isZeroBased = __spreadArray([TYPE.BAR, TYPE.BUBBLE, TYPE.SCATTER], TYPE_BY_CATEGORY.Line, true).some(function (v) {
|
|
4768
4844
|
var type = v.indexOf("area") > -1 ? "area" : v;
|
|
4769
|
-
return $$.hasType(v, yTargets) && config[type
|
|
4845
|
+
return $$.hasType(v, yTargets) && config["".concat(type, "_zerobased")];
|
|
4770
4846
|
});
|
|
4771
4847
|
// MEMO: avoid inverting domain unexpectedly
|
|
4772
4848
|
yDomainMin = isValue(yMin) ? yMin :
|
|
@@ -4815,9 +4891,10 @@ var domain = {
|
|
|
4815
4891
|
padding[v] += $$.convertPixelToScale("y", lengths_1[i], domainLength);
|
|
4816
4892
|
});
|
|
4817
4893
|
}
|
|
4894
|
+
padding = $$.getResettedPadding(padding);
|
|
4818
4895
|
// if padding is set, the domain will be updated relative the current domain value
|
|
4819
4896
|
// ex) $$.height=300, padding.top=150, domainLength=4 --> domain=6
|
|
4820
|
-
var p = config[pfx
|
|
4897
|
+
var p = config["".concat(pfx, "_padding")];
|
|
4821
4898
|
if (notEmpty(p)) {
|
|
4822
4899
|
["bottom", "top"].forEach(function (v) {
|
|
4823
4900
|
padding[v] = axis.getPadding(p, v, padding[v], domainLength);
|
|
@@ -4835,7 +4912,7 @@ var domain = {
|
|
|
4835
4912
|
getXDomainMinMax: function (targets, type) {
|
|
4836
4913
|
var _a;
|
|
4837
4914
|
var $$ = this;
|
|
4838
|
-
var configValue = $$.config["axis_x_"
|
|
4915
|
+
var configValue = $$.config["axis_x_".concat(type)];
|
|
4839
4916
|
var dataValue = getMinMax$1(type, targets.map(function (t) { return getMinMax$1(type, t.values.map(function (v) { return v.x; })); }));
|
|
4840
4917
|
var value = isObject(configValue) ? configValue.value : configValue;
|
|
4841
4918
|
value = isDefined(value) && ((_a = $$.axis) === null || _a === void 0 ? void 0 : _a.isTimeSeries()) ? parseDate.bind(this)(value) : value;
|
|
@@ -4867,7 +4944,7 @@ var domain = {
|
|
|
4867
4944
|
defaultValue = maxDataCount > 1 ? (diff / (maxDataCount - 1)) / 2 : 0.5;
|
|
4868
4945
|
}
|
|
4869
4946
|
else {
|
|
4870
|
-
defaultValue = diff * 0.01;
|
|
4947
|
+
defaultValue = $$.getResettedPadding(diff * 0.01);
|
|
4871
4948
|
}
|
|
4872
4949
|
var _a = isNumber(padding) ?
|
|
4873
4950
|
{ left: padding, right: padding } : padding, _b = _a.left, left = _b === void 0 ? defaultValue : _b, _c = _a.right, right = _c === void 0 ? defaultValue : _c;
|
|
@@ -5015,7 +5092,7 @@ var domain = {
|
|
|
5015
5092
|
*/
|
|
5016
5093
|
function getFormat($$, typeValue, v) {
|
|
5017
5094
|
var config = $$.config;
|
|
5018
|
-
var type = "axis_"
|
|
5095
|
+
var type = "axis_".concat(typeValue, "_tick_format");
|
|
5019
5096
|
var format = config[type] ?
|
|
5020
5097
|
config[type] : $$.defaultValueFormat;
|
|
5021
5098
|
return format(v);
|
|
@@ -5043,7 +5120,7 @@ var format = {
|
|
|
5043
5120
|
return isValue(v) ? +v : "";
|
|
5044
5121
|
},
|
|
5045
5122
|
defaultArcValueFormat: function (v, ratio) {
|
|
5046
|
-
return (ratio * 100).toFixed(1)
|
|
5123
|
+
return "".concat((ratio * 100).toFixed(1), "%");
|
|
5047
5124
|
},
|
|
5048
5125
|
dataLabelFormat: function (targetId) {
|
|
5049
5126
|
var $$ = this;
|
|
@@ -5119,7 +5196,7 @@ var legend$1 = {
|
|
|
5119
5196
|
$$.updateLegendElement(targetIds || $$.mapToIds($$.data.targets), optionz, transitions);
|
|
5120
5197
|
}
|
|
5121
5198
|
// toggle legend state
|
|
5122
|
-
$el.legend.selectAll("."
|
|
5199
|
+
$el.legend.selectAll(".".concat(CLASS.legendItem))
|
|
5123
5200
|
.classed(CLASS.legendItemHidden, function (id) {
|
|
5124
5201
|
var hide = !$$.isTargetToShow(id);
|
|
5125
5202
|
if (hide) {
|
|
@@ -5236,7 +5313,7 @@ var legend$1 = {
|
|
|
5236
5313
|
updateLegendItemColor: function (id, color) {
|
|
5237
5314
|
var legend = this.$el.legend;
|
|
5238
5315
|
if (legend) {
|
|
5239
|
-
legend.select("."
|
|
5316
|
+
legend.select(".".concat(CLASS.legendItem, "-").concat(id, " line"))
|
|
5240
5317
|
.style("stroke", color);
|
|
5241
5318
|
}
|
|
5242
5319
|
},
|
|
@@ -5281,7 +5358,7 @@ var legend$1 = {
|
|
|
5281
5358
|
var $$ = this;
|
|
5282
5359
|
var legend = $$.$el.legend, $T = $$.$T;
|
|
5283
5360
|
var targetIdz = $$.mapToTargetIds(targetIds);
|
|
5284
|
-
legend && $T(legend.selectAll("."
|
|
5361
|
+
legend && $T(legend.selectAll(".".concat(CLASS.legendItem))
|
|
5285
5362
|
.filter(function (id) { return targetIdz.indexOf(id) >= 0; })
|
|
5286
5363
|
.classed(CLASS.legendItemFocused, focus))
|
|
5287
5364
|
.style("opacity", function () {
|
|
@@ -5296,7 +5373,7 @@ var legend$1 = {
|
|
|
5296
5373
|
revertLegend: function () {
|
|
5297
5374
|
var $$ = this;
|
|
5298
5375
|
var legend = $$.$el.legend, $T = $$.$T;
|
|
5299
|
-
legend && $T(legend.selectAll("."
|
|
5376
|
+
legend && $T(legend.selectAll(".".concat(CLASS.legendItem))
|
|
5300
5377
|
.classed(CLASS.legendItemFocused, false))
|
|
5301
5378
|
.style("opacity", null);
|
|
5302
5379
|
},
|
|
@@ -5398,7 +5475,7 @@ var legend$1 = {
|
|
|
5398
5475
|
if (!callFn(config.legend_item_onout, api, id)) {
|
|
5399
5476
|
select(this).classed(CLASS.legendItemFocused, false);
|
|
5400
5477
|
if (hasGauge) {
|
|
5401
|
-
$$.undoMarkOverlapped($$, "."
|
|
5478
|
+
$$.undoMarkOverlapped($$, ".".concat(CLASS.gaugeValue));
|
|
5402
5479
|
}
|
|
5403
5480
|
$$.api.revert();
|
|
5404
5481
|
}
|
|
@@ -5407,7 +5484,7 @@ var legend$1 = {
|
|
|
5407
5484
|
if (!callFn(config.legend_item_onover, api, id)) {
|
|
5408
5485
|
select(this).classed(CLASS.legendItemFocused, true);
|
|
5409
5486
|
if (hasGauge) {
|
|
5410
|
-
$$.markOverlapped(id, $$, "."
|
|
5487
|
+
$$.markOverlapped(id, $$, ".".concat(CLASS.gaugeValue));
|
|
5411
5488
|
}
|
|
5412
5489
|
if (!state.transiting && $$.isTargetToShow(id)) {
|
|
5413
5490
|
api.focus(id);
|
|
@@ -5535,7 +5612,7 @@ var legend$1 = {
|
|
|
5535
5612
|
var yForLegendTile = function (id, i) { return yForLegend(id, i) + 4; };
|
|
5536
5613
|
var pos = -200;
|
|
5537
5614
|
// Define g for legend area
|
|
5538
|
-
var l = legend.selectAll("."
|
|
5615
|
+
var l = legend.selectAll(".".concat(CLASS.legendItem))
|
|
5539
5616
|
.data(targetIdz)
|
|
5540
5617
|
.enter()
|
|
5541
5618
|
.append("g");
|
|
@@ -5578,7 +5655,8 @@ var legend$1 = {
|
|
|
5578
5655
|
.attr("href", function (data, idx, selection) {
|
|
5579
5656
|
var node = selection[idx];
|
|
5580
5657
|
var nodeName = node.nodeName.toLowerCase();
|
|
5581
|
-
|
|
5658
|
+
var id = $$.getTargetSelectorSuffix(data);
|
|
5659
|
+
return nodeName === "use" ? "#".concat(state.datetimeId, "-point").concat(id) : undefined;
|
|
5582
5660
|
});
|
|
5583
5661
|
}
|
|
5584
5662
|
else {
|
|
@@ -5593,9 +5671,9 @@ var legend$1 = {
|
|
|
5593
5671
|
.attr("stroke-width", config.legend_item_tile_height);
|
|
5594
5672
|
}
|
|
5595
5673
|
// Set background for inset legend
|
|
5596
|
-
background = legend.select("."
|
|
5674
|
+
background = legend.select(".".concat(CLASS.legendBackground, " rect"));
|
|
5597
5675
|
if (state.isLegendInset && maxWidth > 0 && background.size() === 0) {
|
|
5598
|
-
background = legend.insert("g", "."
|
|
5676
|
+
background = legend.insert("g", ".".concat(CLASS.legendItem))
|
|
5599
5677
|
.attr("class", CLASS.legendBackground)
|
|
5600
5678
|
.append("rect");
|
|
5601
5679
|
}
|
|
@@ -5608,7 +5686,7 @@ var legend$1 = {
|
|
|
5608
5686
|
$T(texts, withTransition)
|
|
5609
5687
|
.attr("x", xForLegendText)
|
|
5610
5688
|
.attr("y", yForLegendText);
|
|
5611
|
-
var rects = legend.selectAll("rect."
|
|
5689
|
+
var rects = legend.selectAll("rect.".concat(CLASS.legendItemEvent))
|
|
5612
5690
|
.data(targetIdz);
|
|
5613
5691
|
$T(rects, withTransition)
|
|
5614
5692
|
.attr("width", function (id) { return widths[id]; })
|
|
@@ -5616,7 +5694,7 @@ var legend$1 = {
|
|
|
5616
5694
|
.attr("x", xForLegendRect)
|
|
5617
5695
|
.attr("y", yForLegendRect);
|
|
5618
5696
|
if (usePoint) {
|
|
5619
|
-
var tiles = legend.selectAll("."
|
|
5697
|
+
var tiles = legend.selectAll(".".concat(CLASS.legendItemPoint))
|
|
5620
5698
|
.data(targetIdz);
|
|
5621
5699
|
$T(tiles, withTransition)
|
|
5622
5700
|
.each(function () {
|
|
@@ -5652,7 +5730,7 @@ var legend$1 = {
|
|
|
5652
5730
|
});
|
|
5653
5731
|
}
|
|
5654
5732
|
else {
|
|
5655
|
-
var tiles = legend.selectAll("line."
|
|
5733
|
+
var tiles = legend.selectAll("line.".concat(CLASS.legendItemTile))
|
|
5656
5734
|
.data(targetIdz);
|
|
5657
5735
|
$T(tiles, withTransition)
|
|
5658
5736
|
.style("stroke", getColor)
|
|
@@ -5686,8 +5764,7 @@ var redraw = {
|
|
|
5686
5764
|
var main = $el.main;
|
|
5687
5765
|
state.redrawing = true;
|
|
5688
5766
|
var targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
|
5689
|
-
var initializing = options.initializing;
|
|
5690
|
-
var flow = options.flow;
|
|
5767
|
+
var flow = options.flow, initializing = options.initializing;
|
|
5691
5768
|
var wth = $$.getWithOption(options);
|
|
5692
5769
|
var duration = wth.Transition ? config.transition_duration : 0;
|
|
5693
5770
|
var durationForExit = wth.TransitionForExit ? duration : 0;
|
|
@@ -5713,7 +5790,7 @@ var redraw = {
|
|
|
5713
5790
|
// @TODO: Make 'init' state to be accessible everywhere not passing as argument.
|
|
5714
5791
|
$$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing);
|
|
5715
5792
|
// Data empty label positioning and text.
|
|
5716
|
-
config.data_empty_label_text && main.select("text."
|
|
5793
|
+
config.data_empty_label_text && main.select("text.".concat(CLASS.text, ".").concat(CLASS.empty))
|
|
5717
5794
|
.attr("x", state.width / 2)
|
|
5718
5795
|
.attr("y", state.height / 2)
|
|
5719
5796
|
.text(config.data_empty_label_text)
|
|
@@ -5725,11 +5802,11 @@ var redraw = {
|
|
|
5725
5802
|
["bar", "candlestick", "line", "area"].forEach(function (v) {
|
|
5726
5803
|
var name = capitalize(v);
|
|
5727
5804
|
if ((/^(line|area)$/.test(v) && $$.hasTypeOf(name)) || $$.hasType(v)) {
|
|
5728
|
-
$$["update"
|
|
5805
|
+
$$["update".concat(name)](wth.TransitionForExit);
|
|
5729
5806
|
}
|
|
5730
5807
|
});
|
|
5731
5808
|
// circles for select
|
|
5732
|
-
$el.text && main.selectAll("."
|
|
5809
|
+
$el.text && main.selectAll(".".concat(CLASS.selectedCircles))
|
|
5733
5810
|
.filter($$.isBarType.bind($$))
|
|
5734
5811
|
.selectAll("circle")
|
|
5735
5812
|
.remove();
|
|
@@ -5829,7 +5906,7 @@ var redraw = {
|
|
|
5829
5906
|
var name = capitalize(v);
|
|
5830
5907
|
var drawFn = shape.type[v];
|
|
5831
5908
|
if ((/^(area|line)$/.test(v) && $$.hasTypeOf(name)) || $$.hasType(v)) {
|
|
5832
|
-
list.push($$["redraw"
|
|
5909
|
+
list.push($$["redraw".concat(name)](drawFn, withTransition));
|
|
5833
5910
|
}
|
|
5834
5911
|
});
|
|
5835
5912
|
!flow && grid.main && list.push($$.updateGridFocus());
|
|
@@ -5874,6 +5951,7 @@ var redraw = {
|
|
|
5874
5951
|
redrawWithoutRescale: function () {
|
|
5875
5952
|
this.redraw({
|
|
5876
5953
|
withY: false,
|
|
5954
|
+
withLegend: true,
|
|
5877
5955
|
withSubchart: false,
|
|
5878
5956
|
withEventRect: false,
|
|
5879
5957
|
withTransitionForAxis: false
|
|
@@ -5998,16 +6076,17 @@ var scale = {
|
|
|
5998
6076
|
var axis = $$.axis, config = $$.config, format = $$.format, org = $$.org, scale = $$.scale, _c = $$.state, width = _c.width, height = _c.height, width2 = _c.width2, height2 = _c.height2, hasAxis = _c.hasAxis;
|
|
5999
6077
|
if (hasAxis) {
|
|
6000
6078
|
var isRotated = config.axis_rotated;
|
|
6079
|
+
var resettedPadding = $$.getResettedPadding(1);
|
|
6001
6080
|
// update edges
|
|
6002
6081
|
var min = {
|
|
6003
|
-
x: isRotated ?
|
|
6082
|
+
x: isRotated ? resettedPadding : 0,
|
|
6004
6083
|
y: isRotated ? 0 : height,
|
|
6005
6084
|
subX: isRotated ? 1 : 0,
|
|
6006
6085
|
subY: isRotated ? 0 : height2
|
|
6007
6086
|
};
|
|
6008
6087
|
var max = {
|
|
6009
6088
|
x: isRotated ? height : width,
|
|
6010
|
-
y: isRotated ? width :
|
|
6089
|
+
y: isRotated ? width : resettedPadding,
|
|
6011
6090
|
subX: isRotated ? height : width,
|
|
6012
6091
|
subY: isRotated ? width2 : 1
|
|
6013
6092
|
};
|
|
@@ -6093,8 +6172,8 @@ var shape = {
|
|
|
6093
6172
|
["bar", "candlestick", "line", "area"].forEach(function (v) {
|
|
6094
6173
|
var name = capitalize(/^(bubble|scatter)$/.test(v) ? "line" : v);
|
|
6095
6174
|
if ($$.hasType(v) || $$.hasTypeOf(name) || (v === "line" && ($$.hasType("bubble") || $$.hasType("scatter")))) {
|
|
6096
|
-
var indices = $$.getShapeIndices($$["is"
|
|
6097
|
-
var drawFn = $$["generateDraw"
|
|
6175
|
+
var indices = $$.getShapeIndices($$["is".concat(name, "Type")]);
|
|
6176
|
+
var drawFn = $$["generateDraw".concat(name)];
|
|
6098
6177
|
shape.indices[v] = indices;
|
|
6099
6178
|
shape.type[v] = drawFn ? drawFn.bind($$)(indices, false) : undefined;
|
|
6100
6179
|
}
|
|
@@ -6112,6 +6191,19 @@ var shape = {
|
|
|
6112
6191
|
}
|
|
6113
6192
|
return shape;
|
|
6114
6193
|
},
|
|
6194
|
+
/**
|
|
6195
|
+
* Get shape's indices according it's position
|
|
6196
|
+
*
|
|
6197
|
+
* From the below example, indices will be:
|
|
6198
|
+
* ==> {data1: 0, data2: 0, data3: 1, data4: 1, __max__: 1}
|
|
6199
|
+
*
|
|
6200
|
+
* data1 data3 data1 data3
|
|
6201
|
+
* data2 data4 data2 data4
|
|
6202
|
+
* -------------------------
|
|
6203
|
+
* 0 1
|
|
6204
|
+
* @param {Function} typeFilter Chart type filter function
|
|
6205
|
+
* @returns {object} Indices object with its position
|
|
6206
|
+
*/
|
|
6115
6207
|
getShapeIndices: function (typeFilter) {
|
|
6116
6208
|
var $$ = this;
|
|
6117
6209
|
var config = $$.config;
|
|
@@ -6151,12 +6243,25 @@ var shape = {
|
|
|
6151
6243
|
/**
|
|
6152
6244
|
* Get indices value based on data ID value
|
|
6153
6245
|
* @param {object} indices Indices object
|
|
6154
|
-
* @param {
|
|
6246
|
+
* @param {object} d Data row
|
|
6247
|
+
* @param {string} caller Caller function name (Used only for 'sparkline' plugin)
|
|
6155
6248
|
* @returns {object} Indices object
|
|
6156
6249
|
* @private
|
|
6157
6250
|
*/
|
|
6158
|
-
getIndices: function (indices,
|
|
6159
|
-
var
|
|
6251
|
+
getIndices: function (indices, d, caller) {
|
|
6252
|
+
var $$ = this;
|
|
6253
|
+
var _a = $$.config, xs = _a.data_xs, removeNull = _a.bar_indices_removeNull;
|
|
6254
|
+
var id = d.id, index = d.index;
|
|
6255
|
+
if ($$.isBarType(id) && removeNull) {
|
|
6256
|
+
var ind_1 = {};
|
|
6257
|
+
// redefine bar indices order
|
|
6258
|
+
$$.getAllValuesOnIndex(index, true)
|
|
6259
|
+
.forEach(function (v, i) {
|
|
6260
|
+
ind_1[v.id] = i;
|
|
6261
|
+
ind_1.__max__ = i;
|
|
6262
|
+
});
|
|
6263
|
+
return ind_1;
|
|
6264
|
+
}
|
|
6160
6265
|
return notEmpty(xs) ?
|
|
6161
6266
|
indices[xs[id]] : indices;
|
|
6162
6267
|
},
|
|
@@ -6181,7 +6286,7 @@ var shape = {
|
|
|
6181
6286
|
var sum = function (p, c) { return p + c; };
|
|
6182
6287
|
var halfWidth = isObjectType(offset) && (offset._$total.length ? offset._$total.reduce(sum) / 2 : 0);
|
|
6183
6288
|
return function (d) {
|
|
6184
|
-
var ind = $$.getIndices(indices, d
|
|
6289
|
+
var ind = $$.getIndices(indices, d, "getShapeX");
|
|
6185
6290
|
var index = d.id in ind ? ind[d.id] : 0;
|
|
6186
6291
|
var targetsNum = (ind.__max__ || 0) + 1;
|
|
6187
6292
|
var x = 0;
|
|
@@ -6225,6 +6330,10 @@ var shape = {
|
|
|
6225
6330
|
else if ($$.isBubbleZType(d)) {
|
|
6226
6331
|
value = $$.getBubbleZData(d.value, "y");
|
|
6227
6332
|
}
|
|
6333
|
+
else if ($$.isBarRangeType(d)) {
|
|
6334
|
+
// TODO use range.getEnd() like method
|
|
6335
|
+
value = value[1];
|
|
6336
|
+
}
|
|
6228
6337
|
return $$.getYScaleById(d.id, isSub)(value);
|
|
6229
6338
|
};
|
|
6230
6339
|
},
|
|
@@ -6281,8 +6390,12 @@ var shape = {
|
|
|
6281
6390
|
var _a = $$.getShapeOffsetData(typeFilter), shapeOffsetTargets = _a.shapeOffsetTargets, indexMapByTargetId = _a.indexMapByTargetId;
|
|
6282
6391
|
return function (d, idx) {
|
|
6283
6392
|
var id = d.id, value = d.value, x = d.x;
|
|
6284
|
-
var ind = $$.getIndices(indices,
|
|
6393
|
+
var ind = $$.getIndices(indices, d);
|
|
6285
6394
|
var scale = $$.getYScaleById(id, isSub);
|
|
6395
|
+
if ($$.isBarRangeType(d)) {
|
|
6396
|
+
// TODO use range.getStart()
|
|
6397
|
+
return scale(value[0]);
|
|
6398
|
+
}
|
|
6286
6399
|
var y0 = scale($$.getShapeYMin(id));
|
|
6287
6400
|
var dataXAsNumber = Number(x);
|
|
6288
6401
|
var offset = y0;
|
|
@@ -6290,6 +6403,7 @@ var shape = {
|
|
|
6290
6403
|
.filter(function (t) { return t.id !== id; })
|
|
6291
6404
|
.forEach(function (t) {
|
|
6292
6405
|
var tid = t.id, rowValueMapByXValue = t.rowValueMapByXValue, rowValues = t.rowValues, tvalues = t.values;
|
|
6406
|
+
// for same stacked group (ind[tid] === ind[id])
|
|
6293
6407
|
if (ind[tid] === ind[id] && indexMapByTargetId[tid] < indexMapByTargetId[id]) {
|
|
6294
6408
|
var row = rowValues[idx];
|
|
6295
6409
|
// check if the x values line up
|
|
@@ -6309,14 +6423,14 @@ var shape = {
|
|
|
6309
6423
|
var config = $$.config, org = $$.org, scale = $$.scale;
|
|
6310
6424
|
var maxDataCount = $$.getMaxDataCount();
|
|
6311
6425
|
var isGrouped = type === "bar" && config.data_groups.length;
|
|
6312
|
-
var configName = type
|
|
6426
|
+
var configName = "".concat(type, "_width");
|
|
6313
6427
|
var tickInterval = scale.zoom && !$$.axis.isCategorized() ?
|
|
6314
6428
|
(org.xDomain.map(function (v) { return scale.zoom(v); })
|
|
6315
6429
|
.reduce(function (a, c) { return Math.abs(a) + c; }) / maxDataCount) : axis.tickInterval(maxDataCount);
|
|
6316
6430
|
var getWidth = function (id) {
|
|
6317
6431
|
var width = id ? config[configName][id] : config[configName];
|
|
6318
|
-
var ratio = id ? width.ratio : config[configName
|
|
6319
|
-
var max = id ? width.max : config[configName
|
|
6432
|
+
var ratio = id ? width.ratio : config["".concat(configName, "_ratio")];
|
|
6433
|
+
var max = id ? width.max : config["".concat(configName, "_max")];
|
|
6320
6434
|
var w = isNumber(width) ?
|
|
6321
6435
|
width : targetsNum ? (tickInterval * ratio) / targetsNum : 0;
|
|
6322
6436
|
return max && w > max ? max : w;
|
|
@@ -6344,7 +6458,7 @@ var shape = {
|
|
|
6344
6458
|
getShapeByIndex: function (shapeName, i, id) {
|
|
6345
6459
|
var $$ = this;
|
|
6346
6460
|
var $el = $$.$el;
|
|
6347
|
-
var suffix = (isValue(i) ? "-"
|
|
6461
|
+
var suffix = (isValue(i) ? "-".concat(i) : "");
|
|
6348
6462
|
var shape = $el[shapeName];
|
|
6349
6463
|
// filter from shape reference if has
|
|
6350
6464
|
if (shape && !shape.empty()) {
|
|
@@ -6354,8 +6468,8 @@ var shape = {
|
|
|
6354
6468
|
}
|
|
6355
6469
|
else {
|
|
6356
6470
|
shape = (id ? $el.main
|
|
6357
|
-
.selectAll("."
|
|
6358
|
-
.selectAll("."
|
|
6471
|
+
.selectAll(".".concat(CLASS["".concat(shapeName, "s")]).concat($$.getTargetSelectorSuffix(id))) : $el.main)
|
|
6472
|
+
.selectAll(".".concat(CLASS[shapeName]).concat(suffix));
|
|
6359
6473
|
}
|
|
6360
6474
|
return shape;
|
|
6361
6475
|
},
|
|
@@ -6409,6 +6523,24 @@ var shape = {
|
|
|
6409
6523
|
return $$.isSplineType(d) ?
|
|
6410
6524
|
interpolation : ($$.isStepType(d) ?
|
|
6411
6525
|
config.line_step_type : "linear");
|
|
6526
|
+
},
|
|
6527
|
+
isWithinBar: function (that) {
|
|
6528
|
+
var mouse = getPointer(this.state.event, that);
|
|
6529
|
+
var list = getRectSegList(that);
|
|
6530
|
+
var seg0 = list[0], seg1 = list[1];
|
|
6531
|
+
var x = Math.min(seg0.x, seg1.x);
|
|
6532
|
+
var y = Math.min(seg0.y, seg1.y);
|
|
6533
|
+
var offset = this.config.bar_sensitivity;
|
|
6534
|
+
var _a = that.getBBox(), width = _a.width, height = _a.height;
|
|
6535
|
+
var sx = x - offset;
|
|
6536
|
+
var ex = x + width + offset;
|
|
6537
|
+
var sy = y + height + offset;
|
|
6538
|
+
var ey = y - offset;
|
|
6539
|
+
var isWithin = sx < mouse[0] &&
|
|
6540
|
+
mouse[0] < ex &&
|
|
6541
|
+
ey < mouse[1] &&
|
|
6542
|
+
mouse[1] < sy;
|
|
6543
|
+
return isWithin;
|
|
6412
6544
|
}
|
|
6413
6545
|
};
|
|
6414
6546
|
|
|
@@ -6455,7 +6587,7 @@ var size = {
|
|
|
6455
6587
|
var $$ = this;
|
|
6456
6588
|
var config = $$.config, hasAxis = $$.state.hasAxis;
|
|
6457
6589
|
var axisId = config.axis_rotated ? "y" : "x";
|
|
6458
|
-
var axesLen = hasAxis ? config["axis_"
|
|
6590
|
+
var axesLen = hasAxis ? config["axis_".concat(axisId, "_axes")].length : 0;
|
|
6459
6591
|
var padding = isValue(config.padding_bottom) ?
|
|
6460
6592
|
config.padding_bottom : 0;
|
|
6461
6593
|
return padding + (axesLen ? $$.getHorizontalAxisHeight(axisId) * axesLen : 0);
|
|
@@ -6465,7 +6597,7 @@ var size = {
|
|
|
6465
6597
|
var config = $$.config, hasAxis = $$.state.hasAxis;
|
|
6466
6598
|
var isRotated = config.axis_rotated;
|
|
6467
6599
|
var axisId = isRotated ? "x" : "y";
|
|
6468
|
-
var axesLen = hasAxis ? config["axis_"
|
|
6600
|
+
var axesLen = hasAxis ? config["axis_".concat(axisId, "_axes")].length : 0;
|
|
6469
6601
|
var axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0;
|
|
6470
6602
|
var padding;
|
|
6471
6603
|
if (isValue(config.padding_left)) {
|
|
@@ -6515,7 +6647,7 @@ var size = {
|
|
|
6515
6647
|
* @private
|
|
6516
6648
|
*/
|
|
6517
6649
|
getParentRectValue: function (key) {
|
|
6518
|
-
var offsetName = "offset"
|
|
6650
|
+
var offsetName = "offset".concat(capitalize(key));
|
|
6519
6651
|
var parent = this.$el.chart.node();
|
|
6520
6652
|
var v = 0;
|
|
6521
6653
|
while (v < 30 && parent && parent.tagName !== "BODY") {
|
|
@@ -6555,7 +6687,7 @@ var size = {
|
|
|
6555
6687
|
var config = $$.config, $el = $$.$el;
|
|
6556
6688
|
var hasLeftAxisRect = config.axis_rotated || (!config.axis_rotated && !config.axis_y_inner);
|
|
6557
6689
|
var leftAxisClass = config.axis_rotated ? CLASS.axisX : CLASS.axisY;
|
|
6558
|
-
var leftAxis = $el.main.select("."
|
|
6690
|
+
var leftAxis = $el.main.select(".".concat(leftAxisClass)).node();
|
|
6559
6691
|
var svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : { right: 0 };
|
|
6560
6692
|
var chartRect = $el.chart.node().getBoundingClientRect();
|
|
6561
6693
|
var hasArc = $$.hasArcType();
|
|
@@ -6582,28 +6714,53 @@ var size = {
|
|
|
6582
6714
|
.attr("width", current.width)
|
|
6583
6715
|
.attr("height", current.height);
|
|
6584
6716
|
if (hasAxis) {
|
|
6585
|
-
var brush = svg.select("."
|
|
6717
|
+
var brush = svg.select(".".concat(CLASS.brush, " .overlay"));
|
|
6586
6718
|
var brushSize = { width: 0, height: 0 };
|
|
6587
6719
|
if (brush.size()) {
|
|
6588
6720
|
brushSize.width = +brush.attr("width");
|
|
6589
6721
|
brushSize.height = +brush.attr("height");
|
|
6590
6722
|
}
|
|
6591
|
-
svg.selectAll(["#"
|
|
6723
|
+
svg.selectAll(["#".concat(clip.id), "#".concat(clip.idGrid)])
|
|
6592
6724
|
.select("rect")
|
|
6593
6725
|
.attr("width", width)
|
|
6594
6726
|
.attr("height", height);
|
|
6595
|
-
svg.select("#"
|
|
6727
|
+
svg.select("#".concat(clip.idXAxis))
|
|
6596
6728
|
.select("rect")
|
|
6597
6729
|
.call($$.setXAxisClipPath.bind($$));
|
|
6598
|
-
svg.select("#"
|
|
6730
|
+
svg.select("#".concat(clip.idYAxis))
|
|
6599
6731
|
.select("rect")
|
|
6600
6732
|
.call($$.setYAxisClipPath.bind($$));
|
|
6601
|
-
clip.idSubchart && svg.select("#"
|
|
6733
|
+
clip.idSubchart && svg.select("#".concat(clip.idSubchart))
|
|
6602
6734
|
.select("rect")
|
|
6603
6735
|
.attr("width", width)
|
|
6604
6736
|
.attr("height", brushSize.height);
|
|
6605
6737
|
}
|
|
6606
6738
|
},
|
|
6739
|
+
/**
|
|
6740
|
+
* Get resetted padding values when 'padding=false' option is set
|
|
6741
|
+
* https://github.com/naver/billboard.js/issues/2367
|
|
6742
|
+
* @param {number|object} v Padding values to be resetted
|
|
6743
|
+
* @returns {number|object} Padding value
|
|
6744
|
+
* @private
|
|
6745
|
+
*/
|
|
6746
|
+
getResettedPadding: function (v) {
|
|
6747
|
+
var $$ = this;
|
|
6748
|
+
var config = $$.config;
|
|
6749
|
+
var isNum = isNumber(v);
|
|
6750
|
+
var p = isNum ? 0 : {};
|
|
6751
|
+
if (config.padding === false) {
|
|
6752
|
+
!isNum && Object.keys(v).forEach(function (key) {
|
|
6753
|
+
// when data.lables=true, do not reset top padding
|
|
6754
|
+
p[key] = (!isEmpty(config.data_labels) &&
|
|
6755
|
+
config.data_labels !== false &&
|
|
6756
|
+
key === "top") ? v[key] : 0;
|
|
6757
|
+
});
|
|
6758
|
+
}
|
|
6759
|
+
else {
|
|
6760
|
+
p = v;
|
|
6761
|
+
}
|
|
6762
|
+
return p;
|
|
6763
|
+
},
|
|
6607
6764
|
/**
|
|
6608
6765
|
* Update size values
|
|
6609
6766
|
* @param {boolean} isInit If is called at initialization
|
|
@@ -6641,6 +6798,7 @@ var size = {
|
|
|
6641
6798
|
bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
|
|
6642
6799
|
left: hasArc ? 0 : $$.getCurrentPaddingLeft()
|
|
6643
6800
|
};
|
|
6801
|
+
state.margin = $$.getResettedPadding(state.margin);
|
|
6644
6802
|
// for subchart
|
|
6645
6803
|
state.margin2 = isRotated ? {
|
|
6646
6804
|
top: state.margin.top,
|
|
@@ -6709,7 +6867,7 @@ var text = {
|
|
|
6709
6867
|
*/
|
|
6710
6868
|
initText: function () {
|
|
6711
6869
|
var $el = this.$el;
|
|
6712
|
-
$el.main.select("."
|
|
6870
|
+
$el.main.select(".".concat(CLASS.chart)).append("g")
|
|
6713
6871
|
.attr("class", CLASS.chartTexts);
|
|
6714
6872
|
},
|
|
6715
6873
|
/**
|
|
@@ -6722,7 +6880,7 @@ var text = {
|
|
|
6722
6880
|
var classChartText = $$.getChartClass("Text");
|
|
6723
6881
|
var classTexts = $$.getClass("texts", "id");
|
|
6724
6882
|
var classFocus = $$.classFocus.bind($$);
|
|
6725
|
-
var mainTextUpdate = $$.$el.main.select("."
|
|
6883
|
+
var mainTextUpdate = $$.$el.main.select(".".concat(CLASS.chartTexts)).selectAll(".".concat(CLASS.chartText))
|
|
6726
6884
|
.data(targets)
|
|
6727
6885
|
.attr("class", function (d) { return classChartText(d) + classFocus(d); });
|
|
6728
6886
|
var mainTextEnter = mainTextUpdate.enter().append("g")
|
|
@@ -6740,8 +6898,8 @@ var text = {
|
|
|
6740
6898
|
var $$ = this;
|
|
6741
6899
|
var $el = $$.$el, $T = $$.$T, config = $$.config;
|
|
6742
6900
|
var classText = $$.getClass("text", "index");
|
|
6743
|
-
var text = $el.main.selectAll("."
|
|
6744
|
-
.selectAll("."
|
|
6901
|
+
var text = $el.main.selectAll(".".concat(CLASS.texts))
|
|
6902
|
+
.selectAll(".".concat(CLASS.text))
|
|
6745
6903
|
.data($$.labelishData.bind($$));
|
|
6746
6904
|
$T(text.exit())
|
|
6747
6905
|
.style("fill-opacity", "0")
|
|
@@ -6822,7 +6980,7 @@ var text = {
|
|
|
6822
6980
|
var id = isString(backgroundColor) ? "" : $$.getTargetSelectorSuffix(("id" in d ? d.id : d.data.id));
|
|
6823
6981
|
var filter = $el.defs.select(["filter[id*='labels-bg", "']"].join(id));
|
|
6824
6982
|
if (filter.size()) {
|
|
6825
|
-
color = "url(#"
|
|
6983
|
+
color = "url(#".concat(filter.attr("id"), ")");
|
|
6826
6984
|
}
|
|
6827
6985
|
}
|
|
6828
6986
|
return color || null;
|
|
@@ -6851,7 +7009,7 @@ var text = {
|
|
|
6851
7009
|
var posY = y.bind(this)(d, i);
|
|
6852
7010
|
// when is multiline
|
|
6853
7011
|
if (this.childElementCount) {
|
|
6854
|
-
node.attr("transform", "translate("
|
|
7012
|
+
node.attr("transform", "translate(".concat(posX, " ").concat(posY, ")"));
|
|
6855
7013
|
}
|
|
6856
7014
|
else {
|
|
6857
7015
|
node.attr("x", posX).attr("y", posY);
|
|
@@ -6875,7 +7033,7 @@ var text = {
|
|
|
6875
7033
|
base = base.querySelector("text");
|
|
6876
7034
|
}
|
|
6877
7035
|
var text = base.textContent;
|
|
6878
|
-
var cacheKey = KEY.textRect
|
|
7036
|
+
var cacheKey = "".concat(KEY.textRect, "-").concat(text.replace(/\W/g, "_"));
|
|
6879
7037
|
var rect = $$.cache.get(cacheKey);
|
|
6880
7038
|
if (!rect) {
|
|
6881
7039
|
$$.$el.svg.append("text")
|
|
@@ -6905,7 +7063,7 @@ var text = {
|
|
|
6905
7063
|
var getter = forX ? $$.getXForText : $$.getYForText;
|
|
6906
7064
|
$$.hasType("radar") && types.push("radar");
|
|
6907
7065
|
types.forEach(function (v) {
|
|
6908
|
-
points[v] = $$["generateGet"
|
|
7066
|
+
points[v] = $$["generateGet".concat(capitalize(v), "Points")](indices[v], false);
|
|
6909
7067
|
});
|
|
6910
7068
|
return function (d, i) {
|
|
6911
7069
|
var type = ($$.isAreaType(d) && "area") ||
|
|
@@ -6965,13 +7123,14 @@ var text = {
|
|
|
6965
7123
|
* @private
|
|
6966
7124
|
*/
|
|
6967
7125
|
getXForText: function (points, d, textElement) {
|
|
7126
|
+
var _a;
|
|
6968
7127
|
var $$ = this;
|
|
6969
7128
|
var config = $$.config, state = $$.state;
|
|
6970
7129
|
var isRotated = config.axis_rotated;
|
|
6971
7130
|
var xPos = points[0][0];
|
|
6972
|
-
if ($$.
|
|
7131
|
+
if ($$.isCandlestickType(d)) {
|
|
6973
7132
|
if (isRotated) {
|
|
6974
|
-
xPos = $$.getCandlestickData(d)._isUp ?
|
|
7133
|
+
xPos = ((_a = $$.getCandlestickData(d)) === null || _a === void 0 ? void 0 : _a._isUp) ?
|
|
6975
7134
|
points[2][2] + 4 : points[2][1] - 4;
|
|
6976
7135
|
}
|
|
6977
7136
|
else {
|
|
@@ -7122,7 +7281,7 @@ var text = {
|
|
|
7122
7281
|
if (ratio === void 0) { ratio = 0; }
|
|
7123
7282
|
var $$ = this;
|
|
7124
7283
|
var config = $$.config;
|
|
7125
|
-
var threshold = config[type
|
|
7284
|
+
var threshold = config["".concat(type, "_label_threshold")] || 0;
|
|
7126
7285
|
return ratio >= threshold;
|
|
7127
7286
|
}
|
|
7128
7287
|
};
|
|
@@ -7180,7 +7339,7 @@ var title = {
|
|
|
7180
7339
|
if (title) {
|
|
7181
7340
|
var y = $$.yForTitle.call($$);
|
|
7182
7341
|
if (/g/i.test(title.node().tagName)) {
|
|
7183
|
-
title.attr("transform", "translate("
|
|
7342
|
+
title.attr("transform", "translate(".concat(getTextPos(config.title_position, current.width), ", ").concat(y, ")"));
|
|
7184
7343
|
}
|
|
7185
7344
|
else {
|
|
7186
7345
|
title.attr("x", $$.xForTitle.call($$)).attr("y", y);
|
|
@@ -7244,7 +7403,6 @@ var tooltip$1 = {
|
|
|
7244
7403
|
$el.tooltip = select(config.tooltip_contents.bindto);
|
|
7245
7404
|
if ($el.tooltip.empty()) {
|
|
7246
7405
|
$el.tooltip = $el.chart
|
|
7247
|
-
.style("position", "relative")
|
|
7248
7406
|
.append("div")
|
|
7249
7407
|
.attr("class", CLASS.tooltipContainer)
|
|
7250
7408
|
.style("position", "absolute")
|
|
@@ -7315,12 +7473,12 @@ var tooltip$1 = {
|
|
|
7315
7473
|
var $$ = this;
|
|
7316
7474
|
var api = $$.api, config = $$.config, state = $$.state;
|
|
7317
7475
|
var _a = ["title", "name", "value"].map(function (v) {
|
|
7318
|
-
var fn = config["tooltip_format_"
|
|
7476
|
+
var fn = config["tooltip_format_".concat(v)];
|
|
7319
7477
|
return isFunction(fn) ? fn.bind(api) : fn;
|
|
7320
7478
|
}), titleFormat = _a[0], nameFormat = _a[1], valueFormat = _a[2];
|
|
7321
7479
|
titleFormat = titleFormat || defaultTitleFormat;
|
|
7322
7480
|
nameFormat = nameFormat || (function (name) { return name; });
|
|
7323
|
-
valueFormat = valueFormat || ($$.isStackNormalized() ? function (v, ratio) { return (ratio * 100).toFixed(2)
|
|
7481
|
+
valueFormat = valueFormat || ($$.isStackNormalized() ? function (v, ratio) { return "".concat((ratio * 100).toFixed(2), "%"); } : defaultValueFormat);
|
|
7324
7482
|
var order = config.tooltip_order;
|
|
7325
7483
|
var getRowValue = function (row) { return ($$.axis && $$.isBubbleZType(row) ? $$.getBubbleZData(row.value, "z") : $$.getBaseValue(row)); };
|
|
7326
7484
|
var getBgColor = $$.levelColor ? function (row) { return $$.levelColor(row.value); } : function (row) { return color(row); };
|
|
@@ -7370,21 +7528,25 @@ var tooltip$1 = {
|
|
|
7370
7528
|
sanitise(titleFormat ? titleFormat(row.x) : row.x);
|
|
7371
7529
|
text = tplProcess(tpl[0], {
|
|
7372
7530
|
CLASS_TOOLTIP: CLASS.tooltip,
|
|
7373
|
-
TITLE: isValue(title) ? (tplStr ? title : "<tr><th colspan=\"2\">"
|
|
7531
|
+
TITLE: isValue(title) ? (tplStr ? title : "<tr><th colspan=\"2\">".concat(title, "</th></tr>")) : ""
|
|
7374
7532
|
});
|
|
7375
7533
|
}
|
|
7376
7534
|
if (!row.ratio && $$.$el.arcs) {
|
|
7377
|
-
row.ratio = $$.getRatio("arc", $$.$el.arcs.select("path."
|
|
7535
|
+
row.ratio = $$.getRatio("arc", $$.$el.arcs.select("path.".concat(CLASS.arc, "-").concat(row.id)).data()[0]);
|
|
7378
7536
|
}
|
|
7379
7537
|
param = [row.ratio, row.id, row.index, d];
|
|
7380
7538
|
value = sanitise(valueFormat.apply(void 0, __spreadArray([getRowValue(row)], param, false)));
|
|
7381
7539
|
if ($$.isAreaRangeType(row)) {
|
|
7382
7540
|
var _b = ["high", "low"].map(function (v) { return sanitise(valueFormat.apply(void 0, __spreadArray([$$.getRangedData(row, v)], param, false))); }), high = _b[0], low = _b[1];
|
|
7383
|
-
value = "<b>Mid:</b> "
|
|
7541
|
+
value = "<b>Mid:</b> ".concat(value, " <b>High:</b> ").concat(high, " <b>Low:</b> ").concat(low);
|
|
7384
7542
|
}
|
|
7385
7543
|
else if ($$.isCandlestickType(row)) {
|
|
7386
7544
|
var _c = ["open", "high", "low", "close", "volume"].map(function (v) { return sanitise(valueFormat.apply(void 0, __spreadArray([$$.getRangedData(row, v, "candlestick")], param, false))); }), open_1 = _c[0], high = _c[1], low = _c[2], close_1 = _c[3], volume = _c[4];
|
|
7387
|
-
value = "<b>Open:</b> "
|
|
7545
|
+
value = "<b>Open:</b> ".concat(open_1, " <b>High:</b> ").concat(high, " <b>Low:</b> ").concat(low, " <b>Close:</b> ").concat(close_1).concat(volume ? " <b>Volume:</b> ".concat(volume) : "");
|
|
7546
|
+
}
|
|
7547
|
+
else if ($$.isBarRangeType(row)) {
|
|
7548
|
+
var _d = row.value, start = _d[0], end = _d[1];
|
|
7549
|
+
value = "".concat(valueFormat(start), " ~ ").concat(valueFormat(end));
|
|
7388
7550
|
}
|
|
7389
7551
|
if (value !== undefined) {
|
|
7390
7552
|
// Skip elements when their name is set to null
|
|
@@ -7395,7 +7557,7 @@ var tooltip$1 = {
|
|
|
7395
7557
|
var color_1 = getBgColor(row);
|
|
7396
7558
|
var contentValue_1 = {
|
|
7397
7559
|
CLASS_TOOLTIP_NAME: CLASS.tooltipName + $$.getTargetSelectorSuffix(row.id),
|
|
7398
|
-
COLOR: (tplStr || !$$.patterns) ? color_1 : "<svg><rect style=\"fill:"
|
|
7560
|
+
COLOR: (tplStr || !$$.patterns) ? color_1 : "<svg><rect style=\"fill:".concat(color_1, "\" width=\"10\" height=\"10\"></rect></svg>"),
|
|
7399
7561
|
NAME: name_1,
|
|
7400
7562
|
VALUE: value
|
|
7401
7563
|
};
|
|
@@ -7411,7 +7573,7 @@ var tooltip$1 = {
|
|
|
7411
7573
|
for (i = 0; i < len; i++) {
|
|
7412
7574
|
_loop_1();
|
|
7413
7575
|
}
|
|
7414
|
-
return text
|
|
7576
|
+
return "".concat(text, "</table>");
|
|
7415
7577
|
},
|
|
7416
7578
|
/**
|
|
7417
7579
|
* Get the content template string
|
|
@@ -7420,7 +7582,7 @@ var tooltip$1 = {
|
|
|
7420
7582
|
* @private
|
|
7421
7583
|
*/
|
|
7422
7584
|
getTooltipContentTemplate: function (tplStr) {
|
|
7423
|
-
return (tplStr || "<table class=\"{=CLASS_TOOLTIP}\"><tbody>\n\t\t\t\t{=TITLE}\n\t\t\t\t{{<tr class=\"{=CLASS_TOOLTIP_NAME}\">\n\t\t\t\t\t<td class=\"name\">"
|
|
7585
|
+
return (tplStr || "<table class=\"{=CLASS_TOOLTIP}\"><tbody>\n\t\t\t\t{=TITLE}\n\t\t\t\t{{<tr class=\"{=CLASS_TOOLTIP_NAME}\">\n\t\t\t\t\t<td class=\"name\">".concat(this.patterns ? "{=COLOR}" : "<span style=\"background-color:{=COLOR}\"></span>", "{=NAME}</td>\n\t\t\t\t\t<td class=\"value\">{=VALUE}</td>\n\t\t\t\t</tr>}}\n\t\t\t</tbody></table>"))
|
|
7424
7586
|
.replace(/(\r?\n|\t)/g, "")
|
|
7425
7587
|
.split(/{{(.*)}}/);
|
|
7426
7588
|
},
|
|
@@ -7530,7 +7692,7 @@ var tooltip$1 = {
|
|
|
7530
7692
|
var pos_1 = fnPos(dataToShow, width, height, eventRect, currPos);
|
|
7531
7693
|
["top", "left"].forEach(function (v) {
|
|
7532
7694
|
var value = pos_1[v];
|
|
7533
|
-
tooltip.style(v, value
|
|
7695
|
+
tooltip.style(v, "".concat(value, "px"));
|
|
7534
7696
|
// Remember left pos in percentage to be used on resize call
|
|
7535
7697
|
if (v === "left" && !datum.xPosInPercent) {
|
|
7536
7698
|
datum.xPosInPercent = value / state.current.width * 100;
|
|
@@ -7555,7 +7717,7 @@ var tooltip$1 = {
|
|
|
7555
7717
|
if (diff < 0) {
|
|
7556
7718
|
value += diff;
|
|
7557
7719
|
}
|
|
7558
|
-
tooltip.style("left", value
|
|
7720
|
+
tooltip.style("left", "".concat(value, "px"));
|
|
7559
7721
|
}
|
|
7560
7722
|
});
|
|
7561
7723
|
},
|
|
@@ -7664,26 +7826,26 @@ var transform = {
|
|
|
7664
7826
|
x = state.width / 2 - width;
|
|
7665
7827
|
y = asHalfPixel(state.margin.top);
|
|
7666
7828
|
}
|
|
7667
|
-
return "translate("
|
|
7829
|
+
return "translate(".concat(x, ", ").concat(y, ")");
|
|
7668
7830
|
},
|
|
7669
7831
|
transformMain: function (withTransition, transitions) {
|
|
7670
7832
|
var $$ = this;
|
|
7671
7833
|
var main = $$.$el.main, $T = $$.$T;
|
|
7672
7834
|
var xAxis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisX) ?
|
|
7673
7835
|
transitions.axisX :
|
|
7674
|
-
$T(main.select("."
|
|
7836
|
+
$T(main.select(".".concat(CLASS.axisX)), withTransition);
|
|
7675
7837
|
var yAxis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisY) ?
|
|
7676
7838
|
transitions.axisY :
|
|
7677
|
-
$T(main.select("."
|
|
7839
|
+
$T(main.select(".".concat(CLASS.axisY)), withTransition);
|
|
7678
7840
|
var y2Axis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisY2) ?
|
|
7679
7841
|
transitions.axisY2 :
|
|
7680
|
-
$T(main.select("."
|
|
7842
|
+
$T(main.select(".".concat(CLASS.axisY2)), withTransition);
|
|
7681
7843
|
$T(main, withTransition)
|
|
7682
7844
|
.attr("transform", $$.getTranslate("main"));
|
|
7683
7845
|
xAxis.attr("transform", $$.getTranslate("x"));
|
|
7684
7846
|
yAxis.attr("transform", $$.getTranslate("y"));
|
|
7685
7847
|
y2Axis.attr("transform", $$.getTranslate("y2"));
|
|
7686
|
-
main.select("."
|
|
7848
|
+
main.select(".".concat(CLASS.chartArcs))
|
|
7687
7849
|
.attr("transform", $$.getTranslate("arc"));
|
|
7688
7850
|
},
|
|
7689
7851
|
transformAll: function (withTransition, transitions) {
|
|
@@ -8028,6 +8190,13 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8028
8190
|
checkModuleImport($$);
|
|
8029
8191
|
state.hasAxis = !$$.hasArcType();
|
|
8030
8192
|
state.hasRadar = !state.hasAxis && $$.hasType("radar");
|
|
8193
|
+
// when 'padding=false' is set, disable axes and subchart. Because they are useless.
|
|
8194
|
+
if (config.padding === false) {
|
|
8195
|
+
config.axis_x_show = false;
|
|
8196
|
+
config.axis_y_show = false;
|
|
8197
|
+
config.axis_y2_show = false;
|
|
8198
|
+
config.subchart_show = false;
|
|
8199
|
+
}
|
|
8031
8200
|
$$.initParams();
|
|
8032
8201
|
var bindto = {
|
|
8033
8202
|
element: config.bindto,
|
|
@@ -8043,7 +8212,9 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8043
8212
|
if ($el.chart.empty()) {
|
|
8044
8213
|
$el.chart = select(doc.body.appendChild(doc.createElement("div")));
|
|
8045
8214
|
}
|
|
8046
|
-
$el.chart.html("")
|
|
8215
|
+
$el.chart.html("")
|
|
8216
|
+
.classed(bindto.classname, true)
|
|
8217
|
+
.style("position", "relative");
|
|
8047
8218
|
$$.initToRender();
|
|
8048
8219
|
};
|
|
8049
8220
|
/**
|
|
@@ -8079,7 +8250,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8079
8250
|
var _a = $$, config = _a.config, format = _a.format, state = _a.state;
|
|
8080
8251
|
var isRotated = config.axis_rotated;
|
|
8081
8252
|
// datetime to be used for uniqueness
|
|
8082
|
-
state.datetimeId = "bb-"
|
|
8253
|
+
state.datetimeId = "bb-".concat(+new Date());
|
|
8083
8254
|
$$.color = $$.generateColor();
|
|
8084
8255
|
$$.levelColor = $$.generateLevelColor();
|
|
8085
8256
|
if ($$.hasPointType()) {
|
|
@@ -8111,7 +8282,8 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8111
8282
|
config.legend_inset_anchor === "top-right";
|
|
8112
8283
|
state.isLegendLeft = config.legend_inset_anchor === "top-left" ||
|
|
8113
8284
|
config.legend_inset_anchor === "bottom-left";
|
|
8114
|
-
state.
|
|
8285
|
+
state.rotatedPadding.top = $$.getResettedPadding(state.rotatedPadding.top);
|
|
8286
|
+
state.rotatedPadding.right = isRotated && !config.axis_x_show ? 0 : 30;
|
|
8115
8287
|
state.inputType = convertInputType(config.interaction_inputType_mouse, config.interaction_inputType_touch);
|
|
8116
8288
|
};
|
|
8117
8289
|
ChartInternal.prototype.initWithData = function (data) {
|
|
@@ -8204,7 +8376,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8204
8376
|
// text when empty
|
|
8205
8377
|
if (config.data_empty_label_text) {
|
|
8206
8378
|
main.append("text")
|
|
8207
|
-
.attr("class", CLASS.text
|
|
8379
|
+
.attr("class", "".concat(CLASS.text, " ").concat(CLASS.empty))
|
|
8208
8380
|
.attr("text-anchor", "middle") // horizontal centering of text at x position in all browsers.
|
|
8209
8381
|
.attr("dominant-baseline", "middle"); // vertical centering of text at y position in all browsers, except IE.
|
|
8210
8382
|
}
|
|
@@ -8280,7 +8452,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8280
8452
|
}
|
|
8281
8453
|
}
|
|
8282
8454
|
types.forEach(function (v) {
|
|
8283
|
-
$$["init"
|
|
8455
|
+
$$["init".concat(v)]();
|
|
8284
8456
|
});
|
|
8285
8457
|
notEmpty($$.config.data_labels) && !$$.hasArcType(null, ["radar"]) && $$.initText();
|
|
8286
8458
|
};
|
|
@@ -8347,7 +8519,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8347
8519
|
["bar", "candlestick", "line"].forEach(function (v) {
|
|
8348
8520
|
var name = capitalize(v);
|
|
8349
8521
|
if ((v === "line" && $$.hasTypeOf(name)) || $$.hasType(v)) {
|
|
8350
|
-
$$["updateTargetsFor"
|
|
8522
|
+
$$["updateTargetsFor".concat(name)](targets.filter($$["is".concat(name, "Type")].bind($$)));
|
|
8351
8523
|
}
|
|
8352
8524
|
});
|
|
8353
8525
|
// Sub Chart
|
|
@@ -8374,7 +8546,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8374
8546
|
ChartInternal.prototype.showTargets = function () {
|
|
8375
8547
|
var $$ = this;
|
|
8376
8548
|
var svg = $$.$el.svg, $T = $$.$T;
|
|
8377
|
-
$T(svg.selectAll("."
|
|
8549
|
+
$T(svg.selectAll(".".concat(CLASS.target))
|
|
8378
8550
|
.filter(function (d) { return $$.isTargetToShow(d.id); })).style("opacity", null);
|
|
8379
8551
|
};
|
|
8380
8552
|
ChartInternal.prototype.getWithOption = function (options) {
|
|
@@ -8398,7 +8570,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8398
8570
|
if (isString(defVal)) {
|
|
8399
8571
|
defVal = withOptions[defVal];
|
|
8400
8572
|
}
|
|
8401
|
-
withOptions[key] = getOption(options, "with"
|
|
8573
|
+
withOptions[key] = getOption(options, "with".concat(key), defVal);
|
|
8402
8574
|
});
|
|
8403
8575
|
return withOptions;
|
|
8404
8576
|
};
|
|
@@ -8608,11 +8780,16 @@ var apiChart = {
|
|
|
8608
8780
|
if (notEmpty($$)) {
|
|
8609
8781
|
$$.callPluginHook("$willDestroy");
|
|
8610
8782
|
$$.charts.splice($$.charts.indexOf(this), 1);
|
|
8783
|
+
// detach events
|
|
8784
|
+
$$.unbindAllEvents();
|
|
8611
8785
|
// clear timers && pending transition
|
|
8612
8786
|
svg.select("*").interrupt();
|
|
8613
8787
|
$$.resizeFunction.clear();
|
|
8614
8788
|
win.removeEventListener("resize", $$.resizeFunction);
|
|
8615
|
-
chart.classed("bb", false)
|
|
8789
|
+
chart.classed("bb", false)
|
|
8790
|
+
.style("position", null)
|
|
8791
|
+
.selectChildren()
|
|
8792
|
+
.remove();
|
|
8616
8793
|
// releasing own references
|
|
8617
8794
|
Object.keys(this).forEach(function (key) {
|
|
8618
8795
|
key === "internal" && Object.keys($$).forEach(function (k) {
|
|
@@ -8871,7 +9048,7 @@ var apiData = { data: data };
|
|
|
8871
9048
|
* @see https://developer.mozilla.org/ko/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
|
|
8872
9049
|
*/
|
|
8873
9050
|
var b64EncodeUnicode = function (str) { return btoa(encodeURIComponent(str)
|
|
8874
|
-
.replace(/%([0-9A-F]{2})/g, function (match, p) { return String.fromCharCode(Number("0x"
|
|
9051
|
+
.replace(/%([0-9A-F]{2})/g, function (match, p) { return String.fromCharCode(Number("0x".concat(p))); })); };
|
|
8875
9052
|
/**
|
|
8876
9053
|
* Convert svg node to data url
|
|
8877
9054
|
* @param {HTMLElement} node target node
|
|
@@ -8895,9 +9072,9 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
8895
9072
|
var styleXml = serializer.serializeToString(style);
|
|
8896
9073
|
// foreignObject not supported in IE11 and below
|
|
8897
9074
|
// https://msdn.microsoft.com/en-us/library/hh834675(v=vs.85).aspx
|
|
8898
|
-
var dataStr =
|
|
9075
|
+
var dataStr = "<svg xmlns=\"".concat(namespaces.svg, "\" width=\"").concat(width, "\" height=\"").concat(height, "\" \n\t\tviewBox=\"0 0 ").concat(orgSize.width, " ").concat(orgSize.height, "\" \n\t\tpreserveAspectRatio=\"").concat((option === null || option === void 0 ? void 0 : option.preserveAspectRatio) === false ? "none" : "xMinYMid meet", "\">\n\t\t\t<foreignObject width=\"100%\" height=\"100%\">\n\t\t\t\t").concat(styleXml, "\n\t\t\t\t").concat(nodeXml.replace(/(url\()[^#]+/g, "$1"), "\n\t\t\t</foreignObject></svg>")
|
|
8899
9076
|
.replace("/\n/g", "%0A");
|
|
8900
|
-
return "data:image/svg+xml;base64,"
|
|
9077
|
+
return "data:image/svg+xml;base64,".concat(b64EncodeUnicode(dataStr));
|
|
8901
9078
|
}
|
|
8902
9079
|
var apiExport = {
|
|
8903
9080
|
/**
|
|
@@ -9003,7 +9180,7 @@ var apiFocus = {
|
|
|
9003
9180
|
if ($$.hasArcType() && !state.hasRadar) {
|
|
9004
9181
|
$$.expandArc(targetIds);
|
|
9005
9182
|
$$.hasType("gauge") &&
|
|
9006
|
-
$$.markOverlapped(targetIdsValue, $$, "."
|
|
9183
|
+
$$.markOverlapped(targetIdsValue, $$, ".".concat(CLASS.gaugeValue));
|
|
9007
9184
|
}
|
|
9008
9185
|
$$.toggleFocusLegend(targetIds, true);
|
|
9009
9186
|
state.focusedTargetIds = targetIds;
|
|
@@ -9035,7 +9212,7 @@ var apiFocus = {
|
|
|
9035
9212
|
if ($$.hasArcType()) {
|
|
9036
9213
|
$$.unexpandArc(targetIds);
|
|
9037
9214
|
$$.hasType("gauge") &&
|
|
9038
|
-
$$.undoMarkOverlapped($$, "."
|
|
9215
|
+
$$.undoMarkOverlapped($$, ".".concat(CLASS.gaugeValue));
|
|
9039
9216
|
}
|
|
9040
9217
|
$$.toggleFocusLegend(targetIds, false);
|
|
9041
9218
|
state.focusedTargetIds = state.focusedTargetIds.filter(function (id) { return targetIds.indexOf(id) < 0; });
|
|
@@ -9373,7 +9550,7 @@ function showHide(show, targetIdsValue, options) {
|
|
|
9373
9550
|
.map(function (v) { return targetIds.indexOf(v) > -1 && v; })
|
|
9374
9551
|
.filter(Boolean);
|
|
9375
9552
|
$$.state.toggling = true;
|
|
9376
|
-
$$[(show ? "remove" : "add"
|
|
9553
|
+
$$["".concat(show ? "remove" : "add", "HiddenTargetIds")](targetIds);
|
|
9377
9554
|
var targets = $$.$el.svg.selectAll($$.selectorTargets(targetIds));
|
|
9378
9555
|
var opacity = show ? null : "0";
|
|
9379
9556
|
if (show && hiddenIds.length) {
|
|
@@ -9390,7 +9567,7 @@ function showHide(show, targetIdsValue, options) {
|
|
|
9390
9567
|
}
|
|
9391
9568
|
targets.style("opacity", opacity);
|
|
9392
9569
|
});
|
|
9393
|
-
options.withLegend && $$[(show ? "show" : "hide"
|
|
9570
|
+
options.withLegend && $$["".concat(show ? "show" : "hide", "Legend")](targetIds);
|
|
9394
9571
|
$$.redraw({
|
|
9395
9572
|
withUpdateOrgXDomain: true,
|
|
9396
9573
|
withUpdateXDomain: true,
|
|
@@ -9721,9 +9898,9 @@ extend(Chart.prototype, [
|
|
|
9721
9898
|
*/
|
|
9722
9899
|
function setMinMax($$, type, value) {
|
|
9723
9900
|
var config = $$.config;
|
|
9724
|
-
var axisX = "axis_x_"
|
|
9725
|
-
var axisY = "axis_y_"
|
|
9726
|
-
var axisY2 = "axis_y2_"
|
|
9901
|
+
var axisX = "axis_x_".concat(type);
|
|
9902
|
+
var axisY = "axis_y_".concat(type);
|
|
9903
|
+
var axisY2 = "axis_y2_".concat(type);
|
|
9727
9904
|
if (isDefined(value)) {
|
|
9728
9905
|
if (isObjectType(value)) {
|
|
9729
9906
|
isValue(value.x) && (config[axisX] = value.x);
|
|
@@ -9750,9 +9927,9 @@ function setMinMax($$, type, value) {
|
|
|
9750
9927
|
function getMinMax($$, type) {
|
|
9751
9928
|
var config = $$.config;
|
|
9752
9929
|
return {
|
|
9753
|
-
x: config["axis_x_"
|
|
9754
|
-
y: config["axis_y_"
|
|
9755
|
-
y2: config["axis_y2_"
|
|
9930
|
+
x: config["axis_x_".concat(type)],
|
|
9931
|
+
y: config["axis_y_".concat(type)],
|
|
9932
|
+
y2: config["axis_y2_".concat(type)]
|
|
9756
9933
|
};
|
|
9757
9934
|
}
|
|
9758
9935
|
/**
|
|
@@ -10210,8 +10387,8 @@ extend(regions, {
|
|
|
10210
10387
|
var config = $$.config, $T = $$.$T;
|
|
10211
10388
|
var options = optionsValue || {};
|
|
10212
10389
|
var classes = getOption(options, "classes", [CLASS.region]);
|
|
10213
|
-
var regions = $$.$el.main.select("."
|
|
10214
|
-
.selectAll(classes.map(function (c) { return "."
|
|
10390
|
+
var regions = $$.$el.main.select(".".concat(CLASS.regions))
|
|
10391
|
+
.selectAll(classes.map(function (c) { return ".".concat(c); }));
|
|
10215
10392
|
$T(regions)
|
|
10216
10393
|
.style("opacity", "0")
|
|
10217
10394
|
.remove();
|
|
@@ -10548,8 +10725,8 @@ var AxisRendererHelper = /** @class */ (function () {
|
|
|
10548
10725
|
AxisRendererHelper.prototype.getTickTransformSetter = function (id) {
|
|
10549
10726
|
var config = this.config;
|
|
10550
10727
|
var fn = id === "x" ?
|
|
10551
|
-
function (value) { return "translate("
|
|
10552
|
-
function (value) { return "translate(0,"
|
|
10728
|
+
function (value) { return "translate(".concat(value + config.tickOffset, ",0)"); } :
|
|
10729
|
+
function (value) { return "translate(0,".concat(value, ")"); };
|
|
10553
10730
|
return function (selection, scale) {
|
|
10554
10731
|
selection.attr("transform", function (d) { return fn(Math.ceil(scale(d))); });
|
|
10555
10732
|
};
|
|
@@ -10695,13 +10872,13 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
10695
10872
|
// // get the axis' tick position configuration
|
|
10696
10873
|
var id = params.id;
|
|
10697
10874
|
var tickTextPos = id && /^(x|y|y2)$/.test(id) ?
|
|
10698
|
-
params.config["axis_"
|
|
10875
|
+
params.config["axis_".concat(id, "_tick_text_position")] : { x: 0, y: 0 };
|
|
10699
10876
|
// tick visiblity
|
|
10700
|
-
var prefix = id === "subX" ? "subchart_axis_x" : "axis_"
|
|
10701
|
-
var axisShow = params.config[prefix
|
|
10877
|
+
var prefix = id === "subX" ? "subchart_axis_x" : "axis_".concat(id);
|
|
10878
|
+
var axisShow = params.config["".concat(prefix, "_show")];
|
|
10702
10879
|
var tickShow = {
|
|
10703
|
-
tick: axisShow ? params.config[prefix
|
|
10704
|
-
text: axisShow ? params.config[prefix
|
|
10880
|
+
tick: axisShow ? params.config["".concat(prefix, "_tick_show")] : false,
|
|
10881
|
+
text: axisShow ? params.config["".concat(prefix, "_tick_text_show")] : false
|
|
10705
10882
|
};
|
|
10706
10883
|
var $g;
|
|
10707
10884
|
g.each(function () {
|
|
@@ -10722,8 +10899,8 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
10722
10899
|
.attr("d", function () {
|
|
10723
10900
|
var outerTickSized = config.outerTickSize * sign;
|
|
10724
10901
|
return isTopBottom ?
|
|
10725
|
-
"M"
|
|
10726
|
-
"M"
|
|
10902
|
+
"M".concat(range[0], ",").concat(outerTickSized, "V0H").concat(range[1], "V").concat(outerTickSized) :
|
|
10903
|
+
"M".concat(outerTickSized, ",").concat(range[0], "H0V").concat(range[1], "H").concat(outerTickSized);
|
|
10727
10904
|
});
|
|
10728
10905
|
if (tickShow.tick || tickShow.text) {
|
|
10729
10906
|
// count of tick data in array
|
|
@@ -10784,7 +10961,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
10784
10961
|
});
|
|
10785
10962
|
var lineUpdate = tick.select("line");
|
|
10786
10963
|
var textUpdate = tick.select("text");
|
|
10787
|
-
tickEnter.select("line").attr(axisPx
|
|
10964
|
+
tickEnter.select("line").attr("".concat(axisPx, "2"), innerTickSize * sign);
|
|
10788
10965
|
tickEnter.select("text").attr(axisPx, tickLength * sign);
|
|
10789
10966
|
ctx.setTickLineTextPosition(lineUpdate, textUpdate);
|
|
10790
10967
|
// Append <title> for tooltip display
|
|
@@ -10859,7 +11036,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
10859
11036
|
orient === "top" && value.reverse();
|
|
10860
11037
|
return !r ? "middle" : value[r > 0 ? 0 : 1];
|
|
10861
11038
|
};
|
|
10862
|
-
var textTransform = function (r) { return (r ? "rotate("
|
|
11039
|
+
var textTransform = function (r) { return (r ? "rotate(".concat(r, ")") : null); };
|
|
10863
11040
|
var yForText = function (r) {
|
|
10864
11041
|
var r2 = r / (orient === "bottom" ? 15 : 23);
|
|
10865
11042
|
return r ? 11.5 - 2.5 * r2 * (r > 0 ? 1 : -1) : tickLength;
|
|
@@ -11084,7 +11261,7 @@ var Axis = /** @class */ (function () {
|
|
|
11084
11261
|
this.setOrient();
|
|
11085
11262
|
}
|
|
11086
11263
|
Axis.prototype.getAxisClassName = function (id) {
|
|
11087
|
-
return CLASS.axis
|
|
11264
|
+
return "".concat(CLASS.axis, " ").concat(CLASS["axis".concat(capitalize(id))]);
|
|
11088
11265
|
};
|
|
11089
11266
|
Axis.prototype.isHorizontal = function ($$, forHorizontal) {
|
|
11090
11267
|
var isRotated = $$.config.axis_rotated;
|
|
@@ -11100,11 +11277,11 @@ var Axis = /** @class */ (function () {
|
|
|
11100
11277
|
};
|
|
11101
11278
|
Axis.prototype.isTimeSeries = function (id) {
|
|
11102
11279
|
if (id === void 0) { id = "x"; }
|
|
11103
|
-
return this.owner.config["axis_"
|
|
11280
|
+
return this.owner.config["axis_".concat(id, "_type")] === "timeseries";
|
|
11104
11281
|
};
|
|
11105
11282
|
Axis.prototype.isLog = function (id) {
|
|
11106
11283
|
if (id === void 0) { id = "x"; }
|
|
11107
|
-
return this.owner.config["axis_"
|
|
11284
|
+
return this.owner.config["axis_".concat(id, "_type")] === "log";
|
|
11108
11285
|
};
|
|
11109
11286
|
Axis.prototype.isTimeSeriesY = function () {
|
|
11110
11287
|
return this.isTimeSeries("y");
|
|
@@ -11129,7 +11306,7 @@ var Axis = /** @class */ (function () {
|
|
|
11129
11306
|
config.axis_y2_show && target.push("y2");
|
|
11130
11307
|
target.forEach(function (v) {
|
|
11131
11308
|
var classAxis = _this.getAxisClassName(v);
|
|
11132
|
-
var classLabel = CLASS["axis"
|
|
11309
|
+
var classLabel = CLASS["axis".concat(v.toUpperCase(), "Label")];
|
|
11133
11310
|
axis[v] = main.append("g")
|
|
11134
11311
|
.attr("class", classAxis)
|
|
11135
11312
|
.attr("clip-path", function () {
|
|
@@ -11143,7 +11320,7 @@ var Axis = /** @class */ (function () {
|
|
|
11143
11320
|
return res;
|
|
11144
11321
|
})
|
|
11145
11322
|
.attr("transform", $$.getTranslate(v))
|
|
11146
|
-
.style("visibility", config["axis_"
|
|
11323
|
+
.style("visibility", config["axis_".concat(v, "_show")] ? null : "hidden");
|
|
11147
11324
|
axis[v].append("text")
|
|
11148
11325
|
.attr("class", classLabel)
|
|
11149
11326
|
.attr("transform", ["rotate(-90)", null][v === "x" ? +!isRotated : +isRotated])
|
|
@@ -11175,7 +11352,7 @@ var Axis = /** @class */ (function () {
|
|
|
11175
11352
|
var $$ = this.owner;
|
|
11176
11353
|
var config = $$.config;
|
|
11177
11354
|
var axes = [];
|
|
11178
|
-
var axesConfig = config["axis_"
|
|
11355
|
+
var axesConfig = config["axis_".concat(id, "_axes")];
|
|
11179
11356
|
var isRotated = config.axis_rotated;
|
|
11180
11357
|
var d3Axis;
|
|
11181
11358
|
if (id === "x") {
|
|
@@ -11210,7 +11387,7 @@ var Axis = /** @class */ (function () {
|
|
|
11210
11387
|
var $$ = this.owner;
|
|
11211
11388
|
var config = $$.config, main = $$.$el.main;
|
|
11212
11389
|
Object.keys(this.axesList).forEach(function (id) {
|
|
11213
|
-
var axesConfig = config["axis_"
|
|
11390
|
+
var axesConfig = config["axis_".concat(id, "_axes")];
|
|
11214
11391
|
var scale = $$.scale[id].copy();
|
|
11215
11392
|
var range = scale.range();
|
|
11216
11393
|
_this.axesList[id].forEach(function (v, i) {
|
|
@@ -11220,12 +11397,12 @@ var Axis = /** @class */ (function () {
|
|
|
11220
11397
|
if (!range.every(function (v, i) { return v === axisRange[i]; })) {
|
|
11221
11398
|
v.scale().range(range);
|
|
11222
11399
|
}
|
|
11223
|
-
var className = _this.getAxisClassName(id)
|
|
11224
|
-
var g = main.select("."
|
|
11400
|
+
var className = "".concat(_this.getAxisClassName(id), "-").concat(i + 1);
|
|
11401
|
+
var g = main.select(".".concat(className.replace(/\s/, ".")));
|
|
11225
11402
|
if (g.empty()) {
|
|
11226
11403
|
g = main.append("g")
|
|
11227
11404
|
.attr("class", className)
|
|
11228
|
-
.style("visibility", config["axis_"
|
|
11405
|
+
.style("visibility", config["axis_".concat(id, "_show")] ? null : "hidden")
|
|
11229
11406
|
.call(v);
|
|
11230
11407
|
}
|
|
11231
11408
|
else {
|
|
@@ -11270,7 +11447,7 @@ var Axis = /** @class */ (function () {
|
|
|
11270
11447
|
tickFormat = (id === "subX") ? $$.format.subXAxisTick : $$.format.xAxisTick;
|
|
11271
11448
|
}
|
|
11272
11449
|
else {
|
|
11273
|
-
var fn = config["axis_"
|
|
11450
|
+
var fn = config["axis_".concat(id, "_tick_format")];
|
|
11274
11451
|
if (isFunction(fn)) {
|
|
11275
11452
|
tickFormat = fn.bind($$.api);
|
|
11276
11453
|
}
|
|
@@ -11291,7 +11468,7 @@ var Axis = /** @class */ (function () {
|
|
|
11291
11468
|
orgXScale: $$.scale.x
|
|
11292
11469
|
});
|
|
11293
11470
|
if (!isX) {
|
|
11294
|
-
axisParams.tickStepSize = config["axis_"
|
|
11471
|
+
axisParams.tickStepSize = config["axis_".concat(type, "_tick_stepSize")];
|
|
11295
11472
|
}
|
|
11296
11473
|
var axis = new AxisRenderer(axisParams)
|
|
11297
11474
|
.scale((isX && $$.scale.zoom) || scale)
|
|
@@ -11307,14 +11484,14 @@ var Axis = /** @class */ (function () {
|
|
|
11307
11484
|
}
|
|
11308
11485
|
tickValues && axis.tickValues(tickValues);
|
|
11309
11486
|
// Set tick
|
|
11310
|
-
axis.tickFormat(tickFormat || (!isX && ($$.isStackNormalized() && (function (x) { return x
|
|
11487
|
+
axis.tickFormat(tickFormat || (!isX && ($$.isStackNormalized() && (function (x) { return "".concat(x, "%"); }))));
|
|
11311
11488
|
if (isCategory) {
|
|
11312
11489
|
axis.tickCentered(config.axis_x_tick_centered);
|
|
11313
11490
|
if (isEmpty(config.axis_x_tick_culling)) {
|
|
11314
11491
|
config.axis_x_tick_culling = false;
|
|
11315
11492
|
}
|
|
11316
11493
|
}
|
|
11317
|
-
var tickCount = config["axis_"
|
|
11494
|
+
var tickCount = config["axis_".concat(type, "_tick_count")];
|
|
11318
11495
|
tickCount && axis.ticks(tickCount);
|
|
11319
11496
|
return axis;
|
|
11320
11497
|
};
|
|
@@ -11380,13 +11557,13 @@ var Axis = /** @class */ (function () {
|
|
|
11380
11557
|
};
|
|
11381
11558
|
Axis.prototype.getTickValues = function (id) {
|
|
11382
11559
|
var $$ = this.owner;
|
|
11383
|
-
var tickValues = $$.config["axis_"
|
|
11384
|
-
var axis = $$[id
|
|
11560
|
+
var tickValues = $$.config["axis_".concat(id, "_tick_values")];
|
|
11561
|
+
var axis = $$["".concat(id, "Axis")];
|
|
11385
11562
|
return (isFunction(tickValues) ? tickValues.call($$.api) : tickValues) ||
|
|
11386
11563
|
(axis ? axis.tickValues() : undefined);
|
|
11387
11564
|
};
|
|
11388
11565
|
Axis.prototype.getLabelOptionByAxisId = function (id) {
|
|
11389
|
-
return this.owner.config["axis_"
|
|
11566
|
+
return this.owner.config["axis_".concat(id, "_label")];
|
|
11390
11567
|
};
|
|
11391
11568
|
Axis.prototype.getLabelText = function (id) {
|
|
11392
11569
|
var option = this.getLabelOptionByAxisId(id);
|
|
@@ -11397,7 +11574,7 @@ var Axis = /** @class */ (function () {
|
|
|
11397
11574
|
var config = $$.config;
|
|
11398
11575
|
var option = this.getLabelOptionByAxisId(id);
|
|
11399
11576
|
if (isString(option)) {
|
|
11400
|
-
config["axis_"
|
|
11577
|
+
config["axis_".concat(id, "_label")] = text;
|
|
11401
11578
|
}
|
|
11402
11579
|
else if (option) {
|
|
11403
11580
|
option.text = text;
|
|
@@ -11468,7 +11645,7 @@ var Axis = /** @class */ (function () {
|
|
|
11468
11645
|
var config = $$.config;
|
|
11469
11646
|
var isRotated = config.axis_rotated;
|
|
11470
11647
|
var isInner = this.getAxisLabelPosition(id).isInner;
|
|
11471
|
-
var tickRotate = config["axis_"
|
|
11648
|
+
var tickRotate = config["axis_".concat(id, "_tick_rotate")] ? $$.getHorizontalAxisHeight(id) : 0;
|
|
11472
11649
|
var maxTickWidth = this.getMaxTickWidth(id);
|
|
11473
11650
|
var dy;
|
|
11474
11651
|
if (id === "x") {
|
|
@@ -11507,7 +11684,7 @@ var Axis = /** @class */ (function () {
|
|
|
11507
11684
|
}
|
|
11508
11685
|
else {
|
|
11509
11686
|
dy = isInner ?
|
|
11510
|
-
dy[3] : (dy[4] + (config["axis_"
|
|
11687
|
+
dy[3] : (dy[4] + (config["axis_".concat(id, "_inner")] ? 0 : (maxTickWidth + dy[4]))) * (id === "y" ? -1 : 1);
|
|
11511
11688
|
}
|
|
11512
11689
|
}
|
|
11513
11690
|
return dy;
|
|
@@ -11517,13 +11694,13 @@ var Axis = /** @class */ (function () {
|
|
|
11517
11694
|
var config = $$.config, current = $$.state.current, _a = $$.$el, svg = _a.svg, chart = _a.chart;
|
|
11518
11695
|
var currentTickMax = current.maxTickWidths[id];
|
|
11519
11696
|
var maxWidth = 0;
|
|
11520
|
-
if (withoutRecompute || !config["axis_"
|
|
11697
|
+
if (withoutRecompute || !config["axis_".concat(id, "_show")] || $$.filterTargetsToShow().length === 0) {
|
|
11521
11698
|
return currentTickMax.size;
|
|
11522
11699
|
}
|
|
11523
11700
|
if (svg) {
|
|
11524
11701
|
var isYAxis_1 = /^y2?$/.test(id);
|
|
11525
11702
|
var targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
|
11526
|
-
var scale = $$.scale[id].copy().domain($$["get"
|
|
11703
|
+
var scale = $$.scale[id].copy().domain($$["get".concat(isYAxis_1 ? "Y" : "X", "Domain")](targetsToShow, id));
|
|
11527
11704
|
var domain = scale.domain();
|
|
11528
11705
|
var isDomainSame = domain[0] === domain[1] && domain.every(function (v) { return v > 0; });
|
|
11529
11706
|
var isCurrentMaxTickDomainSame = isArray(currentTickMax.domain) &&
|
|
@@ -11541,8 +11718,8 @@ var Axis = /** @class */ (function () {
|
|
|
11541
11718
|
currentTickMax.ticks.splice(0);
|
|
11542
11719
|
}
|
|
11543
11720
|
var axis = this.getAxis(id, scale, false, false, true);
|
|
11544
|
-
var tickCount = config["axis_"
|
|
11545
|
-
var tickValues = config["axis_"
|
|
11721
|
+
var tickCount = config["axis_".concat(id, "_tick_count")];
|
|
11722
|
+
var tickValues = config["axis_".concat(id, "_tick_values")];
|
|
11546
11723
|
// Make to generate the final tick text to be rendered
|
|
11547
11724
|
// https://github.com/naver/billboard.js/issues/920
|
|
11548
11725
|
// Do not generate if 'tick values' option is given
|
|
@@ -11554,8 +11731,8 @@ var Axis = /** @class */ (function () {
|
|
|
11554
11731
|
var dummy = chart.append("svg")
|
|
11555
11732
|
.style("visibility", "hidden")
|
|
11556
11733
|
.style("position", "fixed")
|
|
11557
|
-
.style("top", "
|
|
11558
|
-
.style("left", "
|
|
11734
|
+
.style("top", "0")
|
|
11735
|
+
.style("left", "0");
|
|
11559
11736
|
axis.create(dummy);
|
|
11560
11737
|
dummy.selectAll("text")
|
|
11561
11738
|
.each(function (d, i) {
|
|
@@ -11634,9 +11811,9 @@ var Axis = /** @class */ (function () {
|
|
|
11634
11811
|
var $$ = this.owner;
|
|
11635
11812
|
var main = $$.$el.main, $T = $$.$T;
|
|
11636
11813
|
var labels = {
|
|
11637
|
-
x: main.select("."
|
|
11638
|
-
y: main.select("."
|
|
11639
|
-
y2: main.select("."
|
|
11814
|
+
x: main.select(".".concat(CLASS.axisX, " .").concat(CLASS.axisXLabel)),
|
|
11815
|
+
y: main.select(".".concat(CLASS.axisY, " .").concat(CLASS.axisYLabel)),
|
|
11816
|
+
y2: main.select(".".concat(CLASS.axisY2, " .").concat(CLASS.axisY2Label))
|
|
11640
11817
|
};
|
|
11641
11818
|
Object.keys(labels).filter(function (id) { return !labels[id].empty(); })
|
|
11642
11819
|
.forEach(function (v) {
|
|
@@ -11717,7 +11894,7 @@ var Axis = /** @class */ (function () {
|
|
|
11717
11894
|
axis.config.withoutTransition = true;
|
|
11718
11895
|
}
|
|
11719
11896
|
$axis.style("opacity", opacity);
|
|
11720
|
-
axis.create(transitions["axis"
|
|
11897
|
+
axis.create(transitions["axis".concat(capitalize(id))]);
|
|
11721
11898
|
}
|
|
11722
11899
|
});
|
|
11723
11900
|
this.updateAxes();
|
|
@@ -11758,8 +11935,8 @@ var Axis = /** @class */ (function () {
|
|
|
11758
11935
|
["y", "y2"].forEach(function (key) {
|
|
11759
11936
|
var axisScale = scale[key];
|
|
11760
11937
|
if (axisScale) {
|
|
11761
|
-
var tickValues = config["axis_"
|
|
11762
|
-
var tickCount = config["axis_"
|
|
11938
|
+
var tickValues = config["axis_".concat(key, "_tick_values")];
|
|
11939
|
+
var tickCount = config["axis_".concat(key, "_tick_count")];
|
|
11763
11940
|
axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
|
|
11764
11941
|
if (!tickValues && tickCount) {
|
|
11765
11942
|
var axis = $$.axis[key];
|
|
@@ -11793,12 +11970,14 @@ var Axis = /** @class */ (function () {
|
|
|
11793
11970
|
var axis = $el.axis[type];
|
|
11794
11971
|
// subchart x axis should be aligned with x axis culling
|
|
11795
11972
|
var id = type === "subX" ? "x" : type;
|
|
11796
|
-
var
|
|
11973
|
+
var cullingOptionPrefix = "axis_".concat(id, "_tick_culling");
|
|
11974
|
+
var toCull = config[cullingOptionPrefix];
|
|
11797
11975
|
if (axis && toCull) {
|
|
11798
|
-
var
|
|
11799
|
-
var tickValues_1 = sortValue(
|
|
11976
|
+
var tickNodes = axis.selectAll(".tick");
|
|
11977
|
+
var tickValues_1 = sortValue(tickNodes.data());
|
|
11800
11978
|
var tickSize = tickValues_1.length;
|
|
11801
|
-
var cullingMax = config["
|
|
11979
|
+
var cullingMax = config["".concat(cullingOptionPrefix, "_max")];
|
|
11980
|
+
var lines_1 = config["".concat(cullingOptionPrefix, "_lines")];
|
|
11802
11981
|
var intervalForCulling_1;
|
|
11803
11982
|
if (tickSize) {
|
|
11804
11983
|
for (var i = 1; i < tickSize; i++) {
|
|
@@ -11807,17 +11986,20 @@ var Axis = /** @class */ (function () {
|
|
|
11807
11986
|
break;
|
|
11808
11987
|
}
|
|
11809
11988
|
}
|
|
11810
|
-
|
|
11811
|
-
|
|
11989
|
+
tickNodes.each(function (d) {
|
|
11990
|
+
if (tickValues_1.indexOf(d) % intervalForCulling_1) {
|
|
11991
|
+
(lines_1 ? this.querySelector("text") : this)
|
|
11992
|
+
.style.display = "none";
|
|
11993
|
+
}
|
|
11812
11994
|
});
|
|
11813
11995
|
}
|
|
11814
11996
|
else {
|
|
11815
|
-
|
|
11997
|
+
tickNodes.style("display", null);
|
|
11816
11998
|
}
|
|
11817
11999
|
// set/unset x_axis_tick_clippath
|
|
11818
12000
|
if (type === "x") {
|
|
11819
12001
|
var clipPath = current.maxTickWidths.x.clipPath ? clip.pathXAxisTickTexts : null;
|
|
11820
|
-
$el.svg.selectAll("."
|
|
12002
|
+
$el.svg.selectAll(".".concat(CLASS.axisX, " .tick text"))
|
|
11821
12003
|
.attr("clip-path", clipPath);
|
|
11822
12004
|
}
|
|
11823
12005
|
}
|
|
@@ -11838,7 +12020,7 @@ var eventrect = {
|
|
|
11838
12020
|
*/
|
|
11839
12021
|
initEventRect: function () {
|
|
11840
12022
|
var $$ = this;
|
|
11841
|
-
$$.$el.main.select("."
|
|
12023
|
+
$$.$el.main.select(".".concat(CLASS.chart))
|
|
11842
12024
|
.append("g")
|
|
11843
12025
|
.attr("class", CLASS.eventRects)
|
|
11844
12026
|
.style("fill-opacity", "0");
|
|
@@ -11856,12 +12038,12 @@ var eventrect = {
|
|
|
11856
12038
|
$$.updateEventRect($el.eventRect, true);
|
|
11857
12039
|
}
|
|
11858
12040
|
else {
|
|
11859
|
-
var eventRects = $$.$el.main.select("."
|
|
12041
|
+
var eventRects = $$.$el.main.select(".".concat(CLASS.eventRects))
|
|
11860
12042
|
.style("cursor", config.zoom_enabled && config.zoom_type !== "drag" ? (config.axis_rotated ? "ns-resize" : "ew-resize") : null)
|
|
11861
12043
|
.classed(CLASS.eventRectsMultiple, isMultipleX)
|
|
11862
12044
|
.classed(CLASS.eventRectsSingle, !isMultipleX);
|
|
11863
12045
|
// append event <rect>
|
|
11864
|
-
var eventRectUpdate = eventRects.selectAll("."
|
|
12046
|
+
var eventRectUpdate = eventRects.selectAll(".".concat(CLASS.eventRect))
|
|
11865
12047
|
.data([0])
|
|
11866
12048
|
.enter()
|
|
11867
12049
|
.append("rect");
|
|
@@ -11916,7 +12098,7 @@ var eventrect = {
|
|
|
11916
12098
|
var preventEvent = function (event) {
|
|
11917
12099
|
var eventType = event.type;
|
|
11918
12100
|
var touch = event.changedTouches[0];
|
|
11919
|
-
var currentXY = touch["client"
|
|
12101
|
+
var currentXY = touch["client".concat(config.axis_rotated ? "Y" : "X")];
|
|
11920
12102
|
// prevent document scrolling
|
|
11921
12103
|
if (eventType === "touchstart") {
|
|
11922
12104
|
if (isPrevented) {
|
|
@@ -12105,7 +12287,7 @@ var eventrect = {
|
|
|
12105
12287
|
$$.showGridFocus(selectedData);
|
|
12106
12288
|
// Show cursor as pointer if point is close to mouse position
|
|
12107
12289
|
if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
|
|
12108
|
-
$$.$el.svg.select("."
|
|
12290
|
+
$$.$el.svg.select(".".concat(CLASS.eventRect)).style("cursor", "pointer");
|
|
12109
12291
|
if (!state.mouseover) {
|
|
12110
12292
|
config.data_onover.call($$.api, closest);
|
|
12111
12293
|
state.mouseover = closest;
|
|
@@ -12119,7 +12301,7 @@ var eventrect = {
|
|
|
12119
12301
|
unselectRect: function () {
|
|
12120
12302
|
var $$ = this;
|
|
12121
12303
|
var config = $$.config, _a = $$.$el, circle = _a.circle, tooltip = _a.tooltip;
|
|
12122
|
-
$$.$el.svg.select("."
|
|
12304
|
+
$$.$el.svg.select(".".concat(CLASS.eventRect)).style("cursor", null);
|
|
12123
12305
|
$$.hideGridFocus();
|
|
12124
12306
|
if (tooltip) {
|
|
12125
12307
|
$$.hideTooltip();
|
|
@@ -12215,7 +12397,7 @@ var eventrect = {
|
|
|
12215
12397
|
return;
|
|
12216
12398
|
}
|
|
12217
12399
|
var index = d.index;
|
|
12218
|
-
main.selectAll("."
|
|
12400
|
+
main.selectAll(".".concat(CLASS.shape, "-").concat(index))
|
|
12219
12401
|
.each(function (d2) {
|
|
12220
12402
|
var _a;
|
|
12221
12403
|
if (config.data_selection_grouped || $$.isWithinShape(this, d2)) {
|
|
@@ -12268,8 +12450,8 @@ var eventrect = {
|
|
|
12268
12450
|
}
|
|
12269
12451
|
// select if selection enabled
|
|
12270
12452
|
if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
|
|
12271
|
-
$$.$el.main.selectAll("."
|
|
12272
|
-
.selectAll("."
|
|
12453
|
+
$$.$el.main.selectAll(".".concat(CLASS.shapes).concat($$.getTargetSelectorSuffix(closest.id)))
|
|
12454
|
+
.selectAll(".".concat(CLASS.shape, "-").concat(closest.index))
|
|
12273
12455
|
.each(function () {
|
|
12274
12456
|
var _a;
|
|
12275
12457
|
if (config.data_selection_grouped || $$.isWithinShape(this, closest)) {
|
|
@@ -12378,13 +12560,13 @@ var flow = {
|
|
|
12378
12560
|
["circle", "text", "shape", "eventRect"].forEach(function (v) {
|
|
12379
12561
|
var target = [];
|
|
12380
12562
|
for (var i = 0; i < flowLength; i++) {
|
|
12381
|
-
target.push("."
|
|
12563
|
+
target.push(".".concat(CLASS[v], "-").concat(i));
|
|
12382
12564
|
}
|
|
12383
|
-
svg.selectAll("."
|
|
12565
|
+
svg.selectAll(".".concat(CLASS["".concat(v, "s")])) // circles, shapes, texts, eventRects
|
|
12384
12566
|
.selectAll(target)
|
|
12385
12567
|
.remove();
|
|
12386
12568
|
});
|
|
12387
|
-
svg.select("."
|
|
12569
|
+
svg.select(".".concat(CLASS.xgrid))
|
|
12388
12570
|
.remove();
|
|
12389
12571
|
}
|
|
12390
12572
|
// draw again for removing flowed elements and reverting attr
|
|
@@ -12483,7 +12665,7 @@ var flow = {
|
|
|
12483
12665
|
x(flowStart.x) - x(flowEnd.x);
|
|
12484
12666
|
}
|
|
12485
12667
|
var scaleX = (diffDomain(orgDomain) / diffDomain(domain));
|
|
12486
|
-
return "translate("
|
|
12668
|
+
return "translate(".concat(translateX, ",0) scale(").concat(scaleX, ",1)");
|
|
12487
12669
|
}
|
|
12488
12670
|
};
|
|
12489
12671
|
|
|
@@ -12496,10 +12678,10 @@ var clip = {
|
|
|
12496
12678
|
var $$ = this;
|
|
12497
12679
|
var clip = $$.state.clip;
|
|
12498
12680
|
// MEMO: clipId needs to be unique because it conflicts when multiple charts exist
|
|
12499
|
-
clip.id = $$.state.datetimeId
|
|
12500
|
-
clip.idXAxis = clip.id
|
|
12501
|
-
clip.idYAxis = clip.id
|
|
12502
|
-
clip.idGrid = clip.id
|
|
12681
|
+
clip.id = "".concat($$.state.datetimeId, "-clip");
|
|
12682
|
+
clip.idXAxis = "".concat(clip.id, "-xaxis");
|
|
12683
|
+
clip.idYAxis = "".concat(clip.id, "-yaxis");
|
|
12684
|
+
clip.idGrid = "".concat(clip.id, "-grid");
|
|
12503
12685
|
// Define 'clip-path' attribute values
|
|
12504
12686
|
clip.path = $$.getClipPath(clip.id);
|
|
12505
12687
|
clip.pathXAxis = $$.getClipPath(clip.idXAxis);
|
|
@@ -12517,7 +12699,7 @@ var clip = {
|
|
|
12517
12699
|
var isIE9 = win.navigator ?
|
|
12518
12700
|
win.navigator.appVersion
|
|
12519
12701
|
.toLowerCase().indexOf("msie 9.") >= 0 : false;
|
|
12520
|
-
return "url("
|
|
12702
|
+
return "url(".concat((isIE9 ? "" : doc.URL.split("#")[0]), "#").concat(id, ")");
|
|
12521
12703
|
},
|
|
12522
12704
|
appendClip: function (parent, id) {
|
|
12523
12705
|
id && parent.append("clipPath")
|
|
@@ -12571,7 +12753,7 @@ var clip = {
|
|
|
12571
12753
|
var config = $$.config, _a = $$.state, clip = _a.clip, xAxisHeight = _a.xAxisHeight, defs = $$.$el.defs;
|
|
12572
12754
|
var newXAxisHeight = $$.getHorizontalAxisHeight("x");
|
|
12573
12755
|
if (defs && !clip.idXAxisTickTexts) {
|
|
12574
|
-
var clipId = clip.id
|
|
12756
|
+
var clipId = "".concat(clip.id, "-xaxisticktexts");
|
|
12575
12757
|
$$.appendClip(defs, clipId);
|
|
12576
12758
|
clip.pathXAxisTickTexts = $$.getClipPath(clip.idXAxisTickTexts);
|
|
12577
12759
|
clip.idXAxisTickTexts = clipId;
|
|
@@ -12600,7 +12782,7 @@ var clip = {
|
|
|
12600
12782
|
var $$ = this;
|
|
12601
12783
|
var _a = $$.state, clip = _a.clip, current = _a.current, svg = $$.$el.svg;
|
|
12602
12784
|
if (svg) {
|
|
12603
|
-
svg.select("#"
|
|
12785
|
+
svg.select("#".concat(clip.idXAxisTickTexts, " rect"))
|
|
12604
12786
|
.attr("width", current.maxTickWidths.x.clipPath)
|
|
12605
12787
|
.attr("height", 30);
|
|
12606
12788
|
}
|
|
@@ -12653,7 +12835,7 @@ var grid = {
|
|
|
12653
12835
|
hasGrid: function () {
|
|
12654
12836
|
var config = this.config;
|
|
12655
12837
|
return ["x", "y"]
|
|
12656
|
-
.some(function (v) { return config["grid_"
|
|
12838
|
+
.some(function (v) { return config["grid_".concat(v, "_show")] || config["grid_".concat(v, "_lines")].length; });
|
|
12657
12839
|
},
|
|
12658
12840
|
initGrid: function () {
|
|
12659
12841
|
var $$ = this;
|
|
@@ -12664,9 +12846,9 @@ var grid = {
|
|
|
12664
12846
|
var $$ = this;
|
|
12665
12847
|
var config = $$.config, clip = $$.state.clip, $el = $$.$el;
|
|
12666
12848
|
if (config.grid_x_lines.length || config.grid_y_lines.length) {
|
|
12667
|
-
$el.gridLines.main = $el.main.insert("g", "."
|
|
12849
|
+
$el.gridLines.main = $el.main.insert("g", ".".concat(CLASS.chart).concat(config.grid_lines_front ? " + *" : ""))
|
|
12668
12850
|
.attr("clip-path", clip.pathGrid)
|
|
12669
|
-
.attr("class", CLASS.grid
|
|
12851
|
+
.attr("class", "".concat(CLASS.grid, " ").concat(CLASS.gridLines));
|
|
12670
12852
|
$el.gridLines.main.append("g").attr("class", CLASS.xgridLines);
|
|
12671
12853
|
$el.gridLines.main.append("g").attr("class", CLASS.ygridLines);
|
|
12672
12854
|
$el.gridLines.x = selectAll([]);
|
|
@@ -12690,8 +12872,8 @@ var grid = {
|
|
|
12690
12872
|
"y1": 0,
|
|
12691
12873
|
"y2": state.height
|
|
12692
12874
|
};
|
|
12693
|
-
grid.x = main.select("."
|
|
12694
|
-
.selectAll("."
|
|
12875
|
+
grid.x = main.select(".".concat(CLASS.xgrids))
|
|
12876
|
+
.selectAll(".".concat(CLASS.xgrid))
|
|
12695
12877
|
.data(xgridData);
|
|
12696
12878
|
grid.x.exit().remove();
|
|
12697
12879
|
grid.x = grid.x.enter()
|
|
@@ -12715,8 +12897,8 @@ var grid = {
|
|
|
12715
12897
|
var isRotated = config.axis_rotated;
|
|
12716
12898
|
var gridValues = $$.axis.y.tickValues() || $$.scale.y.ticks(config.grid_y_ticks);
|
|
12717
12899
|
var pos = function (d) { return Math.ceil($$.scale.y(d)); };
|
|
12718
|
-
grid.y = main.select("."
|
|
12719
|
-
.selectAll("."
|
|
12900
|
+
grid.y = main.select(".".concat(CLASS.ygrids))
|
|
12901
|
+
.selectAll(".".concat(CLASS.ygrid))
|
|
12720
12902
|
.data(gridValues);
|
|
12721
12903
|
grid.y.exit().remove();
|
|
12722
12904
|
grid.y = grid.y
|
|
@@ -12749,8 +12931,8 @@ var grid = {
|
|
|
12749
12931
|
var config = $$.config, _a = $$.$el, gridLines = _a.gridLines, main = _a.main, $T = $$.$T;
|
|
12750
12932
|
var isRotated = config.axis_rotated;
|
|
12751
12933
|
config.grid_x_show && $$.updateXGrid();
|
|
12752
|
-
var xLines = main.select("."
|
|
12753
|
-
.selectAll("."
|
|
12934
|
+
var xLines = main.select(".".concat(CLASS.xgridLines))
|
|
12935
|
+
.selectAll(".".concat(CLASS.xgridLine))
|
|
12754
12936
|
.data(config.grid_x_lines);
|
|
12755
12937
|
// exit
|
|
12756
12938
|
$T(xLines.exit())
|
|
@@ -12766,7 +12948,7 @@ var grid = {
|
|
|
12766
12948
|
.style("opacity", "0");
|
|
12767
12949
|
xLines = xgridLine.merge(xLines);
|
|
12768
12950
|
$T(xLines
|
|
12769
|
-
.attr("class", function (d) { return (CLASS.xgridLine
|
|
12951
|
+
.attr("class", function (d) { return "".concat(CLASS.xgridLine, " ").concat(d["class"] || "").trim(); })
|
|
12770
12952
|
.select("text")
|
|
12771
12953
|
.attr("text-anchor", getGridTextAnchor)
|
|
12772
12954
|
.attr("dx", getGridTextDx))
|
|
@@ -12783,8 +12965,8 @@ var grid = {
|
|
|
12783
12965
|
var config = $$.config, _a = $$.state, width = _a.width, height = _a.height, $el = $$.$el, $T = $$.$T;
|
|
12784
12966
|
var isRotated = config.axis_rotated;
|
|
12785
12967
|
config.grid_y_show && $$.updateYGrid();
|
|
12786
|
-
var ygridLines = $el.main.select("."
|
|
12787
|
-
.selectAll("."
|
|
12968
|
+
var ygridLines = $el.main.select(".".concat(CLASS.ygridLines))
|
|
12969
|
+
.selectAll(".".concat(CLASS.ygridLine))
|
|
12788
12970
|
.data(config.grid_y_lines);
|
|
12789
12971
|
// exit
|
|
12790
12972
|
$T(ygridLines.exit())
|
|
@@ -12801,7 +12983,7 @@ var grid = {
|
|
|
12801
12983
|
// update
|
|
12802
12984
|
var yv = $$.yv.bind($$);
|
|
12803
12985
|
$T(ygridLines
|
|
12804
|
-
.attr("class", function (d) { return (CLASS.ygridLine
|
|
12986
|
+
.attr("class", function (d) { return "".concat(CLASS.ygridLine, " ").concat(d["class"] || "").trim(); })
|
|
12805
12987
|
.select("line"))
|
|
12806
12988
|
.attr("x1", isRotated ? yv : 0)
|
|
12807
12989
|
.attr("x2", isRotated ? yv : width)
|
|
@@ -12842,7 +13024,7 @@ var grid = {
|
|
|
12842
13024
|
var $$ = this;
|
|
12843
13025
|
var config = $$.config, clip = $$.state.clip, $el = $$.$el;
|
|
12844
13026
|
var isFront = config.grid_front;
|
|
12845
|
-
var className = "."
|
|
13027
|
+
var className = ".".concat(CLASS[isFront && $el.gridLines.main ? "gridLines" : "chart"]).concat(isFront ? " + *" : "");
|
|
12846
13028
|
var grid = $el.main.insert("g", className)
|
|
12847
13029
|
.attr("clip-path", clip.pathGrid)
|
|
12848
13030
|
.attr("class", CLASS.grid);
|
|
@@ -12875,7 +13057,7 @@ var grid = {
|
|
|
12875
13057
|
var $$ = this;
|
|
12876
13058
|
var config = $$.config, _b = $$.state, width = _b.width, height = _b.height;
|
|
12877
13059
|
var isRotated = config.axis_rotated;
|
|
12878
|
-
var focusEl = $$.$el.main.selectAll("line."
|
|
13060
|
+
var focusEl = $$.$el.main.selectAll("line.".concat(CLASS.xgridFocus, ", line.").concat(CLASS.ygridFocus));
|
|
12879
13061
|
var dataToShow = (data || [focusEl.datum()]).filter(function (d) { return d && isValue($$.getBaseValue(d)); });
|
|
12880
13062
|
// Hide when bubble/scatter/stanford plot exists
|
|
12881
13063
|
if (!config.tooltip_show || dataToShow.length === 0 || $$.hasType("bubble") || $$.hasArcType()) {
|
|
@@ -12934,7 +13116,7 @@ var grid = {
|
|
|
12934
13116
|
var $$ = this;
|
|
12935
13117
|
var _b = $$.state, inputType = _b.inputType, resizing = _b.resizing, main = $$.$el.main;
|
|
12936
13118
|
if (inputType === "mouse" || !resizing) {
|
|
12937
|
-
main.selectAll("line."
|
|
13119
|
+
main.selectAll("line.".concat(CLASS.xgridFocus, ", line.").concat(CLASS.ygridFocus))
|
|
12938
13120
|
.style("visibility", "hidden");
|
|
12939
13121
|
(_a = $$.hideCircleFocus) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
12940
13122
|
}
|
|
@@ -12943,7 +13125,7 @@ var grid = {
|
|
|
12943
13125
|
var _a;
|
|
12944
13126
|
var $$ = this;
|
|
12945
13127
|
var _b = $$.state, inputType = _b.inputType, width = _b.width, height = _b.height, resizing = _b.resizing, grid = $$.$el.grid;
|
|
12946
|
-
var xgridFocus = grid.main.select("line."
|
|
13128
|
+
var xgridFocus = grid.main.select("line.".concat(CLASS.xgridFocus));
|
|
12947
13129
|
if (inputType === "touch") {
|
|
12948
13130
|
if (xgridFocus.empty()) {
|
|
12949
13131
|
resizing && ((_a = $$.showCircleFocus) === null || _a === void 0 ? void 0 : _a.call($$));
|
|
@@ -12966,7 +13148,7 @@ var grid = {
|
|
|
12966
13148
|
},
|
|
12967
13149
|
generateGridData: function (type, scale) {
|
|
12968
13150
|
var $$ = this;
|
|
12969
|
-
var tickNum = $$.$el.main.select("."
|
|
13151
|
+
var tickNum = $$.$el.main.select(".".concat(CLASS.axisX))
|
|
12970
13152
|
.selectAll(".tick")
|
|
12971
13153
|
.size();
|
|
12972
13154
|
var gridData = [];
|
|
@@ -12974,7 +13156,7 @@ var grid = {
|
|
|
12974
13156
|
var xDomain = $$.getXDomain();
|
|
12975
13157
|
var _a = xDomain.map(function (v) { return v.getFullYear(); }), firstYear = _a[0], lastYear = _a[1];
|
|
12976
13158
|
for (var i = firstYear; i <= lastYear; i++) {
|
|
12977
|
-
gridData.push(new Date(i
|
|
13159
|
+
gridData.push(new Date("".concat(i, "-01-01 00:00:00")));
|
|
12978
13160
|
}
|
|
12979
13161
|
}
|
|
12980
13162
|
else {
|
|
@@ -13003,12 +13185,12 @@ var grid = {
|
|
|
13003
13185
|
var toShow = function (line) { return !toRemove(line); };
|
|
13004
13186
|
var classLines = forX ? CLASS.xgridLines : CLASS.ygridLines;
|
|
13005
13187
|
var classLine = forX ? CLASS.xgridLine : CLASS.ygridLine;
|
|
13006
|
-
$T($$.$el.main.select("."
|
|
13007
|
-
.selectAll("."
|
|
13188
|
+
$T($$.$el.main.select(".".concat(classLines))
|
|
13189
|
+
.selectAll(".".concat(classLine))
|
|
13008
13190
|
.filter(toRemove))
|
|
13009
13191
|
.style("opacity", "0")
|
|
13010
13192
|
.remove();
|
|
13011
|
-
var gridLines = "grid_"
|
|
13193
|
+
var gridLines = "grid_".concat(forX ? "x" : "y", "_lines");
|
|
13012
13194
|
config[gridLines] = config[gridLines].filter(toShow);
|
|
13013
13195
|
}
|
|
13014
13196
|
};
|
|
@@ -13036,7 +13218,7 @@ var region = {
|
|
|
13036
13218
|
region.main.style("visibility", $$.hasArcType() ? "hidden" : null);
|
|
13037
13219
|
// select <g> element
|
|
13038
13220
|
var list = region.main
|
|
13039
|
-
.selectAll("."
|
|
13221
|
+
.selectAll(".".concat(CLASS.region))
|
|
13040
13222
|
.data(config.regions);
|
|
13041
13223
|
$T(list.exit())
|
|
13042
13224
|
.style("opacity", "0")
|
|
@@ -13208,7 +13390,7 @@ var sizeAxis = {
|
|
|
13208
13390
|
getAxisTickRotate: function (id) {
|
|
13209
13391
|
var $$ = this;
|
|
13210
13392
|
var axis = $$.axis, config = $$.config, state = $$.state, $el = $$.$el;
|
|
13211
|
-
var rotate = config["axis_"
|
|
13393
|
+
var rotate = config["axis_".concat(id, "_tick_rotate")];
|
|
13212
13394
|
if (id === "x") {
|
|
13213
13395
|
var allowedXAxisTypes = axis.isCategorized() || axis.isTimeSeries();
|
|
13214
13396
|
if (config.axis_x_tick_fit && allowedXAxisTypes) {
|
|
@@ -13536,15 +13718,16 @@ var x = {
|
|
|
13536
13718
|
*/
|
|
13537
13719
|
axis_x_tick_format: undefined,
|
|
13538
13720
|
/**
|
|
13539
|
-
* Setting for culling ticks
|
|
13540
|
-
*
|
|
13541
|
-
*
|
|
13721
|
+
* Setting for culling ticks.
|
|
13722
|
+
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
13723
|
+
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
|
|
13724
|
+
* - `false`: all of ticks will be shown.<br><br>
|
|
13725
|
+
* The number of ticks to be shown can be chaned by `axis.x.tick.culling.max`.
|
|
13542
13726
|
* @name axis․x․tick․culling
|
|
13543
13727
|
* @memberof Options
|
|
13544
13728
|
* @type {boolean}
|
|
13545
13729
|
* @default
|
|
13546
|
-
*
|
|
13547
|
-
* - false for category axis
|
|
13730
|
+
* `true` for indexed axis and timeseries axis, `false` for category axis
|
|
13548
13731
|
* @example
|
|
13549
13732
|
* axis: {
|
|
13550
13733
|
* x: {
|
|
@@ -13573,6 +13756,24 @@ var x = {
|
|
|
13573
13756
|
* }
|
|
13574
13757
|
*/
|
|
13575
13758
|
axis_x_tick_culling_max: 10,
|
|
13759
|
+
/**
|
|
13760
|
+
* Control visibility of tick lines within culling option, along with tick text.
|
|
13761
|
+
* @name axis․x․tick․culling․lines
|
|
13762
|
+
* @memberof Options
|
|
13763
|
+
* @type {boolean}
|
|
13764
|
+
* @default true
|
|
13765
|
+
* @example
|
|
13766
|
+
* axis: {
|
|
13767
|
+
* x: {
|
|
13768
|
+
* tick: {
|
|
13769
|
+
* culling: {
|
|
13770
|
+
* lines: false,
|
|
13771
|
+
* }
|
|
13772
|
+
* }
|
|
13773
|
+
* }
|
|
13774
|
+
* }
|
|
13775
|
+
*/
|
|
13776
|
+
axis_x_tick_culling_lines: true,
|
|
13576
13777
|
/**
|
|
13577
13778
|
* The number of x axis ticks to show.<br><br>
|
|
13578
13779
|
* This option hides tick lines together with tick text. If this option is used on timeseries axis, the ticks position will be determined precisely and not nicely positioned (e.g. it will have rough second value).
|
|
@@ -13649,8 +13850,8 @@ var x = {
|
|
|
13649
13850
|
axis_x_tick_text_position: { x: 0, y: 0 },
|
|
13650
13851
|
/**
|
|
13651
13852
|
* Fit x axis ticks.
|
|
13652
|
-
* - **true**: ticks will be
|
|
13653
|
-
* - **false**: ticks will be
|
|
13853
|
+
* - **true**: ticks will be shown according to x value of the data points.
|
|
13854
|
+
* - **false**: ticks will be shown as to have same intervals.
|
|
13654
13855
|
* @name axis․x․tick․fit
|
|
13655
13856
|
* @memberof Options
|
|
13656
13857
|
* @type {boolean}
|
|
@@ -14214,9 +14415,11 @@ var y = {
|
|
|
14214
14415
|
*/
|
|
14215
14416
|
axis_y_tick_format: undefined,
|
|
14216
14417
|
/**
|
|
14217
|
-
* Setting for culling ticks
|
|
14218
|
-
*
|
|
14219
|
-
*
|
|
14418
|
+
* Setting for culling ticks.
|
|
14419
|
+
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
14420
|
+
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y.tick.culling.lines=false`.
|
|
14421
|
+
* - `false`: all of ticks will be shown.<br><br>
|
|
14422
|
+
* The number of ticks to be shown can be chaned by `axis.y.tick.culling.max`.
|
|
14220
14423
|
* @name axis․y․tick․culling
|
|
14221
14424
|
* @memberof Options
|
|
14222
14425
|
* @type {boolean}
|
|
@@ -14249,6 +14452,24 @@ var y = {
|
|
|
14249
14452
|
* }
|
|
14250
14453
|
*/
|
|
14251
14454
|
axis_y_tick_culling_max: 5,
|
|
14455
|
+
/**
|
|
14456
|
+
* Control visibility of tick lines within culling option, along with tick text.
|
|
14457
|
+
* @name axis․y․tick․culling․lines
|
|
14458
|
+
* @memberof Options
|
|
14459
|
+
* @type {boolean}
|
|
14460
|
+
* @default true
|
|
14461
|
+
* @example
|
|
14462
|
+
* axis: {
|
|
14463
|
+
* y: {
|
|
14464
|
+
* tick: {
|
|
14465
|
+
* culling: {
|
|
14466
|
+
* lines: false,
|
|
14467
|
+
* }
|
|
14468
|
+
* }
|
|
14469
|
+
* }
|
|
14470
|
+
* }
|
|
14471
|
+
*/
|
|
14472
|
+
axis_y_tick_culling_lines: true,
|
|
14252
14473
|
/**
|
|
14253
14474
|
* Show y axis outer tick.
|
|
14254
14475
|
* @name axis․y․tick․outer
|
|
@@ -14668,9 +14889,11 @@ var y2 = {
|
|
|
14668
14889
|
*/
|
|
14669
14890
|
axis_y2_tick_format: undefined,
|
|
14670
14891
|
/**
|
|
14671
|
-
* Setting for culling ticks
|
|
14672
|
-
*
|
|
14673
|
-
*
|
|
14892
|
+
* Setting for culling ticks.
|
|
14893
|
+
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
14894
|
+
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y2.tick.culling.lines=false`.
|
|
14895
|
+
* - `false`: all of ticks will be shown.<br><br>
|
|
14896
|
+
* The number of ticks to be shown can be chaned by `axis.y2.tick.culling.max`.
|
|
14674
14897
|
* @name axis․y2․tick․culling
|
|
14675
14898
|
* @memberof Options
|
|
14676
14899
|
* @type {boolean}
|
|
@@ -14703,6 +14926,24 @@ var y2 = {
|
|
|
14703
14926
|
* }
|
|
14704
14927
|
*/
|
|
14705
14928
|
axis_y2_tick_culling_max: 5,
|
|
14929
|
+
/**
|
|
14930
|
+
* Control visibility of tick lines within culling option, along with tick text.
|
|
14931
|
+
* @name axis․y2․tick․culling․lines
|
|
14932
|
+
* @memberof Options
|
|
14933
|
+
* @type {boolean}
|
|
14934
|
+
* @default true
|
|
14935
|
+
* @example
|
|
14936
|
+
* axis: {
|
|
14937
|
+
* y2: {
|
|
14938
|
+
* tick: {
|
|
14939
|
+
* culling: {
|
|
14940
|
+
* lines: false,
|
|
14941
|
+
* }
|
|
14942
|
+
* }
|
|
14943
|
+
* }
|
|
14944
|
+
* }
|
|
14945
|
+
*/
|
|
14946
|
+
axis_y2_tick_culling_lines: true,
|
|
14706
14947
|
/**
|
|
14707
14948
|
* Show or hide y2 axis outer tick.
|
|
14708
14949
|
* @name axis․y2․tick․outer
|
|
@@ -15059,9 +15300,9 @@ var shapeArc = {
|
|
|
15059
15300
|
var config = $$.config;
|
|
15060
15301
|
var dataType = config.data_type;
|
|
15061
15302
|
var padding = config.pie_padding;
|
|
15062
|
-
var startingAngle = config[dataType
|
|
15303
|
+
var startingAngle = config["".concat(dataType, "_startingAngle")] || 0;
|
|
15063
15304
|
var padAngle = ($$.hasType("pie") && padding ? padding * 0.01 :
|
|
15064
|
-
config[dataType
|
|
15305
|
+
config["".concat(dataType, "_padAngle")]) || 0;
|
|
15065
15306
|
$$.pie = pie$1()
|
|
15066
15307
|
.startAngle(startingAngle)
|
|
15067
15308
|
.endAngle(startingAngle + (2 * Math.PI))
|
|
@@ -15268,7 +15509,7 @@ var shapeArc = {
|
|
|
15268
15509
|
var y1 = Math.sin(updated.endAngle - Math.PI / 2);
|
|
15269
15510
|
var x = Math.cos(updated.endAngle - Math.PI / 2) * (radiusExpanded + 25);
|
|
15270
15511
|
var y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
|
|
15271
|
-
translate = "translate("
|
|
15512
|
+
translate = "translate(".concat(x, ",").concat(y, ")");
|
|
15272
15513
|
}
|
|
15273
15514
|
else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
15274
15515
|
var outerRadius = $$.getRadius(d).outerRadius;
|
|
@@ -15283,7 +15524,7 @@ var shapeArc = {
|
|
|
15283
15524
|
else {
|
|
15284
15525
|
ratio = outerRadius && (h ? (36 / outerRadius > 0.375 ? 1.175 - 36 / outerRadius : 0.8) * outerRadius / h : 0);
|
|
15285
15526
|
}
|
|
15286
|
-
translate = "translate("
|
|
15527
|
+
translate = "translate(".concat(x * ratio, ",").concat(y * ratio, ")");
|
|
15287
15528
|
}
|
|
15288
15529
|
}
|
|
15289
15530
|
return translate;
|
|
@@ -15327,14 +15568,14 @@ var shapeArc = {
|
|
|
15327
15568
|
var interval_1 = setInterval(function () {
|
|
15328
15569
|
if (!transiting) {
|
|
15329
15570
|
clearInterval(interval_1);
|
|
15330
|
-
$el.legend.selectAll("."
|
|
15571
|
+
$el.legend.selectAll(".".concat(CLASS.legendItemFocused)).size() > 0 &&
|
|
15331
15572
|
$$.expandArc(targetIds);
|
|
15332
15573
|
}
|
|
15333
15574
|
}, 10);
|
|
15334
15575
|
return;
|
|
15335
15576
|
}
|
|
15336
15577
|
var newTargetIds = $$.mapToTargetIds(targetIds);
|
|
15337
|
-
$el.svg.selectAll($$.selectorTargets(newTargetIds, "."
|
|
15578
|
+
$el.svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(CLASS.chartArc)))
|
|
15338
15579
|
.each(function (d) {
|
|
15339
15580
|
if (!$$.shouldExpand(d.data.id)) {
|
|
15340
15581
|
return;
|
|
@@ -15357,12 +15598,12 @@ var shapeArc = {
|
|
|
15357
15598
|
return;
|
|
15358
15599
|
}
|
|
15359
15600
|
var newTargetIds = $$.mapToTargetIds(targetIds);
|
|
15360
|
-
svg.selectAll($$.selectorTargets(newTargetIds, "."
|
|
15601
|
+
svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(CLASS.chartArc)))
|
|
15361
15602
|
.selectAll("path")
|
|
15362
15603
|
.transition()
|
|
15363
15604
|
.duration(function (d) { return $$.getExpandConfig(d.data.id, "duration"); })
|
|
15364
15605
|
.attr("d", $$.svgArc);
|
|
15365
|
-
svg.selectAll(""
|
|
15606
|
+
svg.selectAll("".concat(CLASS.arc))
|
|
15366
15607
|
.style("opacity", null);
|
|
15367
15608
|
},
|
|
15368
15609
|
/**
|
|
@@ -15389,7 +15630,7 @@ var shapeArc = {
|
|
|
15389
15630
|
else if ($$.isPieType(id)) {
|
|
15390
15631
|
type = "pie";
|
|
15391
15632
|
}
|
|
15392
|
-
return type ? config[type
|
|
15633
|
+
return type ? config["".concat(type, "_expand_").concat(key)] : def[key];
|
|
15393
15634
|
},
|
|
15394
15635
|
shouldExpand: function (id) {
|
|
15395
15636
|
var $$ = this;
|
|
@@ -15402,7 +15643,7 @@ var shapeArc = {
|
|
|
15402
15643
|
var $$ = this;
|
|
15403
15644
|
var config = $$.config;
|
|
15404
15645
|
return ["pie", "donut", "gauge"]
|
|
15405
|
-
.some(function (v) { return $$.hasType(v) && config[v
|
|
15646
|
+
.some(function (v) { return $$.hasType(v) && config["".concat(v, "_label_show")]; });
|
|
15406
15647
|
},
|
|
15407
15648
|
getArcLabelFormat: function () {
|
|
15408
15649
|
var $$ = this;
|
|
@@ -15419,7 +15660,7 @@ var shapeArc = {
|
|
|
15419
15660
|
getArcTitle: function () {
|
|
15420
15661
|
var $$ = this;
|
|
15421
15662
|
var type = ($$.hasType("donut") && "donut") || ($$.hasType("gauge") && "gauge");
|
|
15422
|
-
return type ? $$.config[type
|
|
15663
|
+
return type ? $$.config["".concat(type, "_title")] : "";
|
|
15423
15664
|
},
|
|
15424
15665
|
updateTargetsForArc: function (targets) {
|
|
15425
15666
|
var $$ = this;
|
|
@@ -15428,9 +15669,9 @@ var shapeArc = {
|
|
|
15428
15669
|
var classChartArc = $$.getChartClass("Arc");
|
|
15429
15670
|
var classArcs = $$.getClass("arcs", true);
|
|
15430
15671
|
var classFocus = $$.classFocus.bind($$);
|
|
15431
|
-
var chartArcs = $el.main.select("."
|
|
15672
|
+
var chartArcs = $el.main.select(".".concat(CLASS.chartArcs));
|
|
15432
15673
|
var mainPieUpdate = chartArcs
|
|
15433
|
-
.selectAll("."
|
|
15674
|
+
.selectAll(".".concat(CLASS.chartArc))
|
|
15434
15675
|
.data($$.pie(targets))
|
|
15435
15676
|
.attr("class", function (d) { return classChartArc(d) + classFocus(d.data); });
|
|
15436
15677
|
var mainPieEnter = mainPieUpdate.enter().append("g")
|
|
@@ -15443,14 +15684,14 @@ var shapeArc = {
|
|
|
15443
15684
|
.style("opacity", "0")
|
|
15444
15685
|
.style("text-anchor", "middle")
|
|
15445
15686
|
.style("pointer-events", "none");
|
|
15446
|
-
$el.text = chartArcs.selectAll("."
|
|
15687
|
+
$el.text = chartArcs.selectAll(".".concat(CLASS.target, " text"));
|
|
15447
15688
|
// MEMO: can not keep same color..., but not bad to update color in redraw
|
|
15448
15689
|
// mainPieUpdate.exit().remove();
|
|
15449
15690
|
},
|
|
15450
15691
|
initArc: function () {
|
|
15451
15692
|
var $$ = this;
|
|
15452
15693
|
var $el = $$.$el;
|
|
15453
|
-
$el.arcs = $el.main.select("."
|
|
15694
|
+
$el.arcs = $el.main.select(".".concat(CLASS.chart))
|
|
15454
15695
|
.append("g")
|
|
15455
15696
|
.attr("class", CLASS.chartArcs)
|
|
15456
15697
|
.attr("transform", $$.getTranslate("arc"));
|
|
@@ -15468,11 +15709,7 @@ var shapeArc = {
|
|
|
15468
15709
|
var text = $$.$el.arcs.append("text")
|
|
15469
15710
|
.attr("class", CLASS[hasGauge ? "chartArcsGaugeTitle" : "chartArcsTitle"])
|
|
15470
15711
|
.style("text-anchor", "middle");
|
|
15471
|
-
|
|
15472
|
-
text
|
|
15473
|
-
.attr("dy", "-0.3em")
|
|
15474
|
-
.style("font-size", "27px");
|
|
15475
|
-
}
|
|
15712
|
+
hasGauge && text.attr("dy", "-0.3em");
|
|
15476
15713
|
setTextValue(text, title, hasGauge ? undefined : [-0.6, 1.35], true);
|
|
15477
15714
|
}
|
|
15478
15715
|
},
|
|
@@ -15481,8 +15718,8 @@ var shapeArc = {
|
|
|
15481
15718
|
var config = $$.config, state = $$.state, main = $$.$el.main;
|
|
15482
15719
|
var hasInteraction = config.interaction_enabled;
|
|
15483
15720
|
var isSelectable = hasInteraction && config.data_selection_isselectable;
|
|
15484
|
-
var mainArc = main.selectAll("."
|
|
15485
|
-
.selectAll("."
|
|
15721
|
+
var mainArc = main.selectAll(".".concat(CLASS.arcs))
|
|
15722
|
+
.selectAll(".".concat(CLASS.arc))
|
|
15486
15723
|
.data($$.arcData.bind($$));
|
|
15487
15724
|
mainArc.exit()
|
|
15488
15725
|
.transition()
|
|
@@ -15571,15 +15808,15 @@ var shapeArc = {
|
|
|
15571
15808
|
var isFullCircle = config.gauge_fullCircle;
|
|
15572
15809
|
var startAngle = $$.getStartAngle();
|
|
15573
15810
|
var endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1;
|
|
15574
|
-
var backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : ""
|
|
15811
|
+
var backgroundArc = $$.$el.arcs.select("".concat(hasMultiArcGauge ? "g" : "", ".").concat(CLASS.chartArcsBackground));
|
|
15575
15812
|
if (hasMultiArcGauge) {
|
|
15576
15813
|
var index_1 = 0;
|
|
15577
15814
|
backgroundArc = backgroundArc
|
|
15578
|
-
.selectAll("path."
|
|
15815
|
+
.selectAll("path.".concat(CLASS.chartArcsBackground))
|
|
15579
15816
|
.data($$.data.targets);
|
|
15580
15817
|
backgroundArc.enter()
|
|
15581
15818
|
.append("path")
|
|
15582
|
-
.attr("class", function (d, i) { return CLASS.chartArcsBackground
|
|
15819
|
+
.attr("class", function (d, i) { return "".concat(CLASS.chartArcsBackground, " ").concat(CLASS.chartArcsBackground, "-").concat(i); })
|
|
15583
15820
|
.merge(backgroundArc)
|
|
15584
15821
|
.style("fill", (config.gauge_background) || null)
|
|
15585
15822
|
.attr("d", function (_a) {
|
|
@@ -15683,6 +15920,7 @@ var shapeArc = {
|
|
|
15683
15920
|
if (state.transiting) { // skip while transiting
|
|
15684
15921
|
return;
|
|
15685
15922
|
}
|
|
15923
|
+
state.event = event;
|
|
15686
15924
|
var eventArc = getEventArc_1(event);
|
|
15687
15925
|
var datum = eventArc.datum();
|
|
15688
15926
|
var updated = ((datum === null || datum === void 0 ? void 0 : datum.data) && datum.data.id) ? $$.updateAngle(datum) : null;
|
|
@@ -15702,35 +15940,35 @@ var shapeArc = {
|
|
|
15702
15940
|
var text;
|
|
15703
15941
|
// for gauge type, update text when has no title & multi data
|
|
15704
15942
|
if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) {
|
|
15705
|
-
text = main.selectAll("."
|
|
15943
|
+
text = main.selectAll(".".concat(CLASS.chartArc))
|
|
15706
15944
|
.select("text")
|
|
15707
15945
|
.style("opacity", "0")
|
|
15708
15946
|
.attr("class", function (d) { return ($$.isGaugeType(d.data) ? CLASS.gaugeValue : null); })
|
|
15709
15947
|
.call($$.textForArcLabel.bind($$))
|
|
15710
15948
|
.attr("transform", $$.transformForArcLabel.bind($$))
|
|
15711
15949
|
.style("font-size", function (d) { return ($$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ?
|
|
15712
|
-
Math.round(state.radius / 5)
|
|
15950
|
+
"".concat(Math.round(state.radius / 5), "px") : null); })
|
|
15713
15951
|
.transition()
|
|
15714
15952
|
.duration(duration)
|
|
15715
15953
|
.style("opacity", function (d) { return ($$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? null : "0"); });
|
|
15716
15954
|
hasMultiArcGauge && text.attr("dy", "-.1em");
|
|
15717
15955
|
}
|
|
15718
|
-
main.select("."
|
|
15956
|
+
main.select(".".concat(CLASS.chartArcsTitle))
|
|
15719
15957
|
.style("opacity", $$.hasType("donut") || hasGauge ? null : "0");
|
|
15720
15958
|
if (hasGauge) {
|
|
15721
15959
|
var isFullCircle = config.gauge_fullCircle;
|
|
15722
|
-
isFullCircle && (text === null || text === void 0 ? void 0 : text.attr("dy", ""
|
|
15960
|
+
isFullCircle && (text === null || text === void 0 ? void 0 : text.attr("dy", "".concat(hasMultiArcGauge ? 0 : Math.round(state.radius / 14))));
|
|
15723
15961
|
if (config.gauge_label_show) {
|
|
15724
|
-
arcs.select("."
|
|
15725
|
-
.attr("dy", (isFullCircle ? 1.5 : 0.75
|
|
15962
|
+
arcs.select(".".concat(CLASS.chartArcsGaugeUnit))
|
|
15963
|
+
.attr("dy", "".concat(isFullCircle ? 1.5 : 0.75, "em"))
|
|
15726
15964
|
.text(config.gauge_units);
|
|
15727
|
-
arcs.select("."
|
|
15728
|
-
.attr("dx", -1 * (state.innerRadius + ((state.radius - state.innerRadius) / (isFullCircle ? 1 : 2)))
|
|
15965
|
+
arcs.select(".".concat(CLASS.chartArcsGaugeMin))
|
|
15966
|
+
.attr("dx", "".concat(-1 * (state.innerRadius + ((state.radius - state.innerRadius) / (isFullCircle ? 1 : 2))), "px"))
|
|
15729
15967
|
.attr("dy", "1.2em")
|
|
15730
15968
|
.text($$.textForGaugeMinMax(config.gauge_min, false));
|
|
15731
15969
|
// show max text when isn't fullCircle
|
|
15732
|
-
!isFullCircle && arcs.select("."
|
|
15733
|
-
.attr("dx", state.innerRadius + ((state.radius - state.innerRadius) / 2)
|
|
15970
|
+
!isFullCircle && arcs.select(".".concat(CLASS.chartArcsGaugeMax))
|
|
15971
|
+
.attr("dx", "".concat(state.innerRadius + ((state.radius - state.innerRadius) / 2), "px"))
|
|
15734
15972
|
.attr("dy", "1.2em")
|
|
15735
15973
|
.text($$.textForGaugeMinMax(config.gauge_max, true));
|
|
15736
15974
|
}
|
|
@@ -15747,19 +15985,19 @@ var shapeArea = {
|
|
|
15747
15985
|
var $$ = this;
|
|
15748
15986
|
var config = $$.config;
|
|
15749
15987
|
mainLine
|
|
15750
|
-
.insert("g", "."
|
|
15988
|
+
.insert("g", ".".concat(CLASS[config.area_front ? "circles" : "lines"]))
|
|
15751
15989
|
.attr("class", $$.getClass("areas", true));
|
|
15752
15990
|
},
|
|
15753
15991
|
updateAreaGradient: function () {
|
|
15754
15992
|
var $$ = this;
|
|
15755
15993
|
var config = $$.config, datetimeId = $$.state.datetimeId, defs = $$.$el.defs;
|
|
15756
15994
|
$$.data.targets.forEach(function (d) {
|
|
15757
|
-
var id = datetimeId
|
|
15758
|
-
if ($$.isAreaType(d) && defs.select("#"
|
|
15995
|
+
var id = "".concat(datetimeId, "-areaGradient").concat($$.getTargetSelectorSuffix(d.id));
|
|
15996
|
+
if ($$.isAreaType(d) && defs.select("#".concat(id)).empty()) {
|
|
15759
15997
|
var color_1 = $$.color(d);
|
|
15760
15998
|
var _a = config.area_linearGradient, _b = _a.x, x = _b === void 0 ? [0, 0] : _b, _c = _a.y, y = _c === void 0 ? [0, 1] : _c, _d = _a.stops, stops = _d === void 0 ? [[0, color_1, 1], [1, color_1, 0]] : _d;
|
|
15761
15999
|
var linearGradient_1 = defs.append("linearGradient")
|
|
15762
|
-
.attr("id", ""
|
|
16000
|
+
.attr("id", "".concat(id))
|
|
15763
16001
|
.attr("x1", x[0])
|
|
15764
16002
|
.attr("x2", x[1])
|
|
15765
16003
|
.attr("y1", y[0])
|
|
@@ -15777,7 +16015,7 @@ var shapeArea = {
|
|
|
15777
16015
|
updateAreaColor: function (d) {
|
|
15778
16016
|
var $$ = this;
|
|
15779
16017
|
return $$.config.area_linearGradient ?
|
|
15780
|
-
"url(#"
|
|
16018
|
+
"url(#".concat($$.state.datetimeId, "-areaGradient").concat($$.getTargetSelectorSuffix(d.id), ")") :
|
|
15781
16019
|
$$.color(d);
|
|
15782
16020
|
},
|
|
15783
16021
|
/**
|
|
@@ -15792,8 +16030,8 @@ var shapeArea = {
|
|
|
15792
16030
|
var config = $$.config, state = $$.state, $el = $$.$el, $T = $$.$T;
|
|
15793
16031
|
var $root = isSub ? $el.subchart : $el;
|
|
15794
16032
|
config.area_linearGradient && $$.updateAreaGradient();
|
|
15795
|
-
var area = $root.main.selectAll("."
|
|
15796
|
-
.selectAll("."
|
|
16033
|
+
var area = $root.main.selectAll(".".concat(CLASS.areas))
|
|
16034
|
+
.selectAll(".".concat(CLASS.area))
|
|
15797
16035
|
.data($$.lineData.bind($$));
|
|
15798
16036
|
$T(area.exit(), withTransition)
|
|
15799
16037
|
.style("opacity", "0")
|
|
@@ -15878,7 +16116,7 @@ var shapeArea = {
|
|
|
15878
16116
|
x0 = $$.scale.x(values[0].x);
|
|
15879
16117
|
y0 = $$.getYScaleById(d.id)(values[0].value);
|
|
15880
16118
|
}
|
|
15881
|
-
path = isRotated ? "M "
|
|
16119
|
+
path = isRotated ? "M ".concat(y0, " ").concat(x0) : "M ".concat(x0, " ").concat(y0);
|
|
15882
16120
|
}
|
|
15883
16121
|
return path || "M 0 0";
|
|
15884
16122
|
};
|
|
@@ -15911,17 +16149,18 @@ var shapeArea = {
|
|
|
15911
16149
|
}
|
|
15912
16150
|
};
|
|
15913
16151
|
|
|
15914
|
-
/**
|
|
15915
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
15916
|
-
* billboard.js project is licensed under the MIT license
|
|
15917
|
-
*/
|
|
15918
16152
|
var shapeBar = {
|
|
15919
16153
|
initBar: function () {
|
|
15920
|
-
var $el =
|
|
15921
|
-
$el.bar = $el.main.select("."
|
|
16154
|
+
var _a = this, $el = _a.$el, config = _a.config, clip = _a.state.clip;
|
|
16155
|
+
$el.bar = $el.main.select(".".concat(CLASS.chart))
|
|
15922
16156
|
// should positioned at the beginning of the shape node to not overlap others
|
|
15923
16157
|
.insert("g", ":first-child")
|
|
15924
16158
|
.attr("class", CLASS.chartBars);
|
|
16159
|
+
// set clip-path attribute when condition meet
|
|
16160
|
+
// https://github.com/naver/billboard.js/issues/2421
|
|
16161
|
+
if (config.clipPath === false && (config.bar_radius || config.bar_radius_ratio)) {
|
|
16162
|
+
$el.bar.attr("clip-path", clip.pathXAxis.replace(/#[^)]*/, "#".concat(clip.id)));
|
|
16163
|
+
}
|
|
15925
16164
|
},
|
|
15926
16165
|
updateTargetsForBar: function (targets) {
|
|
15927
16166
|
var $$ = this;
|
|
@@ -15933,11 +16172,11 @@ var shapeBar = {
|
|
|
15933
16172
|
if (!$el.bar) {
|
|
15934
16173
|
$$.initBar();
|
|
15935
16174
|
}
|
|
15936
|
-
var mainBarUpdate = $$.$el.main.select("."
|
|
15937
|
-
.selectAll("."
|
|
16175
|
+
var mainBarUpdate = $$.$el.main.select(".".concat(CLASS.chartBars))
|
|
16176
|
+
.selectAll(".".concat(CLASS.chartBar))
|
|
15938
16177
|
.data(
|
|
15939
16178
|
// remove
|
|
15940
|
-
targets.filter(function (v) { return
|
|
16179
|
+
targets.filter(function (v) { return v.values.some(function (d) { return (isNumber(d.value) || $$.isBarRangeType(d)); }); }))
|
|
15941
16180
|
.attr("class", function (d) { return classChartBar(d) + classFocus(d); });
|
|
15942
16181
|
var mainBarEnter = mainBarUpdate.enter().append("g")
|
|
15943
16182
|
.attr("class", classChartBar)
|
|
@@ -15961,8 +16200,8 @@ var shapeBar = {
|
|
|
15961
16200
|
var $root = isSub ? $el.subchart : $el;
|
|
15962
16201
|
var classBar = $$.getClass("bar", true);
|
|
15963
16202
|
var initialOpacity = $$.initialOpacity.bind($$);
|
|
15964
|
-
var bar = $root.main.selectAll("."
|
|
15965
|
-
.selectAll("."
|
|
16203
|
+
var bar = $root.main.selectAll(".".concat(CLASS.bars))
|
|
16204
|
+
.selectAll(".".concat(CLASS.bar))
|
|
15966
16205
|
.data($$.labelishData.bind($$));
|
|
15967
16206
|
$T(bar.exit(), withTransition)
|
|
15968
16207
|
.style("opacity", "0")
|
|
@@ -15975,7 +16214,7 @@ var shapeBar = {
|
|
|
15975
16214
|
},
|
|
15976
16215
|
/**
|
|
15977
16216
|
* Redraw function
|
|
15978
|
-
* @param {Function} drawFn Retuned
|
|
16217
|
+
* @param {Function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
|
|
15979
16218
|
* @param {boolean} withTransition With or without transition
|
|
15980
16219
|
* @param {boolean} isSub Subchart draw
|
|
15981
16220
|
* @returns {Array}
|
|
@@ -15986,17 +16225,36 @@ var shapeBar = {
|
|
|
15986
16225
|
var bar = (isSub ? $$.$el.subchart : $$.$el).bar;
|
|
15987
16226
|
return [
|
|
15988
16227
|
$$.$T(bar, withTransition, getRandom())
|
|
15989
|
-
.attr("d", function (d) { return isNumber(d.value) && drawFn(d); })
|
|
16228
|
+
.attr("d", function (d) { return (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d); })
|
|
15990
16229
|
.style("fill", this.color)
|
|
15991
16230
|
.style("opacity", null)
|
|
15992
16231
|
];
|
|
15993
16232
|
},
|
|
16233
|
+
/**
|
|
16234
|
+
* Generate draw function
|
|
16235
|
+
* @param {object} barIndices data order within x axis.
|
|
16236
|
+
* barIndices ==> {data1: 0, data2: 0, data3: 1, data4: 1, __max__: 1}
|
|
16237
|
+
*
|
|
16238
|
+
* When gropus given as:
|
|
16239
|
+
* groups: [
|
|
16240
|
+
* ["data1", "data2"],
|
|
16241
|
+
* ["data3", "data4"]
|
|
16242
|
+
* ],
|
|
16243
|
+
*
|
|
16244
|
+
* Will be rendered as:
|
|
16245
|
+
* data1 data3 data1 data3
|
|
16246
|
+
* data2 data4 data2 data4
|
|
16247
|
+
* -------------------------
|
|
16248
|
+
* 0 1
|
|
16249
|
+
* @param {boolean} isSub If is for subchart
|
|
16250
|
+
* @returns {Function}
|
|
16251
|
+
* @private
|
|
16252
|
+
*/
|
|
15994
16253
|
generateDrawBar: function (barIndices, isSub) {
|
|
15995
16254
|
var $$ = this;
|
|
15996
16255
|
var config = $$.config;
|
|
15997
16256
|
var getPoints = $$.generateGetBarPoints(barIndices, isSub);
|
|
15998
16257
|
var isRotated = config.axis_rotated;
|
|
15999
|
-
var isGrouped = config.data_groups.length;
|
|
16000
16258
|
var barRadius = config.bar_radius;
|
|
16001
16259
|
var barRadiusRatio = config.bar_radius_ratio;
|
|
16002
16260
|
// get the bar radius
|
|
@@ -16011,23 +16269,54 @@ var shapeBar = {
|
|
|
16011
16269
|
var isNegative = d.value < 0;
|
|
16012
16270
|
var pathRadius = ["", ""];
|
|
16013
16271
|
var radius = 0;
|
|
16014
|
-
|
|
16272
|
+
var isGrouped = $$.isGrouped(d.id);
|
|
16273
|
+
var hasRadius = d.value !== 0 && getRadius;
|
|
16274
|
+
var isRadiusData = hasRadius && isGrouped ? $$.isStackingRadiusData(d) : false;
|
|
16275
|
+
if (hasRadius && (!isGrouped || isRadiusData)) {
|
|
16015
16276
|
var index = isRotated ? indexY : indexX;
|
|
16016
16277
|
var barW = points[2][index] - points[0][index];
|
|
16017
16278
|
radius = getRadius(barW);
|
|
16018
|
-
var arc = "a"
|
|
16019
|
-
pathRadius[+!isRotated] = ""
|
|
16020
|
-
pathRadius[+isRotated] = ""
|
|
16279
|
+
var arc = "a".concat(radius, ",").concat(radius, " ").concat(isNegative ? "1 0 0" : "0 0 1", " ");
|
|
16280
|
+
pathRadius[+!isRotated] = "".concat(arc).concat(radius, ",").concat(radius);
|
|
16281
|
+
pathRadius[+isRotated] = "".concat(arc).concat([-radius, radius][isRotated ? "sort" : "reverse"]());
|
|
16021
16282
|
isNegative && pathRadius.reverse();
|
|
16022
16283
|
}
|
|
16023
16284
|
// path string data shouldn't be containing new line chars
|
|
16024
16285
|
// https://github.com/naver/billboard.js/issues/530
|
|
16025
16286
|
var path = isRotated ?
|
|
16026
|
-
"H"
|
|
16027
|
-
"V"
|
|
16028
|
-
return "M"
|
|
16287
|
+
"H".concat(points[1][indexX] - radius, " ").concat(pathRadius[0], "V").concat(points[2][indexY] - radius, " ").concat(pathRadius[1], "H").concat(points[3][indexX]) :
|
|
16288
|
+
"V".concat(points[1][indexY] + (isNegative ? -radius : radius), " ").concat(pathRadius[0], "H").concat(points[2][indexX] - radius, " ").concat(pathRadius[1], "V").concat(points[3][indexY]);
|
|
16289
|
+
return "M".concat(points[0][indexX], ",").concat(points[0][indexY]).concat(path, "z");
|
|
16029
16290
|
};
|
|
16030
16291
|
},
|
|
16292
|
+
/**
|
|
16293
|
+
* Determine if given stacking bar data is radius type
|
|
16294
|
+
* @param {Object} d Data row
|
|
16295
|
+
* @returns {boolean}
|
|
16296
|
+
*/
|
|
16297
|
+
isStackingRadiusData: function (d) {
|
|
16298
|
+
var $$ = this;
|
|
16299
|
+
var config = $$.config, data = $$.data;
|
|
16300
|
+
var id = d.id, index = d.index, value = d.value;
|
|
16301
|
+
// Find same grouped ids
|
|
16302
|
+
var keys = config.data_groups.find(function (v) { return v.indexOf(id) > -1; });
|
|
16303
|
+
// Get sorted list
|
|
16304
|
+
var sortedList = $$.orderTargets($$.filterTargetsToShow(data.targets.filter($$.isBarType, $$))).filter(function (v) { return keys.indexOf(v.id) > -1; });
|
|
16305
|
+
// Get sorted Ids. Filter positive or negative values Ids from given value
|
|
16306
|
+
var sortedIds = sortedList
|
|
16307
|
+
.map(function (v) { return v.values.filter(function (v2) { return v2.index === index && (value > 0 ? v2.value > 0 : v2.value < 0); })[0]; })
|
|
16308
|
+
.filter(Boolean)
|
|
16309
|
+
.map(function (v) { return v.id; });
|
|
16310
|
+
// If the given id stays in the last position, then radius should be applied.
|
|
16311
|
+
return value !== 0 && (sortedIds.indexOf(id) === sortedIds.length - 1);
|
|
16312
|
+
},
|
|
16313
|
+
/**
|
|
16314
|
+
* Generate bar coordinate points data
|
|
16315
|
+
* @param {object} barIndices Data order within x axis.
|
|
16316
|
+
* @param {boolean} isSub If is for subchart
|
|
16317
|
+
* @returns {Array} Array of coordinate points
|
|
16318
|
+
* @private
|
|
16319
|
+
*/
|
|
16031
16320
|
generateGetBarPoints: function (barIndices, isSub) {
|
|
16032
16321
|
var $$ = this;
|
|
16033
16322
|
var config = $$.config;
|
|
@@ -16048,7 +16337,9 @@ var shapeBar = {
|
|
|
16048
16337
|
if (config.axis_rotated && ((d.value > 0 && posY < y0) || (d.value < 0 && y0 < posY))) {
|
|
16049
16338
|
posY = y0;
|
|
16050
16339
|
}
|
|
16051
|
-
|
|
16340
|
+
if (!$$.isBarRangeType(d)) {
|
|
16341
|
+
posY -= (y0 - offset);
|
|
16342
|
+
}
|
|
16052
16343
|
var startPosX = posX + width;
|
|
16053
16344
|
// 4 points that make a bar
|
|
16054
16345
|
return [
|
|
@@ -16058,31 +16349,13 @@ var shapeBar = {
|
|
|
16058
16349
|
[startPosX, offset]
|
|
16059
16350
|
];
|
|
16060
16351
|
};
|
|
16061
|
-
},
|
|
16062
|
-
isWithinBar: function (that) {
|
|
16063
|
-
var mouse = getPointer(this.state.event, that);
|
|
16064
|
-
var list = getRectSegList(that);
|
|
16065
|
-
var seg0 = list[0], seg1 = list[1];
|
|
16066
|
-
var x = Math.min(seg0.x, seg1.x);
|
|
16067
|
-
var y = Math.min(seg0.y, seg1.y);
|
|
16068
|
-
var offset = this.config.bar_sensitivity;
|
|
16069
|
-
var _a = that.getBBox(), width = _a.width, height = _a.height;
|
|
16070
|
-
var sx = x - offset;
|
|
16071
|
-
var ex = x + width + offset;
|
|
16072
|
-
var sy = y + height + offset;
|
|
16073
|
-
var ey = y - offset;
|
|
16074
|
-
var isWithin = sx < mouse[0] &&
|
|
16075
|
-
mouse[0] < ex &&
|
|
16076
|
-
ey < mouse[1] &&
|
|
16077
|
-
mouse[1] < sy;
|
|
16078
|
-
return isWithin;
|
|
16079
16352
|
}
|
|
16080
16353
|
};
|
|
16081
16354
|
|
|
16082
16355
|
var shapeCandlestick = {
|
|
16083
16356
|
initCandlestick: function () {
|
|
16084
16357
|
var $el = this.$el;
|
|
16085
|
-
$el.candlestick = $el.main.select("."
|
|
16358
|
+
$el.candlestick = $el.main.select(".".concat(CLASS.chart))
|
|
16086
16359
|
// should positioned at the beginning of the shape node to not overlap others
|
|
16087
16360
|
.append("g")
|
|
16088
16361
|
.attr("class", CLASS.chartCandlesticks);
|
|
@@ -16101,8 +16374,8 @@ var shapeCandlestick = {
|
|
|
16101
16374
|
if (!$el.candlestick) {
|
|
16102
16375
|
$$.initCandlestick();
|
|
16103
16376
|
}
|
|
16104
|
-
var mainUpdate = $$.$el.main.select("."
|
|
16105
|
-
.selectAll("."
|
|
16377
|
+
var mainUpdate = $$.$el.main.select(".".concat(CLASS.chartCandlesticks))
|
|
16378
|
+
.selectAll(".".concat(CLASS.chartCandlestick))
|
|
16106
16379
|
.data(targets)
|
|
16107
16380
|
.attr("class", function (d) { return classChart(d) + classFocus(d); });
|
|
16108
16381
|
mainUpdate.enter().append("g")
|
|
@@ -16122,8 +16395,8 @@ var shapeCandlestick = {
|
|
|
16122
16395
|
var $root = isSub ? $el.subchart : $el;
|
|
16123
16396
|
var classSetter = $$.getClass("candlestick", true);
|
|
16124
16397
|
var initialOpacity = $$.initialOpacity.bind($$);
|
|
16125
|
-
var candlestick = $root.main.selectAll("."
|
|
16126
|
-
.selectAll("."
|
|
16398
|
+
var candlestick = $root.main.selectAll(".".concat(CLASS.chartCandlestick))
|
|
16399
|
+
.selectAll(".".concat(CLASS.candlestick))
|
|
16127
16400
|
.data($$.labelishData.bind($$));
|
|
16128
16401
|
$T(candlestick.exit(), withTransition)
|
|
16129
16402
|
.style("opacity", "0")
|
|
@@ -16164,10 +16437,10 @@ var shapeCandlestick = {
|
|
|
16164
16437
|
g.classed(CLASS[isUp ? "valueUp" : "valueDown"], true);
|
|
16165
16438
|
}
|
|
16166
16439
|
var path = isRotated ?
|
|
16167
|
-
"H"
|
|
16168
|
-
"V"
|
|
16440
|
+
"H".concat(points[1][1], " V").concat(points[1][0], " H").concat(points[0][1]) :
|
|
16441
|
+
"V".concat(points[1][1], " H").concat(points[1][0], " V").concat(points[0][1]);
|
|
16169
16442
|
g.select("path")
|
|
16170
|
-
.attr("d", "M"
|
|
16443
|
+
.attr("d", "M".concat(points[0][indexX], ",").concat(points[0][indexY]).concat(path, "z"))
|
|
16171
16444
|
.style("fill", function (d) {
|
|
16172
16445
|
var color = isUp ? $$.color(d) : (isObject(downColor) ? downColor[d.id] : downColor);
|
|
16173
16446
|
return color || $$.color(d);
|
|
@@ -16336,12 +16609,12 @@ var shapeGauge = {
|
|
|
16336
16609
|
var $$ = this;
|
|
16337
16610
|
var config = $$.config, state = $$.state, $el = $$.$el;
|
|
16338
16611
|
var hiddenTargetIds = $$.state.hiddenTargetIds;
|
|
16339
|
-
var arcLabelLines = $el.main.selectAll("."
|
|
16340
|
-
.selectAll("."
|
|
16612
|
+
var arcLabelLines = $el.main.selectAll(".".concat(CLASS.arcs))
|
|
16613
|
+
.selectAll(".".concat(CLASS.arcLabelLine))
|
|
16341
16614
|
.data($$.arcData.bind($$));
|
|
16342
16615
|
var mainArcLabelLine = arcLabelLines.enter()
|
|
16343
16616
|
.append("rect")
|
|
16344
|
-
.attr("class", function (d) { return CLASS.arcLabelLine
|
|
16617
|
+
.attr("class", function (d) { return "".concat(CLASS.arcLabelLine, " ").concat(CLASS.target, " ").concat(CLASS.target, "-").concat(d.data.id); })
|
|
16345
16618
|
.merge(arcLabelLines);
|
|
16346
16619
|
mainArcLabelLine
|
|
16347
16620
|
.style("fill", function (d) { return ($$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data)); })
|
|
@@ -16362,7 +16635,7 @@ var shapeGauge = {
|
|
|
16362
16635
|
lineLength = state.radiusExpanded - state.radius + innerLineLength;
|
|
16363
16636
|
x = Math.cos(linePositioningAngle) * arcInnerRadius;
|
|
16364
16637
|
y = Math.sin(linePositioningAngle) * arcInnerRadius;
|
|
16365
|
-
transform = "rotate("
|
|
16638
|
+
transform = "rotate(".concat(lineAngle * 180 / Math.PI, ", ").concat(x, ", ").concat(y, ")");
|
|
16366
16639
|
}
|
|
16367
16640
|
select(this)
|
|
16368
16641
|
.attr("x", x)
|
|
@@ -16370,7 +16643,7 @@ var shapeGauge = {
|
|
|
16370
16643
|
.attr("width", lineLength)
|
|
16371
16644
|
.attr("height", lineThickness)
|
|
16372
16645
|
.attr("transform", transform)
|
|
16373
|
-
.style("stroke-dasharray", "0, "
|
|
16646
|
+
.style("stroke-dasharray", "0, ".concat(lineLength + lineThickness, ", 0"));
|
|
16374
16647
|
});
|
|
16375
16648
|
},
|
|
16376
16649
|
textForGaugeMinMax: function (value, isMax) {
|
|
@@ -16462,7 +16735,7 @@ var shapeBubble = {
|
|
|
16462
16735
|
var shapeLine = {
|
|
16463
16736
|
initLine: function () {
|
|
16464
16737
|
var $el = this.$el;
|
|
16465
|
-
$el.line = $el.main.select("."
|
|
16738
|
+
$el.line = $el.main.select(".".concat(CLASS.chart)).append("g")
|
|
16466
16739
|
.attr("class", CLASS.chartLines);
|
|
16467
16740
|
},
|
|
16468
16741
|
updateTargetsForLine: function (t) {
|
|
@@ -16475,8 +16748,8 @@ var shapeLine = {
|
|
|
16475
16748
|
$$.initLine();
|
|
16476
16749
|
}
|
|
16477
16750
|
var targets = t.filter(function (d) { return !($$.isScatterType(d) || $$.isBubbleType(d)); });
|
|
16478
|
-
var mainLineUpdate = main.select("."
|
|
16479
|
-
.selectAll("."
|
|
16751
|
+
var mainLineUpdate = main.select(".".concat(CLASS.chartLines))
|
|
16752
|
+
.selectAll(".".concat(CLASS.chartLine))
|
|
16480
16753
|
.data(targets)
|
|
16481
16754
|
.attr("class", function (d) { return classChartLine(d) + classFocus(d); });
|
|
16482
16755
|
var mainLineEnter = mainLineUpdate.enter().append("g")
|
|
@@ -16504,15 +16777,15 @@ var shapeLine = {
|
|
|
16504
16777
|
var extraLineClasses = $$.format.extraLineClasses, $el = $$.$el, $T = $$.$T;
|
|
16505
16778
|
var $root = isSub ? $el.subchart : $el;
|
|
16506
16779
|
var line = $root.main
|
|
16507
|
-
.selectAll("."
|
|
16508
|
-
.selectAll("."
|
|
16780
|
+
.selectAll(".".concat(CLASS.lines))
|
|
16781
|
+
.selectAll(".".concat(CLASS.line))
|
|
16509
16782
|
.data($$.lineData.bind($$));
|
|
16510
16783
|
$T(line.exit(), withTransition)
|
|
16511
16784
|
.style("opacity", "0")
|
|
16512
16785
|
.remove();
|
|
16513
16786
|
$root.line = line.enter()
|
|
16514
16787
|
.append("path")
|
|
16515
|
-
.attr("class", function (d) { return $$.getClass("line", true)(d)
|
|
16788
|
+
.attr("class", function (d) { return "".concat($$.getClass("line", true)(d), " ").concat(extraLineClasses(d) || ""); })
|
|
16516
16789
|
.style("stroke", $$.color)
|
|
16517
16790
|
.merge(line)
|
|
16518
16791
|
.style("opacity", $$.initialOpacity.bind($$))
|
|
@@ -16609,7 +16882,7 @@ var shapeLine = {
|
|
|
16609
16882
|
x0 = x(values[0].x);
|
|
16610
16883
|
y0 = y(values[0].value);
|
|
16611
16884
|
}
|
|
16612
|
-
path = isRotated ? "M "
|
|
16885
|
+
path = isRotated ? "M ".concat(y0, " ").concat(x0) : "M ".concat(x0, " ").concat(y0);
|
|
16613
16886
|
}
|
|
16614
16887
|
return path || "M 0 0";
|
|
16615
16888
|
};
|
|
@@ -16649,7 +16922,7 @@ var shapeLine = {
|
|
|
16649
16922
|
var xValue = isRotated ? function (dt) { return y(dt.value); } : function (dt) { return x(dt.x); };
|
|
16650
16923
|
var yValue = isRotated ? function (dt) { return x(dt.x); } : function (dt) { return y(dt.value); };
|
|
16651
16924
|
// Define svg generator function for region
|
|
16652
|
-
var generateM = function (points) { return "M"
|
|
16925
|
+
var generateM = function (points) { return "M".concat(points[0][0], ",").concat(points[0][1], "L").concat(points[1][0], ",").concat(points[1][1]); };
|
|
16653
16926
|
var sWithRegion = isTimeSeries ? function (d0, d1, k, timeseriesDiff) {
|
|
16654
16927
|
var x0 = d0.x.getTime();
|
|
16655
16928
|
var xDiff = d1.x - d0.x;
|
|
@@ -16678,7 +16951,7 @@ var shapeLine = {
|
|
|
16678
16951
|
}
|
|
16679
16952
|
// Draw as normal
|
|
16680
16953
|
if (isUndefined(regions) || !style || !hasPrevData) {
|
|
16681
|
-
path += ""
|
|
16954
|
+
path += "".concat(i && hasPrevData ? "L" : "M").concat(xValue(data), ",").concat(yValue(data));
|
|
16682
16955
|
}
|
|
16683
16956
|
else if (hasPrevData) {
|
|
16684
16957
|
try {
|
|
@@ -16750,8 +17023,8 @@ var shapePoint = {
|
|
|
16750
17023
|
var $$ = this;
|
|
16751
17024
|
var main = $$.$el.main;
|
|
16752
17025
|
$$.point = $$.generatePoint();
|
|
16753
|
-
if (($$.hasType("bubble") || $$.hasType("scatter")) && main.select("."
|
|
16754
|
-
main.select("."
|
|
17026
|
+
if (($$.hasType("bubble") || $$.hasType("scatter")) && main.select(".".concat(CLASS.chartCircles)).empty()) {
|
|
17027
|
+
main.select(".".concat(CLASS.chart))
|
|
16755
17028
|
.append("g")
|
|
16756
17029
|
.attr("class", CLASS.chartCircles);
|
|
16757
17030
|
}
|
|
@@ -16773,9 +17046,9 @@ var shapePoint = {
|
|
|
16773
17046
|
if (!targets) {
|
|
16774
17047
|
targets = (data.targets)
|
|
16775
17048
|
.filter(function (d) { return _this.isScatterType(d) || _this.isBubbleType(d); });
|
|
16776
|
-
var mainCircle = $el.main.select("."
|
|
17049
|
+
var mainCircle = $el.main.select(".".concat(CLASS.chartCircles))
|
|
16777
17050
|
.style("pointer-events", "none")
|
|
16778
|
-
.selectAll("."
|
|
17051
|
+
.selectAll(".".concat(CLASS.circles))
|
|
16779
17052
|
.data(targets)
|
|
16780
17053
|
.attr("class", classCircles);
|
|
16781
17054
|
mainCircle.exit().remove();
|
|
@@ -16789,8 +17062,8 @@ var shapePoint = {
|
|
|
16789
17062
|
.style("cursor", function (d) { return (isFunction(isSelectable) && isSelectable(d) ? "pointer" : null); });
|
|
16790
17063
|
// Update date for selected circles
|
|
16791
17064
|
selectionEnabled && targets.forEach(function (t) {
|
|
16792
|
-
$el.main.selectAll("."
|
|
16793
|
-
.selectAll(""
|
|
17065
|
+
$el.main.selectAll(".".concat(CLASS.selectedCircles).concat($$.getTargetSelectorSuffix(t.id)))
|
|
17066
|
+
.selectAll("".concat(CLASS.selectedCircle))
|
|
16794
17067
|
.each(function (d) {
|
|
16795
17068
|
d.value = t.values[d.index].value;
|
|
16796
17069
|
});
|
|
@@ -16803,8 +17076,8 @@ var shapePoint = {
|
|
|
16803
17076
|
var focusOnly = config.point_focus_only;
|
|
16804
17077
|
var $root = isSub ? $el.subchart : $el;
|
|
16805
17078
|
if (config.point_show && !state.toggling) {
|
|
16806
|
-
var circles = $root.main.selectAll("."
|
|
16807
|
-
.selectAll("."
|
|
17079
|
+
var circles = $root.main.selectAll(".".concat(CLASS.circles))
|
|
17080
|
+
.selectAll(".".concat(CLASS.circle))
|
|
16808
17081
|
.data(function (d) { return (($$.isLineType(d) && $$.shouldDrawPointsForLine(d)) ||
|
|
16809
17082
|
$$.isBubbleType(d) || $$.isRadarType(d) || $$.isScatterType(d) ?
|
|
16810
17083
|
(focusOnly ? [d.values[0]] : d.values) : []); });
|
|
@@ -16812,7 +17085,7 @@ var shapePoint = {
|
|
|
16812
17085
|
circles.enter()
|
|
16813
17086
|
.filter(Boolean)
|
|
16814
17087
|
.append($$.point("create", this, $$.pointR.bind($$), $$.color));
|
|
16815
|
-
$root.circle = $root.main.selectAll("."
|
|
17088
|
+
$root.circle = $root.main.selectAll(".".concat(CLASS.circles, " .").concat(CLASS.circle))
|
|
16816
17089
|
.style("stroke", $$.color)
|
|
16817
17090
|
.style("opacity", $$.initialOpacityForCircle.bind($$));
|
|
16818
17091
|
}
|
|
@@ -16822,7 +17095,7 @@ var shapePoint = {
|
|
|
16822
17095
|
var $$ = this;
|
|
16823
17096
|
var rendered = $$.state.rendered, $el = $$.$el, $T = $$.$T;
|
|
16824
17097
|
var $root = isSub ? $el.subchart : $el;
|
|
16825
|
-
var selectedCircles = $root.main.selectAll("."
|
|
17098
|
+
var selectedCircles = $root.main.selectAll(".".concat(CLASS.selectedCircle));
|
|
16826
17099
|
if (!$$.config.point_show) {
|
|
16827
17100
|
return [];
|
|
16828
17101
|
}
|
|
@@ -16840,8 +17113,8 @@ var shapePoint = {
|
|
|
16840
17113
|
return [
|
|
16841
17114
|
mainCircles,
|
|
16842
17115
|
$T(selectedCircles, withTransition)
|
|
16843
|
-
.attr(posAttr
|
|
16844
|
-
.attr(posAttr
|
|
17116
|
+
.attr("".concat(posAttr, "x"), cx)
|
|
17117
|
+
.attr("".concat(posAttr, "y"), cy)
|
|
16845
17118
|
];
|
|
16846
17119
|
},
|
|
16847
17120
|
/**
|
|
@@ -16928,7 +17201,7 @@ var shapePoint = {
|
|
|
16928
17201
|
var _a = this.getBBox(), width = _a.width, height = _a.height;
|
|
16929
17202
|
var x = ratio * (+point.attr("x") + width / 2);
|
|
16930
17203
|
var y = ratio * (+point.attr("y") + height / 2);
|
|
16931
|
-
point.attr("transform", "translate("
|
|
17204
|
+
point.attr("transform", "translate(".concat(x, " ").concat(y, ") scale(").concat(scale, ")"));
|
|
16932
17205
|
}
|
|
16933
17206
|
});
|
|
16934
17207
|
}
|
|
@@ -16943,7 +17216,7 @@ var shapePoint = {
|
|
|
16943
17216
|
.classed(CLASS.EXPANDED, false);
|
|
16944
17217
|
circles.attr("r", r);
|
|
16945
17218
|
!$$.isCirclePoint() &&
|
|
16946
|
-
circles.attr("transform", "scale("
|
|
17219
|
+
circles.attr("transform", "scale(".concat(r(circles) / $$.config.point_r, ")"));
|
|
16947
17220
|
},
|
|
16948
17221
|
pointR: function (d) {
|
|
16949
17222
|
var $$ = this;
|
|
@@ -16975,8 +17248,8 @@ var shapePoint = {
|
|
|
16975
17248
|
var mouse = getPointer(this.state.event, node);
|
|
16976
17249
|
var element = select(node);
|
|
16977
17250
|
var prefix = this.isCirclePoint(node) ? "c" : "";
|
|
16978
|
-
var cx = +element.attr(prefix
|
|
16979
|
-
var cy = +element.attr(prefix
|
|
17251
|
+
var cx = +element.attr("".concat(prefix, "x"));
|
|
17252
|
+
var cy = +element.attr("".concat(prefix, "y"));
|
|
16980
17253
|
// if node don't have cx/y or x/y attribute value
|
|
16981
17254
|
if (!(cx || cy) && node.nodeType === 1) {
|
|
16982
17255
|
var _a = getBoundingRect(node), x = _a.x, y = _a.y;
|
|
@@ -17016,7 +17289,7 @@ var shapePoint = {
|
|
|
17016
17289
|
$$.$el.defs.node().appendChild(clone);
|
|
17017
17290
|
},
|
|
17018
17291
|
pointFromDefs: function (id) {
|
|
17019
|
-
return this.$el.defs.select("#"
|
|
17292
|
+
return this.$el.defs.select("#".concat(id));
|
|
17020
17293
|
},
|
|
17021
17294
|
updatePointClass: function (d) {
|
|
17022
17295
|
var $$ = this;
|
|
@@ -17027,7 +17300,7 @@ var shapePoint = {
|
|
|
17027
17300
|
circle.each(function (d) {
|
|
17028
17301
|
var className = $$.getClass("circle", true)(d);
|
|
17029
17302
|
if (this.getAttribute("class").indexOf(CLASS.EXPANDED) > -1) {
|
|
17030
|
-
className += " "
|
|
17303
|
+
className += " ".concat(CLASS.EXPANDED);
|
|
17031
17304
|
}
|
|
17032
17305
|
this.setAttribute("class", className);
|
|
17033
17306
|
}) : $$.getClass("circle", true)(d);
|
|
@@ -17080,7 +17353,7 @@ var shapePoint = {
|
|
|
17080
17353
|
point = $$[point];
|
|
17081
17354
|
}
|
|
17082
17355
|
else if (!$$.hasValidPointDrawMethods(point)) {
|
|
17083
|
-
var pointId = datetimeId
|
|
17356
|
+
var pointId = "".concat(datetimeId, "-point").concat(id);
|
|
17084
17357
|
var pointFromDefs = $$.pointFromDefs(pointId);
|
|
17085
17358
|
if (pointFromDefs.size() < 1) {
|
|
17086
17359
|
$$.insertPointInfoDefs(point, pointId);
|
|
@@ -17099,7 +17372,7 @@ var shapePoint = {
|
|
|
17099
17372
|
custom: {
|
|
17100
17373
|
create: function (element, id, sizeFn, fillStyleFn) {
|
|
17101
17374
|
return element.append("use")
|
|
17102
|
-
.attr("xlink:href", "#"
|
|
17375
|
+
.attr("xlink:href", "#".concat(id))
|
|
17103
17376
|
.attr("class", this.updatePointClass.bind(this))
|
|
17104
17377
|
.style("fill", fillStyleFn)
|
|
17105
17378
|
.node();
|
|
@@ -17208,7 +17481,7 @@ var shapeRadar = {
|
|
|
17208
17481
|
var $$ = this;
|
|
17209
17482
|
var config = $$.config, current = $$.state.current, $el = $$.$el;
|
|
17210
17483
|
if ($$.hasType("radar")) {
|
|
17211
|
-
$el.radar = $el.main.select("."
|
|
17484
|
+
$el.radar = $el.main.select(".".concat(CLASS.chart)).append("g")
|
|
17212
17485
|
.attr("class", CLASS.chartRadars);
|
|
17213
17486
|
// level
|
|
17214
17487
|
$el.radar.levels = $el.radar.append("g")
|
|
@@ -17272,7 +17545,7 @@ var shapeRadar = {
|
|
|
17272
17545
|
// Adjust radar, circles and texts' position
|
|
17273
17546
|
if (translate) {
|
|
17274
17547
|
radar.attr("transform", translate);
|
|
17275
|
-
main.select("."
|
|
17548
|
+
main.select(".".concat(CLASS.chartTexts)).attr("transform", translate);
|
|
17276
17549
|
$$.generateRadarPoints();
|
|
17277
17550
|
$$.updateRadarLevel();
|
|
17278
17551
|
$$.updateRadarAxes();
|
|
@@ -17310,11 +17583,11 @@ var shapeRadar = {
|
|
|
17310
17583
|
return pos.join(" ");
|
|
17311
17584
|
});
|
|
17312
17585
|
var level = radarLevels
|
|
17313
|
-
.selectAll("."
|
|
17586
|
+
.selectAll(".".concat(CLASS.level))
|
|
17314
17587
|
.data(levelData);
|
|
17315
17588
|
level.exit().remove();
|
|
17316
17589
|
var levelEnter = level.enter().append("g")
|
|
17317
|
-
.attr("class", function (d, i) { return CLASS.level
|
|
17590
|
+
.attr("class", function (d, i) { return "".concat(CLASS.level, " ").concat(CLASS.level, "-").concat(i); });
|
|
17318
17591
|
levelEnter.append("polygon")
|
|
17319
17592
|
.style("visibility", config.radar_level_show ? null : "hidden");
|
|
17320
17593
|
if (showText) {
|
|
@@ -17333,7 +17606,7 @@ var shapeRadar = {
|
|
|
17333
17606
|
}
|
|
17334
17607
|
levelEnter
|
|
17335
17608
|
.merge(level)
|
|
17336
|
-
.attr("transform", function (d) { return "translate("
|
|
17609
|
+
.attr("transform", function (d) { return "translate(".concat(width - levelRatio[d], ", ").concat(height - levelRatio[d], ")"); })
|
|
17337
17610
|
.selectAll("polygon")
|
|
17338
17611
|
.attr("points", function (d) { return points[d]; });
|
|
17339
17612
|
// update level text position
|
|
@@ -17352,7 +17625,7 @@ var shapeRadar = {
|
|
|
17352
17625
|
.data(categories);
|
|
17353
17626
|
axis.exit().remove();
|
|
17354
17627
|
var axisEnter = axis.enter().append("g")
|
|
17355
|
-
.attr("class", function (d, i) { return CLASS.axis
|
|
17628
|
+
.attr("class", function (d, i) { return "".concat(CLASS.axis, "-").concat(i); });
|
|
17356
17629
|
config.radar_axis_line_show && axisEnter.append("line");
|
|
17357
17630
|
config.radar_axis_text_show && axisEnter.append("text");
|
|
17358
17631
|
axis = axisEnter.merge(axis);
|
|
@@ -17399,7 +17672,7 @@ var shapeRadar = {
|
|
|
17399
17672
|
else if (posY < height) {
|
|
17400
17673
|
posY -= y_1;
|
|
17401
17674
|
}
|
|
17402
|
-
return "translate("
|
|
17675
|
+
return "translate(".concat(posX, " ").concat(posY, ")");
|
|
17403
17676
|
});
|
|
17404
17677
|
}
|
|
17405
17678
|
$$.bindEvent();
|
|
@@ -17421,6 +17694,7 @@ var shapeRadar = {
|
|
|
17421
17694
|
return d && Object.keys(d).length === 1 ? d.index : undefined;
|
|
17422
17695
|
};
|
|
17423
17696
|
var hide = function (event) {
|
|
17697
|
+
state.event = event;
|
|
17424
17698
|
var index = getIndex_1(event);
|
|
17425
17699
|
var noIndex = isUndefined(index);
|
|
17426
17700
|
if (isMouse_1 || noIndex) {
|
|
@@ -17671,10 +17945,10 @@ var optBar = {
|
|
|
17671
17945
|
* @memberof Options
|
|
17672
17946
|
* @type {object}
|
|
17673
17947
|
* @property {object} bar Bar object
|
|
17948
|
+
* @property {number} [bar.indices.removeNull=false] Remove nullish data on bar indices positions.
|
|
17674
17949
|
* @property {number} [bar.label.threshold=0] Set threshold ratio to show/hide labels.
|
|
17675
17950
|
* @property {number} [bar.padding=0] The padding pixel value between each bar.
|
|
17676
17951
|
* @property {number} [bar.radius] Set the radius of bar edge in pixel.
|
|
17677
|
-
* - **NOTE:** Works only for non-stacked bar
|
|
17678
17952
|
* @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
|
|
17679
17953
|
* @property {number} [bar.sensitivity=2] The senstivity offset value for interaction boundary.
|
|
17680
17954
|
* @property {number} [bar.width] Change the width of bar chart.
|
|
@@ -17687,15 +17961,21 @@ var optBar = {
|
|
|
17687
17961
|
* @property {number} [bar.width.dataname.ratio=0.6] Change the width of bar chart by ratio.
|
|
17688
17962
|
* @property {number} [bar.width.dataname.max] The maximum width value for ratio.
|
|
17689
17963
|
* @property {boolean} [bar.zerobased=true] Set if min or max value will be 0 on bar chart.
|
|
17964
|
+
* @see [Demo: bar indices](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarIndices)
|
|
17690
17965
|
* @see [Demo: bar padding](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarPadding)
|
|
17691
17966
|
* @see [Demo: bar radius](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarRadius)
|
|
17692
17967
|
* @see [Demo: bar width](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidth)
|
|
17693
17968
|
* @see [Demo: bar width variant](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidthVariant)
|
|
17694
17969
|
* @example
|
|
17695
17970
|
* bar: {
|
|
17971
|
+
* // remove nullish data on bar indices postions
|
|
17972
|
+
* indices: {
|
|
17973
|
+
* removeNull: true
|
|
17974
|
+
* },
|
|
17975
|
+
*
|
|
17696
17976
|
* padding: 1,
|
|
17697
17977
|
*
|
|
17698
|
-
* //
|
|
17978
|
+
* // bar radius
|
|
17699
17979
|
* radius: 10,
|
|
17700
17980
|
* // or
|
|
17701
17981
|
* radius: {
|
|
@@ -17732,6 +18012,7 @@ var optBar = {
|
|
|
17732
18012
|
* }
|
|
17733
18013
|
*/
|
|
17734
18014
|
bar_label_threshold: 0,
|
|
18015
|
+
bar_indices_removeNull: false,
|
|
17735
18016
|
bar_padding: 0,
|
|
17736
18017
|
bar_radius: undefined,
|
|
17737
18018
|
bar_radius_ratio: undefined,
|
|
@@ -18439,8 +18720,8 @@ var apiSelection = {
|
|
|
18439
18720
|
selected: function (targetId) {
|
|
18440
18721
|
var $$ = this.internal;
|
|
18441
18722
|
var dataPoint = [];
|
|
18442
|
-
$$.$el.main.selectAll("."
|
|
18443
|
-
.selectAll("."
|
|
18723
|
+
$$.$el.main.selectAll(".".concat(CLASS.shapes + $$.getTargetSelectorSuffix(targetId)))
|
|
18724
|
+
.selectAll(".".concat(CLASS.shape))
|
|
18444
18725
|
.filter(function () {
|
|
18445
18726
|
return select(this).classed(CLASS.SELECTED);
|
|
18446
18727
|
})
|
|
@@ -18477,8 +18758,8 @@ var apiSelection = {
|
|
|
18477
18758
|
if (!config.data_selection_enabled) {
|
|
18478
18759
|
return;
|
|
18479
18760
|
}
|
|
18480
|
-
$el.main.selectAll("."
|
|
18481
|
-
.selectAll("."
|
|
18761
|
+
$el.main.selectAll(".".concat(CLASS.shapes))
|
|
18762
|
+
.selectAll(".".concat(CLASS.shape))
|
|
18482
18763
|
.each(function (d, i) {
|
|
18483
18764
|
var shape = select(this);
|
|
18484
18765
|
var id = d.data ? d.data.id : d.id;
|
|
@@ -18523,8 +18804,8 @@ var apiSelection = {
|
|
|
18523
18804
|
if (!config.data_selection_enabled) {
|
|
18524
18805
|
return;
|
|
18525
18806
|
}
|
|
18526
|
-
$el.main.selectAll("."
|
|
18527
|
-
.selectAll("."
|
|
18807
|
+
$el.main.selectAll(".".concat(CLASS.shapes))
|
|
18808
|
+
.selectAll(".".concat(CLASS.shape))
|
|
18528
18809
|
.each(function (d, i) {
|
|
18529
18810
|
var shape = select(this);
|
|
18530
18811
|
var id = d.data ? d.data.id : d.id;
|
|
@@ -18584,12 +18865,12 @@ var apiSubchart = {
|
|
|
18584
18865
|
$$.unbindZoomEvent();
|
|
18585
18866
|
config.subchart_show = !show;
|
|
18586
18867
|
!subchart.main && $$.initSubchart();
|
|
18587
|
-
var $target = subchart.main.selectAll("."
|
|
18868
|
+
var $target = subchart.main.selectAll(".".concat(CLASS.target));
|
|
18588
18869
|
// need to cover when new data has been loaded
|
|
18589
18870
|
if ($$.data.targets.length !== $target.size()) {
|
|
18590
18871
|
$$.updateSizes();
|
|
18591
18872
|
$$.updateTargetsForSubchart($$.data.targets);
|
|
18592
|
-
$target = subchart.main.selectAll("."
|
|
18873
|
+
$target = subchart.main.selectAll(".".concat(CLASS.target));
|
|
18593
18874
|
}
|
|
18594
18875
|
$target.style("opacity", null);
|
|
18595
18876
|
subchart.main.style("display", null);
|
|
@@ -18875,14 +19156,14 @@ var drag = {
|
|
|
18875
19156
|
var maxX = Math.max(sx, mx);
|
|
18876
19157
|
var minY = isSelectionGrouped ? state.margin.top : Math.min(sy, my);
|
|
18877
19158
|
var maxY = isSelectionGrouped ? state.height : Math.max(sy, my);
|
|
18878
|
-
main.select("."
|
|
19159
|
+
main.select(".".concat(CLASS.dragarea))
|
|
18879
19160
|
.attr("x", minX)
|
|
18880
19161
|
.attr("y", minY)
|
|
18881
19162
|
.attr("width", maxX - minX)
|
|
18882
19163
|
.attr("height", maxY - minY);
|
|
18883
19164
|
// TODO: binary search when multiple xs
|
|
18884
|
-
main.selectAll("."
|
|
18885
|
-
.selectAll("."
|
|
19165
|
+
main.selectAll(".".concat(CLASS.shapes))
|
|
19166
|
+
.selectAll(".".concat(CLASS.shape))
|
|
18886
19167
|
.filter(function (d) { return isSelectable === null || isSelectable === void 0 ? void 0 : isSelectable.bind($$.api)(d); })
|
|
18887
19168
|
.each(function (d, i) {
|
|
18888
19169
|
var shape = select(this);
|
|
@@ -18927,7 +19208,7 @@ var drag = {
|
|
|
18927
19208
|
return;
|
|
18928
19209
|
}
|
|
18929
19210
|
state.dragStart = mouse;
|
|
18930
|
-
main.select("."
|
|
19211
|
+
main.select(".".concat(CLASS.chart))
|
|
18931
19212
|
.append("rect")
|
|
18932
19213
|
.attr("class", CLASS.dragarea)
|
|
18933
19214
|
.style("opacity", "0.1");
|
|
@@ -18944,10 +19225,10 @@ var drag = {
|
|
|
18944
19225
|
if ($$.hasArcType() || !config.data_selection_enabled) { // do nothing if not selectable
|
|
18945
19226
|
return;
|
|
18946
19227
|
}
|
|
18947
|
-
$T(main.select("."
|
|
19228
|
+
$T(main.select(".".concat(CLASS.dragarea)))
|
|
18948
19229
|
.style("opacity", "0")
|
|
18949
19230
|
.remove();
|
|
18950
|
-
main.selectAll("."
|
|
19231
|
+
main.selectAll(".".concat(CLASS.shape))
|
|
18951
19232
|
.classed(CLASS.INCLUDED, false);
|
|
18952
19233
|
$$.setDragStatus(false);
|
|
18953
19234
|
}
|
|
@@ -18970,8 +19251,8 @@ var selection = _assign(_assign({}, drag), {
|
|
|
18970
19251
|
var r = $$.pointSelectR.bind($$);
|
|
18971
19252
|
callFn(config.data_onselected, $$.api, d, target.node());
|
|
18972
19253
|
// add selected-circle on low layer g
|
|
18973
|
-
$T(main.select("."
|
|
18974
|
-
.selectAll("."
|
|
19254
|
+
$T(main.select(".".concat(CLASS.selectedCircles).concat($$.getTargetSelectorSuffix(d.id)))
|
|
19255
|
+
.selectAll(".".concat(CLASS.selectedCircle, "-").concat(i))
|
|
18975
19256
|
.data([d])
|
|
18976
19257
|
.enter()
|
|
18977
19258
|
.append("circle")
|
|
@@ -18993,8 +19274,8 @@ var selection = _assign(_assign({}, drag), {
|
|
|
18993
19274
|
var config = $$.config, main = $$.$el.main, $T = $$.$T;
|
|
18994
19275
|
callFn(config.data_onunselected, $$.api, d, target.node());
|
|
18995
19276
|
// remove selected-circle from low layer g
|
|
18996
|
-
$T(main.select("."
|
|
18997
|
-
.selectAll("."
|
|
19277
|
+
$T(main.select(".".concat(CLASS.selectedCircles).concat($$.getTargetSelectorSuffix(d.id)))
|
|
19278
|
+
.selectAll(".".concat(CLASS.selectedCircle, "-").concat(i)))
|
|
18998
19279
|
.attr("r", 0)
|
|
18999
19280
|
.remove();
|
|
19000
19281
|
},
|
|
@@ -19007,7 +19288,7 @@ var selection = _assign(_assign({}, drag), {
|
|
|
19007
19288
|
* @private
|
|
19008
19289
|
*/
|
|
19009
19290
|
togglePoint: function (selected, target, d, i) {
|
|
19010
|
-
var method = (selected ? "" : "un"
|
|
19291
|
+
var method = "".concat(selected ? "" : "un", "selectPoint");
|
|
19011
19292
|
this[method](target, d, i);
|
|
19012
19293
|
},
|
|
19013
19294
|
/**
|
|
@@ -19047,7 +19328,7 @@ var selection = _assign(_assign({}, drag), {
|
|
|
19047
19328
|
* @private
|
|
19048
19329
|
*/
|
|
19049
19330
|
togglePath: function (selected, target, d, i) {
|
|
19050
|
-
this[(selected ? "" : "un"
|
|
19331
|
+
this["".concat(selected ? "" : "un", "selectPath")](target, d, i);
|
|
19051
19332
|
},
|
|
19052
19333
|
/**
|
|
19053
19334
|
* Returns the toggle method of the target
|
|
@@ -19079,12 +19360,12 @@ var selection = _assign(_assign({}, drag), {
|
|
|
19079
19360
|
var toggledShape;
|
|
19080
19361
|
if (config.data_selection_enabled && config.data_selection_isselectable.bind($$.api)(d)) {
|
|
19081
19362
|
if (!config.data_selection_multiple) {
|
|
19082
|
-
var selector = "."
|
|
19363
|
+
var selector = ".".concat(CLASS.shapes);
|
|
19083
19364
|
if (config.data_selection_grouped) {
|
|
19084
19365
|
selector += $$.getTargetSelectorSuffix(d.id);
|
|
19085
19366
|
}
|
|
19086
19367
|
main.selectAll(selector)
|
|
19087
|
-
.selectAll("."
|
|
19368
|
+
.selectAll(".".concat(CLASS.shape))
|
|
19088
19369
|
.each(function (d, i) {
|
|
19089
19370
|
var shape = select(this);
|
|
19090
19371
|
if (shape.classed(CLASS.SELECTED)) {
|
|
@@ -19118,7 +19399,7 @@ var subchart = {
|
|
|
19118
19399
|
// set the brush
|
|
19119
19400
|
$$.brush = (isRotated ? brushY() : brushX()).handleSize(5);
|
|
19120
19401
|
var getBrushSize = function () {
|
|
19121
|
-
var brush = $$.$el.svg.select("."
|
|
19402
|
+
var brush = $$.$el.svg.select(".".concat(CLASS.brush, " .overlay"));
|
|
19122
19403
|
var brushSize = { width: 0, height: 0 };
|
|
19123
19404
|
if (brush.size()) {
|
|
19124
19405
|
brushSize.width = +brush.attr("width");
|
|
@@ -19148,7 +19429,7 @@ var subchart = {
|
|
|
19148
19429
|
.attr("transform", function (d, i) {
|
|
19149
19430
|
var pos = isRotated ?
|
|
19150
19431
|
[33, selection[i] - (i === 0 ? 30 : 24)] : [selection[i], 3];
|
|
19151
|
-
return "translate("
|
|
19432
|
+
return "translate(".concat(pos, ")");
|
|
19152
19433
|
});
|
|
19153
19434
|
}
|
|
19154
19435
|
}
|
|
@@ -19166,7 +19447,7 @@ var subchart = {
|
|
|
19166
19447
|
var _a;
|
|
19167
19448
|
var extent = this.extent()();
|
|
19168
19449
|
if (extent[1].filter(function (v) { return isNaN(v); }).length === 0) {
|
|
19169
|
-
(_a = subchart.main) === null || _a === void 0 ? void 0 : _a.select("."
|
|
19450
|
+
(_a = subchart.main) === null || _a === void 0 ? void 0 : _a.select(".".concat(CLASS.brush)).call(this);
|
|
19170
19451
|
}
|
|
19171
19452
|
return this;
|
|
19172
19453
|
};
|
|
@@ -19189,7 +19470,7 @@ var subchart = {
|
|
|
19189
19470
|
};
|
|
19190
19471
|
$$.brush.getSelection = function () { return (
|
|
19191
19472
|
// @ts-ignore
|
|
19192
|
-
subchart.main ? subchart.main.select("."
|
|
19473
|
+
subchart.main ? subchart.main.select(".".concat(CLASS.brush)) : select([])); };
|
|
19193
19474
|
},
|
|
19194
19475
|
/**
|
|
19195
19476
|
* Initialize the subchart.
|
|
@@ -19202,7 +19483,7 @@ var subchart = {
|
|
|
19202
19483
|
return;
|
|
19203
19484
|
}
|
|
19204
19485
|
var visibility = config.subchart_show ? null : "hidden";
|
|
19205
|
-
var clipId = clip.id
|
|
19486
|
+
var clipId = "".concat(clip.id, "-subchart");
|
|
19206
19487
|
var clipPath = $$.getClipPath(clipId);
|
|
19207
19488
|
clip.idSubchart = clipId;
|
|
19208
19489
|
$$.appendClip(defs, clipId);
|
|
@@ -19220,9 +19501,9 @@ var subchart = {
|
|
|
19220
19501
|
["bar", "line", "bubble", "candlestick", "scatter"].forEach(function (v) {
|
|
19221
19502
|
var type = capitalize(/^(bubble|scatter)$/.test(v) ? "circle" : v);
|
|
19222
19503
|
if ($$.hasType(v) || $$.hasTypeOf(type)) {
|
|
19223
|
-
var chart = main.select("."
|
|
19224
|
-
var chartClassName = CLASS["chart"
|
|
19225
|
-
if (chart.select("."
|
|
19504
|
+
var chart = main.select(".".concat(CLASS.chart));
|
|
19505
|
+
var chartClassName = CLASS["chart".concat(type, "s")];
|
|
19506
|
+
if (chart.select(".".concat(chartClassName)).empty()) {
|
|
19226
19507
|
chart
|
|
19227
19508
|
.append("g")
|
|
19228
19509
|
.attr("class", chartClassName);
|
|
@@ -19263,14 +19544,14 @@ var subchart = {
|
|
|
19263
19544
|
"M 0 18 A 6 6 0 0 0 -6.5 23.5 V 29 A 6 6 0 0 0 0 35 Z M -2 23 V 30 M -4 23 V 30Z",
|
|
19264
19545
|
"M 0 18 A 6 6 0 0 1 6.5 23.5 V 29 A 6 6 0 0 1 0 35 Z M 2 23 V 30 M 4 23 V 30Z"
|
|
19265
19546
|
];
|
|
19266
|
-
$$.brush.handle = brush.selectAll("."
|
|
19547
|
+
$$.brush.handle = brush.selectAll(".".concat(customHandleClass))
|
|
19267
19548
|
.data(isRotated ?
|
|
19268
19549
|
[{ type: "n" }, { type: "s" }] :
|
|
19269
19550
|
[{ type: "w" }, { type: "e" }])
|
|
19270
19551
|
.enter()
|
|
19271
19552
|
.append("path")
|
|
19272
19553
|
.attr("class", customHandleClass)
|
|
19273
|
-
.attr("cursor", (isRotated ? "ns" : "ew"
|
|
19554
|
+
.attr("cursor", "".concat(isRotated ? "ns" : "ew", "-resize"))
|
|
19274
19555
|
.attr("d", function (d) { return path[+/[se]/.test(d.type)]; })
|
|
19275
19556
|
.attr("display", initRange ? null : "none");
|
|
19276
19557
|
},
|
|
@@ -19289,12 +19570,12 @@ var subchart = {
|
|
|
19289
19570
|
var isPointType = /^(bubble|scatter)$/.test(v);
|
|
19290
19571
|
var name = capitalize(isPointType ? "circle" : v);
|
|
19291
19572
|
var chartClass = $$.getChartClass(name, true);
|
|
19292
|
-
var shapeClass = $$.getClass(isPointType ? "circles" : v
|
|
19293
|
-
var shapeChart = main.select("."
|
|
19573
|
+
var shapeClass = $$.getClass(isPointType ? "circles" : "".concat(v, "s"), true);
|
|
19574
|
+
var shapeChart = main.select(".".concat(CLASS["chart".concat("".concat(name, "s"))]));
|
|
19294
19575
|
if (isPointType) {
|
|
19295
19576
|
var circle = shapeChart
|
|
19296
|
-
.selectAll("."
|
|
19297
|
-
.data(targets.filter($$["is"
|
|
19577
|
+
.selectAll(".".concat(CLASS.circles))
|
|
19578
|
+
.data(targets.filter($$["is".concat(capitalize(v), "Type")].bind($$)))
|
|
19298
19579
|
.attr("class", shapeClass);
|
|
19299
19580
|
circle.exit().remove();
|
|
19300
19581
|
circle.enter().append("g")
|
|
@@ -19302,9 +19583,9 @@ var subchart = {
|
|
|
19302
19583
|
}
|
|
19303
19584
|
else {
|
|
19304
19585
|
var shapeUpdate = shapeChart
|
|
19305
|
-
.selectAll("."
|
|
19586
|
+
.selectAll(".".concat(CLASS["chart".concat(name)]))
|
|
19306
19587
|
.attr("class", chartClass)
|
|
19307
|
-
.data(targets.filter($$["is"
|
|
19588
|
+
.data(targets.filter($$["is".concat(name, "Type")].bind($$)));
|
|
19308
19589
|
var shapeEnter = shapeUpdate.enter()
|
|
19309
19590
|
.append("g")
|
|
19310
19591
|
.style("opacity", "0")
|
|
@@ -19318,7 +19599,7 @@ var subchart = {
|
|
|
19318
19599
|
}
|
|
19319
19600
|
});
|
|
19320
19601
|
// -- Brush --//
|
|
19321
|
-
main.selectAll("."
|
|
19602
|
+
main.selectAll(".".concat(CLASS.brush, " rect"))
|
|
19322
19603
|
.attr(config.axis_rotated ? "width" : "height", config.axis_rotated ? state.width2 : state.height2);
|
|
19323
19604
|
}
|
|
19324
19605
|
},
|
|
@@ -19348,10 +19629,10 @@ var subchart = {
|
|
|
19348
19629
|
!brushEmpty($$) && $$.brush.update();
|
|
19349
19630
|
Object.keys(shape.type).forEach(function (v) {
|
|
19350
19631
|
var name = capitalize(v);
|
|
19351
|
-
var drawFn = $$["generateDraw"
|
|
19632
|
+
var drawFn = $$["generateDraw".concat(name)](shape.indices[v], true);
|
|
19352
19633
|
// call shape's update & redraw method
|
|
19353
|
-
$$["update"
|
|
19354
|
-
$$["redraw"
|
|
19634
|
+
$$["update".concat(name)](withTransition, true);
|
|
19635
|
+
$$["redraw".concat(name)](drawFn, withTransition, true);
|
|
19355
19636
|
});
|
|
19356
19637
|
if ($$.hasType("bubble") || $$.hasType("scatter")) {
|
|
19357
19638
|
var cx = shape.pos.cx;
|
|
@@ -19390,7 +19671,7 @@ var subchart = {
|
|
|
19390
19671
|
var subchart = $$.$el.subchart, $T = $$.$T;
|
|
19391
19672
|
var subXAxis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisSubX) ?
|
|
19392
19673
|
transitions.axisSubX :
|
|
19393
|
-
$T(subchart.main.select("."
|
|
19674
|
+
$T(subchart.main.select(".".concat(CLASS.axisX)), withTransition);
|
|
19394
19675
|
subchart.main.attr("transform", $$.getTranslate("context"));
|
|
19395
19676
|
subXAxis.attr("transform", $$.getTranslate("subX"));
|
|
19396
19677
|
},
|
|
@@ -20041,7 +20322,7 @@ var zoomModule = function () {
|
|
|
20041
20322
|
var defaults = {};
|
|
20042
20323
|
/**
|
|
20043
20324
|
* @namespace bb
|
|
20044
|
-
* @version 3.
|
|
20325
|
+
* @version 3.3.0
|
|
20045
20326
|
*/
|
|
20046
20327
|
var bb = {
|
|
20047
20328
|
/**
|
|
@@ -20051,7 +20332,7 @@ var bb = {
|
|
|
20051
20332
|
* bb.version; // "1.0.0"
|
|
20052
20333
|
* @memberof bb
|
|
20053
20334
|
*/
|
|
20054
|
-
version: "3.
|
|
20335
|
+
version: "3.3.0",
|
|
20055
20336
|
/**
|
|
20056
20337
|
* Generate chart
|
|
20057
20338
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|