billboard.js 3.3.2 → 3.4.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 +19 -14
- package/dist/billboard.js +474 -100
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +478 -104
- 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 +39 -17
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +39 -17
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +34 -14
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +34 -14
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +6 -6
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +43 -21
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +43 -21
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +38 -18
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +38 -18
- 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 +419 -88
- 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 +3 -5
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +22 -22
- package/src/Chart/api/axis.ts +90 -25
- package/src/Chart/api/focus.ts +3 -2
- package/src/ChartInternal/Axis/Axis.ts +10 -7
- package/src/ChartInternal/ChartInternal.ts +31 -17
- 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/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 +12 -4
- 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-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';
|
|
@@ -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: [
|
|
@@ -395,12 +398,16 @@ function getBoundingRect(node) {
|
|
|
395
398
|
/**
|
|
396
399
|
* Retrun random number
|
|
397
400
|
* @param {boolean} asStr Convert returned value as string
|
|
401
|
+
* @param {number} min Minimum value
|
|
402
|
+
* @param {number} max Maximum value
|
|
398
403
|
* @returns {number|string}
|
|
399
404
|
* @private
|
|
400
405
|
*/
|
|
401
|
-
function getRandom(asStr) {
|
|
406
|
+
function getRandom(asStr, min, max) {
|
|
402
407
|
if (asStr === void 0) { asStr = true; }
|
|
403
|
-
|
|
408
|
+
if (min === void 0) { min = 0; }
|
|
409
|
+
if (max === void 0) { max = 10000; }
|
|
410
|
+
var rand = Math.floor(Math.random() * (max - min) + min);
|
|
404
411
|
return asStr ? String(rand) : rand;
|
|
405
412
|
}
|
|
406
413
|
/**
|
|
@@ -765,26 +772,36 @@ function isTabVisible() {
|
|
|
765
772
|
* @private
|
|
766
773
|
*/
|
|
767
774
|
function convertInputType(mouse, touch) {
|
|
775
|
+
var DocumentTouch = win.DocumentTouch, matchMedia = win.matchMedia, navigator = win.navigator;
|
|
768
776
|
var hasTouch = false;
|
|
769
777
|
if (touch) {
|
|
770
778
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
771
|
-
if (
|
|
772
|
-
hasTouch =
|
|
779
|
+
if (navigator && "maxTouchPoints" in navigator) {
|
|
780
|
+
hasTouch = navigator.maxTouchPoints > 0;
|
|
773
781
|
// Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
774
782
|
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
775
783
|
}
|
|
776
|
-
else if ("ontouchmove" in win || (
|
|
784
|
+
else if ("ontouchmove" in win || (DocumentTouch && doc instanceof DocumentTouch)) {
|
|
777
785
|
hasTouch = true;
|
|
778
786
|
}
|
|
779
787
|
else {
|
|
780
788
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
789
|
+
if (matchMedia === null || matchMedia === void 0 ? void 0 : matchMedia("(pointer:coarse)").matches) {
|
|
790
|
+
hasTouch = true;
|
|
791
|
+
}
|
|
792
|
+
else {
|
|
793
|
+
// Only as a last resort, fall back to user agent sniffing
|
|
794
|
+
var UA = navigator.userAgent;
|
|
795
|
+
hasTouch = (/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) ||
|
|
796
|
+
/\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA));
|
|
784
797
|
}
|
|
785
798
|
}
|
|
786
799
|
}
|
|
787
|
-
|
|
800
|
+
// 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
|
|
801
|
+
// https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
|
|
802
|
+
// Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
|
|
803
|
+
var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"]
|
|
804
|
+
.some(function (v) { return matchMedia === null || matchMedia === void 0 ? void 0 : matchMedia("(".concat(v, ")")).matches; });
|
|
788
805
|
return (hasMouse && "mouse") || (hasTouch && "touch") || null;
|
|
789
806
|
}
|
|
790
807
|
|
|
@@ -941,12 +958,14 @@ var $GRID = {
|
|
|
941
958
|
ygridLines: "bb-ygrid-lines",
|
|
942
959
|
ygrids: "bb-ygrids"
|
|
943
960
|
};
|
|
944
|
-
var $
|
|
945
|
-
chartRadar: "bb-chart-radar",
|
|
946
|
-
chartRadars: "bb-chart-radars",
|
|
961
|
+
var $LEVEL = {
|
|
947
962
|
level: "bb-level",
|
|
948
963
|
levels: "bb-levels"
|
|
949
964
|
};
|
|
965
|
+
var $RADAR = {
|
|
966
|
+
chartRadar: "bb-chart-radar",
|
|
967
|
+
chartRadars: "bb-chart-radars"
|
|
968
|
+
};
|
|
950
969
|
var $REGION = {
|
|
951
970
|
region: "bb-region",
|
|
952
971
|
regions: "bb-regions"
|
|
@@ -1352,6 +1371,20 @@ var main = {
|
|
|
1352
1371
|
* }
|
|
1353
1372
|
*/
|
|
1354
1373
|
resize_auto: true,
|
|
1374
|
+
/**
|
|
1375
|
+
* Set a callback to execute when the chart is clicked.
|
|
1376
|
+
* @name onclick
|
|
1377
|
+
* @memberof Options
|
|
1378
|
+
* @type {Function}
|
|
1379
|
+
* @default undefined
|
|
1380
|
+
* @example
|
|
1381
|
+
* onclick: function(event) {
|
|
1382
|
+
* this; // chart instance itself
|
|
1383
|
+
* event; // native event object
|
|
1384
|
+
* ...
|
|
1385
|
+
* }
|
|
1386
|
+
*/
|
|
1387
|
+
onclick: undefined,
|
|
1355
1388
|
/**
|
|
1356
1389
|
* Set a callback to execute when mouse/touch enters the chart.
|
|
1357
1390
|
* @name onover
|
|
@@ -1359,8 +1392,9 @@ var main = {
|
|
|
1359
1392
|
* @type {Function}
|
|
1360
1393
|
* @default undefined
|
|
1361
1394
|
* @example
|
|
1362
|
-
* onover: function() {
|
|
1395
|
+
* onover: function(event) {
|
|
1363
1396
|
* this; // chart instance itself
|
|
1397
|
+
* event; // native event object
|
|
1364
1398
|
* ...
|
|
1365
1399
|
* }
|
|
1366
1400
|
*/
|
|
@@ -1372,8 +1406,9 @@ var main = {
|
|
|
1372
1406
|
* @type {Function}
|
|
1373
1407
|
* @default undefined
|
|
1374
1408
|
* @example
|
|
1375
|
-
* onout: function() {
|
|
1409
|
+
* onout: function(event) {
|
|
1376
1410
|
* this; // chart instance itself
|
|
1411
|
+
* event; // native event object
|
|
1377
1412
|
* ...
|
|
1378
1413
|
* }
|
|
1379
1414
|
*/
|
|
@@ -1634,6 +1669,7 @@ var data$2 = {
|
|
|
1634
1669
|
* - gauge
|
|
1635
1670
|
* - line
|
|
1636
1671
|
* - pie
|
|
1672
|
+
* - polar
|
|
1637
1673
|
* - radar
|
|
1638
1674
|
* - scatter
|
|
1639
1675
|
* - spline
|
|
@@ -1662,6 +1698,7 @@ var data$2 = {
|
|
|
1662
1698
|
* gauge,
|
|
1663
1699
|
* line,
|
|
1664
1700
|
* pie,
|
|
1701
|
+
* polar,
|
|
1665
1702
|
* radar,
|
|
1666
1703
|
* scatter,
|
|
1667
1704
|
* spline,
|
|
@@ -1707,6 +1744,7 @@ var data$2 = {
|
|
|
1707
1744
|
* gauge,
|
|
1708
1745
|
* line,
|
|
1709
1746
|
* pie,
|
|
1747
|
+
* polar,
|
|
1710
1748
|
* radar,
|
|
1711
1749
|
* scatter,
|
|
1712
1750
|
* spline,
|
|
@@ -2981,10 +3019,6 @@ var Cache = /** @class */ (function () {
|
|
|
2981
3019
|
return Cache;
|
|
2982
3020
|
}());
|
|
2983
3021
|
|
|
2984
|
-
/**
|
|
2985
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
2986
|
-
* billboard.js project is licensed under the MIT license
|
|
2987
|
-
*/
|
|
2988
3022
|
var setTimeout$1 = win.setTimeout, clearTimeout$1 = win.clearTimeout;
|
|
2989
3023
|
/**
|
|
2990
3024
|
* Generate resize queue function
|
|
@@ -3018,19 +3052,23 @@ function generateResize() {
|
|
|
3018
3052
|
*/
|
|
3019
3053
|
function generateWait() {
|
|
3020
3054
|
var transitionsToWait = [];
|
|
3021
|
-
|
|
3055
|
+
// 'f' is called as selection.call(f, ...);
|
|
3056
|
+
var f = function (selection, callback) {
|
|
3022
3057
|
var timer;
|
|
3023
|
-
|
|
3058
|
+
/**
|
|
3059
|
+
* Check if transition is complete
|
|
3060
|
+
* @private
|
|
3061
|
+
*/
|
|
3024
3062
|
function loop() {
|
|
3025
3063
|
var _a;
|
|
3026
3064
|
var done = 0;
|
|
3027
|
-
for (var i = 0,
|
|
3028
|
-
if (
|
|
3065
|
+
for (var i = 0, t = void 0; (t = transitionsToWait[i]); i++) {
|
|
3066
|
+
if (t === true || ((_a = t.empty) === null || _a === void 0 ? void 0 : _a.call(t))) {
|
|
3029
3067
|
done++;
|
|
3030
3068
|
continue;
|
|
3031
3069
|
}
|
|
3032
3070
|
try {
|
|
3033
|
-
|
|
3071
|
+
t.transition();
|
|
3034
3072
|
}
|
|
3035
3073
|
catch (e) {
|
|
3036
3074
|
done++;
|
|
@@ -4759,12 +4797,13 @@ var color = {
|
|
|
4759
4797
|
},
|
|
4760
4798
|
/**
|
|
4761
4799
|
* Append data backgound color filter definition
|
|
4800
|
+
* @param {string} color Color string
|
|
4762
4801
|
* @private
|
|
4763
4802
|
*/
|
|
4764
|
-
generateDataLabelBackgroundColorFilter: function () {
|
|
4803
|
+
generateDataLabelBackgroundColorFilter: function (color) {
|
|
4765
4804
|
var $$ = this;
|
|
4766
4805
|
var $el = $$.$el, config = $$.config, state = $$.state;
|
|
4767
|
-
var backgroundColors = config.data_labels_backgroundColors;
|
|
4806
|
+
var backgroundColors = color || config.data_labels_backgroundColors;
|
|
4768
4807
|
if (backgroundColors) {
|
|
4769
4808
|
var ids = [];
|
|
4770
4809
|
if (isString(backgroundColors)) {
|
|
@@ -4774,7 +4813,7 @@ var color = {
|
|
|
4774
4813
|
ids = Object.keys(backgroundColors);
|
|
4775
4814
|
}
|
|
4776
4815
|
ids.forEach(function (v) {
|
|
4777
|
-
var id = "".concat(state.datetimeId, "-labels-bg").concat($$.getTargetSelectorSuffix(v));
|
|
4816
|
+
var id = "".concat(state.datetimeId, "-labels-bg").concat($$.getTargetSelectorSuffix(v)).concat(color ? $$.getTargetSelectorSuffix(color) : "");
|
|
4778
4817
|
$el.defs.append("filter")
|
|
4779
4818
|
.attr("x", "0")
|
|
4780
4819
|
.attr("y", "0")
|
|
@@ -5170,7 +5209,7 @@ var format = {
|
|
|
5170
5209
|
getDefaultValueFormat: function () {
|
|
5171
5210
|
var $$ = this;
|
|
5172
5211
|
var defaultArcValueFormat = $$.defaultArcValueFormat, yFormat = $$.yFormat, y2Format = $$.y2Format;
|
|
5173
|
-
var hasArc = $$.hasArcType(null, ["gauge", "radar"]);
|
|
5212
|
+
var hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
|
|
5174
5213
|
return function (v, ratio, id) {
|
|
5175
5214
|
var format = hasArc ? defaultArcValueFormat : ($$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat);
|
|
5176
5215
|
return format.call($$, v, ratio);
|
|
@@ -5182,6 +5221,9 @@ var format = {
|
|
|
5182
5221
|
defaultArcValueFormat: function (v, ratio) {
|
|
5183
5222
|
return "".concat((ratio * 100).toFixed(1), "%");
|
|
5184
5223
|
},
|
|
5224
|
+
defaultPolarValueFormat: function (v) {
|
|
5225
|
+
return "".concat(v);
|
|
5226
|
+
},
|
|
5185
5227
|
dataLabelFormat: function (targetId) {
|
|
5186
5228
|
var $$ = this;
|
|
5187
5229
|
var dataLabels = $$.config.data_labels;
|
|
@@ -5881,6 +5923,8 @@ var redraw = {
|
|
|
5881
5923
|
$el.arcs && $$.redrawArc(duration, durationForExit, wth.Transform);
|
|
5882
5924
|
// radar
|
|
5883
5925
|
$el.radar && $$.redrawRadar();
|
|
5926
|
+
// polar
|
|
5927
|
+
$el.polar && $$.redrawPolar();
|
|
5884
5928
|
}
|
|
5885
5929
|
// @TODO: Axis & Radar type
|
|
5886
5930
|
if (!state.resizing && ($$.hasPointType() || state.hasRadar)) {
|
|
@@ -7884,6 +7928,10 @@ var transform = {
|
|
|
7884
7928
|
x = state.arcWidth / 2;
|
|
7885
7929
|
y = state.arcHeight / 2;
|
|
7886
7930
|
}
|
|
7931
|
+
else if (target === "polar") {
|
|
7932
|
+
x = state.arcWidth / 2;
|
|
7933
|
+
y = state.arcHeight / 2;
|
|
7934
|
+
}
|
|
7887
7935
|
else if (target === "radar") {
|
|
7888
7936
|
var width = $$.getRadarSize()[0];
|
|
7889
7937
|
x = state.width / 2 - width;
|
|
@@ -8083,6 +8131,9 @@ var type = {
|
|
|
8083
8131
|
isDonutType: function (d) {
|
|
8084
8132
|
return this.isTypeOf(d, "donut");
|
|
8085
8133
|
},
|
|
8134
|
+
isPolarType: function (d) {
|
|
8135
|
+
return this.isTypeOf(d, "polar");
|
|
8136
|
+
},
|
|
8086
8137
|
isRadarType: function (d) {
|
|
8087
8138
|
return this.isTypeOf(d, "radar");
|
|
8088
8139
|
},
|
|
@@ -8090,6 +8141,7 @@ var type = {
|
|
|
8090
8141
|
return this.isPieType(d) ||
|
|
8091
8142
|
this.isDonutType(d) ||
|
|
8092
8143
|
this.isGaugeType(d) ||
|
|
8144
|
+
this.isPolarType(d) ||
|
|
8093
8145
|
this.isRadarType(d);
|
|
8094
8146
|
},
|
|
8095
8147
|
// determine if is 'circle' data point
|
|
@@ -8310,10 +8362,10 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8310
8362
|
};
|
|
8311
8363
|
ChartInternal.prototype.initParams = function () {
|
|
8312
8364
|
var $$ = this;
|
|
8313
|
-
var
|
|
8365
|
+
var config = $$.config, format = $$.format, state = $$.state;
|
|
8314
8366
|
var isRotated = config.axis_rotated;
|
|
8315
8367
|
// datetime to be used for uniqueness
|
|
8316
|
-
state.datetimeId = "bb-".concat(+new Date());
|
|
8368
|
+
state.datetimeId = "bb-".concat(+new Date() * getRandom());
|
|
8317
8369
|
$$.color = $$.generateColor();
|
|
8318
8370
|
$$.levelColor = $$.generateLevelColor();
|
|
8319
8371
|
if ($$.hasPointType()) {
|
|
@@ -8355,6 +8407,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8355
8407
|
var config = $$.config, scale = $$.scale, state = $$.state, $el = $$.$el, org = $$.org;
|
|
8356
8408
|
var hasAxis = state.hasAxis;
|
|
8357
8409
|
var hasInteraction = config.interaction_enabled;
|
|
8410
|
+
var hasPolar = $$.hasType("polar");
|
|
8358
8411
|
// for arc type, set axes to not be shown
|
|
8359
8412
|
// $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
|
|
8360
8413
|
if (hasAxis) {
|
|
@@ -8402,20 +8455,23 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8402
8455
|
.style("display", "block");
|
|
8403
8456
|
if (hasInteraction && state.inputType) {
|
|
8404
8457
|
var isTouch = state.inputType === "touch";
|
|
8405
|
-
|
|
8406
|
-
|
|
8458
|
+
var onclick_1 = config.onclick, onover = config.onover, onout = config.onout;
|
|
8459
|
+
$el.svg
|
|
8460
|
+
.on("click", (onclick_1 === null || onclick_1 === void 0 ? void 0 : onclick_1.bind($$.api)) || null)
|
|
8461
|
+
.on(isTouch ? "touchstart" : "mouseenter", (onover === null || onover === void 0 ? void 0 : onover.bind($$.api)) || null)
|
|
8462
|
+
.on(isTouch ? "touchend" : "mouseleave", (onout === null || onout === void 0 ? void 0 : onout.bind($$.api)) || null);
|
|
8407
8463
|
}
|
|
8408
8464
|
config.svg_classname && $el.svg.attr("class", config.svg_classname);
|
|
8409
8465
|
// Define defs
|
|
8410
8466
|
var hasColorPatterns = (isFunction(config.color_tiles) && $$.patterns);
|
|
8411
|
-
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
|
|
8467
|
+
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
|
|
8412
8468
|
$el.defs = $el.svg.append("defs");
|
|
8413
8469
|
if (hasAxis) {
|
|
8414
8470
|
["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
|
8415
8471
|
$$.appendClip($el.defs, state.clip[v]);
|
|
8416
8472
|
});
|
|
8417
8473
|
}
|
|
8418
|
-
// Append data
|
|
8474
|
+
// Append data background color filter definition
|
|
8419
8475
|
$$.generateDataLabelBackgroundColorFilter();
|
|
8420
8476
|
// set color patterns
|
|
8421
8477
|
if (hasColorPatterns) {
|
|
@@ -8504,6 +8560,7 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8504
8560
|
});
|
|
8505
8561
|
}
|
|
8506
8562
|
else {
|
|
8563
|
+
var hasPolar = $$.hasType("polar");
|
|
8507
8564
|
if (!hasRadar) {
|
|
8508
8565
|
types.push("Arc", "Pie");
|
|
8509
8566
|
}
|
|
@@ -8513,6 +8570,9 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8513
8570
|
else if (hasRadar) {
|
|
8514
8571
|
types.push("Radar");
|
|
8515
8572
|
}
|
|
8573
|
+
else if (hasPolar) {
|
|
8574
|
+
types.push("Polar");
|
|
8575
|
+
}
|
|
8516
8576
|
}
|
|
8517
8577
|
types.forEach(function (v) {
|
|
8518
8578
|
$$["init".concat(v)]();
|
|
@@ -8576,24 +8636,30 @@ var ChartInternal = /** @class */ (function () {
|
|
|
8576
8636
|
var _a;
|
|
8577
8637
|
var $$ = this;
|
|
8578
8638
|
var _b = $$.state, hasAxis = _b.hasAxis, hasRadar = _b.hasRadar;
|
|
8639
|
+
var helper = function (type) { return $$["updateTargetsFor".concat(type)](targets.filter($$["is".concat(type, "Type")].bind($$))); };
|
|
8579
8640
|
// Text
|
|
8580
8641
|
$$.updateTargetsForText(targets);
|
|
8581
8642
|
if (hasAxis) {
|
|
8582
8643
|
["bar", "candlestick", "line"].forEach(function (v) {
|
|
8583
8644
|
var name = capitalize(v);
|
|
8584
8645
|
if ((v === "line" && $$.hasTypeOf(name)) || $$.hasType(v)) {
|
|
8585
|
-
|
|
8646
|
+
helper(name);
|
|
8586
8647
|
}
|
|
8587
8648
|
});
|
|
8588
8649
|
// Sub Chart
|
|
8589
8650
|
$$.updateTargetsForSubchart &&
|
|
8590
8651
|
$$.updateTargetsForSubchart(targets);
|
|
8652
|
+
// Arc, Polar, Radar
|
|
8591
8653
|
}
|
|
8592
|
-
else {
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8654
|
+
else if ($$.hasArcType(targets)) {
|
|
8655
|
+
var type_1 = "Arc";
|
|
8656
|
+
if (hasRadar) {
|
|
8657
|
+
type_1 = "Radar";
|
|
8658
|
+
}
|
|
8659
|
+
else if ($$.hasType("polar")) {
|
|
8660
|
+
type_1 = "Polar";
|
|
8661
|
+
}
|
|
8662
|
+
helper(type_1);
|
|
8597
8663
|
}
|
|
8598
8664
|
// circle
|
|
8599
8665
|
if ($$.hasType("bubble") || $$.hasType("scatter")) {
|
|
@@ -9272,7 +9338,7 @@ var apiFocus = {
|
|
|
9272
9338
|
var targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
9273
9339
|
var candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
|
9274
9340
|
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, true);
|
|
9275
|
-
if ($$.hasArcType()) {
|
|
9341
|
+
if ($$.hasArcType(null, ["polar"])) {
|
|
9276
9342
|
$$.unexpandArc(targetIds);
|
|
9277
9343
|
$$.hasType("gauge") &&
|
|
9278
9344
|
$$.undoMarkOverlapped($$, ".".concat($GAUGE.gaugeValue));
|
|
@@ -9304,7 +9370,7 @@ var apiFocus = {
|
|
|
9304
9370
|
var targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
9305
9371
|
var candidates = $el.svg.selectAll($$.selectorTargets(targetIds)); // should be for all targets
|
|
9306
9372
|
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, false);
|
|
9307
|
-
$$.hasArcType() && $$.unexpandArc(targetIds);
|
|
9373
|
+
$$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
|
|
9308
9374
|
if (config.legend_show) {
|
|
9309
9375
|
$$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
|
|
9310
9376
|
$el.legend.selectAll($$.selectorLegends(targetIds))
|
|
@@ -9961,18 +10027,23 @@ extend(Chart.prototype, [
|
|
|
9961
10027
|
*/
|
|
9962
10028
|
function setMinMax($$, type, value) {
|
|
9963
10029
|
var config = $$.config;
|
|
9964
|
-
var
|
|
9965
|
-
|
|
9966
|
-
|
|
10030
|
+
var helper = function (key, value) {
|
|
10031
|
+
var v = isNumber(value) ? value : (value === false ? undefined : null);
|
|
10032
|
+
if (v !== null) {
|
|
10033
|
+
config["axis_".concat(key, "_").concat(type)] = v;
|
|
10034
|
+
}
|
|
10035
|
+
};
|
|
9967
10036
|
if (isDefined(value)) {
|
|
9968
10037
|
if (isObjectType(value)) {
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
10038
|
+
Object.keys(value).forEach(function (key) {
|
|
10039
|
+
helper(key, value[key]);
|
|
10040
|
+
});
|
|
9972
10041
|
}
|
|
9973
|
-
else {
|
|
9974
|
-
|
|
9975
|
-
|
|
10042
|
+
else if (isNumber(value) || value === false) {
|
|
10043
|
+
// shorthand values affects only y and y2.
|
|
10044
|
+
["y", "y2"].forEach(function (key) {
|
|
10045
|
+
helper(key, value);
|
|
10046
|
+
});
|
|
9976
10047
|
}
|
|
9977
10048
|
$$.redraw({
|
|
9978
10049
|
withUpdateOrgXDomain: true,
|
|
@@ -10049,8 +10120,9 @@ var axis$1 = {
|
|
|
10049
10120
|
* @instance
|
|
10050
10121
|
* @memberof Chart
|
|
10051
10122
|
* @param {object} min If min is given, specified axis' min value will be updated.<br>
|
|
10052
|
-
*
|
|
10053
|
-
*
|
|
10123
|
+
* If no argument is given, the min values set on generating option for each axis will be returned.
|
|
10124
|
+
* If not set any min values on generation, it will return `undefined`.<br>
|
|
10125
|
+
* To unset specific axis max, set `false` to each of them.
|
|
10054
10126
|
* @returns {object|undefined}
|
|
10055
10127
|
* @example
|
|
10056
10128
|
* // Update axis' min
|
|
@@ -10059,10 +10131,21 @@ var axis$1 = {
|
|
|
10059
10131
|
* y: 1000,
|
|
10060
10132
|
* y2: 100
|
|
10061
10133
|
* });
|
|
10134
|
+
*
|
|
10135
|
+
* // To unset specific axis min, set false to each of them.
|
|
10136
|
+
* chart.axis.min({
|
|
10137
|
+
* x: false,
|
|
10138
|
+
* y: false,
|
|
10139
|
+
* y2: false
|
|
10140
|
+
* });
|
|
10141
|
+
*
|
|
10142
|
+
* // shorthand (only affects y and y2 axis)
|
|
10143
|
+
* chart.axis.min(-50);
|
|
10144
|
+
* chart.axis.min(false);
|
|
10062
10145
|
*/
|
|
10063
10146
|
min: function (min) {
|
|
10064
10147
|
var $$ = this.internal;
|
|
10065
|
-
return isValue(min) ?
|
|
10148
|
+
return isValue(min) || min === false ?
|
|
10066
10149
|
setMinMax($$, "min", min) :
|
|
10067
10150
|
getMinMax($$, "min");
|
|
10068
10151
|
},
|
|
@@ -10072,8 +10155,9 @@ var axis$1 = {
|
|
|
10072
10155
|
* @instance
|
|
10073
10156
|
* @memberof Chart
|
|
10074
10157
|
* @param {object} max If max is given, specified axis' max value will be updated.<br>
|
|
10075
|
-
*
|
|
10076
|
-
*
|
|
10158
|
+
* If no argument is given, the max values set on generating option for each axis will be returned.
|
|
10159
|
+
* If not set any max values on generation, it will return `undefined`.<br>
|
|
10160
|
+
* To unset specific axis max, set `false` to each of them.
|
|
10077
10161
|
* @returns {object|undefined}
|
|
10078
10162
|
* @example
|
|
10079
10163
|
* // Update axis' label
|
|
@@ -10082,10 +10166,21 @@ var axis$1 = {
|
|
|
10082
10166
|
* y: 1000,
|
|
10083
10167
|
* y2: 10000
|
|
10084
10168
|
* });
|
|
10169
|
+
*
|
|
10170
|
+
* // To unset specific axis max, set false to each of them.
|
|
10171
|
+
* chart.axis.max({
|
|
10172
|
+
* x: false,
|
|
10173
|
+
* y: false,
|
|
10174
|
+
* y2: false
|
|
10175
|
+
* });
|
|
10176
|
+
*
|
|
10177
|
+
* // shorthand (only affects y and y2 axis)
|
|
10178
|
+
* chart.axis.max(10);
|
|
10179
|
+
* chart.axis.max(false);
|
|
10085
10180
|
*/
|
|
10086
10181
|
max: function (max) {
|
|
10087
10182
|
var $$ = this.internal;
|
|
10088
|
-
return
|
|
10183
|
+
return isValue(max) || max === false ?
|
|
10089
10184
|
setMinMax($$, "max", max) :
|
|
10090
10185
|
getMinMax($$, "max");
|
|
10091
10186
|
},
|
|
@@ -10094,7 +10189,9 @@ var axis$1 = {
|
|
|
10094
10189
|
* @function axis․range
|
|
10095
10190
|
* @instance
|
|
10096
10191
|
* @memberof Chart
|
|
10097
|
-
* @param {object} range If range is given, specified axis' min and max value will be updated.
|
|
10192
|
+
* @param {object} range If range is given, specified axis' min and max value will be updated.
|
|
10193
|
+
* If no argument is given, the current min and max values for each axis will be returned.<br>
|
|
10194
|
+
* To unset specific axis max, set `false` to each of them.
|
|
10098
10195
|
* @returns {object|undefined}
|
|
10099
10196
|
* @example
|
|
10100
10197
|
* // Update axis' label
|
|
@@ -10110,12 +10207,31 @@ var axis$1 = {
|
|
|
10110
10207
|
* y2: 10000
|
|
10111
10208
|
* },
|
|
10112
10209
|
* });
|
|
10210
|
+
*
|
|
10211
|
+
* // To unset specific axis max, set false to each of them.
|
|
10212
|
+
* chart.axis.range({
|
|
10213
|
+
* min: {
|
|
10214
|
+
* x: false,
|
|
10215
|
+
* y: false,
|
|
10216
|
+
* y2: false
|
|
10217
|
+
* },
|
|
10218
|
+
* max: {
|
|
10219
|
+
* x: false,
|
|
10220
|
+
* y: false,
|
|
10221
|
+
* y2: false
|
|
10222
|
+
* },
|
|
10223
|
+
* });
|
|
10224
|
+
*
|
|
10225
|
+
* // shorthand (only affects y and y2 axis)
|
|
10226
|
+
* chart.axis.range({ min: -50, max: 1000 });
|
|
10227
|
+
* chart.axis.range({ min: false, max: false });
|
|
10113
10228
|
*/
|
|
10114
10229
|
range: function (range) {
|
|
10115
10230
|
var axis = this.axis;
|
|
10116
10231
|
if (arguments.length) {
|
|
10117
|
-
|
|
10118
|
-
isDefined(
|
|
10232
|
+
var min = range.min, max = range.max;
|
|
10233
|
+
isDefined(max) && axis.max(max);
|
|
10234
|
+
isDefined(min) && axis.min(min);
|
|
10119
10235
|
}
|
|
10120
10236
|
else {
|
|
10121
10237
|
return {
|
|
@@ -11998,7 +12114,7 @@ var Axis = /** @class */ (function () {
|
|
|
11998
12114
|
["y", "y2"].forEach(function (key) {
|
|
11999
12115
|
var prefix = "axis_".concat(key, "_");
|
|
12000
12116
|
var axisScale = scale[key];
|
|
12001
|
-
if (
|
|
12117
|
+
if (axisScale) {
|
|
12002
12118
|
var tickValues = config["".concat(prefix, "tick_values")];
|
|
12003
12119
|
var tickCount = config["".concat(prefix, "tick_count")];
|
|
12004
12120
|
axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
|
|
@@ -12050,10 +12166,11 @@ var Axis = /** @class */ (function () {
|
|
|
12050
12166
|
break;
|
|
12051
12167
|
}
|
|
12052
12168
|
}
|
|
12053
|
-
tickNodes
|
|
12054
|
-
|
|
12055
|
-
|
|
12056
|
-
|
|
12169
|
+
tickNodes
|
|
12170
|
+
.each(function (d) {
|
|
12171
|
+
var node = (lines_1 ? this.querySelector("text") : this);
|
|
12172
|
+
if (node) {
|
|
12173
|
+
node.style.display = tickValues_1.indexOf(d) % intervalForCulling_1 ? "none" : null;
|
|
12057
12174
|
}
|
|
12058
12175
|
});
|
|
12059
12176
|
}
|
|
@@ -12726,7 +12843,7 @@ var flow = {
|
|
|
12726
12843
|
else {
|
|
12727
12844
|
translateX = $$.axis.isTimeSeries() ?
|
|
12728
12845
|
x(orgDomain[0]) - x(domain[0]) :
|
|
12729
|
-
x(flowStart.x) - x(flowEnd.x);
|
|
12846
|
+
x((flowStart === null || flowStart === void 0 ? void 0 : flowStart.x) || 0) - x(flowEnd.x);
|
|
12730
12847
|
}
|
|
12731
12848
|
var scaleX = (diffDomain(orgDomain) / diffDomain(domain));
|
|
12732
12849
|
return "translate(".concat(translateX, ",0) scale(").concat(scaleX, ",1)");
|
|
@@ -15363,9 +15480,9 @@ var shapeArc = {
|
|
|
15363
15480
|
var $$ = this;
|
|
15364
15481
|
var config = $$.config;
|
|
15365
15482
|
var dataType = config.data_type;
|
|
15366
|
-
var padding = config.
|
|
15483
|
+
var padding = config["".concat(dataType, "_padding")];
|
|
15367
15484
|
var startingAngle = config["".concat(dataType, "_startingAngle")] || 0;
|
|
15368
|
-
var padAngle = (
|
|
15485
|
+
var padAngle = (padding ? padding * 0.01 :
|
|
15369
15486
|
config["".concat(dataType, "_padAngle")]) || 0;
|
|
15370
15487
|
$$.pie = pie$1()
|
|
15371
15488
|
.startAngle(startingAngle)
|
|
@@ -15377,7 +15494,8 @@ var shapeArc = {
|
|
|
15377
15494
|
updateRadius: function () {
|
|
15378
15495
|
var $$ = this;
|
|
15379
15496
|
var config = $$.config, state = $$.state;
|
|
15380
|
-
var
|
|
15497
|
+
var dataType = config.data_type;
|
|
15498
|
+
var padding = config["".concat(dataType, "_padding")];
|
|
15381
15499
|
var w = config.gauge_width || config.donut_width;
|
|
15382
15500
|
var gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length *
|
|
15383
15501
|
config.gauge_arcs_minWidth;
|
|
@@ -15502,6 +15620,7 @@ var shapeArc = {
|
|
|
15502
15620
|
var state = $$.state;
|
|
15503
15621
|
var singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length;
|
|
15504
15622
|
var hasMultiArcGauge = $$.hasMultiArcGauge();
|
|
15623
|
+
var hasPolar = $$.hasType("polar");
|
|
15505
15624
|
var arc$1 = arc()
|
|
15506
15625
|
.innerRadius(function (d) {
|
|
15507
15626
|
var innerRadius = $$.getRadius(d).innerRadius;
|
|
@@ -15511,7 +15630,14 @@ var shapeArc = {
|
|
|
15511
15630
|
})
|
|
15512
15631
|
.outerRadius(function (d) {
|
|
15513
15632
|
var outerRadius = $$.getRadius(d).outerRadius;
|
|
15514
|
-
|
|
15633
|
+
var radius = outerRadius;
|
|
15634
|
+
if (hasMultiArcGauge) {
|
|
15635
|
+
radius = state.radius - singleArcWidth * d.index;
|
|
15636
|
+
}
|
|
15637
|
+
else if (hasPolar) {
|
|
15638
|
+
radius = $$.getPolarOuterRadius(d, outerRadius);
|
|
15639
|
+
}
|
|
15640
|
+
return radius;
|
|
15515
15641
|
});
|
|
15516
15642
|
var newArc = function (d, withoutUpdate) {
|
|
15517
15643
|
var path = "M 0 0";
|
|
@@ -15563,7 +15689,14 @@ var shapeArc = {
|
|
|
15563
15689
|
getArc: function (d, withoutUpdate, force) {
|
|
15564
15690
|
return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
|
|
15565
15691
|
},
|
|
15692
|
+
/**
|
|
15693
|
+
* Set transform attributes to arc label text
|
|
15694
|
+
* @param {Object} d Data object
|
|
15695
|
+
* @returns {string} Translate attribute string
|
|
15696
|
+
* @private
|
|
15697
|
+
*/
|
|
15566
15698
|
transformForArcLabel: function (d) {
|
|
15699
|
+
var _a;
|
|
15567
15700
|
var $$ = this;
|
|
15568
15701
|
var config = $$.config, radiusExpanded = $$.state.radiusExpanded;
|
|
15569
15702
|
var updated = $$.updateAngle(d);
|
|
@@ -15577,11 +15710,15 @@ var shapeArc = {
|
|
|
15577
15710
|
}
|
|
15578
15711
|
else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
15579
15712
|
var outerRadius = $$.getRadius(d).outerRadius;
|
|
15713
|
+
if ($$.hasType("polar")) {
|
|
15714
|
+
outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
15715
|
+
}
|
|
15580
15716
|
var c = this.svgArc.centroid(updated);
|
|
15581
|
-
var
|
|
15717
|
+
var _b = c.map(function (v) { return (isNaN(v) ? 0 : v); }), x = _b[0], y = _b[1];
|
|
15582
15718
|
var h = Math.sqrt(x * x + y * y);
|
|
15583
|
-
var ratio = (
|
|
15584
|
-
($$.hasType(
|
|
15719
|
+
var ratio = (_a = ["donut", "pie", "polar"]
|
|
15720
|
+
.filter($$.hasType.bind($$))
|
|
15721
|
+
.map(function (v) { return config["".concat(v, "_label_ratio")]; })) === null || _a === void 0 ? void 0 : _a[0];
|
|
15585
15722
|
if (ratio) {
|
|
15586
15723
|
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
|
15587
15724
|
}
|
|
@@ -15609,10 +15746,11 @@ var shapeArc = {
|
|
|
15609
15746
|
.style("fill", $$.updateTextColor.bind($$))
|
|
15610
15747
|
.attr("filter", $$.updateTextBacgroundColor.bind($$))
|
|
15611
15748
|
.each(function (d) {
|
|
15749
|
+
var _a;
|
|
15612
15750
|
var node = select(this);
|
|
15613
15751
|
var updated = $$.updateAngle(d);
|
|
15614
15752
|
var ratio = $$.getRatio("arc", updated);
|
|
15615
|
-
var isUnderThreshold = $$.meetsLabelThreshold(ratio, (
|
|
15753
|
+
var isUnderThreshold = $$.meetsLabelThreshold(ratio, (_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) === null || _a === void 0 ? void 0 : _a[0]);
|
|
15616
15754
|
if (isUnderThreshold) {
|
|
15617
15755
|
var value = (updated || d).value;
|
|
15618
15756
|
var text = ($$.getArcLabelFormat() || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString();
|
|
@@ -15706,19 +15844,18 @@ var shapeArc = {
|
|
|
15706
15844
|
shouldShowArcLabel: function () {
|
|
15707
15845
|
var $$ = this;
|
|
15708
15846
|
var config = $$.config;
|
|
15709
|
-
return ["
|
|
15847
|
+
return ["donut", "gauge", "pie", "polar"]
|
|
15710
15848
|
.some(function (v) { return $$.hasType(v) && config["".concat(v, "_label_show")]; });
|
|
15711
15849
|
},
|
|
15712
15850
|
getArcLabelFormat: function () {
|
|
15713
15851
|
var $$ = this;
|
|
15714
15852
|
var config = $$.config;
|
|
15715
|
-
var format =
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
}
|
|
15853
|
+
var format = function (v) { return v; };
|
|
15854
|
+
["donut", "gauge", "pie", "polar"]
|
|
15855
|
+
.filter($$.hasType.bind($$))
|
|
15856
|
+
.forEach(function (v) {
|
|
15857
|
+
format = config["".concat(v, "_label_format")];
|
|
15858
|
+
});
|
|
15722
15859
|
return isFunction(format) ? format.bind($$.api) : format;
|
|
15723
15860
|
},
|
|
15724
15861
|
getArcTitle: function () {
|
|
@@ -15862,6 +15999,7 @@ var shapeArc = {
|
|
|
15862
15999
|
});
|
|
15863
16000
|
// bind arc events
|
|
15864
16001
|
hasInteraction && $$.bindArcEvent(mainArc);
|
|
16002
|
+
$$.hasType("polar") && $$.redrawPolar();
|
|
15865
16003
|
$$.hasType("gauge") && $$.redrawBackgroundArcs();
|
|
15866
16004
|
$$.redrawArcText(duration);
|
|
15867
16005
|
},
|
|
@@ -17517,6 +17655,115 @@ var shapePoint = {
|
|
|
17517
17655
|
}
|
|
17518
17656
|
};
|
|
17519
17657
|
|
|
17658
|
+
/**
|
|
17659
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
17660
|
+
* billboard.js project is licensed under the MIT license
|
|
17661
|
+
*/
|
|
17662
|
+
/**
|
|
17663
|
+
* Get data max value
|
|
17664
|
+
* @param {object} $$ ChartInternal instance
|
|
17665
|
+
* @returns {number} max value
|
|
17666
|
+
* @private
|
|
17667
|
+
*/
|
|
17668
|
+
function getDataMax($$) {
|
|
17669
|
+
var levelMax = $$.config.polar_level_max;
|
|
17670
|
+
var dataMax = $$.getMinMaxData().max[0].value;
|
|
17671
|
+
// Apply level max only when is greater than the data max value
|
|
17672
|
+
if (levelMax && levelMax > dataMax) {
|
|
17673
|
+
dataMax = levelMax;
|
|
17674
|
+
}
|
|
17675
|
+
return dataMax;
|
|
17676
|
+
}
|
|
17677
|
+
var shapePolar = {
|
|
17678
|
+
/**
|
|
17679
|
+
* Initialize polar
|
|
17680
|
+
* @private
|
|
17681
|
+
*/
|
|
17682
|
+
initPolar: function () {
|
|
17683
|
+
var $$ = this;
|
|
17684
|
+
var arcs = $$.$el.arcs, config = $$.config;
|
|
17685
|
+
var levelTextShow = config.polar_level_text_show;
|
|
17686
|
+
var levelTextBgColor = config.polar_level_text_backgroundColor;
|
|
17687
|
+
// append <g> for level
|
|
17688
|
+
arcs.levels = arcs.append("g")
|
|
17689
|
+
.attr("class", $LEVEL.levels);
|
|
17690
|
+
// set level text background color
|
|
17691
|
+
if (levelTextShow && levelTextBgColor) {
|
|
17692
|
+
$$.generateDataLabelBackgroundColorFilter(levelTextBgColor);
|
|
17693
|
+
}
|
|
17694
|
+
},
|
|
17695
|
+
/**
|
|
17696
|
+
* Get polar outer radius according to the data value
|
|
17697
|
+
* @param {object} d Data object
|
|
17698
|
+
* @param {numbet} outerRadius Outer radius
|
|
17699
|
+
* @returns {number} outer radius
|
|
17700
|
+
* @private
|
|
17701
|
+
*/
|
|
17702
|
+
getPolarOuterRadius: function (d, outerRadius) {
|
|
17703
|
+
var dataMax = getDataMax(this);
|
|
17704
|
+
return ((d === null || d === void 0 ? void 0 : d.data.values[0].value) / dataMax) * outerRadius;
|
|
17705
|
+
},
|
|
17706
|
+
/**
|
|
17707
|
+
* Update polar based on given data array
|
|
17708
|
+
* @param {object} targets Data object
|
|
17709
|
+
* @private
|
|
17710
|
+
*/
|
|
17711
|
+
updateTargetsForPolar: function (targets) {
|
|
17712
|
+
// borrow from Arc
|
|
17713
|
+
this.updateTargetsForArc(targets);
|
|
17714
|
+
},
|
|
17715
|
+
/**
|
|
17716
|
+
* Called whenever redraw happens
|
|
17717
|
+
* @private
|
|
17718
|
+
*/
|
|
17719
|
+
redrawPolar: function () {
|
|
17720
|
+
var $$ = this;
|
|
17721
|
+
var config = $$.config;
|
|
17722
|
+
config.polar_level_show && $$.updatePolarLevel();
|
|
17723
|
+
},
|
|
17724
|
+
/**
|
|
17725
|
+
* Update polar level circle
|
|
17726
|
+
* @private
|
|
17727
|
+
*/
|
|
17728
|
+
updatePolarLevel: function () {
|
|
17729
|
+
var $$ = this;
|
|
17730
|
+
var config = $$.config, state = $$.state, levels = $$.$el.arcs.levels;
|
|
17731
|
+
var depth = config.polar_level_depth;
|
|
17732
|
+
var dataMax = getDataMax($$);
|
|
17733
|
+
var levelData = getRange(0, depth);
|
|
17734
|
+
var outerRadius = state.radius;
|
|
17735
|
+
var levelRatio = levelData.map(function (l) { return outerRadius * ((l + 1) / depth); });
|
|
17736
|
+
var levelTextFormat = (config.polar_level_text_format || function () { }).bind($$.api);
|
|
17737
|
+
var level = levels
|
|
17738
|
+
.selectAll(".".concat($LEVEL.level))
|
|
17739
|
+
.data(levelData);
|
|
17740
|
+
level.exit().remove();
|
|
17741
|
+
var levelEnter = level.enter().append("g")
|
|
17742
|
+
.attr("class", function (d, i) { return "".concat($LEVEL.level, " ").concat($LEVEL.level, "-").concat(i); });
|
|
17743
|
+
// cx, cy, translate: Set center as origin (0,0) so that it can share same center with arcs
|
|
17744
|
+
levelEnter.append("circle");
|
|
17745
|
+
levelEnter
|
|
17746
|
+
.merge(level)
|
|
17747
|
+
.selectAll("circle")
|
|
17748
|
+
.style("visibility", config.polar_level_show ? null : "hidden")
|
|
17749
|
+
.attr("cx", 0)
|
|
17750
|
+
.attr("cy", 0)
|
|
17751
|
+
.attr("r", function (d) { return levelRatio[d]; });
|
|
17752
|
+
if (config.polar_level_text_show) {
|
|
17753
|
+
var levelTextBackgroundColor = config.polar_level_text_backgroundColor;
|
|
17754
|
+
var defsId = "#".concat(state.datetimeId, "-labels-bg").concat($$.getTargetSelectorSuffix(levelTextBackgroundColor));
|
|
17755
|
+
levelEnter.append("text")
|
|
17756
|
+
.style("text-anchor", "middle");
|
|
17757
|
+
levelEnter
|
|
17758
|
+
.merge(level)
|
|
17759
|
+
.selectAll("text")
|
|
17760
|
+
.attr("dy", function (d) { return -levelRatio[d] + 5; })
|
|
17761
|
+
.attr("filter", levelTextBackgroundColor ? "url(".concat(defsId, ")") : null)
|
|
17762
|
+
.text(function (d) { return levelTextFormat(dataMax / levelData.length * (d + 1)); });
|
|
17763
|
+
}
|
|
17764
|
+
}
|
|
17765
|
+
};
|
|
17766
|
+
|
|
17520
17767
|
/**
|
|
17521
17768
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
17522
17769
|
* billboard.js project is licensed under the MIT license
|
|
@@ -17549,7 +17796,7 @@ var shapeRadar = {
|
|
|
17549
17796
|
.attr("class", $RADAR.chartRadars);
|
|
17550
17797
|
// level
|
|
17551
17798
|
$el.radar.levels = $el.radar.append("g")
|
|
17552
|
-
.attr("class", $
|
|
17799
|
+
.attr("class", $LEVEL.levels);
|
|
17553
17800
|
// axis
|
|
17554
17801
|
$el.radar.axes = $el.radar.append("g")
|
|
17555
17802
|
.attr("class", $AXIS.axis);
|
|
@@ -17647,11 +17894,11 @@ var shapeRadar = {
|
|
|
17647
17894
|
return pos.join(" ");
|
|
17648
17895
|
});
|
|
17649
17896
|
var level = radarLevels
|
|
17650
|
-
.selectAll(".".concat($
|
|
17897
|
+
.selectAll(".".concat($LEVEL.level))
|
|
17651
17898
|
.data(levelData);
|
|
17652
17899
|
level.exit().remove();
|
|
17653
17900
|
var levelEnter = level.enter().append("g")
|
|
17654
|
-
.attr("class", function (d, i) { return "".concat($
|
|
17901
|
+
.attr("class", function (d, i) { return "".concat($LEVEL.level, " ").concat($LEVEL.level, "-").concat(i); });
|
|
17655
17902
|
levelEnter.append("polygon")
|
|
17656
17903
|
.style("visibility", config.radar_level_show ? null : "hidden");
|
|
17657
17904
|
if (showText) {
|
|
@@ -18628,6 +18875,88 @@ var optPie = {
|
|
|
18628
18875
|
pie_startingAngle: 0
|
|
18629
18876
|
};
|
|
18630
18877
|
|
|
18878
|
+
/**
|
|
18879
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
18880
|
+
* billboard.js project is licensed under the MIT license
|
|
18881
|
+
*/
|
|
18882
|
+
/**
|
|
18883
|
+
* x Axis config options
|
|
18884
|
+
*/
|
|
18885
|
+
var optPolar = {
|
|
18886
|
+
/**
|
|
18887
|
+
* Set polar options
|
|
18888
|
+
* @name polar
|
|
18889
|
+
* @memberof Options
|
|
18890
|
+
* @type {object}
|
|
18891
|
+
* @property {object} polar Polar object
|
|
18892
|
+
* @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
|
|
18893
|
+
* @property {Function} [polar.label.format] Set formatter for the label on each polar piece.
|
|
18894
|
+
* @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
18895
|
+
* @property {number|Function} [polar.label.ratio=undefined] Set ratio of labels position.
|
|
18896
|
+
* @property {number} [polar.level.depth=3] Set the level depth.
|
|
18897
|
+
* @property {boolean} [polar.level.show=true] Show or hide level.
|
|
18898
|
+
* @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
|
|
18899
|
+
* @property {Function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
|
|
18900
|
+
* @property {boolean} [polar.level.text.show=true] Show or hide level text.
|
|
18901
|
+
* @property {number} [polar.padAngle=0] Set padding between data.
|
|
18902
|
+
* @property {number} [polar.padding=0] Sets the gap between pie arcs.
|
|
18903
|
+
* @property {number} [polar.startingAngle=0] Set starting angle where data draws.
|
|
18904
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
|
|
18905
|
+
* @example
|
|
18906
|
+
* polar: {
|
|
18907
|
+
* label: {
|
|
18908
|
+
* show: false,
|
|
18909
|
+
* format: function(value, ratio, id) {
|
|
18910
|
+
* return d3.format("$")(value);
|
|
18911
|
+
*
|
|
18912
|
+
* // to multiline, return with '\n' character
|
|
18913
|
+
* // return value +"%\nLine1\n2Line2";
|
|
18914
|
+
* },
|
|
18915
|
+
*
|
|
18916
|
+
* // 0.1(10%) ratio value means, the minimum ratio to show text label relative to the total value.
|
|
18917
|
+
* // if data value is below than 0.1, text label will be hidden.
|
|
18918
|
+
* threshold: 0.1,
|
|
18919
|
+
*
|
|
18920
|
+
* // set ratio callback. Should return ratio value
|
|
18921
|
+
* ratio: function(d, radius, h) {
|
|
18922
|
+
* ...
|
|
18923
|
+
* return ratio;
|
|
18924
|
+
* },
|
|
18925
|
+
* // or set ratio number
|
|
18926
|
+
* ratio: 0.5
|
|
18927
|
+
* },
|
|
18928
|
+
* level: {
|
|
18929
|
+
* depth: 3,
|
|
18930
|
+
* max: 500,
|
|
18931
|
+
* show: true,
|
|
18932
|
+
* text: {
|
|
18933
|
+
* format: function(x) {
|
|
18934
|
+
* return x + "%";
|
|
18935
|
+
* },
|
|
18936
|
+
* show: true,
|
|
18937
|
+
* backgroundColor: "red"
|
|
18938
|
+
* }
|
|
18939
|
+
* },
|
|
18940
|
+
* padAngle: 0.1,
|
|
18941
|
+
* padding: 0,
|
|
18942
|
+
* startingAngle: 1
|
|
18943
|
+
* }
|
|
18944
|
+
*/
|
|
18945
|
+
polar_label_show: true,
|
|
18946
|
+
polar_label_format: undefined,
|
|
18947
|
+
polar_label_threshold: 0.05,
|
|
18948
|
+
polar_label_ratio: undefined,
|
|
18949
|
+
polar_level_depth: 3,
|
|
18950
|
+
polar_level_max: undefined,
|
|
18951
|
+
polar_level_show: true,
|
|
18952
|
+
polar_level_text_backgroundColor: "#fff",
|
|
18953
|
+
polar_level_text_format: function (x) { return (x % 1 === 0 ? x : x.toFixed(2)); },
|
|
18954
|
+
polar_level_text_show: true,
|
|
18955
|
+
polar_padAngle: 0,
|
|
18956
|
+
polar_padding: 0,
|
|
18957
|
+
polar_startingAngle: 0
|
|
18958
|
+
};
|
|
18959
|
+
|
|
18631
18960
|
/**
|
|
18632
18961
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
18633
18962
|
* billboard.js project is licensed under the MIT license
|
|
@@ -18753,6 +19082,7 @@ var step = function () { return (extendLine(), (step = function () { return TYPE
|
|
|
18753
19082
|
var donut = function () { return (extendArc(undefined, [optDonut]), (donut = function () { return TYPE.DONUT; })()); };
|
|
18754
19083
|
var gauge = function () { return (extendArc([shapeGauge], [optGauge]), (gauge = function () { return TYPE.GAUGE; })()); };
|
|
18755
19084
|
var pie = function () { return (extendArc(undefined, [optPie]), (pie = function () { return TYPE.PIE; })()); };
|
|
19085
|
+
var polar = function () { return (extendArc([shapePolar], [optPolar]), (polar = function () { return TYPE.POLAR; })()); };
|
|
18756
19086
|
var radar = function () { return (extendArc([shapePoint, shapeRadar], [optPoint, optRadar]), (radar = function () { return TYPE.RADAR; })()); };
|
|
18757
19087
|
// Axis based types
|
|
18758
19088
|
var bar = function () { return (extendAxis([shapeBar], optBar), (bar = function () { return TYPE.BAR; })()); };
|
|
@@ -20387,7 +20717,7 @@ var zoomModule = function () {
|
|
|
20387
20717
|
var defaults = {};
|
|
20388
20718
|
/**
|
|
20389
20719
|
* @namespace bb
|
|
20390
|
-
* @version 3.
|
|
20720
|
+
* @version 3.4.0-next.2
|
|
20391
20721
|
*/
|
|
20392
20722
|
var bb = {
|
|
20393
20723
|
/**
|
|
@@ -20397,7 +20727,7 @@ var bb = {
|
|
|
20397
20727
|
* bb.version; // "1.0.0"
|
|
20398
20728
|
* @memberof bb
|
|
20399
20729
|
*/
|
|
20400
|
-
version: "3.
|
|
20730
|
+
version: "3.4.0-next.2",
|
|
20401
20731
|
/**
|
|
20402
20732
|
* Generate chart
|
|
20403
20733
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|
|
@@ -20444,6 +20774,7 @@ var bb = {
|
|
|
20444
20774
|
* gauge,
|
|
20445
20775
|
* line,
|
|
20446
20776
|
* pie,
|
|
20777
|
+
* polar,
|
|
20447
20778
|
* radar,
|
|
20448
20779
|
* scatter,
|
|
20449
20780
|
* spline,
|
|
@@ -20525,4 +20856,4 @@ var bb = {
|
|
|
20525
20856
|
plugin: {}
|
|
20526
20857
|
};
|
|
20527
20858
|
|
|
20528
|
-
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 };
|
|
20859
|
+
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 };
|