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/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
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -183,6 +183,7 @@ __webpack_require__.d(resolver_shape_namespaceObject, {
|
|
|
183
183
|
"gauge": function() { return resolver_shape_gauge; },
|
|
184
184
|
"line": function() { return resolver_shape_line; },
|
|
185
185
|
"pie": function() { return shape_pie; },
|
|
186
|
+
"polar": function() { return resolver_shape_polar; },
|
|
186
187
|
"radar": function() { return resolver_shape_radar; },
|
|
187
188
|
"scatter": function() { return shape_scatter; },
|
|
188
189
|
"spline": function() { return shape_spline; },
|
|
@@ -256,6 +257,7 @@ var TYPE = {
|
|
|
256
257
|
GAUGE: "gauge",
|
|
257
258
|
LINE: "line",
|
|
258
259
|
PIE: "pie",
|
|
260
|
+
POLAR: "polar",
|
|
259
261
|
RADAR: "radar",
|
|
260
262
|
SCATTER: "scatter",
|
|
261
263
|
SPLINE: "spline",
|
|
@@ -279,6 +281,7 @@ var TYPE_METHOD_NEEDED = {
|
|
|
279
281
|
GAUGE: "initArc",
|
|
280
282
|
LINE: "initLine",
|
|
281
283
|
PIE: "initArc",
|
|
284
|
+
POLAR: "initPolar",
|
|
282
285
|
RADAR: "initCircle",
|
|
283
286
|
SCATTER: "initCircle",
|
|
284
287
|
SPLINE: "initLine",
|
|
@@ -292,7 +295,7 @@ var TYPE_METHOD_NEEDED = {
|
|
|
292
295
|
var TYPE_BY_CATEGORY = {
|
|
293
296
|
Area: [TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.AREA_STEP],
|
|
294
297
|
AreaRange: [TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE],
|
|
295
|
-
Arc: [TYPE.PIE, TYPE.DONUT, TYPE.GAUGE, TYPE.RADAR],
|
|
298
|
+
Arc: [TYPE.PIE, TYPE.DONUT, TYPE.GAUGE, TYPE.POLAR, TYPE.RADAR],
|
|
296
299
|
Line: [TYPE.LINE, TYPE.SPLINE, TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.STEP, TYPE.AREA_STEP],
|
|
297
300
|
Step: [TYPE.STEP, TYPE.AREA_STEP],
|
|
298
301
|
Spline: [TYPE.SPLINE, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE]
|
|
@@ -623,17 +626,27 @@ function getBoundingRect(node) {
|
|
|
623
626
|
/**
|
|
624
627
|
* Retrun random number
|
|
625
628
|
* @param {boolean} asStr Convert returned value as string
|
|
629
|
+
* @param {number} min Minimum value
|
|
630
|
+
* @param {number} max Maximum value
|
|
626
631
|
* @returns {number|string}
|
|
627
632
|
* @private
|
|
628
633
|
*/
|
|
629
634
|
|
|
630
635
|
|
|
631
|
-
function getRandom(asStr) {
|
|
636
|
+
function getRandom(asStr, min, max) {
|
|
632
637
|
if (asStr === void 0) {
|
|
633
638
|
asStr = !0;
|
|
634
639
|
}
|
|
635
640
|
|
|
636
|
-
|
|
641
|
+
if (min === void 0) {
|
|
642
|
+
min = 0;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
if (max === void 0) {
|
|
646
|
+
max = 1e4;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
var rand = Math.floor(Math.random() * (max - min) + min);
|
|
637
650
|
return asStr ? rand + "" : rand;
|
|
638
651
|
}
|
|
639
652
|
/**
|
|
@@ -1107,26 +1120,36 @@ function isTabVisible() {
|
|
|
1107
1120
|
|
|
1108
1121
|
|
|
1109
1122
|
function convertInputType(mouse, touch) {
|
|
1110
|
-
var
|
|
1123
|
+
var DocumentTouch = win.DocumentTouch,
|
|
1124
|
+
matchMedia = win.matchMedia,
|
|
1125
|
+
navigator = win.navigator,
|
|
1126
|
+
hasTouch = !1;
|
|
1111
1127
|
|
|
1112
1128
|
if (touch) {
|
|
1113
1129
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
1114
|
-
if (
|
|
1115
|
-
hasTouch =
|
|
1130
|
+
if (navigator && "maxTouchPoints" in navigator) {
|
|
1131
|
+
hasTouch = navigator.maxTouchPoints > 0; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
1116
1132
|
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
1117
|
-
} else if ("ontouchmove" in win ||
|
|
1133
|
+
} else if ("ontouchmove" in win || DocumentTouch && browser_doc instanceof DocumentTouch) {
|
|
1118
1134
|
hasTouch = !0;
|
|
1119
1135
|
} else {
|
|
1120
1136
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1137
|
+
if (matchMedia != null && matchMedia("(pointer:coarse)").matches) {
|
|
1138
|
+
hasTouch = !0;
|
|
1139
|
+
} else {
|
|
1140
|
+
// Only as a last resort, fall back to user agent sniffing
|
|
1141
|
+
var UA = navigator.userAgent;
|
|
1142
|
+
hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
|
1125
1143
|
}
|
|
1126
1144
|
}
|
|
1127
|
-
}
|
|
1145
|
+
} // 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
|
|
1146
|
+
// https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
|
|
1147
|
+
// Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
|
|
1148
|
+
|
|
1128
1149
|
|
|
1129
|
-
var hasMouse = mouse &&
|
|
1150
|
+
var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
1151
|
+
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
1152
|
+
});
|
|
1130
1153
|
return hasMouse && "mouse" || hasTouch && "touch" || null;
|
|
1131
1154
|
}
|
|
1132
1155
|
;// CONCATENATED MODULE: ./src/module/error.ts
|
|
@@ -1307,12 +1330,14 @@ var $GRID = {
|
|
|
1307
1330
|
ygridLines: "bb-ygrid-lines",
|
|
1308
1331
|
ygrids: "bb-ygrids"
|
|
1309
1332
|
};
|
|
1310
|
-
var $
|
|
1311
|
-
chartRadar: "bb-chart-radar",
|
|
1312
|
-
chartRadars: "bb-chart-radars",
|
|
1333
|
+
var $LEVEL = {
|
|
1313
1334
|
level: "bb-level",
|
|
1314
1335
|
levels: "bb-levels"
|
|
1315
1336
|
};
|
|
1337
|
+
var $RADAR = {
|
|
1338
|
+
chartRadar: "bb-chart-radar",
|
|
1339
|
+
chartRadars: "bb-chart-radars"
|
|
1340
|
+
};
|
|
1316
1341
|
var $REGION = {
|
|
1317
1342
|
region: "bb-region",
|
|
1318
1343
|
regions: "bb-regions"
|
|
@@ -1781,6 +1806,21 @@ var Store = /*#__PURE__*/function () {
|
|
|
1781
1806
|
*/
|
|
1782
1807
|
resize_auto: !0,
|
|
1783
1808
|
|
|
1809
|
+
/**
|
|
1810
|
+
* Set a callback to execute when the chart is clicked.
|
|
1811
|
+
* @name onclick
|
|
1812
|
+
* @memberof Options
|
|
1813
|
+
* @type {Function}
|
|
1814
|
+
* @default undefined
|
|
1815
|
+
* @example
|
|
1816
|
+
* onclick: function(event) {
|
|
1817
|
+
* this; // chart instance itself
|
|
1818
|
+
* event; // native event object
|
|
1819
|
+
* ...
|
|
1820
|
+
* }
|
|
1821
|
+
*/
|
|
1822
|
+
onclick: undefined,
|
|
1823
|
+
|
|
1784
1824
|
/**
|
|
1785
1825
|
* Set a callback to execute when mouse/touch enters the chart.
|
|
1786
1826
|
* @name onover
|
|
@@ -1788,8 +1828,9 @@ var Store = /*#__PURE__*/function () {
|
|
|
1788
1828
|
* @type {Function}
|
|
1789
1829
|
* @default undefined
|
|
1790
1830
|
* @example
|
|
1791
|
-
* onover: function() {
|
|
1831
|
+
* onover: function(event) {
|
|
1792
1832
|
* this; // chart instance itself
|
|
1833
|
+
* event; // native event object
|
|
1793
1834
|
* ...
|
|
1794
1835
|
* }
|
|
1795
1836
|
*/
|
|
@@ -1802,8 +1843,9 @@ var Store = /*#__PURE__*/function () {
|
|
|
1802
1843
|
* @type {Function}
|
|
1803
1844
|
* @default undefined
|
|
1804
1845
|
* @example
|
|
1805
|
-
* onout: function() {
|
|
1846
|
+
* onout: function(event) {
|
|
1806
1847
|
* this; // chart instance itself
|
|
1848
|
+
* event; // native event object
|
|
1807
1849
|
* ...
|
|
1808
1850
|
* }
|
|
1809
1851
|
*/
|
|
@@ -2085,6 +2127,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
2085
2127
|
* - gauge
|
|
2086
2128
|
* - line
|
|
2087
2129
|
* - pie
|
|
2130
|
+
* - polar
|
|
2088
2131
|
* - radar
|
|
2089
2132
|
* - scatter
|
|
2090
2133
|
* - spline
|
|
@@ -2113,6 +2156,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
2113
2156
|
* gauge,
|
|
2114
2157
|
* line,
|
|
2115
2158
|
* pie,
|
|
2159
|
+
* polar,
|
|
2116
2160
|
* radar,
|
|
2117
2161
|
* scatter,
|
|
2118
2162
|
* spline,
|
|
@@ -2159,6 +2203,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
2159
2203
|
* gauge,
|
|
2160
2204
|
* line,
|
|
2161
2205
|
* pie,
|
|
2206
|
+
* polar,
|
|
2162
2207
|
* radar,
|
|
2163
2208
|
* scatter,
|
|
2164
2209
|
* spline,
|
|
@@ -3563,28 +3608,32 @@ function generateResize() {
|
|
|
3563
3608
|
|
|
3564
3609
|
return callResizeFn;
|
|
3565
3610
|
}
|
|
3611
|
+
|
|
3566
3612
|
/**
|
|
3567
3613
|
* Generate transition queue function
|
|
3568
3614
|
* @returns {Function}
|
|
3569
3615
|
* @private
|
|
3570
3616
|
*/
|
|
3571
|
-
|
|
3572
3617
|
function generateWait() {
|
|
3573
3618
|
var transitionsToWait = [],
|
|
3574
|
-
f = function (
|
|
3575
|
-
var timer;
|
|
3619
|
+
f = function (selection, callback) {
|
|
3620
|
+
var timer;
|
|
3621
|
+
/**
|
|
3622
|
+
* Check if transition is complete
|
|
3623
|
+
* @private
|
|
3624
|
+
*/
|
|
3576
3625
|
|
|
3577
3626
|
function loop() {
|
|
3578
3627
|
var done = 0;
|
|
3579
3628
|
|
|
3580
|
-
for (var i = 0,
|
|
3581
|
-
if (
|
|
3629
|
+
for (var i = 0, t; t = transitionsToWait[i]; i++) {
|
|
3630
|
+
if (t === !0 || t.empty != null && t.empty()) {
|
|
3582
3631
|
done++;
|
|
3583
3632
|
continue;
|
|
3584
3633
|
}
|
|
3585
3634
|
|
|
3586
3635
|
try {
|
|
3587
|
-
|
|
3636
|
+
t.transition();
|
|
3588
3637
|
} catch (e) {
|
|
3589
3638
|
done++;
|
|
3590
3639
|
}
|
|
@@ -3600,7 +3649,8 @@ function generateWait() {
|
|
|
3600
3649
|
}
|
|
3601
3650
|
|
|
3602
3651
|
loop();
|
|
3603
|
-
};
|
|
3652
|
+
}; // 'f' is called as selection.call(f, ...);
|
|
3653
|
+
|
|
3604
3654
|
|
|
3605
3655
|
f.add = function (t) {
|
|
3606
3656
|
isArray(t) ? transitionsToWait = transitionsToWait.concat(t) : transitionsToWait.push(t);
|
|
@@ -5609,14 +5659,15 @@ var colorizePattern = function (pattern, color, id) {
|
|
|
5609
5659
|
|
|
5610
5660
|
/**
|
|
5611
5661
|
* Append data backgound color filter definition
|
|
5662
|
+
* @param {string} color Color string
|
|
5612
5663
|
* @private
|
|
5613
5664
|
*/
|
|
5614
|
-
generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter() {
|
|
5665
|
+
generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter(color) {
|
|
5615
5666
|
var $$ = this,
|
|
5616
5667
|
$el = $$.$el,
|
|
5617
5668
|
config = $$.config,
|
|
5618
5669
|
state = $$.state,
|
|
5619
|
-
backgroundColors = config.data_labels_backgroundColors;
|
|
5670
|
+
backgroundColors = color || config.data_labels_backgroundColors;
|
|
5620
5671
|
|
|
5621
5672
|
if (backgroundColors) {
|
|
5622
5673
|
var ids = [];
|
|
@@ -5628,7 +5679,7 @@ var colorizePattern = function (pattern, color, id) {
|
|
|
5628
5679
|
}
|
|
5629
5680
|
|
|
5630
5681
|
ids.forEach(function (v) {
|
|
5631
|
-
var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v);
|
|
5682
|
+
var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v) + (color ? $$.getTargetSelectorSuffix(color) : "");
|
|
5632
5683
|
$el.defs.append("filter").attr("x", "0").attr("y", "0").attr("width", "1").attr("height", "1").attr("id", id).html("<feFlood flood-color=\"" + (v === "" ? backgroundColors : backgroundColors[v]) + "\" /><feComposite in=\"SourceGraphic\"/>");
|
|
5633
5684
|
});
|
|
5634
5685
|
}
|
|
@@ -6118,7 +6169,7 @@ function getFormat($$, typeValue, v) {
|
|
|
6118
6169
|
defaultArcValueFormat = $$.defaultArcValueFormat,
|
|
6119
6170
|
yFormat = $$.yFormat,
|
|
6120
6171
|
y2Format = $$.y2Format,
|
|
6121
|
-
hasArc = $$.hasArcType(null, ["gauge", "radar"]);
|
|
6172
|
+
hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
|
|
6122
6173
|
return function (v, ratio, id) {
|
|
6123
6174
|
var format = hasArc ? defaultArcValueFormat : $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat;
|
|
6124
6175
|
return format.call($$, v, ratio);
|
|
@@ -6130,6 +6181,9 @@ function getFormat($$, typeValue, v) {
|
|
|
6130
6181
|
defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
|
|
6131
6182
|
return (ratio * 100).toFixed(1) + "%";
|
|
6132
6183
|
},
|
|
6184
|
+
defaultPolarValueFormat: function defaultPolarValueFormat(v) {
|
|
6185
|
+
return "" + v;
|
|
6186
|
+
},
|
|
6133
6187
|
dataLabelFormat: function dataLabelFormat(targetId) {
|
|
6134
6188
|
var $$ = this,
|
|
6135
6189
|
dataLabels = $$.config.data_labels,
|
|
@@ -6894,7 +6948,9 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
6894
6948
|
// arc
|
|
6895
6949
|
$el.arcs && $$.redrawArc(duration, durationForExit, wth.Transform); // radar
|
|
6896
6950
|
|
|
6897
|
-
$el.radar && $$.redrawRadar();
|
|
6951
|
+
$el.radar && $$.redrawRadar(); // polar
|
|
6952
|
+
|
|
6953
|
+
$el.polar && $$.redrawPolar();
|
|
6898
6954
|
} // @TODO: Axis & Radar type
|
|
6899
6955
|
|
|
6900
6956
|
|
|
@@ -9215,6 +9271,9 @@ function getTextPos(pos, width) {
|
|
|
9215
9271
|
} else if (target === "arc") {
|
|
9216
9272
|
x = state.arcWidth / 2;
|
|
9217
9273
|
y = state.arcHeight / 2;
|
|
9274
|
+
} else if (target === "polar") {
|
|
9275
|
+
x = state.arcWidth / 2;
|
|
9276
|
+
y = state.arcHeight / 2;
|
|
9218
9277
|
} else if (target === "radar") {
|
|
9219
9278
|
var _$$$getRadarSize = $$.getRadarSize(),
|
|
9220
9279
|
width = _$$$getRadarSize[0];
|
|
@@ -9430,11 +9489,14 @@ function getTextPos(pos, width) {
|
|
|
9430
9489
|
isDonutType: function isDonutType(d) {
|
|
9431
9490
|
return this.isTypeOf(d, "donut");
|
|
9432
9491
|
},
|
|
9492
|
+
isPolarType: function isPolarType(d) {
|
|
9493
|
+
return this.isTypeOf(d, "polar");
|
|
9494
|
+
},
|
|
9433
9495
|
isRadarType: function isRadarType(d) {
|
|
9434
9496
|
return this.isTypeOf(d, "radar");
|
|
9435
9497
|
},
|
|
9436
9498
|
isArcType: function isArcType(d) {
|
|
9437
|
-
return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isRadarType(d);
|
|
9499
|
+
return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isPolarType(d) || this.isRadarType(d);
|
|
9438
9500
|
},
|
|
9439
9501
|
// determine if is 'circle' data point
|
|
9440
9502
|
isCirclePoint: function isCirclePoint(node) {
|
|
@@ -9714,13 +9776,12 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
9714
9776
|
|
|
9715
9777
|
_proto.initParams = function initParams() {
|
|
9716
9778
|
var $$ = this,
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
state = _ref.state,
|
|
9779
|
+
config = $$.config,
|
|
9780
|
+
format = $$.format,
|
|
9781
|
+
state = $$.state,
|
|
9721
9782
|
isRotated = config.axis_rotated;
|
|
9722
9783
|
// datetime to be used for uniqueness
|
|
9723
|
-
state.datetimeId = "bb-" + +new Date();
|
|
9784
|
+
state.datetimeId = "bb-" + +new Date() * getRandom();
|
|
9724
9785
|
$$.color = $$.generateColor();
|
|
9725
9786
|
$$.levelColor = $$.generateLevelColor();
|
|
9726
9787
|
|
|
@@ -9762,7 +9823,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
9762
9823
|
$el = $$.$el,
|
|
9763
9824
|
org = $$.org,
|
|
9764
9825
|
hasAxis = state.hasAxis,
|
|
9765
|
-
hasInteraction = config.interaction_enabled
|
|
9826
|
+
hasInteraction = config.interaction_enabled,
|
|
9827
|
+
hasPolar = $$.hasType("polar");
|
|
9766
9828
|
|
|
9767
9829
|
// for arc type, set axes to not be shown
|
|
9768
9830
|
// $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
|
|
@@ -9820,26 +9882,30 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
9820
9882
|
$el.svg = $el.chart.append("svg").style("overflow", "hidden").style("display", "block");
|
|
9821
9883
|
|
|
9822
9884
|
if (hasInteraction && state.inputType) {
|
|
9823
|
-
var
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9885
|
+
var _onclick,
|
|
9886
|
+
_onover,
|
|
9887
|
+
_onout,
|
|
9888
|
+
isTouch = state.inputType === "touch",
|
|
9889
|
+
_config = config,
|
|
9890
|
+
onclick = _config.onclick,
|
|
9891
|
+
onover = _config.onover,
|
|
9892
|
+
onout = _config.onout;
|
|
9893
|
+
|
|
9894
|
+
$el.svg.on("click", ((_onclick = onclick) == null ? void 0 : _onclick.bind($$.api)) || null).on(isTouch ? "touchstart" : "mouseenter", ((_onover = onover) == null ? void 0 : _onover.bind($$.api)) || null).on(isTouch ? "touchend" : "mouseleave", ((_onout = onout) == null ? void 0 : _onout.bind($$.api)) || null);
|
|
9829
9895
|
}
|
|
9830
9896
|
|
|
9831
9897
|
config.svg_classname && $el.svg.attr("class", config.svg_classname); // Define defs
|
|
9832
9898
|
|
|
9833
9899
|
var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
|
9834
9900
|
|
|
9835
|
-
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
|
|
9901
|
+
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
|
|
9836
9902
|
$el.defs = $el.svg.append("defs");
|
|
9837
9903
|
|
|
9838
9904
|
if (hasAxis) {
|
|
9839
9905
|
["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
|
9840
9906
|
$$.appendClip($el.defs, state.clip[v]);
|
|
9841
9907
|
});
|
|
9842
|
-
} // Append data
|
|
9908
|
+
} // Append data background color filter definition
|
|
9843
9909
|
|
|
9844
9910
|
|
|
9845
9911
|
$$.generateDataLabelBackgroundColorFilter(); // set color patterns
|
|
@@ -9942,6 +10008,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
9942
10008
|
}
|
|
9943
10009
|
});
|
|
9944
10010
|
} else {
|
|
10011
|
+
var hasPolar = $$.hasType("polar");
|
|
10012
|
+
|
|
9945
10013
|
if (!hasRadar) {
|
|
9946
10014
|
types.push("Arc", "Pie");
|
|
9947
10015
|
}
|
|
@@ -9950,6 +10018,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
9950
10018
|
types.push("Gauge");
|
|
9951
10019
|
} else if (hasRadar) {
|
|
9952
10020
|
types.push("Radar");
|
|
10021
|
+
} else if (hasPolar) {
|
|
10022
|
+
types.push("Polar");
|
|
9953
10023
|
}
|
|
9954
10024
|
}
|
|
9955
10025
|
|
|
@@ -10041,7 +10111,11 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10041
10111
|
var $$ = this,
|
|
10042
10112
|
_$$$state2 = $$.state,
|
|
10043
10113
|
hasAxis = _$$$state2.hasAxis,
|
|
10044
|
-
hasRadar = _$$$state2.hasRadar
|
|
10114
|
+
hasRadar = _$$$state2.hasRadar,
|
|
10115
|
+
helper = function (type) {
|
|
10116
|
+
return $$["updateTargetsFor" + type](targets.filter($$["is" + type + "Type"].bind($$)));
|
|
10117
|
+
};
|
|
10118
|
+
|
|
10045
10119
|
// Text
|
|
10046
10120
|
$$.updateTargetsForText(targets);
|
|
10047
10121
|
|
|
@@ -10050,14 +10124,21 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10050
10124
|
var name = capitalize(v);
|
|
10051
10125
|
|
|
10052
10126
|
if (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) {
|
|
10053
|
-
|
|
10127
|
+
helper(name);
|
|
10054
10128
|
}
|
|
10055
10129
|
}); // Sub Chart
|
|
10056
10130
|
|
|
10057
|
-
$$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets);
|
|
10058
|
-
} else {
|
|
10059
|
-
|
|
10060
|
-
|
|
10131
|
+
$$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets); // Arc, Polar, Radar
|
|
10132
|
+
} else if ($$.hasArcType(targets)) {
|
|
10133
|
+
var _type = "Arc";
|
|
10134
|
+
|
|
10135
|
+
if (hasRadar) {
|
|
10136
|
+
_type = "Radar";
|
|
10137
|
+
} else if ($$.hasType("polar")) {
|
|
10138
|
+
_type = "Polar";
|
|
10139
|
+
}
|
|
10140
|
+
|
|
10141
|
+
helper(_type);
|
|
10061
10142
|
} // circle
|
|
10062
10143
|
|
|
10063
10144
|
|
|
@@ -10820,7 +10901,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
10820
10901
|
candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
|
10821
10902
|
candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !0);
|
|
10822
10903
|
|
|
10823
|
-
if ($$.hasArcType()) {
|
|
10904
|
+
if ($$.hasArcType(null, ["polar"])) {
|
|
10824
10905
|
$$.unexpandArc(targetIds);
|
|
10825
10906
|
$$.hasType("gauge") && $$.undoMarkOverlapped($$, "." + $GAUGE.gaugeValue);
|
|
10826
10907
|
}
|
|
@@ -10858,7 +10939,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
10858
10939
|
candidates = $el.svg.selectAll($$.selectorTargets(targetIds));
|
|
10859
10940
|
// should be for all targets
|
|
10860
10941
|
candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !1);
|
|
10861
|
-
$$.hasArcType() && $$.unexpandArc(targetIds);
|
|
10942
|
+
$$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
|
|
10862
10943
|
|
|
10863
10944
|
if (config.legend_show) {
|
|
10864
10945
|
$$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
|
|
@@ -11562,6 +11643,7 @@ extend(Chart.prototype, [chart, api_color, api_data, api_export, api_focus, api_
|
|
|
11562
11643
|
* billboard.js project is licensed under the MIT license
|
|
11563
11644
|
*/
|
|
11564
11645
|
|
|
11646
|
+
|
|
11565
11647
|
/**
|
|
11566
11648
|
* Set the min/max value
|
|
11567
11649
|
* @param {Chart} $$ Chart instance
|
|
@@ -11569,20 +11651,26 @@ extend(Chart.prototype, [chart, api_color, api_data, api_export, api_focus, api_
|
|
|
11569
11651
|
* @param {object} value Value to be set
|
|
11570
11652
|
* @private
|
|
11571
11653
|
*/
|
|
11572
|
-
|
|
11573
11654
|
function setMinMax($$, type, value) {
|
|
11574
11655
|
var config = $$.config,
|
|
11575
|
-
|
|
11576
|
-
|
|
11656
|
+
helper = function (key, value) {
|
|
11657
|
+
var v = isNumber(value) ? value : value === !1 ? undefined : null;
|
|
11658
|
+
|
|
11659
|
+
if (v !== null) {
|
|
11660
|
+
config["axis_" + key + "_" + type] = v;
|
|
11661
|
+
}
|
|
11662
|
+
};
|
|
11577
11663
|
|
|
11578
11664
|
if (isDefined(value)) {
|
|
11579
11665
|
if (isObjectType(value)) {
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
} else {
|
|
11584
|
-
|
|
11585
|
-
|
|
11666
|
+
Object.keys(value).forEach(function (key) {
|
|
11667
|
+
helper(key, value[key]);
|
|
11668
|
+
});
|
|
11669
|
+
} else if (isNumber(value) || value === !1) {
|
|
11670
|
+
// shorthand values affects only y and y2.
|
|
11671
|
+
["y", "y2"].forEach(function (key) {
|
|
11672
|
+
helper(key, value);
|
|
11673
|
+
});
|
|
11586
11674
|
}
|
|
11587
11675
|
|
|
11588
11676
|
$$.redraw({
|
|
@@ -11668,8 +11756,9 @@ var axis = {
|
|
|
11668
11756
|
* @instance
|
|
11669
11757
|
* @memberof Chart
|
|
11670
11758
|
* @param {object} min If min is given, specified axis' min value will be updated.<br>
|
|
11671
|
-
*
|
|
11672
|
-
*
|
|
11759
|
+
* If no argument is given, the min values set on generating option for each axis will be returned.
|
|
11760
|
+
* If not set any min values on generation, it will return `undefined`.<br>
|
|
11761
|
+
* To unset specific axis max, set `false` to each of them.
|
|
11673
11762
|
* @returns {object|undefined}
|
|
11674
11763
|
* @example
|
|
11675
11764
|
* // Update axis' min
|
|
@@ -11678,10 +11767,21 @@ var axis = {
|
|
|
11678
11767
|
* y: 1000,
|
|
11679
11768
|
* y2: 100
|
|
11680
11769
|
* });
|
|
11770
|
+
*
|
|
11771
|
+
* // To unset specific axis min, set false to each of them.
|
|
11772
|
+
* chart.axis.min({
|
|
11773
|
+
* x: false,
|
|
11774
|
+
* y: false,
|
|
11775
|
+
* y2: false
|
|
11776
|
+
* });
|
|
11777
|
+
*
|
|
11778
|
+
* // shorthand (only affects y and y2 axis)
|
|
11779
|
+
* chart.axis.min(-50);
|
|
11780
|
+
* chart.axis.min(false);
|
|
11681
11781
|
*/
|
|
11682
11782
|
min: function min(_min) {
|
|
11683
11783
|
var $$ = this.internal;
|
|
11684
|
-
return isValue(_min) ? setMinMax($$, "min", _min) : axis_getMinMax($$, "min");
|
|
11784
|
+
return isValue(_min) || _min === !1 ? setMinMax($$, "min", _min) : axis_getMinMax($$, "min");
|
|
11685
11785
|
},
|
|
11686
11786
|
|
|
11687
11787
|
/**
|
|
@@ -11690,8 +11790,9 @@ var axis = {
|
|
|
11690
11790
|
* @instance
|
|
11691
11791
|
* @memberof Chart
|
|
11692
11792
|
* @param {object} max If max is given, specified axis' max value will be updated.<br>
|
|
11693
|
-
*
|
|
11694
|
-
*
|
|
11793
|
+
* If no argument is given, the max values set on generating option for each axis will be returned.
|
|
11794
|
+
* If not set any max values on generation, it will return `undefined`.<br>
|
|
11795
|
+
* To unset specific axis max, set `false` to each of them.
|
|
11695
11796
|
* @returns {object|undefined}
|
|
11696
11797
|
* @example
|
|
11697
11798
|
* // Update axis' label
|
|
@@ -11700,10 +11801,21 @@ var axis = {
|
|
|
11700
11801
|
* y: 1000,
|
|
11701
11802
|
* y2: 10000
|
|
11702
11803
|
* });
|
|
11804
|
+
*
|
|
11805
|
+
* // To unset specific axis max, set false to each of them.
|
|
11806
|
+
* chart.axis.max({
|
|
11807
|
+
* x: false,
|
|
11808
|
+
* y: false,
|
|
11809
|
+
* y2: false
|
|
11810
|
+
* });
|
|
11811
|
+
*
|
|
11812
|
+
* // shorthand (only affects y and y2 axis)
|
|
11813
|
+
* chart.axis.max(10);
|
|
11814
|
+
* chart.axis.max(false);
|
|
11703
11815
|
*/
|
|
11704
11816
|
max: function max(_max) {
|
|
11705
11817
|
var $$ = this.internal;
|
|
11706
|
-
return
|
|
11818
|
+
return isValue(_max) || _max === !1 ? setMinMax($$, "max", _max) : axis_getMinMax($$, "max");
|
|
11707
11819
|
},
|
|
11708
11820
|
|
|
11709
11821
|
/**
|
|
@@ -11711,7 +11823,9 @@ var axis = {
|
|
|
11711
11823
|
* @function axis․range
|
|
11712
11824
|
* @instance
|
|
11713
11825
|
* @memberof Chart
|
|
11714
|
-
* @param {object} range If range is given, specified axis' min and max value will be updated.
|
|
11826
|
+
* @param {object} range If range is given, specified axis' min and max value will be updated.
|
|
11827
|
+
* If no argument is given, the current min and max values for each axis will be returned.<br>
|
|
11828
|
+
* To unset specific axis max, set `false` to each of them.
|
|
11715
11829
|
* @returns {object|undefined}
|
|
11716
11830
|
* @example
|
|
11717
11831
|
* // Update axis' label
|
|
@@ -11727,13 +11841,33 @@ var axis = {
|
|
|
11727
11841
|
* y2: 10000
|
|
11728
11842
|
* },
|
|
11729
11843
|
* });
|
|
11844
|
+
*
|
|
11845
|
+
* // To unset specific axis max, set false to each of them.
|
|
11846
|
+
* chart.axis.range({
|
|
11847
|
+
* min: {
|
|
11848
|
+
* x: false,
|
|
11849
|
+
* y: false,
|
|
11850
|
+
* y2: false
|
|
11851
|
+
* },
|
|
11852
|
+
* max: {
|
|
11853
|
+
* x: false,
|
|
11854
|
+
* y: false,
|
|
11855
|
+
* y2: false
|
|
11856
|
+
* },
|
|
11857
|
+
* });
|
|
11858
|
+
*
|
|
11859
|
+
* // shorthand (only affects y and y2 axis)
|
|
11860
|
+
* chart.axis.range({ min: -50, max: 1000 });
|
|
11861
|
+
* chart.axis.range({ min: false, max: false });
|
|
11730
11862
|
*/
|
|
11731
11863
|
range: function range(_range) {
|
|
11732
11864
|
var axis = this.axis;
|
|
11733
11865
|
|
|
11734
11866
|
if (arguments.length) {
|
|
11735
|
-
|
|
11736
|
-
|
|
11867
|
+
var min = _range.min,
|
|
11868
|
+
max = _range.max;
|
|
11869
|
+
isDefined(max) && axis.max(max);
|
|
11870
|
+
isDefined(min) && axis.min(min);
|
|
11737
11871
|
} else {
|
|
11738
11872
|
return {
|
|
11739
11873
|
max: axis.max(),
|
|
@@ -13901,7 +14035,7 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
13901
14035
|
var prefix = "axis_" + key + "_",
|
|
13902
14036
|
axisScale = scale[key];
|
|
13903
14037
|
|
|
13904
|
-
if (
|
|
14038
|
+
if (axisScale) {
|
|
13905
14039
|
var tickValues = config[prefix + "tick_values"],
|
|
13906
14040
|
tickCount = config[prefix + "tick_count"];
|
|
13907
14041
|
axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
|
|
@@ -13969,8 +14103,10 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
13969
14103
|
}
|
|
13970
14104
|
|
|
13971
14105
|
tickNodes.each(function (d) {
|
|
13972
|
-
|
|
13973
|
-
|
|
14106
|
+
var node = lines ? this.querySelector("text") : this;
|
|
14107
|
+
|
|
14108
|
+
if (node) {
|
|
14109
|
+
node.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null;
|
|
13974
14110
|
}
|
|
13975
14111
|
});
|
|
13976
14112
|
} else {
|
|
@@ -14706,7 +14842,9 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
14706
14842
|
} else if (orgDataCount === 1 || ((_flowStart = flowStart) == null ? void 0 : _flowStart.x) === ((_flowEnd = flowEnd) == null ? void 0 : _flowEnd.x)) {
|
|
14707
14843
|
translateX = x(orgDomain[0]) - x(domain[0]);
|
|
14708
14844
|
} else {
|
|
14709
|
-
|
|
14845
|
+
var _flowStart2;
|
|
14846
|
+
|
|
14847
|
+
translateX = $$.axis.isTimeSeries() ? x(orgDomain[0]) - x(domain[0]) : x(((_flowStart2 = flowStart) == null ? void 0 : _flowStart2.x) || 0) - x(flowEnd.x);
|
|
14710
14848
|
}
|
|
14711
14849
|
|
|
14712
14850
|
var scaleX = diffDomain(orgDomain) / diffDomain(domain);
|
|
@@ -17479,9 +17617,9 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17479
17617
|
var $$ = this,
|
|
17480
17618
|
config = $$.config,
|
|
17481
17619
|
dataType = config.data_type,
|
|
17482
|
-
padding = config
|
|
17620
|
+
padding = config[dataType + "_padding"],
|
|
17483
17621
|
startingAngle = config[dataType + "_startingAngle"] || 0,
|
|
17484
|
-
padAngle = (
|
|
17622
|
+
padAngle = (padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
|
|
17485
17623
|
$$.pie = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.pie)().startAngle(startingAngle).endAngle(startingAngle + 2 * Math.PI).padAngle(padAngle).value(function (d) {
|
|
17486
17624
|
return d.values.reduce(function (a, b) {
|
|
17487
17625
|
return a + b.value;
|
|
@@ -17492,7 +17630,8 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17492
17630
|
var $$ = this,
|
|
17493
17631
|
config = $$.config,
|
|
17494
17632
|
state = $$.state,
|
|
17495
|
-
|
|
17633
|
+
dataType = config.data_type,
|
|
17634
|
+
padding = config[dataType + "_padding"],
|
|
17496
17635
|
w = config.gauge_width || config.donut_width,
|
|
17497
17636
|
gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
|
|
17498
17637
|
// determine radius
|
|
@@ -17627,6 +17766,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17627
17766
|
state = $$.state,
|
|
17628
17767
|
singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
|
|
17629
17768
|
hasMultiArcGauge = $$.hasMultiArcGauge(),
|
|
17769
|
+
hasPolar = $$.hasType("polar"),
|
|
17630
17770
|
arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(function (d) {
|
|
17631
17771
|
var _$$$getRadius = $$.getRadius(d),
|
|
17632
17772
|
innerRadius = _$$$getRadius.innerRadius;
|
|
@@ -17634,9 +17774,16 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17634
17774
|
return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : isNumber(innerRadius) ? innerRadius : 0;
|
|
17635
17775
|
}).outerRadius(function (d) {
|
|
17636
17776
|
var _$$$getRadius2 = $$.getRadius(d),
|
|
17637
|
-
outerRadius = _$$$getRadius2.outerRadius
|
|
17777
|
+
outerRadius = _$$$getRadius2.outerRadius,
|
|
17778
|
+
radius = outerRadius;
|
|
17779
|
+
|
|
17780
|
+
if (hasMultiArcGauge) {
|
|
17781
|
+
radius = state.radius - singleArcWidth * d.index;
|
|
17782
|
+
} else if (hasPolar) {
|
|
17783
|
+
radius = $$.getPolarOuterRadius(d, outerRadius);
|
|
17784
|
+
}
|
|
17638
17785
|
|
|
17639
|
-
return
|
|
17786
|
+
return radius;
|
|
17640
17787
|
}),
|
|
17641
17788
|
newArc = function (d, withoutUpdate) {
|
|
17642
17789
|
var path = "M 0 0";
|
|
@@ -17694,6 +17841,13 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17694
17841
|
getArc: function getArc(d, withoutUpdate, force) {
|
|
17695
17842
|
return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
|
|
17696
17843
|
},
|
|
17844
|
+
|
|
17845
|
+
/**
|
|
17846
|
+
* Set transform attributes to arc label text
|
|
17847
|
+
* @param {Object} d Data object
|
|
17848
|
+
* @returns {string} Translate attribute string
|
|
17849
|
+
* @private
|
|
17850
|
+
*/
|
|
17697
17851
|
transformForArcLabel: function transformForArcLabel(d) {
|
|
17698
17852
|
var $$ = this,
|
|
17699
17853
|
config = $$.config,
|
|
@@ -17708,16 +17862,24 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17708
17862
|
y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
|
|
17709
17863
|
translate = "translate(" + x + "," + y + ")";
|
|
17710
17864
|
} else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
17711
|
-
var
|
|
17712
|
-
|
|
17713
|
-
|
|
17865
|
+
var _filter$map,
|
|
17866
|
+
_$$$getRadius4 = $$.getRadius(d),
|
|
17867
|
+
outerRadius = _$$$getRadius4.outerRadius;
|
|
17868
|
+
|
|
17869
|
+
if ($$.hasType("polar")) {
|
|
17870
|
+
outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
17871
|
+
}
|
|
17872
|
+
|
|
17873
|
+
var c = this.svgArc.centroid(updated),
|
|
17714
17874
|
_c$map = c.map(function (v) {
|
|
17715
17875
|
return isNaN(v) ? 0 : v;
|
|
17716
17876
|
}),
|
|
17717
17877
|
x = _c$map[0],
|
|
17718
17878
|
y = _c$map[1],
|
|
17719
17879
|
h = Math.sqrt(x * x + y * y),
|
|
17720
|
-
ratio =
|
|
17880
|
+
ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
|
|
17881
|
+
return config[v + "_label_ratio"];
|
|
17882
|
+
})) == null ? void 0 : _filter$map[0];
|
|
17721
17883
|
|
|
17722
17884
|
if (ratio) {
|
|
17723
17885
|
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
|
@@ -17745,10 +17907,11 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17745
17907
|
|
|
17746
17908
|
if ($$.shouldShowArcLabel()) {
|
|
17747
17909
|
selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.updateTextBacgroundColor.bind($$)).each(function (d) {
|
|
17748
|
-
var
|
|
17910
|
+
var _filter,
|
|
17911
|
+
node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
17749
17912
|
updated = $$.updateAngle(d),
|
|
17750
17913
|
ratio = $$.getRatio("arc", updated),
|
|
17751
|
-
isUnderThreshold = $$.meetsLabelThreshold(ratio,
|
|
17914
|
+
isUnderThreshold = $$.meetsLabelThreshold(ratio, (_filter = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _filter[0]);
|
|
17752
17915
|
|
|
17753
17916
|
if (isUnderThreshold) {
|
|
17754
17917
|
var value = (updated || d).value,
|
|
@@ -17836,21 +17999,20 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17836
17999
|
shouldShowArcLabel: function shouldShowArcLabel() {
|
|
17837
18000
|
var $$ = this,
|
|
17838
18001
|
config = $$.config;
|
|
17839
|
-
return ["
|
|
18002
|
+
return ["donut", "gauge", "pie", "polar"].some(function (v) {
|
|
17840
18003
|
return $$.hasType(v) && config[v + "_label_show"];
|
|
17841
18004
|
});
|
|
17842
18005
|
},
|
|
17843
18006
|
getArcLabelFormat: function getArcLabelFormat() {
|
|
17844
18007
|
var $$ = this,
|
|
17845
18008
|
config = $$.config,
|
|
17846
|
-
format =
|
|
17847
|
-
|
|
17848
|
-
|
|
17849
|
-
format = config.gauge_label_format;
|
|
17850
|
-
} else if ($$.hasType("donut")) {
|
|
17851
|
-
format = config.donut_label_format;
|
|
17852
|
-
}
|
|
18009
|
+
format = function (v) {
|
|
18010
|
+
return v;
|
|
18011
|
+
};
|
|
17853
18012
|
|
|
18013
|
+
["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).forEach(function (v) {
|
|
18014
|
+
format = config[v + "_label_format"];
|
|
18015
|
+
});
|
|
17854
18016
|
return isFunction(format) ? format.bind($$.api) : format;
|
|
17855
18017
|
},
|
|
17856
18018
|
getArcTitle: function getArcTitle() {
|
|
@@ -17982,6 +18144,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17982
18144
|
}); // bind arc events
|
|
17983
18145
|
|
|
17984
18146
|
hasInteraction && $$.bindArcEvent(mainArc);
|
|
18147
|
+
$$.hasType("polar") && $$.redrawPolar();
|
|
17985
18148
|
$$.hasType("gauge") && $$.redrawBackgroundArcs();
|
|
17986
18149
|
$$.redrawArcText(duration);
|
|
17987
18150
|
},
|
|
@@ -19789,6 +19952,124 @@ var getTransitionName = function () {
|
|
|
19789
19952
|
}
|
|
19790
19953
|
}
|
|
19791
19954
|
});
|
|
19955
|
+
;// CONCATENATED MODULE: ./src/ChartInternal/shape/polar.ts
|
|
19956
|
+
/**
|
|
19957
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
19958
|
+
* billboard.js project is licensed under the MIT license
|
|
19959
|
+
*/
|
|
19960
|
+
|
|
19961
|
+
|
|
19962
|
+
|
|
19963
|
+
/**
|
|
19964
|
+
* Get data max value
|
|
19965
|
+
* @param {object} $$ ChartInternal instance
|
|
19966
|
+
* @returns {number} max value
|
|
19967
|
+
* @private
|
|
19968
|
+
*/
|
|
19969
|
+
function getDataMax($$) {
|
|
19970
|
+
var levelMax = $$.config.polar_level_max,
|
|
19971
|
+
dataMax = $$.getMinMaxData().max[0].value;
|
|
19972
|
+
|
|
19973
|
+
// Apply level max only when is greater than the data max value
|
|
19974
|
+
if (levelMax && levelMax > dataMax) {
|
|
19975
|
+
dataMax = levelMax;
|
|
19976
|
+
}
|
|
19977
|
+
|
|
19978
|
+
return dataMax;
|
|
19979
|
+
}
|
|
19980
|
+
|
|
19981
|
+
/* harmony default export */ var polar = ({
|
|
19982
|
+
/**
|
|
19983
|
+
* Initialize polar
|
|
19984
|
+
* @private
|
|
19985
|
+
*/
|
|
19986
|
+
initPolar: function initPolar() {
|
|
19987
|
+
var $$ = this,
|
|
19988
|
+
arcs = $$.$el.arcs,
|
|
19989
|
+
config = $$.config,
|
|
19990
|
+
levelTextShow = config.polar_level_text_show,
|
|
19991
|
+
levelTextBgColor = config.polar_level_text_backgroundColor;
|
|
19992
|
+
// append <g> for level
|
|
19993
|
+
arcs.levels = arcs.append("g").attr("class", $LEVEL.levels); // set level text background color
|
|
19994
|
+
|
|
19995
|
+
if (levelTextShow && levelTextBgColor) {
|
|
19996
|
+
$$.generateDataLabelBackgroundColorFilter(levelTextBgColor);
|
|
19997
|
+
}
|
|
19998
|
+
},
|
|
19999
|
+
|
|
20000
|
+
/**
|
|
20001
|
+
* Get polar outer radius according to the data value
|
|
20002
|
+
* @param {object} d Data object
|
|
20003
|
+
* @param {numbet} outerRadius Outer radius
|
|
20004
|
+
* @returns {number} outer radius
|
|
20005
|
+
* @private
|
|
20006
|
+
*/
|
|
20007
|
+
getPolarOuterRadius: function getPolarOuterRadius(d, outerRadius) {
|
|
20008
|
+
var dataMax = getDataMax(this);
|
|
20009
|
+
return (d == null ? void 0 : d.data.values[0].value) / dataMax * outerRadius;
|
|
20010
|
+
},
|
|
20011
|
+
|
|
20012
|
+
/**
|
|
20013
|
+
* Update polar based on given data array
|
|
20014
|
+
* @param {object} targets Data object
|
|
20015
|
+
* @private
|
|
20016
|
+
*/
|
|
20017
|
+
updateTargetsForPolar: function updateTargetsForPolar(targets) {
|
|
20018
|
+
// borrow from Arc
|
|
20019
|
+
this.updateTargetsForArc(targets);
|
|
20020
|
+
},
|
|
20021
|
+
|
|
20022
|
+
/**
|
|
20023
|
+
* Called whenever redraw happens
|
|
20024
|
+
* @private
|
|
20025
|
+
*/
|
|
20026
|
+
redrawPolar: function redrawPolar() {
|
|
20027
|
+
var $$ = this,
|
|
20028
|
+
config = $$.config;
|
|
20029
|
+
config.polar_level_show && $$.updatePolarLevel();
|
|
20030
|
+
},
|
|
20031
|
+
|
|
20032
|
+
/**
|
|
20033
|
+
* Update polar level circle
|
|
20034
|
+
* @private
|
|
20035
|
+
*/
|
|
20036
|
+
updatePolarLevel: function updatePolarLevel() {
|
|
20037
|
+
var $$ = this,
|
|
20038
|
+
config = $$.config,
|
|
20039
|
+
state = $$.state,
|
|
20040
|
+
levels = $$.$el.arcs.levels,
|
|
20041
|
+
depth = config.polar_level_depth,
|
|
20042
|
+
dataMax = getDataMax($$),
|
|
20043
|
+
levelData = getRange(0, depth),
|
|
20044
|
+
outerRadius = state.radius,
|
|
20045
|
+
levelRatio = levelData.map(function (l) {
|
|
20046
|
+
return outerRadius * ((l + 1) / depth);
|
|
20047
|
+
}),
|
|
20048
|
+
levelTextFormat = (config.polar_level_text_format || function () {}).bind($$.api),
|
|
20049
|
+
level = levels.selectAll("." + $LEVEL.level).data(levelData);
|
|
20050
|
+
|
|
20051
|
+
level.exit().remove();
|
|
20052
|
+
var levelEnter = level.enter().append("g").attr("class", function (d, i) {
|
|
20053
|
+
return $LEVEL.level + " " + $LEVEL.level + "-" + i;
|
|
20054
|
+
}); // cx, cy, translate: Set center as origin (0,0) so that it can share same center with arcs
|
|
20055
|
+
|
|
20056
|
+
levelEnter.append("circle");
|
|
20057
|
+
levelEnter.merge(level).selectAll("circle").style("visibility", config.polar_level_show ? null : "hidden").attr("cx", 0).attr("cy", 0).attr("r", function (d) {
|
|
20058
|
+
return levelRatio[d];
|
|
20059
|
+
});
|
|
20060
|
+
|
|
20061
|
+
if (config.polar_level_text_show) {
|
|
20062
|
+
var levelTextBackgroundColor = config.polar_level_text_backgroundColor,
|
|
20063
|
+
defsId = "#" + state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(levelTextBackgroundColor);
|
|
20064
|
+
levelEnter.append("text").style("text-anchor", "middle");
|
|
20065
|
+
levelEnter.merge(level).selectAll("text").attr("dy", function (d) {
|
|
20066
|
+
return -levelRatio[d] + 5;
|
|
20067
|
+
}).attr("filter", levelTextBackgroundColor ? "url(" + defsId + ")" : null).text(function (d) {
|
|
20068
|
+
return levelTextFormat(dataMax / levelData.length * (d + 1));
|
|
20069
|
+
});
|
|
20070
|
+
}
|
|
20071
|
+
}
|
|
20072
|
+
});
|
|
19792
20073
|
;// CONCATENATED MODULE: ./src/ChartInternal/shape/radar.ts
|
|
19793
20074
|
/**
|
|
19794
20075
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -19829,7 +20110,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
19829
20110
|
if ($$.hasType("radar")) {
|
|
19830
20111
|
$el.radar = $el.main.select("." + $COMMON.chart).append("g").attr("class", $RADAR.chartRadars); // level
|
|
19831
20112
|
|
|
19832
|
-
$el.radar.levels = $el.radar.append("g").attr("class", $
|
|
20113
|
+
$el.radar.levels = $el.radar.append("g").attr("class", $LEVEL.levels); // axis
|
|
19833
20114
|
|
|
19834
20115
|
$el.radar.axes = $el.radar.append("g").attr("class", $AXIS.axis); // shapes
|
|
19835
20116
|
|
|
@@ -19950,11 +20231,11 @@ var cacheKey = KEY.radarPoints;
|
|
|
19950
20231
|
});
|
|
19951
20232
|
return pos.join(" ");
|
|
19952
20233
|
}),
|
|
19953
|
-
level = radarLevels.selectAll("." + $
|
|
20234
|
+
level = radarLevels.selectAll("." + $LEVEL.level).data(levelData);
|
|
19954
20235
|
|
|
19955
20236
|
level.exit().remove();
|
|
19956
20237
|
var levelEnter = level.enter().append("g").attr("class", function (d, i) {
|
|
19957
|
-
return $
|
|
20238
|
+
return $LEVEL.level + " " + $LEVEL.level + "-" + i;
|
|
19958
20239
|
});
|
|
19959
20240
|
levelEnter.append("polygon").style("visibility", config.radar_level_show ? null : "hidden");
|
|
19960
20241
|
|
|
@@ -20960,6 +21241,91 @@ var cacheKey = KEY.radarPoints;
|
|
|
20960
21241
|
pie_padding: 0,
|
|
20961
21242
|
pie_startingAngle: 0
|
|
20962
21243
|
});
|
|
21244
|
+
;// CONCATENATED MODULE: ./src/config/Options/shape/polar.ts
|
|
21245
|
+
/**
|
|
21246
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
21247
|
+
* billboard.js project is licensed under the MIT license
|
|
21248
|
+
*/
|
|
21249
|
+
|
|
21250
|
+
/**
|
|
21251
|
+
* x Axis config options
|
|
21252
|
+
*/
|
|
21253
|
+
/* harmony default export */ var shape_polar = ({
|
|
21254
|
+
/**
|
|
21255
|
+
* Set polar options
|
|
21256
|
+
* @name polar
|
|
21257
|
+
* @memberof Options
|
|
21258
|
+
* @type {object}
|
|
21259
|
+
* @property {object} polar Polar object
|
|
21260
|
+
* @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
|
|
21261
|
+
* @property {Function} [polar.label.format] Set formatter for the label on each polar piece.
|
|
21262
|
+
* @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
21263
|
+
* @property {number|Function} [polar.label.ratio=undefined] Set ratio of labels position.
|
|
21264
|
+
* @property {number} [polar.level.depth=3] Set the level depth.
|
|
21265
|
+
* @property {boolean} [polar.level.show=true] Show or hide level.
|
|
21266
|
+
* @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
|
|
21267
|
+
* @property {Function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
|
|
21268
|
+
* @property {boolean} [polar.level.text.show=true] Show or hide level text.
|
|
21269
|
+
* @property {number} [polar.padAngle=0] Set padding between data.
|
|
21270
|
+
* @property {number} [polar.padding=0] Sets the gap between pie arcs.
|
|
21271
|
+
* @property {number} [polar.startingAngle=0] Set starting angle where data draws.
|
|
21272
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
|
|
21273
|
+
* @example
|
|
21274
|
+
* polar: {
|
|
21275
|
+
* label: {
|
|
21276
|
+
* show: false,
|
|
21277
|
+
* format: function(value, ratio, id) {
|
|
21278
|
+
* return d3.format("$")(value);
|
|
21279
|
+
*
|
|
21280
|
+
* // to multiline, return with '\n' character
|
|
21281
|
+
* // return value +"%\nLine1\n2Line2";
|
|
21282
|
+
* },
|
|
21283
|
+
*
|
|
21284
|
+
* // 0.1(10%) ratio value means, the minimum ratio to show text label relative to the total value.
|
|
21285
|
+
* // if data value is below than 0.1, text label will be hidden.
|
|
21286
|
+
* threshold: 0.1,
|
|
21287
|
+
*
|
|
21288
|
+
* // set ratio callback. Should return ratio value
|
|
21289
|
+
* ratio: function(d, radius, h) {
|
|
21290
|
+
* ...
|
|
21291
|
+
* return ratio;
|
|
21292
|
+
* },
|
|
21293
|
+
* // or set ratio number
|
|
21294
|
+
* ratio: 0.5
|
|
21295
|
+
* },
|
|
21296
|
+
* level: {
|
|
21297
|
+
* depth: 3,
|
|
21298
|
+
* max: 500,
|
|
21299
|
+
* show: true,
|
|
21300
|
+
* text: {
|
|
21301
|
+
* format: function(x) {
|
|
21302
|
+
* return x + "%";
|
|
21303
|
+
* },
|
|
21304
|
+
* show: true,
|
|
21305
|
+
* backgroundColor: "red"
|
|
21306
|
+
* }
|
|
21307
|
+
* },
|
|
21308
|
+
* padAngle: 0.1,
|
|
21309
|
+
* padding: 0,
|
|
21310
|
+
* startingAngle: 1
|
|
21311
|
+
* }
|
|
21312
|
+
*/
|
|
21313
|
+
polar_label_show: !0,
|
|
21314
|
+
polar_label_format: undefined,
|
|
21315
|
+
polar_label_threshold: .05,
|
|
21316
|
+
polar_label_ratio: undefined,
|
|
21317
|
+
polar_level_depth: 3,
|
|
21318
|
+
polar_level_max: undefined,
|
|
21319
|
+
polar_level_show: !0,
|
|
21320
|
+
polar_level_text_backgroundColor: "#fff",
|
|
21321
|
+
polar_level_text_format: function polar_level_text_format(x) {
|
|
21322
|
+
return x % 1 === 0 ? x : x.toFixed(2);
|
|
21323
|
+
},
|
|
21324
|
+
polar_level_text_show: !0,
|
|
21325
|
+
polar_padAngle: 0,
|
|
21326
|
+
polar_padding: 0,
|
|
21327
|
+
polar_startingAngle: 0
|
|
21328
|
+
});
|
|
20963
21329
|
;// CONCATENATED MODULE: ./src/config/Options/shape/radar.ts
|
|
20964
21330
|
/**
|
|
20965
21331
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -21060,6 +21426,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
21060
21426
|
|
|
21061
21427
|
|
|
21062
21428
|
|
|
21429
|
+
|
|
21063
21430
|
// Options
|
|
21064
21431
|
|
|
21065
21432
|
|
|
@@ -21076,6 +21443,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
21076
21443
|
|
|
21077
21444
|
|
|
21078
21445
|
|
|
21446
|
+
|
|
21079
21447
|
/**
|
|
21080
21448
|
* Extend Axis
|
|
21081
21449
|
* @param {Array} module Module to be extended
|
|
@@ -21168,6 +21536,11 @@ var _area = function area() {
|
|
|
21168
21536
|
return extendArc(undefined, [pie]), (shape_pie = function () {
|
|
21169
21537
|
return TYPE.PIE;
|
|
21170
21538
|
})();
|
|
21539
|
+
},
|
|
21540
|
+
resolver_shape_polar = function () {
|
|
21541
|
+
return extendArc([polar], [shape_polar]), (resolver_shape_polar = function () {
|
|
21542
|
+
return TYPE.POLAR;
|
|
21543
|
+
})();
|
|
21171
21544
|
},
|
|
21172
21545
|
resolver_shape_radar = function () {
|
|
21173
21546
|
return extendArc([point, radar], [common_point, shape_radar]), (resolver_shape_radar = function () {
|
|
@@ -23035,7 +23408,7 @@ var _defaults = {},
|
|
|
23035
23408
|
* bb.version; // "1.0.0"
|
|
23036
23409
|
* @memberof bb
|
|
23037
23410
|
*/
|
|
23038
|
-
version: "3.
|
|
23411
|
+
version: "3.4.0-next.2",
|
|
23039
23412
|
|
|
23040
23413
|
/**
|
|
23041
23414
|
* Generate chart
|
|
@@ -23083,6 +23456,7 @@ var _defaults = {},
|
|
|
23083
23456
|
* gauge,
|
|
23084
23457
|
* line,
|
|
23085
23458
|
* pie,
|
|
23459
|
+
* polar,
|
|
23086
23460
|
* radar,
|
|
23087
23461
|
* scatter,
|
|
23088
23462
|
* spline,
|
|
@@ -23169,7 +23543,7 @@ var _defaults = {},
|
|
|
23169
23543
|
};
|
|
23170
23544
|
/**
|
|
23171
23545
|
* @namespace bb
|
|
23172
|
-
* @version 3.
|
|
23546
|
+
* @version 3.4.0-next.2
|
|
23173
23547
|
*/
|
|
23174
23548
|
;// CONCATENATED MODULE: ./src/index.ts
|
|
23175
23549
|
/**
|