billboard.js 3.12.0 → 3.12.2-patch
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 +1 -1
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +57 -35
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +9 -9
- package/dist/billboard.pkgd.js +224 -202
- package/dist/billboard.pkgd.min.js +16 -16
- 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 +3 -3
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.js +3 -3
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +5 -5
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +6 -6
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
- 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 +72 -39
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +12 -12
- package/src/ChartInternal/data/load.ts +3 -0
- package/src/ChartInternal/interactions/zoom.ts +0 -4
- package/src/ChartInternal/shape/funnel.ts +49 -25
- package/src/ChartInternal/shape/treemap.ts +19 -10
- package/src/module/util.ts +2 -2
- package/types/types.d.ts +1 -0
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ If you have any questions, checkout the previous posts or create a new one at:
|
|
|
40
40
|
- [Issue with 'question' label](https://github.com/naver/billboard.js/issues?utf8=%E2%9C%93&q=label%3Aquestion)
|
|
41
41
|
|
|
42
42
|
## Supported chart types
|
|
43
|
-
<img src="https://naver.github.io/billboard.js/img/chart-types.png?v=
|
|
43
|
+
<img src="https://naver.github.io/billboard.js/img/chart-types.png?v=14" width=800>
|
|
44
44
|
|
|
45
45
|
## Download and Installation
|
|
46
46
|
|
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.12.
|
|
8
|
+
* @version 3.12.2-patch
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -2660,7 +2660,7 @@ function convertInputType(mouse, touch) {
|
|
|
2660
2660
|
}
|
|
2661
2661
|
}
|
|
2662
2662
|
}
|
|
2663
|
-
const hasMouse = mouse &&
|
|
2663
|
+
const hasMouse = mouse && ((matchMedia == null ? void 0 : matchMedia("any-hover:hover").matches) || (matchMedia == null ? void 0 : matchMedia("any-pointer:fine").matches));
|
|
2664
2664
|
return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
|
|
2665
2665
|
}
|
|
2666
2666
|
function runUntil(fn, conditionFn) {
|
|
@@ -4489,6 +4489,7 @@ function callDone(fn, resizeAfter = false) {
|
|
|
4489
4489
|
$$.data.targets = $$.data.targets.filter((t) => t.id !== id);
|
|
4490
4490
|
hasLegendDefsPoint && ((_a2 = $el.defs) == null ? void 0 : _a2.select(`#${$$.getDefsPointId(suffixId)}`).remove());
|
|
4491
4491
|
});
|
|
4492
|
+
state.hasFunnel && $$.updateFunnel($$.data.targets);
|
|
4492
4493
|
state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
|
|
4493
4494
|
$$.updateTypesElements();
|
|
4494
4495
|
}
|
|
@@ -11203,8 +11204,6 @@ extend(zoom, {
|
|
|
11203
11204
|
const $$ = this;
|
|
11204
11205
|
const { config, $el: { eventRect } } = $$;
|
|
11205
11206
|
const behaviour = config.zoom_type === "drag" ? $$.zoomBehaviour : $$.zoom;
|
|
11206
|
-
$$.$el.svg.on("wheel", () => {
|
|
11207
|
-
});
|
|
11208
11207
|
eventRect == null ? void 0 : eventRect.call(behaviour).on("dblclick.zoom", null);
|
|
11209
11208
|
},
|
|
11210
11209
|
/**
|
|
@@ -18637,13 +18636,16 @@ function getSize(checkNeck = false) {
|
|
|
18637
18636
|
height: height - (config.legend_show ? $$.getLegendHeight() + 10 : 0) - (padding.top + padding.bottom)
|
|
18638
18637
|
}, padding);
|
|
18639
18638
|
if (checkNeck) {
|
|
18640
|
-
const { width: neckWidth } = getNecklSize.call($$, {
|
|
18639
|
+
const { width: neckWidth, height: neckHeight } = getNecklSize.call($$, {
|
|
18641
18640
|
width: size.width,
|
|
18642
18641
|
height: size.height
|
|
18643
18642
|
});
|
|
18644
18643
|
if (size.width < neckWidth) {
|
|
18645
18644
|
size.width = neckWidth;
|
|
18646
18645
|
}
|
|
18646
|
+
if (size.height < neckHeight) {
|
|
18647
|
+
size.height = neckHeight;
|
|
18648
|
+
}
|
|
18647
18649
|
}
|
|
18648
18650
|
return size;
|
|
18649
18651
|
}
|
|
@@ -18666,49 +18668,55 @@ function getNecklSize(current) {
|
|
|
18666
18668
|
}
|
|
18667
18669
|
function getCoord(d) {
|
|
18668
18670
|
const $$ = this;
|
|
18669
|
-
const { top, width } = getSize.call($$, true);
|
|
18671
|
+
const { top, left, width } = getSize.call($$, true);
|
|
18670
18672
|
const coords = [];
|
|
18671
18673
|
d.forEach((d2, i) => {
|
|
18672
18674
|
const { ratio } = d2;
|
|
18673
18675
|
const y = i > 0 ? coords[i - 1][2][1] : top;
|
|
18674
18676
|
coords.push(d2.coords = [
|
|
18675
|
-
[
|
|
18677
|
+
[left, y],
|
|
18676
18678
|
// M
|
|
18677
|
-
[width, y],
|
|
18679
|
+
[left + width, y],
|
|
18678
18680
|
// 1
|
|
18679
|
-
[width, i > 0 ? ratio + y : ratio + top],
|
|
18681
|
+
[left + width, i > 0 ? ratio + y : ratio + top],
|
|
18680
18682
|
// 2
|
|
18681
|
-
[
|
|
18683
|
+
[left, i > 0 ? ratio + y : ratio + top],
|
|
18682
18684
|
// 3
|
|
18683
|
-
[
|
|
18685
|
+
[left, y]
|
|
18684
18686
|
// 4
|
|
18685
18687
|
]);
|
|
18686
18688
|
});
|
|
18687
18689
|
return coords;
|
|
18688
18690
|
}
|
|
18689
|
-
function
|
|
18691
|
+
function getClipPath(forBackground = false) {
|
|
18690
18692
|
const $$ = this;
|
|
18691
18693
|
const { width, height, top, left } = getSize.call($$, true);
|
|
18692
18694
|
const neck = getNecklSize.call($$, { width, height });
|
|
18693
|
-
const rightX = (width + neck.width) / 2;
|
|
18694
18695
|
const leftX = (width - neck.width) / 2;
|
|
18696
|
+
const rightX = (width + neck.width) / 2;
|
|
18695
18697
|
const bodyHeigth = height - neck.height;
|
|
18696
18698
|
const coords = [
|
|
18697
|
-
[0
|
|
18699
|
+
[0, 0],
|
|
18698
18700
|
// M
|
|
18699
|
-
[width
|
|
18701
|
+
[width, 0],
|
|
18700
18702
|
// 1
|
|
18701
18703
|
[rightX, bodyHeigth],
|
|
18702
18704
|
// 2
|
|
18703
|
-
[rightX, height
|
|
18705
|
+
[rightX, height],
|
|
18704
18706
|
// 3
|
|
18705
|
-
[leftX, height
|
|
18707
|
+
[leftX, height],
|
|
18706
18708
|
// 4
|
|
18707
18709
|
[leftX, bodyHeigth],
|
|
18708
18710
|
// 5
|
|
18709
|
-
[0
|
|
18711
|
+
[0, 0]
|
|
18710
18712
|
// 6
|
|
18711
18713
|
];
|
|
18714
|
+
if (forBackground) {
|
|
18715
|
+
coords.forEach((d) => {
|
|
18716
|
+
d[0] += left;
|
|
18717
|
+
d[1] += top;
|
|
18718
|
+
});
|
|
18719
|
+
}
|
|
18712
18720
|
return `M${coords.join("L")}z`;
|
|
18713
18721
|
}
|
|
18714
18722
|
function getFunnelData(d) {
|
|
@@ -18796,23 +18804,35 @@ function updateRatio(data) {
|
|
|
18796
18804
|
mainFunnelEnter.append("path");
|
|
18797
18805
|
funnel.path = mainFunnelEnter.merge(mainFunnelUpdate).attr("class", (d) => classChartFunnel(d)).select("path").attr("class", classFunnel).style("opacity", "0").style("fill", $$.color);
|
|
18798
18806
|
},
|
|
18807
|
+
/**
|
|
18808
|
+
* Update funnel path selection
|
|
18809
|
+
* @param {object} targets Updated target data
|
|
18810
|
+
* @private
|
|
18811
|
+
*/
|
|
18812
|
+
updateFunnel(targets) {
|
|
18813
|
+
const $$ = this;
|
|
18814
|
+
const { $el: { funnel } } = $$;
|
|
18815
|
+
const targetIds = targets.map(({ id }) => id);
|
|
18816
|
+
funnel.path = funnel.path.filter((d) => targetIds.indexOf(d.id) >= 0);
|
|
18817
|
+
},
|
|
18799
18818
|
/**
|
|
18800
18819
|
* Generate treemap coordinate points data
|
|
18801
18820
|
* @returns {Array} Array of coordinate points
|
|
18802
18821
|
* @private
|
|
18803
18822
|
*/
|
|
18804
18823
|
generateGetFunnelPoints() {
|
|
18805
|
-
var _a;
|
|
18806
18824
|
const $$ = this;
|
|
18807
18825
|
const { $el: { funnel } } = $$;
|
|
18808
18826
|
const targets = $$.filterTargetsToShow(funnel.path);
|
|
18827
|
+
const { top, left, right } = getSize.call($$);
|
|
18828
|
+
const center = (left - right) / 2;
|
|
18809
18829
|
const points = {};
|
|
18810
|
-
let accumulatedHeight =
|
|
18830
|
+
let accumulatedHeight = top != null ? top : 0;
|
|
18811
18831
|
targets.each((d, i) => {
|
|
18812
|
-
var
|
|
18832
|
+
var _a;
|
|
18813
18833
|
points[d.id] = [
|
|
18814
|
-
[
|
|
18815
|
-
[
|
|
18834
|
+
[center, accumulatedHeight],
|
|
18835
|
+
[center, accumulatedHeight += ((_a = targets == null ? void 0 : targets[i]) != null ? _a : d).ratio]
|
|
18816
18836
|
];
|
|
18817
18837
|
});
|
|
18818
18838
|
return (d) => points[d.id];
|
|
@@ -18826,9 +18846,8 @@ function updateRatio(data) {
|
|
|
18826
18846
|
const { $T, $el: { funnel } } = $$;
|
|
18827
18847
|
const targets = $$.filterTargetsToShow(funnel.path);
|
|
18828
18848
|
const coords = getCoord.call($$, updateRatio.call($$, targets.data()));
|
|
18829
|
-
|
|
18830
|
-
funnel.attr("
|
|
18831
|
-
funnel.background.attr("d", neckPath);
|
|
18849
|
+
funnel.attr("clip-path", `path('${getClipPath.bind($$)()}')`);
|
|
18850
|
+
funnel.background.attr("d", getClipPath.call($$, true));
|
|
18832
18851
|
$T(targets).attr("d", (d, i) => `M${coords[i].join("L")}z`).style("opacity", "1");
|
|
18833
18852
|
funnel.selectAll("g").style("opacity", null);
|
|
18834
18853
|
}
|
|
@@ -19985,6 +20004,16 @@ function convertDataToTreemapData(data) {
|
|
|
19985
20004
|
};
|
|
19986
20005
|
});
|
|
19987
20006
|
}
|
|
20007
|
+
function getHierachyData(data) {
|
|
20008
|
+
const $$ = this;
|
|
20009
|
+
const hierarchyData = (0,external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.hierarchy)(data).sum((d) => d.value);
|
|
20010
|
+
const sortFn = $$.getSortCompareFn(true);
|
|
20011
|
+
return [
|
|
20012
|
+
$$.treemap(
|
|
20013
|
+
sortFn ? hierarchyData.sort(sortFn) : hierarchyData
|
|
20014
|
+
)
|
|
20015
|
+
];
|
|
20016
|
+
}
|
|
19988
20017
|
/* harmony default export */ var treemap = ({
|
|
19989
20018
|
initTreemap() {
|
|
19990
20019
|
const $$ = this;
|
|
@@ -19998,13 +20027,6 @@ function convertDataToTreemapData(data) {
|
|
|
19998
20027
|
} = $$;
|
|
19999
20028
|
clip.id = `${datetimeId}-clip`;
|
|
20000
20029
|
$$.treemap = (0,external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemap)().tile($$.getTreemapTile());
|
|
20001
|
-
$$.treemapFn = (data) => {
|
|
20002
|
-
const hierarchyData = (0,external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.hierarchy)(data).sum((d) => d.value);
|
|
20003
|
-
const sortFn = $$.getSortCompareFn(true);
|
|
20004
|
-
return $$.treemap(
|
|
20005
|
-
sortFn ? hierarchyData.sort(sortFn) : hierarchyData
|
|
20006
|
-
);
|
|
20007
|
-
};
|
|
20008
20030
|
$el.defs.append("clipPath").attr("id", clip.id).append("rect").attr("width", width).attr("height", height);
|
|
20009
20031
|
$el.treemap = $el.main.select(`.${$COMMON.chart}`).attr("clip-path", `url(#${clip.id})`).append("g").classed($TREEMAP.chartTreemaps, true);
|
|
20010
20032
|
$$.bindTreemapEvent();
|
|
@@ -20091,7 +20113,7 @@ function convertDataToTreemapData(data) {
|
|
|
20091
20113
|
updateTargetsForTreemap(targets) {
|
|
20092
20114
|
const $$ = this;
|
|
20093
20115
|
const { $el: { treemap } } = $$;
|
|
20094
|
-
const treemapData =
|
|
20116
|
+
const treemapData = getHierachyData.call($$, $$.getTreemapData(targets != null ? targets : $$.data.targets));
|
|
20095
20117
|
treemap.data(treemapData);
|
|
20096
20118
|
},
|
|
20097
20119
|
/**
|
|
@@ -21508,7 +21530,7 @@ const bb = {
|
|
|
21508
21530
|
* bb.version; // "1.0.0"
|
|
21509
21531
|
* @memberof bb
|
|
21510
21532
|
*/
|
|
21511
|
-
version: "3.12.
|
|
21533
|
+
version: "3.12.2-patch",
|
|
21512
21534
|
/**
|
|
21513
21535
|
* Generate chart
|
|
21514
21536
|
* - **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.12.
|
|
8
|
+
* @version 3.12.2-patch
|
|
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}
|