billboard.js 3.3.3 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billboard.css +19 -14
- package/dist/billboard.js +504 -112
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +550 -126
- package/dist/billboard.pkgd.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +34 -18
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +34 -18
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +29 -15
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +29 -15
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +80 -32
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +80 -32
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +75 -29
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +75 -29
- package/dist/theme/datalab.css +24 -20
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +24 -20
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +24 -20
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +446 -99
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -5
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +8 -7
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +21 -21
- package/src/Chart/api/axis.ts +90 -25
- package/src/Chart/api/focus.ts +3 -2
- package/src/ChartInternal/Axis/Axis.ts +8 -6
- package/src/ChartInternal/ChartInternal.ts +48 -23
- package/src/ChartInternal/data/data.ts +1 -1
- package/src/ChartInternal/interactions/flow.ts +1 -1
- package/src/ChartInternal/internals/color.ts +4 -3
- package/src/ChartInternal/internals/format.ts +5 -1
- package/src/ChartInternal/internals/redraw.ts +3 -0
- package/src/ChartInternal/internals/text.ts +1 -1
- package/src/ChartInternal/internals/transform.ts +4 -1
- package/src/ChartInternal/internals/type.ts +5 -0
- package/src/ChartInternal/shape/arc.ts +41 -17
- package/src/ChartInternal/shape/bar.ts +1 -1
- package/src/ChartInternal/shape/point.ts +6 -3
- package/src/ChartInternal/shape/polar.ts +132 -0
- package/src/ChartInternal/shape/radar.ts +4 -4
- package/src/config/Options/common/main.ts +19 -2
- package/src/config/Options/data/data.ts +3 -0
- package/src/config/Options/shape/polar.ts +81 -0
- package/src/config/classes.ts +6 -3
- package/src/config/const.ts +3 -0
- package/src/config/resolver/shape.ts +4 -0
- package/src/core.ts +1 -0
- package/src/index.esm.ts +1 -0
- package/src/module/generator.ts +19 -5
- package/src/module/util.ts +22 -9
- package/src/scss/billboard.scss +13 -0
- package/src/scss/theme/datalab.scss +13 -0
- package/src/scss/theme/graph.scss +13 -0
- package/src/scss/theme/insight.scss +13 -0
- package/types/bb.d.ts +1 -0
- package/types/chart.d.ts +8 -8
- package/types/options.d.ts +79 -2
- package/types/types.d.ts +2 -0
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.4.0
|
|
9
9
|
*/
|
|
10
10
|
import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
|
|
11
11
|
import { pointer, select, namespaces, selectAll } from 'd3-selection';
|
|
@@ -57,6 +57,7 @@ var TYPE = {
|
|
|
57
57
|
GAUGE: "gauge",
|
|
58
58
|
LINE: "line",
|
|
59
59
|
PIE: "pie",
|
|
60
|
+
POLAR: "polar",
|
|
60
61
|
RADAR: "radar",
|
|
61
62
|
SCATTER: "scatter",
|
|
62
63
|
SPLINE: "spline",
|
|
@@ -79,6 +80,7 @@ var TYPE_METHOD_NEEDED = {
|
|
|
79
80
|
GAUGE: "initArc",
|
|
80
81
|
LINE: "initLine",
|
|
81
82
|
PIE: "initArc",
|
|
83
|
+
POLAR: "initPolar",
|
|
82
84
|
RADAR: "initCircle",
|
|
83
85
|
SCATTER: "initCircle",
|
|
84
86
|
SPLINE: "initLine",
|
|
@@ -104,6 +106,7 @@ var TYPE_BY_CATEGORY = {
|
|
|
104
106
|
TYPE.PIE,
|
|
105
107
|
TYPE.DONUT,
|
|
106
108
|
TYPE.GAUGE,
|
|
109
|
+
TYPE.POLAR,
|
|
107
110
|
TYPE.RADAR
|
|
108
111
|
],
|
|
109
112
|
Line: [
|
|
@@ -736,13 +739,16 @@ function tplProcess(tpl, data) {
|
|
|
736
739
|
* @private
|
|
737
740
|
*/
|
|
738
741
|
function parseDate(date) {
|
|
742
|
+
var _a;
|
|
739
743
|
var parsedDate;
|
|
740
744
|
if (date instanceof Date) {
|
|
741
745
|
parsedDate = date;
|
|
742
746
|
}
|
|
743
747
|
else if (isString(date)) {
|
|
744
|
-
var
|
|
745
|
-
|
|
748
|
+
var _b = this, config = _b.config, format = _b.format;
|
|
749
|
+
// if fails to parse, try by new Date()
|
|
750
|
+
// https://github.com/naver/billboard.js/issues/1714
|
|
751
|
+
parsedDate = (_a = format.dataTime(config.data_xFormat)(date)) !== null && _a !== void 0 ? _a : new Date(date);
|
|
746
752
|
}
|
|
747
753
|
else if (isNumber(date) && !isNaN(date)) {
|
|
748
754
|
parsedDate = new Date(+date);
|
|
@@ -759,7 +765,7 @@ function parseDate(date) {
|
|
|
759
765
|
* @private
|
|
760
766
|
*/
|
|
761
767
|
function isTabVisible() {
|
|
762
|
-
return
|
|
768
|
+
return (doc === null || doc === void 0 ? void 0 : doc.hidden) === false || (doc === null || doc === void 0 ? void 0 : doc.visibilityState) === "visible";
|
|
763
769
|
}
|
|
764
770
|
/**
|
|
765
771
|
* Get the current input type
|
|
@@ -769,26 +775,36 @@ function isTabVisible() {
|
|
|
769
775
|
* @private
|
|
770
776
|
*/
|
|
771
777
|
function convertInputType(mouse, touch) {
|
|
778
|
+
var DocumentTouch = win.DocumentTouch, matchMedia = win.matchMedia, navigator = win.navigator;
|
|
772
779
|
var hasTouch = false;
|
|
773
780
|
if (touch) {
|
|
774
781
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
775
|
-
if (
|
|
776
|
-
hasTouch =
|
|
782
|
+
if (navigator && "maxTouchPoints" in navigator) {
|
|
783
|
+
hasTouch = navigator.maxTouchPoints > 0;
|
|
777
784
|
// Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
778
785
|
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
779
786
|
}
|
|
780
|
-
else if ("ontouchmove" in win || (
|
|
787
|
+
else if ("ontouchmove" in win || (DocumentTouch && doc instanceof DocumentTouch)) {
|
|
781
788
|
hasTouch = true;
|
|
782
789
|
}
|
|
783
790
|
else {
|
|
784
791
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
792
|
+
if (matchMedia === null || matchMedia === void 0 ? void 0 : matchMedia("(pointer:coarse)").matches) {
|
|
793
|
+
hasTouch = true;
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
// Only as a last resort, fall back to user agent sniffing
|
|
797
|
+
var UA = navigator.userAgent;
|
|
798
|
+
hasTouch = (/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) ||
|
|
799
|
+
/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA));
|
|
788
800
|
}
|
|
789
801
|
}
|
|
790
802
|
}
|
|
791
|
-
|
|
803
|
+
// Check if agent has mouse using any-hover, touch devices (e.g iPad) with external mouse will return true as long as mouse is connected
|
|
804
|
+
// https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
|
|
805
|
+
// Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
|
|
806
|
+
var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"]
|
|
807
|
+
.some(function (v) { return matchMedia === null || matchMedia === void 0 ? void 0 : matchMedia("(".concat(v, ")")).matches; });
|
|
792
808
|
return (hasMouse && "mouse") || (hasTouch && "touch") || null;
|
|
793
809
|
}
|
|
794
810
|
|
|
@@ -945,12 +961,14 @@ var $GRID = {
|
|
|
945
961
|
ygridLines: "bb-ygrid-lines",
|
|
946
962
|
ygrids: "bb-ygrids"
|
|
947
963
|
};
|
|
948
|
-
var $
|
|
949
|
-
chartRadar: "bb-chart-radar",
|
|
950
|
-
chartRadars: "bb-chart-radars",
|
|
964
|
+
var $LEVEL = {
|
|
951
965
|
level: "bb-level",
|
|
952
966
|
levels: "bb-levels"
|
|
953
967
|
};
|
|
968
|
+
var $RADAR = {
|
|
969
|
+
chartRadar: "bb-chart-radar",
|
|
970
|
+
chartRadars: "bb-chart-radars"
|
|
971
|
+
};
|
|
954
972
|
var $REGION = {
|
|
955
973
|
region: "bb-region",
|
|
956
974
|
regions: "bb-regions"
|
|
@@ -1356,6 +1374,20 @@ var main = {
|
|
|
1356
1374
|
* }
|
|
1357
1375
|
*/
|
|
1358
1376
|
resize_auto: true,
|
|
1377
|
+
/**
|
|
1378
|
+
* Set a callback to execute when the chart is clicked.
|
|
1379
|
+
* @name onclick
|
|
1380
|
+
* @memberof Options
|
|
1381
|
+
* @type {Function}
|
|
1382
|
+
* @default undefined
|
|
1383
|
+
* @example
|
|
1384
|
+
* onclick: function(event) {
|
|
1385
|
+
* this; // chart instance itself
|
|
1386
|
+
* event; // native event object
|
|
1387
|
+
* ...
|
|
1388
|
+
* }
|
|
1389
|
+
*/
|
|
1390
|
+
onclick: undefined,
|
|
1359
1391
|
/**
|
|
1360
1392
|
* Set a callback to execute when mouse/touch enters the chart.
|
|
1361
1393
|
* @name onover
|
|
@@ -1363,8 +1395,9 @@ var main = {
|
|
|
1363
1395
|
* @type {Function}
|
|
1364
1396
|
* @default undefined
|
|
1365
1397
|
* @example
|
|
1366
|
-
* onover: function() {
|
|
1398
|
+
* onover: function(event) {
|
|
1367
1399
|
* this; // chart instance itself
|
|
1400
|
+
* event; // native event object
|
|
1368
1401
|
* ...
|
|
1369
1402
|
* }
|
|
1370
1403
|
*/
|
|
@@ -1376,8 +1409,9 @@ var main = {
|
|
|
1376
1409
|
* @type {Function}
|
|
1377
1410
|
* @default undefined
|
|
1378
1411
|
* @example
|
|
1379
|
-
* onout: function() {
|
|
1412
|
+
* onout: function(event) {
|
|
1380
1413
|
* this; // chart instance itself
|
|
1414
|
+
* event; // native event object
|
|
1381
1415
|
* ...
|
|
1382
1416
|
* }
|
|
1383
1417
|
*/
|
|
@@ -1638,6 +1672,7 @@ var data$2 = {
|
|
|
1638
1672
|
* - gauge
|
|
1639
1673
|
* - line
|
|
1640
1674
|
* - pie
|
|
1675
|
+
* - polar
|
|
1641
1676
|
* - radar
|
|
1642
1677
|
* - scatter
|
|
1643
1678
|
* - spline
|
|
@@ -1666,6 +1701,7 @@ var data$2 = {
|
|
|
1666
1701
|
* gauge,
|
|
1667
1702
|
* line,
|
|
1668
1703
|
* pie,
|
|
1704
|
+
* polar,
|
|
1669
1705
|
* radar,
|
|
1670
1706
|
* scatter,
|
|
1671
1707
|
* spline,
|
|
@@ -1711,6 +1747,7 @@ var data$2 = {
|
|
|
1711
1747
|
* gauge,
|
|
1712
1748
|
* line,
|
|
1713
1749
|
* pie,
|
|
1750
|
+
* polar,
|
|
1714
1751
|
* radar,
|
|
1715
1752
|
* scatter,
|
|
1716
1753
|
* spline,
|
|
@@ -2985,10 +3022,6 @@ var Cache = /** @class */ (function () {
|
|
|
2985
3022
|
return Cache;
|
|
2986
3023
|
}());
|
|
2987
3024
|
|
|
2988
|
-
/**
|
|
2989
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
2990
|
-
* billboard.js project is licensed under the MIT license
|
|
2991
|
-
*/
|
|
2992
3025
|
var setTimeout$1 = win.setTimeout, clearTimeout$1 = win.clearTimeout;
|
|
2993
3026
|
/**
|
|
2994
3027
|
* Generate resize queue function
|
|
@@ -3022,19 +3055,28 @@ function generateResize() {
|
|
|
3022
3055
|
*/
|
|
3023
3056
|
function generateWait() {
|
|
3024
3057
|
var transitionsToWait = [];
|
|
3025
|
-
|
|
3058
|
+
// 'f' is called as selection.call(f, ...);
|
|
3059
|
+
var f = function (selection, callback) {
|
|
3026
3060
|
var timer;
|
|
3027
|
-
|
|
3061
|
+
/**
|
|
3062
|
+
* Check if transition is complete
|
|
3063
|
+
* @private
|
|
3064
|
+
*/
|
|
3028
3065
|
function loop() {
|
|
3029
3066
|
var _a;
|
|
3030
3067
|
var done = 0;
|
|
3031
|
-
for (var i = 0,
|
|
3032
|
-
if (
|
|
3068
|
+
for (var i = 0, t = void 0; (t = transitionsToWait[i]); i++) {
|
|
3069
|
+
if (t === true || ((_a = t.empty) === null || _a === void 0 ? void 0 : _a.call(t))) {
|
|
3033
3070
|
done++;
|
|
3034
3071
|
continue;
|
|
3035
3072
|
}
|
|
3073
|
+
// when tab isn't visible exit loop
|
|
3074
|
+
if (isTabVisible() === false) {
|
|
3075
|
+
done = transitionsToWait.length;
|
|
3076
|
+
break;
|
|
3077
|
+
}
|
|
3036
3078
|
try {
|
|
3037
|
-
|
|
3079
|
+
t.transition();
|
|
3038
3080
|
}
|
|
3039
3081
|
catch (e) {
|
|
3040
3082
|
done++;
|
|
@@ -4763,12 +4805,13 @@ var color = {
|
|
|
4763
4805
|
},
|
|
4764
4806
|
/**
|
|
4765
4807
|
* Append data backgound color filter definition
|
|
4808
|
+
* @param {string} color Color string
|
|
4766
4809
|
* @private
|
|
4767
4810
|
*/
|
|
4768
|
-
generateDataLabelBackgroundColorFilter: function () {
|
|
4811
|
+
generateDataLabelBackgroundColorFilter: function (color) {
|
|
4769
4812
|
var $$ = this;
|
|
4770
4813
|
var $el = $$.$el, config = $$.config, state = $$.state;
|
|
4771
|
-
var backgroundColors = config.data_labels_backgroundColors;
|
|
4814
|
+
var backgroundColors = color || config.data_labels_backgroundColors;
|
|
4772
4815
|
if (backgroundColors) {
|
|
4773
4816
|
var ids = [];
|
|
4774
4817
|
if (isString(backgroundColors)) {
|
|
@@ -4778,7 +4821,7 @@ var color = {
|
|
|
4778
4821
|
ids = Object.keys(backgroundColors);
|
|
4779
4822
|
}
|
|
4780
4823
|
ids.forEach(function (v) {
|
|
4781
|
-
var id = "".concat(state.datetimeId, "-labels-bg").concat($$.getTargetSelectorSuffix(v));
|
|
4824
|
+
var id = "".concat(state.datetimeId, "-labels-bg").concat($$.getTargetSelectorSuffix(v)).concat(color ? $$.getTargetSelectorSuffix(color) : "");
|
|
4782
4825
|
$el.defs.append("filter")
|
|
4783
4826
|
.attr("x", "0")
|
|
4784
4827
|
.attr("y", "0")
|
|
@@ -5174,7 +5217,7 @@ var format = {
|
|
|
5174
5217
|
getDefaultValueFormat: function () {
|
|
5175
5218
|
var $$ = this;
|
|
5176
5219
|
var defaultArcValueFormat = $$.defaultArcValueFormat, yFormat = $$.yFormat, y2Format = $$.y2Format;
|
|
5177
|
-
var hasArc = $$.hasArcType(null, ["gauge", "radar"]);
|
|
5220
|
+
var hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
|
|
5178
5221
|
return function (v, ratio, id) {
|
|
5179
5222
|
var format = hasArc ? defaultArcValueFormat : ($$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat);
|
|
5180
5223
|
return format.call($$, v, ratio);
|
|
@@ -5186,6 +5229,9 @@ var format = {
|
|
|
5186
5229
|
defaultArcValueFormat: function (v, ratio) {
|
|
5187
5230
|
return "".concat((ratio * 100).toFixed(1), "%");
|
|
5188
5231
|
},
|
|
5232
|
+
defaultPolarValueFormat: function (v) {
|
|
5233
|
+
return "".concat(v);
|
|
5234
|
+
},
|
|
5189
5235
|
dataLabelFormat: function (targetId) {
|
|
5190
5236
|
var $$ = this;
|
|
5191
5237
|
var dataLabels = $$.config.data_labels;
|
|
@@ -5885,6 +5931,8 @@ var redraw = {
|
|
|
5885
5931
|
$el.arcs && $$.redrawArc(duration, durationForExit, wth.Transform);
|
|
5886
5932
|
// radar
|
|
5887
5933
|
$el.radar && $$.redrawRadar();
|
|
5934
|
+
// polar
|
|
5935
|
+
$el.polar && $$.redrawPolar();
|
|
5888
5936
|
}
|
|
5889
5937
|
// @TODO: Axis & Radar type
|
|
5890
5938
|
if (!state.resizing && ($$.hasPointType() || state.hasRadar)) {
|
|
@@ -7888,6 +7936,10 @@ var transform = {
|
|
|
7888
7936
|
x = state.arcWidth / 2;
|
|
7889
7937
|
y = state.arcHeight / 2;
|
|
7890
7938
|
}
|
|
7939
|
+
else if (target === "polar") {
|
|
7940
|
+
x = state.arcWidth / 2;
|
|
7941
|
+
y = state.arcHeight / 2;
|
|
7942
|
+
}
|
|
7891
7943
|
else if (target === "radar") {
|
|
7892
7944
|
var width = $$.getRadarSize()[0];
|
|
7893
7945
|
x = state.width / 2 - width;
|
|
@@ -8087,6 +8139,9 @@ var type = {
|
|
|
8087
8139
|
isDonutType: function (d) {
|
|
8088
8140
|
return this.isTypeOf(d, "donut");
|
|
8089
8141
|
},
|
|
8142
|
+
isPolarType: function (d) {
|
|
8143
|
+
return this.isTypeOf(d, "polar");
|
|
8144
|
+
},
|
|
8090
8145
|
isRadarType: function (d) {
|
|
8091
8146
|
return this.isTypeOf(d, "radar");
|
|
8092
8147
|
},
|
|
@@ -8094,6 +8149,7 @@ var type = {
|
|
|
8094
8149
|
return this.isPieType(d) ||
|
|
8095
8150
|
this.isDonutType(d) ||
|
|
8096
8151
|
this.isGaugeType(d) ||
|
|
8152
|
+
this.isPolarType(d) ||
|
|
8097
8153
|
this.isRadarType(d);
|
|
8098
8154
|
},
|
|
8099
8155
|
// determine if is 'circle' data point
|
|
@@ -8314,7 +8370,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8314
8370
|
};
|
|
8315
8371
|
ChartInternal.prototype.initParams = function () {
|
|
8316
8372
|
var $$ = this;
|
|
8317
|
-
var
|
|
8373
|
+
var config = $$.config, format = $$.format, state = $$.state;
|
|
8318
8374
|
var isRotated = config.axis_rotated;
|
|
8319
8375
|
// datetime to be used for uniqueness
|
|
8320
8376
|
state.datetimeId = "bb-".concat(+new Date() * getRandom());
|
|
@@ -8359,6 +8415,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8359
8415
|
var config = $$.config, scale = $$.scale, state = $$.state, $el = $$.$el, org = $$.org;
|
|
8360
8416
|
var hasAxis = state.hasAxis;
|
|
8361
8417
|
var hasInteraction = config.interaction_enabled;
|
|
8418
|
+
var hasPolar = $$.hasType("polar");
|
|
8362
8419
|
// for arc type, set axes to not be shown
|
|
8363
8420
|
// $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
|
|
8364
8421
|
if (hasAxis) {
|
|
@@ -8406,20 +8463,23 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8406
8463
|
.style("display", "block");
|
|
8407
8464
|
if (hasInteraction && state.inputType) {
|
|
8408
8465
|
var isTouch = state.inputType === "touch";
|
|
8409
|
-
|
|
8410
|
-
|
|
8466
|
+
var onclick_1 = config.onclick, onover = config.onover, onout = config.onout;
|
|
8467
|
+
$el.svg
|
|
8468
|
+
.on("click", (onclick_1 === null || onclick_1 === void 0 ? void 0 : onclick_1.bind($$.api)) || null)
|
|
8469
|
+
.on(isTouch ? "touchstart" : "mouseenter", (onover === null || onover === void 0 ? void 0 : onover.bind($$.api)) || null)
|
|
8470
|
+
.on(isTouch ? "touchend" : "mouseleave", (onout === null || onout === void 0 ? void 0 : onout.bind($$.api)) || null);
|
|
8411
8471
|
}
|
|
8412
8472
|
config.svg_classname && $el.svg.attr("class", config.svg_classname);
|
|
8413
8473
|
// Define defs
|
|
8414
8474
|
var hasColorPatterns = (isFunction(config.color_tiles) && $$.patterns);
|
|
8415
|
-
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
|
|
8475
|
+
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
|
|
8416
8476
|
$el.defs = $el.svg.append("defs");
|
|
8417
8477
|
if (hasAxis) {
|
|
8418
8478
|
["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
|
8419
8479
|
$$.appendClip($el.defs, state.clip[v]);
|
|
8420
8480
|
});
|
|
8421
8481
|
}
|
|
8422
|
-
// Append data
|
|
8482
|
+
// Append data background color filter definition
|
|
8423
8483
|
$$.generateDataLabelBackgroundColorFilter();
|
|
8424
8484
|
// set color patterns
|
|
8425
8485
|
if (hasColorPatterns) {
|
|
@@ -8508,6 +8568,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8508
8568
|
});
|
|
8509
8569
|
}
|
|
8510
8570
|
else {
|
|
8571
|
+
var hasPolar = $$.hasType("polar");
|
|
8511
8572
|
if (!hasRadar) {
|
|
8512
8573
|
types.push("Arc", "Pie");
|
|
8513
8574
|
}
|
|
@@ -8517,6 +8578,9 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8517
8578
|
else if (hasRadar) {
|
|
8518
8579
|
types.push("Radar");
|
|
8519
8580
|
}
|
|
8581
|
+
else if (hasPolar) {
|
|
8582
|
+
types.push("Polar");
|
|
8583
|
+
}
|
|
8520
8584
|
}
|
|
8521
8585
|
types.forEach(function (v) {
|
|
8522
8586
|
$$["init".concat(v)]();
|
|
@@ -8580,40 +8644,53 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8580
8644
|
var _a;
|
|
8581
8645
|
var $$ = this;
|
|
8582
8646
|
var _b = $$.state, hasAxis = _b.hasAxis, hasRadar = _b.hasRadar;
|
|
8647
|
+
var helper = function (type) { return $$["updateTargetsFor".concat(type)](targets.filter($$["is".concat(type, "Type")].bind($$))); };
|
|
8583
8648
|
// Text
|
|
8584
8649
|
$$.updateTargetsForText(targets);
|
|
8585
8650
|
if (hasAxis) {
|
|
8586
8651
|
["bar", "candlestick", "line"].forEach(function (v) {
|
|
8587
8652
|
var name = capitalize(v);
|
|
8588
8653
|
if ((v === "line" && $$.hasTypeOf(name)) || $$.hasType(v)) {
|
|
8589
|
-
|
|
8654
|
+
helper(name);
|
|
8590
8655
|
}
|
|
8591
8656
|
});
|
|
8592
8657
|
// Sub Chart
|
|
8593
8658
|
$$.updateTargetsForSubchart &&
|
|
8594
8659
|
$$.updateTargetsForSubchart(targets);
|
|
8660
|
+
// Arc, Polar, Radar
|
|
8595
8661
|
}
|
|
8596
|
-
else {
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8662
|
+
else if ($$.hasArcType(targets)) {
|
|
8663
|
+
var type_1 = "Arc";
|
|
8664
|
+
if (hasRadar) {
|
|
8665
|
+
type_1 = "Radar";
|
|
8666
|
+
}
|
|
8667
|
+
else if ($$.hasType("polar")) {
|
|
8668
|
+
type_1 = "Polar";
|
|
8669
|
+
}
|
|
8670
|
+
helper(type_1);
|
|
8601
8671
|
}
|
|
8602
|
-
//
|
|
8603
|
-
|
|
8672
|
+
// Point types
|
|
8673
|
+
var hasPointType = $$.hasType("bubble") || $$.hasType("scatter");
|
|
8674
|
+
if (hasPointType) {
|
|
8604
8675
|
(_a = $$.updateTargetForCircle) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
8605
8676
|
}
|
|
8606
8677
|
// Fade-in each chart
|
|
8607
|
-
$$.
|
|
8678
|
+
$$.filterTargetsToShowAtInit(hasPointType);
|
|
8608
8679
|
};
|
|
8609
8680
|
/**
|
|
8610
|
-
* Display targeted elements
|
|
8681
|
+
* Display targeted elements at initialization
|
|
8682
|
+
* @param {boolean} hasPointType whether has point type(bubble, scatter) or not
|
|
8611
8683
|
* @private
|
|
8612
8684
|
*/
|
|
8613
|
-
ChartInternal.prototype.
|
|
8685
|
+
ChartInternal.prototype.filterTargetsToShowAtInit = function (hasPointType) {
|
|
8686
|
+
if (hasPointType === void 0) { hasPointType = false; }
|
|
8614
8687
|
var $$ = this;
|
|
8615
8688
|
var svg = $$.$el.svg, $T = $$.$T;
|
|
8616
|
-
|
|
8689
|
+
var selector = ".".concat($COMMON.target);
|
|
8690
|
+
if (hasPointType) {
|
|
8691
|
+
selector += ", .".concat($CIRCLE.chartCircles, " > .").concat($CIRCLE.circles);
|
|
8692
|
+
}
|
|
8693
|
+
$T(svg.selectAll(selector)
|
|
8617
8694
|
.filter(function (d) { return $$.isTargetToShow(d.id); })).style("opacity", null);
|
|
8618
8695
|
};
|
|
8619
8696
|
ChartInternal.prototype.getWithOption = function (options) {
|
|
@@ -8644,8 +8721,9 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8644
8721
|
ChartInternal.prototype.initialOpacity = function (d) {
|
|
8645
8722
|
var $$ = this;
|
|
8646
8723
|
var withoutFadeIn = $$.state.withoutFadeIn;
|
|
8647
|
-
|
|
8724
|
+
var r = $$.getBaseValue(d) !== null &&
|
|
8648
8725
|
withoutFadeIn[d.id] ? null : "0";
|
|
8726
|
+
return r;
|
|
8649
8727
|
};
|
|
8650
8728
|
ChartInternal.prototype.bindResize = function () {
|
|
8651
8729
|
var $$ = this;
|
|
@@ -9276,7 +9354,7 @@ var apiFocus = {
|
|
|
9276
9354
|
var targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
9277
9355
|
var candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
|
9278
9356
|
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, true);
|
|
9279
|
-
if ($$.hasArcType()) {
|
|
9357
|
+
if ($$.hasArcType(null, ["polar"])) {
|
|
9280
9358
|
$$.unexpandArc(targetIds);
|
|
9281
9359
|
$$.hasType("gauge") &&
|
|
9282
9360
|
$$.undoMarkOverlapped($$, ".".concat($GAUGE.gaugeValue));
|
|
@@ -9308,7 +9386,7 @@ var apiFocus = {
|
|
|
9308
9386
|
var targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
9309
9387
|
var candidates = $el.svg.selectAll($$.selectorTargets(targetIds)); // should be for all targets
|
|
9310
9388
|
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, false);
|
|
9311
|
-
$$.hasArcType() && $$.unexpandArc(targetIds);
|
|
9389
|
+
$$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
|
|
9312
9390
|
if (config.legend_show) {
|
|
9313
9391
|
$$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
|
|
9314
9392
|
$el.legend.selectAll($$.selectorLegends(targetIds))
|
|
@@ -9965,18 +10043,23 @@ extend(Chart.prototype, [
|
|
|
9965
10043
|
*/
|
|
9966
10044
|
function setMinMax($$, type, value) {
|
|
9967
10045
|
var config = $$.config;
|
|
9968
|
-
var
|
|
9969
|
-
|
|
9970
|
-
|
|
10046
|
+
var helper = function (key, value) {
|
|
10047
|
+
var v = isNumber(value) ? value : (value === false ? undefined : null);
|
|
10048
|
+
if (v !== null) {
|
|
10049
|
+
config["axis_".concat(key, "_").concat(type)] = v;
|
|
10050
|
+
}
|
|
10051
|
+
};
|
|
9971
10052
|
if (isDefined(value)) {
|
|
9972
10053
|
if (isObjectType(value)) {
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
10054
|
+
Object.keys(value).forEach(function (key) {
|
|
10055
|
+
helper(key, value[key]);
|
|
10056
|
+
});
|
|
9976
10057
|
}
|
|
9977
|
-
else {
|
|
9978
|
-
|
|
9979
|
-
|
|
10058
|
+
else if (isNumber(value) || value === false) {
|
|
10059
|
+
// shorthand values affects only y and y2.
|
|
10060
|
+
["y", "y2"].forEach(function (key) {
|
|
10061
|
+
helper(key, value);
|
|
10062
|
+
});
|
|
9980
10063
|
}
|
|
9981
10064
|
$$.redraw({
|
|
9982
10065
|
withUpdateOrgXDomain: true,
|
|
@@ -10053,8 +10136,9 @@ var axis$1 = {
|
|
|
10053
10136
|
* @instance
|
|
10054
10137
|
* @memberof Chart
|
|
10055
10138
|
* @param {object} min If min is given, specified axis' min value will be updated.<br>
|
|
10056
|
-
*
|
|
10057
|
-
*
|
|
10139
|
+
* If no argument is given, the min values set on generating option for each axis will be returned.
|
|
10140
|
+
* If not set any min values on generation, it will return `undefined`.<br>
|
|
10141
|
+
* To unset specific axis max, set `false` to each of them.
|
|
10058
10142
|
* @returns {object|undefined}
|
|
10059
10143
|
* @example
|
|
10060
10144
|
* // Update axis' min
|
|
@@ -10063,10 +10147,21 @@ var axis$1 = {
|
|
|
10063
10147
|
* y: 1000,
|
|
10064
10148
|
* y2: 100
|
|
10065
10149
|
* });
|
|
10150
|
+
*
|
|
10151
|
+
* // To unset specific axis min, set false to each of them.
|
|
10152
|
+
* chart.axis.min({
|
|
10153
|
+
* x: false,
|
|
10154
|
+
* y: false,
|
|
10155
|
+
* y2: false
|
|
10156
|
+
* });
|
|
10157
|
+
*
|
|
10158
|
+
* // shorthand (only affects y and y2 axis)
|
|
10159
|
+
* chart.axis.min(-50);
|
|
10160
|
+
* chart.axis.min(false);
|
|
10066
10161
|
*/
|
|
10067
10162
|
min: function (min) {
|
|
10068
10163
|
var $$ = this.internal;
|
|
10069
|
-
return isValue(min) ?
|
|
10164
|
+
return isValue(min) || min === false ?
|
|
10070
10165
|
setMinMax($$, "min", min) :
|
|
10071
10166
|
getMinMax($$, "min");
|
|
10072
10167
|
},
|
|
@@ -10076,8 +10171,9 @@ var axis$1 = {
|
|
|
10076
10171
|
* @instance
|
|
10077
10172
|
* @memberof Chart
|
|
10078
10173
|
* @param {object} max If max is given, specified axis' max value will be updated.<br>
|
|
10079
|
-
*
|
|
10080
|
-
*
|
|
10174
|
+
* If no argument is given, the max values set on generating option for each axis will be returned.
|
|
10175
|
+
* If not set any max values on generation, it will return `undefined`.<br>
|
|
10176
|
+
* To unset specific axis max, set `false` to each of them.
|
|
10081
10177
|
* @returns {object|undefined}
|
|
10082
10178
|
* @example
|
|
10083
10179
|
* // Update axis' label
|
|
@@ -10086,10 +10182,21 @@ var axis$1 = {
|
|
|
10086
10182
|
* y: 1000,
|
|
10087
10183
|
* y2: 10000
|
|
10088
10184
|
* });
|
|
10185
|
+
*
|
|
10186
|
+
* // To unset specific axis max, set false to each of them.
|
|
10187
|
+
* chart.axis.max({
|
|
10188
|
+
* x: false,
|
|
10189
|
+
* y: false,
|
|
10190
|
+
* y2: false
|
|
10191
|
+
* });
|
|
10192
|
+
*
|
|
10193
|
+
* // shorthand (only affects y and y2 axis)
|
|
10194
|
+
* chart.axis.max(10);
|
|
10195
|
+
* chart.axis.max(false);
|
|
10089
10196
|
*/
|
|
10090
10197
|
max: function (max) {
|
|
10091
10198
|
var $$ = this.internal;
|
|
10092
|
-
return
|
|
10199
|
+
return isValue(max) || max === false ?
|
|
10093
10200
|
setMinMax($$, "max", max) :
|
|
10094
10201
|
getMinMax($$, "max");
|
|
10095
10202
|
},
|
|
@@ -10098,7 +10205,9 @@ var axis$1 = {
|
|
|
10098
10205
|
* @function axis․range
|
|
10099
10206
|
* @instance
|
|
10100
10207
|
* @memberof Chart
|
|
10101
|
-
* @param {object} range If range is given, specified axis' min and max value will be updated.
|
|
10208
|
+
* @param {object} range If range is given, specified axis' min and max value will be updated.
|
|
10209
|
+
* If no argument is given, the current min and max values for each axis will be returned.<br>
|
|
10210
|
+
* To unset specific axis max, set `false` to each of them.
|
|
10102
10211
|
* @returns {object|undefined}
|
|
10103
10212
|
* @example
|
|
10104
10213
|
* // Update axis' label
|
|
@@ -10114,12 +10223,31 @@ var axis$1 = {
|
|
|
10114
10223
|
* y2: 10000
|
|
10115
10224
|
* },
|
|
10116
10225
|
* });
|
|
10226
|
+
*
|
|
10227
|
+
* // To unset specific axis max, set false to each of them.
|
|
10228
|
+
* chart.axis.range({
|
|
10229
|
+
* min: {
|
|
10230
|
+
* x: false,
|
|
10231
|
+
* y: false,
|
|
10232
|
+
* y2: false
|
|
10233
|
+
* },
|
|
10234
|
+
* max: {
|
|
10235
|
+
* x: false,
|
|
10236
|
+
* y: false,
|
|
10237
|
+
* y2: false
|
|
10238
|
+
* },
|
|
10239
|
+
* });
|
|
10240
|
+
*
|
|
10241
|
+
* // shorthand (only affects y and y2 axis)
|
|
10242
|
+
* chart.axis.range({ min: -50, max: 1000 });
|
|
10243
|
+
* chart.axis.range({ min: false, max: false });
|
|
10117
10244
|
*/
|
|
10118
10245
|
range: function (range) {
|
|
10119
10246
|
var axis = this.axis;
|
|
10120
10247
|
if (arguments.length) {
|
|
10121
|
-
|
|
10122
|
-
isDefined(
|
|
10248
|
+
var min = range.min, max = range.max;
|
|
10249
|
+
isDefined(max) && axis.max(max);
|
|
10250
|
+
isDefined(min) && axis.min(min);
|
|
10123
10251
|
}
|
|
10124
10252
|
else {
|
|
10125
10253
|
return {
|
|
@@ -12002,7 +12130,7 @@ var Axis = /** @class */ (function () {
|
|
|
12002
12130
|
["y", "y2"].forEach(function (key) {
|
|
12003
12131
|
var prefix = "axis_".concat(key, "_");
|
|
12004
12132
|
var axisScale = scale[key];
|
|
12005
|
-
if (
|
|
12133
|
+
if (axisScale) {
|
|
12006
12134
|
var tickValues = config["".concat(prefix, "tick_values")];
|
|
12007
12135
|
var tickCount = config["".concat(prefix, "tick_count")];
|
|
12008
12136
|
axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
|
|
@@ -12054,10 +12182,11 @@ var Axis = /** @class */ (function () {
|
|
|
12054
12182
|
break;
|
|
12055
12183
|
}
|
|
12056
12184
|
}
|
|
12057
|
-
tickNodes
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12185
|
+
tickNodes
|
|
12186
|
+
.each(function (d) {
|
|
12187
|
+
var node = (lines_1 ? this.querySelector("text") : this);
|
|
12188
|
+
if (node) {
|
|
12189
|
+
node.style.display = tickValues_1.indexOf(d) % intervalForCulling_1 ? "none" : null;
|
|
12061
12190
|
}
|
|
12062
12191
|
});
|
|
12063
12192
|
}
|
|
@@ -12730,7 +12859,7 @@ var flow = {
|
|
|
12730
12859
|
else {
|
|
12731
12860
|
translateX = $$.axis.isTimeSeries() ?
|
|
12732
12861
|
x(orgDomain[0]) - x(domain[0]) :
|
|
12733
|
-
x(flowStart.x) - x(flowEnd.x);
|
|
12862
|
+
x((flowStart === null || flowStart === void 0 ? void 0 : flowStart.x) || 0) - x(flowEnd.x);
|
|
12734
12863
|
}
|
|
12735
12864
|
var scaleX = (diffDomain(orgDomain) / diffDomain(domain));
|
|
12736
12865
|
return "translate(".concat(translateX, ",0) scale(").concat(scaleX, ",1)");
|
|
@@ -15367,9 +15496,9 @@ var shapeArc = {
|
|
|
15367
15496
|
var $$ = this;
|
|
15368
15497
|
var config = $$.config;
|
|
15369
15498
|
var dataType = config.data_type;
|
|
15370
|
-
var padding = config.
|
|
15499
|
+
var padding = config["".concat(dataType, "_padding")];
|
|
15371
15500
|
var startingAngle = config["".concat(dataType, "_startingAngle")] || 0;
|
|
15372
|
-
var padAngle = (
|
|
15501
|
+
var padAngle = (padding ? padding * 0.01 :
|
|
15373
15502
|
config["".concat(dataType, "_padAngle")]) || 0;
|
|
15374
15503
|
$$.pie = pie$1()
|
|
15375
15504
|
.startAngle(startingAngle)
|
|
@@ -15381,7 +15510,8 @@ var shapeArc = {
|
|
|
15381
15510
|
updateRadius: function () {
|
|
15382
15511
|
var $$ = this;
|
|
15383
15512
|
var config = $$.config, state = $$.state;
|
|
15384
|
-
var
|
|
15513
|
+
var dataType = config.data_type;
|
|
15514
|
+
var padding = config["".concat(dataType, "_padding")];
|
|
15385
15515
|
var w = config.gauge_width || config.donut_width;
|
|
15386
15516
|
var gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length *
|
|
15387
15517
|
config.gauge_arcs_minWidth;
|
|
@@ -15506,6 +15636,7 @@ var shapeArc = {
|
|
|
15506
15636
|
var state = $$.state;
|
|
15507
15637
|
var singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length;
|
|
15508
15638
|
var hasMultiArcGauge = $$.hasMultiArcGauge();
|
|
15639
|
+
var hasPolar = $$.hasType("polar");
|
|
15509
15640
|
var arc$1 = arc()
|
|
15510
15641
|
.innerRadius(function (d) {
|
|
15511
15642
|
var innerRadius = $$.getRadius(d).innerRadius;
|
|
@@ -15515,7 +15646,14 @@ var shapeArc = {
|
|
|
15515
15646
|
})
|
|
15516
15647
|
.outerRadius(function (d) {
|
|
15517
15648
|
var outerRadius = $$.getRadius(d).outerRadius;
|
|
15518
|
-
|
|
15649
|
+
var radius = outerRadius;
|
|
15650
|
+
if (hasMultiArcGauge) {
|
|
15651
|
+
radius = state.radius - singleArcWidth * d.index;
|
|
15652
|
+
}
|
|
15653
|
+
else if (hasPolar) {
|
|
15654
|
+
radius = $$.getPolarOuterRadius(d, outerRadius);
|
|
15655
|
+
}
|
|
15656
|
+
return radius;
|
|
15519
15657
|
});
|
|
15520
15658
|
var newArc = function (d, withoutUpdate) {
|
|
15521
15659
|
var path = "M 0 0";
|
|
@@ -15567,7 +15705,14 @@ var shapeArc = {
|
|
|
15567
15705
|
getArc: function (d, withoutUpdate, force) {
|
|
15568
15706
|
return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
|
|
15569
15707
|
},
|
|
15708
|
+
/**
|
|
15709
|
+
* Set transform attributes to arc label text
|
|
15710
|
+
* @param {object} d Data object
|
|
15711
|
+
* @returns {string} Translate attribute string
|
|
15712
|
+
* @private
|
|
15713
|
+
*/
|
|
15570
15714
|
transformForArcLabel: function (d) {
|
|
15715
|
+
var _a;
|
|
15571
15716
|
var $$ = this;
|
|
15572
15717
|
var config = $$.config, radiusExpanded = $$.state.radiusExpanded;
|
|
15573
15718
|
var updated = $$.updateAngle(d);
|
|
@@ -15581,11 +15726,15 @@ var shapeArc = {
|
|
|
15581
15726
|
}
|
|
15582
15727
|
else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
15583
15728
|
var outerRadius = $$.getRadius(d).outerRadius;
|
|
15729
|
+
if ($$.hasType("polar")) {
|
|
15730
|
+
outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
15731
|
+
}
|
|
15584
15732
|
var c = this.svgArc.centroid(updated);
|
|
15585
|
-
var
|
|
15733
|
+
var _b = c.map(function (v) { return (isNaN(v) ? 0 : v); }), x = _b[0], y = _b[1];
|
|
15586
15734
|
var h = Math.sqrt(x * x + y * y);
|
|
15587
|
-
var ratio = (
|
|
15588
|
-
($$.hasType(
|
|
15735
|
+
var ratio = (_a = ["donut", "pie", "polar"]
|
|
15736
|
+
.filter($$.hasType.bind($$))
|
|
15737
|
+
.map(function (v) { return config["".concat(v, "_label_ratio")]; })) === null || _a === void 0 ? void 0 : _a[0];
|
|
15589
15738
|
if (ratio) {
|
|
15590
15739
|
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
|
15591
15740
|
}
|
|
@@ -15613,10 +15762,11 @@ var shapeArc = {
|
|
|
15613
15762
|
.style("fill", $$.updateTextColor.bind($$))
|
|
15614
15763
|
.attr("filter", $$.updateTextBacgroundColor.bind($$))
|
|
15615
15764
|
.each(function (d) {
|
|
15765
|
+
var _a;
|
|
15616
15766
|
var node = select(this);
|
|
15617
15767
|
var updated = $$.updateAngle(d);
|
|
15618
15768
|
var ratio = $$.getRatio("arc", updated);
|
|
15619
|
-
var isUnderThreshold = $$.meetsLabelThreshold(ratio, (
|
|
15769
|
+
var isUnderThreshold = $$.meetsLabelThreshold(ratio, (_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) === null || _a === void 0 ? void 0 : _a[0]);
|
|
15620
15770
|
if (isUnderThreshold) {
|
|
15621
15771
|
var value = (updated || d).value;
|
|
15622
15772
|
var text = ($$.getArcLabelFormat() || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString();
|
|
@@ -15710,19 +15860,18 @@ var shapeArc = {
|
|
|
15710
15860
|
shouldShowArcLabel: function () {
|
|
15711
15861
|
var $$ = this;
|
|
15712
15862
|
var config = $$.config;
|
|
15713
|
-
return ["
|
|
15863
|
+
return ["donut", "gauge", "pie", "polar"]
|
|
15714
15864
|
.some(function (v) { return $$.hasType(v) && config["".concat(v, "_label_show")]; });
|
|
15715
15865
|
},
|
|
15716
15866
|
getArcLabelFormat: function () {
|
|
15717
15867
|
var $$ = this;
|
|
15718
15868
|
var config = $$.config;
|
|
15719
|
-
var format =
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
}
|
|
15869
|
+
var format = function (v) { return v; };
|
|
15870
|
+
["donut", "gauge", "pie", "polar"]
|
|
15871
|
+
.filter($$.hasType.bind($$))
|
|
15872
|
+
.forEach(function (v) {
|
|
15873
|
+
format = config["".concat(v, "_label_format")];
|
|
15874
|
+
});
|
|
15726
15875
|
return isFunction(format) ? format.bind($$.api) : format;
|
|
15727
15876
|
},
|
|
15728
15877
|
getArcTitle: function () {
|
|
@@ -15866,6 +16015,7 @@ var shapeArc = {
|
|
|
15866
16015
|
});
|
|
15867
16016
|
// bind arc events
|
|
15868
16017
|
hasInteraction && $$.bindArcEvent(mainArc);
|
|
16018
|
+
$$.hasType("polar") && $$.redrawPolar();
|
|
15869
16019
|
$$.hasType("gauge") && $$.redrawBackgroundArcs();
|
|
15870
16020
|
$$.redrawArcText(duration);
|
|
15871
16021
|
},
|
|
@@ -16359,7 +16509,7 @@ var shapeBar = {
|
|
|
16359
16509
|
},
|
|
16360
16510
|
/**
|
|
16361
16511
|
* Determine if given stacking bar data is radius type
|
|
16362
|
-
* @param {
|
|
16512
|
+
* @param {object} d Data row
|
|
16363
16513
|
* @returns {boolean}
|
|
16364
16514
|
*/
|
|
16365
16515
|
isStackingRadiusData: function (d) {
|
|
@@ -17117,8 +17267,7 @@ var shapePoint = {
|
|
|
17117
17267
|
var mainCircle = $el.main.select(".".concat($CIRCLE.chartCircles))
|
|
17118
17268
|
.style("pointer-events", "none")
|
|
17119
17269
|
.selectAll(".".concat($CIRCLE.circles))
|
|
17120
|
-
.data(targets)
|
|
17121
|
-
.attr("class", classCircles);
|
|
17270
|
+
.data(targets);
|
|
17122
17271
|
mainCircle.exit().remove();
|
|
17123
17272
|
enterNode = mainCircle.enter();
|
|
17124
17273
|
}
|
|
@@ -17127,7 +17276,12 @@ var shapePoint = {
|
|
|
17127
17276
|
.attr("class", function (d) { return $$.generateClass($SELECT.selectedCircles, d.id); });
|
|
17128
17277
|
enterNode.append("g")
|
|
17129
17278
|
.attr("class", classCircles)
|
|
17130
|
-
.style("cursor", function (d) { return (isFunction(isSelectable) && isSelectable(d) ? "pointer" : null); })
|
|
17279
|
+
.style("cursor", function (d) { return (isFunction(isSelectable) && isSelectable(d) ? "pointer" : null); })
|
|
17280
|
+
.style("opacity", function () {
|
|
17281
|
+
var _a;
|
|
17282
|
+
// if the parent node is .bb-chart-circles (bubble, scatter), initialize <g bb-circles> with opacity "0"
|
|
17283
|
+
return ((_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.classList.contains("bb-chart-circles")) ? "0" : null;
|
|
17284
|
+
});
|
|
17131
17285
|
// Update date for selected circles
|
|
17132
17286
|
selectionEnabled && targets.forEach(function (t) {
|
|
17133
17287
|
$el.main.selectAll(".".concat($SELECT.selectedCircles).concat($$.getTargetSelectorSuffix(t.id)))
|
|
@@ -17521,6 +17675,115 @@ var shapePoint = {
|
|
|
17521
17675
|
}
|
|
17522
17676
|
};
|
|
17523
17677
|
|
|
17678
|
+
/**
|
|
17679
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
17680
|
+
* billboard.js project is licensed under the MIT license
|
|
17681
|
+
*/
|
|
17682
|
+
/**
|
|
17683
|
+
* Get data max value
|
|
17684
|
+
* @param {object} $$ ChartInternal instance
|
|
17685
|
+
* @returns {number} max value
|
|
17686
|
+
* @private
|
|
17687
|
+
*/
|
|
17688
|
+
function getDataMax($$) {
|
|
17689
|
+
var levelMax = $$.config.polar_level_max;
|
|
17690
|
+
var dataMax = $$.getMinMaxData().max[0].value;
|
|
17691
|
+
// Apply level max only when is greater than the data max value
|
|
17692
|
+
if (levelMax && levelMax > dataMax) {
|
|
17693
|
+
dataMax = levelMax;
|
|
17694
|
+
}
|
|
17695
|
+
return dataMax;
|
|
17696
|
+
}
|
|
17697
|
+
var shapePolar = {
|
|
17698
|
+
/**
|
|
17699
|
+
* Initialize polar
|
|
17700
|
+
* @private
|
|
17701
|
+
*/
|
|
17702
|
+
initPolar: function () {
|
|
17703
|
+
var $$ = this;
|
|
17704
|
+
var arcs = $$.$el.arcs, config = $$.config;
|
|
17705
|
+
var levelTextShow = config.polar_level_text_show;
|
|
17706
|
+
var levelTextBgColor = config.polar_level_text_backgroundColor;
|
|
17707
|
+
// append <g> for level
|
|
17708
|
+
arcs.levels = arcs.append("g")
|
|
17709
|
+
.attr("class", $LEVEL.levels);
|
|
17710
|
+
// set level text background color
|
|
17711
|
+
if (levelTextShow && levelTextBgColor) {
|
|
17712
|
+
$$.generateDataLabelBackgroundColorFilter(levelTextBgColor);
|
|
17713
|
+
}
|
|
17714
|
+
},
|
|
17715
|
+
/**
|
|
17716
|
+
* Get polar outer radius according to the data value
|
|
17717
|
+
* @param {object} d Data object
|
|
17718
|
+
* @param {numbet} outerRadius Outer radius
|
|
17719
|
+
* @returns {number} outer radius
|
|
17720
|
+
* @private
|
|
17721
|
+
*/
|
|
17722
|
+
getPolarOuterRadius: function (d, outerRadius) {
|
|
17723
|
+
var dataMax = getDataMax(this);
|
|
17724
|
+
return ((d === null || d === void 0 ? void 0 : d.data.values[0].value) / dataMax) * outerRadius;
|
|
17725
|
+
},
|
|
17726
|
+
/**
|
|
17727
|
+
* Update polar based on given data array
|
|
17728
|
+
* @param {object} targets Data object
|
|
17729
|
+
* @private
|
|
17730
|
+
*/
|
|
17731
|
+
updateTargetsForPolar: function (targets) {
|
|
17732
|
+
// borrow from Arc
|
|
17733
|
+
this.updateTargetsForArc(targets);
|
|
17734
|
+
},
|
|
17735
|
+
/**
|
|
17736
|
+
* Called whenever redraw happens
|
|
17737
|
+
* @private
|
|
17738
|
+
*/
|
|
17739
|
+
redrawPolar: function () {
|
|
17740
|
+
var $$ = this;
|
|
17741
|
+
var config = $$.config;
|
|
17742
|
+
config.polar_level_show && $$.updatePolarLevel();
|
|
17743
|
+
},
|
|
17744
|
+
/**
|
|
17745
|
+
* Update polar level circle
|
|
17746
|
+
* @private
|
|
17747
|
+
*/
|
|
17748
|
+
updatePolarLevel: function () {
|
|
17749
|
+
var $$ = this;
|
|
17750
|
+
var config = $$.config, state = $$.state, levels = $$.$el.arcs.levels;
|
|
17751
|
+
var depth = config.polar_level_depth;
|
|
17752
|
+
var dataMax = getDataMax($$);
|
|
17753
|
+
var levelData = getRange(0, depth);
|
|
17754
|
+
var outerRadius = state.radius;
|
|
17755
|
+
var levelRatio = levelData.map(function (l) { return outerRadius * ((l + 1) / depth); });
|
|
17756
|
+
var levelTextFormat = (config.polar_level_text_format || function () { }).bind($$.api);
|
|
17757
|
+
var level = levels
|
|
17758
|
+
.selectAll(".".concat($LEVEL.level))
|
|
17759
|
+
.data(levelData);
|
|
17760
|
+
level.exit().remove();
|
|
17761
|
+
var levelEnter = level.enter().append("g")
|
|
17762
|
+
.attr("class", function (d, i) { return "".concat($LEVEL.level, " ").concat($LEVEL.level, "-").concat(i); });
|
|
17763
|
+
// cx, cy, translate: Set center as origin (0,0) so that it can share same center with arcs
|
|
17764
|
+
levelEnter.append("circle");
|
|
17765
|
+
levelEnter
|
|
17766
|
+
.merge(level)
|
|
17767
|
+
.selectAll("circle")
|
|
17768
|
+
.style("visibility", config.polar_level_show ? null : "hidden")
|
|
17769
|
+
.attr("cx", 0)
|
|
17770
|
+
.attr("cy", 0)
|
|
17771
|
+
.attr("r", function (d) { return levelRatio[d]; });
|
|
17772
|
+
if (config.polar_level_text_show) {
|
|
17773
|
+
var levelTextBackgroundColor = config.polar_level_text_backgroundColor;
|
|
17774
|
+
var defsId = "#".concat(state.datetimeId, "-labels-bg").concat($$.getTargetSelectorSuffix(levelTextBackgroundColor));
|
|
17775
|
+
levelEnter.append("text")
|
|
17776
|
+
.style("text-anchor", "middle");
|
|
17777
|
+
levelEnter
|
|
17778
|
+
.merge(level)
|
|
17779
|
+
.selectAll("text")
|
|
17780
|
+
.attr("dy", function (d) { return -levelRatio[d] + 5; })
|
|
17781
|
+
.attr("filter", levelTextBackgroundColor ? "url(".concat(defsId, ")") : null)
|
|
17782
|
+
.text(function (d) { return levelTextFormat(dataMax / levelData.length * (d + 1)); });
|
|
17783
|
+
}
|
|
17784
|
+
}
|
|
17785
|
+
};
|
|
17786
|
+
|
|
17524
17787
|
/**
|
|
17525
17788
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
17526
17789
|
* billboard.js project is licensed under the MIT license
|
|
@@ -17553,7 +17816,7 @@ var shapeRadar = {
|
|
|
17553
17816
|
.attr("class", $RADAR.chartRadars);
|
|
17554
17817
|
// level
|
|
17555
17818
|
$el.radar.levels = $el.radar.append("g")
|
|
17556
|
-
.attr("class", $
|
|
17819
|
+
.attr("class", $LEVEL.levels);
|
|
17557
17820
|
// axis
|
|
17558
17821
|
$el.radar.axes = $el.radar.append("g")
|
|
17559
17822
|
.attr("class", $AXIS.axis);
|
|
@@ -17651,11 +17914,11 @@ var shapeRadar = {
|
|
|
17651
17914
|
return pos.join(" ");
|
|
17652
17915
|
});
|
|
17653
17916
|
var level = radarLevels
|
|
17654
|
-
.selectAll(".".concat($
|
|
17917
|
+
.selectAll(".".concat($LEVEL.level))
|
|
17655
17918
|
.data(levelData);
|
|
17656
17919
|
level.exit().remove();
|
|
17657
17920
|
var levelEnter = level.enter().append("g")
|
|
17658
|
-
.attr("class", function (d, i) { return "".concat($
|
|
17921
|
+
.attr("class", function (d, i) { return "".concat($LEVEL.level, " ").concat($LEVEL.level, "-").concat(i); });
|
|
17659
17922
|
levelEnter.append("polygon")
|
|
17660
17923
|
.style("visibility", config.radar_level_show ? null : "hidden");
|
|
17661
17924
|
if (showText) {
|
|
@@ -18632,6 +18895,88 @@ var optPie = {
|
|
|
18632
18895
|
pie_startingAngle: 0
|
|
18633
18896
|
};
|
|
18634
18897
|
|
|
18898
|
+
/**
|
|
18899
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
18900
|
+
* billboard.js project is licensed under the MIT license
|
|
18901
|
+
*/
|
|
18902
|
+
/**
|
|
18903
|
+
* x Axis config options
|
|
18904
|
+
*/
|
|
18905
|
+
var optPolar = {
|
|
18906
|
+
/**
|
|
18907
|
+
* Set polar options
|
|
18908
|
+
* @name polar
|
|
18909
|
+
* @memberof Options
|
|
18910
|
+
* @type {object}
|
|
18911
|
+
* @property {object} polar Polar object
|
|
18912
|
+
* @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
|
|
18913
|
+
* @property {Function} [polar.label.format] Set formatter for the label on each polar piece.
|
|
18914
|
+
* @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
18915
|
+
* @property {number|Function} [polar.label.ratio=undefined] Set ratio of labels position.
|
|
18916
|
+
* @property {number} [polar.level.depth=3] Set the level depth.
|
|
18917
|
+
* @property {boolean} [polar.level.show=true] Show or hide level.
|
|
18918
|
+
* @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
|
|
18919
|
+
* @property {Function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
|
|
18920
|
+
* @property {boolean} [polar.level.text.show=true] Show or hide level text.
|
|
18921
|
+
* @property {number} [polar.padAngle=0] Set padding between data.
|
|
18922
|
+
* @property {number} [polar.padding=0] Sets the gap between pie arcs.
|
|
18923
|
+
* @property {number} [polar.startingAngle=0] Set starting angle where data draws.
|
|
18924
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
|
|
18925
|
+
* @example
|
|
18926
|
+
* polar: {
|
|
18927
|
+
* label: {
|
|
18928
|
+
* show: false,
|
|
18929
|
+
* format: function(value, ratio, id) {
|
|
18930
|
+
* return d3.format("$")(value);
|
|
18931
|
+
*
|
|
18932
|
+
* // to multiline, return with '\n' character
|
|
18933
|
+
* // return value +"%\nLine1\n2Line2";
|
|
18934
|
+
* },
|
|
18935
|
+
*
|
|
18936
|
+
* // 0.1(10%) ratio value means, the minimum ratio to show text label relative to the total value.
|
|
18937
|
+
* // if data value is below than 0.1, text label will be hidden.
|
|
18938
|
+
* threshold: 0.1,
|
|
18939
|
+
*
|
|
18940
|
+
* // set ratio callback. Should return ratio value
|
|
18941
|
+
* ratio: function(d, radius, h) {
|
|
18942
|
+
* ...
|
|
18943
|
+
* return ratio;
|
|
18944
|
+
* },
|
|
18945
|
+
* // or set ratio number
|
|
18946
|
+
* ratio: 0.5
|
|
18947
|
+
* },
|
|
18948
|
+
* level: {
|
|
18949
|
+
* depth: 3,
|
|
18950
|
+
* max: 500,
|
|
18951
|
+
* show: true,
|
|
18952
|
+
* text: {
|
|
18953
|
+
* format: function(x) {
|
|
18954
|
+
* return x + "%";
|
|
18955
|
+
* },
|
|
18956
|
+
* show: true,
|
|
18957
|
+
* backgroundColor: "red"
|
|
18958
|
+
* }
|
|
18959
|
+
* },
|
|
18960
|
+
* padAngle: 0.1,
|
|
18961
|
+
* padding: 0,
|
|
18962
|
+
* startingAngle: 1
|
|
18963
|
+
* }
|
|
18964
|
+
*/
|
|
18965
|
+
polar_label_show: true,
|
|
18966
|
+
polar_label_format: undefined,
|
|
18967
|
+
polar_label_threshold: 0.05,
|
|
18968
|
+
polar_label_ratio: undefined,
|
|
18969
|
+
polar_level_depth: 3,
|
|
18970
|
+
polar_level_max: undefined,
|
|
18971
|
+
polar_level_show: true,
|
|
18972
|
+
polar_level_text_backgroundColor: "#fff",
|
|
18973
|
+
polar_level_text_format: function (x) { return (x % 1 === 0 ? x : x.toFixed(2)); },
|
|
18974
|
+
polar_level_text_show: true,
|
|
18975
|
+
polar_padAngle: 0,
|
|
18976
|
+
polar_padding: 0,
|
|
18977
|
+
polar_startingAngle: 0
|
|
18978
|
+
};
|
|
18979
|
+
|
|
18635
18980
|
/**
|
|
18636
18981
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
18637
18982
|
* billboard.js project is licensed under the MIT license
|
|
@@ -18757,6 +19102,7 @@ var step = function () { return (extendLine(), (step = function () { return TYPE
|
|
|
18757
19102
|
var donut = function () { return (extendArc(undefined, [optDonut]), (donut = function () { return TYPE.DONUT; })()); };
|
|
18758
19103
|
var gauge = function () { return (extendArc([shapeGauge], [optGauge]), (gauge = function () { return TYPE.GAUGE; })()); };
|
|
18759
19104
|
var pie = function () { return (extendArc(undefined, [optPie]), (pie = function () { return TYPE.PIE; })()); };
|
|
19105
|
+
var polar = function () { return (extendArc([shapePolar], [optPolar]), (polar = function () { return TYPE.POLAR; })()); };
|
|
18760
19106
|
var radar = function () { return (extendArc([shapePoint, shapeRadar], [optPoint, optRadar]), (radar = function () { return TYPE.RADAR; })()); };
|
|
18761
19107
|
// Axis based types
|
|
18762
19108
|
var bar = function () { return (extendAxis([shapeBar], optBar), (bar = function () { return TYPE.BAR; })()); };
|
|
@@ -20391,7 +20737,7 @@ var zoomModule = function () {
|
|
|
20391
20737
|
var defaults = {};
|
|
20392
20738
|
/**
|
|
20393
20739
|
* @namespace bb
|
|
20394
|
-
* @version 3.
|
|
20740
|
+
* @version 3.4.0
|
|
20395
20741
|
*/
|
|
20396
20742
|
var bb = {
|
|
20397
20743
|
/**
|
|
@@ -20401,7 +20747,7 @@ var bb = {
|
|
|
20401
20747
|
* bb.version; // "1.0.0"
|
|
20402
20748
|
* @memberof bb
|
|
20403
20749
|
*/
|
|
20404
|
-
version: "3.
|
|
20750
|
+
version: "3.4.0",
|
|
20405
20751
|
/**
|
|
20406
20752
|
* Generate chart
|
|
20407
20753
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|
|
@@ -20448,6 +20794,7 @@ var bb = {
|
|
|
20448
20794
|
* gauge,
|
|
20449
20795
|
* line,
|
|
20450
20796
|
* pie,
|
|
20797
|
+
* polar,
|
|
20451
20798
|
* radar,
|
|
20452
20799
|
* scatter,
|
|
20453
20800
|
* spline,
|
|
@@ -20529,4 +20876,4 @@ var bb = {
|
|
|
20529
20876
|
plugin: {}
|
|
20530
20877
|
};
|
|
20531
20878
|
|
|
20532
|
-
export { area, areaLineRange, areaSpline, areaSplineRange, areaStep, bar, bb, bubble, candlestick, bb as default, donut, gauge, line, pie, radar, scatter, selectionModule as selection, spline, step, subchartModule as subchart, zoomModule as zoom };
|
|
20879
|
+
export { area, areaLineRange, areaSpline, areaSplineRange, areaStep, bar, bb, bubble, candlestick, bb as default, donut, gauge, line, pie, polar, radar, scatter, selectionModule as selection, spline, step, subchartModule as subchart, zoomModule as zoom };
|