billboard.js 3.14.3 → 3.15.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/README.md +4 -2
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +133 -91
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +10 -10
- package/dist/billboard.pkgd.js +1345 -1003
- package/dist/billboard.pkgd.min.js +14 -14
- 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 +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-textoverlap.js +9 -9
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1204 -914
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -5
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +1205 -915
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -7
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +1206 -916
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1207 -917
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +8 -8
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1215 -918
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +6 -6
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/billboard.js +525 -479
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +4 -4
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +15 -88
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +13 -86
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +10 -83
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +7 -70
- package/package.json +27 -27
- package/src/Chart/api/chart.ts +2 -0
- package/src/Chart/api/regions.ts +2 -2
- package/src/ChartInternal/Axis/Axis.ts +68 -60
- package/src/ChartInternal/ChartInternal.ts +9 -4
- package/src/ChartInternal/interactions/interaction.ts +1 -1
- package/src/ChartInternal/internals/region.ts +44 -46
- package/src/config/Options/axis/y2.ts +13 -0
- package/src/config/Options/common/main.ts +30 -11
- package/types/options.d.ts +2 -1
- package/types/types.d.ts +0 -14
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
[![Latest Version][badge-latest]][link-version] [![Next version][badge-next]][link-version] [![bb][badge-@billboard.js/react]][link-@billboard.js/react]<br>
|
|
7
7
|
[![semantic-release][badge-semantic-release]][link-semantic-release] ![React][badge-react]
|
|
8
8
|
|
|
9
|
-
![
|
|
10
|
-
[![
|
|
9
|
+
[![download][badge-download]][link-download] [![download][badge-download-weekly]][link-download] [![jsDelivr][badge-jsDelivr]][link-jsDelivr] [![jsDelivr][badge-jsDelivr-weekly]][link-jsDelivr]<br>
|
|
10
|
+
![CI Status][badge-ci-status] [![Coverage Status][badge-coverage]][link-coverage] [![Known Vulnerabilities][badge-snyk]][link-snyk] [![gzip size][badge-gzip-size]][link-gzip-size]
|
|
11
11
|
|
|
12
12
|
billboard.js is a re-usable, easy interface JavaScript chart library, based on [D3.js](https://d3js.org/).
|
|
13
13
|
> The name "billboard" comes from the famous `billboard chart` which everybody knows.<br>
|
|
@@ -288,7 +288,9 @@ THE SOFTWARE.
|
|
|
288
288
|
|
|
289
289
|
<!-- badges -->
|
|
290
290
|
[badge-download]: https://img.shields.io/npm/dm/billboard.js.svg?style=flat
|
|
291
|
+
[badge-download-weekly]: https://img.shields.io/npm/dw/billboard.js
|
|
291
292
|
[badge-jsDelivr]: https://data.jsdelivr.com/v1/package/npm/billboard.js/badge?style=rounded
|
|
293
|
+
[badge-jsDelivr-weekly]: https://img.shields.io/jsdelivr/npm/hw/billboard.js
|
|
292
294
|
[badge-ci-status]: https://github.com/naver/billboard.js/workflows/CI/badge.svg
|
|
293
295
|
[badge-coverage]: https://coveralls.io/repos/github/naver/billboard.js/badge.svg?branch=master&v1
|
|
294
296
|
[badge-snyk]: https://snyk.io/test/github/naver/billboard.js/badge.svg?targetFile=package.json
|
package/dist/billboard.css
CHANGED
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.15.0-next.1
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -827,6 +827,7 @@ const $ZOOM = {
|
|
|
827
827
|
* - **NOTE:** Available options
|
|
828
828
|
* - true: Enables automatic resize.
|
|
829
829
|
* - false: Disables automatic resize.
|
|
830
|
+
* - "parent": Enables automatic resize when the parent node is resized.
|
|
830
831
|
* - "viewBox": Enables automatic resize, and size will be fixed based on the viewbox.
|
|
831
832
|
* @property {boolean|number} [resize.timer=true] Set resize timer option.
|
|
832
833
|
* - **NOTE:** Available options
|
|
@@ -834,11 +835,15 @@ const $ZOOM = {
|
|
|
834
835
|
* - true: `setTimeout()`
|
|
835
836
|
* - false: `requestIdleCallback()`
|
|
836
837
|
* - Given number(delay in ms) value, resize function will be triggered using `setTimeout()` with given delay.
|
|
837
|
-
* @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.
|
|
838
|
+
* @see [Demo: resize "parent"](https://naver.github.io/billboard.js/demo/#ChartOptions.resizeParent)
|
|
839
|
+
* @see [Demo: resize "viewBox"](https://naver.github.io/billboard.js/demo/#ChartOptions.resizeViewBox)
|
|
838
840
|
* @example
|
|
839
841
|
* resize: {
|
|
840
842
|
* auto: false,
|
|
841
843
|
*
|
|
844
|
+
* // set resize based on parent node width value
|
|
845
|
+
* auto: "parent",
|
|
846
|
+
*
|
|
842
847
|
* // set resize based on viewBox value
|
|
843
848
|
* auto: "viewBox",
|
|
844
849
|
*
|
|
@@ -1047,17 +1052,31 @@ const $ZOOM = {
|
|
|
1047
1052
|
render: {},
|
|
1048
1053
|
/**
|
|
1049
1054
|
* Show rectangles inside the chart.<br><br>
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
* If
|
|
1054
|
-
* If
|
|
1055
|
-
* If class is set, the region element will have it as class.
|
|
1055
|
+
* - **NOTE:**<br>
|
|
1056
|
+
* - axis must be x, y or y2. start and end should be the value where regions start and end.
|
|
1057
|
+
* - If not specified, the edge values will be used.
|
|
1058
|
+
* - If timeseries x axis, date string, Date object and unixtime integer can be used.
|
|
1059
|
+
* - If category x axis, category name can be used for start and end.
|
|
1060
|
+
* - If class is set, the region element will have it as class.
|
|
1061
|
+
*
|
|
1062
|
+
* This option accept array of object with below values:
|
|
1063
|
+
* - `axis {string}`: 'x', 'y', or 'y2'
|
|
1064
|
+
* - `[start] {number|Date|string}`: Start position of the region. If not set, the start will be the edge of the chart.
|
|
1065
|
+
* - `[end] {number|Date|string}`: End position of the region. If not set, the end will be the edge of the chart.
|
|
1066
|
+
* - `[class] {string}`: Class value to apply to the region.
|
|
1067
|
+
* - `[label] {object}` Lable text option.
|
|
1068
|
+
* - `text {string}`: Text value.
|
|
1069
|
+
* - `x {number}`: x Position.
|
|
1070
|
+
* - `y {number}`: y Position.
|
|
1071
|
+
* - `color {string}`: Color string.
|
|
1072
|
+
* - `rotated (boolean)`: Whether rotate label or not.
|
|
1056
1073
|
* @name regions
|
|
1057
1074
|
* @memberof Options
|
|
1058
1075
|
* @type {Array}
|
|
1059
1076
|
* @default []
|
|
1060
|
-
* @see [Demo](https://naver.github.io/billboard.js/demo/#Region.
|
|
1077
|
+
* @see [Demo: Regions](https://naver.github.io/billboard.js/demo/#Region.Region)
|
|
1078
|
+
* @see [Demo: Regions Timeseries](https://naver.github.io/billboard.js/demo/#Region.RegionWithTimeseries)
|
|
1079
|
+
* @see [Demo: Regions Label](https://naver.github.io/billboard.js/demo/#Region.RegionLabel)
|
|
1061
1080
|
* @example
|
|
1062
1081
|
* regions: [
|
|
1063
1082
|
* {
|
|
@@ -4701,7 +4720,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
4701
4720
|
* @param {Array} mouse x and y coordinate value
|
|
4702
4721
|
*/
|
|
4703
4722
|
dispatchEvent(type, index, mouse) {
|
|
4704
|
-
var _a, _b;
|
|
4723
|
+
var _a, _b, _c;
|
|
4705
4724
|
const $$ = this;
|
|
4706
4725
|
const {
|
|
4707
4726
|
config,
|
|
@@ -4714,7 +4733,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
4714
4733
|
},
|
|
4715
4734
|
$el: { eventRect, funnel, radar, svg, treemap }
|
|
4716
4735
|
} = $$;
|
|
4717
|
-
let element = (_b = (hasFunnel || hasTreemap) && eventReceiver.rect || hasRadar && radar.axes.select(`.${$AXIS.axis}-${index} text`) || (eventRect || ((_a = $$.getArcElementByIdOrIndex) == null ? void 0 : _a.call($$, index)))) == null ? void 0 : _b.node();
|
|
4736
|
+
let element = (_c = (_b = (hasFunnel || hasTreemap) && eventReceiver.rect || hasRadar && radar.axes.select(`.${$AXIS.axis}-${index} text`) || (eventRect || ((_a = $$.getArcElementByIdOrIndex) == null ? void 0 : _a.call($$, index)))) == null ? void 0 : _b.node) == null ? void 0 : _c.call(_b);
|
|
4718
4737
|
if (element) {
|
|
4719
4738
|
const isMultipleX = $$.isMultipleX();
|
|
4720
4739
|
const isRotated = config.axis_rotated;
|
|
@@ -8935,7 +8954,7 @@ class ChartInternal {
|
|
|
8935
8954
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_a = $$.hasLegendDefsPoint) == null ? void 0 : _a.call($$))) {
|
|
8936
8955
|
$el.defs = $el.svg.append("defs");
|
|
8937
8956
|
if (hasAxis) {
|
|
8938
|
-
["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
|
|
8957
|
+
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
|
|
8939
8958
|
$$.appendClip($el.defs, state.clip[v]);
|
|
8940
8959
|
});
|
|
8941
8960
|
}
|
|
@@ -9176,11 +9195,11 @@ class ChartInternal {
|
|
|
9176
9195
|
}
|
|
9177
9196
|
bindResize() {
|
|
9178
9197
|
const $$ = this;
|
|
9179
|
-
const { config, state } = $$;
|
|
9198
|
+
const { $el, config, state } = $$;
|
|
9180
9199
|
const resizeFunction = generateResize(config.resize_timer);
|
|
9181
9200
|
const list = [];
|
|
9182
9201
|
list.push(() => callFn(config.onresize, $$.api));
|
|
9183
|
-
if (config.resize_auto
|
|
9202
|
+
if (/^(true|parent)$/.test(config.resize_auto)) {
|
|
9184
9203
|
list.push(() => {
|
|
9185
9204
|
state.resizing = true;
|
|
9186
9205
|
if (config.legend_show) {
|
|
@@ -9196,7 +9215,11 @@ class ChartInternal {
|
|
|
9196
9215
|
});
|
|
9197
9216
|
list.forEach((v) => resizeFunction.add(v));
|
|
9198
9217
|
$$.resizeFunction = resizeFunction;
|
|
9199
|
-
|
|
9218
|
+
if (config.resize_auto === "parent") {
|
|
9219
|
+
($$.resizeFunction.resizeObserver = new ResizeObserver($$.resizeFunction.bind($$))).observe($el.chart.node().parentNode);
|
|
9220
|
+
} else {
|
|
9221
|
+
win.addEventListener("resize", $$.resizeFunction);
|
|
9222
|
+
}
|
|
9200
9223
|
}
|
|
9201
9224
|
/**
|
|
9202
9225
|
* Call plugin hook
|
|
@@ -9351,6 +9374,7 @@ function loadConfig(config) {
|
|
|
9351
9374
|
* chart.destroy();
|
|
9352
9375
|
*/
|
|
9353
9376
|
destroy() {
|
|
9377
|
+
var _a;
|
|
9354
9378
|
const $$ = this.internal;
|
|
9355
9379
|
const { $el: { chart, style, svg } } = $$;
|
|
9356
9380
|
if (notEmpty($$)) {
|
|
@@ -9359,6 +9383,7 @@ function loadConfig(config) {
|
|
|
9359
9383
|
$$.unbindAllEvents();
|
|
9360
9384
|
svg.select("*").interrupt();
|
|
9361
9385
|
$$.resizeFunction.clear();
|
|
9386
|
+
(_a = $$.resizeFunction.resizeObserver) == null ? void 0 : _a.disconnect();
|
|
9362
9387
|
win.removeEventListener("resize", $$.resizeFunction);
|
|
9363
9388
|
chart.classed("bb", false).style("position", null).selectChildren().remove();
|
|
9364
9389
|
style && style.parentNode.removeChild(style);
|
|
@@ -12592,7 +12617,7 @@ extend(regions, {
|
|
|
12592
12617
|
* @function regions․add
|
|
12593
12618
|
* @instance
|
|
12594
12619
|
* @memberof Chart
|
|
12595
|
-
* @param {Array|object} regions New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added.
|
|
12620
|
+
* @param {Array|object} regions New region will be added. The format of this argument is the same as [regions](./Options.html#.regions) and it's possible to give an Object if only one region will be added.
|
|
12596
12621
|
* @returns {Array} regions
|
|
12597
12622
|
* @example
|
|
12598
12623
|
* // Add a new region
|
|
@@ -13330,12 +13355,10 @@ class Axis_Axis {
|
|
|
13330
13355
|
init() {
|
|
13331
13356
|
const $$ = this.owner;
|
|
13332
13357
|
const { config, $el: { main, axis }, state: { clip } } = $$;
|
|
13333
|
-
const isRotated = config.axis_rotated;
|
|
13334
13358
|
const target = ["x", "y"];
|
|
13335
13359
|
config.axis_y2_show && target.push("y2");
|
|
13336
13360
|
target.forEach((v) => {
|
|
13337
13361
|
const classAxis = this.getAxisClassName(v);
|
|
13338
|
-
const classLabel = $AXIS[`axis${v.toUpperCase()}Label`];
|
|
13339
13362
|
axis[v] = main.append("g").attr("class", classAxis).attr("clip-path", () => {
|
|
13340
13363
|
let res = null;
|
|
13341
13364
|
if (v === "x") {
|
|
@@ -13345,10 +13368,8 @@ class Axis_Axis {
|
|
|
13345
13368
|
}
|
|
13346
13369
|
return res;
|
|
13347
13370
|
}).attr("transform", $$.getTranslate(v)).style("visibility", config[`axis_${v}_show`] ? null : "hidden");
|
|
13348
|
-
axis[v].append("text").attr("class", classLabel).attr("transform", ["rotate(-90)", null][v === "x" ? +!isRotated : +isRotated]).style("text-anchor", () => this.textAnchorForAxisLabel(v));
|
|
13349
13371
|
this.generateAxes(v);
|
|
13350
13372
|
});
|
|
13351
|
-
config.axis_tooltip && this.setAxisTooltip();
|
|
13352
13373
|
}
|
|
13353
13374
|
/**
|
|
13354
13375
|
* Set axis orient according option value
|
|
@@ -13624,17 +13645,6 @@ class Axis_Axis {
|
|
|
13624
13645
|
}
|
|
13625
13646
|
return x;
|
|
13626
13647
|
}
|
|
13627
|
-
dxForAxisLabel(id) {
|
|
13628
|
-
const $$ = this.owner;
|
|
13629
|
-
const position = this.getAxisLabelPosition(id);
|
|
13630
|
-
let dx = position.isBottom ? "0.5em" : "0";
|
|
13631
|
-
if (this.isHorizontal($$, id !== "x")) {
|
|
13632
|
-
dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0";
|
|
13633
|
-
} else if (position.isTop) {
|
|
13634
|
-
dx = "-0.5em";
|
|
13635
|
-
}
|
|
13636
|
-
return dx;
|
|
13637
|
-
}
|
|
13638
13648
|
textAnchorForAxisLabel(id) {
|
|
13639
13649
|
const $$ = this.owner;
|
|
13640
13650
|
const position = this.getAxisLabelPosition(id);
|
|
@@ -13646,6 +13656,17 @@ class Axis_Axis {
|
|
|
13646
13656
|
}
|
|
13647
13657
|
return anchor;
|
|
13648
13658
|
}
|
|
13659
|
+
dxForAxisLabel(id) {
|
|
13660
|
+
const $$ = this.owner;
|
|
13661
|
+
const position = this.getAxisLabelPosition(id);
|
|
13662
|
+
let dx = position.isBottom ? "0.5em" : "0";
|
|
13663
|
+
if (this.isHorizontal($$, id !== "x")) {
|
|
13664
|
+
dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0";
|
|
13665
|
+
} else if (position.isTop) {
|
|
13666
|
+
dx = "-0.5em";
|
|
13667
|
+
}
|
|
13668
|
+
return dx;
|
|
13669
|
+
}
|
|
13649
13670
|
dyForAxisLabel(id) {
|
|
13650
13671
|
const $$ = this.owner;
|
|
13651
13672
|
const { config } = $$;
|
|
@@ -13812,17 +13833,26 @@ class Axis_Axis {
|
|
|
13812
13833
|
}
|
|
13813
13834
|
return maxOverflow + tickOffset;
|
|
13814
13835
|
}
|
|
13836
|
+
/**
|
|
13837
|
+
* Update axis label text
|
|
13838
|
+
* @param {boolean} withTransition Weather update with transition
|
|
13839
|
+
* @private
|
|
13840
|
+
*/
|
|
13815
13841
|
updateLabels(withTransition) {
|
|
13816
13842
|
const $$ = this.owner;
|
|
13817
|
-
const { $el: { main }, $T } = $$;
|
|
13818
|
-
const
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13843
|
+
const { config, $el: { main }, $T } = $$;
|
|
13844
|
+
const isRotated = config.axis_rotated;
|
|
13845
|
+
["x", "y", "y2"].forEach((id) => {
|
|
13846
|
+
const text = this.getLabelText(id);
|
|
13847
|
+
const selector = `axis${capitalize(id)}`;
|
|
13848
|
+
const classLabel = $AXIS[`${selector}Label`];
|
|
13849
|
+
if (text) {
|
|
13850
|
+
let axisLabel = main.select(`text.${classLabel}`);
|
|
13851
|
+
if (axisLabel.empty()) {
|
|
13852
|
+
axisLabel = main.select(`g.${$AXIS[selector]}`).insert("text", ":first-child").attr("class", classLabel).attr("transform", ["rotate(-90)", null][id === "x" ? +!isRotated : +isRotated]).style("text-anchor", () => this.textAnchorForAxisLabel(id));
|
|
13853
|
+
}
|
|
13854
|
+
$T(axisLabel, withTransition).attr("x", () => this.xForAxisLabel(id)).attr("dx", () => this.dxForAxisLabel(id)).attr("dy", () => this.dyForAxisLabel(id)).text(text);
|
|
13855
|
+
}
|
|
13826
13856
|
});
|
|
13827
13857
|
}
|
|
13828
13858
|
/**
|
|
@@ -13883,7 +13913,7 @@ class Axis_Axis {
|
|
|
13883
13913
|
}
|
|
13884
13914
|
redraw(transitions, isHidden, isInit) {
|
|
13885
13915
|
const $$ = this.owner;
|
|
13886
|
-
const { config, $el } = $$;
|
|
13916
|
+
const { config, state, $el } = $$;
|
|
13887
13917
|
const opacity = isHidden ? "0" : null;
|
|
13888
13918
|
["x", "y", "y2", "subX"].forEach((id) => {
|
|
13889
13919
|
const axis = this[id];
|
|
@@ -13897,6 +13927,7 @@ class Axis_Axis {
|
|
|
13897
13927
|
}
|
|
13898
13928
|
});
|
|
13899
13929
|
this.updateAxes();
|
|
13930
|
+
!state.rendered && config.axis_tooltip && this.setAxisTooltip();
|
|
13900
13931
|
}
|
|
13901
13932
|
/**
|
|
13902
13933
|
* Redraw axis
|
|
@@ -14025,15 +14056,17 @@ class Axis_Axis {
|
|
|
14025
14056
|
);
|
|
14026
14057
|
["x", "y", "y2"].forEach((v) => {
|
|
14027
14058
|
var _a2, _b, _c;
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
|
|
14033
|
-
|
|
14034
|
-
|
|
14035
|
-
|
|
14036
|
-
|
|
14059
|
+
if (isString(bgColor) || bgColor[v]) {
|
|
14060
|
+
axisTooltip[v] = (_a2 = axis[v]) == null ? void 0 : _a2.append("text").classed($AXIS[`axis${v.toUpperCase()}Tooltip`], true).attr("filter", $$.updateTextBGColor({ id: v }, bgColor));
|
|
14061
|
+
if (isRotated) {
|
|
14062
|
+
const pos = v === "x" ? "x" : "y";
|
|
14063
|
+
const val = v === "y" ? "1.15em" : v === "x" ? "-0.3em" : "-0.4em";
|
|
14064
|
+
(_b = axisTooltip[v]) == null ? void 0 : _b.attr(pos, val).attr(`d${v === "x" ? "y" : "x"}`, v === "x" ? "0.4em" : "-1.3em").style("text-anchor", v === "x" ? "end" : null);
|
|
14065
|
+
} else {
|
|
14066
|
+
const pos = v === "x" ? "y" : "x";
|
|
14067
|
+
const val = v === "x" ? "1.15em" : `${v === "y" ? "-" : ""}0.4em`;
|
|
14068
|
+
(_c = axisTooltip[v]) == null ? void 0 : _c.attr(pos, val).attr(`d${v === "x" ? "x" : "y"}`, v === "x" ? "-1em" : "0.3em").style("text-anchor", v === "y" ? "end" : null);
|
|
14069
|
+
}
|
|
14037
14070
|
}
|
|
14038
14071
|
});
|
|
14039
14072
|
}
|
|
@@ -15195,62 +15228,59 @@ function smoothLines(el, type) {
|
|
|
15195
15228
|
label.style("opacity", null)
|
|
15196
15229
|
];
|
|
15197
15230
|
},
|
|
15198
|
-
getRegionXY(type, d) {
|
|
15199
|
-
const $$ = this;
|
|
15200
|
-
const { config, scale } = $$;
|
|
15201
|
-
const isRotated = config.axis_rotated;
|
|
15202
|
-
const isX = type === "x";
|
|
15203
|
-
let key = "start";
|
|
15204
|
-
let currScale;
|
|
15205
|
-
let pos = 0;
|
|
15206
|
-
if (d.axis === "y" || d.axis === "y2") {
|
|
15207
|
-
if (!isX) {
|
|
15208
|
-
key = "end";
|
|
15209
|
-
}
|
|
15210
|
-
if ((isX ? isRotated : !isRotated) && key in d) {
|
|
15211
|
-
currScale = scale[d.axis];
|
|
15212
|
-
pos = currScale(d[key]);
|
|
15213
|
-
}
|
|
15214
|
-
} else if ((isX ? !isRotated : isRotated) && key in d) {
|
|
15215
|
-
currScale = scale.zoom || scale.x;
|
|
15216
|
-
pos = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key]);
|
|
15217
|
-
}
|
|
15218
|
-
return pos;
|
|
15219
|
-
},
|
|
15220
15231
|
regionX(d) {
|
|
15221
|
-
return this.
|
|
15232
|
+
return this.getRegionSize("x", d);
|
|
15222
15233
|
},
|
|
15223
15234
|
regionY(d) {
|
|
15224
|
-
return this.
|
|
15235
|
+
return this.getRegionSize("y", d);
|
|
15236
|
+
},
|
|
15237
|
+
regionWidth(d) {
|
|
15238
|
+
return this.getRegionSize("width", d);
|
|
15239
|
+
},
|
|
15240
|
+
regionHeight(d) {
|
|
15241
|
+
return this.getRegionSize("height", d);
|
|
15225
15242
|
},
|
|
15243
|
+
/**
|
|
15244
|
+
* Get Region size according start/end position
|
|
15245
|
+
* @param {string} type Type string
|
|
15246
|
+
* @param {ojbect} d Data object
|
|
15247
|
+
* @returns {number}
|
|
15248
|
+
* @private
|
|
15249
|
+
*/
|
|
15226
15250
|
getRegionSize(type, d) {
|
|
15227
15251
|
const $$ = this;
|
|
15228
15252
|
const { config, scale, state } = $$;
|
|
15229
15253
|
const isRotated = config.axis_rotated;
|
|
15230
|
-
const
|
|
15231
|
-
const
|
|
15254
|
+
const isAxisType = /(x|y|y2)/.test(type);
|
|
15255
|
+
const isType = isAxisType ? type === "x" : type === "width";
|
|
15256
|
+
const start = !isAxisType && $$[isType ? "regionX" : "regionY"](d);
|
|
15257
|
+
let key = isAxisType ? "start" : "end";
|
|
15258
|
+
let pos = isAxisType ? 0 : state[type];
|
|
15232
15259
|
let currScale;
|
|
15233
|
-
let key = "end";
|
|
15234
|
-
let end = state[type];
|
|
15235
15260
|
if (d.axis === "y" || d.axis === "y2") {
|
|
15236
|
-
if (!
|
|
15261
|
+
if (!isAxisType && !isType) {
|
|
15237
15262
|
key = "start";
|
|
15263
|
+
} else if (isAxisType && !isType) {
|
|
15264
|
+
key = "end";
|
|
15238
15265
|
}
|
|
15239
|
-
if ((
|
|
15266
|
+
if ((isType ? isRotated : !isRotated) && key in d) {
|
|
15240
15267
|
currScale = scale[d.axis];
|
|
15241
|
-
end = currScale(d[key]);
|
|
15242
15268
|
}
|
|
15243
|
-
} else if ((
|
|
15269
|
+
} else if ((isType ? !isRotated : isRotated) && key in d) {
|
|
15244
15270
|
currScale = scale.zoom || scale.x;
|
|
15245
|
-
end = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key]);
|
|
15246
15271
|
}
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15272
|
+
if (currScale) {
|
|
15273
|
+
let offset = 0;
|
|
15274
|
+
pos = d[key];
|
|
15275
|
+
if ($$.axis.isTimeSeries(d.axis)) {
|
|
15276
|
+
pos = parseDate.call($$, pos);
|
|
15277
|
+
} else if (/(x|width)/.test(type) && $$.axis.isCategorized() && isNaN(pos)) {
|
|
15278
|
+
pos = config.axis_x_categories.indexOf(pos);
|
|
15279
|
+
offset = $$.axis.x.tickOffset() * (key === "start" ? -1 : 1);
|
|
15280
|
+
}
|
|
15281
|
+
pos = currScale(pos) + offset;
|
|
15282
|
+
}
|
|
15283
|
+
return isAxisType ? pos : pos < start ? 0 : pos - start;
|
|
15254
15284
|
},
|
|
15255
15285
|
isRegionOnX(d) {
|
|
15256
15286
|
return !d.axis || d.axis === "x";
|
|
@@ -16570,6 +16600,18 @@ function smoothLines(el, type) {
|
|
|
16570
16600
|
|
|
16571
16601
|
;// ./src/config/Options/axis/y2.ts
|
|
16572
16602
|
/* harmony default export */ var y2 = ({
|
|
16603
|
+
/**
|
|
16604
|
+
* Set clip-path attribute for y2 axis element
|
|
16605
|
+
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
16606
|
+
* @name axis․y2․clipPath
|
|
16607
|
+
* @memberof Options
|
|
16608
|
+
* @type {boolean}
|
|
16609
|
+
* @default true
|
|
16610
|
+
* @example
|
|
16611
|
+
* // don't set 'clip-path' attribute
|
|
16612
|
+
* clipPath: false
|
|
16613
|
+
*/
|
|
16614
|
+
axis_y2_clipPath: true,
|
|
16573
16615
|
/**
|
|
16574
16616
|
* Show or hide y2 axis.
|
|
16575
16617
|
* - **NOTE**:
|
|
@@ -21863,7 +21905,7 @@ const bb = {
|
|
|
21863
21905
|
* bb.version; // "1.0.0"
|
|
21864
21906
|
* @memberof bb
|
|
21865
21907
|
*/
|
|
21866
|
-
version: "3.
|
|
21908
|
+
version: "3.15.0-next.1",
|
|
21867
21909
|
/**
|
|
21868
21910
|
* Generate chart
|
|
21869
21911
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|
package/dist/billboard.min.css
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.15.0-next.1
|
|
9
9
|
*/.bb svg{font:10px sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0)}.bb path,.bb line{fill:none;stroke:#000}.bb text,.bb .bb-button{-webkit-user-select:none;-moz-user-select:none;user-select:none}.bb-legend-item-tile,.bb-xgrid-focus,.bb-ygrid-focus,.bb-ygrid{shape-rendering:crispEdges}.bb-chart-arcs .bb-needle,.bb-chart-arc .bb-gauge-value{fill:#000}.bb-chart-arc path{stroke:#fff}.bb-chart-arc rect{stroke:#fff;stroke-width:1}.bb-chart-arc text{fill:#fff;font-size:13px}.bb-chart-funnels path{stroke-width:0}.bb-chart-funnels+.bb-chart-texts text{font-size:13px;fill:#fff}.bb-axis{shape-rendering:crispEdges}.bb-axis .bb-axis-x-tooltip,.bb-axis .bb-axis-y-tooltip,.bb-axis .bb-axis-y2-tooltip{font-size:1em;fill:#fff;white-space:nowrap}.bb-grid{pointer-events:none}.bb-grid line{stroke:#aaa}.bb-grid text{fill:#aaa}.bb-xgrid,.bb-ygrid{stroke-dasharray:3 3}.bb-text.bb-empty{fill:gray;font-size:2em}.bb-line{stroke-width:1px}.bb-circle._expanded_{stroke-width:1px;stroke:#fff}.bb-selected-circle{fill:#fff;stroke-width:2px}.bb-bar{stroke-width:0}.bb-bar._expanded_{fill-opacity:.75}.bb-candlestick{stroke-width:1px}.bb-candlestick._expanded_{fill-opacity:.75}.bb-target.bb-focused,.bb-circles.bb-focused{opacity:1}.bb-target.bb-focused path.bb-line,.bb-target.bb-focused path.bb-step,.bb-circles.bb-focused path.bb-line,.bb-circles.bb-focused path.bb-step{stroke-width:2px}.bb-target.bb-defocused,.bb-circles.bb-defocused{opacity:.3!important}.bb-target.bb-defocused .text-overlapping,.bb-circles.bb-defocused .text-overlapping{opacity:.05!important}.bb-region{fill:#4682b4}.bb-region rect{fill-opacity:.1}.bb-zoom-brush,.bb-brush .extent{fill-opacity:.1}.bb-legend-item{font-size:12px;user-select:none}.bb-legend-item-hidden{opacity:.15}.bb-legend-background{opacity:.75;fill:#fff;stroke:#d3d3d3;stroke-width:1}.bb-title{font:14px sans-serif}.bb-chart-treemaps rect{stroke:#fff;stroke-width:1px}.bb-tooltip-container{z-index:10;user-select:none}.bb-tooltip{border-collapse:collapse;border-spacing:0;background-color:#fff;empty-cells:show;opacity:.9;box-shadow:7px 7px 12px -9px #777;white-space:nowrap}.bb-tooltip tr{border:1px solid #CCC}.bb-tooltip th{background-color:#aaa;font-size:14px;padding:2px 5px;text-align:left;color:#fff}.bb-tooltip td{font-size:13px;padding:3px 6px;background-color:#fff;border-left:1px dotted #999}.bb-tooltip td>span,.bb-tooltip td>svg{display:inline-block;width:10px;height:10px;margin-right:6px}.bb-tooltip.value{text-align:right}.bb-area{stroke-width:0;opacity:.2}.bb-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}text.bb-chart-arcs-gauge-title{dominant-baseline:middle;font-size:2.7em}.bb-chart-arcs .bb-chart-arcs-background{fill:#e0e0e0;stroke:#fff}.bb-chart-arcs .bb-chart-arcs-gauge-unit{fill:#000;font-size:16px}.bb-chart-arcs .bb-chart-arcs-gauge-max,.bb-chart-arcs .bb-chart-arcs-gauge-min{fill:#777}.bb-chart-arcs .bb-levels circle{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-arcs .bb-levels text{fill:#848282}.bb-chart-radars .bb-levels polygon{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-levels text{fill:#848282}.bb-chart-radars .bb-axis line{stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-axis text{font-size:1.15em;cursor:default}.bb-chart-radars .bb-shapes polygon{fill-opacity:.2;stroke-width:1px}.bb-button{position:absolute;top:10px;right:10px}.bb-button .bb-zoom-reset{font-size:11px;border:solid 1px #ccc;background-color:#fff;padding:5px;border-radius:5px;cursor:pointer}
|