billboard.js 3.2.0 → 3.3.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billboard.css +2 -3
- package/dist/billboard.js +422 -147
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +5645 -3320
- package/dist/billboard.pkgd.min.js +3 -3
- 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 +5061 -3202
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +5087 -3223
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +5086 -3222
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +5080 -3216
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +5079 -3215
- 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 +723 -484
- 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 +60 -60
- package/src/Chart/api/data.ts +3 -4
- package/src/ChartInternal/Axis/Axis.ts +15 -9
- package/src/ChartInternal/ChartInternal.ts +11 -2
- package/src/ChartInternal/data/IData.ts +9 -0
- package/src/ChartInternal/data/convert.ts +1 -1
- package/src/ChartInternal/data/data.ts +29 -12
- package/src/ChartInternal/internals/domain.ts +31 -31
- 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 +4 -4
- package/src/ChartInternal/internals/tooltip.ts +4 -0
- 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 +25 -3
- 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 +18 -4
- package/types/options.d.ts +43 -36
- 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-next.2
|
|
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,
|
|
@@ -1776,8 +1786,8 @@ var data$2 = {
|
|
|
1776
1786
|
* The arguments are:<br>
|
|
1777
1787
|
* - `v` is the value of the data point where the label is shown.
|
|
1778
1788
|
* - `id` is the id of the data where the label is shown.
|
|
1779
|
-
* - `i` is the index of the data point where the label is shown.
|
|
1780
|
-
* - `
|
|
1789
|
+
* - `i` is the index of the data series point where the label is shown.
|
|
1790
|
+
* - `texts` is the array of whole corresponding data series' text labels.<br><br>
|
|
1781
1791
|
* Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
|
|
1782
1792
|
* @property {string|object} [data.labels.backgroundColors] Set label text background colors.
|
|
1783
1793
|
* @property {string|object|Function} [data.labels.colors] Set label text colors.
|
|
@@ -1807,7 +1817,7 @@ var data$2 = {
|
|
|
1807
1817
|
*
|
|
1808
1818
|
* // it's possible to set for each data
|
|
1809
1819
|
* format: {
|
|
1810
|
-
* data1: function(v, id, i,
|
|
1820
|
+
* data1: function(v, id, i, texts) { ... },
|
|
1811
1821
|
* ...
|
|
1812
1822
|
* },
|
|
1813
1823
|
*
|
|
@@ -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];
|
|
@@ -4391,7 +4438,7 @@ var interaction = {
|
|
|
4391
4438
|
*/
|
|
4392
4439
|
var classModule = {
|
|
4393
4440
|
generateClass: function (prefix, targetId) {
|
|
4394
|
-
return " "
|
|
4441
|
+
return " ".concat(prefix, " ").concat(prefix + this.getTargetSelectorSuffix(targetId));
|
|
4395
4442
|
},
|
|
4396
4443
|
/**
|
|
4397
4444
|
* Get class string
|
|
@@ -4419,7 +4466,7 @@ var classModule = {
|
|
|
4419
4466
|
*/
|
|
4420
4467
|
getChartClass: function (type) {
|
|
4421
4468
|
var _this = this;
|
|
4422
|
-
return function (d) { return CLASS["chart"
|
|
4469
|
+
return function (d) { return CLASS["chart".concat(type)] + _this.classTarget((d.data ? d.data : d).id); };
|
|
4423
4470
|
},
|
|
4424
4471
|
generateExtraLineClass: function () {
|
|
4425
4472
|
var $$ = this;
|
|
@@ -4435,13 +4482,13 @@ var classModule = {
|
|
|
4435
4482
|
};
|
|
4436
4483
|
},
|
|
4437
4484
|
classRegion: function (d, i) {
|
|
4438
|
-
return this.generateClass(CLASS.region, i)
|
|
4485
|
+
return "".concat(this.generateClass(CLASS.region, i), " ").concat("class" in d ? d["class"] : "");
|
|
4439
4486
|
},
|
|
4440
4487
|
classTarget: function (id) {
|
|
4441
4488
|
var additionalClassSuffix = this.config.data_classes[id];
|
|
4442
4489
|
var additionalClass = "";
|
|
4443
4490
|
if (additionalClassSuffix) {
|
|
4444
|
-
additionalClass = " "
|
|
4491
|
+
additionalClass = " ".concat(CLASS.target, "-").concat(additionalClassSuffix);
|
|
4445
4492
|
}
|
|
4446
4493
|
return this.generateClass(CLASS.target, id) + additionalClass;
|
|
4447
4494
|
},
|
|
@@ -4449,20 +4496,20 @@ var classModule = {
|
|
|
4449
4496
|
return this.classFocused(d) + this.classDefocused(d);
|
|
4450
4497
|
},
|
|
4451
4498
|
classFocused: function (d) {
|
|
4452
|
-
return " "
|
|
4499
|
+
return " ".concat(this.state.focusedTargetIds.indexOf(d.id) >= 0 ? CLASS.focused : "");
|
|
4453
4500
|
},
|
|
4454
4501
|
classDefocused: function (d) {
|
|
4455
|
-
return " "
|
|
4502
|
+
return " ".concat(this.state.defocusedTargetIds.indexOf(d.id) >= 0 ? CLASS.defocused : "");
|
|
4456
4503
|
},
|
|
4457
4504
|
getTargetSelectorSuffix: function (targetId) {
|
|
4458
|
-
var targetStr = targetId || targetId === 0 ? "-"
|
|
4505
|
+
var targetStr = targetId || targetId === 0 ? "-".concat(targetId) : "";
|
|
4459
4506
|
return targetStr.replace(/([\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\])/g, "-");
|
|
4460
4507
|
},
|
|
4461
4508
|
selectorTarget: function (id, prefix) {
|
|
4462
4509
|
var pfx = prefix || "";
|
|
4463
4510
|
var target = this.getTargetSelectorSuffix(id);
|
|
4464
4511
|
// select target & circle
|
|
4465
|
-
return pfx
|
|
4512
|
+
return "".concat(pfx, ".").concat(CLASS.target + target, ", ").concat(pfx, ".").concat(CLASS.circles + target);
|
|
4466
4513
|
},
|
|
4467
4514
|
selectorTargets: function (idsValue, prefix) {
|
|
4468
4515
|
var _this = this;
|
|
@@ -4471,7 +4518,7 @@ var classModule = {
|
|
|
4471
4518
|
ids.map(function (id) { return _this.selectorTarget(id, prefix); }) : null;
|
|
4472
4519
|
},
|
|
4473
4520
|
selectorLegend: function (id) {
|
|
4474
|
-
return "."
|
|
4521
|
+
return ".".concat(CLASS.legendItem + this.getTargetSelectorSuffix(id));
|
|
4475
4522
|
},
|
|
4476
4523
|
selectorLegends: function (ids) {
|
|
4477
4524
|
var _this = this;
|
|
@@ -4570,10 +4617,10 @@ var color = {
|
|
|
4570
4617
|
// Add background color to patterns
|
|
4571
4618
|
var colorizedPatterns = pattern.map(function (p, index) {
|
|
4572
4619
|
var color = p.replace(/[#\(\)\s,]/g, "");
|
|
4573
|
-
var id = $$.state.datetimeId
|
|
4620
|
+
var id = "".concat($$.state.datetimeId, "-pattern-").concat(color, "-").concat(index);
|
|
4574
4621
|
return colorizePattern(tiles_1[index % tiles_1.length], p, id);
|
|
4575
4622
|
});
|
|
4576
|
-
pattern = colorizedPatterns.map(function (p) { return "url(#"
|
|
4623
|
+
pattern = colorizedPatterns.map(function (p) { return "url(#".concat(p.id, ")"); });
|
|
4577
4624
|
$$.patterns = colorizedPatterns;
|
|
4578
4625
|
}
|
|
4579
4626
|
return function (d) {
|
|
@@ -4640,14 +4687,14 @@ var color = {
|
|
|
4640
4687
|
ids = Object.keys(backgroundColors);
|
|
4641
4688
|
}
|
|
4642
4689
|
ids.forEach(function (v) {
|
|
4643
|
-
var id = state.datetimeId
|
|
4690
|
+
var id = "".concat(state.datetimeId, "-labels-bg").concat($$.getTargetSelectorSuffix(v));
|
|
4644
4691
|
$el.defs.append("filter")
|
|
4645
4692
|
.attr("x", "0")
|
|
4646
4693
|
.attr("y", "0")
|
|
4647
4694
|
.attr("width", "1")
|
|
4648
4695
|
.attr("height", "1")
|
|
4649
4696
|
.attr("id", id)
|
|
4650
|
-
.html("<feFlood flood-color=\""
|
|
4697
|
+
.html("<feFlood flood-color=\"".concat(v === "" ? backgroundColors : backgroundColors[v], "\" /><feComposite in=\"SourceGraphic\"/>"));
|
|
4651
4698
|
});
|
|
4652
4699
|
}
|
|
4653
4700
|
},
|
|
@@ -4677,8 +4724,8 @@ var color = {
|
|
|
4677
4724
|
}
|
|
4678
4725
|
main.selectAll(isObject(d) ?
|
|
4679
4726
|
// when is Arc type
|
|
4680
|
-
"."
|
|
4681
|
-
"."
|
|
4727
|
+
".".concat(CLASS.arc).concat($$.getTargetSelectorSuffix(d.id)) :
|
|
4728
|
+
".".concat(CLASS.shape, "-").concat(d)).style("fill", color);
|
|
4682
4729
|
}
|
|
4683
4730
|
};
|
|
4684
4731
|
|
|
@@ -4691,42 +4738,35 @@ var domain = {
|
|
|
4691
4738
|
var ids = $$.mapToIds(targets);
|
|
4692
4739
|
var ys = $$.getValuesAsIdKeyed(targets);
|
|
4693
4740
|
if (dataGroups.length > 0) {
|
|
4694
|
-
var hasValue_1 = $$["has"
|
|
4695
|
-
|
|
4741
|
+
var hasValue_1 = $$["has".concat(isMin ? "Negative" : "Positive", "ValueInTargets")](targets);
|
|
4742
|
+
dataGroups.forEach(function (groupIds) {
|
|
4696
4743
|
// Determine baseId
|
|
4697
|
-
idsInGroup =
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
}
|
|
4707
|
-
var _loop_2 = function (k, id) {
|
|
4708
|
-
if (!ys[id]) {
|
|
4709
|
-
return "continue";
|
|
4744
|
+
var idsInGroup = groupIds
|
|
4745
|
+
.filter(function (v) { return ids.indexOf(v) >= 0; });
|
|
4746
|
+
if (idsInGroup.length) {
|
|
4747
|
+
var baseId_1 = idsInGroup[0];
|
|
4748
|
+
var baseAxisId_1 = axis.getId(baseId_1);
|
|
4749
|
+
// Initialize base value. Set to 0 if not match with the condition
|
|
4750
|
+
if (hasValue_1 && ys[baseId_1]) {
|
|
4751
|
+
ys[baseId_1] = ys[baseId_1]
|
|
4752
|
+
.map(function (v) { return ((isMin ? v < 0 : v > 0) ? v : 0); });
|
|
4710
4753
|
}
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
ys[
|
|
4754
|
+
idsInGroup
|
|
4755
|
+
.filter(function (v, i) { return i > 0; })
|
|
4756
|
+
.forEach(function (id) {
|
|
4757
|
+
if (ys[id]) {
|
|
4758
|
+
var axisId_1 = axis.getId(id);
|
|
4759
|
+
ys[id].forEach(function (v, i) {
|
|
4760
|
+
var val = +v;
|
|
4761
|
+
var meetCondition = isMin ? val > 0 : val < 0;
|
|
4762
|
+
if (axisId_1 === baseAxisId_1 && !(hasValue_1 && meetCondition)) {
|
|
4763
|
+
ys[baseId_1][i] += val;
|
|
4764
|
+
}
|
|
4765
|
+
});
|
|
4717
4766
|
}
|
|
4718
4767
|
});
|
|
4719
|
-
};
|
|
4720
|
-
for (var k = 1, id = void 0; (id = idsInGroup[k]); k++) {
|
|
4721
|
-
_loop_2(k, id);
|
|
4722
4768
|
}
|
|
4723
|
-
|
|
4724
|
-
};
|
|
4725
|
-
var out_idsInGroup_1;
|
|
4726
|
-
for (var j = 0, idsInGroup = void 0; (idsInGroup = dataGroups[j]); j++) {
|
|
4727
|
-
_loop_1(j, idsInGroup);
|
|
4728
|
-
idsInGroup = out_idsInGroup_1;
|
|
4729
|
-
}
|
|
4769
|
+
});
|
|
4730
4770
|
}
|
|
4731
4771
|
return getMinMax$1(type, Object.keys(ys).map(function (key) { return getMinMax$1(type, ys[key]); }));
|
|
4732
4772
|
},
|
|
@@ -4744,7 +4784,7 @@ var domain = {
|
|
|
4744
4784
|
getYDomain: function (targets, axisId, xDomain) {
|
|
4745
4785
|
var $$ = this;
|
|
4746
4786
|
var axis = $$.axis, config = $$.config, scale = $$.scale;
|
|
4747
|
-
var pfx = "axis_"
|
|
4787
|
+
var pfx = "axis_".concat(axisId);
|
|
4748
4788
|
if ($$.isStackNormalized()) {
|
|
4749
4789
|
return [0, 100];
|
|
4750
4790
|
}
|
|
@@ -4763,17 +4803,17 @@ var domain = {
|
|
|
4763
4803
|
$$.getYDomain(targets, "y2", xDomain);
|
|
4764
4804
|
}
|
|
4765
4805
|
}
|
|
4766
|
-
var yMin = config[pfx
|
|
4767
|
-
var yMax = config[pfx
|
|
4768
|
-
var center = config[pfx
|
|
4769
|
-
var isInverted = config[pfx
|
|
4806
|
+
var yMin = config["".concat(pfx, "_min")];
|
|
4807
|
+
var yMax = config["".concat(pfx, "_max")];
|
|
4808
|
+
var center = config["".concat(pfx, "_center")];
|
|
4809
|
+
var isInverted = config["".concat(pfx, "_inverted")];
|
|
4770
4810
|
var showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated;
|
|
4771
4811
|
var showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated;
|
|
4772
4812
|
var yDomainMin = $$.getYDomainMinMax(yTargets, "min");
|
|
4773
4813
|
var yDomainMax = $$.getYDomainMinMax(yTargets, "max");
|
|
4774
4814
|
var isZeroBased = __spreadArray([TYPE.BAR, TYPE.BUBBLE, TYPE.SCATTER], TYPE_BY_CATEGORY.Line, true).some(function (v) {
|
|
4775
4815
|
var type = v.indexOf("area") > -1 ? "area" : v;
|
|
4776
|
-
return $$.hasType(v, yTargets) && config[type
|
|
4816
|
+
return $$.hasType(v, yTargets) && config["".concat(type, "_zerobased")];
|
|
4777
4817
|
});
|
|
4778
4818
|
// MEMO: avoid inverting domain unexpectedly
|
|
4779
4819
|
yDomainMin = isValue(yMin) ? yMin :
|
|
@@ -4822,9 +4862,10 @@ var domain = {
|
|
|
4822
4862
|
padding[v] += $$.convertPixelToScale("y", lengths_1[i], domainLength);
|
|
4823
4863
|
});
|
|
4824
4864
|
}
|
|
4865
|
+
padding = $$.getResettedPadding(padding);
|
|
4825
4866
|
// if padding is set, the domain will be updated relative the current domain value
|
|
4826
4867
|
// ex) $$.height=300, padding.top=150, domainLength=4 --> domain=6
|
|
4827
|
-
var p = config[pfx
|
|
4868
|
+
var p = config["".concat(pfx, "_padding")];
|
|
4828
4869
|
if (notEmpty(p)) {
|
|
4829
4870
|
["bottom", "top"].forEach(function (v) {
|
|
4830
4871
|
padding[v] = axis.getPadding(p, v, padding[v], domainLength);
|
|
@@ -4842,7 +4883,7 @@ var domain = {
|
|
|
4842
4883
|
getXDomainMinMax: function (targets, type) {
|
|
4843
4884
|
var _a;
|
|
4844
4885
|
var $$ = this;
|
|
4845
|
-
var configValue = $$.config["axis_x_"
|
|
4886
|
+
var configValue = $$.config["axis_x_".concat(type)];
|
|
4846
4887
|
var dataValue = getMinMax$1(type, targets.map(function (t) { return getMinMax$1(type, t.values.map(function (v) { return v.x; })); }));
|
|
4847
4888
|
var value = isObject(configValue) ? configValue.value : configValue;
|
|
4848
4889
|
value = isDefined(value) && ((_a = $$.axis) === null || _a === void 0 ? void 0 : _a.isTimeSeries()) ? parseDate.bind(this)(value) : value;
|
|
@@ -4874,7 +4915,7 @@ var domain = {
|
|
|
4874
4915
|
defaultValue = maxDataCount > 1 ? (diff / (maxDataCount - 1)) / 2 : 0.5;
|
|
4875
4916
|
}
|
|
4876
4917
|
else {
|
|
4877
|
-
defaultValue = diff * 0.01;
|
|
4918
|
+
defaultValue = $$.getResettedPadding(diff * 0.01);
|
|
4878
4919
|
}
|
|
4879
4920
|
var _a = isNumber(padding) ?
|
|
4880
4921
|
{ left: padding, right: padding } : padding, _b = _a.left, left = _b === void 0 ? defaultValue : _b, _c = _a.right, right = _c === void 0 ? defaultValue : _c;
|
|
@@ -5022,7 +5063,7 @@ var domain = {
|
|
|
5022
5063
|
*/
|
|
5023
5064
|
function getFormat($$, typeValue, v) {
|
|
5024
5065
|
var config = $$.config;
|
|
5025
|
-
var type = "axis_"
|
|
5066
|
+
var type = "axis_".concat(typeValue, "_tick_format");
|
|
5026
5067
|
var format = config[type] ?
|
|
5027
5068
|
config[type] : $$.defaultValueFormat;
|
|
5028
5069
|
return format(v);
|
|
@@ -5050,7 +5091,7 @@ var format = {
|
|
|
5050
5091
|
return isValue(v) ? +v : "";
|
|
5051
5092
|
},
|
|
5052
5093
|
defaultArcValueFormat: function (v, ratio) {
|
|
5053
|
-
return (ratio * 100).toFixed(1)
|
|
5094
|
+
return "".concat((ratio * 100).toFixed(1), "%");
|
|
5054
5095
|
},
|
|
5055
5096
|
dataLabelFormat: function (targetId) {
|
|
5056
5097
|
var $$ = this;
|
|
@@ -5126,7 +5167,7 @@ var legend$1 = {
|
|
|
5126
5167
|
$$.updateLegendElement(targetIds || $$.mapToIds($$.data.targets), optionz, transitions);
|
|
5127
5168
|
}
|
|
5128
5169
|
// toggle legend state
|
|
5129
|
-
$el.legend.selectAll("."
|
|
5170
|
+
$el.legend.selectAll(".".concat(CLASS.legendItem))
|
|
5130
5171
|
.classed(CLASS.legendItemHidden, function (id) {
|
|
5131
5172
|
var hide = !$$.isTargetToShow(id);
|
|
5132
5173
|
if (hide) {
|
|
@@ -5243,7 +5284,7 @@ var legend$1 = {
|
|
|
5243
5284
|
updateLegendItemColor: function (id, color) {
|
|
5244
5285
|
var legend = this.$el.legend;
|
|
5245
5286
|
if (legend) {
|
|
5246
|
-
legend.select("."
|
|
5287
|
+
legend.select(".".concat(CLASS.legendItem, "-").concat(id, " line"))
|
|
5247
5288
|
.style("stroke", color);
|
|
5248
5289
|
}
|
|
5249
5290
|
},
|
|
@@ -5288,7 +5329,7 @@ var legend$1 = {
|
|
|
5288
5329
|
var $$ = this;
|
|
5289
5330
|
var legend = $$.$el.legend, $T = $$.$T;
|
|
5290
5331
|
var targetIdz = $$.mapToTargetIds(targetIds);
|
|
5291
|
-
legend && $T(legend.selectAll("."
|
|
5332
|
+
legend && $T(legend.selectAll(".".concat(CLASS.legendItem))
|
|
5292
5333
|
.filter(function (id) { return targetIdz.indexOf(id) >= 0; })
|
|
5293
5334
|
.classed(CLASS.legendItemFocused, focus))
|
|
5294
5335
|
.style("opacity", function () {
|
|
@@ -5303,7 +5344,7 @@ var legend$1 = {
|
|
|
5303
5344
|
revertLegend: function () {
|
|
5304
5345
|
var $$ = this;
|
|
5305
5346
|
var legend = $$.$el.legend, $T = $$.$T;
|
|
5306
|
-
legend && $T(legend.selectAll("."
|
|
5347
|
+
legend && $T(legend.selectAll(".".concat(CLASS.legendItem))
|
|
5307
5348
|
.classed(CLASS.legendItemFocused, false))
|
|
5308
5349
|
.style("opacity", null);
|
|
5309
5350
|
},
|
|
@@ -5405,7 +5446,7 @@ var legend$1 = {
|
|
|
5405
5446
|
if (!callFn(config.legend_item_onout, api, id)) {
|
|
5406
5447
|
select(this).classed(CLASS.legendItemFocused, false);
|
|
5407
5448
|
if (hasGauge) {
|
|
5408
|
-
$$.undoMarkOverlapped($$, "."
|
|
5449
|
+
$$.undoMarkOverlapped($$, ".".concat(CLASS.gaugeValue));
|
|
5409
5450
|
}
|
|
5410
5451
|
$$.api.revert();
|
|
5411
5452
|
}
|
|
@@ -5414,7 +5455,7 @@ var legend$1 = {
|
|
|
5414
5455
|
if (!callFn(config.legend_item_onover, api, id)) {
|
|
5415
5456
|
select(this).classed(CLASS.legendItemFocused, true);
|
|
5416
5457
|
if (hasGauge) {
|
|
5417
|
-
$$.markOverlapped(id, $$, "."
|
|
5458
|
+
$$.markOverlapped(id, $$, ".".concat(CLASS.gaugeValue));
|
|
5418
5459
|
}
|
|
5419
5460
|
if (!state.transiting && $$.isTargetToShow(id)) {
|
|
5420
5461
|
api.focus(id);
|
|
@@ -5542,7 +5583,7 @@ var legend$1 = {
|
|
|
5542
5583
|
var yForLegendTile = function (id, i) { return yForLegend(id, i) + 4; };
|
|
5543
5584
|
var pos = -200;
|
|
5544
5585
|
// Define g for legend area
|
|
5545
|
-
var l = legend.selectAll("."
|
|
5586
|
+
var l = legend.selectAll(".".concat(CLASS.legendItem))
|
|
5546
5587
|
.data(targetIdz)
|
|
5547
5588
|
.enter()
|
|
5548
5589
|
.append("g");
|
|
@@ -5585,7 +5626,8 @@ var legend$1 = {
|
|
|
5585
5626
|
.attr("href", function (data, idx, selection) {
|
|
5586
5627
|
var node = selection[idx];
|
|
5587
5628
|
var nodeName = node.nodeName.toLowerCase();
|
|
5588
|
-
|
|
5629
|
+
var id = $$.getTargetSelectorSuffix(data);
|
|
5630
|
+
return nodeName === "use" ? "#".concat(state.datetimeId, "-point").concat(id) : undefined;
|
|
5589
5631
|
});
|
|
5590
5632
|
}
|
|
5591
5633
|
else {
|
|
@@ -5600,9 +5642,9 @@ var legend$1 = {
|
|
|
5600
5642
|
.attr("stroke-width", config.legend_item_tile_height);
|
|
5601
5643
|
}
|
|
5602
5644
|
// Set background for inset legend
|
|
5603
|
-
background = legend.select("."
|
|
5645
|
+
background = legend.select(".".concat(CLASS.legendBackground, " rect"));
|
|
5604
5646
|
if (state.isLegendInset && maxWidth > 0 && background.size() === 0) {
|
|
5605
|
-
background = legend.insert("g", "."
|
|
5647
|
+
background = legend.insert("g", ".".concat(CLASS.legendItem))
|
|
5606
5648
|
.attr("class", CLASS.legendBackground)
|
|
5607
5649
|
.append("rect");
|
|
5608
5650
|
}
|
|
@@ -5615,7 +5657,7 @@ var legend$1 = {
|
|
|
5615
5657
|
$T(texts, withTransition)
|
|
5616
5658
|
.attr("x", xForLegendText)
|
|
5617
5659
|
.attr("y", yForLegendText);
|
|
5618
|
-
var rects = legend.selectAll("rect."
|
|
5660
|
+
var rects = legend.selectAll("rect.".concat(CLASS.legendItemEvent))
|
|
5619
5661
|
.data(targetIdz);
|
|
5620
5662
|
$T(rects, withTransition)
|
|
5621
5663
|
.attr("width", function (id) { return widths[id]; })
|
|
@@ -5623,7 +5665,7 @@ var legend$1 = {
|
|
|
5623
5665
|
.attr("x", xForLegendRect)
|
|
5624
5666
|
.attr("y", yForLegendRect);
|
|
5625
5667
|
if (usePoint) {
|
|
5626
|
-
var tiles = legend.selectAll("."
|
|
5668
|
+
var tiles = legend.selectAll(".".concat(CLASS.legendItemPoint))
|
|
5627
5669
|
.data(targetIdz);
|
|
5628
5670
|
$T(tiles, withTransition)
|
|
5629
5671
|
.each(function () {
|
|
@@ -5659,7 +5701,7 @@ var legend$1 = {
|
|
|
5659
5701
|
});
|
|
5660
5702
|
}
|
|
5661
5703
|
else {
|
|
5662
|
-
var tiles = legend.selectAll("line."
|
|
5704
|
+
var tiles = legend.selectAll("line.".concat(CLASS.legendItemTile))
|
|
5663
5705
|
.data(targetIdz);
|
|
5664
5706
|
$T(tiles, withTransition)
|
|
5665
5707
|
.style("stroke", getColor)
|
|
@@ -5693,8 +5735,7 @@ var redraw = {
|
|
|
5693
5735
|
var main = $el.main;
|
|
5694
5736
|
state.redrawing = true;
|
|
5695
5737
|
var targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
|
5696
|
-
var initializing = options.initializing;
|
|
5697
|
-
var flow = options.flow;
|
|
5738
|
+
var flow = options.flow, initializing = options.initializing;
|
|
5698
5739
|
var wth = $$.getWithOption(options);
|
|
5699
5740
|
var duration = wth.Transition ? config.transition_duration : 0;
|
|
5700
5741
|
var durationForExit = wth.TransitionForExit ? duration : 0;
|
|
@@ -5720,7 +5761,7 @@ var redraw = {
|
|
|
5720
5761
|
// @TODO: Make 'init' state to be accessible everywhere not passing as argument.
|
|
5721
5762
|
$$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing);
|
|
5722
5763
|
// Data empty label positioning and text.
|
|
5723
|
-
config.data_empty_label_text && main.select("text."
|
|
5764
|
+
config.data_empty_label_text && main.select("text.".concat(CLASS.text, ".").concat(CLASS.empty))
|
|
5724
5765
|
.attr("x", state.width / 2)
|
|
5725
5766
|
.attr("y", state.height / 2)
|
|
5726
5767
|
.text(config.data_empty_label_text)
|
|
@@ -5732,11 +5773,11 @@ var redraw = {
|
|
|
5732
5773
|
["bar", "candlestick", "line", "area"].forEach(function (v) {
|
|
5733
5774
|
var name = capitalize(v);
|
|
5734
5775
|
if ((/^(line|area)$/.test(v) && $$.hasTypeOf(name)) || $$.hasType(v)) {
|
|
5735
|
-
$$["update"
|
|
5776
|
+
$$["update".concat(name)](wth.TransitionForExit);
|
|
5736
5777
|
}
|
|
5737
5778
|
});
|
|
5738
5779
|
// circles for select
|
|
5739
|
-
$el.text && main.selectAll("."
|
|
5780
|
+
$el.text && main.selectAll(".".concat(CLASS.selectedCircles))
|
|
5740
5781
|
.filter($$.isBarType.bind($$))
|
|
5741
5782
|
.selectAll("circle")
|
|
5742
5783
|
.remove();
|
|
@@ -5836,7 +5877,7 @@ var redraw = {
|
|
|
5836
5877
|
var name = capitalize(v);
|
|
5837
5878
|
var drawFn = shape.type[v];
|
|
5838
5879
|
if ((/^(area|line)$/.test(v) && $$.hasTypeOf(name)) || $$.hasType(v)) {
|
|
5839
|
-
list.push($$["redraw"
|
|
5880
|
+
list.push($$["redraw".concat(name)](drawFn, withTransition));
|
|
5840
5881
|
}
|
|
5841
5882
|
});
|
|
5842
5883
|
!flow && grid.main && list.push($$.updateGridFocus());
|
|
@@ -5881,6 +5922,7 @@ var redraw = {
|
|
|
5881
5922
|
redrawWithoutRescale: function () {
|
|
5882
5923
|
this.redraw({
|
|
5883
5924
|
withY: false,
|
|
5925
|
+
withLegend: true,
|
|
5884
5926
|
withSubchart: false,
|
|
5885
5927
|
withEventRect: false,
|
|
5886
5928
|
withTransitionForAxis: false
|
|
@@ -6005,16 +6047,17 @@ var scale = {
|
|
|
6005
6047
|
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;
|
|
6006
6048
|
if (hasAxis) {
|
|
6007
6049
|
var isRotated = config.axis_rotated;
|
|
6050
|
+
var resettedPadding = $$.getResettedPadding(1);
|
|
6008
6051
|
// update edges
|
|
6009
6052
|
var min = {
|
|
6010
|
-
x: isRotated ?
|
|
6053
|
+
x: isRotated ? resettedPadding : 0,
|
|
6011
6054
|
y: isRotated ? 0 : height,
|
|
6012
6055
|
subX: isRotated ? 1 : 0,
|
|
6013
6056
|
subY: isRotated ? 0 : height2
|
|
6014
6057
|
};
|
|
6015
6058
|
var max = {
|
|
6016
6059
|
x: isRotated ? height : width,
|
|
6017
|
-
y: isRotated ? width :
|
|
6060
|
+
y: isRotated ? width : resettedPadding,
|
|
6018
6061
|
subX: isRotated ? height : width,
|
|
6019
6062
|
subY: isRotated ? width2 : 1
|
|
6020
6063
|
};
|
|
@@ -6100,8 +6143,8 @@ var shape = {
|
|
|
6100
6143
|
["bar", "candlestick", "line", "area"].forEach(function (v) {
|
|
6101
6144
|
var name = capitalize(/^(bubble|scatter)$/.test(v) ? "line" : v);
|
|
6102
6145
|
if ($$.hasType(v) || $$.hasTypeOf(name) || (v === "line" && ($$.hasType("bubble") || $$.hasType("scatter")))) {
|
|
6103
|
-
var indices = $$.getShapeIndices($$["is"
|
|
6104
|
-
var drawFn = $$["generateDraw"
|
|
6146
|
+
var indices = $$.getShapeIndices($$["is".concat(name, "Type")]);
|
|
6147
|
+
var drawFn = $$["generateDraw".concat(name)];
|
|
6105
6148
|
shape.indices[v] = indices;
|
|
6106
6149
|
shape.type[v] = drawFn ? drawFn.bind($$)(indices, false) : undefined;
|
|
6107
6150
|
}
|
|
@@ -6119,6 +6162,19 @@ var shape = {
|
|
|
6119
6162
|
}
|
|
6120
6163
|
return shape;
|
|
6121
6164
|
},
|
|
6165
|
+
/**
|
|
6166
|
+
* Get shape's indices according it's position
|
|
6167
|
+
*
|
|
6168
|
+
* From the below example, indices will be:
|
|
6169
|
+
* ==> {data1: 0, data2: 0, data3: 1, data4: 1, __max__: 1}
|
|
6170
|
+
*
|
|
6171
|
+
* data1 data3 data1 data3
|
|
6172
|
+
* data2 data4 data2 data4
|
|
6173
|
+
* -------------------------
|
|
6174
|
+
* 0 1
|
|
6175
|
+
* @param {Function} typeFilter Chart type filter function
|
|
6176
|
+
* @returns {object} Indices object with its position
|
|
6177
|
+
*/
|
|
6122
6178
|
getShapeIndices: function (typeFilter) {
|
|
6123
6179
|
var $$ = this;
|
|
6124
6180
|
var config = $$.config;
|
|
@@ -6158,12 +6214,25 @@ var shape = {
|
|
|
6158
6214
|
/**
|
|
6159
6215
|
* Get indices value based on data ID value
|
|
6160
6216
|
* @param {object} indices Indices object
|
|
6161
|
-
* @param {
|
|
6217
|
+
* @param {object} d Data row
|
|
6218
|
+
* @param {string} caller Caller function name (Used only for 'sparkline' plugin)
|
|
6162
6219
|
* @returns {object} Indices object
|
|
6163
6220
|
* @private
|
|
6164
6221
|
*/
|
|
6165
|
-
getIndices: function (indices,
|
|
6166
|
-
var
|
|
6222
|
+
getIndices: function (indices, d, caller) {
|
|
6223
|
+
var $$ = this;
|
|
6224
|
+
var _a = $$.config, xs = _a.data_xs, removeNull = _a.bar_indices_removeNull;
|
|
6225
|
+
var id = d.id, index = d.index;
|
|
6226
|
+
if ($$.isBarType(id) && removeNull) {
|
|
6227
|
+
var ind_1 = {};
|
|
6228
|
+
// redefine bar indices order
|
|
6229
|
+
$$.getAllValuesOnIndex(index, true)
|
|
6230
|
+
.forEach(function (v, i) {
|
|
6231
|
+
ind_1[v.id] = i;
|
|
6232
|
+
ind_1.__max__ = i;
|
|
6233
|
+
});
|
|
6234
|
+
return ind_1;
|
|
6235
|
+
}
|
|
6167
6236
|
return notEmpty(xs) ?
|
|
6168
6237
|
indices[xs[id]] : indices;
|
|
6169
6238
|
},
|
|
@@ -6188,7 +6257,7 @@ var shape = {
|
|
|
6188
6257
|
var sum = function (p, c) { return p + c; };
|
|
6189
6258
|
var halfWidth = isObjectType(offset) && (offset._$total.length ? offset._$total.reduce(sum) / 2 : 0);
|
|
6190
6259
|
return function (d) {
|
|
6191
|
-
var ind = $$.getIndices(indices, d
|
|
6260
|
+
var ind = $$.getIndices(indices, d, "getShapeX");
|
|
6192
6261
|
var index = d.id in ind ? ind[d.id] : 0;
|
|
6193
6262
|
var targetsNum = (ind.__max__ || 0) + 1;
|
|
6194
6263
|
var x = 0;
|
|
@@ -6232,6 +6301,10 @@ var shape = {
|
|
|
6232
6301
|
else if ($$.isBubbleZType(d)) {
|
|
6233
6302
|
value = $$.getBubbleZData(d.value, "y");
|
|
6234
6303
|
}
|
|
6304
|
+
else if ($$.isBarRangeType(d)) {
|
|
6305
|
+
// TODO use range.getEnd() like method
|
|
6306
|
+
value = value[1];
|
|
6307
|
+
}
|
|
6235
6308
|
return $$.getYScaleById(d.id, isSub)(value);
|
|
6236
6309
|
};
|
|
6237
6310
|
},
|
|
@@ -6288,8 +6361,12 @@ var shape = {
|
|
|
6288
6361
|
var _a = $$.getShapeOffsetData(typeFilter), shapeOffsetTargets = _a.shapeOffsetTargets, indexMapByTargetId = _a.indexMapByTargetId;
|
|
6289
6362
|
return function (d, idx) {
|
|
6290
6363
|
var id = d.id, value = d.value, x = d.x;
|
|
6291
|
-
var ind = $$.getIndices(indices,
|
|
6364
|
+
var ind = $$.getIndices(indices, d);
|
|
6292
6365
|
var scale = $$.getYScaleById(id, isSub);
|
|
6366
|
+
if ($$.isBarRangeType(d)) {
|
|
6367
|
+
// TODO use range.getStart()
|
|
6368
|
+
return scale(value[0]);
|
|
6369
|
+
}
|
|
6293
6370
|
var y0 = scale($$.getShapeYMin(id));
|
|
6294
6371
|
var dataXAsNumber = Number(x);
|
|
6295
6372
|
var offset = y0;
|
|
@@ -6297,6 +6374,7 @@ var shape = {
|
|
|
6297
6374
|
.filter(function (t) { return t.id !== id; })
|
|
6298
6375
|
.forEach(function (t) {
|
|
6299
6376
|
var tid = t.id, rowValueMapByXValue = t.rowValueMapByXValue, rowValues = t.rowValues, tvalues = t.values;
|
|
6377
|
+
// for same stacked group (ind[tid] === ind[id])
|
|
6300
6378
|
if (ind[tid] === ind[id] && indexMapByTargetId[tid] < indexMapByTargetId[id]) {
|
|
6301
6379
|
var row = rowValues[idx];
|
|
6302
6380
|
// check if the x values line up
|
|
@@ -6316,14 +6394,14 @@ var shape = {
|
|
|
6316
6394
|
var config = $$.config, org = $$.org, scale = $$.scale;
|
|
6317
6395
|
var maxDataCount = $$.getMaxDataCount();
|
|
6318
6396
|
var isGrouped = type === "bar" && config.data_groups.length;
|
|
6319
|
-
var configName = type
|
|
6397
|
+
var configName = "".concat(type, "_width");
|
|
6320
6398
|
var tickInterval = scale.zoom && !$$.axis.isCategorized() ?
|
|
6321
6399
|
(org.xDomain.map(function (v) { return scale.zoom(v); })
|
|
6322
6400
|
.reduce(function (a, c) { return Math.abs(a) + c; }) / maxDataCount) : axis.tickInterval(maxDataCount);
|
|
6323
6401
|
var getWidth = function (id) {
|
|
6324
6402
|
var width = id ? config[configName][id] : config[configName];
|
|
6325
|
-
var ratio = id ? width.ratio : config[configName
|
|
6326
|
-
var max = id ? width.max : config[configName
|
|
6403
|
+
var ratio = id ? width.ratio : config["".concat(configName, "_ratio")];
|
|
6404
|
+
var max = id ? width.max : config["".concat(configName, "_max")];
|
|
6327
6405
|
var w = isNumber(width) ?
|
|
6328
6406
|
width : targetsNum ? (tickInterval * ratio) / targetsNum : 0;
|
|
6329
6407
|
return max && w > max ? max : w;
|
|
@@ -6351,7 +6429,7 @@ var shape = {
|
|
|
6351
6429
|
getShapeByIndex: function (shapeName, i, id) {
|
|
6352
6430
|
var $$ = this;
|
|
6353
6431
|
var $el = $$.$el;
|
|
6354
|
-
var suffix = (isValue(i) ? "-"
|
|
6432
|
+
var suffix = (isValue(i) ? "-".concat(i) : "");
|
|
6355
6433
|
var shape = $el[shapeName];
|
|
6356
6434
|
// filter from shape reference if has
|
|
6357
6435
|
if (shape && !shape.empty()) {
|
|
@@ -6361,8 +6439,8 @@ var shape = {
|
|
|
6361
6439
|
}
|
|
6362
6440
|
else {
|
|
6363
6441
|
shape = (id ? $el.main
|
|
6364
|
-
.selectAll("."
|
|
6365
|
-
.selectAll("."
|
|
6442
|
+
.selectAll(".".concat(CLASS["".concat(shapeName, "s")]).concat($$.getTargetSelectorSuffix(id))) : $el.main)
|
|
6443
|
+
.selectAll(".".concat(CLASS[shapeName]).concat(suffix));
|
|
6366
6444
|
}
|
|
6367
6445
|
return shape;
|
|
6368
6446
|
},
|
|
@@ -6416,6 +6494,24 @@ var shape = {
|
|
|
6416
6494
|
return $$.isSplineType(d) ?
|
|
6417
6495
|
interpolation : ($$.isStepType(d) ?
|
|
6418
6496
|
config.line_step_type : "linear");
|
|
6497
|
+
},
|
|
6498
|
+
isWithinBar: function (that) {
|
|
6499
|
+
var mouse = getPointer(this.state.event, that);
|
|
6500
|
+
var list = getRectSegList(that);
|
|
6501
|
+
var seg0 = list[0], seg1 = list[1];
|
|
6502
|
+
var x = Math.min(seg0.x, seg1.x);
|
|
6503
|
+
var y = Math.min(seg0.y, seg1.y);
|
|
6504
|
+
var offset = this.config.bar_sensitivity;
|
|
6505
|
+
var _a = that.getBBox(), width = _a.width, height = _a.height;
|
|
6506
|
+
var sx = x - offset;
|
|
6507
|
+
var ex = x + width + offset;
|
|
6508
|
+
var sy = y + height + offset;
|
|
6509
|
+
var ey = y - offset;
|
|
6510
|
+
var isWithin = sx < mouse[0] &&
|
|
6511
|
+
mouse[0] < ex &&
|
|
6512
|
+
ey < mouse[1] &&
|
|
6513
|
+
mouse[1] < sy;
|
|
6514
|
+
return isWithin;
|
|
6419
6515
|
}
|
|
6420
6516
|
};
|
|
6421
6517
|
|
|
@@ -6462,7 +6558,7 @@ var size = {
|
|
|
6462
6558
|
var $$ = this;
|
|
6463
6559
|
var config = $$.config, hasAxis = $$.state.hasAxis;
|
|
6464
6560
|
var axisId = config.axis_rotated ? "y" : "x";
|
|
6465
|
-
var axesLen = hasAxis ? config["axis_"
|
|
6561
|
+
var axesLen = hasAxis ? config["axis_".concat(axisId, "_axes")].length : 0;
|
|
6466
6562
|
var padding = isValue(config.padding_bottom) ?
|
|
6467
6563
|
config.padding_bottom : 0;
|
|
6468
6564
|
return padding + (axesLen ? $$.getHorizontalAxisHeight(axisId) * axesLen : 0);
|
|
@@ -6472,7 +6568,7 @@ var size = {
|
|
|
6472
6568
|
var config = $$.config, hasAxis = $$.state.hasAxis;
|
|
6473
6569
|
var isRotated = config.axis_rotated;
|
|
6474
6570
|
var axisId = isRotated ? "x" : "y";
|
|
6475
|
-
var axesLen = hasAxis ? config["axis_"
|
|
6571
|
+
var axesLen = hasAxis ? config["axis_".concat(axisId, "_axes")].length : 0;
|
|
6476
6572
|
var axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0;
|
|
6477
6573
|
var padding;
|
|
6478
6574
|
if (isValue(config.padding_left)) {
|
|
@@ -6522,7 +6618,7 @@ var size = {
|
|
|
6522
6618
|
* @private
|
|
6523
6619
|
*/
|
|
6524
6620
|
getParentRectValue: function (key) {
|
|
6525
|
-
var offsetName = "offset"
|
|
6621
|
+
var offsetName = "offset".concat(capitalize(key));
|
|
6526
6622
|
var parent = this.$el.chart.node();
|
|
6527
6623
|
var v = 0;
|
|
6528
6624
|
while (v < 30 && parent && parent.tagName !== "BODY") {
|
|
@@ -6562,7 +6658,7 @@ var size = {
|
|
|
6562
6658
|
var config = $$.config, $el = $$.$el;
|
|
6563
6659
|
var hasLeftAxisRect = config.axis_rotated || (!config.axis_rotated && !config.axis_y_inner);
|
|
6564
6660
|
var leftAxisClass = config.axis_rotated ? CLASS.axisX : CLASS.axisY;
|
|
6565
|
-
var leftAxis = $el.main.select("."
|
|
6661
|
+
var leftAxis = $el.main.select(".".concat(leftAxisClass)).node();
|
|
6566
6662
|
var svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : { right: 0 };
|
|
6567
6663
|
var chartRect = $el.chart.node().getBoundingClientRect();
|
|
6568
6664
|
var hasArc = $$.hasArcType();
|
|
@@ -6589,28 +6685,53 @@ var size = {
|
|
|
6589
6685
|
.attr("width", current.width)
|
|
6590
6686
|
.attr("height", current.height);
|
|
6591
6687
|
if (hasAxis) {
|
|
6592
|
-
var brush = svg.select("."
|
|
6688
|
+
var brush = svg.select(".".concat(CLASS.brush, " .overlay"));
|
|
6593
6689
|
var brushSize = { width: 0, height: 0 };
|
|
6594
6690
|
if (brush.size()) {
|
|
6595
6691
|
brushSize.width = +brush.attr("width");
|
|
6596
6692
|
brushSize.height = +brush.attr("height");
|
|
6597
6693
|
}
|
|
6598
|
-
svg.selectAll(["#"
|
|
6694
|
+
svg.selectAll(["#".concat(clip.id), "#".concat(clip.idGrid)])
|
|
6599
6695
|
.select("rect")
|
|
6600
6696
|
.attr("width", width)
|
|
6601
6697
|
.attr("height", height);
|
|
6602
|
-
svg.select("#"
|
|
6698
|
+
svg.select("#".concat(clip.idXAxis))
|
|
6603
6699
|
.select("rect")
|
|
6604
6700
|
.call($$.setXAxisClipPath.bind($$));
|
|
6605
|
-
svg.select("#"
|
|
6701
|
+
svg.select("#".concat(clip.idYAxis))
|
|
6606
6702
|
.select("rect")
|
|
6607
6703
|
.call($$.setYAxisClipPath.bind($$));
|
|
6608
|
-
clip.idSubchart && svg.select("#"
|
|
6704
|
+
clip.idSubchart && svg.select("#".concat(clip.idSubchart))
|
|
6609
6705
|
.select("rect")
|
|
6610
6706
|
.attr("width", width)
|
|
6611
6707
|
.attr("height", brushSize.height);
|
|
6612
6708
|
}
|
|
6613
6709
|
},
|
|
6710
|
+
/**
|
|
6711
|
+
* Get resetted padding values when 'padding=false' option is set
|
|
6712
|
+
* https://github.com/naver/billboard.js/issues/2367
|
|
6713
|
+
* @param {number|object} v Padding values to be resetted
|
|
6714
|
+
* @returns {number|object} Padding value
|
|
6715
|
+
* @private
|
|
6716
|
+
*/
|
|
6717
|
+
getResettedPadding: function (v) {
|
|
6718
|
+
var $$ = this;
|
|
6719
|
+
var config = $$.config;
|
|
6720
|
+
var isNum = isNumber(v);
|
|
6721
|
+
var p = isNum ? 0 : {};
|
|
6722
|
+
if (config.padding === false) {
|
|
6723
|
+
!isNum && Object.keys(v).forEach(function (key) {
|
|
6724
|
+
// when data.lables=true, do not reset top padding
|
|
6725
|
+
p[key] = (!isEmpty(config.data_labels) &&
|
|
6726
|
+
config.data_labels !== false &&
|
|
6727
|
+
key === "top") ? v[key] : 0;
|
|
6728
|
+
});
|
|
6729
|
+
}
|
|
6730
|
+
else {
|
|
6731
|
+
p = v;
|
|
6732
|
+
}
|
|
6733
|
+
return p;
|
|
6734
|
+
},
|
|
6614
6735
|
/**
|
|
6615
6736
|
* Update size values
|
|
6616
6737
|
* @param {boolean} isInit If is called at initialization
|
|
@@ -6648,6 +6769,7 @@ var size = {
|
|
|
6648
6769
|
bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
|
|
6649
6770
|
left: hasArc ? 0 : $$.getCurrentPaddingLeft()
|
|
6650
6771
|
};
|
|
6772
|
+
state.margin = $$.getResettedPadding(state.margin);
|
|
6651
6773
|
// for subchart
|
|
6652
6774
|
state.margin2 = isRotated ? {
|
|
6653
6775
|
top: state.margin.top,
|
|
@@ -6716,7 +6838,7 @@ var text = {
|
|
|
6716
6838
|
*/
|
|
6717
6839
|
initText: function () {
|
|
6718
6840
|
var $el = this.$el;
|
|
6719
|
-
$el.main.select("."
|
|
6841
|
+
$el.main.select(".".concat(CLASS.chart)).append("g")
|
|
6720
6842
|
.attr("class", CLASS.chartTexts);
|
|
6721
6843
|
},
|
|
6722
6844
|
/**
|
|
@@ -6729,7 +6851,7 @@ var text = {
|
|
|
6729
6851
|
var classChartText = $$.getChartClass("Text");
|
|
6730
6852
|
var classTexts = $$.getClass("texts", "id");
|
|
6731
6853
|
var classFocus = $$.classFocus.bind($$);
|
|
6732
|
-
var mainTextUpdate = $$.$el.main.select("."
|
|
6854
|
+
var mainTextUpdate = $$.$el.main.select(".".concat(CLASS.chartTexts)).selectAll(".".concat(CLASS.chartText))
|
|
6733
6855
|
.data(targets)
|
|
6734
6856
|
.attr("class", function (d) { return classChartText(d) + classFocus(d); });
|
|
6735
6857
|
var mainTextEnter = mainTextUpdate.enter().append("g")
|
|
@@ -6747,8 +6869,8 @@ var text = {
|
|
|
6747
6869
|
var $$ = this;
|
|
6748
6870
|
var $el = $$.$el, $T = $$.$T, config = $$.config;
|
|
6749
6871
|
var classText = $$.getClass("text", "index");
|
|
6750
|
-
var text = $el.main.selectAll("."
|
|
6751
|
-
.selectAll("."
|
|
6872
|
+
var text = $el.main.selectAll(".".concat(CLASS.texts))
|
|
6873
|
+
.selectAll(".".concat(CLASS.text))
|
|
6752
6874
|
.data($$.labelishData.bind($$));
|
|
6753
6875
|
$T(text.exit())
|
|
6754
6876
|
.style("fill-opacity", "0")
|
|
@@ -6768,7 +6890,7 @@ var text = {
|
|
|
6768
6890
|
})
|
|
6769
6891
|
.style("fill", $$.updateTextColor.bind($$))
|
|
6770
6892
|
.style("fill-opacity", "0")
|
|
6771
|
-
.each(function (d, i,
|
|
6893
|
+
.each(function (d, i, texts) {
|
|
6772
6894
|
var node = select(this);
|
|
6773
6895
|
var value = d.value;
|
|
6774
6896
|
if ($$.isBubbleZType(d)) {
|
|
@@ -6780,7 +6902,7 @@ var text = {
|
|
|
6780
6902
|
value = data.close;
|
|
6781
6903
|
}
|
|
6782
6904
|
}
|
|
6783
|
-
value = $$.dataLabelFormat(d.id)(value, d.id, i,
|
|
6905
|
+
value = $$.dataLabelFormat(d.id)(value, d.id, i, texts);
|
|
6784
6906
|
if (isNumber(value)) {
|
|
6785
6907
|
this.textContent = value;
|
|
6786
6908
|
}
|
|
@@ -6829,7 +6951,7 @@ var text = {
|
|
|
6829
6951
|
var id = isString(backgroundColor) ? "" : $$.getTargetSelectorSuffix(("id" in d ? d.id : d.data.id));
|
|
6830
6952
|
var filter = $el.defs.select(["filter[id*='labels-bg", "']"].join(id));
|
|
6831
6953
|
if (filter.size()) {
|
|
6832
|
-
color = "url(#"
|
|
6954
|
+
color = "url(#".concat(filter.attr("id"), ")");
|
|
6833
6955
|
}
|
|
6834
6956
|
}
|
|
6835
6957
|
return color || null;
|
|
@@ -6858,7 +6980,7 @@ var text = {
|
|
|
6858
6980
|
var posY = y.bind(this)(d, i);
|
|
6859
6981
|
// when is multiline
|
|
6860
6982
|
if (this.childElementCount) {
|
|
6861
|
-
node.attr("transform", "translate("
|
|
6983
|
+
node.attr("transform", "translate(".concat(posX, " ").concat(posY, ")"));
|
|
6862
6984
|
}
|
|
6863
6985
|
else {
|
|
6864
6986
|
node.attr("x", posX).attr("y", posY);
|
|
@@ -6882,7 +7004,7 @@ var text = {
|
|
|
6882
7004
|
base = base.querySelector("text");
|
|
6883
7005
|
}
|
|
6884
7006
|
var text = base.textContent;
|
|
6885
|
-
var cacheKey = KEY.textRect
|
|
7007
|
+
var cacheKey = "".concat(KEY.textRect, "-").concat(text.replace(/\W/g, "_"));
|
|
6886
7008
|
var rect = $$.cache.get(cacheKey);
|
|
6887
7009
|
if (!rect) {
|
|
6888
7010
|
$$.$el.svg.append("text")
|
|
@@ -6912,7 +7034,7 @@ var text = {
|
|
|
6912
7034
|
var getter = forX ? $$.getXForText : $$.getYForText;
|
|
6913
7035
|
$$.hasType("radar") && types.push("radar");
|
|
6914
7036
|
types.forEach(function (v) {
|
|
6915
|
-
points[v] = $$["generateGet"
|
|
7037
|
+
points[v] = $$["generateGet".concat(capitalize(v), "Points")](indices[v], false);
|
|
6916
7038
|
});
|
|
6917
7039
|
return function (d, i) {
|
|
6918
7040
|
var type = ($$.isAreaType(d) && "area") ||
|
|
@@ -6972,13 +7094,14 @@ var text = {
|
|
|
6972
7094
|
* @private
|
|
6973
7095
|
*/
|
|
6974
7096
|
getXForText: function (points, d, textElement) {
|
|
7097
|
+
var _a;
|
|
6975
7098
|
var $$ = this;
|
|
6976
7099
|
var config = $$.config, state = $$.state;
|
|
6977
7100
|
var isRotated = config.axis_rotated;
|
|
6978
7101
|
var xPos = points[0][0];
|
|
6979
|
-
if ($$.
|
|
7102
|
+
if ($$.isCandlestickType(d)) {
|
|
6980
7103
|
if (isRotated) {
|
|
6981
|
-
xPos = $$.getCandlestickData(d)._isUp ?
|
|
7104
|
+
xPos = ((_a = $$.getCandlestickData(d)) === null || _a === void 0 ? void 0 : _a._isUp) ?
|
|
6982
7105
|
points[2][2] + 4 : points[2][1] - 4;
|
|
6983
7106
|
}
|
|
6984
7107
|
else {
|
|
@@ -7129,7 +7252,7 @@ var text = {
|
|
|
7129
7252
|
if (ratio === void 0) { ratio = 0; }
|
|
7130
7253
|
var $$ = this;
|
|
7131
7254
|
var config = $$.config;
|
|
7132
|
-
var threshold = config[type
|
|
7255
|
+
var threshold = config["".concat(type, "_label_threshold")] || 0;
|
|
7133
7256
|
return ratio >= threshold;
|
|
7134
7257
|
}
|
|
7135
7258
|
};
|
|
@@ -7187,7 +7310,7 @@ var title = {
|
|
|
7187
7310
|
if (title) {
|
|
7188
7311
|
var y = $$.yForTitle.call($$);
|
|
7189
7312
|
if (/g/i.test(title.node().tagName)) {
|
|
7190
|
-
title.attr("transform", "translate("
|
|
7313
|
+
title.attr("transform", "translate(".concat(getTextPos(config.title_position, current.width), ", ").concat(y, ")"));
|
|
7191
7314
|
}
|
|
7192
7315
|
else {
|
|
7193
7316
|
title.attr("x", $$.xForTitle.call($$)).attr("y", y);
|
|
@@ -7322,12 +7445,12 @@ var tooltip$1 = {
|
|
|
7322
7445
|
var $$ = this;
|
|
7323
7446
|
var api = $$.api, config = $$.config, state = $$.state;
|
|
7324
7447
|
var _a = ["title", "name", "value"].map(function (v) {
|
|
7325
|
-
var fn = config["tooltip_format_"
|
|
7448
|
+
var fn = config["tooltip_format_".concat(v)];
|
|
7326
7449
|
return isFunction(fn) ? fn.bind(api) : fn;
|
|
7327
7450
|
}), titleFormat = _a[0], nameFormat = _a[1], valueFormat = _a[2];
|
|
7328
7451
|
titleFormat = titleFormat || defaultTitleFormat;
|
|
7329
7452
|
nameFormat = nameFormat || (function (name) { return name; });
|
|
7330
|
-
valueFormat = valueFormat || ($$.isStackNormalized() ? function (v, ratio) { return (ratio * 100).toFixed(2)
|
|
7453
|
+
valueFormat = valueFormat || ($$.isStackNormalized() ? function (v, ratio) { return "".concat((ratio * 100).toFixed(2), "%"); } : defaultValueFormat);
|
|
7331
7454
|
var order = config.tooltip_order;
|
|
7332
7455
|
var getRowValue = function (row) { return ($$.axis && $$.isBubbleZType(row) ? $$.getBubbleZData(row.value, "z") : $$.getBaseValue(row)); };
|
|
7333
7456
|
var getBgColor = $$.levelColor ? function (row) { return $$.levelColor(row.value); } : function (row) { return color(row); };
|
|
@@ -7377,21 +7500,25 @@ var tooltip$1 = {
|
|
|
7377
7500
|
sanitise(titleFormat ? titleFormat(row.x) : row.x);
|
|
7378
7501
|
text = tplProcess(tpl[0], {
|
|
7379
7502
|
CLASS_TOOLTIP: CLASS.tooltip,
|
|
7380
|
-
TITLE: isValue(title) ? (tplStr ? title : "<tr><th colspan=\"2\">"
|
|
7503
|
+
TITLE: isValue(title) ? (tplStr ? title : "<tr><th colspan=\"2\">".concat(title, "</th></tr>")) : ""
|
|
7381
7504
|
});
|
|
7382
7505
|
}
|
|
7383
7506
|
if (!row.ratio && $$.$el.arcs) {
|
|
7384
|
-
row.ratio = $$.getRatio("arc", $$.$el.arcs.select("path."
|
|
7507
|
+
row.ratio = $$.getRatio("arc", $$.$el.arcs.select("path.".concat(CLASS.arc, "-").concat(row.id)).data()[0]);
|
|
7385
7508
|
}
|
|
7386
7509
|
param = [row.ratio, row.id, row.index, d];
|
|
7387
7510
|
value = sanitise(valueFormat.apply(void 0, __spreadArray([getRowValue(row)], param, false)));
|
|
7388
7511
|
if ($$.isAreaRangeType(row)) {
|
|
7389
7512
|
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];
|
|
7390
|
-
value = "<b>Mid:</b> "
|
|
7513
|
+
value = "<b>Mid:</b> ".concat(value, " <b>High:</b> ").concat(high, " <b>Low:</b> ").concat(low);
|
|
7391
7514
|
}
|
|
7392
7515
|
else if ($$.isCandlestickType(row)) {
|
|
7393
7516
|
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];
|
|
7394
|
-
value = "<b>Open:</b> "
|
|
7517
|
+
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) : "");
|
|
7518
|
+
}
|
|
7519
|
+
else if ($$.isBarRangeType(row)) {
|
|
7520
|
+
var _d = row.value, start = _d[0], end = _d[1];
|
|
7521
|
+
value = "".concat(valueFormat(start), " ~ ").concat(valueFormat(end));
|
|
7395
7522
|
}
|
|
7396
7523
|
if (value !== undefined) {
|
|
7397
7524
|
// Skip elements when their name is set to null
|
|
@@ -7402,7 +7529,7 @@ var tooltip$1 = {
|
|
|
7402
7529
|
var color_1 = getBgColor(row);
|
|
7403
7530
|
var contentValue_1 = {
|
|
7404
7531
|
CLASS_TOOLTIP_NAME: CLASS.tooltipName + $$.getTargetSelectorSuffix(row.id),
|
|
7405
|
-
COLOR: (tplStr || !$$.patterns) ? color_1 : "<svg><rect style=\"fill:"
|
|
7532
|
+
COLOR: (tplStr || !$$.patterns) ? color_1 : "<svg><rect style=\"fill:".concat(color_1, "\" width=\"10\" height=\"10\"></rect></svg>"),
|
|
7406
7533
|
NAME: name_1,
|
|
7407
7534
|
VALUE: value
|
|
7408
7535
|
};
|
|
@@ -7418,7 +7545,7 @@ var tooltip$1 = {
|
|
|
7418
7545
|
for (i = 0; i < len; i++) {
|
|
7419
7546
|
_loop_1();
|
|
7420
7547
|
}
|
|
7421
|
-
return text
|
|
7548
|
+
return "".concat(text, "</table>");
|
|
7422
7549
|
},
|
|
7423
7550
|
/**
|
|
7424
7551
|
* Get the content template string
|
|
@@ -7427,7 +7554,7 @@ var tooltip$1 = {
|
|
|
7427
7554
|
* @private
|
|
7428
7555
|
*/
|
|
7429
7556
|
getTooltipContentTemplate: function (tplStr) {
|
|
7430
|
-
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\">"
|
|
7557
|
+
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>"))
|
|
7431
7558
|
.replace(/(\r?\n|\t)/g, "")
|
|
7432
7559
|
.split(/{{(.*)}}/);
|
|
7433
7560
|
},
|
|
@@ -7537,7 +7664,7 @@ var tooltip$1 = {
|
|
|
7537
7664
|
var pos_1 = fnPos(dataToShow, width, height, eventRect, currPos);
|
|
7538
7665
|
["top", "left"].forEach(function (v) {
|
|
7539
7666
|
var value = pos_1[v];
|
|
7540
|
-
tooltip.style(v, value
|
|
7667
|
+
tooltip.style(v, "".concat(value, "px"));
|
|
7541
7668
|
// Remember left pos in percentage to be used on resize call
|
|
7542
7669
|
if (v === "left" && !datum.xPosInPercent) {
|
|
7543
7670
|
datum.xPosInPercent = value / state.current.width * 100;
|
|
@@ -7562,7 +7689,7 @@ var tooltip$1 = {
|
|
|
7562
7689
|
if (diff < 0) {
|
|
7563
7690
|
value += diff;
|
|
7564
7691
|
}
|
|
7565
|
-
tooltip.style("left", value
|
|
7692
|
+
tooltip.style("left", "".concat(value, "px"));
|
|
7566
7693
|
}
|
|
7567
7694
|
});
|
|
7568
7695
|
},
|
|
@@ -7671,26 +7798,26 @@ var transform = {
|
|
|
7671
7798
|
x = state.width / 2 - width;
|
|
7672
7799
|
y = asHalfPixel(state.margin.top);
|
|
7673
7800
|
}
|
|
7674
|
-
return "translate("
|
|
7801
|
+
return "translate(".concat(x, ", ").concat(y, ")");
|
|
7675
7802
|
},
|
|
7676
7803
|
transformMain: function (withTransition, transitions) {
|
|
7677
7804
|
var $$ = this;
|
|
7678
7805
|
var main = $$.$el.main, $T = $$.$T;
|
|
7679
7806
|
var xAxis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisX) ?
|
|
7680
7807
|
transitions.axisX :
|
|
7681
|
-
$T(main.select("."
|
|
7808
|
+
$T(main.select(".".concat(CLASS.axisX)), withTransition);
|
|
7682
7809
|
var yAxis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisY) ?
|
|
7683
7810
|
transitions.axisY :
|
|
7684
|
-
$T(main.select("."
|
|
7811
|
+
$T(main.select(".".concat(CLASS.axisY)), withTransition);
|
|
7685
7812
|
var y2Axis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisY2) ?
|
|
7686
7813
|
transitions.axisY2 :
|
|
7687
|
-
$T(main.select("."
|
|
7814
|
+
$T(main.select(".".concat(CLASS.axisY2)), withTransition);
|
|
7688
7815
|
$T(main, withTransition)
|
|
7689
7816
|
.attr("transform", $$.getTranslate("main"));
|
|
7690
7817
|
xAxis.attr("transform", $$.getTranslate("x"));
|
|
7691
7818
|
yAxis.attr("transform", $$.getTranslate("y"));
|
|
7692
7819
|
y2Axis.attr("transform", $$.getTranslate("y2"));
|
|
7693
|
-
main.select("."
|
|
7820
|
+
main.select(".".concat(CLASS.chartArcs))
|
|
7694
7821
|
.attr("transform", $$.getTranslate("arc"));
|
|
7695
7822
|
},
|
|
7696
7823
|
transformAll: function (withTransition, transitions) {
|
|
@@ -8035,6 +8162,13 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8035
8162
|
checkModuleImport($$);
|
|
8036
8163
|
state.hasAxis = !$$.hasArcType();
|
|
8037
8164
|
state.hasRadar = !state.hasAxis && $$.hasType("radar");
|
|
8165
|
+
// when 'padding=false' is set, disable axes and subchart. Because they are useless.
|
|
8166
|
+
if (config.padding === false) {
|
|
8167
|
+
config.axis_x_show = false;
|
|
8168
|
+
config.axis_y_show = false;
|
|
8169
|
+
config.axis_y2_show = false;
|
|
8170
|
+
config.subchart_show = false;
|
|
8171
|
+
}
|
|
8038
8172
|
$$.initParams();
|
|
8039
8173
|
var bindto = {
|
|
8040
8174
|
element: config.bindto,
|
|
@@ -8086,7 +8220,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8086
8220
|
var _a = $$, config = _a.config, format = _a.format, state = _a.state;
|
|
8087
8221
|
var isRotated = config.axis_rotated;
|
|
8088
8222
|
// datetime to be used for uniqueness
|
|
8089
|
-
state.datetimeId = "bb-"
|
|
8223
|
+
state.datetimeId = "bb-".concat(+new Date());
|
|
8090
8224
|
$$.color = $$.generateColor();
|
|
8091
8225
|
$$.levelColor = $$.generateLevelColor();
|
|
8092
8226
|
if ($$.hasPointType()) {
|
|
@@ -8118,7 +8252,8 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8118
8252
|
config.legend_inset_anchor === "top-right";
|
|
8119
8253
|
state.isLegendLeft = config.legend_inset_anchor === "top-left" ||
|
|
8120
8254
|
config.legend_inset_anchor === "bottom-left";
|
|
8121
|
-
state.
|
|
8255
|
+
state.rotatedPadding.top = $$.getResettedPadding(state.rotatedPadding.top);
|
|
8256
|
+
state.rotatedPadding.right = isRotated && !config.axis_x_show ? 0 : 30;
|
|
8122
8257
|
state.inputType = convertInputType(config.interaction_inputType_mouse, config.interaction_inputType_touch);
|
|
8123
8258
|
};
|
|
8124
8259
|
ChartInternal.prototype.initWithData = function (data) {
|
|
@@ -8211,7 +8346,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8211
8346
|
// text when empty
|
|
8212
8347
|
if (config.data_empty_label_text) {
|
|
8213
8348
|
main.append("text")
|
|
8214
|
-
.attr("class", CLASS.text
|
|
8349
|
+
.attr("class", "".concat(CLASS.text, " ").concat(CLASS.empty))
|
|
8215
8350
|
.attr("text-anchor", "middle") // horizontal centering of text at x position in all browsers.
|
|
8216
8351
|
.attr("dominant-baseline", "middle"); // vertical centering of text at y position in all browsers, except IE.
|
|
8217
8352
|
}
|
|
@@ -8287,7 +8422,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8287
8422
|
}
|
|
8288
8423
|
}
|
|
8289
8424
|
types.forEach(function (v) {
|
|
8290
|
-
$$["init"
|
|
8425
|
+
$$["init".concat(v)]();
|
|
8291
8426
|
});
|
|
8292
8427
|
notEmpty($$.config.data_labels) && !$$.hasArcType(null, ["radar"]) && $$.initText();
|
|
8293
8428
|
};
|
|
@@ -8354,7 +8489,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8354
8489
|
["bar", "candlestick", "line"].forEach(function (v) {
|
|
8355
8490
|
var name = capitalize(v);
|
|
8356
8491
|
if ((v === "line" && $$.hasTypeOf(name)) || $$.hasType(v)) {
|
|
8357
|
-
$$["updateTargetsFor"
|
|
8492
|
+
$$["updateTargetsFor".concat(name)](targets.filter($$["is".concat(name, "Type")].bind($$)));
|
|
8358
8493
|
}
|
|
8359
8494
|
});
|
|
8360
8495
|
// Sub Chart
|
|
@@ -8381,7 +8516,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8381
8516
|
ChartInternal.prototype.showTargets = function () {
|
|
8382
8517
|
var $$ = this;
|
|
8383
8518
|
var svg = $$.$el.svg, $T = $$.$T;
|
|
8384
|
-
$T(svg.selectAll("."
|
|
8519
|
+
$T(svg.selectAll(".".concat(CLASS.target))
|
|
8385
8520
|
.filter(function (d) { return $$.isTargetToShow(d.id); })).style("opacity", null);
|
|
8386
8521
|
};
|
|
8387
8522
|
ChartInternal.prototype.getWithOption = function (options) {
|
|
@@ -8405,7 +8540,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8405
8540
|
if (isString(defVal)) {
|
|
8406
8541
|
defVal = withOptions[defVal];
|
|
8407
8542
|
}
|
|
8408
|
-
withOptions[key] = getOption(options, "with"
|
|
8543
|
+
withOptions[key] = getOption(options, "with".concat(key), defVal);
|
|
8409
8544
|
});
|
|
8410
8545
|
return withOptions;
|
|
8411
8546
|
};
|
|
@@ -8878,7 +9013,7 @@ var apiData = { data: data };
|
|
|
8878
9013
|
* @see https://developer.mozilla.org/ko/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
|
|
8879
9014
|
*/
|
|
8880
9015
|
var b64EncodeUnicode = function (str) { return btoa(encodeURIComponent(str)
|
|
8881
|
-
.replace(/%([0-9A-F]{2})/g, function (match, p) { return String.fromCharCode(Number("0x"
|
|
9016
|
+
.replace(/%([0-9A-F]{2})/g, function (match, p) { return String.fromCharCode(Number("0x".concat(p))); })); };
|
|
8882
9017
|
/**
|
|
8883
9018
|
* Convert svg node to data url
|
|
8884
9019
|
* @param {HTMLElement} node target node
|
|
@@ -8902,9 +9037,9 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
8902
9037
|
var styleXml = serializer.serializeToString(style);
|
|
8903
9038
|
// foreignObject not supported in IE11 and below
|
|
8904
9039
|
// https://msdn.microsoft.com/en-us/library/hh834675(v=vs.85).aspx
|
|
8905
|
-
var dataStr =
|
|
9040
|
+
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>")
|
|
8906
9041
|
.replace("/\n/g", "%0A");
|
|
8907
|
-
return "data:image/svg+xml;base64,"
|
|
9042
|
+
return "data:image/svg+xml;base64,".concat(b64EncodeUnicode(dataStr));
|
|
8908
9043
|
}
|
|
8909
9044
|
var apiExport = {
|
|
8910
9045
|
/**
|
|
@@ -9010,7 +9145,7 @@ var apiFocus = {
|
|
|
9010
9145
|
if ($$.hasArcType() && !state.hasRadar) {
|
|
9011
9146
|
$$.expandArc(targetIds);
|
|
9012
9147
|
$$.hasType("gauge") &&
|
|
9013
|
-
$$.markOverlapped(targetIdsValue, $$, "."
|
|
9148
|
+
$$.markOverlapped(targetIdsValue, $$, ".".concat(CLASS.gaugeValue));
|
|
9014
9149
|
}
|
|
9015
9150
|
$$.toggleFocusLegend(targetIds, true);
|
|
9016
9151
|
state.focusedTargetIds = targetIds;
|
|
@@ -9042,7 +9177,7 @@ var apiFocus = {
|
|
|
9042
9177
|
if ($$.hasArcType()) {
|
|
9043
9178
|
$$.unexpandArc(targetIds);
|
|
9044
9179
|
$$.hasType("gauge") &&
|
|
9045
|
-
$$.undoMarkOverlapped($$, "."
|
|
9180
|
+
$$.undoMarkOverlapped($$, ".".concat(CLASS.gaugeValue));
|
|
9046
9181
|
}
|
|
9047
9182
|
$$.toggleFocusLegend(targetIds, false);
|
|
9048
9183
|
state.focusedTargetIds = state.focusedTargetIds.filter(function (id) { return targetIds.indexOf(id) < 0; });
|
|
@@ -9380,7 +9515,7 @@ function showHide(show, targetIdsValue, options) {
|
|
|
9380
9515
|
.map(function (v) { return targetIds.indexOf(v) > -1 && v; })
|
|
9381
9516
|
.filter(Boolean);
|
|
9382
9517
|
$$.state.toggling = true;
|
|
9383
|
-
$$[(show ? "remove" : "add"
|
|
9518
|
+
$$["".concat(show ? "remove" : "add", "HiddenTargetIds")](targetIds);
|
|
9384
9519
|
var targets = $$.$el.svg.selectAll($$.selectorTargets(targetIds));
|
|
9385
9520
|
var opacity = show ? null : "0";
|
|
9386
9521
|
if (show && hiddenIds.length) {
|
|
@@ -9397,7 +9532,7 @@ function showHide(show, targetIdsValue, options) {
|
|
|
9397
9532
|
}
|
|
9398
9533
|
targets.style("opacity", opacity);
|
|
9399
9534
|
});
|
|
9400
|
-
options.withLegend && $$[(show ? "show" : "hide"
|
|
9535
|
+
options.withLegend && $$["".concat(show ? "show" : "hide", "Legend")](targetIds);
|
|
9401
9536
|
$$.redraw({
|
|
9402
9537
|
withUpdateOrgXDomain: true,
|
|
9403
9538
|
withUpdateXDomain: true,
|
|
@@ -9728,9 +9863,9 @@ extend(Chart.prototype, [
|
|
|
9728
9863
|
*/
|
|
9729
9864
|
function setMinMax($$, type, value) {
|
|
9730
9865
|
var config = $$.config;
|
|
9731
|
-
var axisX = "axis_x_"
|
|
9732
|
-
var axisY = "axis_y_"
|
|
9733
|
-
var axisY2 = "axis_y2_"
|
|
9866
|
+
var axisX = "axis_x_".concat(type);
|
|
9867
|
+
var axisY = "axis_y_".concat(type);
|
|
9868
|
+
var axisY2 = "axis_y2_".concat(type);
|
|
9734
9869
|
if (isDefined(value)) {
|
|
9735
9870
|
if (isObjectType(value)) {
|
|
9736
9871
|
isValue(value.x) && (config[axisX] = value.x);
|
|
@@ -9757,9 +9892,9 @@ function setMinMax($$, type, value) {
|
|
|
9757
9892
|
function getMinMax($$, type) {
|
|
9758
9893
|
var config = $$.config;
|
|
9759
9894
|
return {
|
|
9760
|
-
x: config["axis_x_"
|
|
9761
|
-
y: config["axis_y_"
|
|
9762
|
-
y2: config["axis_y2_"
|
|
9895
|
+
x: config["axis_x_".concat(type)],
|
|
9896
|
+
y: config["axis_y_".concat(type)],
|
|
9897
|
+
y2: config["axis_y2_".concat(type)]
|
|
9763
9898
|
};
|
|
9764
9899
|
}
|
|
9765
9900
|
/**
|
|
@@ -10217,8 +10352,8 @@ extend(regions, {
|
|
|
10217
10352
|
var config = $$.config, $T = $$.$T;
|
|
10218
10353
|
var options = optionsValue || {};
|
|
10219
10354
|
var classes = getOption(options, "classes", [CLASS.region]);
|
|
10220
|
-
var regions = $$.$el.main.select("."
|
|
10221
|
-
.selectAll(classes.map(function (c) { return "."
|
|
10355
|
+
var regions = $$.$el.main.select(".".concat(CLASS.regions))
|
|
10356
|
+
.selectAll(classes.map(function (c) { return ".".concat(c); }));
|
|
10222
10357
|
$T(regions)
|
|
10223
10358
|
.style("opacity", "0")
|
|
10224
10359
|
.remove();
|
|
@@ -10555,8 +10690,8 @@ var AxisRendererHelper = /** @class */ (function () {
|
|
|
10555
10690
|
AxisRendererHelper.prototype.getTickTransformSetter = function (id) {
|
|
10556
10691
|
var config = this.config;
|
|
10557
10692
|
var fn = id === "x" ?
|
|
10558
|
-
function (value) { return "translate("
|
|
10559
|
-
function (value) { return "translate(0,"
|
|
10693
|
+
function (value) { return "translate(".concat(value + config.tickOffset, ",0)"); } :
|
|
10694
|
+
function (value) { return "translate(0,".concat(value, ")"); };
|
|
10560
10695
|
return function (selection, scale) {
|
|
10561
10696
|
selection.attr("transform", function (d) { return fn(Math.ceil(scale(d))); });
|
|
10562
10697
|
};
|
|
@@ -10702,13 +10837,13 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
10702
10837
|
// // get the axis' tick position configuration
|
|
10703
10838
|
var id = params.id;
|
|
10704
10839
|
var tickTextPos = id && /^(x|y|y2)$/.test(id) ?
|
|
10705
|
-
params.config["axis_"
|
|
10840
|
+
params.config["axis_".concat(id, "_tick_text_position")] : { x: 0, y: 0 };
|
|
10706
10841
|
// tick visiblity
|
|
10707
|
-
var prefix = id === "subX" ? "subchart_axis_x" : "axis_"
|
|
10708
|
-
var axisShow = params.config[prefix
|
|
10842
|
+
var prefix = id === "subX" ? "subchart_axis_x" : "axis_".concat(id);
|
|
10843
|
+
var axisShow = params.config["".concat(prefix, "_show")];
|
|
10709
10844
|
var tickShow = {
|
|
10710
|
-
tick: axisShow ? params.config[prefix
|
|
10711
|
-
text: axisShow ? params.config[prefix
|
|
10845
|
+
tick: axisShow ? params.config["".concat(prefix, "_tick_show")] : false,
|
|
10846
|
+
text: axisShow ? params.config["".concat(prefix, "_tick_text_show")] : false
|
|
10712
10847
|
};
|
|
10713
10848
|
var $g;
|
|
10714
10849
|
g.each(function () {
|
|
@@ -10729,8 +10864,8 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
10729
10864
|
.attr("d", function () {
|
|
10730
10865
|
var outerTickSized = config.outerTickSize * sign;
|
|
10731
10866
|
return isTopBottom ?
|
|
10732
|
-
"M"
|
|
10733
|
-
"M"
|
|
10867
|
+
"M".concat(range[0], ",").concat(outerTickSized, "V0H").concat(range[1], "V").concat(outerTickSized) :
|
|
10868
|
+
"M".concat(outerTickSized, ",").concat(range[0], "H0V").concat(range[1], "H").concat(outerTickSized);
|
|
10734
10869
|
});
|
|
10735
10870
|
if (tickShow.tick || tickShow.text) {
|
|
10736
10871
|
// count of tick data in array
|
|
@@ -10791,7 +10926,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
10791
10926
|
});
|
|
10792
10927
|
var lineUpdate = tick.select("line");
|
|
10793
10928
|
var textUpdate = tick.select("text");
|
|
10794
|
-
tickEnter.select("line").attr(axisPx
|
|
10929
|
+
tickEnter.select("line").attr("".concat(axisPx, "2"), innerTickSize * sign);
|
|
10795
10930
|
tickEnter.select("text").attr(axisPx, tickLength * sign);
|
|
10796
10931
|
ctx.setTickLineTextPosition(lineUpdate, textUpdate);
|
|
10797
10932
|
// Append <title> for tooltip display
|
|
@@ -10866,7 +11001,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
10866
11001
|
orient === "top" && value.reverse();
|
|
10867
11002
|
return !r ? "middle" : value[r > 0 ? 0 : 1];
|
|
10868
11003
|
};
|
|
10869
|
-
var textTransform = function (r) { return (r ? "rotate("
|
|
11004
|
+
var textTransform = function (r) { return (r ? "rotate(".concat(r, ")") : null); };
|
|
10870
11005
|
var yForText = function (r) {
|
|
10871
11006
|
var r2 = r / (orient === "bottom" ? 15 : 23);
|
|
10872
11007
|
return r ? 11.5 - 2.5 * r2 * (r > 0 ? 1 : -1) : tickLength;
|
|
@@ -11091,7 +11226,7 @@ var Axis = /** @class */ (function () {
|
|
|
11091
11226
|
this.setOrient();
|
|
11092
11227
|
}
|
|
11093
11228
|
Axis.prototype.getAxisClassName = function (id) {
|
|
11094
|
-
return CLASS.axis
|
|
11229
|
+
return "".concat(CLASS.axis, " ").concat(CLASS["axis".concat(capitalize(id))]);
|
|
11095
11230
|
};
|
|
11096
11231
|
Axis.prototype.isHorizontal = function ($$, forHorizontal) {
|
|
11097
11232
|
var isRotated = $$.config.axis_rotated;
|
|
@@ -11107,11 +11242,11 @@ var Axis = /** @class */ (function () {
|
|
|
11107
11242
|
};
|
|
11108
11243
|
Axis.prototype.isTimeSeries = function (id) {
|
|
11109
11244
|
if (id === void 0) { id = "x"; }
|
|
11110
|
-
return this.owner.config["axis_"
|
|
11245
|
+
return this.owner.config["axis_".concat(id, "_type")] === "timeseries";
|
|
11111
11246
|
};
|
|
11112
11247
|
Axis.prototype.isLog = function (id) {
|
|
11113
11248
|
if (id === void 0) { id = "x"; }
|
|
11114
|
-
return this.owner.config["axis_"
|
|
11249
|
+
return this.owner.config["axis_".concat(id, "_type")] === "log";
|
|
11115
11250
|
};
|
|
11116
11251
|
Axis.prototype.isTimeSeriesY = function () {
|
|
11117
11252
|
return this.isTimeSeries("y");
|
|
@@ -11136,7 +11271,7 @@ var Axis = /** @class */ (function () {
|
|
|
11136
11271
|
config.axis_y2_show && target.push("y2");
|
|
11137
11272
|
target.forEach(function (v) {
|
|
11138
11273
|
var classAxis = _this.getAxisClassName(v);
|
|
11139
|
-
var classLabel = CLASS["axis"
|
|
11274
|
+
var classLabel = CLASS["axis".concat(v.toUpperCase(), "Label")];
|
|
11140
11275
|
axis[v] = main.append("g")
|
|
11141
11276
|
.attr("class", classAxis)
|
|
11142
11277
|
.attr("clip-path", function () {
|
|
@@ -11150,7 +11285,7 @@ var Axis = /** @class */ (function () {
|
|
|
11150
11285
|
return res;
|
|
11151
11286
|
})
|
|
11152
11287
|
.attr("transform", $$.getTranslate(v))
|
|
11153
|
-
.style("visibility", config["axis_"
|
|
11288
|
+
.style("visibility", config["axis_".concat(v, "_show")] ? null : "hidden");
|
|
11154
11289
|
axis[v].append("text")
|
|
11155
11290
|
.attr("class", classLabel)
|
|
11156
11291
|
.attr("transform", ["rotate(-90)", null][v === "x" ? +!isRotated : +isRotated])
|
|
@@ -11182,7 +11317,7 @@ var Axis = /** @class */ (function () {
|
|
|
11182
11317
|
var $$ = this.owner;
|
|
11183
11318
|
var config = $$.config;
|
|
11184
11319
|
var axes = [];
|
|
11185
|
-
var axesConfig = config["axis_"
|
|
11320
|
+
var axesConfig = config["axis_".concat(id, "_axes")];
|
|
11186
11321
|
var isRotated = config.axis_rotated;
|
|
11187
11322
|
var d3Axis;
|
|
11188
11323
|
if (id === "x") {
|
|
@@ -11217,7 +11352,7 @@ var Axis = /** @class */ (function () {
|
|
|
11217
11352
|
var $$ = this.owner;
|
|
11218
11353
|
var config = $$.config, main = $$.$el.main;
|
|
11219
11354
|
Object.keys(this.axesList).forEach(function (id) {
|
|
11220
|
-
var axesConfig = config["axis_"
|
|
11355
|
+
var axesConfig = config["axis_".concat(id, "_axes")];
|
|
11221
11356
|
var scale = $$.scale[id].copy();
|
|
11222
11357
|
var range = scale.range();
|
|
11223
11358
|
_this.axesList[id].forEach(function (v, i) {
|
|
@@ -11227,12 +11362,12 @@ var Axis = /** @class */ (function () {
|
|
|
11227
11362
|
if (!range.every(function (v, i) { return v === axisRange[i]; })) {
|
|
11228
11363
|
v.scale().range(range);
|
|
11229
11364
|
}
|
|
11230
|
-
var className = _this.getAxisClassName(id)
|
|
11231
|
-
var g = main.select("."
|
|
11365
|
+
var className = "".concat(_this.getAxisClassName(id), "-").concat(i + 1);
|
|
11366
|
+
var g = main.select(".".concat(className.replace(/\s/, ".")));
|
|
11232
11367
|
if (g.empty()) {
|
|
11233
11368
|
g = main.append("g")
|
|
11234
11369
|
.attr("class", className)
|
|
11235
|
-
.style("visibility", config["axis_"
|
|
11370
|
+
.style("visibility", config["axis_".concat(id, "_show")] ? null : "hidden")
|
|
11236
11371
|
.call(v);
|
|
11237
11372
|
}
|
|
11238
11373
|
else {
|
|
@@ -11277,7 +11412,7 @@ var Axis = /** @class */ (function () {
|
|
|
11277
11412
|
tickFormat = (id === "subX") ? $$.format.subXAxisTick : $$.format.xAxisTick;
|
|
11278
11413
|
}
|
|
11279
11414
|
else {
|
|
11280
|
-
var fn = config["axis_"
|
|
11415
|
+
var fn = config["axis_".concat(id, "_tick_format")];
|
|
11281
11416
|
if (isFunction(fn)) {
|
|
11282
11417
|
tickFormat = fn.bind($$.api);
|
|
11283
11418
|
}
|
|
@@ -11298,7 +11433,7 @@ var Axis = /** @class */ (function () {
|
|
|
11298
11433
|
orgXScale: $$.scale.x
|
|
11299
11434
|
});
|
|
11300
11435
|
if (!isX) {
|
|
11301
|
-
axisParams.tickStepSize = config["axis_"
|
|
11436
|
+
axisParams.tickStepSize = config["axis_".concat(type, "_tick_stepSize")];
|
|
11302
11437
|
}
|
|
11303
11438
|
var axis = new AxisRenderer(axisParams)
|
|
11304
11439
|
.scale((isX && $$.scale.zoom) || scale)
|
|
@@ -11314,14 +11449,14 @@ var Axis = /** @class */ (function () {
|
|
|
11314
11449
|
}
|
|
11315
11450
|
tickValues && axis.tickValues(tickValues);
|
|
11316
11451
|
// Set tick
|
|
11317
|
-
axis.tickFormat(tickFormat || (!isX && ($$.isStackNormalized() && (function (x) { return x
|
|
11452
|
+
axis.tickFormat(tickFormat || (!isX && ($$.isStackNormalized() && (function (x) { return "".concat(x, "%"); }))));
|
|
11318
11453
|
if (isCategory) {
|
|
11319
11454
|
axis.tickCentered(config.axis_x_tick_centered);
|
|
11320
11455
|
if (isEmpty(config.axis_x_tick_culling)) {
|
|
11321
11456
|
config.axis_x_tick_culling = false;
|
|
11322
11457
|
}
|
|
11323
11458
|
}
|
|
11324
|
-
var tickCount = config["axis_"
|
|
11459
|
+
var tickCount = config["axis_".concat(type, "_tick_count")];
|
|
11325
11460
|
tickCount && axis.ticks(tickCount);
|
|
11326
11461
|
return axis;
|
|
11327
11462
|
};
|
|
@@ -11387,13 +11522,13 @@ var Axis = /** @class */ (function () {
|
|
|
11387
11522
|
};
|
|
11388
11523
|
Axis.prototype.getTickValues = function (id) {
|
|
11389
11524
|
var $$ = this.owner;
|
|
11390
|
-
var tickValues = $$.config["axis_"
|
|
11391
|
-
var axis = $$[id
|
|
11525
|
+
var tickValues = $$.config["axis_".concat(id, "_tick_values")];
|
|
11526
|
+
var axis = $$["".concat(id, "Axis")];
|
|
11392
11527
|
return (isFunction(tickValues) ? tickValues.call($$.api) : tickValues) ||
|
|
11393
11528
|
(axis ? axis.tickValues() : undefined);
|
|
11394
11529
|
};
|
|
11395
11530
|
Axis.prototype.getLabelOptionByAxisId = function (id) {
|
|
11396
|
-
return this.owner.config["axis_"
|
|
11531
|
+
return this.owner.config["axis_".concat(id, "_label")];
|
|
11397
11532
|
};
|
|
11398
11533
|
Axis.prototype.getLabelText = function (id) {
|
|
11399
11534
|
var option = this.getLabelOptionByAxisId(id);
|
|
@@ -11404,7 +11539,7 @@ var Axis = /** @class */ (function () {
|
|
|
11404
11539
|
var config = $$.config;
|
|
11405
11540
|
var option = this.getLabelOptionByAxisId(id);
|
|
11406
11541
|
if (isString(option)) {
|
|
11407
|
-
config["axis_"
|
|
11542
|
+
config["axis_".concat(id, "_label")] = text;
|
|
11408
11543
|
}
|
|
11409
11544
|
else if (option) {
|
|
11410
11545
|
option.text = text;
|
|
@@ -11475,7 +11610,7 @@ var Axis = /** @class */ (function () {
|
|
|
11475
11610
|
var config = $$.config;
|
|
11476
11611
|
var isRotated = config.axis_rotated;
|
|
11477
11612
|
var isInner = this.getAxisLabelPosition(id).isInner;
|
|
11478
|
-
var tickRotate = config["axis_"
|
|
11613
|
+
var tickRotate = config["axis_".concat(id, "_tick_rotate")] ? $$.getHorizontalAxisHeight(id) : 0;
|
|
11479
11614
|
var maxTickWidth = this.getMaxTickWidth(id);
|
|
11480
11615
|
var dy;
|
|
11481
11616
|
if (id === "x") {
|
|
@@ -11514,7 +11649,7 @@ var Axis = /** @class */ (function () {
|
|
|
11514
11649
|
}
|
|
11515
11650
|
else {
|
|
11516
11651
|
dy = isInner ?
|
|
11517
|
-
dy[3] : (dy[4] + (config["axis_"
|
|
11652
|
+
dy[3] : (dy[4] + (config["axis_".concat(id, "_inner")] ? 0 : (maxTickWidth + dy[4]))) * (id === "y" ? -1 : 1);
|
|
11518
11653
|
}
|
|
11519
11654
|
}
|
|
11520
11655
|
return dy;
|
|
@@ -11524,13 +11659,13 @@ var Axis = /** @class */ (function () {
|
|
|
11524
11659
|
var config = $$.config, current = $$.state.current, _a = $$.$el, svg = _a.svg, chart = _a.chart;
|
|
11525
11660
|
var currentTickMax = current.maxTickWidths[id];
|
|
11526
11661
|
var maxWidth = 0;
|
|
11527
|
-
if (withoutRecompute || !config["axis_"
|
|
11662
|
+
if (withoutRecompute || !config["axis_".concat(id, "_show")] || $$.filterTargetsToShow().length === 0) {
|
|
11528
11663
|
return currentTickMax.size;
|
|
11529
11664
|
}
|
|
11530
11665
|
if (svg) {
|
|
11531
11666
|
var isYAxis_1 = /^y2?$/.test(id);
|
|
11532
11667
|
var targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
|
11533
|
-
var scale = $$.scale[id].copy().domain($$["get"
|
|
11668
|
+
var scale = $$.scale[id].copy().domain($$["get".concat(isYAxis_1 ? "Y" : "X", "Domain")](targetsToShow, id));
|
|
11534
11669
|
var domain = scale.domain();
|
|
11535
11670
|
var isDomainSame = domain[0] === domain[1] && domain.every(function (v) { return v > 0; });
|
|
11536
11671
|
var isCurrentMaxTickDomainSame = isArray(currentTickMax.domain) &&
|
|
@@ -11548,8 +11683,8 @@ var Axis = /** @class */ (function () {
|
|
|
11548
11683
|
currentTickMax.ticks.splice(0);
|
|
11549
11684
|
}
|
|
11550
11685
|
var axis = this.getAxis(id, scale, false, false, true);
|
|
11551
|
-
var tickCount = config["axis_"
|
|
11552
|
-
var tickValues = config["axis_"
|
|
11686
|
+
var tickCount = config["axis_".concat(id, "_tick_count")];
|
|
11687
|
+
var tickValues = config["axis_".concat(id, "_tick_values")];
|
|
11553
11688
|
// Make to generate the final tick text to be rendered
|
|
11554
11689
|
// https://github.com/naver/billboard.js/issues/920
|
|
11555
11690
|
// Do not generate if 'tick values' option is given
|
|
@@ -11561,8 +11696,8 @@ var Axis = /** @class */ (function () {
|
|
|
11561
11696
|
var dummy = chart.append("svg")
|
|
11562
11697
|
.style("visibility", "hidden")
|
|
11563
11698
|
.style("position", "fixed")
|
|
11564
|
-
.style("top", "
|
|
11565
|
-
.style("left", "
|
|
11699
|
+
.style("top", "0")
|
|
11700
|
+
.style("left", "0");
|
|
11566
11701
|
axis.create(dummy);
|
|
11567
11702
|
dummy.selectAll("text")
|
|
11568
11703
|
.each(function (d, i) {
|
|
@@ -11641,9 +11776,9 @@ var Axis = /** @class */ (function () {
|
|
|
11641
11776
|
var $$ = this.owner;
|
|
11642
11777
|
var main = $$.$el.main, $T = $$.$T;
|
|
11643
11778
|
var labels = {
|
|
11644
|
-
x: main.select("."
|
|
11645
|
-
y: main.select("."
|
|
11646
|
-
y2: main.select("."
|
|
11779
|
+
x: main.select(".".concat(CLASS.axisX, " .").concat(CLASS.axisXLabel)),
|
|
11780
|
+
y: main.select(".".concat(CLASS.axisY, " .").concat(CLASS.axisYLabel)),
|
|
11781
|
+
y2: main.select(".".concat(CLASS.axisY2, " .").concat(CLASS.axisY2Label))
|
|
11647
11782
|
};
|
|
11648
11783
|
Object.keys(labels).filter(function (id) { return !labels[id].empty(); })
|
|
11649
11784
|
.forEach(function (v) {
|
|
@@ -11724,7 +11859,7 @@ var Axis = /** @class */ (function () {
|
|
|
11724
11859
|
axis.config.withoutTransition = true;
|
|
11725
11860
|
}
|
|
11726
11861
|
$axis.style("opacity", opacity);
|
|
11727
|
-
axis.create(transitions["axis"
|
|
11862
|
+
axis.create(transitions["axis".concat(capitalize(id))]);
|
|
11728
11863
|
}
|
|
11729
11864
|
});
|
|
11730
11865
|
this.updateAxes();
|
|
@@ -11765,8 +11900,8 @@ var Axis = /** @class */ (function () {
|
|
|
11765
11900
|
["y", "y2"].forEach(function (key) {
|
|
11766
11901
|
var axisScale = scale[key];
|
|
11767
11902
|
if (axisScale) {
|
|
11768
|
-
var tickValues = config["axis_"
|
|
11769
|
-
var tickCount = config["axis_"
|
|
11903
|
+
var tickValues = config["axis_".concat(key, "_tick_values")];
|
|
11904
|
+
var tickCount = config["axis_".concat(key, "_tick_count")];
|
|
11770
11905
|
axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
|
|
11771
11906
|
if (!tickValues && tickCount) {
|
|
11772
11907
|
var axis = $$.axis[key];
|
|
@@ -11800,12 +11935,14 @@ var Axis = /** @class */ (function () {
|
|
|
11800
11935
|
var axis = $el.axis[type];
|
|
11801
11936
|
// subchart x axis should be aligned with x axis culling
|
|
11802
11937
|
var id = type === "subX" ? "x" : type;
|
|
11803
|
-
var
|
|
11938
|
+
var cullingOptionPrefix = "axis_".concat(id, "_tick_culling");
|
|
11939
|
+
var toCull = config[cullingOptionPrefix];
|
|
11804
11940
|
if (axis && toCull) {
|
|
11805
|
-
var
|
|
11806
|
-
var tickValues_1 = sortValue(
|
|
11941
|
+
var tickNodes = axis.selectAll(".tick");
|
|
11942
|
+
var tickValues_1 = sortValue(tickNodes.data());
|
|
11807
11943
|
var tickSize = tickValues_1.length;
|
|
11808
|
-
var cullingMax = config["
|
|
11944
|
+
var cullingMax = config["".concat(cullingOptionPrefix, "_max")];
|
|
11945
|
+
var lines_1 = config["".concat(cullingOptionPrefix, "_lines")];
|
|
11809
11946
|
var intervalForCulling_1;
|
|
11810
11947
|
if (tickSize) {
|
|
11811
11948
|
for (var i = 1; i < tickSize; i++) {
|
|
@@ -11814,17 +11951,20 @@ var Axis = /** @class */ (function () {
|
|
|
11814
11951
|
break;
|
|
11815
11952
|
}
|
|
11816
11953
|
}
|
|
11817
|
-
|
|
11818
|
-
|
|
11954
|
+
tickNodes.each(function (d) {
|
|
11955
|
+
if (tickValues_1.indexOf(d) % intervalForCulling_1) {
|
|
11956
|
+
(lines_1 ? this.querySelector("text") : this)
|
|
11957
|
+
.style.display = "none";
|
|
11958
|
+
}
|
|
11819
11959
|
});
|
|
11820
11960
|
}
|
|
11821
11961
|
else {
|
|
11822
|
-
|
|
11962
|
+
tickNodes.style("display", null);
|
|
11823
11963
|
}
|
|
11824
11964
|
// set/unset x_axis_tick_clippath
|
|
11825
11965
|
if (type === "x") {
|
|
11826
11966
|
var clipPath = current.maxTickWidths.x.clipPath ? clip.pathXAxisTickTexts : null;
|
|
11827
|
-
$el.svg.selectAll("."
|
|
11967
|
+
$el.svg.selectAll(".".concat(CLASS.axisX, " .tick text"))
|
|
11828
11968
|
.attr("clip-path", clipPath);
|
|
11829
11969
|
}
|
|
11830
11970
|
}
|
|
@@ -11845,7 +11985,7 @@ var eventrect = {
|
|
|
11845
11985
|
*/
|
|
11846
11986
|
initEventRect: function () {
|
|
11847
11987
|
var $$ = this;
|
|
11848
|
-
$$.$el.main.select("."
|
|
11988
|
+
$$.$el.main.select(".".concat(CLASS.chart))
|
|
11849
11989
|
.append("g")
|
|
11850
11990
|
.attr("class", CLASS.eventRects)
|
|
11851
11991
|
.style("fill-opacity", "0");
|
|
@@ -11863,12 +12003,12 @@ var eventrect = {
|
|
|
11863
12003
|
$$.updateEventRect($el.eventRect, true);
|
|
11864
12004
|
}
|
|
11865
12005
|
else {
|
|
11866
|
-
var eventRects = $$.$el.main.select("."
|
|
12006
|
+
var eventRects = $$.$el.main.select(".".concat(CLASS.eventRects))
|
|
11867
12007
|
.style("cursor", config.zoom_enabled && config.zoom_type !== "drag" ? (config.axis_rotated ? "ns-resize" : "ew-resize") : null)
|
|
11868
12008
|
.classed(CLASS.eventRectsMultiple, isMultipleX)
|
|
11869
12009
|
.classed(CLASS.eventRectsSingle, !isMultipleX);
|
|
11870
12010
|
// append event <rect>
|
|
11871
|
-
var eventRectUpdate = eventRects.selectAll("."
|
|
12011
|
+
var eventRectUpdate = eventRects.selectAll(".".concat(CLASS.eventRect))
|
|
11872
12012
|
.data([0])
|
|
11873
12013
|
.enter()
|
|
11874
12014
|
.append("rect");
|
|
@@ -11923,7 +12063,7 @@ var eventrect = {
|
|
|
11923
12063
|
var preventEvent = function (event) {
|
|
11924
12064
|
var eventType = event.type;
|
|
11925
12065
|
var touch = event.changedTouches[0];
|
|
11926
|
-
var currentXY = touch["client"
|
|
12066
|
+
var currentXY = touch["client".concat(config.axis_rotated ? "Y" : "X")];
|
|
11927
12067
|
// prevent document scrolling
|
|
11928
12068
|
if (eventType === "touchstart") {
|
|
11929
12069
|
if (isPrevented) {
|
|
@@ -12112,7 +12252,7 @@ var eventrect = {
|
|
|
12112
12252
|
$$.showGridFocus(selectedData);
|
|
12113
12253
|
// Show cursor as pointer if point is close to mouse position
|
|
12114
12254
|
if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
|
|
12115
|
-
$$.$el.svg.select("."
|
|
12255
|
+
$$.$el.svg.select(".".concat(CLASS.eventRect)).style("cursor", "pointer");
|
|
12116
12256
|
if (!state.mouseover) {
|
|
12117
12257
|
config.data_onover.call($$.api, closest);
|
|
12118
12258
|
state.mouseover = closest;
|
|
@@ -12126,7 +12266,7 @@ var eventrect = {
|
|
|
12126
12266
|
unselectRect: function () {
|
|
12127
12267
|
var $$ = this;
|
|
12128
12268
|
var config = $$.config, _a = $$.$el, circle = _a.circle, tooltip = _a.tooltip;
|
|
12129
|
-
$$.$el.svg.select("."
|
|
12269
|
+
$$.$el.svg.select(".".concat(CLASS.eventRect)).style("cursor", null);
|
|
12130
12270
|
$$.hideGridFocus();
|
|
12131
12271
|
if (tooltip) {
|
|
12132
12272
|
$$.hideTooltip();
|
|
@@ -12222,7 +12362,7 @@ var eventrect = {
|
|
|
12222
12362
|
return;
|
|
12223
12363
|
}
|
|
12224
12364
|
var index = d.index;
|
|
12225
|
-
main.selectAll("."
|
|
12365
|
+
main.selectAll(".".concat(CLASS.shape, "-").concat(index))
|
|
12226
12366
|
.each(function (d2) {
|
|
12227
12367
|
var _a;
|
|
12228
12368
|
if (config.data_selection_grouped || $$.isWithinShape(this, d2)) {
|
|
@@ -12275,8 +12415,8 @@ var eventrect = {
|
|
|
12275
12415
|
}
|
|
12276
12416
|
// select if selection enabled
|
|
12277
12417
|
if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
|
|
12278
|
-
$$.$el.main.selectAll("."
|
|
12279
|
-
.selectAll("."
|
|
12418
|
+
$$.$el.main.selectAll(".".concat(CLASS.shapes).concat($$.getTargetSelectorSuffix(closest.id)))
|
|
12419
|
+
.selectAll(".".concat(CLASS.shape, "-").concat(closest.index))
|
|
12280
12420
|
.each(function () {
|
|
12281
12421
|
var _a;
|
|
12282
12422
|
if (config.data_selection_grouped || $$.isWithinShape(this, closest)) {
|
|
@@ -12385,13 +12525,13 @@ var flow = {
|
|
|
12385
12525
|
["circle", "text", "shape", "eventRect"].forEach(function (v) {
|
|
12386
12526
|
var target = [];
|
|
12387
12527
|
for (var i = 0; i < flowLength; i++) {
|
|
12388
|
-
target.push("."
|
|
12528
|
+
target.push(".".concat(CLASS[v], "-").concat(i));
|
|
12389
12529
|
}
|
|
12390
|
-
svg.selectAll("."
|
|
12530
|
+
svg.selectAll(".".concat(CLASS["".concat(v, "s")])) // circles, shapes, texts, eventRects
|
|
12391
12531
|
.selectAll(target)
|
|
12392
12532
|
.remove();
|
|
12393
12533
|
});
|
|
12394
|
-
svg.select("."
|
|
12534
|
+
svg.select(".".concat(CLASS.xgrid))
|
|
12395
12535
|
.remove();
|
|
12396
12536
|
}
|
|
12397
12537
|
// draw again for removing flowed elements and reverting attr
|
|
@@ -12490,7 +12630,7 @@ var flow = {
|
|
|
12490
12630
|
x(flowStart.x) - x(flowEnd.x);
|
|
12491
12631
|
}
|
|
12492
12632
|
var scaleX = (diffDomain(orgDomain) / diffDomain(domain));
|
|
12493
|
-
return "translate("
|
|
12633
|
+
return "translate(".concat(translateX, ",0) scale(").concat(scaleX, ",1)");
|
|
12494
12634
|
}
|
|
12495
12635
|
};
|
|
12496
12636
|
|
|
@@ -12503,10 +12643,10 @@ var clip = {
|
|
|
12503
12643
|
var $$ = this;
|
|
12504
12644
|
var clip = $$.state.clip;
|
|
12505
12645
|
// MEMO: clipId needs to be unique because it conflicts when multiple charts exist
|
|
12506
|
-
clip.id = $$.state.datetimeId
|
|
12507
|
-
clip.idXAxis = clip.id
|
|
12508
|
-
clip.idYAxis = clip.id
|
|
12509
|
-
clip.idGrid = clip.id
|
|
12646
|
+
clip.id = "".concat($$.state.datetimeId, "-clip");
|
|
12647
|
+
clip.idXAxis = "".concat(clip.id, "-xaxis");
|
|
12648
|
+
clip.idYAxis = "".concat(clip.id, "-yaxis");
|
|
12649
|
+
clip.idGrid = "".concat(clip.id, "-grid");
|
|
12510
12650
|
// Define 'clip-path' attribute values
|
|
12511
12651
|
clip.path = $$.getClipPath(clip.id);
|
|
12512
12652
|
clip.pathXAxis = $$.getClipPath(clip.idXAxis);
|
|
@@ -12524,7 +12664,7 @@ var clip = {
|
|
|
12524
12664
|
var isIE9 = win.navigator ?
|
|
12525
12665
|
win.navigator.appVersion
|
|
12526
12666
|
.toLowerCase().indexOf("msie 9.") >= 0 : false;
|
|
12527
|
-
return "url("
|
|
12667
|
+
return "url(".concat((isIE9 ? "" : doc.URL.split("#")[0]), "#").concat(id, ")");
|
|
12528
12668
|
},
|
|
12529
12669
|
appendClip: function (parent, id) {
|
|
12530
12670
|
id && parent.append("clipPath")
|
|
@@ -12578,7 +12718,7 @@ var clip = {
|
|
|
12578
12718
|
var config = $$.config, _a = $$.state, clip = _a.clip, xAxisHeight = _a.xAxisHeight, defs = $$.$el.defs;
|
|
12579
12719
|
var newXAxisHeight = $$.getHorizontalAxisHeight("x");
|
|
12580
12720
|
if (defs && !clip.idXAxisTickTexts) {
|
|
12581
|
-
var clipId = clip.id
|
|
12721
|
+
var clipId = "".concat(clip.id, "-xaxisticktexts");
|
|
12582
12722
|
$$.appendClip(defs, clipId);
|
|
12583
12723
|
clip.pathXAxisTickTexts = $$.getClipPath(clip.idXAxisTickTexts);
|
|
12584
12724
|
clip.idXAxisTickTexts = clipId;
|
|
@@ -12607,7 +12747,7 @@ var clip = {
|
|
|
12607
12747
|
var $$ = this;
|
|
12608
12748
|
var _a = $$.state, clip = _a.clip, current = _a.current, svg = $$.$el.svg;
|
|
12609
12749
|
if (svg) {
|
|
12610
|
-
svg.select("#"
|
|
12750
|
+
svg.select("#".concat(clip.idXAxisTickTexts, " rect"))
|
|
12611
12751
|
.attr("width", current.maxTickWidths.x.clipPath)
|
|
12612
12752
|
.attr("height", 30);
|
|
12613
12753
|
}
|
|
@@ -12660,7 +12800,7 @@ var grid = {
|
|
|
12660
12800
|
hasGrid: function () {
|
|
12661
12801
|
var config = this.config;
|
|
12662
12802
|
return ["x", "y"]
|
|
12663
|
-
.some(function (v) { return config["grid_"
|
|
12803
|
+
.some(function (v) { return config["grid_".concat(v, "_show")] || config["grid_".concat(v, "_lines")].length; });
|
|
12664
12804
|
},
|
|
12665
12805
|
initGrid: function () {
|
|
12666
12806
|
var $$ = this;
|
|
@@ -12671,9 +12811,9 @@ var grid = {
|
|
|
12671
12811
|
var $$ = this;
|
|
12672
12812
|
var config = $$.config, clip = $$.state.clip, $el = $$.$el;
|
|
12673
12813
|
if (config.grid_x_lines.length || config.grid_y_lines.length) {
|
|
12674
|
-
$el.gridLines.main = $el.main.insert("g", "."
|
|
12814
|
+
$el.gridLines.main = $el.main.insert("g", ".".concat(CLASS.chart).concat(config.grid_lines_front ? " + *" : ""))
|
|
12675
12815
|
.attr("clip-path", clip.pathGrid)
|
|
12676
|
-
.attr("class", CLASS.grid
|
|
12816
|
+
.attr("class", "".concat(CLASS.grid, " ").concat(CLASS.gridLines));
|
|
12677
12817
|
$el.gridLines.main.append("g").attr("class", CLASS.xgridLines);
|
|
12678
12818
|
$el.gridLines.main.append("g").attr("class", CLASS.ygridLines);
|
|
12679
12819
|
$el.gridLines.x = selectAll([]);
|
|
@@ -12697,8 +12837,8 @@ var grid = {
|
|
|
12697
12837
|
"y1": 0,
|
|
12698
12838
|
"y2": state.height
|
|
12699
12839
|
};
|
|
12700
|
-
grid.x = main.select("."
|
|
12701
|
-
.selectAll("."
|
|
12840
|
+
grid.x = main.select(".".concat(CLASS.xgrids))
|
|
12841
|
+
.selectAll(".".concat(CLASS.xgrid))
|
|
12702
12842
|
.data(xgridData);
|
|
12703
12843
|
grid.x.exit().remove();
|
|
12704
12844
|
grid.x = grid.x.enter()
|
|
@@ -12722,8 +12862,8 @@ var grid = {
|
|
|
12722
12862
|
var isRotated = config.axis_rotated;
|
|
12723
12863
|
var gridValues = $$.axis.y.tickValues() || $$.scale.y.ticks(config.grid_y_ticks);
|
|
12724
12864
|
var pos = function (d) { return Math.ceil($$.scale.y(d)); };
|
|
12725
|
-
grid.y = main.select("."
|
|
12726
|
-
.selectAll("."
|
|
12865
|
+
grid.y = main.select(".".concat(CLASS.ygrids))
|
|
12866
|
+
.selectAll(".".concat(CLASS.ygrid))
|
|
12727
12867
|
.data(gridValues);
|
|
12728
12868
|
grid.y.exit().remove();
|
|
12729
12869
|
grid.y = grid.y
|
|
@@ -12756,8 +12896,8 @@ var grid = {
|
|
|
12756
12896
|
var config = $$.config, _a = $$.$el, gridLines = _a.gridLines, main = _a.main, $T = $$.$T;
|
|
12757
12897
|
var isRotated = config.axis_rotated;
|
|
12758
12898
|
config.grid_x_show && $$.updateXGrid();
|
|
12759
|
-
var xLines = main.select("."
|
|
12760
|
-
.selectAll("."
|
|
12899
|
+
var xLines = main.select(".".concat(CLASS.xgridLines))
|
|
12900
|
+
.selectAll(".".concat(CLASS.xgridLine))
|
|
12761
12901
|
.data(config.grid_x_lines);
|
|
12762
12902
|
// exit
|
|
12763
12903
|
$T(xLines.exit())
|
|
@@ -12773,7 +12913,7 @@ var grid = {
|
|
|
12773
12913
|
.style("opacity", "0");
|
|
12774
12914
|
xLines = xgridLine.merge(xLines);
|
|
12775
12915
|
$T(xLines
|
|
12776
|
-
.attr("class", function (d) { return (CLASS.xgridLine
|
|
12916
|
+
.attr("class", function (d) { return "".concat(CLASS.xgridLine, " ").concat(d["class"] || "").trim(); })
|
|
12777
12917
|
.select("text")
|
|
12778
12918
|
.attr("text-anchor", getGridTextAnchor)
|
|
12779
12919
|
.attr("dx", getGridTextDx))
|
|
@@ -12790,8 +12930,8 @@ var grid = {
|
|
|
12790
12930
|
var config = $$.config, _a = $$.state, width = _a.width, height = _a.height, $el = $$.$el, $T = $$.$T;
|
|
12791
12931
|
var isRotated = config.axis_rotated;
|
|
12792
12932
|
config.grid_y_show && $$.updateYGrid();
|
|
12793
|
-
var ygridLines = $el.main.select("."
|
|
12794
|
-
.selectAll("."
|
|
12933
|
+
var ygridLines = $el.main.select(".".concat(CLASS.ygridLines))
|
|
12934
|
+
.selectAll(".".concat(CLASS.ygridLine))
|
|
12795
12935
|
.data(config.grid_y_lines);
|
|
12796
12936
|
// exit
|
|
12797
12937
|
$T(ygridLines.exit())
|
|
@@ -12808,7 +12948,7 @@ var grid = {
|
|
|
12808
12948
|
// update
|
|
12809
12949
|
var yv = $$.yv.bind($$);
|
|
12810
12950
|
$T(ygridLines
|
|
12811
|
-
.attr("class", function (d) { return (CLASS.ygridLine
|
|
12951
|
+
.attr("class", function (d) { return "".concat(CLASS.ygridLine, " ").concat(d["class"] || "").trim(); })
|
|
12812
12952
|
.select("line"))
|
|
12813
12953
|
.attr("x1", isRotated ? yv : 0)
|
|
12814
12954
|
.attr("x2", isRotated ? yv : width)
|
|
@@ -12849,7 +12989,7 @@ var grid = {
|
|
|
12849
12989
|
var $$ = this;
|
|
12850
12990
|
var config = $$.config, clip = $$.state.clip, $el = $$.$el;
|
|
12851
12991
|
var isFront = config.grid_front;
|
|
12852
|
-
var className = "."
|
|
12992
|
+
var className = ".".concat(CLASS[isFront && $el.gridLines.main ? "gridLines" : "chart"]).concat(isFront ? " + *" : "");
|
|
12853
12993
|
var grid = $el.main.insert("g", className)
|
|
12854
12994
|
.attr("clip-path", clip.pathGrid)
|
|
12855
12995
|
.attr("class", CLASS.grid);
|
|
@@ -12882,7 +13022,7 @@ var grid = {
|
|
|
12882
13022
|
var $$ = this;
|
|
12883
13023
|
var config = $$.config, _b = $$.state, width = _b.width, height = _b.height;
|
|
12884
13024
|
var isRotated = config.axis_rotated;
|
|
12885
|
-
var focusEl = $$.$el.main.selectAll("line."
|
|
13025
|
+
var focusEl = $$.$el.main.selectAll("line.".concat(CLASS.xgridFocus, ", line.").concat(CLASS.ygridFocus));
|
|
12886
13026
|
var dataToShow = (data || [focusEl.datum()]).filter(function (d) { return d && isValue($$.getBaseValue(d)); });
|
|
12887
13027
|
// Hide when bubble/scatter/stanford plot exists
|
|
12888
13028
|
if (!config.tooltip_show || dataToShow.length === 0 || $$.hasType("bubble") || $$.hasArcType()) {
|
|
@@ -12941,7 +13081,7 @@ var grid = {
|
|
|
12941
13081
|
var $$ = this;
|
|
12942
13082
|
var _b = $$.state, inputType = _b.inputType, resizing = _b.resizing, main = $$.$el.main;
|
|
12943
13083
|
if (inputType === "mouse" || !resizing) {
|
|
12944
|
-
main.selectAll("line."
|
|
13084
|
+
main.selectAll("line.".concat(CLASS.xgridFocus, ", line.").concat(CLASS.ygridFocus))
|
|
12945
13085
|
.style("visibility", "hidden");
|
|
12946
13086
|
(_a = $$.hideCircleFocus) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
12947
13087
|
}
|
|
@@ -12950,7 +13090,7 @@ var grid = {
|
|
|
12950
13090
|
var _a;
|
|
12951
13091
|
var $$ = this;
|
|
12952
13092
|
var _b = $$.state, inputType = _b.inputType, width = _b.width, height = _b.height, resizing = _b.resizing, grid = $$.$el.grid;
|
|
12953
|
-
var xgridFocus = grid.main.select("line."
|
|
13093
|
+
var xgridFocus = grid.main.select("line.".concat(CLASS.xgridFocus));
|
|
12954
13094
|
if (inputType === "touch") {
|
|
12955
13095
|
if (xgridFocus.empty()) {
|
|
12956
13096
|
resizing && ((_a = $$.showCircleFocus) === null || _a === void 0 ? void 0 : _a.call($$));
|
|
@@ -12973,7 +13113,7 @@ var grid = {
|
|
|
12973
13113
|
},
|
|
12974
13114
|
generateGridData: function (type, scale) {
|
|
12975
13115
|
var $$ = this;
|
|
12976
|
-
var tickNum = $$.$el.main.select("."
|
|
13116
|
+
var tickNum = $$.$el.main.select(".".concat(CLASS.axisX))
|
|
12977
13117
|
.selectAll(".tick")
|
|
12978
13118
|
.size();
|
|
12979
13119
|
var gridData = [];
|
|
@@ -12981,7 +13121,7 @@ var grid = {
|
|
|
12981
13121
|
var xDomain = $$.getXDomain();
|
|
12982
13122
|
var _a = xDomain.map(function (v) { return v.getFullYear(); }), firstYear = _a[0], lastYear = _a[1];
|
|
12983
13123
|
for (var i = firstYear; i <= lastYear; i++) {
|
|
12984
|
-
gridData.push(new Date(i
|
|
13124
|
+
gridData.push(new Date("".concat(i, "-01-01 00:00:00")));
|
|
12985
13125
|
}
|
|
12986
13126
|
}
|
|
12987
13127
|
else {
|
|
@@ -13010,12 +13150,12 @@ var grid = {
|
|
|
13010
13150
|
var toShow = function (line) { return !toRemove(line); };
|
|
13011
13151
|
var classLines = forX ? CLASS.xgridLines : CLASS.ygridLines;
|
|
13012
13152
|
var classLine = forX ? CLASS.xgridLine : CLASS.ygridLine;
|
|
13013
|
-
$T($$.$el.main.select("."
|
|
13014
|
-
.selectAll("."
|
|
13153
|
+
$T($$.$el.main.select(".".concat(classLines))
|
|
13154
|
+
.selectAll(".".concat(classLine))
|
|
13015
13155
|
.filter(toRemove))
|
|
13016
13156
|
.style("opacity", "0")
|
|
13017
13157
|
.remove();
|
|
13018
|
-
var gridLines = "grid_"
|
|
13158
|
+
var gridLines = "grid_".concat(forX ? "x" : "y", "_lines");
|
|
13019
13159
|
config[gridLines] = config[gridLines].filter(toShow);
|
|
13020
13160
|
}
|
|
13021
13161
|
};
|
|
@@ -13043,7 +13183,7 @@ var region = {
|
|
|
13043
13183
|
region.main.style("visibility", $$.hasArcType() ? "hidden" : null);
|
|
13044
13184
|
// select <g> element
|
|
13045
13185
|
var list = region.main
|
|
13046
|
-
.selectAll("."
|
|
13186
|
+
.selectAll(".".concat(CLASS.region))
|
|
13047
13187
|
.data(config.regions);
|
|
13048
13188
|
$T(list.exit())
|
|
13049
13189
|
.style("opacity", "0")
|
|
@@ -13215,7 +13355,7 @@ var sizeAxis = {
|
|
|
13215
13355
|
getAxisTickRotate: function (id) {
|
|
13216
13356
|
var $$ = this;
|
|
13217
13357
|
var axis = $$.axis, config = $$.config, state = $$.state, $el = $$.$el;
|
|
13218
|
-
var rotate = config["axis_"
|
|
13358
|
+
var rotate = config["axis_".concat(id, "_tick_rotate")];
|
|
13219
13359
|
if (id === "x") {
|
|
13220
13360
|
var allowedXAxisTypes = axis.isCategorized() || axis.isTimeSeries();
|
|
13221
13361
|
if (config.axis_x_tick_fit && allowedXAxisTypes) {
|
|
@@ -13543,15 +13683,16 @@ var x = {
|
|
|
13543
13683
|
*/
|
|
13544
13684
|
axis_x_tick_format: undefined,
|
|
13545
13685
|
/**
|
|
13546
|
-
* Setting for culling ticks
|
|
13547
|
-
*
|
|
13548
|
-
*
|
|
13686
|
+
* Setting for culling ticks.
|
|
13687
|
+
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
13688
|
+
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
|
|
13689
|
+
* - `false`: all of ticks will be shown.<br><br>
|
|
13690
|
+
* The number of ticks to be shown can be chaned by `axis.x.tick.culling.max`.
|
|
13549
13691
|
* @name axis․x․tick․culling
|
|
13550
13692
|
* @memberof Options
|
|
13551
13693
|
* @type {boolean}
|
|
13552
13694
|
* @default
|
|
13553
|
-
*
|
|
13554
|
-
* - false for category axis
|
|
13695
|
+
* `true` for indexed axis and timeseries axis, `false` for category axis
|
|
13555
13696
|
* @example
|
|
13556
13697
|
* axis: {
|
|
13557
13698
|
* x: {
|
|
@@ -13580,6 +13721,24 @@ var x = {
|
|
|
13580
13721
|
* }
|
|
13581
13722
|
*/
|
|
13582
13723
|
axis_x_tick_culling_max: 10,
|
|
13724
|
+
/**
|
|
13725
|
+
* Control visibility of tick lines within culling option, along with tick text.
|
|
13726
|
+
* @name axis․x․tick․culling․lines
|
|
13727
|
+
* @memberof Options
|
|
13728
|
+
* @type {boolean}
|
|
13729
|
+
* @default true
|
|
13730
|
+
* @example
|
|
13731
|
+
* axis: {
|
|
13732
|
+
* x: {
|
|
13733
|
+
* tick: {
|
|
13734
|
+
* culling: {
|
|
13735
|
+
* lines: false,
|
|
13736
|
+
* }
|
|
13737
|
+
* }
|
|
13738
|
+
* }
|
|
13739
|
+
* }
|
|
13740
|
+
*/
|
|
13741
|
+
axis_x_tick_culling_lines: true,
|
|
13583
13742
|
/**
|
|
13584
13743
|
* The number of x axis ticks to show.<br><br>
|
|
13585
13744
|
* 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).
|
|
@@ -13656,8 +13815,8 @@ var x = {
|
|
|
13656
13815
|
axis_x_tick_text_position: { x: 0, y: 0 },
|
|
13657
13816
|
/**
|
|
13658
13817
|
* Fit x axis ticks.
|
|
13659
|
-
* - **true**: ticks will be
|
|
13660
|
-
* - **false**: ticks will be
|
|
13818
|
+
* - **true**: ticks will be shown according to x value of the data points.
|
|
13819
|
+
* - **false**: ticks will be shown as to have same intervals.
|
|
13661
13820
|
* @name axis․x․tick․fit
|
|
13662
13821
|
* @memberof Options
|
|
13663
13822
|
* @type {boolean}
|
|
@@ -14221,9 +14380,11 @@ var y = {
|
|
|
14221
14380
|
*/
|
|
14222
14381
|
axis_y_tick_format: undefined,
|
|
14223
14382
|
/**
|
|
14224
|
-
* Setting for culling ticks
|
|
14225
|
-
*
|
|
14226
|
-
*
|
|
14383
|
+
* Setting for culling ticks.
|
|
14384
|
+
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
14385
|
+
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y.tick.culling.lines=false`.
|
|
14386
|
+
* - `false`: all of ticks will be shown.<br><br>
|
|
14387
|
+
* The number of ticks to be shown can be chaned by `axis.y.tick.culling.max`.
|
|
14227
14388
|
* @name axis․y․tick․culling
|
|
14228
14389
|
* @memberof Options
|
|
14229
14390
|
* @type {boolean}
|
|
@@ -14256,6 +14417,24 @@ var y = {
|
|
|
14256
14417
|
* }
|
|
14257
14418
|
*/
|
|
14258
14419
|
axis_y_tick_culling_max: 5,
|
|
14420
|
+
/**
|
|
14421
|
+
* Control visibility of tick lines within culling option, along with tick text.
|
|
14422
|
+
* @name axis․y․tick․culling․lines
|
|
14423
|
+
* @memberof Options
|
|
14424
|
+
* @type {boolean}
|
|
14425
|
+
* @default true
|
|
14426
|
+
* @example
|
|
14427
|
+
* axis: {
|
|
14428
|
+
* y: {
|
|
14429
|
+
* tick: {
|
|
14430
|
+
* culling: {
|
|
14431
|
+
* lines: false,
|
|
14432
|
+
* }
|
|
14433
|
+
* }
|
|
14434
|
+
* }
|
|
14435
|
+
* }
|
|
14436
|
+
*/
|
|
14437
|
+
axis_y_tick_culling_lines: true,
|
|
14259
14438
|
/**
|
|
14260
14439
|
* Show y axis outer tick.
|
|
14261
14440
|
* @name axis․y․tick․outer
|
|
@@ -14675,9 +14854,11 @@ var y2 = {
|
|
|
14675
14854
|
*/
|
|
14676
14855
|
axis_y2_tick_format: undefined,
|
|
14677
14856
|
/**
|
|
14678
|
-
* Setting for culling ticks
|
|
14679
|
-
*
|
|
14680
|
-
*
|
|
14857
|
+
* Setting for culling ticks.
|
|
14858
|
+
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
14859
|
+
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y2.tick.culling.lines=false`.
|
|
14860
|
+
* - `false`: all of ticks will be shown.<br><br>
|
|
14861
|
+
* The number of ticks to be shown can be chaned by `axis.y2.tick.culling.max`.
|
|
14681
14862
|
* @name axis․y2․tick․culling
|
|
14682
14863
|
* @memberof Options
|
|
14683
14864
|
* @type {boolean}
|
|
@@ -14710,6 +14891,24 @@ var y2 = {
|
|
|
14710
14891
|
* }
|
|
14711
14892
|
*/
|
|
14712
14893
|
axis_y2_tick_culling_max: 5,
|
|
14894
|
+
/**
|
|
14895
|
+
* Control visibility of tick lines within culling option, along with tick text.
|
|
14896
|
+
* @name axis․y2․tick․culling․lines
|
|
14897
|
+
* @memberof Options
|
|
14898
|
+
* @type {boolean}
|
|
14899
|
+
* @default true
|
|
14900
|
+
* @example
|
|
14901
|
+
* axis: {
|
|
14902
|
+
* y2: {
|
|
14903
|
+
* tick: {
|
|
14904
|
+
* culling: {
|
|
14905
|
+
* lines: false,
|
|
14906
|
+
* }
|
|
14907
|
+
* }
|
|
14908
|
+
* }
|
|
14909
|
+
* }
|
|
14910
|
+
*/
|
|
14911
|
+
axis_y2_tick_culling_lines: true,
|
|
14713
14912
|
/**
|
|
14714
14913
|
* Show or hide y2 axis outer tick.
|
|
14715
14914
|
* @name axis․y2․tick․outer
|
|
@@ -15066,9 +15265,9 @@ var shapeArc = {
|
|
|
15066
15265
|
var config = $$.config;
|
|
15067
15266
|
var dataType = config.data_type;
|
|
15068
15267
|
var padding = config.pie_padding;
|
|
15069
|
-
var startingAngle = config[dataType
|
|
15268
|
+
var startingAngle = config["".concat(dataType, "_startingAngle")] || 0;
|
|
15070
15269
|
var padAngle = ($$.hasType("pie") && padding ? padding * 0.01 :
|
|
15071
|
-
config[dataType
|
|
15270
|
+
config["".concat(dataType, "_padAngle")]) || 0;
|
|
15072
15271
|
$$.pie = pie$1()
|
|
15073
15272
|
.startAngle(startingAngle)
|
|
15074
15273
|
.endAngle(startingAngle + (2 * Math.PI))
|
|
@@ -15275,7 +15474,7 @@ var shapeArc = {
|
|
|
15275
15474
|
var y1 = Math.sin(updated.endAngle - Math.PI / 2);
|
|
15276
15475
|
var x = Math.cos(updated.endAngle - Math.PI / 2) * (radiusExpanded + 25);
|
|
15277
15476
|
var y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
|
|
15278
|
-
translate = "translate("
|
|
15477
|
+
translate = "translate(".concat(x, ",").concat(y, ")");
|
|
15279
15478
|
}
|
|
15280
15479
|
else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
15281
15480
|
var outerRadius = $$.getRadius(d).outerRadius;
|
|
@@ -15290,7 +15489,7 @@ var shapeArc = {
|
|
|
15290
15489
|
else {
|
|
15291
15490
|
ratio = outerRadius && (h ? (36 / outerRadius > 0.375 ? 1.175 - 36 / outerRadius : 0.8) * outerRadius / h : 0);
|
|
15292
15491
|
}
|
|
15293
|
-
translate = "translate("
|
|
15492
|
+
translate = "translate(".concat(x * ratio, ",").concat(y * ratio, ")");
|
|
15294
15493
|
}
|
|
15295
15494
|
}
|
|
15296
15495
|
return translate;
|
|
@@ -15334,14 +15533,14 @@ var shapeArc = {
|
|
|
15334
15533
|
var interval_1 = setInterval(function () {
|
|
15335
15534
|
if (!transiting) {
|
|
15336
15535
|
clearInterval(interval_1);
|
|
15337
|
-
$el.legend.selectAll("."
|
|
15536
|
+
$el.legend.selectAll(".".concat(CLASS.legendItemFocused)).size() > 0 &&
|
|
15338
15537
|
$$.expandArc(targetIds);
|
|
15339
15538
|
}
|
|
15340
15539
|
}, 10);
|
|
15341
15540
|
return;
|
|
15342
15541
|
}
|
|
15343
15542
|
var newTargetIds = $$.mapToTargetIds(targetIds);
|
|
15344
|
-
$el.svg.selectAll($$.selectorTargets(newTargetIds, "."
|
|
15543
|
+
$el.svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(CLASS.chartArc)))
|
|
15345
15544
|
.each(function (d) {
|
|
15346
15545
|
if (!$$.shouldExpand(d.data.id)) {
|
|
15347
15546
|
return;
|
|
@@ -15364,12 +15563,12 @@ var shapeArc = {
|
|
|
15364
15563
|
return;
|
|
15365
15564
|
}
|
|
15366
15565
|
var newTargetIds = $$.mapToTargetIds(targetIds);
|
|
15367
|
-
svg.selectAll($$.selectorTargets(newTargetIds, "."
|
|
15566
|
+
svg.selectAll($$.selectorTargets(newTargetIds, ".".concat(CLASS.chartArc)))
|
|
15368
15567
|
.selectAll("path")
|
|
15369
15568
|
.transition()
|
|
15370
15569
|
.duration(function (d) { return $$.getExpandConfig(d.data.id, "duration"); })
|
|
15371
15570
|
.attr("d", $$.svgArc);
|
|
15372
|
-
svg.selectAll(""
|
|
15571
|
+
svg.selectAll("".concat(CLASS.arc))
|
|
15373
15572
|
.style("opacity", null);
|
|
15374
15573
|
},
|
|
15375
15574
|
/**
|
|
@@ -15396,7 +15595,7 @@ var shapeArc = {
|
|
|
15396
15595
|
else if ($$.isPieType(id)) {
|
|
15397
15596
|
type = "pie";
|
|
15398
15597
|
}
|
|
15399
|
-
return type ? config[type
|
|
15598
|
+
return type ? config["".concat(type, "_expand_").concat(key)] : def[key];
|
|
15400
15599
|
},
|
|
15401
15600
|
shouldExpand: function (id) {
|
|
15402
15601
|
var $$ = this;
|
|
@@ -15409,7 +15608,7 @@ var shapeArc = {
|
|
|
15409
15608
|
var $$ = this;
|
|
15410
15609
|
var config = $$.config;
|
|
15411
15610
|
return ["pie", "donut", "gauge"]
|
|
15412
|
-
.some(function (v) { return $$.hasType(v) && config[v
|
|
15611
|
+
.some(function (v) { return $$.hasType(v) && config["".concat(v, "_label_show")]; });
|
|
15413
15612
|
},
|
|
15414
15613
|
getArcLabelFormat: function () {
|
|
15415
15614
|
var $$ = this;
|
|
@@ -15426,7 +15625,7 @@ var shapeArc = {
|
|
|
15426
15625
|
getArcTitle: function () {
|
|
15427
15626
|
var $$ = this;
|
|
15428
15627
|
var type = ($$.hasType("donut") && "donut") || ($$.hasType("gauge") && "gauge");
|
|
15429
|
-
return type ? $$.config[type
|
|
15628
|
+
return type ? $$.config["".concat(type, "_title")] : "";
|
|
15430
15629
|
},
|
|
15431
15630
|
updateTargetsForArc: function (targets) {
|
|
15432
15631
|
var $$ = this;
|
|
@@ -15435,9 +15634,9 @@ var shapeArc = {
|
|
|
15435
15634
|
var classChartArc = $$.getChartClass("Arc");
|
|
15436
15635
|
var classArcs = $$.getClass("arcs", true);
|
|
15437
15636
|
var classFocus = $$.classFocus.bind($$);
|
|
15438
|
-
var chartArcs = $el.main.select("."
|
|
15637
|
+
var chartArcs = $el.main.select(".".concat(CLASS.chartArcs));
|
|
15439
15638
|
var mainPieUpdate = chartArcs
|
|
15440
|
-
.selectAll("."
|
|
15639
|
+
.selectAll(".".concat(CLASS.chartArc))
|
|
15441
15640
|
.data($$.pie(targets))
|
|
15442
15641
|
.attr("class", function (d) { return classChartArc(d) + classFocus(d.data); });
|
|
15443
15642
|
var mainPieEnter = mainPieUpdate.enter().append("g")
|
|
@@ -15450,14 +15649,14 @@ var shapeArc = {
|
|
|
15450
15649
|
.style("opacity", "0")
|
|
15451
15650
|
.style("text-anchor", "middle")
|
|
15452
15651
|
.style("pointer-events", "none");
|
|
15453
|
-
$el.text = chartArcs.selectAll("."
|
|
15652
|
+
$el.text = chartArcs.selectAll(".".concat(CLASS.target, " text"));
|
|
15454
15653
|
// MEMO: can not keep same color..., but not bad to update color in redraw
|
|
15455
15654
|
// mainPieUpdate.exit().remove();
|
|
15456
15655
|
},
|
|
15457
15656
|
initArc: function () {
|
|
15458
15657
|
var $$ = this;
|
|
15459
15658
|
var $el = $$.$el;
|
|
15460
|
-
$el.arcs = $el.main.select("."
|
|
15659
|
+
$el.arcs = $el.main.select(".".concat(CLASS.chart))
|
|
15461
15660
|
.append("g")
|
|
15462
15661
|
.attr("class", CLASS.chartArcs)
|
|
15463
15662
|
.attr("transform", $$.getTranslate("arc"));
|
|
@@ -15475,11 +15674,7 @@ var shapeArc = {
|
|
|
15475
15674
|
var text = $$.$el.arcs.append("text")
|
|
15476
15675
|
.attr("class", CLASS[hasGauge ? "chartArcsGaugeTitle" : "chartArcsTitle"])
|
|
15477
15676
|
.style("text-anchor", "middle");
|
|
15478
|
-
|
|
15479
|
-
text
|
|
15480
|
-
.attr("dy", "-0.3em")
|
|
15481
|
-
.style("font-size", "27px");
|
|
15482
|
-
}
|
|
15677
|
+
hasGauge && text.attr("dy", "-0.3em");
|
|
15483
15678
|
setTextValue(text, title, hasGauge ? undefined : [-0.6, 1.35], true);
|
|
15484
15679
|
}
|
|
15485
15680
|
},
|
|
@@ -15488,8 +15683,8 @@ var shapeArc = {
|
|
|
15488
15683
|
var config = $$.config, state = $$.state, main = $$.$el.main;
|
|
15489
15684
|
var hasInteraction = config.interaction_enabled;
|
|
15490
15685
|
var isSelectable = hasInteraction && config.data_selection_isselectable;
|
|
15491
|
-
var mainArc = main.selectAll("."
|
|
15492
|
-
.selectAll("."
|
|
15686
|
+
var mainArc = main.selectAll(".".concat(CLASS.arcs))
|
|
15687
|
+
.selectAll(".".concat(CLASS.arc))
|
|
15493
15688
|
.data($$.arcData.bind($$));
|
|
15494
15689
|
mainArc.exit()
|
|
15495
15690
|
.transition()
|
|
@@ -15578,15 +15773,15 @@ var shapeArc = {
|
|
|
15578
15773
|
var isFullCircle = config.gauge_fullCircle;
|
|
15579
15774
|
var startAngle = $$.getStartAngle();
|
|
15580
15775
|
var endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1;
|
|
15581
|
-
var backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : ""
|
|
15776
|
+
var backgroundArc = $$.$el.arcs.select("".concat(hasMultiArcGauge ? "g" : "", ".").concat(CLASS.chartArcsBackground));
|
|
15582
15777
|
if (hasMultiArcGauge) {
|
|
15583
15778
|
var index_1 = 0;
|
|
15584
15779
|
backgroundArc = backgroundArc
|
|
15585
|
-
.selectAll("path."
|
|
15780
|
+
.selectAll("path.".concat(CLASS.chartArcsBackground))
|
|
15586
15781
|
.data($$.data.targets);
|
|
15587
15782
|
backgroundArc.enter()
|
|
15588
15783
|
.append("path")
|
|
15589
|
-
.attr("class", function (d, i) { return CLASS.chartArcsBackground
|
|
15784
|
+
.attr("class", function (d, i) { return "".concat(CLASS.chartArcsBackground, " ").concat(CLASS.chartArcsBackground, "-").concat(i); })
|
|
15590
15785
|
.merge(backgroundArc)
|
|
15591
15786
|
.style("fill", (config.gauge_background) || null)
|
|
15592
15787
|
.attr("d", function (_a) {
|
|
@@ -15690,6 +15885,7 @@ var shapeArc = {
|
|
|
15690
15885
|
if (state.transiting) { // skip while transiting
|
|
15691
15886
|
return;
|
|
15692
15887
|
}
|
|
15888
|
+
state.event = event;
|
|
15693
15889
|
var eventArc = getEventArc_1(event);
|
|
15694
15890
|
var datum = eventArc.datum();
|
|
15695
15891
|
var updated = ((datum === null || datum === void 0 ? void 0 : datum.data) && datum.data.id) ? $$.updateAngle(datum) : null;
|
|
@@ -15709,35 +15905,35 @@ var shapeArc = {
|
|
|
15709
15905
|
var text;
|
|
15710
15906
|
// for gauge type, update text when has no title & multi data
|
|
15711
15907
|
if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) {
|
|
15712
|
-
text = main.selectAll("."
|
|
15908
|
+
text = main.selectAll(".".concat(CLASS.chartArc))
|
|
15713
15909
|
.select("text")
|
|
15714
15910
|
.style("opacity", "0")
|
|
15715
15911
|
.attr("class", function (d) { return ($$.isGaugeType(d.data) ? CLASS.gaugeValue : null); })
|
|
15716
15912
|
.call($$.textForArcLabel.bind($$))
|
|
15717
15913
|
.attr("transform", $$.transformForArcLabel.bind($$))
|
|
15718
15914
|
.style("font-size", function (d) { return ($$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ?
|
|
15719
|
-
Math.round(state.radius / 5)
|
|
15915
|
+
"".concat(Math.round(state.radius / 5), "px") : null); })
|
|
15720
15916
|
.transition()
|
|
15721
15917
|
.duration(duration)
|
|
15722
15918
|
.style("opacity", function (d) { return ($$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? null : "0"); });
|
|
15723
15919
|
hasMultiArcGauge && text.attr("dy", "-.1em");
|
|
15724
15920
|
}
|
|
15725
|
-
main.select("."
|
|
15921
|
+
main.select(".".concat(CLASS.chartArcsTitle))
|
|
15726
15922
|
.style("opacity", $$.hasType("donut") || hasGauge ? null : "0");
|
|
15727
15923
|
if (hasGauge) {
|
|
15728
15924
|
var isFullCircle = config.gauge_fullCircle;
|
|
15729
|
-
isFullCircle && (text === null || text === void 0 ? void 0 : text.attr("dy", ""
|
|
15925
|
+
isFullCircle && (text === null || text === void 0 ? void 0 : text.attr("dy", "".concat(hasMultiArcGauge ? 0 : Math.round(state.radius / 14))));
|
|
15730
15926
|
if (config.gauge_label_show) {
|
|
15731
|
-
arcs.select("."
|
|
15732
|
-
.attr("dy", (isFullCircle ? 1.5 : 0.75
|
|
15927
|
+
arcs.select(".".concat(CLASS.chartArcsGaugeUnit))
|
|
15928
|
+
.attr("dy", "".concat(isFullCircle ? 1.5 : 0.75, "em"))
|
|
15733
15929
|
.text(config.gauge_units);
|
|
15734
|
-
arcs.select("."
|
|
15735
|
-
.attr("dx", -1 * (state.innerRadius + ((state.radius - state.innerRadius) / (isFullCircle ? 1 : 2)))
|
|
15930
|
+
arcs.select(".".concat(CLASS.chartArcsGaugeMin))
|
|
15931
|
+
.attr("dx", "".concat(-1 * (state.innerRadius + ((state.radius - state.innerRadius) / (isFullCircle ? 1 : 2))), "px"))
|
|
15736
15932
|
.attr("dy", "1.2em")
|
|
15737
15933
|
.text($$.textForGaugeMinMax(config.gauge_min, false));
|
|
15738
15934
|
// show max text when isn't fullCircle
|
|
15739
|
-
!isFullCircle && arcs.select("."
|
|
15740
|
-
.attr("dx", state.innerRadius + ((state.radius - state.innerRadius) / 2)
|
|
15935
|
+
!isFullCircle && arcs.select(".".concat(CLASS.chartArcsGaugeMax))
|
|
15936
|
+
.attr("dx", "".concat(state.innerRadius + ((state.radius - state.innerRadius) / 2), "px"))
|
|
15741
15937
|
.attr("dy", "1.2em")
|
|
15742
15938
|
.text($$.textForGaugeMinMax(config.gauge_max, true));
|
|
15743
15939
|
}
|
|
@@ -15754,19 +15950,19 @@ var shapeArea = {
|
|
|
15754
15950
|
var $$ = this;
|
|
15755
15951
|
var config = $$.config;
|
|
15756
15952
|
mainLine
|
|
15757
|
-
.insert("g", "."
|
|
15953
|
+
.insert("g", ".".concat(CLASS[config.area_front ? "circles" : "lines"]))
|
|
15758
15954
|
.attr("class", $$.getClass("areas", true));
|
|
15759
15955
|
},
|
|
15760
15956
|
updateAreaGradient: function () {
|
|
15761
15957
|
var $$ = this;
|
|
15762
15958
|
var config = $$.config, datetimeId = $$.state.datetimeId, defs = $$.$el.defs;
|
|
15763
15959
|
$$.data.targets.forEach(function (d) {
|
|
15764
|
-
var id = datetimeId
|
|
15765
|
-
if ($$.isAreaType(d) && defs.select("#"
|
|
15960
|
+
var id = "".concat(datetimeId, "-areaGradient").concat($$.getTargetSelectorSuffix(d.id));
|
|
15961
|
+
if ($$.isAreaType(d) && defs.select("#".concat(id)).empty()) {
|
|
15766
15962
|
var color_1 = $$.color(d);
|
|
15767
15963
|
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;
|
|
15768
15964
|
var linearGradient_1 = defs.append("linearGradient")
|
|
15769
|
-
.attr("id", ""
|
|
15965
|
+
.attr("id", "".concat(id))
|
|
15770
15966
|
.attr("x1", x[0])
|
|
15771
15967
|
.attr("x2", x[1])
|
|
15772
15968
|
.attr("y1", y[0])
|
|
@@ -15784,7 +15980,7 @@ var shapeArea = {
|
|
|
15784
15980
|
updateAreaColor: function (d) {
|
|
15785
15981
|
var $$ = this;
|
|
15786
15982
|
return $$.config.area_linearGradient ?
|
|
15787
|
-
"url(#"
|
|
15983
|
+
"url(#".concat($$.state.datetimeId, "-areaGradient").concat($$.getTargetSelectorSuffix(d.id), ")") :
|
|
15788
15984
|
$$.color(d);
|
|
15789
15985
|
},
|
|
15790
15986
|
/**
|
|
@@ -15799,8 +15995,8 @@ var shapeArea = {
|
|
|
15799
15995
|
var config = $$.config, state = $$.state, $el = $$.$el, $T = $$.$T;
|
|
15800
15996
|
var $root = isSub ? $el.subchart : $el;
|
|
15801
15997
|
config.area_linearGradient && $$.updateAreaGradient();
|
|
15802
|
-
var area = $root.main.selectAll("."
|
|
15803
|
-
.selectAll("."
|
|
15998
|
+
var area = $root.main.selectAll(".".concat(CLASS.areas))
|
|
15999
|
+
.selectAll(".".concat(CLASS.area))
|
|
15804
16000
|
.data($$.lineData.bind($$));
|
|
15805
16001
|
$T(area.exit(), withTransition)
|
|
15806
16002
|
.style("opacity", "0")
|
|
@@ -15885,7 +16081,7 @@ var shapeArea = {
|
|
|
15885
16081
|
x0 = $$.scale.x(values[0].x);
|
|
15886
16082
|
y0 = $$.getYScaleById(d.id)(values[0].value);
|
|
15887
16083
|
}
|
|
15888
|
-
path = isRotated ? "M "
|
|
16084
|
+
path = isRotated ? "M ".concat(y0, " ").concat(x0) : "M ".concat(x0, " ").concat(y0);
|
|
15889
16085
|
}
|
|
15890
16086
|
return path || "M 0 0";
|
|
15891
16087
|
};
|
|
@@ -15918,17 +16114,18 @@ var shapeArea = {
|
|
|
15918
16114
|
}
|
|
15919
16115
|
};
|
|
15920
16116
|
|
|
15921
|
-
/**
|
|
15922
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
15923
|
-
* billboard.js project is licensed under the MIT license
|
|
15924
|
-
*/
|
|
15925
16117
|
var shapeBar = {
|
|
15926
16118
|
initBar: function () {
|
|
15927
|
-
var $el =
|
|
15928
|
-
$el.bar = $el.main.select("."
|
|
16119
|
+
var _a = this, $el = _a.$el, config = _a.config, clip = _a.state.clip;
|
|
16120
|
+
$el.bar = $el.main.select(".".concat(CLASS.chart))
|
|
15929
16121
|
// should positioned at the beginning of the shape node to not overlap others
|
|
15930
16122
|
.insert("g", ":first-child")
|
|
15931
16123
|
.attr("class", CLASS.chartBars);
|
|
16124
|
+
// set clip-path attribute when condition meet
|
|
16125
|
+
// https://github.com/naver/billboard.js/issues/2421
|
|
16126
|
+
if (config.clipPath === false && (config.bar_radius || config.bar_radius_ratio)) {
|
|
16127
|
+
$el.bar.attr("clip-path", clip.pathXAxis.replace(/#[^)]*/, "#".concat(clip.id)));
|
|
16128
|
+
}
|
|
15932
16129
|
},
|
|
15933
16130
|
updateTargetsForBar: function (targets) {
|
|
15934
16131
|
var $$ = this;
|
|
@@ -15940,11 +16137,11 @@ var shapeBar = {
|
|
|
15940
16137
|
if (!$el.bar) {
|
|
15941
16138
|
$$.initBar();
|
|
15942
16139
|
}
|
|
15943
|
-
var mainBarUpdate = $$.$el.main.select("."
|
|
15944
|
-
.selectAll("."
|
|
16140
|
+
var mainBarUpdate = $$.$el.main.select(".".concat(CLASS.chartBars))
|
|
16141
|
+
.selectAll(".".concat(CLASS.chartBar))
|
|
15945
16142
|
.data(
|
|
15946
16143
|
// remove
|
|
15947
|
-
targets.filter(function (v) { return
|
|
16144
|
+
targets.filter(function (v) { return v.values.some(function (d) { return (isNumber(d.value) || $$.isBarRangeType(d)); }); }))
|
|
15948
16145
|
.attr("class", function (d) { return classChartBar(d) + classFocus(d); });
|
|
15949
16146
|
var mainBarEnter = mainBarUpdate.enter().append("g")
|
|
15950
16147
|
.attr("class", classChartBar)
|
|
@@ -15968,8 +16165,8 @@ var shapeBar = {
|
|
|
15968
16165
|
var $root = isSub ? $el.subchart : $el;
|
|
15969
16166
|
var classBar = $$.getClass("bar", true);
|
|
15970
16167
|
var initialOpacity = $$.initialOpacity.bind($$);
|
|
15971
|
-
var bar = $root.main.selectAll("."
|
|
15972
|
-
.selectAll("."
|
|
16168
|
+
var bar = $root.main.selectAll(".".concat(CLASS.bars))
|
|
16169
|
+
.selectAll(".".concat(CLASS.bar))
|
|
15973
16170
|
.data($$.labelishData.bind($$));
|
|
15974
16171
|
$T(bar.exit(), withTransition)
|
|
15975
16172
|
.style("opacity", "0")
|
|
@@ -15982,7 +16179,7 @@ var shapeBar = {
|
|
|
15982
16179
|
},
|
|
15983
16180
|
/**
|
|
15984
16181
|
* Redraw function
|
|
15985
|
-
* @param {Function} drawFn Retuned
|
|
16182
|
+
* @param {Function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
|
|
15986
16183
|
* @param {boolean} withTransition With or without transition
|
|
15987
16184
|
* @param {boolean} isSub Subchart draw
|
|
15988
16185
|
* @returns {Array}
|
|
@@ -15993,17 +16190,36 @@ var shapeBar = {
|
|
|
15993
16190
|
var bar = (isSub ? $$.$el.subchart : $$.$el).bar;
|
|
15994
16191
|
return [
|
|
15995
16192
|
$$.$T(bar, withTransition, getRandom())
|
|
15996
|
-
.attr("d", function (d) { return isNumber(d.value) && drawFn(d); })
|
|
16193
|
+
.attr("d", function (d) { return (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d); })
|
|
15997
16194
|
.style("fill", this.color)
|
|
15998
16195
|
.style("opacity", null)
|
|
15999
16196
|
];
|
|
16000
16197
|
},
|
|
16198
|
+
/**
|
|
16199
|
+
* Generate draw function
|
|
16200
|
+
* @param {object} barIndices data order within x axis.
|
|
16201
|
+
* barIndices ==> {data1: 0, data2: 0, data3: 1, data4: 1, __max__: 1}
|
|
16202
|
+
*
|
|
16203
|
+
* When gropus given as:
|
|
16204
|
+
* groups: [
|
|
16205
|
+
* ["data1", "data2"],
|
|
16206
|
+
* ["data3", "data4"]
|
|
16207
|
+
* ],
|
|
16208
|
+
*
|
|
16209
|
+
* Will be rendered as:
|
|
16210
|
+
* data1 data3 data1 data3
|
|
16211
|
+
* data2 data4 data2 data4
|
|
16212
|
+
* -------------------------
|
|
16213
|
+
* 0 1
|
|
16214
|
+
* @param {boolean} isSub If is for subchart
|
|
16215
|
+
* @returns {Function}
|
|
16216
|
+
* @private
|
|
16217
|
+
*/
|
|
16001
16218
|
generateDrawBar: function (barIndices, isSub) {
|
|
16002
16219
|
var $$ = this;
|
|
16003
16220
|
var config = $$.config;
|
|
16004
16221
|
var getPoints = $$.generateGetBarPoints(barIndices, isSub);
|
|
16005
16222
|
var isRotated = config.axis_rotated;
|
|
16006
|
-
var isGrouped = config.data_groups.length;
|
|
16007
16223
|
var barRadius = config.bar_radius;
|
|
16008
16224
|
var barRadiusRatio = config.bar_radius_ratio;
|
|
16009
16225
|
// get the bar radius
|
|
@@ -16018,23 +16234,54 @@ var shapeBar = {
|
|
|
16018
16234
|
var isNegative = d.value < 0;
|
|
16019
16235
|
var pathRadius = ["", ""];
|
|
16020
16236
|
var radius = 0;
|
|
16021
|
-
|
|
16237
|
+
var isGrouped = $$.isGrouped(d.id);
|
|
16238
|
+
var hasRadius = d.value !== 0 && getRadius;
|
|
16239
|
+
var isRadiusData = hasRadius && isGrouped ? $$.isStackingRadiusData(d) : false;
|
|
16240
|
+
if (hasRadius && (!isGrouped || isRadiusData)) {
|
|
16022
16241
|
var index = isRotated ? indexY : indexX;
|
|
16023
16242
|
var barW = points[2][index] - points[0][index];
|
|
16024
16243
|
radius = getRadius(barW);
|
|
16025
|
-
var arc = "a"
|
|
16026
|
-
pathRadius[+!isRotated] = ""
|
|
16027
|
-
pathRadius[+isRotated] = ""
|
|
16244
|
+
var arc = "a".concat(radius, ",").concat(radius, " ").concat(isNegative ? "1 0 0" : "0 0 1", " ");
|
|
16245
|
+
pathRadius[+!isRotated] = "".concat(arc).concat(radius, ",").concat(radius);
|
|
16246
|
+
pathRadius[+isRotated] = "".concat(arc).concat([-radius, radius][isRotated ? "sort" : "reverse"]());
|
|
16028
16247
|
isNegative && pathRadius.reverse();
|
|
16029
16248
|
}
|
|
16030
16249
|
// path string data shouldn't be containing new line chars
|
|
16031
16250
|
// https://github.com/naver/billboard.js/issues/530
|
|
16032
16251
|
var path = isRotated ?
|
|
16033
|
-
"H"
|
|
16034
|
-
"V"
|
|
16035
|
-
return "M"
|
|
16252
|
+
"H".concat(points[1][indexX] - radius, " ").concat(pathRadius[0], "V").concat(points[2][indexY] - radius, " ").concat(pathRadius[1], "H").concat(points[3][indexX]) :
|
|
16253
|
+
"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]);
|
|
16254
|
+
return "M".concat(points[0][indexX], ",").concat(points[0][indexY]).concat(path, "z");
|
|
16036
16255
|
};
|
|
16037
16256
|
},
|
|
16257
|
+
/**
|
|
16258
|
+
* Determine if given stacking bar data is radius type
|
|
16259
|
+
* @param {Object} d Data row
|
|
16260
|
+
* @returns {boolean}
|
|
16261
|
+
*/
|
|
16262
|
+
isStackingRadiusData: function (d) {
|
|
16263
|
+
var $$ = this;
|
|
16264
|
+
var config = $$.config, data = $$.data;
|
|
16265
|
+
var id = d.id, index = d.index, value = d.value;
|
|
16266
|
+
// Find same grouped ids
|
|
16267
|
+
var keys = config.data_groups.find(function (v) { return v.indexOf(id) > -1; });
|
|
16268
|
+
// Get sorted list
|
|
16269
|
+
var sortedList = $$.orderTargets($$.filterTargetsToShow(data.targets.filter($$.isBarType, $$))).filter(function (v) { return keys.indexOf(v.id) > -1; });
|
|
16270
|
+
// Get sorted Ids. Filter positive or negative values Ids from given value
|
|
16271
|
+
var sortedIds = sortedList
|
|
16272
|
+
.map(function (v) { return v.values.filter(function (v2) { return v2.index === index && (value > 0 ? v2.value > 0 : v2.value < 0); })[0]; })
|
|
16273
|
+
.filter(Boolean)
|
|
16274
|
+
.map(function (v) { return v.id; });
|
|
16275
|
+
// If the given id stays in the last position, then radius should be applied.
|
|
16276
|
+
return value !== 0 && (sortedIds.indexOf(id) === sortedIds.length - 1);
|
|
16277
|
+
},
|
|
16278
|
+
/**
|
|
16279
|
+
* Generate bar coordinate points data
|
|
16280
|
+
* @param {object} barIndices Data order within x axis.
|
|
16281
|
+
* @param {boolean} isSub If is for subchart
|
|
16282
|
+
* @returns {Array} Array of coordinate points
|
|
16283
|
+
* @private
|
|
16284
|
+
*/
|
|
16038
16285
|
generateGetBarPoints: function (barIndices, isSub) {
|
|
16039
16286
|
var $$ = this;
|
|
16040
16287
|
var config = $$.config;
|
|
@@ -16055,7 +16302,9 @@ var shapeBar = {
|
|
|
16055
16302
|
if (config.axis_rotated && ((d.value > 0 && posY < y0) || (d.value < 0 && y0 < posY))) {
|
|
16056
16303
|
posY = y0;
|
|
16057
16304
|
}
|
|
16058
|
-
|
|
16305
|
+
if (!$$.isBarRangeType(d)) {
|
|
16306
|
+
posY -= (y0 - offset);
|
|
16307
|
+
}
|
|
16059
16308
|
var startPosX = posX + width;
|
|
16060
16309
|
// 4 points that make a bar
|
|
16061
16310
|
return [
|
|
@@ -16065,31 +16314,13 @@ var shapeBar = {
|
|
|
16065
16314
|
[startPosX, offset]
|
|
16066
16315
|
];
|
|
16067
16316
|
};
|
|
16068
|
-
},
|
|
16069
|
-
isWithinBar: function (that) {
|
|
16070
|
-
var mouse = getPointer(this.state.event, that);
|
|
16071
|
-
var list = getRectSegList(that);
|
|
16072
|
-
var seg0 = list[0], seg1 = list[1];
|
|
16073
|
-
var x = Math.min(seg0.x, seg1.x);
|
|
16074
|
-
var y = Math.min(seg0.y, seg1.y);
|
|
16075
|
-
var offset = this.config.bar_sensitivity;
|
|
16076
|
-
var _a = that.getBBox(), width = _a.width, height = _a.height;
|
|
16077
|
-
var sx = x - offset;
|
|
16078
|
-
var ex = x + width + offset;
|
|
16079
|
-
var sy = y + height + offset;
|
|
16080
|
-
var ey = y - offset;
|
|
16081
|
-
var isWithin = sx < mouse[0] &&
|
|
16082
|
-
mouse[0] < ex &&
|
|
16083
|
-
ey < mouse[1] &&
|
|
16084
|
-
mouse[1] < sy;
|
|
16085
|
-
return isWithin;
|
|
16086
16317
|
}
|
|
16087
16318
|
};
|
|
16088
16319
|
|
|
16089
16320
|
var shapeCandlestick = {
|
|
16090
16321
|
initCandlestick: function () {
|
|
16091
16322
|
var $el = this.$el;
|
|
16092
|
-
$el.candlestick = $el.main.select("."
|
|
16323
|
+
$el.candlestick = $el.main.select(".".concat(CLASS.chart))
|
|
16093
16324
|
// should positioned at the beginning of the shape node to not overlap others
|
|
16094
16325
|
.append("g")
|
|
16095
16326
|
.attr("class", CLASS.chartCandlesticks);
|
|
@@ -16108,8 +16339,8 @@ var shapeCandlestick = {
|
|
|
16108
16339
|
if (!$el.candlestick) {
|
|
16109
16340
|
$$.initCandlestick();
|
|
16110
16341
|
}
|
|
16111
|
-
var mainUpdate = $$.$el.main.select("."
|
|
16112
|
-
.selectAll("."
|
|
16342
|
+
var mainUpdate = $$.$el.main.select(".".concat(CLASS.chartCandlesticks))
|
|
16343
|
+
.selectAll(".".concat(CLASS.chartCandlestick))
|
|
16113
16344
|
.data(targets)
|
|
16114
16345
|
.attr("class", function (d) { return classChart(d) + classFocus(d); });
|
|
16115
16346
|
mainUpdate.enter().append("g")
|
|
@@ -16129,8 +16360,8 @@ var shapeCandlestick = {
|
|
|
16129
16360
|
var $root = isSub ? $el.subchart : $el;
|
|
16130
16361
|
var classSetter = $$.getClass("candlestick", true);
|
|
16131
16362
|
var initialOpacity = $$.initialOpacity.bind($$);
|
|
16132
|
-
var candlestick = $root.main.selectAll("."
|
|
16133
|
-
.selectAll("."
|
|
16363
|
+
var candlestick = $root.main.selectAll(".".concat(CLASS.chartCandlestick))
|
|
16364
|
+
.selectAll(".".concat(CLASS.candlestick))
|
|
16134
16365
|
.data($$.labelishData.bind($$));
|
|
16135
16366
|
$T(candlestick.exit(), withTransition)
|
|
16136
16367
|
.style("opacity", "0")
|
|
@@ -16171,10 +16402,10 @@ var shapeCandlestick = {
|
|
|
16171
16402
|
g.classed(CLASS[isUp ? "valueUp" : "valueDown"], true);
|
|
16172
16403
|
}
|
|
16173
16404
|
var path = isRotated ?
|
|
16174
|
-
"H"
|
|
16175
|
-
"V"
|
|
16405
|
+
"H".concat(points[1][1], " V").concat(points[1][0], " H").concat(points[0][1]) :
|
|
16406
|
+
"V".concat(points[1][1], " H").concat(points[1][0], " V").concat(points[0][1]);
|
|
16176
16407
|
g.select("path")
|
|
16177
|
-
.attr("d", "M"
|
|
16408
|
+
.attr("d", "M".concat(points[0][indexX], ",").concat(points[0][indexY]).concat(path, "z"))
|
|
16178
16409
|
.style("fill", function (d) {
|
|
16179
16410
|
var color = isUp ? $$.color(d) : (isObject(downColor) ? downColor[d.id] : downColor);
|
|
16180
16411
|
return color || $$.color(d);
|
|
@@ -16343,12 +16574,12 @@ var shapeGauge = {
|
|
|
16343
16574
|
var $$ = this;
|
|
16344
16575
|
var config = $$.config, state = $$.state, $el = $$.$el;
|
|
16345
16576
|
var hiddenTargetIds = $$.state.hiddenTargetIds;
|
|
16346
|
-
var arcLabelLines = $el.main.selectAll("."
|
|
16347
|
-
.selectAll("."
|
|
16577
|
+
var arcLabelLines = $el.main.selectAll(".".concat(CLASS.arcs))
|
|
16578
|
+
.selectAll(".".concat(CLASS.arcLabelLine))
|
|
16348
16579
|
.data($$.arcData.bind($$));
|
|
16349
16580
|
var mainArcLabelLine = arcLabelLines.enter()
|
|
16350
16581
|
.append("rect")
|
|
16351
|
-
.attr("class", function (d) { return CLASS.arcLabelLine
|
|
16582
|
+
.attr("class", function (d) { return "".concat(CLASS.arcLabelLine, " ").concat(CLASS.target, " ").concat(CLASS.target, "-").concat(d.data.id); })
|
|
16352
16583
|
.merge(arcLabelLines);
|
|
16353
16584
|
mainArcLabelLine
|
|
16354
16585
|
.style("fill", function (d) { return ($$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data)); })
|
|
@@ -16369,7 +16600,7 @@ var shapeGauge = {
|
|
|
16369
16600
|
lineLength = state.radiusExpanded - state.radius + innerLineLength;
|
|
16370
16601
|
x = Math.cos(linePositioningAngle) * arcInnerRadius;
|
|
16371
16602
|
y = Math.sin(linePositioningAngle) * arcInnerRadius;
|
|
16372
|
-
transform = "rotate("
|
|
16603
|
+
transform = "rotate(".concat(lineAngle * 180 / Math.PI, ", ").concat(x, ", ").concat(y, ")");
|
|
16373
16604
|
}
|
|
16374
16605
|
select(this)
|
|
16375
16606
|
.attr("x", x)
|
|
@@ -16377,7 +16608,7 @@ var shapeGauge = {
|
|
|
16377
16608
|
.attr("width", lineLength)
|
|
16378
16609
|
.attr("height", lineThickness)
|
|
16379
16610
|
.attr("transform", transform)
|
|
16380
|
-
.style("stroke-dasharray", "0, "
|
|
16611
|
+
.style("stroke-dasharray", "0, ".concat(lineLength + lineThickness, ", 0"));
|
|
16381
16612
|
});
|
|
16382
16613
|
},
|
|
16383
16614
|
textForGaugeMinMax: function (value, isMax) {
|
|
@@ -16469,7 +16700,7 @@ var shapeBubble = {
|
|
|
16469
16700
|
var shapeLine = {
|
|
16470
16701
|
initLine: function () {
|
|
16471
16702
|
var $el = this.$el;
|
|
16472
|
-
$el.line = $el.main.select("."
|
|
16703
|
+
$el.line = $el.main.select(".".concat(CLASS.chart)).append("g")
|
|
16473
16704
|
.attr("class", CLASS.chartLines);
|
|
16474
16705
|
},
|
|
16475
16706
|
updateTargetsForLine: function (t) {
|
|
@@ -16482,8 +16713,8 @@ var shapeLine = {
|
|
|
16482
16713
|
$$.initLine();
|
|
16483
16714
|
}
|
|
16484
16715
|
var targets = t.filter(function (d) { return !($$.isScatterType(d) || $$.isBubbleType(d)); });
|
|
16485
|
-
var mainLineUpdate = main.select("."
|
|
16486
|
-
.selectAll("."
|
|
16716
|
+
var mainLineUpdate = main.select(".".concat(CLASS.chartLines))
|
|
16717
|
+
.selectAll(".".concat(CLASS.chartLine))
|
|
16487
16718
|
.data(targets)
|
|
16488
16719
|
.attr("class", function (d) { return classChartLine(d) + classFocus(d); });
|
|
16489
16720
|
var mainLineEnter = mainLineUpdate.enter().append("g")
|
|
@@ -16511,15 +16742,15 @@ var shapeLine = {
|
|
|
16511
16742
|
var extraLineClasses = $$.format.extraLineClasses, $el = $$.$el, $T = $$.$T;
|
|
16512
16743
|
var $root = isSub ? $el.subchart : $el;
|
|
16513
16744
|
var line = $root.main
|
|
16514
|
-
.selectAll("."
|
|
16515
|
-
.selectAll("."
|
|
16745
|
+
.selectAll(".".concat(CLASS.lines))
|
|
16746
|
+
.selectAll(".".concat(CLASS.line))
|
|
16516
16747
|
.data($$.lineData.bind($$));
|
|
16517
16748
|
$T(line.exit(), withTransition)
|
|
16518
16749
|
.style("opacity", "0")
|
|
16519
16750
|
.remove();
|
|
16520
16751
|
$root.line = line.enter()
|
|
16521
16752
|
.append("path")
|
|
16522
|
-
.attr("class", function (d) { return $$.getClass("line", true)(d)
|
|
16753
|
+
.attr("class", function (d) { return "".concat($$.getClass("line", true)(d), " ").concat(extraLineClasses(d) || ""); })
|
|
16523
16754
|
.style("stroke", $$.color)
|
|
16524
16755
|
.merge(line)
|
|
16525
16756
|
.style("opacity", $$.initialOpacity.bind($$))
|
|
@@ -16616,7 +16847,7 @@ var shapeLine = {
|
|
|
16616
16847
|
x0 = x(values[0].x);
|
|
16617
16848
|
y0 = y(values[0].value);
|
|
16618
16849
|
}
|
|
16619
|
-
path = isRotated ? "M "
|
|
16850
|
+
path = isRotated ? "M ".concat(y0, " ").concat(x0) : "M ".concat(x0, " ").concat(y0);
|
|
16620
16851
|
}
|
|
16621
16852
|
return path || "M 0 0";
|
|
16622
16853
|
};
|
|
@@ -16656,7 +16887,7 @@ var shapeLine = {
|
|
|
16656
16887
|
var xValue = isRotated ? function (dt) { return y(dt.value); } : function (dt) { return x(dt.x); };
|
|
16657
16888
|
var yValue = isRotated ? function (dt) { return x(dt.x); } : function (dt) { return y(dt.value); };
|
|
16658
16889
|
// Define svg generator function for region
|
|
16659
|
-
var generateM = function (points) { return "M"
|
|
16890
|
+
var generateM = function (points) { return "M".concat(points[0][0], ",").concat(points[0][1], "L").concat(points[1][0], ",").concat(points[1][1]); };
|
|
16660
16891
|
var sWithRegion = isTimeSeries ? function (d0, d1, k, timeseriesDiff) {
|
|
16661
16892
|
var x0 = d0.x.getTime();
|
|
16662
16893
|
var xDiff = d1.x - d0.x;
|
|
@@ -16685,7 +16916,7 @@ var shapeLine = {
|
|
|
16685
16916
|
}
|
|
16686
16917
|
// Draw as normal
|
|
16687
16918
|
if (isUndefined(regions) || !style || !hasPrevData) {
|
|
16688
|
-
path += ""
|
|
16919
|
+
path += "".concat(i && hasPrevData ? "L" : "M").concat(xValue(data), ",").concat(yValue(data));
|
|
16689
16920
|
}
|
|
16690
16921
|
else if (hasPrevData) {
|
|
16691
16922
|
try {
|
|
@@ -16757,8 +16988,8 @@ var shapePoint = {
|
|
|
16757
16988
|
var $$ = this;
|
|
16758
16989
|
var main = $$.$el.main;
|
|
16759
16990
|
$$.point = $$.generatePoint();
|
|
16760
|
-
if (($$.hasType("bubble") || $$.hasType("scatter")) && main.select("."
|
|
16761
|
-
main.select("."
|
|
16991
|
+
if (($$.hasType("bubble") || $$.hasType("scatter")) && main.select(".".concat(CLASS.chartCircles)).empty()) {
|
|
16992
|
+
main.select(".".concat(CLASS.chart))
|
|
16762
16993
|
.append("g")
|
|
16763
16994
|
.attr("class", CLASS.chartCircles);
|
|
16764
16995
|
}
|
|
@@ -16780,9 +17011,9 @@ var shapePoint = {
|
|
|
16780
17011
|
if (!targets) {
|
|
16781
17012
|
targets = (data.targets)
|
|
16782
17013
|
.filter(function (d) { return _this.isScatterType(d) || _this.isBubbleType(d); });
|
|
16783
|
-
var mainCircle = $el.main.select("."
|
|
17014
|
+
var mainCircle = $el.main.select(".".concat(CLASS.chartCircles))
|
|
16784
17015
|
.style("pointer-events", "none")
|
|
16785
|
-
.selectAll("."
|
|
17016
|
+
.selectAll(".".concat(CLASS.circles))
|
|
16786
17017
|
.data(targets)
|
|
16787
17018
|
.attr("class", classCircles);
|
|
16788
17019
|
mainCircle.exit().remove();
|
|
@@ -16796,8 +17027,8 @@ var shapePoint = {
|
|
|
16796
17027
|
.style("cursor", function (d) { return (isFunction(isSelectable) && isSelectable(d) ? "pointer" : null); });
|
|
16797
17028
|
// Update date for selected circles
|
|
16798
17029
|
selectionEnabled && targets.forEach(function (t) {
|
|
16799
|
-
$el.main.selectAll("."
|
|
16800
|
-
.selectAll(""
|
|
17030
|
+
$el.main.selectAll(".".concat(CLASS.selectedCircles).concat($$.getTargetSelectorSuffix(t.id)))
|
|
17031
|
+
.selectAll("".concat(CLASS.selectedCircle))
|
|
16801
17032
|
.each(function (d) {
|
|
16802
17033
|
d.value = t.values[d.index].value;
|
|
16803
17034
|
});
|
|
@@ -16810,8 +17041,8 @@ var shapePoint = {
|
|
|
16810
17041
|
var focusOnly = config.point_focus_only;
|
|
16811
17042
|
var $root = isSub ? $el.subchart : $el;
|
|
16812
17043
|
if (config.point_show && !state.toggling) {
|
|
16813
|
-
var circles = $root.main.selectAll("."
|
|
16814
|
-
.selectAll("."
|
|
17044
|
+
var circles = $root.main.selectAll(".".concat(CLASS.circles))
|
|
17045
|
+
.selectAll(".".concat(CLASS.circle))
|
|
16815
17046
|
.data(function (d) { return (($$.isLineType(d) && $$.shouldDrawPointsForLine(d)) ||
|
|
16816
17047
|
$$.isBubbleType(d) || $$.isRadarType(d) || $$.isScatterType(d) ?
|
|
16817
17048
|
(focusOnly ? [d.values[0]] : d.values) : []); });
|
|
@@ -16819,7 +17050,7 @@ var shapePoint = {
|
|
|
16819
17050
|
circles.enter()
|
|
16820
17051
|
.filter(Boolean)
|
|
16821
17052
|
.append($$.point("create", this, $$.pointR.bind($$), $$.color));
|
|
16822
|
-
$root.circle = $root.main.selectAll("."
|
|
17053
|
+
$root.circle = $root.main.selectAll(".".concat(CLASS.circles, " .").concat(CLASS.circle))
|
|
16823
17054
|
.style("stroke", $$.color)
|
|
16824
17055
|
.style("opacity", $$.initialOpacityForCircle.bind($$));
|
|
16825
17056
|
}
|
|
@@ -16829,7 +17060,7 @@ var shapePoint = {
|
|
|
16829
17060
|
var $$ = this;
|
|
16830
17061
|
var rendered = $$.state.rendered, $el = $$.$el, $T = $$.$T;
|
|
16831
17062
|
var $root = isSub ? $el.subchart : $el;
|
|
16832
|
-
var selectedCircles = $root.main.selectAll("."
|
|
17063
|
+
var selectedCircles = $root.main.selectAll(".".concat(CLASS.selectedCircle));
|
|
16833
17064
|
if (!$$.config.point_show) {
|
|
16834
17065
|
return [];
|
|
16835
17066
|
}
|
|
@@ -16847,8 +17078,8 @@ var shapePoint = {
|
|
|
16847
17078
|
return [
|
|
16848
17079
|
mainCircles,
|
|
16849
17080
|
$T(selectedCircles, withTransition)
|
|
16850
|
-
.attr(posAttr
|
|
16851
|
-
.attr(posAttr
|
|
17081
|
+
.attr("".concat(posAttr, "x"), cx)
|
|
17082
|
+
.attr("".concat(posAttr, "y"), cy)
|
|
16852
17083
|
];
|
|
16853
17084
|
},
|
|
16854
17085
|
/**
|
|
@@ -16935,7 +17166,7 @@ var shapePoint = {
|
|
|
16935
17166
|
var _a = this.getBBox(), width = _a.width, height = _a.height;
|
|
16936
17167
|
var x = ratio * (+point.attr("x") + width / 2);
|
|
16937
17168
|
var y = ratio * (+point.attr("y") + height / 2);
|
|
16938
|
-
point.attr("transform", "translate("
|
|
17169
|
+
point.attr("transform", "translate(".concat(x, " ").concat(y, ") scale(").concat(scale, ")"));
|
|
16939
17170
|
}
|
|
16940
17171
|
});
|
|
16941
17172
|
}
|
|
@@ -16950,7 +17181,7 @@ var shapePoint = {
|
|
|
16950
17181
|
.classed(CLASS.EXPANDED, false);
|
|
16951
17182
|
circles.attr("r", r);
|
|
16952
17183
|
!$$.isCirclePoint() &&
|
|
16953
|
-
circles.attr("transform", "scale("
|
|
17184
|
+
circles.attr("transform", "scale(".concat(r(circles) / $$.config.point_r, ")"));
|
|
16954
17185
|
},
|
|
16955
17186
|
pointR: function (d) {
|
|
16956
17187
|
var $$ = this;
|
|
@@ -16982,8 +17213,8 @@ var shapePoint = {
|
|
|
16982
17213
|
var mouse = getPointer(this.state.event, node);
|
|
16983
17214
|
var element = select(node);
|
|
16984
17215
|
var prefix = this.isCirclePoint(node) ? "c" : "";
|
|
16985
|
-
var cx = +element.attr(prefix
|
|
16986
|
-
var cy = +element.attr(prefix
|
|
17216
|
+
var cx = +element.attr("".concat(prefix, "x"));
|
|
17217
|
+
var cy = +element.attr("".concat(prefix, "y"));
|
|
16987
17218
|
// if node don't have cx/y or x/y attribute value
|
|
16988
17219
|
if (!(cx || cy) && node.nodeType === 1) {
|
|
16989
17220
|
var _a = getBoundingRect(node), x = _a.x, y = _a.y;
|
|
@@ -17023,7 +17254,7 @@ var shapePoint = {
|
|
|
17023
17254
|
$$.$el.defs.node().appendChild(clone);
|
|
17024
17255
|
},
|
|
17025
17256
|
pointFromDefs: function (id) {
|
|
17026
|
-
return this.$el.defs.select("#"
|
|
17257
|
+
return this.$el.defs.select("#".concat(id));
|
|
17027
17258
|
},
|
|
17028
17259
|
updatePointClass: function (d) {
|
|
17029
17260
|
var $$ = this;
|
|
@@ -17034,7 +17265,7 @@ var shapePoint = {
|
|
|
17034
17265
|
circle.each(function (d) {
|
|
17035
17266
|
var className = $$.getClass("circle", true)(d);
|
|
17036
17267
|
if (this.getAttribute("class").indexOf(CLASS.EXPANDED) > -1) {
|
|
17037
|
-
className += " "
|
|
17268
|
+
className += " ".concat(CLASS.EXPANDED);
|
|
17038
17269
|
}
|
|
17039
17270
|
this.setAttribute("class", className);
|
|
17040
17271
|
}) : $$.getClass("circle", true)(d);
|
|
@@ -17087,7 +17318,7 @@ var shapePoint = {
|
|
|
17087
17318
|
point = $$[point];
|
|
17088
17319
|
}
|
|
17089
17320
|
else if (!$$.hasValidPointDrawMethods(point)) {
|
|
17090
|
-
var pointId = datetimeId
|
|
17321
|
+
var pointId = "".concat(datetimeId, "-point").concat(id);
|
|
17091
17322
|
var pointFromDefs = $$.pointFromDefs(pointId);
|
|
17092
17323
|
if (pointFromDefs.size() < 1) {
|
|
17093
17324
|
$$.insertPointInfoDefs(point, pointId);
|
|
@@ -17106,7 +17337,7 @@ var shapePoint = {
|
|
|
17106
17337
|
custom: {
|
|
17107
17338
|
create: function (element, id, sizeFn, fillStyleFn) {
|
|
17108
17339
|
return element.append("use")
|
|
17109
|
-
.attr("xlink:href", "#"
|
|
17340
|
+
.attr("xlink:href", "#".concat(id))
|
|
17110
17341
|
.attr("class", this.updatePointClass.bind(this))
|
|
17111
17342
|
.style("fill", fillStyleFn)
|
|
17112
17343
|
.node();
|
|
@@ -17215,7 +17446,7 @@ var shapeRadar = {
|
|
|
17215
17446
|
var $$ = this;
|
|
17216
17447
|
var config = $$.config, current = $$.state.current, $el = $$.$el;
|
|
17217
17448
|
if ($$.hasType("radar")) {
|
|
17218
|
-
$el.radar = $el.main.select("."
|
|
17449
|
+
$el.radar = $el.main.select(".".concat(CLASS.chart)).append("g")
|
|
17219
17450
|
.attr("class", CLASS.chartRadars);
|
|
17220
17451
|
// level
|
|
17221
17452
|
$el.radar.levels = $el.radar.append("g")
|
|
@@ -17279,7 +17510,7 @@ var shapeRadar = {
|
|
|
17279
17510
|
// Adjust radar, circles and texts' position
|
|
17280
17511
|
if (translate) {
|
|
17281
17512
|
radar.attr("transform", translate);
|
|
17282
|
-
main.select("."
|
|
17513
|
+
main.select(".".concat(CLASS.chartTexts)).attr("transform", translate);
|
|
17283
17514
|
$$.generateRadarPoints();
|
|
17284
17515
|
$$.updateRadarLevel();
|
|
17285
17516
|
$$.updateRadarAxes();
|
|
@@ -17317,11 +17548,11 @@ var shapeRadar = {
|
|
|
17317
17548
|
return pos.join(" ");
|
|
17318
17549
|
});
|
|
17319
17550
|
var level = radarLevels
|
|
17320
|
-
.selectAll("."
|
|
17551
|
+
.selectAll(".".concat(CLASS.level))
|
|
17321
17552
|
.data(levelData);
|
|
17322
17553
|
level.exit().remove();
|
|
17323
17554
|
var levelEnter = level.enter().append("g")
|
|
17324
|
-
.attr("class", function (d, i) { return CLASS.level
|
|
17555
|
+
.attr("class", function (d, i) { return "".concat(CLASS.level, " ").concat(CLASS.level, "-").concat(i); });
|
|
17325
17556
|
levelEnter.append("polygon")
|
|
17326
17557
|
.style("visibility", config.radar_level_show ? null : "hidden");
|
|
17327
17558
|
if (showText) {
|
|
@@ -17340,7 +17571,7 @@ var shapeRadar = {
|
|
|
17340
17571
|
}
|
|
17341
17572
|
levelEnter
|
|
17342
17573
|
.merge(level)
|
|
17343
|
-
.attr("transform", function (d) { return "translate("
|
|
17574
|
+
.attr("transform", function (d) { return "translate(".concat(width - levelRatio[d], ", ").concat(height - levelRatio[d], ")"); })
|
|
17344
17575
|
.selectAll("polygon")
|
|
17345
17576
|
.attr("points", function (d) { return points[d]; });
|
|
17346
17577
|
// update level text position
|
|
@@ -17359,7 +17590,7 @@ var shapeRadar = {
|
|
|
17359
17590
|
.data(categories);
|
|
17360
17591
|
axis.exit().remove();
|
|
17361
17592
|
var axisEnter = axis.enter().append("g")
|
|
17362
|
-
.attr("class", function (d, i) { return CLASS.axis
|
|
17593
|
+
.attr("class", function (d, i) { return "".concat(CLASS.axis, "-").concat(i); });
|
|
17363
17594
|
config.radar_axis_line_show && axisEnter.append("line");
|
|
17364
17595
|
config.radar_axis_text_show && axisEnter.append("text");
|
|
17365
17596
|
axis = axisEnter.merge(axis);
|
|
@@ -17406,7 +17637,7 @@ var shapeRadar = {
|
|
|
17406
17637
|
else if (posY < height) {
|
|
17407
17638
|
posY -= y_1;
|
|
17408
17639
|
}
|
|
17409
|
-
return "translate("
|
|
17640
|
+
return "translate(".concat(posX, " ").concat(posY, ")");
|
|
17410
17641
|
});
|
|
17411
17642
|
}
|
|
17412
17643
|
$$.bindEvent();
|
|
@@ -17428,6 +17659,7 @@ var shapeRadar = {
|
|
|
17428
17659
|
return d && Object.keys(d).length === 1 ? d.index : undefined;
|
|
17429
17660
|
};
|
|
17430
17661
|
var hide = function (event) {
|
|
17662
|
+
state.event = event;
|
|
17431
17663
|
var index = getIndex_1(event);
|
|
17432
17664
|
var noIndex = isUndefined(index);
|
|
17433
17665
|
if (isMouse_1 || noIndex) {
|
|
@@ -17678,10 +17910,10 @@ var optBar = {
|
|
|
17678
17910
|
* @memberof Options
|
|
17679
17911
|
* @type {object}
|
|
17680
17912
|
* @property {object} bar Bar object
|
|
17913
|
+
* @property {number} [bar.indices.removeNull=false] Remove nullish data on bar indices positions.
|
|
17681
17914
|
* @property {number} [bar.label.threshold=0] Set threshold ratio to show/hide labels.
|
|
17682
17915
|
* @property {number} [bar.padding=0] The padding pixel value between each bar.
|
|
17683
17916
|
* @property {number} [bar.radius] Set the radius of bar edge in pixel.
|
|
17684
|
-
* - **NOTE:** Works only for non-stacked bar
|
|
17685
17917
|
* @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
|
|
17686
17918
|
* @property {number} [bar.sensitivity=2] The senstivity offset value for interaction boundary.
|
|
17687
17919
|
* @property {number} [bar.width] Change the width of bar chart.
|
|
@@ -17694,15 +17926,21 @@ var optBar = {
|
|
|
17694
17926
|
* @property {number} [bar.width.dataname.ratio=0.6] Change the width of bar chart by ratio.
|
|
17695
17927
|
* @property {number} [bar.width.dataname.max] The maximum width value for ratio.
|
|
17696
17928
|
* @property {boolean} [bar.zerobased=true] Set if min or max value will be 0 on bar chart.
|
|
17929
|
+
* @see [Demo: bar indices](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarIndices)
|
|
17697
17930
|
* @see [Demo: bar padding](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarPadding)
|
|
17698
17931
|
* @see [Demo: bar radius](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarRadius)
|
|
17699
17932
|
* @see [Demo: bar width](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidth)
|
|
17700
17933
|
* @see [Demo: bar width variant](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidthVariant)
|
|
17701
17934
|
* @example
|
|
17702
17935
|
* bar: {
|
|
17936
|
+
* // remove nullish data on bar indices postions
|
|
17937
|
+
* indices: {
|
|
17938
|
+
* removeNull: true
|
|
17939
|
+
* },
|
|
17940
|
+
*
|
|
17703
17941
|
* padding: 1,
|
|
17704
17942
|
*
|
|
17705
|
-
* //
|
|
17943
|
+
* // bar radius
|
|
17706
17944
|
* radius: 10,
|
|
17707
17945
|
* // or
|
|
17708
17946
|
* radius: {
|
|
@@ -17739,6 +17977,7 @@ var optBar = {
|
|
|
17739
17977
|
* }
|
|
17740
17978
|
*/
|
|
17741
17979
|
bar_label_threshold: 0,
|
|
17980
|
+
bar_indices_removeNull: false,
|
|
17742
17981
|
bar_padding: 0,
|
|
17743
17982
|
bar_radius: undefined,
|
|
17744
17983
|
bar_radius_ratio: undefined,
|
|
@@ -18446,8 +18685,8 @@ var apiSelection = {
|
|
|
18446
18685
|
selected: function (targetId) {
|
|
18447
18686
|
var $$ = this.internal;
|
|
18448
18687
|
var dataPoint = [];
|
|
18449
|
-
$$.$el.main.selectAll("."
|
|
18450
|
-
.selectAll("."
|
|
18688
|
+
$$.$el.main.selectAll(".".concat(CLASS.shapes + $$.getTargetSelectorSuffix(targetId)))
|
|
18689
|
+
.selectAll(".".concat(CLASS.shape))
|
|
18451
18690
|
.filter(function () {
|
|
18452
18691
|
return select(this).classed(CLASS.SELECTED);
|
|
18453
18692
|
})
|
|
@@ -18484,8 +18723,8 @@ var apiSelection = {
|
|
|
18484
18723
|
if (!config.data_selection_enabled) {
|
|
18485
18724
|
return;
|
|
18486
18725
|
}
|
|
18487
|
-
$el.main.selectAll("."
|
|
18488
|
-
.selectAll("."
|
|
18726
|
+
$el.main.selectAll(".".concat(CLASS.shapes))
|
|
18727
|
+
.selectAll(".".concat(CLASS.shape))
|
|
18489
18728
|
.each(function (d, i) {
|
|
18490
18729
|
var shape = select(this);
|
|
18491
18730
|
var id = d.data ? d.data.id : d.id;
|
|
@@ -18530,8 +18769,8 @@ var apiSelection = {
|
|
|
18530
18769
|
if (!config.data_selection_enabled) {
|
|
18531
18770
|
return;
|
|
18532
18771
|
}
|
|
18533
|
-
$el.main.selectAll("."
|
|
18534
|
-
.selectAll("."
|
|
18772
|
+
$el.main.selectAll(".".concat(CLASS.shapes))
|
|
18773
|
+
.selectAll(".".concat(CLASS.shape))
|
|
18535
18774
|
.each(function (d, i) {
|
|
18536
18775
|
var shape = select(this);
|
|
18537
18776
|
var id = d.data ? d.data.id : d.id;
|
|
@@ -18591,12 +18830,12 @@ var apiSubchart = {
|
|
|
18591
18830
|
$$.unbindZoomEvent();
|
|
18592
18831
|
config.subchart_show = !show;
|
|
18593
18832
|
!subchart.main && $$.initSubchart();
|
|
18594
|
-
var $target = subchart.main.selectAll("."
|
|
18833
|
+
var $target = subchart.main.selectAll(".".concat(CLASS.target));
|
|
18595
18834
|
// need to cover when new data has been loaded
|
|
18596
18835
|
if ($$.data.targets.length !== $target.size()) {
|
|
18597
18836
|
$$.updateSizes();
|
|
18598
18837
|
$$.updateTargetsForSubchart($$.data.targets);
|
|
18599
|
-
$target = subchart.main.selectAll("."
|
|
18838
|
+
$target = subchart.main.selectAll(".".concat(CLASS.target));
|
|
18600
18839
|
}
|
|
18601
18840
|
$target.style("opacity", null);
|
|
18602
18841
|
subchart.main.style("display", null);
|
|
@@ -18882,14 +19121,14 @@ var drag = {
|
|
|
18882
19121
|
var maxX = Math.max(sx, mx);
|
|
18883
19122
|
var minY = isSelectionGrouped ? state.margin.top : Math.min(sy, my);
|
|
18884
19123
|
var maxY = isSelectionGrouped ? state.height : Math.max(sy, my);
|
|
18885
|
-
main.select("."
|
|
19124
|
+
main.select(".".concat(CLASS.dragarea))
|
|
18886
19125
|
.attr("x", minX)
|
|
18887
19126
|
.attr("y", minY)
|
|
18888
19127
|
.attr("width", maxX - minX)
|
|
18889
19128
|
.attr("height", maxY - minY);
|
|
18890
19129
|
// TODO: binary search when multiple xs
|
|
18891
|
-
main.selectAll("."
|
|
18892
|
-
.selectAll("."
|
|
19130
|
+
main.selectAll(".".concat(CLASS.shapes))
|
|
19131
|
+
.selectAll(".".concat(CLASS.shape))
|
|
18893
19132
|
.filter(function (d) { return isSelectable === null || isSelectable === void 0 ? void 0 : isSelectable.bind($$.api)(d); })
|
|
18894
19133
|
.each(function (d, i) {
|
|
18895
19134
|
var shape = select(this);
|
|
@@ -18934,7 +19173,7 @@ var drag = {
|
|
|
18934
19173
|
return;
|
|
18935
19174
|
}
|
|
18936
19175
|
state.dragStart = mouse;
|
|
18937
|
-
main.select("."
|
|
19176
|
+
main.select(".".concat(CLASS.chart))
|
|
18938
19177
|
.append("rect")
|
|
18939
19178
|
.attr("class", CLASS.dragarea)
|
|
18940
19179
|
.style("opacity", "0.1");
|
|
@@ -18951,10 +19190,10 @@ var drag = {
|
|
|
18951
19190
|
if ($$.hasArcType() || !config.data_selection_enabled) { // do nothing if not selectable
|
|
18952
19191
|
return;
|
|
18953
19192
|
}
|
|
18954
|
-
$T(main.select("."
|
|
19193
|
+
$T(main.select(".".concat(CLASS.dragarea)))
|
|
18955
19194
|
.style("opacity", "0")
|
|
18956
19195
|
.remove();
|
|
18957
|
-
main.selectAll("."
|
|
19196
|
+
main.selectAll(".".concat(CLASS.shape))
|
|
18958
19197
|
.classed(CLASS.INCLUDED, false);
|
|
18959
19198
|
$$.setDragStatus(false);
|
|
18960
19199
|
}
|
|
@@ -18977,8 +19216,8 @@ var selection = _assign(_assign({}, drag), {
|
|
|
18977
19216
|
var r = $$.pointSelectR.bind($$);
|
|
18978
19217
|
callFn(config.data_onselected, $$.api, d, target.node());
|
|
18979
19218
|
// add selected-circle on low layer g
|
|
18980
|
-
$T(main.select("."
|
|
18981
|
-
.selectAll("."
|
|
19219
|
+
$T(main.select(".".concat(CLASS.selectedCircles).concat($$.getTargetSelectorSuffix(d.id)))
|
|
19220
|
+
.selectAll(".".concat(CLASS.selectedCircle, "-").concat(i))
|
|
18982
19221
|
.data([d])
|
|
18983
19222
|
.enter()
|
|
18984
19223
|
.append("circle")
|
|
@@ -19000,8 +19239,8 @@ var selection = _assign(_assign({}, drag), {
|
|
|
19000
19239
|
var config = $$.config, main = $$.$el.main, $T = $$.$T;
|
|
19001
19240
|
callFn(config.data_onunselected, $$.api, d, target.node());
|
|
19002
19241
|
// remove selected-circle from low layer g
|
|
19003
|
-
$T(main.select("."
|
|
19004
|
-
.selectAll("."
|
|
19242
|
+
$T(main.select(".".concat(CLASS.selectedCircles).concat($$.getTargetSelectorSuffix(d.id)))
|
|
19243
|
+
.selectAll(".".concat(CLASS.selectedCircle, "-").concat(i)))
|
|
19005
19244
|
.attr("r", 0)
|
|
19006
19245
|
.remove();
|
|
19007
19246
|
},
|
|
@@ -19014,7 +19253,7 @@ var selection = _assign(_assign({}, drag), {
|
|
|
19014
19253
|
* @private
|
|
19015
19254
|
*/
|
|
19016
19255
|
togglePoint: function (selected, target, d, i) {
|
|
19017
|
-
var method = (selected ? "" : "un"
|
|
19256
|
+
var method = "".concat(selected ? "" : "un", "selectPoint");
|
|
19018
19257
|
this[method](target, d, i);
|
|
19019
19258
|
},
|
|
19020
19259
|
/**
|
|
@@ -19054,7 +19293,7 @@ var selection = _assign(_assign({}, drag), {
|
|
|
19054
19293
|
* @private
|
|
19055
19294
|
*/
|
|
19056
19295
|
togglePath: function (selected, target, d, i) {
|
|
19057
|
-
this[(selected ? "" : "un"
|
|
19296
|
+
this["".concat(selected ? "" : "un", "selectPath")](target, d, i);
|
|
19058
19297
|
},
|
|
19059
19298
|
/**
|
|
19060
19299
|
* Returns the toggle method of the target
|
|
@@ -19086,12 +19325,12 @@ var selection = _assign(_assign({}, drag), {
|
|
|
19086
19325
|
var toggledShape;
|
|
19087
19326
|
if (config.data_selection_enabled && config.data_selection_isselectable.bind($$.api)(d)) {
|
|
19088
19327
|
if (!config.data_selection_multiple) {
|
|
19089
|
-
var selector = "."
|
|
19328
|
+
var selector = ".".concat(CLASS.shapes);
|
|
19090
19329
|
if (config.data_selection_grouped) {
|
|
19091
19330
|
selector += $$.getTargetSelectorSuffix(d.id);
|
|
19092
19331
|
}
|
|
19093
19332
|
main.selectAll(selector)
|
|
19094
|
-
.selectAll("."
|
|
19333
|
+
.selectAll(".".concat(CLASS.shape))
|
|
19095
19334
|
.each(function (d, i) {
|
|
19096
19335
|
var shape = select(this);
|
|
19097
19336
|
if (shape.classed(CLASS.SELECTED)) {
|
|
@@ -19125,7 +19364,7 @@ var subchart = {
|
|
|
19125
19364
|
// set the brush
|
|
19126
19365
|
$$.brush = (isRotated ? brushY() : brushX()).handleSize(5);
|
|
19127
19366
|
var getBrushSize = function () {
|
|
19128
|
-
var brush = $$.$el.svg.select("."
|
|
19367
|
+
var brush = $$.$el.svg.select(".".concat(CLASS.brush, " .overlay"));
|
|
19129
19368
|
var brushSize = { width: 0, height: 0 };
|
|
19130
19369
|
if (brush.size()) {
|
|
19131
19370
|
brushSize.width = +brush.attr("width");
|
|
@@ -19155,7 +19394,7 @@ var subchart = {
|
|
|
19155
19394
|
.attr("transform", function (d, i) {
|
|
19156
19395
|
var pos = isRotated ?
|
|
19157
19396
|
[33, selection[i] - (i === 0 ? 30 : 24)] : [selection[i], 3];
|
|
19158
|
-
return "translate("
|
|
19397
|
+
return "translate(".concat(pos, ")");
|
|
19159
19398
|
});
|
|
19160
19399
|
}
|
|
19161
19400
|
}
|
|
@@ -19173,7 +19412,7 @@ var subchart = {
|
|
|
19173
19412
|
var _a;
|
|
19174
19413
|
var extent = this.extent()();
|
|
19175
19414
|
if (extent[1].filter(function (v) { return isNaN(v); }).length === 0) {
|
|
19176
|
-
(_a = subchart.main) === null || _a === void 0 ? void 0 : _a.select("."
|
|
19415
|
+
(_a = subchart.main) === null || _a === void 0 ? void 0 : _a.select(".".concat(CLASS.brush)).call(this);
|
|
19177
19416
|
}
|
|
19178
19417
|
return this;
|
|
19179
19418
|
};
|
|
@@ -19196,7 +19435,7 @@ var subchart = {
|
|
|
19196
19435
|
};
|
|
19197
19436
|
$$.brush.getSelection = function () { return (
|
|
19198
19437
|
// @ts-ignore
|
|
19199
|
-
subchart.main ? subchart.main.select("."
|
|
19438
|
+
subchart.main ? subchart.main.select(".".concat(CLASS.brush)) : select([])); };
|
|
19200
19439
|
},
|
|
19201
19440
|
/**
|
|
19202
19441
|
* Initialize the subchart.
|
|
@@ -19209,7 +19448,7 @@ var subchart = {
|
|
|
19209
19448
|
return;
|
|
19210
19449
|
}
|
|
19211
19450
|
var visibility = config.subchart_show ? null : "hidden";
|
|
19212
|
-
var clipId = clip.id
|
|
19451
|
+
var clipId = "".concat(clip.id, "-subchart");
|
|
19213
19452
|
var clipPath = $$.getClipPath(clipId);
|
|
19214
19453
|
clip.idSubchart = clipId;
|
|
19215
19454
|
$$.appendClip(defs, clipId);
|
|
@@ -19227,9 +19466,9 @@ var subchart = {
|
|
|
19227
19466
|
["bar", "line", "bubble", "candlestick", "scatter"].forEach(function (v) {
|
|
19228
19467
|
var type = capitalize(/^(bubble|scatter)$/.test(v) ? "circle" : v);
|
|
19229
19468
|
if ($$.hasType(v) || $$.hasTypeOf(type)) {
|
|
19230
|
-
var chart = main.select("."
|
|
19231
|
-
var chartClassName = CLASS["chart"
|
|
19232
|
-
if (chart.select("."
|
|
19469
|
+
var chart = main.select(".".concat(CLASS.chart));
|
|
19470
|
+
var chartClassName = CLASS["chart".concat(type, "s")];
|
|
19471
|
+
if (chart.select(".".concat(chartClassName)).empty()) {
|
|
19233
19472
|
chart
|
|
19234
19473
|
.append("g")
|
|
19235
19474
|
.attr("class", chartClassName);
|
|
@@ -19270,14 +19509,14 @@ var subchart = {
|
|
|
19270
19509
|
"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",
|
|
19271
19510
|
"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"
|
|
19272
19511
|
];
|
|
19273
|
-
$$.brush.handle = brush.selectAll("."
|
|
19512
|
+
$$.brush.handle = brush.selectAll(".".concat(customHandleClass))
|
|
19274
19513
|
.data(isRotated ?
|
|
19275
19514
|
[{ type: "n" }, { type: "s" }] :
|
|
19276
19515
|
[{ type: "w" }, { type: "e" }])
|
|
19277
19516
|
.enter()
|
|
19278
19517
|
.append("path")
|
|
19279
19518
|
.attr("class", customHandleClass)
|
|
19280
|
-
.attr("cursor", (isRotated ? "ns" : "ew"
|
|
19519
|
+
.attr("cursor", "".concat(isRotated ? "ns" : "ew", "-resize"))
|
|
19281
19520
|
.attr("d", function (d) { return path[+/[se]/.test(d.type)]; })
|
|
19282
19521
|
.attr("display", initRange ? null : "none");
|
|
19283
19522
|
},
|
|
@@ -19296,12 +19535,12 @@ var subchart = {
|
|
|
19296
19535
|
var isPointType = /^(bubble|scatter)$/.test(v);
|
|
19297
19536
|
var name = capitalize(isPointType ? "circle" : v);
|
|
19298
19537
|
var chartClass = $$.getChartClass(name, true);
|
|
19299
|
-
var shapeClass = $$.getClass(isPointType ? "circles" : v
|
|
19300
|
-
var shapeChart = main.select("."
|
|
19538
|
+
var shapeClass = $$.getClass(isPointType ? "circles" : "".concat(v, "s"), true);
|
|
19539
|
+
var shapeChart = main.select(".".concat(CLASS["chart".concat("".concat(name, "s"))]));
|
|
19301
19540
|
if (isPointType) {
|
|
19302
19541
|
var circle = shapeChart
|
|
19303
|
-
.selectAll("."
|
|
19304
|
-
.data(targets.filter($$["is"
|
|
19542
|
+
.selectAll(".".concat(CLASS.circles))
|
|
19543
|
+
.data(targets.filter($$["is".concat(capitalize(v), "Type")].bind($$)))
|
|
19305
19544
|
.attr("class", shapeClass);
|
|
19306
19545
|
circle.exit().remove();
|
|
19307
19546
|
circle.enter().append("g")
|
|
@@ -19309,9 +19548,9 @@ var subchart = {
|
|
|
19309
19548
|
}
|
|
19310
19549
|
else {
|
|
19311
19550
|
var shapeUpdate = shapeChart
|
|
19312
|
-
.selectAll("."
|
|
19551
|
+
.selectAll(".".concat(CLASS["chart".concat(name)]))
|
|
19313
19552
|
.attr("class", chartClass)
|
|
19314
|
-
.data(targets.filter($$["is"
|
|
19553
|
+
.data(targets.filter($$["is".concat(name, "Type")].bind($$)));
|
|
19315
19554
|
var shapeEnter = shapeUpdate.enter()
|
|
19316
19555
|
.append("g")
|
|
19317
19556
|
.style("opacity", "0")
|
|
@@ -19325,7 +19564,7 @@ var subchart = {
|
|
|
19325
19564
|
}
|
|
19326
19565
|
});
|
|
19327
19566
|
// -- Brush --//
|
|
19328
|
-
main.selectAll("."
|
|
19567
|
+
main.selectAll(".".concat(CLASS.brush, " rect"))
|
|
19329
19568
|
.attr(config.axis_rotated ? "width" : "height", config.axis_rotated ? state.width2 : state.height2);
|
|
19330
19569
|
}
|
|
19331
19570
|
},
|
|
@@ -19355,10 +19594,10 @@ var subchart = {
|
|
|
19355
19594
|
!brushEmpty($$) && $$.brush.update();
|
|
19356
19595
|
Object.keys(shape.type).forEach(function (v) {
|
|
19357
19596
|
var name = capitalize(v);
|
|
19358
|
-
var drawFn = $$["generateDraw"
|
|
19597
|
+
var drawFn = $$["generateDraw".concat(name)](shape.indices[v], true);
|
|
19359
19598
|
// call shape's update & redraw method
|
|
19360
|
-
$$["update"
|
|
19361
|
-
$$["redraw"
|
|
19599
|
+
$$["update".concat(name)](withTransition, true);
|
|
19600
|
+
$$["redraw".concat(name)](drawFn, withTransition, true);
|
|
19362
19601
|
});
|
|
19363
19602
|
if ($$.hasType("bubble") || $$.hasType("scatter")) {
|
|
19364
19603
|
var cx = shape.pos.cx;
|
|
@@ -19397,7 +19636,7 @@ var subchart = {
|
|
|
19397
19636
|
var subchart = $$.$el.subchart, $T = $$.$T;
|
|
19398
19637
|
var subXAxis = (transitions === null || transitions === void 0 ? void 0 : transitions.axisSubX) ?
|
|
19399
19638
|
transitions.axisSubX :
|
|
19400
|
-
$T(subchart.main.select("."
|
|
19639
|
+
$T(subchart.main.select(".".concat(CLASS.axisX)), withTransition);
|
|
19401
19640
|
subchart.main.attr("transform", $$.getTranslate("context"));
|
|
19402
19641
|
subXAxis.attr("transform", $$.getTranslate("subX"));
|
|
19403
19642
|
},
|
|
@@ -20048,7 +20287,7 @@ var zoomModule = function () {
|
|
|
20048
20287
|
var defaults = {};
|
|
20049
20288
|
/**
|
|
20050
20289
|
* @namespace bb
|
|
20051
|
-
* @version 3.
|
|
20290
|
+
* @version 3.3.0-next.2
|
|
20052
20291
|
*/
|
|
20053
20292
|
var bb = {
|
|
20054
20293
|
/**
|
|
@@ -20058,7 +20297,7 @@ var bb = {
|
|
|
20058
20297
|
* bb.version; // "1.0.0"
|
|
20059
20298
|
* @memberof bb
|
|
20060
20299
|
*/
|
|
20061
|
-
version: "3.
|
|
20300
|
+
version: "3.3.0-next.2",
|
|
20062
20301
|
/**
|
|
20063
20302
|
* Generate chart
|
|
20064
20303
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|