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.pkgd.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
|
* All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
|
|
11
11
|
* - d3-axis ^3.0.0
|
|
@@ -1190,10 +1190,10 @@ var store = __webpack_require__(34);
|
|
|
1190
1190
|
(module.exports = function (key, value) {
|
|
1191
1191
|
return store[key] || (store[key] = value !== undefined ? value : {});
|
|
1192
1192
|
})('versions', []).push({
|
|
1193
|
-
version: '3.21.
|
|
1193
|
+
version: '3.21.1',
|
|
1194
1194
|
mode: IS_PURE ? 'pure' : 'global',
|
|
1195
1195
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
1196
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.21.
|
|
1196
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE',
|
|
1197
1197
|
source: 'https://github.com/zloirock/core-js'
|
|
1198
1198
|
});
|
|
1199
1199
|
|
|
@@ -3472,8 +3472,8 @@ var fails = __webpack_require__(6);
|
|
|
3472
3472
|
module.exports = function (METHOD_NAME, argument) {
|
|
3473
3473
|
var method = [][METHOD_NAME];
|
|
3474
3474
|
return !!method && fails(function () {
|
|
3475
|
-
// eslint-disable-next-line no-useless-call
|
|
3476
|
-
method.call(null, argument || function () {
|
|
3475
|
+
// eslint-disable-next-line no-useless-call -- required for testing
|
|
3476
|
+
method.call(null, argument || function () { return 1; }, 1);
|
|
3477
3477
|
});
|
|
3478
3478
|
};
|
|
3479
3479
|
|
|
@@ -16311,6 +16311,7 @@ __webpack_require__.d(resolver_shape_namespaceObject, {
|
|
|
16311
16311
|
"gauge": function() { return resolver_shape_gauge; },
|
|
16312
16312
|
"line": function() { return resolver_shape_line; },
|
|
16313
16313
|
"pie": function() { return resolver_shape_pie; },
|
|
16314
|
+
"polar": function() { return resolver_shape_polar; },
|
|
16314
16315
|
"radar": function() { return resolver_shape_radar; },
|
|
16315
16316
|
"scatter": function() { return shape_scatter; },
|
|
16316
16317
|
"spline": function() { return shape_spline; },
|
|
@@ -18345,6 +18346,7 @@ var TYPE = {
|
|
|
18345
18346
|
GAUGE: "gauge",
|
|
18346
18347
|
LINE: "line",
|
|
18347
18348
|
PIE: "pie",
|
|
18349
|
+
POLAR: "polar",
|
|
18348
18350
|
RADAR: "radar",
|
|
18349
18351
|
SCATTER: "scatter",
|
|
18350
18352
|
SPLINE: "spline",
|
|
@@ -18368,6 +18370,7 @@ var TYPE_METHOD_NEEDED = {
|
|
|
18368
18370
|
GAUGE: "initArc",
|
|
18369
18371
|
LINE: "initLine",
|
|
18370
18372
|
PIE: "initArc",
|
|
18373
|
+
POLAR: "initPolar",
|
|
18371
18374
|
RADAR: "initCircle",
|
|
18372
18375
|
SCATTER: "initCircle",
|
|
18373
18376
|
SPLINE: "initLine",
|
|
@@ -18381,7 +18384,7 @@ var TYPE_METHOD_NEEDED = {
|
|
|
18381
18384
|
var TYPE_BY_CATEGORY = {
|
|
18382
18385
|
Area: [TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.AREA_STEP],
|
|
18383
18386
|
AreaRange: [TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE],
|
|
18384
|
-
Arc: [TYPE.PIE, TYPE.DONUT, TYPE.GAUGE, TYPE.RADAR],
|
|
18387
|
+
Arc: [TYPE.PIE, TYPE.DONUT, TYPE.GAUGE, TYPE.POLAR, TYPE.RADAR],
|
|
18385
18388
|
Line: [TYPE.LINE, TYPE.SPLINE, TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.STEP, TYPE.AREA_STEP],
|
|
18386
18389
|
Step: [TYPE.STEP, TYPE.AREA_STEP],
|
|
18387
18390
|
Spline: [TYPE.SPLINE, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE]
|
|
@@ -21427,17 +21430,27 @@ function getBoundingRect(node) {
|
|
|
21427
21430
|
/**
|
|
21428
21431
|
* Retrun random number
|
|
21429
21432
|
* @param {boolean} asStr Convert returned value as string
|
|
21433
|
+
* @param {number} min Minimum value
|
|
21434
|
+
* @param {number} max Maximum value
|
|
21430
21435
|
* @returns {number|string}
|
|
21431
21436
|
* @private
|
|
21432
21437
|
*/
|
|
21433
21438
|
|
|
21434
21439
|
|
|
21435
|
-
function getRandom(asStr) {
|
|
21440
|
+
function getRandom(asStr, min, max) {
|
|
21436
21441
|
if (asStr === void 0) {
|
|
21437
21442
|
asStr = !0;
|
|
21438
21443
|
}
|
|
21439
21444
|
|
|
21440
|
-
|
|
21445
|
+
if (min === void 0) {
|
|
21446
|
+
min = 0;
|
|
21447
|
+
}
|
|
21448
|
+
|
|
21449
|
+
if (max === void 0) {
|
|
21450
|
+
max = 1e4;
|
|
21451
|
+
}
|
|
21452
|
+
|
|
21453
|
+
var rand = Math.floor(Math.random() * (max - min) + min);
|
|
21441
21454
|
return asStr ? rand + "" : rand;
|
|
21442
21455
|
}
|
|
21443
21456
|
/**
|
|
@@ -21911,26 +21924,36 @@ function isTabVisible() {
|
|
|
21911
21924
|
|
|
21912
21925
|
|
|
21913
21926
|
function convertInputType(mouse, touch) {
|
|
21914
|
-
var
|
|
21927
|
+
var DocumentTouch = win.DocumentTouch,
|
|
21928
|
+
matchMedia = win.matchMedia,
|
|
21929
|
+
navigator = win.navigator,
|
|
21930
|
+
hasTouch = !1;
|
|
21915
21931
|
|
|
21916
21932
|
if (touch) {
|
|
21917
21933
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
21918
|
-
if (
|
|
21919
|
-
hasTouch =
|
|
21934
|
+
if (navigator && "maxTouchPoints" in navigator) {
|
|
21935
|
+
hasTouch = navigator.maxTouchPoints > 0; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
21920
21936
|
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
21921
|
-
} else if ("ontouchmove" in win ||
|
|
21937
|
+
} else if ("ontouchmove" in win || DocumentTouch && browser_doc instanceof DocumentTouch) {
|
|
21922
21938
|
hasTouch = !0;
|
|
21923
21939
|
} else {
|
|
21924
21940
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
|
|
21925
|
-
|
|
21926
|
-
|
|
21927
|
-
|
|
21928
|
-
|
|
21941
|
+
if (matchMedia != null && matchMedia("(pointer:coarse)").matches) {
|
|
21942
|
+
hasTouch = !0;
|
|
21943
|
+
} else {
|
|
21944
|
+
// Only as a last resort, fall back to user agent sniffing
|
|
21945
|
+
var UA = navigator.userAgent;
|
|
21946
|
+
hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
|
21929
21947
|
}
|
|
21930
21948
|
}
|
|
21931
|
-
}
|
|
21949
|
+
} // 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
|
|
21950
|
+
// https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
|
|
21951
|
+
// Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
|
|
21952
|
+
|
|
21932
21953
|
|
|
21933
|
-
var hasMouse = mouse &&
|
|
21954
|
+
var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
21955
|
+
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
21956
|
+
});
|
|
21934
21957
|
return hasMouse && "mouse" || hasTouch && "touch" || null;
|
|
21935
21958
|
}
|
|
21936
21959
|
;// CONCATENATED MODULE: ./src/module/error.ts
|
|
@@ -22111,12 +22134,14 @@ var $GRID = {
|
|
|
22111
22134
|
ygridLines: "bb-ygrid-lines",
|
|
22112
22135
|
ygrids: "bb-ygrids"
|
|
22113
22136
|
};
|
|
22114
|
-
var $
|
|
22115
|
-
chartRadar: "bb-chart-radar",
|
|
22116
|
-
chartRadars: "bb-chart-radars",
|
|
22137
|
+
var $LEVEL = {
|
|
22117
22138
|
level: "bb-level",
|
|
22118
22139
|
levels: "bb-levels"
|
|
22119
22140
|
};
|
|
22141
|
+
var $RADAR = {
|
|
22142
|
+
chartRadar: "bb-chart-radar",
|
|
22143
|
+
chartRadars: "bb-chart-radars"
|
|
22144
|
+
};
|
|
22120
22145
|
var $REGION = {
|
|
22121
22146
|
region: "bb-region",
|
|
22122
22147
|
regions: "bb-regions"
|
|
@@ -22585,6 +22610,21 @@ var Store = /*#__PURE__*/function () {
|
|
|
22585
22610
|
*/
|
|
22586
22611
|
resize_auto: !0,
|
|
22587
22612
|
|
|
22613
|
+
/**
|
|
22614
|
+
* Set a callback to execute when the chart is clicked.
|
|
22615
|
+
* @name onclick
|
|
22616
|
+
* @memberof Options
|
|
22617
|
+
* @type {Function}
|
|
22618
|
+
* @default undefined
|
|
22619
|
+
* @example
|
|
22620
|
+
* onclick: function(event) {
|
|
22621
|
+
* this; // chart instance itself
|
|
22622
|
+
* event; // native event object
|
|
22623
|
+
* ...
|
|
22624
|
+
* }
|
|
22625
|
+
*/
|
|
22626
|
+
onclick: undefined,
|
|
22627
|
+
|
|
22588
22628
|
/**
|
|
22589
22629
|
* Set a callback to execute when mouse/touch enters the chart.
|
|
22590
22630
|
* @name onover
|
|
@@ -22592,8 +22632,9 @@ var Store = /*#__PURE__*/function () {
|
|
|
22592
22632
|
* @type {Function}
|
|
22593
22633
|
* @default undefined
|
|
22594
22634
|
* @example
|
|
22595
|
-
* onover: function() {
|
|
22635
|
+
* onover: function(event) {
|
|
22596
22636
|
* this; // chart instance itself
|
|
22637
|
+
* event; // native event object
|
|
22597
22638
|
* ...
|
|
22598
22639
|
* }
|
|
22599
22640
|
*/
|
|
@@ -22606,8 +22647,9 @@ var Store = /*#__PURE__*/function () {
|
|
|
22606
22647
|
* @type {Function}
|
|
22607
22648
|
* @default undefined
|
|
22608
22649
|
* @example
|
|
22609
|
-
* onout: function() {
|
|
22650
|
+
* onout: function(event) {
|
|
22610
22651
|
* this; // chart instance itself
|
|
22652
|
+
* event; // native event object
|
|
22611
22653
|
* ...
|
|
22612
22654
|
* }
|
|
22613
22655
|
*/
|
|
@@ -22889,6 +22931,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
22889
22931
|
* - gauge
|
|
22890
22932
|
* - line
|
|
22891
22933
|
* - pie
|
|
22934
|
+
* - polar
|
|
22892
22935
|
* - radar
|
|
22893
22936
|
* - scatter
|
|
22894
22937
|
* - spline
|
|
@@ -22917,6 +22960,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
22917
22960
|
* gauge,
|
|
22918
22961
|
* line,
|
|
22919
22962
|
* pie,
|
|
22963
|
+
* polar,
|
|
22920
22964
|
* radar,
|
|
22921
22965
|
* scatter,
|
|
22922
22966
|
* spline,
|
|
@@ -22963,6 +23007,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
22963
23007
|
* gauge,
|
|
22964
23008
|
* line,
|
|
22965
23009
|
* pie,
|
|
23010
|
+
* polar,
|
|
22966
23011
|
* radar,
|
|
22967
23012
|
* scatter,
|
|
22968
23013
|
* spline,
|
|
@@ -24367,28 +24412,32 @@ function generateResize() {
|
|
|
24367
24412
|
|
|
24368
24413
|
return callResizeFn;
|
|
24369
24414
|
}
|
|
24415
|
+
|
|
24370
24416
|
/**
|
|
24371
24417
|
* Generate transition queue function
|
|
24372
24418
|
* @returns {Function}
|
|
24373
24419
|
* @private
|
|
24374
24420
|
*/
|
|
24375
|
-
|
|
24376
24421
|
function generateWait() {
|
|
24377
24422
|
var transitionsToWait = [],
|
|
24378
|
-
f = function (
|
|
24379
|
-
var timer;
|
|
24423
|
+
f = function (selection, callback) {
|
|
24424
|
+
var timer;
|
|
24425
|
+
/**
|
|
24426
|
+
* Check if transition is complete
|
|
24427
|
+
* @private
|
|
24428
|
+
*/
|
|
24380
24429
|
|
|
24381
24430
|
function loop() {
|
|
24382
24431
|
var done = 0;
|
|
24383
24432
|
|
|
24384
|
-
for (var i = 0,
|
|
24385
|
-
if (
|
|
24433
|
+
for (var i = 0, t; t = transitionsToWait[i]; i++) {
|
|
24434
|
+
if (t === !0 || t.empty != null && t.empty()) {
|
|
24386
24435
|
done++;
|
|
24387
24436
|
continue;
|
|
24388
24437
|
}
|
|
24389
24438
|
|
|
24390
24439
|
try {
|
|
24391
|
-
|
|
24440
|
+
t.transition();
|
|
24392
24441
|
} catch (e) {
|
|
24393
24442
|
done++;
|
|
24394
24443
|
}
|
|
@@ -24404,7 +24453,8 @@ function generateWait() {
|
|
|
24404
24453
|
}
|
|
24405
24454
|
|
|
24406
24455
|
loop();
|
|
24407
|
-
};
|
|
24456
|
+
}; // 'f' is called as selection.call(f, ...);
|
|
24457
|
+
|
|
24408
24458
|
|
|
24409
24459
|
f.add = function (t) {
|
|
24410
24460
|
isArray(t) ? transitionsToWait = transitionsToWait.concat(t) : transitionsToWait.push(t);
|
|
@@ -27220,14 +27270,15 @@ var colorizePattern = function (pattern, color, id) {
|
|
|
27220
27270
|
|
|
27221
27271
|
/**
|
|
27222
27272
|
* Append data backgound color filter definition
|
|
27273
|
+
* @param {string} color Color string
|
|
27223
27274
|
* @private
|
|
27224
27275
|
*/
|
|
27225
|
-
generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter() {
|
|
27276
|
+
generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter(color) {
|
|
27226
27277
|
var $$ = this,
|
|
27227
27278
|
$el = $$.$el,
|
|
27228
27279
|
config = $$.config,
|
|
27229
27280
|
state = $$.state,
|
|
27230
|
-
backgroundColors = config.data_labels_backgroundColors;
|
|
27281
|
+
backgroundColors = color || config.data_labels_backgroundColors;
|
|
27231
27282
|
|
|
27232
27283
|
if (backgroundColors) {
|
|
27233
27284
|
var ids = [];
|
|
@@ -27239,7 +27290,7 @@ var colorizePattern = function (pattern, color, id) {
|
|
|
27239
27290
|
}
|
|
27240
27291
|
|
|
27241
27292
|
ids.forEach(function (v) {
|
|
27242
|
-
var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v);
|
|
27293
|
+
var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v) + (color ? $$.getTargetSelectorSuffix(color) : "");
|
|
27243
27294
|
$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\"/>");
|
|
27244
27295
|
});
|
|
27245
27296
|
}
|
|
@@ -27729,7 +27780,7 @@ function getFormat($$, typeValue, v) {
|
|
|
27729
27780
|
defaultArcValueFormat = $$.defaultArcValueFormat,
|
|
27730
27781
|
yFormat = $$.yFormat,
|
|
27731
27782
|
y2Format = $$.y2Format,
|
|
27732
|
-
hasArc = $$.hasArcType(null, ["gauge", "radar"]);
|
|
27783
|
+
hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
|
|
27733
27784
|
return function (v, ratio, id) {
|
|
27734
27785
|
var format = hasArc ? defaultArcValueFormat : $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat;
|
|
27735
27786
|
return format.call($$, v, ratio);
|
|
@@ -27741,6 +27792,9 @@ function getFormat($$, typeValue, v) {
|
|
|
27741
27792
|
defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
|
|
27742
27793
|
return (ratio * 100).toFixed(1) + "%";
|
|
27743
27794
|
},
|
|
27795
|
+
defaultPolarValueFormat: function defaultPolarValueFormat(v) {
|
|
27796
|
+
return "" + v;
|
|
27797
|
+
},
|
|
27744
27798
|
dataLabelFormat: function dataLabelFormat(targetId) {
|
|
27745
27799
|
var $$ = this,
|
|
27746
27800
|
dataLabels = $$.config.data_labels,
|
|
@@ -28503,7 +28557,9 @@ function getFormat($$, typeValue, v) {
|
|
|
28503
28557
|
// arc
|
|
28504
28558
|
$el.arcs && $$.redrawArc(duration, durationForExit, wth.Transform); // radar
|
|
28505
28559
|
|
|
28506
|
-
$el.radar && $$.redrawRadar();
|
|
28560
|
+
$el.radar && $$.redrawRadar(); // polar
|
|
28561
|
+
|
|
28562
|
+
$el.polar && $$.redrawPolar();
|
|
28507
28563
|
} // @TODO: Axis & Radar type
|
|
28508
28564
|
|
|
28509
28565
|
|
|
@@ -33244,6 +33300,9 @@ function getTextPos(pos, width) {
|
|
|
33244
33300
|
} else if (target === "arc") {
|
|
33245
33301
|
x = state.arcWidth / 2;
|
|
33246
33302
|
y = state.arcHeight / 2;
|
|
33303
|
+
} else if (target === "polar") {
|
|
33304
|
+
x = state.arcWidth / 2;
|
|
33305
|
+
y = state.arcHeight / 2;
|
|
33247
33306
|
} else if (target === "radar") {
|
|
33248
33307
|
var _$$$getRadarSize = $$.getRadarSize(),
|
|
33249
33308
|
width = _$$$getRadarSize[0];
|
|
@@ -33459,11 +33518,14 @@ function getTextPos(pos, width) {
|
|
|
33459
33518
|
isDonutType: function isDonutType(d) {
|
|
33460
33519
|
return this.isTypeOf(d, "donut");
|
|
33461
33520
|
},
|
|
33521
|
+
isPolarType: function isPolarType(d) {
|
|
33522
|
+
return this.isTypeOf(d, "polar");
|
|
33523
|
+
},
|
|
33462
33524
|
isRadarType: function isRadarType(d) {
|
|
33463
33525
|
return this.isTypeOf(d, "radar");
|
|
33464
33526
|
},
|
|
33465
33527
|
isArcType: function isArcType(d) {
|
|
33466
|
-
return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isRadarType(d);
|
|
33528
|
+
return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isPolarType(d) || this.isRadarType(d);
|
|
33467
33529
|
},
|
|
33468
33530
|
// determine if is 'circle' data point
|
|
33469
33531
|
isCirclePoint: function isCirclePoint(node) {
|
|
@@ -33743,13 +33805,12 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
33743
33805
|
|
|
33744
33806
|
_proto.initParams = function initParams() {
|
|
33745
33807
|
var $$ = this,
|
|
33746
|
-
|
|
33747
|
-
|
|
33748
|
-
|
|
33749
|
-
state = _ref.state,
|
|
33808
|
+
config = $$.config,
|
|
33809
|
+
format = $$.format,
|
|
33810
|
+
state = $$.state,
|
|
33750
33811
|
isRotated = config.axis_rotated;
|
|
33751
33812
|
// datetime to be used for uniqueness
|
|
33752
|
-
state.datetimeId = "bb-" + +new Date();
|
|
33813
|
+
state.datetimeId = "bb-" + +new Date() * getRandom();
|
|
33753
33814
|
$$.color = $$.generateColor();
|
|
33754
33815
|
$$.levelColor = $$.generateLevelColor();
|
|
33755
33816
|
|
|
@@ -33791,7 +33852,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
33791
33852
|
$el = $$.$el,
|
|
33792
33853
|
org = $$.org,
|
|
33793
33854
|
hasAxis = state.hasAxis,
|
|
33794
|
-
hasInteraction = config.interaction_enabled
|
|
33855
|
+
hasInteraction = config.interaction_enabled,
|
|
33856
|
+
hasPolar = $$.hasType("polar");
|
|
33795
33857
|
|
|
33796
33858
|
// for arc type, set axes to not be shown
|
|
33797
33859
|
// $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
|
|
@@ -33849,26 +33911,30 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
33849
33911
|
$el.svg = $el.chart.append("svg").style("overflow", "hidden").style("display", "block");
|
|
33850
33912
|
|
|
33851
33913
|
if (hasInteraction && state.inputType) {
|
|
33852
|
-
var
|
|
33853
|
-
|
|
33854
|
-
|
|
33855
|
-
|
|
33856
|
-
|
|
33857
|
-
|
|
33914
|
+
var _onclick,
|
|
33915
|
+
_onover,
|
|
33916
|
+
_onout,
|
|
33917
|
+
isTouch = state.inputType === "touch",
|
|
33918
|
+
_config = config,
|
|
33919
|
+
onclick = _config.onclick,
|
|
33920
|
+
onover = _config.onover,
|
|
33921
|
+
onout = _config.onout;
|
|
33922
|
+
|
|
33923
|
+
$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);
|
|
33858
33924
|
}
|
|
33859
33925
|
|
|
33860
33926
|
config.svg_classname && $el.svg.attr("class", config.svg_classname); // Define defs
|
|
33861
33927
|
|
|
33862
33928
|
var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
|
33863
33929
|
|
|
33864
|
-
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
|
|
33930
|
+
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
|
|
33865
33931
|
$el.defs = $el.svg.append("defs");
|
|
33866
33932
|
|
|
33867
33933
|
if (hasAxis) {
|
|
33868
33934
|
["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
|
33869
33935
|
$$.appendClip($el.defs, state.clip[v]);
|
|
33870
33936
|
});
|
|
33871
|
-
} // Append data
|
|
33937
|
+
} // Append data background color filter definition
|
|
33872
33938
|
|
|
33873
33939
|
|
|
33874
33940
|
$$.generateDataLabelBackgroundColorFilter(); // set color patterns
|
|
@@ -33971,6 +34037,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
33971
34037
|
}
|
|
33972
34038
|
});
|
|
33973
34039
|
} else {
|
|
34040
|
+
var hasPolar = $$.hasType("polar");
|
|
34041
|
+
|
|
33974
34042
|
if (!hasRadar) {
|
|
33975
34043
|
types.push("Arc", "Pie");
|
|
33976
34044
|
}
|
|
@@ -33979,6 +34047,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
33979
34047
|
types.push("Gauge");
|
|
33980
34048
|
} else if (hasRadar) {
|
|
33981
34049
|
types.push("Radar");
|
|
34050
|
+
} else if (hasPolar) {
|
|
34051
|
+
types.push("Polar");
|
|
33982
34052
|
}
|
|
33983
34053
|
}
|
|
33984
34054
|
|
|
@@ -34070,7 +34140,11 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
34070
34140
|
var $$ = this,
|
|
34071
34141
|
_$$$state2 = $$.state,
|
|
34072
34142
|
hasAxis = _$$$state2.hasAxis,
|
|
34073
|
-
hasRadar = _$$$state2.hasRadar
|
|
34143
|
+
hasRadar = _$$$state2.hasRadar,
|
|
34144
|
+
helper = function (type) {
|
|
34145
|
+
return $$["updateTargetsFor" + type](targets.filter($$["is" + type + "Type"].bind($$)));
|
|
34146
|
+
};
|
|
34147
|
+
|
|
34074
34148
|
// Text
|
|
34075
34149
|
$$.updateTargetsForText(targets);
|
|
34076
34150
|
|
|
@@ -34079,14 +34153,21 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
34079
34153
|
var name = capitalize(v);
|
|
34080
34154
|
|
|
34081
34155
|
if (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) {
|
|
34082
|
-
|
|
34156
|
+
helper(name);
|
|
34083
34157
|
}
|
|
34084
34158
|
}); // Sub Chart
|
|
34085
34159
|
|
|
34086
|
-
$$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets);
|
|
34087
|
-
} else {
|
|
34088
|
-
|
|
34089
|
-
|
|
34160
|
+
$$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets); // Arc, Polar, Radar
|
|
34161
|
+
} else if ($$.hasArcType(targets)) {
|
|
34162
|
+
var _type = "Arc";
|
|
34163
|
+
|
|
34164
|
+
if (hasRadar) {
|
|
34165
|
+
_type = "Radar";
|
|
34166
|
+
} else if ($$.hasType("polar")) {
|
|
34167
|
+
_type = "Polar";
|
|
34168
|
+
}
|
|
34169
|
+
|
|
34170
|
+
helper(_type);
|
|
34090
34171
|
} // circle
|
|
34091
34172
|
|
|
34092
34173
|
|
|
@@ -34849,7 +34930,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
34849
34930
|
candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
|
34850
34931
|
candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !0);
|
|
34851
34932
|
|
|
34852
|
-
if ($$.hasArcType()) {
|
|
34933
|
+
if ($$.hasArcType(null, ["polar"])) {
|
|
34853
34934
|
$$.unexpandArc(targetIds);
|
|
34854
34935
|
$$.hasType("gauge") && $$.undoMarkOverlapped($$, "." + $GAUGE.gaugeValue);
|
|
34855
34936
|
}
|
|
@@ -34887,7 +34968,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
34887
34968
|
candidates = $el.svg.selectAll($$.selectorTargets(targetIds));
|
|
34888
34969
|
// should be for all targets
|
|
34889
34970
|
candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !1);
|
|
34890
|
-
$$.hasArcType() && $$.unexpandArc(targetIds);
|
|
34971
|
+
$$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
|
|
34891
34972
|
|
|
34892
34973
|
if (config.legend_show) {
|
|
34893
34974
|
$$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
|
|
@@ -35591,6 +35672,7 @@ util_extend(Chart.prototype, [chart, api_color, api_data, api_export, api_focus,
|
|
|
35591
35672
|
* billboard.js project is licensed under the MIT license
|
|
35592
35673
|
*/
|
|
35593
35674
|
|
|
35675
|
+
|
|
35594
35676
|
/**
|
|
35595
35677
|
* Set the min/max value
|
|
35596
35678
|
* @param {Chart} $$ Chart instance
|
|
@@ -35598,20 +35680,26 @@ util_extend(Chart.prototype, [chart, api_color, api_data, api_export, api_focus,
|
|
|
35598
35680
|
* @param {object} value Value to be set
|
|
35599
35681
|
* @private
|
|
35600
35682
|
*/
|
|
35601
|
-
|
|
35602
35683
|
function setMinMax($$, type, value) {
|
|
35603
35684
|
var config = $$.config,
|
|
35604
|
-
|
|
35605
|
-
|
|
35685
|
+
helper = function (key, value) {
|
|
35686
|
+
var v = isNumber(value) ? value : value === !1 ? undefined : null;
|
|
35687
|
+
|
|
35688
|
+
if (v !== null) {
|
|
35689
|
+
config["axis_" + key + "_" + type] = v;
|
|
35690
|
+
}
|
|
35691
|
+
};
|
|
35606
35692
|
|
|
35607
35693
|
if (isDefined(value)) {
|
|
35608
35694
|
if (isObjectType(value)) {
|
|
35609
|
-
|
|
35610
|
-
|
|
35611
|
-
|
|
35612
|
-
} else {
|
|
35613
|
-
|
|
35614
|
-
|
|
35695
|
+
Object.keys(value).forEach(function (key) {
|
|
35696
|
+
helper(key, value[key]);
|
|
35697
|
+
});
|
|
35698
|
+
} else if (isNumber(value) || value === !1) {
|
|
35699
|
+
// shorthand values affects only y and y2.
|
|
35700
|
+
["y", "y2"].forEach(function (key) {
|
|
35701
|
+
helper(key, value);
|
|
35702
|
+
});
|
|
35615
35703
|
}
|
|
35616
35704
|
|
|
35617
35705
|
$$.redraw({
|
|
@@ -35697,8 +35785,9 @@ var axis = {
|
|
|
35697
35785
|
* @instance
|
|
35698
35786
|
* @memberof Chart
|
|
35699
35787
|
* @param {object} min If min is given, specified axis' min value will be updated.<br>
|
|
35700
|
-
*
|
|
35701
|
-
*
|
|
35788
|
+
* If no argument is given, the min values set on generating option for each axis will be returned.
|
|
35789
|
+
* If not set any min values on generation, it will return `undefined`.<br>
|
|
35790
|
+
* To unset specific axis max, set `false` to each of them.
|
|
35702
35791
|
* @returns {object|undefined}
|
|
35703
35792
|
* @example
|
|
35704
35793
|
* // Update axis' min
|
|
@@ -35707,10 +35796,21 @@ var axis = {
|
|
|
35707
35796
|
* y: 1000,
|
|
35708
35797
|
* y2: 100
|
|
35709
35798
|
* });
|
|
35799
|
+
*
|
|
35800
|
+
* // To unset specific axis min, set false to each of them.
|
|
35801
|
+
* chart.axis.min({
|
|
35802
|
+
* x: false,
|
|
35803
|
+
* y: false,
|
|
35804
|
+
* y2: false
|
|
35805
|
+
* });
|
|
35806
|
+
*
|
|
35807
|
+
* // shorthand (only affects y and y2 axis)
|
|
35808
|
+
* chart.axis.min(-50);
|
|
35809
|
+
* chart.axis.min(false);
|
|
35710
35810
|
*/
|
|
35711
35811
|
min: function min(_min) {
|
|
35712
35812
|
var $$ = this.internal;
|
|
35713
|
-
return isValue(_min) ? setMinMax($$, "min", _min) : axis_getMinMax($$, "min");
|
|
35813
|
+
return isValue(_min) || _min === !1 ? setMinMax($$, "min", _min) : axis_getMinMax($$, "min");
|
|
35714
35814
|
},
|
|
35715
35815
|
|
|
35716
35816
|
/**
|
|
@@ -35719,8 +35819,9 @@ var axis = {
|
|
|
35719
35819
|
* @instance
|
|
35720
35820
|
* @memberof Chart
|
|
35721
35821
|
* @param {object} max If max is given, specified axis' max value will be updated.<br>
|
|
35722
|
-
*
|
|
35723
|
-
*
|
|
35822
|
+
* If no argument is given, the max values set on generating option for each axis will be returned.
|
|
35823
|
+
* If not set any max values on generation, it will return `undefined`.<br>
|
|
35824
|
+
* To unset specific axis max, set `false` to each of them.
|
|
35724
35825
|
* @returns {object|undefined}
|
|
35725
35826
|
* @example
|
|
35726
35827
|
* // Update axis' label
|
|
@@ -35729,10 +35830,21 @@ var axis = {
|
|
|
35729
35830
|
* y: 1000,
|
|
35730
35831
|
* y2: 10000
|
|
35731
35832
|
* });
|
|
35833
|
+
*
|
|
35834
|
+
* // To unset specific axis max, set false to each of them.
|
|
35835
|
+
* chart.axis.max({
|
|
35836
|
+
* x: false,
|
|
35837
|
+
* y: false,
|
|
35838
|
+
* y2: false
|
|
35839
|
+
* });
|
|
35840
|
+
*
|
|
35841
|
+
* // shorthand (only affects y and y2 axis)
|
|
35842
|
+
* chart.axis.max(10);
|
|
35843
|
+
* chart.axis.max(false);
|
|
35732
35844
|
*/
|
|
35733
35845
|
max: function max(_max) {
|
|
35734
35846
|
var $$ = this.internal;
|
|
35735
|
-
return
|
|
35847
|
+
return isValue(_max) || _max === !1 ? setMinMax($$, "max", _max) : axis_getMinMax($$, "max");
|
|
35736
35848
|
},
|
|
35737
35849
|
|
|
35738
35850
|
/**
|
|
@@ -35740,7 +35852,9 @@ var axis = {
|
|
|
35740
35852
|
* @function axis․range
|
|
35741
35853
|
* @instance
|
|
35742
35854
|
* @memberof Chart
|
|
35743
|
-
* @param {object} range If range is given, specified axis' min and max value will be updated.
|
|
35855
|
+
* @param {object} range If range is given, specified axis' min and max value will be updated.
|
|
35856
|
+
* If no argument is given, the current min and max values for each axis will be returned.<br>
|
|
35857
|
+
* To unset specific axis max, set `false` to each of them.
|
|
35744
35858
|
* @returns {object|undefined}
|
|
35745
35859
|
* @example
|
|
35746
35860
|
* // Update axis' label
|
|
@@ -35756,13 +35870,33 @@ var axis = {
|
|
|
35756
35870
|
* y2: 10000
|
|
35757
35871
|
* },
|
|
35758
35872
|
* });
|
|
35873
|
+
*
|
|
35874
|
+
* // To unset specific axis max, set false to each of them.
|
|
35875
|
+
* chart.axis.range({
|
|
35876
|
+
* min: {
|
|
35877
|
+
* x: false,
|
|
35878
|
+
* y: false,
|
|
35879
|
+
* y2: false
|
|
35880
|
+
* },
|
|
35881
|
+
* max: {
|
|
35882
|
+
* x: false,
|
|
35883
|
+
* y: false,
|
|
35884
|
+
* y2: false
|
|
35885
|
+
* },
|
|
35886
|
+
* });
|
|
35887
|
+
*
|
|
35888
|
+
* // shorthand (only affects y and y2 axis)
|
|
35889
|
+
* chart.axis.range({ min: -50, max: 1000 });
|
|
35890
|
+
* chart.axis.range({ min: false, max: false });
|
|
35759
35891
|
*/
|
|
35760
35892
|
range: function range(_range) {
|
|
35761
35893
|
var axis = this.axis;
|
|
35762
35894
|
|
|
35763
35895
|
if (arguments.length) {
|
|
35764
|
-
|
|
35765
|
-
|
|
35896
|
+
var min = _range.min,
|
|
35897
|
+
max = _range.max;
|
|
35898
|
+
isDefined(max) && axis.max(max);
|
|
35899
|
+
isDefined(min) && axis.min(min);
|
|
35766
35900
|
} else {
|
|
35767
35901
|
return {
|
|
35768
35902
|
max: axis.max(),
|
|
@@ -38080,7 +38214,7 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
38080
38214
|
var prefix = "axis_" + key + "_",
|
|
38081
38215
|
axisScale = scale[key];
|
|
38082
38216
|
|
|
38083
|
-
if (
|
|
38217
|
+
if (axisScale) {
|
|
38084
38218
|
var tickValues = config[prefix + "tick_values"],
|
|
38085
38219
|
tickCount = config[prefix + "tick_count"];
|
|
38086
38220
|
axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
|
|
@@ -38148,8 +38282,10 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
38148
38282
|
}
|
|
38149
38283
|
|
|
38150
38284
|
tickNodes.each(function (d) {
|
|
38151
|
-
|
|
38152
|
-
|
|
38285
|
+
var node = lines ? this.querySelector("text") : this;
|
|
38286
|
+
|
|
38287
|
+
if (node) {
|
|
38288
|
+
node.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null;
|
|
38153
38289
|
}
|
|
38154
38290
|
});
|
|
38155
38291
|
} else {
|
|
@@ -38887,7 +39023,9 @@ var src_linear_linear = function (t) {
|
|
|
38887
39023
|
} else if (orgDataCount === 1 || ((_flowStart = flowStart) == null ? void 0 : _flowStart.x) === ((_flowEnd = flowEnd) == null ? void 0 : _flowEnd.x)) {
|
|
38888
39024
|
translateX = x(orgDomain[0]) - x(domain[0]);
|
|
38889
39025
|
} else {
|
|
38890
|
-
|
|
39026
|
+
var _flowStart2;
|
|
39027
|
+
|
|
39028
|
+
translateX = $$.axis.isTimeSeries() ? x(orgDomain[0]) - x(domain[0]) : x(((_flowStart2 = flowStart) == null ? void 0 : _flowStart2.x) || 0) - x(flowEnd.x);
|
|
38891
39029
|
}
|
|
38892
39030
|
|
|
38893
39031
|
var scaleX = diffDomain(orgDomain) / diffDomain(domain);
|
|
@@ -42105,9 +42243,9 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
|
42105
42243
|
var $$ = this,
|
|
42106
42244
|
config = $$.config,
|
|
42107
42245
|
dataType = config.data_type,
|
|
42108
|
-
padding = config
|
|
42246
|
+
padding = config[dataType + "_padding"],
|
|
42109
42247
|
startingAngle = config[dataType + "_startingAngle"] || 0,
|
|
42110
|
-
padAngle = (
|
|
42248
|
+
padAngle = (padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
|
|
42111
42249
|
$$.pie = pie().startAngle(startingAngle).endAngle(startingAngle + 2 * Math.PI).padAngle(padAngle).value(function (d) {
|
|
42112
42250
|
return d.values.reduce(function (a, b) {
|
|
42113
42251
|
return a + b.value;
|
|
@@ -42118,7 +42256,8 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
|
42118
42256
|
var $$ = this,
|
|
42119
42257
|
config = $$.config,
|
|
42120
42258
|
state = $$.state,
|
|
42121
|
-
|
|
42259
|
+
dataType = config.data_type,
|
|
42260
|
+
padding = config[dataType + "_padding"],
|
|
42122
42261
|
w = config.gauge_width || config.donut_width,
|
|
42123
42262
|
gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
|
|
42124
42263
|
// determine radius
|
|
@@ -42253,6 +42392,7 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
|
42253
42392
|
state = $$.state,
|
|
42254
42393
|
singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
|
|
42255
42394
|
hasMultiArcGauge = $$.hasMultiArcGauge(),
|
|
42395
|
+
hasPolar = $$.hasType("polar"),
|
|
42256
42396
|
arc = src_arc().innerRadius(function (d) {
|
|
42257
42397
|
var _$$$getRadius = $$.getRadius(d),
|
|
42258
42398
|
innerRadius = _$$$getRadius.innerRadius;
|
|
@@ -42260,9 +42400,16 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
|
42260
42400
|
return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : isNumber(innerRadius) ? innerRadius : 0;
|
|
42261
42401
|
}).outerRadius(function (d) {
|
|
42262
42402
|
var _$$$getRadius2 = $$.getRadius(d),
|
|
42263
|
-
outerRadius = _$$$getRadius2.outerRadius
|
|
42403
|
+
outerRadius = _$$$getRadius2.outerRadius,
|
|
42404
|
+
radius = outerRadius;
|
|
42405
|
+
|
|
42406
|
+
if (hasMultiArcGauge) {
|
|
42407
|
+
radius = state.radius - singleArcWidth * d.index;
|
|
42408
|
+
} else if (hasPolar) {
|
|
42409
|
+
radius = $$.getPolarOuterRadius(d, outerRadius);
|
|
42410
|
+
}
|
|
42264
42411
|
|
|
42265
|
-
return
|
|
42412
|
+
return radius;
|
|
42266
42413
|
}),
|
|
42267
42414
|
newArc = function (d, withoutUpdate) {
|
|
42268
42415
|
var path = "M 0 0";
|
|
@@ -42320,6 +42467,13 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
|
42320
42467
|
getArc: function getArc(d, withoutUpdate, force) {
|
|
42321
42468
|
return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
|
|
42322
42469
|
},
|
|
42470
|
+
|
|
42471
|
+
/**
|
|
42472
|
+
* Set transform attributes to arc label text
|
|
42473
|
+
* @param {Object} d Data object
|
|
42474
|
+
* @returns {string} Translate attribute string
|
|
42475
|
+
* @private
|
|
42476
|
+
*/
|
|
42323
42477
|
transformForArcLabel: function transformForArcLabel(d) {
|
|
42324
42478
|
var $$ = this,
|
|
42325
42479
|
config = $$.config,
|
|
@@ -42334,16 +42488,24 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
|
42334
42488
|
y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
|
|
42335
42489
|
translate = "translate(" + x + "," + y + ")";
|
|
42336
42490
|
} else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
42337
|
-
var
|
|
42338
|
-
|
|
42339
|
-
|
|
42491
|
+
var _filter$map,
|
|
42492
|
+
_$$$getRadius4 = $$.getRadius(d),
|
|
42493
|
+
outerRadius = _$$$getRadius4.outerRadius;
|
|
42494
|
+
|
|
42495
|
+
if ($$.hasType("polar")) {
|
|
42496
|
+
outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
42497
|
+
}
|
|
42498
|
+
|
|
42499
|
+
var c = this.svgArc.centroid(updated),
|
|
42340
42500
|
_c$map = c.map(function (v) {
|
|
42341
42501
|
return isNaN(v) ? 0 : v;
|
|
42342
42502
|
}),
|
|
42343
42503
|
x = _c$map[0],
|
|
42344
42504
|
y = _c$map[1],
|
|
42345
42505
|
h = Math.sqrt(x * x + y * y),
|
|
42346
|
-
ratio =
|
|
42506
|
+
ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
|
|
42507
|
+
return config[v + "_label_ratio"];
|
|
42508
|
+
})) == null ? void 0 : _filter$map[0];
|
|
42347
42509
|
|
|
42348
42510
|
if (ratio) {
|
|
42349
42511
|
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
|
@@ -42371,10 +42533,11 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
|
42371
42533
|
|
|
42372
42534
|
if ($$.shouldShowArcLabel()) {
|
|
42373
42535
|
selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.updateTextBacgroundColor.bind($$)).each(function (d) {
|
|
42374
|
-
var
|
|
42536
|
+
var _filter,
|
|
42537
|
+
node = src_select(this),
|
|
42375
42538
|
updated = $$.updateAngle(d),
|
|
42376
42539
|
ratio = $$.getRatio("arc", updated),
|
|
42377
|
-
isUnderThreshold = $$.meetsLabelThreshold(ratio,
|
|
42540
|
+
isUnderThreshold = $$.meetsLabelThreshold(ratio, (_filter = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _filter[0]);
|
|
42378
42541
|
|
|
42379
42542
|
if (isUnderThreshold) {
|
|
42380
42543
|
var value = (updated || d).value,
|
|
@@ -42462,21 +42625,20 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
|
42462
42625
|
shouldShowArcLabel: function shouldShowArcLabel() {
|
|
42463
42626
|
var $$ = this,
|
|
42464
42627
|
config = $$.config;
|
|
42465
|
-
return ["
|
|
42628
|
+
return ["donut", "gauge", "pie", "polar"].some(function (v) {
|
|
42466
42629
|
return $$.hasType(v) && config[v + "_label_show"];
|
|
42467
42630
|
});
|
|
42468
42631
|
},
|
|
42469
42632
|
getArcLabelFormat: function getArcLabelFormat() {
|
|
42470
42633
|
var $$ = this,
|
|
42471
42634
|
config = $$.config,
|
|
42472
|
-
format =
|
|
42473
|
-
|
|
42474
|
-
|
|
42475
|
-
format = config.gauge_label_format;
|
|
42476
|
-
} else if ($$.hasType("donut")) {
|
|
42477
|
-
format = config.donut_label_format;
|
|
42478
|
-
}
|
|
42635
|
+
format = function (v) {
|
|
42636
|
+
return v;
|
|
42637
|
+
};
|
|
42479
42638
|
|
|
42639
|
+
["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).forEach(function (v) {
|
|
42640
|
+
format = config[v + "_label_format"];
|
|
42641
|
+
});
|
|
42480
42642
|
return isFunction(format) ? format.bind($$.api) : format;
|
|
42481
42643
|
},
|
|
42482
42644
|
getArcTitle: function getArcTitle() {
|
|
@@ -42608,6 +42770,7 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
|
42608
42770
|
}); // bind arc events
|
|
42609
42771
|
|
|
42610
42772
|
hasInteraction && $$.bindArcEvent(mainArc);
|
|
42773
|
+
$$.hasType("polar") && $$.redrawPolar();
|
|
42611
42774
|
$$.hasType("gauge") && $$.redrawBackgroundArcs();
|
|
42612
42775
|
$$.redrawArcText(duration);
|
|
42613
42776
|
},
|
|
@@ -44588,6 +44751,124 @@ var getTransitionName = function () {
|
|
|
44588
44751
|
}
|
|
44589
44752
|
}
|
|
44590
44753
|
});
|
|
44754
|
+
;// CONCATENATED MODULE: ./src/ChartInternal/shape/polar.ts
|
|
44755
|
+
/**
|
|
44756
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
44757
|
+
* billboard.js project is licensed under the MIT license
|
|
44758
|
+
*/
|
|
44759
|
+
|
|
44760
|
+
|
|
44761
|
+
|
|
44762
|
+
/**
|
|
44763
|
+
* Get data max value
|
|
44764
|
+
* @param {object} $$ ChartInternal instance
|
|
44765
|
+
* @returns {number} max value
|
|
44766
|
+
* @private
|
|
44767
|
+
*/
|
|
44768
|
+
function getDataMax($$) {
|
|
44769
|
+
var levelMax = $$.config.polar_level_max,
|
|
44770
|
+
dataMax = $$.getMinMaxData().max[0].value;
|
|
44771
|
+
|
|
44772
|
+
// Apply level max only when is greater than the data max value
|
|
44773
|
+
if (levelMax && levelMax > dataMax) {
|
|
44774
|
+
dataMax = levelMax;
|
|
44775
|
+
}
|
|
44776
|
+
|
|
44777
|
+
return dataMax;
|
|
44778
|
+
}
|
|
44779
|
+
|
|
44780
|
+
/* harmony default export */ var polar = ({
|
|
44781
|
+
/**
|
|
44782
|
+
* Initialize polar
|
|
44783
|
+
* @private
|
|
44784
|
+
*/
|
|
44785
|
+
initPolar: function initPolar() {
|
|
44786
|
+
var $$ = this,
|
|
44787
|
+
arcs = $$.$el.arcs,
|
|
44788
|
+
config = $$.config,
|
|
44789
|
+
levelTextShow = config.polar_level_text_show,
|
|
44790
|
+
levelTextBgColor = config.polar_level_text_backgroundColor;
|
|
44791
|
+
// append <g> for level
|
|
44792
|
+
arcs.levels = arcs.append("g").attr("class", $LEVEL.levels); // set level text background color
|
|
44793
|
+
|
|
44794
|
+
if (levelTextShow && levelTextBgColor) {
|
|
44795
|
+
$$.generateDataLabelBackgroundColorFilter(levelTextBgColor);
|
|
44796
|
+
}
|
|
44797
|
+
},
|
|
44798
|
+
|
|
44799
|
+
/**
|
|
44800
|
+
* Get polar outer radius according to the data value
|
|
44801
|
+
* @param {object} d Data object
|
|
44802
|
+
* @param {numbet} outerRadius Outer radius
|
|
44803
|
+
* @returns {number} outer radius
|
|
44804
|
+
* @private
|
|
44805
|
+
*/
|
|
44806
|
+
getPolarOuterRadius: function getPolarOuterRadius(d, outerRadius) {
|
|
44807
|
+
var dataMax = getDataMax(this);
|
|
44808
|
+
return (d == null ? void 0 : d.data.values[0].value) / dataMax * outerRadius;
|
|
44809
|
+
},
|
|
44810
|
+
|
|
44811
|
+
/**
|
|
44812
|
+
* Update polar based on given data array
|
|
44813
|
+
* @param {object} targets Data object
|
|
44814
|
+
* @private
|
|
44815
|
+
*/
|
|
44816
|
+
updateTargetsForPolar: function updateTargetsForPolar(targets) {
|
|
44817
|
+
// borrow from Arc
|
|
44818
|
+
this.updateTargetsForArc(targets);
|
|
44819
|
+
},
|
|
44820
|
+
|
|
44821
|
+
/**
|
|
44822
|
+
* Called whenever redraw happens
|
|
44823
|
+
* @private
|
|
44824
|
+
*/
|
|
44825
|
+
redrawPolar: function redrawPolar() {
|
|
44826
|
+
var $$ = this,
|
|
44827
|
+
config = $$.config;
|
|
44828
|
+
config.polar_level_show && $$.updatePolarLevel();
|
|
44829
|
+
},
|
|
44830
|
+
|
|
44831
|
+
/**
|
|
44832
|
+
* Update polar level circle
|
|
44833
|
+
* @private
|
|
44834
|
+
*/
|
|
44835
|
+
updatePolarLevel: function updatePolarLevel() {
|
|
44836
|
+
var $$ = this,
|
|
44837
|
+
config = $$.config,
|
|
44838
|
+
state = $$.state,
|
|
44839
|
+
levels = $$.$el.arcs.levels,
|
|
44840
|
+
depth = config.polar_level_depth,
|
|
44841
|
+
dataMax = getDataMax($$),
|
|
44842
|
+
levelData = getRange(0, depth),
|
|
44843
|
+
outerRadius = state.radius,
|
|
44844
|
+
levelRatio = levelData.map(function (l) {
|
|
44845
|
+
return outerRadius * ((l + 1) / depth);
|
|
44846
|
+
}),
|
|
44847
|
+
levelTextFormat = (config.polar_level_text_format || function () {}).bind($$.api),
|
|
44848
|
+
level = levels.selectAll("." + $LEVEL.level).data(levelData);
|
|
44849
|
+
|
|
44850
|
+
level.exit().remove();
|
|
44851
|
+
var levelEnter = level.enter().append("g").attr("class", function (d, i) {
|
|
44852
|
+
return $LEVEL.level + " " + $LEVEL.level + "-" + i;
|
|
44853
|
+
}); // cx, cy, translate: Set center as origin (0,0) so that it can share same center with arcs
|
|
44854
|
+
|
|
44855
|
+
levelEnter.append("circle");
|
|
44856
|
+
levelEnter.merge(level).selectAll("circle").style("visibility", config.polar_level_show ? null : "hidden").attr("cx", 0).attr("cy", 0).attr("r", function (d) {
|
|
44857
|
+
return levelRatio[d];
|
|
44858
|
+
});
|
|
44859
|
+
|
|
44860
|
+
if (config.polar_level_text_show) {
|
|
44861
|
+
var levelTextBackgroundColor = config.polar_level_text_backgroundColor,
|
|
44862
|
+
defsId = "#" + state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(levelTextBackgroundColor);
|
|
44863
|
+
levelEnter.append("text").style("text-anchor", "middle");
|
|
44864
|
+
levelEnter.merge(level).selectAll("text").attr("dy", function (d) {
|
|
44865
|
+
return -levelRatio[d] + 5;
|
|
44866
|
+
}).attr("filter", levelTextBackgroundColor ? "url(" + defsId + ")" : null).text(function (d) {
|
|
44867
|
+
return levelTextFormat(dataMax / levelData.length * (d + 1));
|
|
44868
|
+
});
|
|
44869
|
+
}
|
|
44870
|
+
}
|
|
44871
|
+
});
|
|
44591
44872
|
;// CONCATENATED MODULE: ./src/ChartInternal/shape/radar.ts
|
|
44592
44873
|
/**
|
|
44593
44874
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -44628,7 +44909,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
44628
44909
|
if ($$.hasType("radar")) {
|
|
44629
44910
|
$el.radar = $el.main.select("." + $COMMON.chart).append("g").attr("class", $RADAR.chartRadars); // level
|
|
44630
44911
|
|
|
44631
|
-
$el.radar.levels = $el.radar.append("g").attr("class", $
|
|
44912
|
+
$el.radar.levels = $el.radar.append("g").attr("class", $LEVEL.levels); // axis
|
|
44632
44913
|
|
|
44633
44914
|
$el.radar.axes = $el.radar.append("g").attr("class", $AXIS.axis); // shapes
|
|
44634
44915
|
|
|
@@ -44749,11 +45030,11 @@ var cacheKey = KEY.radarPoints;
|
|
|
44749
45030
|
});
|
|
44750
45031
|
return pos.join(" ");
|
|
44751
45032
|
}),
|
|
44752
|
-
level = radarLevels.selectAll("." + $
|
|
45033
|
+
level = radarLevels.selectAll("." + $LEVEL.level).data(levelData);
|
|
44753
45034
|
|
|
44754
45035
|
level.exit().remove();
|
|
44755
45036
|
var levelEnter = level.enter().append("g").attr("class", function (d, i) {
|
|
44756
|
-
return $
|
|
45037
|
+
return $LEVEL.level + " " + $LEVEL.level + "-" + i;
|
|
44757
45038
|
});
|
|
44758
45039
|
levelEnter.append("polygon").style("visibility", config.radar_level_show ? null : "hidden");
|
|
44759
45040
|
|
|
@@ -45759,6 +46040,91 @@ var cacheKey = KEY.radarPoints;
|
|
|
45759
46040
|
pie_padding: 0,
|
|
45760
46041
|
pie_startingAngle: 0
|
|
45761
46042
|
});
|
|
46043
|
+
;// CONCATENATED MODULE: ./src/config/Options/shape/polar.ts
|
|
46044
|
+
/**
|
|
46045
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
46046
|
+
* billboard.js project is licensed under the MIT license
|
|
46047
|
+
*/
|
|
46048
|
+
|
|
46049
|
+
/**
|
|
46050
|
+
* x Axis config options
|
|
46051
|
+
*/
|
|
46052
|
+
/* harmony default export */ var shape_polar = ({
|
|
46053
|
+
/**
|
|
46054
|
+
* Set polar options
|
|
46055
|
+
* @name polar
|
|
46056
|
+
* @memberof Options
|
|
46057
|
+
* @type {object}
|
|
46058
|
+
* @property {object} polar Polar object
|
|
46059
|
+
* @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
|
|
46060
|
+
* @property {Function} [polar.label.format] Set formatter for the label on each polar piece.
|
|
46061
|
+
* @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
46062
|
+
* @property {number|Function} [polar.label.ratio=undefined] Set ratio of labels position.
|
|
46063
|
+
* @property {number} [polar.level.depth=3] Set the level depth.
|
|
46064
|
+
* @property {boolean} [polar.level.show=true] Show or hide level.
|
|
46065
|
+
* @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
|
|
46066
|
+
* @property {Function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
|
|
46067
|
+
* @property {boolean} [polar.level.text.show=true] Show or hide level text.
|
|
46068
|
+
* @property {number} [polar.padAngle=0] Set padding between data.
|
|
46069
|
+
* @property {number} [polar.padding=0] Sets the gap between pie arcs.
|
|
46070
|
+
* @property {number} [polar.startingAngle=0] Set starting angle where data draws.
|
|
46071
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
|
|
46072
|
+
* @example
|
|
46073
|
+
* polar: {
|
|
46074
|
+
* label: {
|
|
46075
|
+
* show: false,
|
|
46076
|
+
* format: function(value, ratio, id) {
|
|
46077
|
+
* return d3.format("$")(value);
|
|
46078
|
+
*
|
|
46079
|
+
* // to multiline, return with '\n' character
|
|
46080
|
+
* // return value +"%\nLine1\n2Line2";
|
|
46081
|
+
* },
|
|
46082
|
+
*
|
|
46083
|
+
* // 0.1(10%) ratio value means, the minimum ratio to show text label relative to the total value.
|
|
46084
|
+
* // if data value is below than 0.1, text label will be hidden.
|
|
46085
|
+
* threshold: 0.1,
|
|
46086
|
+
*
|
|
46087
|
+
* // set ratio callback. Should return ratio value
|
|
46088
|
+
* ratio: function(d, radius, h) {
|
|
46089
|
+
* ...
|
|
46090
|
+
* return ratio;
|
|
46091
|
+
* },
|
|
46092
|
+
* // or set ratio number
|
|
46093
|
+
* ratio: 0.5
|
|
46094
|
+
* },
|
|
46095
|
+
* level: {
|
|
46096
|
+
* depth: 3,
|
|
46097
|
+
* max: 500,
|
|
46098
|
+
* show: true,
|
|
46099
|
+
* text: {
|
|
46100
|
+
* format: function(x) {
|
|
46101
|
+
* return x + "%";
|
|
46102
|
+
* },
|
|
46103
|
+
* show: true,
|
|
46104
|
+
* backgroundColor: "red"
|
|
46105
|
+
* }
|
|
46106
|
+
* },
|
|
46107
|
+
* padAngle: 0.1,
|
|
46108
|
+
* padding: 0,
|
|
46109
|
+
* startingAngle: 1
|
|
46110
|
+
* }
|
|
46111
|
+
*/
|
|
46112
|
+
polar_label_show: !0,
|
|
46113
|
+
polar_label_format: undefined,
|
|
46114
|
+
polar_label_threshold: .05,
|
|
46115
|
+
polar_label_ratio: undefined,
|
|
46116
|
+
polar_level_depth: 3,
|
|
46117
|
+
polar_level_max: undefined,
|
|
46118
|
+
polar_level_show: !0,
|
|
46119
|
+
polar_level_text_backgroundColor: "#fff",
|
|
46120
|
+
polar_level_text_format: function polar_level_text_format(x) {
|
|
46121
|
+
return x % 1 === 0 ? x : x.toFixed(2);
|
|
46122
|
+
},
|
|
46123
|
+
polar_level_text_show: !0,
|
|
46124
|
+
polar_padAngle: 0,
|
|
46125
|
+
polar_padding: 0,
|
|
46126
|
+
polar_startingAngle: 0
|
|
46127
|
+
});
|
|
45762
46128
|
;// CONCATENATED MODULE: ./src/config/Options/shape/radar.ts
|
|
45763
46129
|
/**
|
|
45764
46130
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -45859,6 +46225,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
45859
46225
|
|
|
45860
46226
|
|
|
45861
46227
|
|
|
46228
|
+
|
|
45862
46229
|
// Options
|
|
45863
46230
|
|
|
45864
46231
|
|
|
@@ -45875,6 +46242,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
45875
46242
|
|
|
45876
46243
|
|
|
45877
46244
|
|
|
46245
|
+
|
|
45878
46246
|
/**
|
|
45879
46247
|
* Extend Axis
|
|
45880
46248
|
* @param {Array} module Module to be extended
|
|
@@ -45967,6 +46335,11 @@ var _area = function area() {
|
|
|
45967
46335
|
return extendArc(undefined, [shape_pie]), (resolver_shape_pie = function () {
|
|
45968
46336
|
return TYPE.PIE;
|
|
45969
46337
|
})();
|
|
46338
|
+
},
|
|
46339
|
+
resolver_shape_polar = function () {
|
|
46340
|
+
return extendArc([polar], [shape_polar]), (resolver_shape_polar = function () {
|
|
46341
|
+
return TYPE.POLAR;
|
|
46342
|
+
})();
|
|
45970
46343
|
},
|
|
45971
46344
|
resolver_shape_radar = function () {
|
|
45972
46345
|
return extendArc([point, radar], [common_point, shape_radar]), (resolver_shape_radar = function () {
|
|
@@ -48461,7 +48834,7 @@ var _defaults = {},
|
|
|
48461
48834
|
* bb.version; // "1.0.0"
|
|
48462
48835
|
* @memberof bb
|
|
48463
48836
|
*/
|
|
48464
|
-
version: "3.
|
|
48837
|
+
version: "3.4.0-next.2",
|
|
48465
48838
|
|
|
48466
48839
|
/**
|
|
48467
48840
|
* Generate chart
|
|
@@ -48509,6 +48882,7 @@ var _defaults = {},
|
|
|
48509
48882
|
* gauge,
|
|
48510
48883
|
* line,
|
|
48511
48884
|
* pie,
|
|
48885
|
+
* polar,
|
|
48512
48886
|
* radar,
|
|
48513
48887
|
* scatter,
|
|
48514
48888
|
* spline,
|
|
@@ -48595,7 +48969,7 @@ var _defaults = {},
|
|
|
48595
48969
|
};
|
|
48596
48970
|
/**
|
|
48597
48971
|
* @namespace bb
|
|
48598
|
-
* @version 3.
|
|
48972
|
+
* @version 3.4.0-next.2
|
|
48599
48973
|
*/
|
|
48600
48974
|
;// CONCATENATED MODULE: ./src/index.ts
|
|
48601
48975
|
/**
|