billboard.js 3.3.1 → 3.4.0-next.1
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 +397 -74
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +865 -414
- 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 +46 -16
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +46 -16
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +41 -13
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +41 -13
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +470 -342
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +515 -357
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +516 -358
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +512 -356
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +513 -357
- 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 +356 -72
- 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 +30 -30
- package/src/Chart/api/chart.ts +1 -1
- package/src/Chart/api/focus.ts +3 -2
- package/src/Chart/api/subchart.ts +8 -8
- package/src/ChartInternal/Axis/Axis.ts +10 -7
- package/src/ChartInternal/ChartInternal.ts +25 -14
- package/src/ChartInternal/data/data.ts +1 -1
- package/src/ChartInternal/internals/color.ts +4 -3
- package/src/ChartInternal/internals/format.ts +13 -4
- package/src/ChartInternal/internals/redraw.ts +6 -2
- 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/tooltip.ts +10 -1
- 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/util.ts +30 -10
- 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/options.d.ts +72 -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.1
|
|
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,19 +1120,37 @@ 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
|
-
if (
|
|
1128
|
+
if (touch) {
|
|
1113
1129
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1130
|
+
if (navigator && "maxTouchPoints" in navigator) {
|
|
1131
|
+
hasTouch = navigator.maxTouchPoints > 0; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
1132
|
+
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
1133
|
+
} else if ("ontouchmove" in win || DocumentTouch && browser_doc instanceof DocumentTouch) {
|
|
1134
|
+
hasTouch = !0;
|
|
1135
|
+
} else {
|
|
1136
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
|
|
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);
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
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/
|
|
1117
1148
|
|
|
1118
|
-
isMobile = hasTouchPoints || hasTouch;
|
|
1119
|
-
}
|
|
1120
1149
|
|
|
1121
|
-
var hasMouse = mouse &&
|
|
1122
|
-
|
|
1150
|
+
var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
1151
|
+
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
1152
|
+
});
|
|
1153
|
+
return hasMouse && "mouse" || hasTouch && "touch" || null;
|
|
1123
1154
|
}
|
|
1124
1155
|
;// CONCATENATED MODULE: ./src/module/error.ts
|
|
1125
1156
|
|
|
@@ -1299,12 +1330,14 @@ var $GRID = {
|
|
|
1299
1330
|
ygridLines: "bb-ygrid-lines",
|
|
1300
1331
|
ygrids: "bb-ygrids"
|
|
1301
1332
|
};
|
|
1302
|
-
var $
|
|
1303
|
-
chartRadar: "bb-chart-radar",
|
|
1304
|
-
chartRadars: "bb-chart-radars",
|
|
1333
|
+
var $LEVEL = {
|
|
1305
1334
|
level: "bb-level",
|
|
1306
1335
|
levels: "bb-levels"
|
|
1307
1336
|
};
|
|
1337
|
+
var $RADAR = {
|
|
1338
|
+
chartRadar: "bb-chart-radar",
|
|
1339
|
+
chartRadars: "bb-chart-radars"
|
|
1340
|
+
};
|
|
1308
1341
|
var $REGION = {
|
|
1309
1342
|
region: "bb-region",
|
|
1310
1343
|
regions: "bb-regions"
|
|
@@ -2077,6 +2110,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
2077
2110
|
* - gauge
|
|
2078
2111
|
* - line
|
|
2079
2112
|
* - pie
|
|
2113
|
+
* - polar
|
|
2080
2114
|
* - radar
|
|
2081
2115
|
* - scatter
|
|
2082
2116
|
* - spline
|
|
@@ -2105,6 +2139,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
2105
2139
|
* gauge,
|
|
2106
2140
|
* line,
|
|
2107
2141
|
* pie,
|
|
2142
|
+
* polar,
|
|
2108
2143
|
* radar,
|
|
2109
2144
|
* scatter,
|
|
2110
2145
|
* spline,
|
|
@@ -2151,6 +2186,7 @@ var Store = /*#__PURE__*/function () {
|
|
|
2151
2186
|
* gauge,
|
|
2152
2187
|
* line,
|
|
2153
2188
|
* pie,
|
|
2189
|
+
* polar,
|
|
2154
2190
|
* radar,
|
|
2155
2191
|
* scatter,
|
|
2156
2192
|
* spline,
|
|
@@ -3147,7 +3183,16 @@ var Store = /*#__PURE__*/function () {
|
|
|
3147
3183
|
* - `element {SVGElement}`: Tooltip event bound element
|
|
3148
3184
|
* - `pos {object}`: Current position of the tooltip.
|
|
3149
3185
|
* @property {Function|object} [tooltip.contents] Set custom HTML for the tooltip.<br>
|
|
3150
|
-
*
|
|
3186
|
+
* If tooltip.grouped is true, data includes multiple data points.<br><br>
|
|
3187
|
+
* Specified function receives `data` array and `defaultTitleFormat`, `defaultValueFormat` and `color` functions of the data point to show.
|
|
3188
|
+
* - **Note:**
|
|
3189
|
+
* - defaultTitleFormat:
|
|
3190
|
+
* - if `axis.x.tick.format` option will be used if set.
|
|
3191
|
+
* - otherwise, will return funciton based on tick format type(category, timeseries).
|
|
3192
|
+
* - defaultValueFormat:
|
|
3193
|
+
* - for Arc type (except gauge, radar), the function will return value from `(ratio * 100).toFixed(1)`.
|
|
3194
|
+
* - for Axis based types, will be used `axis.[y|y2].tick.format` option value if is set.
|
|
3195
|
+
* - otherwise, will parse value and return as number.
|
|
3151
3196
|
* @property {string|HTMLElement} [tooltip.contents.bindto=undefined] Set CSS selector or element reference to bind tooltip.
|
|
3152
3197
|
* - **NOTE:** When is specified, will not be updating tooltip's position.
|
|
3153
3198
|
* @property {string} [tooltip.contents.template=undefined] Set tooltip's template.<br><br>
|
|
@@ -5592,14 +5637,15 @@ var colorizePattern = function (pattern, color, id) {
|
|
|
5592
5637
|
|
|
5593
5638
|
/**
|
|
5594
5639
|
* Append data backgound color filter definition
|
|
5640
|
+
* @param {string} color Color string
|
|
5595
5641
|
* @private
|
|
5596
5642
|
*/
|
|
5597
|
-
generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter() {
|
|
5643
|
+
generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter(color) {
|
|
5598
5644
|
var $$ = this,
|
|
5599
5645
|
$el = $$.$el,
|
|
5600
5646
|
config = $$.config,
|
|
5601
5647
|
state = $$.state,
|
|
5602
|
-
backgroundColors = config.data_labels_backgroundColors;
|
|
5648
|
+
backgroundColors = color || config.data_labels_backgroundColors;
|
|
5603
5649
|
|
|
5604
5650
|
if (backgroundColors) {
|
|
5605
5651
|
var ids = [];
|
|
@@ -5611,7 +5657,7 @@ var colorizePattern = function (pattern, color, id) {
|
|
|
5611
5657
|
}
|
|
5612
5658
|
|
|
5613
5659
|
ids.forEach(function (v) {
|
|
5614
|
-
var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v);
|
|
5660
|
+
var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v) + (color ? $$.getTargetSelectorSuffix(color) : "");
|
|
5615
5661
|
$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\"/>");
|
|
5616
5662
|
});
|
|
5617
5663
|
}
|
|
@@ -6098,8 +6144,14 @@ function getFormat($$, typeValue, v) {
|
|
|
6098
6144
|
*/
|
|
6099
6145
|
getDefaultValueFormat: function getDefaultValueFormat() {
|
|
6100
6146
|
var $$ = this,
|
|
6101
|
-
|
|
6102
|
-
|
|
6147
|
+
defaultArcValueFormat = $$.defaultArcValueFormat,
|
|
6148
|
+
yFormat = $$.yFormat,
|
|
6149
|
+
y2Format = $$.y2Format,
|
|
6150
|
+
hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
|
|
6151
|
+
return function (v, ratio, id) {
|
|
6152
|
+
var format = hasArc ? defaultArcValueFormat : $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat;
|
|
6153
|
+
return format.call($$, v, ratio);
|
|
6154
|
+
};
|
|
6103
6155
|
},
|
|
6104
6156
|
defaultValueFormat: function defaultValueFormat(v) {
|
|
6105
6157
|
return isValue(v) ? +v : "";
|
|
@@ -6107,6 +6159,9 @@ function getFormat($$, typeValue, v) {
|
|
|
6107
6159
|
defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
|
|
6108
6160
|
return (ratio * 100).toFixed(1) + "%";
|
|
6109
6161
|
},
|
|
6162
|
+
defaultPolarValueFormat: function defaultPolarValueFormat(v) {
|
|
6163
|
+
return "" + v;
|
|
6164
|
+
},
|
|
6110
6165
|
dataLabelFormat: function dataLabelFormat(targetId) {
|
|
6111
6166
|
var $$ = this,
|
|
6112
6167
|
dataLabels = $$.config.data_labels,
|
|
@@ -6871,7 +6926,9 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
6871
6926
|
// arc
|
|
6872
6927
|
$el.arcs && $$.redrawArc(duration, durationForExit, wth.Transform); // radar
|
|
6873
6928
|
|
|
6874
|
-
$el.radar && $$.redrawRadar();
|
|
6929
|
+
$el.radar && $$.redrawRadar(); // polar
|
|
6930
|
+
|
|
6931
|
+
$el.polar && $$.redrawPolar();
|
|
6875
6932
|
} // @TODO: Axis & Radar type
|
|
6876
6933
|
|
|
6877
6934
|
|
|
@@ -7027,7 +7084,8 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
7027
7084
|
redrawWithoutRescale: function redrawWithoutRescale() {
|
|
7028
7085
|
this.redraw({
|
|
7029
7086
|
withY: !1,
|
|
7030
|
-
|
|
7087
|
+
withDimension: !1,
|
|
7088
|
+
withLegend: !1,
|
|
7031
7089
|
withSubchart: !1,
|
|
7032
7090
|
withEventRect: !1,
|
|
7033
7091
|
withTransitionForAxis: !1
|
|
@@ -9191,6 +9249,9 @@ function getTextPos(pos, width) {
|
|
|
9191
9249
|
} else if (target === "arc") {
|
|
9192
9250
|
x = state.arcWidth / 2;
|
|
9193
9251
|
y = state.arcHeight / 2;
|
|
9252
|
+
} else if (target === "polar") {
|
|
9253
|
+
x = state.arcWidth / 2;
|
|
9254
|
+
y = state.arcHeight / 2;
|
|
9194
9255
|
} else if (target === "radar") {
|
|
9195
9256
|
var _$$$getRadarSize = $$.getRadarSize(),
|
|
9196
9257
|
width = _$$$getRadarSize[0];
|
|
@@ -9406,11 +9467,14 @@ function getTextPos(pos, width) {
|
|
|
9406
9467
|
isDonutType: function isDonutType(d) {
|
|
9407
9468
|
return this.isTypeOf(d, "donut");
|
|
9408
9469
|
},
|
|
9470
|
+
isPolarType: function isPolarType(d) {
|
|
9471
|
+
return this.isTypeOf(d, "polar");
|
|
9472
|
+
},
|
|
9409
9473
|
isRadarType: function isRadarType(d) {
|
|
9410
9474
|
return this.isTypeOf(d, "radar");
|
|
9411
9475
|
},
|
|
9412
9476
|
isArcType: function isArcType(d) {
|
|
9413
|
-
return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isRadarType(d);
|
|
9477
|
+
return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isPolarType(d) || this.isRadarType(d);
|
|
9414
9478
|
},
|
|
9415
9479
|
// determine if is 'circle' data point
|
|
9416
9480
|
isCirclePoint: function isCirclePoint(node) {
|
|
@@ -9696,7 +9760,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
9696
9760
|
state = _ref.state,
|
|
9697
9761
|
isRotated = config.axis_rotated;
|
|
9698
9762
|
// datetime to be used for uniqueness
|
|
9699
|
-
state.datetimeId = "bb-" + +new Date();
|
|
9763
|
+
state.datetimeId = "bb-" + +new Date() * getRandom();
|
|
9700
9764
|
$$.color = $$.generateColor();
|
|
9701
9765
|
$$.levelColor = $$.generateLevelColor();
|
|
9702
9766
|
|
|
@@ -9738,7 +9802,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
9738
9802
|
$el = $$.$el,
|
|
9739
9803
|
org = $$.org,
|
|
9740
9804
|
hasAxis = state.hasAxis,
|
|
9741
|
-
hasInteraction = config.interaction_enabled
|
|
9805
|
+
hasInteraction = config.interaction_enabled,
|
|
9806
|
+
hasPolar = $$.hasType("polar");
|
|
9742
9807
|
|
|
9743
9808
|
// for arc type, set axes to not be shown
|
|
9744
9809
|
// $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
|
|
@@ -9808,14 +9873,14 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
9808
9873
|
|
|
9809
9874
|
var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
|
9810
9875
|
|
|
9811
|
-
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
|
|
9876
|
+
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
|
|
9812
9877
|
$el.defs = $el.svg.append("defs");
|
|
9813
9878
|
|
|
9814
9879
|
if (hasAxis) {
|
|
9815
9880
|
["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
|
9816
9881
|
$$.appendClip($el.defs, state.clip[v]);
|
|
9817
9882
|
});
|
|
9818
|
-
} // Append data
|
|
9883
|
+
} // Append data background color filter definition
|
|
9819
9884
|
|
|
9820
9885
|
|
|
9821
9886
|
$$.generateDataLabelBackgroundColorFilter(); // set color patterns
|
|
@@ -9918,6 +9983,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
9918
9983
|
}
|
|
9919
9984
|
});
|
|
9920
9985
|
} else {
|
|
9986
|
+
var hasPolar = $$.hasType("polar");
|
|
9987
|
+
|
|
9921
9988
|
if (!hasRadar) {
|
|
9922
9989
|
types.push("Arc", "Pie");
|
|
9923
9990
|
}
|
|
@@ -9926,6 +9993,8 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
9926
9993
|
types.push("Gauge");
|
|
9927
9994
|
} else if (hasRadar) {
|
|
9928
9995
|
types.push("Radar");
|
|
9996
|
+
} else if (hasPolar) {
|
|
9997
|
+
types.push("Polar");
|
|
9929
9998
|
}
|
|
9930
9999
|
}
|
|
9931
10000
|
|
|
@@ -10017,7 +10086,11 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10017
10086
|
var $$ = this,
|
|
10018
10087
|
_$$$state2 = $$.state,
|
|
10019
10088
|
hasAxis = _$$$state2.hasAxis,
|
|
10020
|
-
hasRadar = _$$$state2.hasRadar
|
|
10089
|
+
hasRadar = _$$$state2.hasRadar,
|
|
10090
|
+
helper = function (type) {
|
|
10091
|
+
return $$["updateTargetsFor" + type](targets.filter($$["is" + type + "Type"].bind($$)));
|
|
10092
|
+
};
|
|
10093
|
+
|
|
10021
10094
|
// Text
|
|
10022
10095
|
$$.updateTargetsForText(targets);
|
|
10023
10096
|
|
|
@@ -10026,14 +10099,21 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10026
10099
|
var name = capitalize(v);
|
|
10027
10100
|
|
|
10028
10101
|
if (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) {
|
|
10029
|
-
|
|
10102
|
+
helper(name);
|
|
10030
10103
|
}
|
|
10031
10104
|
}); // Sub Chart
|
|
10032
10105
|
|
|
10033
|
-
$$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets);
|
|
10034
|
-
} else {
|
|
10035
|
-
|
|
10036
|
-
|
|
10106
|
+
$$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets); // Arc, Polar, Radar
|
|
10107
|
+
} else if ($$.hasArcType(targets)) {
|
|
10108
|
+
var _type = "Arc";
|
|
10109
|
+
|
|
10110
|
+
if (hasRadar) {
|
|
10111
|
+
_type = "Radar";
|
|
10112
|
+
} else if ($$.hasType("polar")) {
|
|
10113
|
+
_type = "Polar";
|
|
10114
|
+
}
|
|
10115
|
+
|
|
10116
|
+
helper(_type);
|
|
10037
10117
|
} // circle
|
|
10038
10118
|
|
|
10039
10119
|
|
|
@@ -10224,7 +10304,7 @@ function loadConfig(config) {
|
|
|
10224
10304
|
config.size_width = size ? size.width : null;
|
|
10225
10305
|
config.size_height = size ? size.height : null;
|
|
10226
10306
|
state.resizing = !0;
|
|
10227
|
-
this.flush(!1
|
|
10307
|
+
this.flush(!1);
|
|
10228
10308
|
$$.resizeFunction();
|
|
10229
10309
|
}
|
|
10230
10310
|
},
|
|
@@ -10796,7 +10876,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
10796
10876
|
candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
|
|
10797
10877
|
candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !0);
|
|
10798
10878
|
|
|
10799
|
-
if ($$.hasArcType()) {
|
|
10879
|
+
if ($$.hasArcType(null, ["polar"])) {
|
|
10800
10880
|
$$.unexpandArc(targetIds);
|
|
10801
10881
|
$$.hasType("gauge") && $$.undoMarkOverlapped($$, "." + $GAUGE.gaugeValue);
|
|
10802
10882
|
}
|
|
@@ -10834,7 +10914,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
10834
10914
|
candidates = $el.svg.selectAll($$.selectorTargets(targetIds));
|
|
10835
10915
|
// should be for all targets
|
|
10836
10916
|
candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !1);
|
|
10837
|
-
$$.hasArcType() && $$.unexpandArc(targetIds);
|
|
10917
|
+
$$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
|
|
10838
10918
|
|
|
10839
10919
|
if (config.legend_show) {
|
|
10840
10920
|
$$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
|
|
@@ -13877,7 +13957,7 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
13877
13957
|
var prefix = "axis_" + key + "_",
|
|
13878
13958
|
axisScale = scale[key];
|
|
13879
13959
|
|
|
13880
|
-
if (
|
|
13960
|
+
if (axisScale) {
|
|
13881
13961
|
var tickValues = config[prefix + "tick_values"],
|
|
13882
13962
|
tickCount = config[prefix + "tick_count"];
|
|
13883
13963
|
axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
|
|
@@ -13945,8 +14025,10 @@ var Axis_Axis = /*#__PURE__*/function () {
|
|
|
13945
14025
|
}
|
|
13946
14026
|
|
|
13947
14027
|
tickNodes.each(function (d) {
|
|
13948
|
-
|
|
13949
|
-
|
|
14028
|
+
var node = lines ? this.querySelector("text") : this;
|
|
14029
|
+
|
|
14030
|
+
if (node) {
|
|
14031
|
+
node.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null;
|
|
13950
14032
|
}
|
|
13951
14033
|
});
|
|
13952
14034
|
} else {
|
|
@@ -17455,9 +17537,9 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17455
17537
|
var $$ = this,
|
|
17456
17538
|
config = $$.config,
|
|
17457
17539
|
dataType = config.data_type,
|
|
17458
|
-
padding = config
|
|
17540
|
+
padding = config[dataType + "_padding"],
|
|
17459
17541
|
startingAngle = config[dataType + "_startingAngle"] || 0,
|
|
17460
|
-
padAngle = (
|
|
17542
|
+
padAngle = (padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
|
|
17461
17543
|
$$.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) {
|
|
17462
17544
|
return d.values.reduce(function (a, b) {
|
|
17463
17545
|
return a + b.value;
|
|
@@ -17468,7 +17550,8 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17468
17550
|
var $$ = this,
|
|
17469
17551
|
config = $$.config,
|
|
17470
17552
|
state = $$.state,
|
|
17471
|
-
|
|
17553
|
+
dataType = config.data_type,
|
|
17554
|
+
padding = config[dataType + "_padding"],
|
|
17472
17555
|
w = config.gauge_width || config.donut_width,
|
|
17473
17556
|
gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
|
|
17474
17557
|
// determine radius
|
|
@@ -17603,6 +17686,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17603
17686
|
state = $$.state,
|
|
17604
17687
|
singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
|
|
17605
17688
|
hasMultiArcGauge = $$.hasMultiArcGauge(),
|
|
17689
|
+
hasPolar = $$.hasType("polar"),
|
|
17606
17690
|
arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(function (d) {
|
|
17607
17691
|
var _$$$getRadius = $$.getRadius(d),
|
|
17608
17692
|
innerRadius = _$$$getRadius.innerRadius;
|
|
@@ -17610,9 +17694,16 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17610
17694
|
return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : isNumber(innerRadius) ? innerRadius : 0;
|
|
17611
17695
|
}).outerRadius(function (d) {
|
|
17612
17696
|
var _$$$getRadius2 = $$.getRadius(d),
|
|
17613
|
-
outerRadius = _$$$getRadius2.outerRadius
|
|
17697
|
+
outerRadius = _$$$getRadius2.outerRadius,
|
|
17698
|
+
radius = outerRadius;
|
|
17699
|
+
|
|
17700
|
+
if (hasMultiArcGauge) {
|
|
17701
|
+
radius = state.radius - singleArcWidth * d.index;
|
|
17702
|
+
} else if (hasPolar) {
|
|
17703
|
+
radius = $$.getPolarOuterRadius(d, outerRadius);
|
|
17704
|
+
}
|
|
17614
17705
|
|
|
17615
|
-
return
|
|
17706
|
+
return radius;
|
|
17616
17707
|
}),
|
|
17617
17708
|
newArc = function (d, withoutUpdate) {
|
|
17618
17709
|
var path = "M 0 0";
|
|
@@ -17670,6 +17761,13 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17670
17761
|
getArc: function getArc(d, withoutUpdate, force) {
|
|
17671
17762
|
return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
|
|
17672
17763
|
},
|
|
17764
|
+
|
|
17765
|
+
/**
|
|
17766
|
+
* Set transform attributes to arc label text
|
|
17767
|
+
* @param {Object} d Data object
|
|
17768
|
+
* @returns {string} Translate attribute string
|
|
17769
|
+
* @private
|
|
17770
|
+
*/
|
|
17673
17771
|
transformForArcLabel: function transformForArcLabel(d) {
|
|
17674
17772
|
var $$ = this,
|
|
17675
17773
|
config = $$.config,
|
|
@@ -17684,16 +17782,24 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17684
17782
|
y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
|
|
17685
17783
|
translate = "translate(" + x + "," + y + ")";
|
|
17686
17784
|
} else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
17687
|
-
var
|
|
17688
|
-
|
|
17689
|
-
|
|
17785
|
+
var _filter$map,
|
|
17786
|
+
_$$$getRadius4 = $$.getRadius(d),
|
|
17787
|
+
outerRadius = _$$$getRadius4.outerRadius;
|
|
17788
|
+
|
|
17789
|
+
if ($$.hasType("polar")) {
|
|
17790
|
+
outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
17791
|
+
}
|
|
17792
|
+
|
|
17793
|
+
var c = this.svgArc.centroid(updated),
|
|
17690
17794
|
_c$map = c.map(function (v) {
|
|
17691
17795
|
return isNaN(v) ? 0 : v;
|
|
17692
17796
|
}),
|
|
17693
17797
|
x = _c$map[0],
|
|
17694
17798
|
y = _c$map[1],
|
|
17695
17799
|
h = Math.sqrt(x * x + y * y),
|
|
17696
|
-
ratio =
|
|
17800
|
+
ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
|
|
17801
|
+
return config[v + "_label_ratio"];
|
|
17802
|
+
})) == null ? void 0 : _filter$map[0];
|
|
17697
17803
|
|
|
17698
17804
|
if (ratio) {
|
|
17699
17805
|
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
|
@@ -17721,10 +17827,11 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17721
17827
|
|
|
17722
17828
|
if ($$.shouldShowArcLabel()) {
|
|
17723
17829
|
selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.updateTextBacgroundColor.bind($$)).each(function (d) {
|
|
17724
|
-
var
|
|
17830
|
+
var _filter,
|
|
17831
|
+
node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
|
|
17725
17832
|
updated = $$.updateAngle(d),
|
|
17726
17833
|
ratio = $$.getRatio("arc", updated),
|
|
17727
|
-
isUnderThreshold = $$.meetsLabelThreshold(ratio,
|
|
17834
|
+
isUnderThreshold = $$.meetsLabelThreshold(ratio, (_filter = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _filter[0]);
|
|
17728
17835
|
|
|
17729
17836
|
if (isUnderThreshold) {
|
|
17730
17837
|
var value = (updated || d).value,
|
|
@@ -17812,21 +17919,20 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17812
17919
|
shouldShowArcLabel: function shouldShowArcLabel() {
|
|
17813
17920
|
var $$ = this,
|
|
17814
17921
|
config = $$.config;
|
|
17815
|
-
return ["
|
|
17922
|
+
return ["donut", "gauge", "pie", "polar"].some(function (v) {
|
|
17816
17923
|
return $$.hasType(v) && config[v + "_label_show"];
|
|
17817
17924
|
});
|
|
17818
17925
|
},
|
|
17819
17926
|
getArcLabelFormat: function getArcLabelFormat() {
|
|
17820
17927
|
var $$ = this,
|
|
17821
17928
|
config = $$.config,
|
|
17822
|
-
format =
|
|
17823
|
-
|
|
17824
|
-
|
|
17825
|
-
format = config.gauge_label_format;
|
|
17826
|
-
} else if ($$.hasType("donut")) {
|
|
17827
|
-
format = config.donut_label_format;
|
|
17828
|
-
}
|
|
17929
|
+
format = function (v) {
|
|
17930
|
+
return v;
|
|
17931
|
+
};
|
|
17829
17932
|
|
|
17933
|
+
["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).forEach(function (v) {
|
|
17934
|
+
format = config[v + "_label_format"];
|
|
17935
|
+
});
|
|
17830
17936
|
return isFunction(format) ? format.bind($$.api) : format;
|
|
17831
17937
|
},
|
|
17832
17938
|
getArcTitle: function getArcTitle() {
|
|
@@ -17958,6 +18064,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
17958
18064
|
}); // bind arc events
|
|
17959
18065
|
|
|
17960
18066
|
hasInteraction && $$.bindArcEvent(mainArc);
|
|
18067
|
+
$$.hasType("polar") && $$.redrawPolar();
|
|
17961
18068
|
$$.hasType("gauge") && $$.redrawBackgroundArcs();
|
|
17962
18069
|
$$.redrawArcText(duration);
|
|
17963
18070
|
},
|
|
@@ -19765,6 +19872,124 @@ var getTransitionName = function () {
|
|
|
19765
19872
|
}
|
|
19766
19873
|
}
|
|
19767
19874
|
});
|
|
19875
|
+
;// CONCATENATED MODULE: ./src/ChartInternal/shape/polar.ts
|
|
19876
|
+
/**
|
|
19877
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
19878
|
+
* billboard.js project is licensed under the MIT license
|
|
19879
|
+
*/
|
|
19880
|
+
|
|
19881
|
+
|
|
19882
|
+
|
|
19883
|
+
/**
|
|
19884
|
+
* Get data max value
|
|
19885
|
+
* @param {object} $$ ChartInternal instance
|
|
19886
|
+
* @returns {number} max value
|
|
19887
|
+
* @private
|
|
19888
|
+
*/
|
|
19889
|
+
function getDataMax($$) {
|
|
19890
|
+
var levelMax = $$.config.polar_level_max,
|
|
19891
|
+
dataMax = $$.getMinMaxData().max[0].value;
|
|
19892
|
+
|
|
19893
|
+
// Apply level max only when is greater than the data max value
|
|
19894
|
+
if (levelMax && levelMax > dataMax) {
|
|
19895
|
+
dataMax = levelMax;
|
|
19896
|
+
}
|
|
19897
|
+
|
|
19898
|
+
return dataMax;
|
|
19899
|
+
}
|
|
19900
|
+
|
|
19901
|
+
/* harmony default export */ var polar = ({
|
|
19902
|
+
/**
|
|
19903
|
+
* Initialize polar
|
|
19904
|
+
* @private
|
|
19905
|
+
*/
|
|
19906
|
+
initPolar: function initPolar() {
|
|
19907
|
+
var $$ = this,
|
|
19908
|
+
arcs = $$.$el.arcs,
|
|
19909
|
+
config = $$.config,
|
|
19910
|
+
levelTextShow = config.polar_level_text_show,
|
|
19911
|
+
levelTextBgColor = config.polar_level_text_backgroundColor;
|
|
19912
|
+
// append <g> for level
|
|
19913
|
+
arcs.levels = arcs.append("g").attr("class", $LEVEL.levels); // set level text background color
|
|
19914
|
+
|
|
19915
|
+
if (levelTextShow && levelTextBgColor) {
|
|
19916
|
+
$$.generateDataLabelBackgroundColorFilter(levelTextBgColor);
|
|
19917
|
+
}
|
|
19918
|
+
},
|
|
19919
|
+
|
|
19920
|
+
/**
|
|
19921
|
+
* Get polar outer radius according to the data value
|
|
19922
|
+
* @param {object} d Data object
|
|
19923
|
+
* @param {numbet} outerRadius Outer radius
|
|
19924
|
+
* @returns {number} outer radius
|
|
19925
|
+
* @private
|
|
19926
|
+
*/
|
|
19927
|
+
getPolarOuterRadius: function getPolarOuterRadius(d, outerRadius) {
|
|
19928
|
+
var dataMax = getDataMax(this);
|
|
19929
|
+
return (d == null ? void 0 : d.data.values[0].value) / dataMax * outerRadius;
|
|
19930
|
+
},
|
|
19931
|
+
|
|
19932
|
+
/**
|
|
19933
|
+
* Update polar based on given data array
|
|
19934
|
+
* @param {object} targets Data object
|
|
19935
|
+
* @private
|
|
19936
|
+
*/
|
|
19937
|
+
updateTargetsForPolar: function updateTargetsForPolar(targets) {
|
|
19938
|
+
// borrow from Arc
|
|
19939
|
+
this.updateTargetsForArc(targets);
|
|
19940
|
+
},
|
|
19941
|
+
|
|
19942
|
+
/**
|
|
19943
|
+
* Called whenever redraw happens
|
|
19944
|
+
* @private
|
|
19945
|
+
*/
|
|
19946
|
+
redrawPolar: function redrawPolar() {
|
|
19947
|
+
var $$ = this,
|
|
19948
|
+
config = $$.config;
|
|
19949
|
+
config.polar_level_show && $$.updatePolarLevel();
|
|
19950
|
+
},
|
|
19951
|
+
|
|
19952
|
+
/**
|
|
19953
|
+
* Update polar level circle
|
|
19954
|
+
* @private
|
|
19955
|
+
*/
|
|
19956
|
+
updatePolarLevel: function updatePolarLevel() {
|
|
19957
|
+
var $$ = this,
|
|
19958
|
+
config = $$.config,
|
|
19959
|
+
state = $$.state,
|
|
19960
|
+
levels = $$.$el.arcs.levels,
|
|
19961
|
+
depth = config.polar_level_depth,
|
|
19962
|
+
dataMax = getDataMax($$),
|
|
19963
|
+
levelData = getRange(0, depth),
|
|
19964
|
+
outerRadius = state.radius,
|
|
19965
|
+
levelRatio = levelData.map(function (l) {
|
|
19966
|
+
return outerRadius * ((l + 1) / depth);
|
|
19967
|
+
}),
|
|
19968
|
+
levelTextFormat = (config.polar_level_text_format || function () {}).bind($$.api),
|
|
19969
|
+
level = levels.selectAll("." + $LEVEL.level).data(levelData);
|
|
19970
|
+
|
|
19971
|
+
level.exit().remove();
|
|
19972
|
+
var levelEnter = level.enter().append("g").attr("class", function (d, i) {
|
|
19973
|
+
return $LEVEL.level + " " + $LEVEL.level + "-" + i;
|
|
19974
|
+
}); // cx, cy, translate: Set center as origin (0,0) so that it can share same center with arcs
|
|
19975
|
+
|
|
19976
|
+
levelEnter.append("circle");
|
|
19977
|
+
levelEnter.merge(level).selectAll("circle").style("visibility", config.polar_level_show ? null : "hidden").attr("cx", 0).attr("cy", 0).attr("r", function (d) {
|
|
19978
|
+
return levelRatio[d];
|
|
19979
|
+
});
|
|
19980
|
+
|
|
19981
|
+
if (config.polar_level_text_show) {
|
|
19982
|
+
var levelTextBackgroundColor = config.polar_level_text_backgroundColor,
|
|
19983
|
+
defsId = "#" + state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(levelTextBackgroundColor);
|
|
19984
|
+
levelEnter.append("text").style("text-anchor", "middle");
|
|
19985
|
+
levelEnter.merge(level).selectAll("text").attr("dy", function (d) {
|
|
19986
|
+
return -levelRatio[d] + 5;
|
|
19987
|
+
}).attr("filter", levelTextBackgroundColor ? "url(" + defsId + ")" : null).text(function (d) {
|
|
19988
|
+
return levelTextFormat(dataMax / levelData.length * (d + 1));
|
|
19989
|
+
});
|
|
19990
|
+
}
|
|
19991
|
+
}
|
|
19992
|
+
});
|
|
19768
19993
|
;// CONCATENATED MODULE: ./src/ChartInternal/shape/radar.ts
|
|
19769
19994
|
/**
|
|
19770
19995
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -19805,7 +20030,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
19805
20030
|
if ($$.hasType("radar")) {
|
|
19806
20031
|
$el.radar = $el.main.select("." + $COMMON.chart).append("g").attr("class", $RADAR.chartRadars); // level
|
|
19807
20032
|
|
|
19808
|
-
$el.radar.levels = $el.radar.append("g").attr("class", $
|
|
20033
|
+
$el.radar.levels = $el.radar.append("g").attr("class", $LEVEL.levels); // axis
|
|
19809
20034
|
|
|
19810
20035
|
$el.radar.axes = $el.radar.append("g").attr("class", $AXIS.axis); // shapes
|
|
19811
20036
|
|
|
@@ -19926,11 +20151,11 @@ var cacheKey = KEY.radarPoints;
|
|
|
19926
20151
|
});
|
|
19927
20152
|
return pos.join(" ");
|
|
19928
20153
|
}),
|
|
19929
|
-
level = radarLevels.selectAll("." + $
|
|
20154
|
+
level = radarLevels.selectAll("." + $LEVEL.level).data(levelData);
|
|
19930
20155
|
|
|
19931
20156
|
level.exit().remove();
|
|
19932
20157
|
var levelEnter = level.enter().append("g").attr("class", function (d, i) {
|
|
19933
|
-
return $
|
|
20158
|
+
return $LEVEL.level + " " + $LEVEL.level + "-" + i;
|
|
19934
20159
|
});
|
|
19935
20160
|
levelEnter.append("polygon").style("visibility", config.radar_level_show ? null : "hidden");
|
|
19936
20161
|
|
|
@@ -20936,6 +21161,91 @@ var cacheKey = KEY.radarPoints;
|
|
|
20936
21161
|
pie_padding: 0,
|
|
20937
21162
|
pie_startingAngle: 0
|
|
20938
21163
|
});
|
|
21164
|
+
;// CONCATENATED MODULE: ./src/config/Options/shape/polar.ts
|
|
21165
|
+
/**
|
|
21166
|
+
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
21167
|
+
* billboard.js project is licensed under the MIT license
|
|
21168
|
+
*/
|
|
21169
|
+
|
|
21170
|
+
/**
|
|
21171
|
+
* x Axis config options
|
|
21172
|
+
*/
|
|
21173
|
+
/* harmony default export */ var shape_polar = ({
|
|
21174
|
+
/**
|
|
21175
|
+
* Set polar options
|
|
21176
|
+
* @name polar
|
|
21177
|
+
* @memberof Options
|
|
21178
|
+
* @type {object}
|
|
21179
|
+
* @property {object} polar Polar object
|
|
21180
|
+
* @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
|
|
21181
|
+
* @property {Function} [polar.label.format] Set formatter for the label on each polar piece.
|
|
21182
|
+
* @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
21183
|
+
* @property {number|Function} [polar.label.ratio=undefined] Set ratio of labels position.
|
|
21184
|
+
* @property {number} [polar.level.depth=3] Set the level depth.
|
|
21185
|
+
* @property {boolean} [polar.level.show=true] Show or hide level.
|
|
21186
|
+
* @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
|
|
21187
|
+
* @property {Function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
|
|
21188
|
+
* @property {boolean} [polar.level.text.show=true] Show or hide level text.
|
|
21189
|
+
* @property {number} [polar.padAngle=0] Set padding between data.
|
|
21190
|
+
* @property {number} [polar.padding=0] Sets the gap between pie arcs.
|
|
21191
|
+
* @property {number} [polar.startingAngle=0] Set starting angle where data draws.
|
|
21192
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
|
|
21193
|
+
* @example
|
|
21194
|
+
* polar: {
|
|
21195
|
+
* label: {
|
|
21196
|
+
* show: false,
|
|
21197
|
+
* format: function(value, ratio, id) {
|
|
21198
|
+
* return d3.format("$")(value);
|
|
21199
|
+
*
|
|
21200
|
+
* // to multiline, return with '\n' character
|
|
21201
|
+
* // return value +"%\nLine1\n2Line2";
|
|
21202
|
+
* },
|
|
21203
|
+
*
|
|
21204
|
+
* // 0.1(10%) ratio value means, the minimum ratio to show text label relative to the total value.
|
|
21205
|
+
* // if data value is below than 0.1, text label will be hidden.
|
|
21206
|
+
* threshold: 0.1,
|
|
21207
|
+
*
|
|
21208
|
+
* // set ratio callback. Should return ratio value
|
|
21209
|
+
* ratio: function(d, radius, h) {
|
|
21210
|
+
* ...
|
|
21211
|
+
* return ratio;
|
|
21212
|
+
* },
|
|
21213
|
+
* // or set ratio number
|
|
21214
|
+
* ratio: 0.5
|
|
21215
|
+
* },
|
|
21216
|
+
* level: {
|
|
21217
|
+
* depth: 3,
|
|
21218
|
+
* max: 500,
|
|
21219
|
+
* show: true,
|
|
21220
|
+
* text: {
|
|
21221
|
+
* format: function(x) {
|
|
21222
|
+
* return x + "%";
|
|
21223
|
+
* },
|
|
21224
|
+
* show: true,
|
|
21225
|
+
* backgroundColor: "red"
|
|
21226
|
+
* }
|
|
21227
|
+
* },
|
|
21228
|
+
* padAngle: 0.1,
|
|
21229
|
+
* padding: 0,
|
|
21230
|
+
* startingAngle: 1
|
|
21231
|
+
* }
|
|
21232
|
+
*/
|
|
21233
|
+
polar_label_show: !0,
|
|
21234
|
+
polar_label_format: undefined,
|
|
21235
|
+
polar_label_threshold: .05,
|
|
21236
|
+
polar_label_ratio: undefined,
|
|
21237
|
+
polar_level_depth: 3,
|
|
21238
|
+
polar_level_max: undefined,
|
|
21239
|
+
polar_level_show: !0,
|
|
21240
|
+
polar_level_text_backgroundColor: "#fff",
|
|
21241
|
+
polar_level_text_format: function polar_level_text_format(x) {
|
|
21242
|
+
return x % 1 === 0 ? x : x.toFixed(2);
|
|
21243
|
+
},
|
|
21244
|
+
polar_level_text_show: !0,
|
|
21245
|
+
polar_padAngle: 0,
|
|
21246
|
+
polar_padding: 0,
|
|
21247
|
+
polar_startingAngle: 0
|
|
21248
|
+
});
|
|
20939
21249
|
;// CONCATENATED MODULE: ./src/config/Options/shape/radar.ts
|
|
20940
21250
|
/**
|
|
20941
21251
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -21036,6 +21346,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
21036
21346
|
|
|
21037
21347
|
|
|
21038
21348
|
|
|
21349
|
+
|
|
21039
21350
|
// Options
|
|
21040
21351
|
|
|
21041
21352
|
|
|
@@ -21052,6 +21363,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
21052
21363
|
|
|
21053
21364
|
|
|
21054
21365
|
|
|
21366
|
+
|
|
21055
21367
|
/**
|
|
21056
21368
|
* Extend Axis
|
|
21057
21369
|
* @param {Array} module Module to be extended
|
|
@@ -21144,6 +21456,11 @@ var _area = function area() {
|
|
|
21144
21456
|
return extendArc(undefined, [pie]), (shape_pie = function () {
|
|
21145
21457
|
return TYPE.PIE;
|
|
21146
21458
|
})();
|
|
21459
|
+
},
|
|
21460
|
+
resolver_shape_polar = function () {
|
|
21461
|
+
return extendArc([polar], [shape_polar]), (resolver_shape_polar = function () {
|
|
21462
|
+
return TYPE.POLAR;
|
|
21463
|
+
})();
|
|
21147
21464
|
},
|
|
21148
21465
|
resolver_shape_radar = function () {
|
|
21149
21466
|
return extendArc([point, radar], [common_point, shape_radar]), (resolver_shape_radar = function () {
|
|
@@ -21345,6 +21662,8 @@ var _area = function area() {
|
|
|
21345
21662
|
show = config.subchart_show;
|
|
21346
21663
|
|
|
21347
21664
|
if (!show) {
|
|
21665
|
+
var _$target, _subchart$main2;
|
|
21666
|
+
|
|
21348
21667
|
// unbind zoom event bound to chart rect area
|
|
21349
21668
|
$$.unbindZoomEvent();
|
|
21350
21669
|
config.subchart_show = !show;
|
|
@@ -21352,14 +21671,16 @@ var _area = function area() {
|
|
|
21352
21671
|
var $target = subchart.main.selectAll("." + $COMMON.target); // need to cover when new data has been loaded
|
|
21353
21672
|
|
|
21354
21673
|
if ($$.data.targets.length !== $target.size()) {
|
|
21674
|
+
var _subchart$main;
|
|
21675
|
+
|
|
21355
21676
|
$$.updateSizes();
|
|
21356
21677
|
$$.updateTargetsForSubchart($$.data.targets);
|
|
21357
|
-
$target = subchart.main.selectAll("." + $COMMON.target);
|
|
21678
|
+
$target = (_subchart$main = subchart.main) == null ? void 0 : _subchart$main.selectAll("." + $COMMON.target);
|
|
21358
21679
|
}
|
|
21359
21680
|
|
|
21360
|
-
$target.style("opacity", null);
|
|
21361
|
-
subchart.main.style("display", null);
|
|
21362
|
-
this.
|
|
21681
|
+
(_$target = $target) == null ? void 0 : _$target.style("opacity", null);
|
|
21682
|
+
(_subchart$main2 = subchart.main) == null ? void 0 : _subchart$main2.style("display", null);
|
|
21683
|
+
this.resize();
|
|
21363
21684
|
}
|
|
21364
21685
|
},
|
|
21365
21686
|
|
|
@@ -21373,14 +21694,15 @@ var _area = function area() {
|
|
|
21373
21694
|
* chart.subchart.hide();
|
|
21374
21695
|
*/
|
|
21375
21696
|
hide: function hide() {
|
|
21376
|
-
var
|
|
21377
|
-
|
|
21697
|
+
var _main,
|
|
21698
|
+
$$ = this.internal,
|
|
21699
|
+
main = $$.$el.subchart.main,
|
|
21378
21700
|
config = $$.config;
|
|
21379
21701
|
|
|
21380
|
-
if (config.subchart_show &&
|
|
21702
|
+
if (config.subchart_show && ((_main = main) == null ? void 0 : _main.style("display")) !== "none") {
|
|
21381
21703
|
config.subchart_show = !1;
|
|
21382
|
-
|
|
21383
|
-
this.
|
|
21704
|
+
main.style("display", "none");
|
|
21705
|
+
this.resize();
|
|
21384
21706
|
}
|
|
21385
21707
|
},
|
|
21386
21708
|
|
|
@@ -23006,7 +23328,7 @@ var _defaults = {},
|
|
|
23006
23328
|
* bb.version; // "1.0.0"
|
|
23007
23329
|
* @memberof bb
|
|
23008
23330
|
*/
|
|
23009
|
-
version: "3.
|
|
23331
|
+
version: "3.4.0-next.1",
|
|
23010
23332
|
|
|
23011
23333
|
/**
|
|
23012
23334
|
* Generate chart
|
|
@@ -23054,6 +23376,7 @@ var _defaults = {},
|
|
|
23054
23376
|
* gauge,
|
|
23055
23377
|
* line,
|
|
23056
23378
|
* pie,
|
|
23379
|
+
* polar,
|
|
23057
23380
|
* radar,
|
|
23058
23381
|
* scatter,
|
|
23059
23382
|
* spline,
|
|
@@ -23140,7 +23463,7 @@ var _defaults = {},
|
|
|
23140
23463
|
};
|
|
23141
23464
|
/**
|
|
23142
23465
|
* @namespace bb
|
|
23143
|
-
* @version 3.
|
|
23466
|
+
* @version 3.4.0-next.1
|
|
23144
23467
|
*/
|
|
23145
23468
|
;// CONCATENATED MODULE: ./src/index.ts
|
|
23146
23469
|
/**
|