billboard.js 2.2.5 → 2.2.7
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/CHANGELOG.md +14 -0
- package/dist/billboard.css +1 -1
- package/dist/billboard.esm.js +384 -387
- package/dist/billboard.js +3008 -3656
- package/dist/billboard.js.map +1 -0
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +17963 -14767
- package/dist/billboard.pkgd.min.js +2 -2
- package/dist/package.json +1 -0
- package/dist/plugin/billboardjs-plugin-bubblecompare.esm.js +14 -21
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +30 -45
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.esm.js +31 -39
- package/dist/plugin/billboardjs-plugin-stanford.js +281 -345
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.esm.js +20 -28
- package/dist/plugin/billboardjs-plugin-textoverlap.js +243 -291
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- 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/package.json +16 -16
- package/src/ChartInternal/data/data.ts +3 -2
- package/src/ChartInternal/internals/redraw.ts +7 -6
- package/src/ChartInternal/internals/tooltip.ts +9 -9
- package/src/ChartInternal/shape/arc.ts +4 -2
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 2.2.
|
|
8
|
+
* @version 2.2.7
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
12
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("d3-interpolate"),require("d3-color"),require("d3-scale"),require("d3-selection"),require("d3-brush"),require("d3-axis"),require("d3-format")):"function"==typeof define&&define.amd?define("bb",["d3-interpolate","d3-color","d3-scale","d3-selection","d3-brush","d3-axis","d3-format"],e):"object"==typeof exports?exports.bb=e(require("d3-interpolate"),require("d3-color"),require("d3-scale"),require("d3-selection"),require("d3-brush"),require("d3-axis"),require("d3-format")):(t.bb=t.bb||{},t.bb.plugin=t.bb.plugin||{},t.bb.plugin.stanford=e(t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3))}(this,(function(t,e,n,o,r,i,a){return function(){"use strict";var s=[,function(t){t.exports=o},,function(e){e.exports=t},function(t){t.exports=e},function(t){t.exports=n},function(t){t.exports=r},function(t){t.exports=i},function(t){t.exports=a}],c={};function l(t){if(c[t])return c[t].exports;var e=c[t]={exports:{}};return s[t](e,e.exports,l),e.exports}l.d=function(t,e){for(var n in e)l.o(e,n)&&!l.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},l.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var u={};return function(){function t(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function e(t,n){return(e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,n)}l.d(u,{default:function(){return D}});var n=l(3),o=l(4),r=l(5),i="bb-tooltip",a="bb-tooltip-name";l(1),l(6);var s="object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis||"object"==typeof global&&null!==global&&global.Object===Object&&global||"object"==typeof self&&null!==self&&self.Object===Object&&self||Function("return this")(),c=s&&s.document;var d=function(t){return"function"==typeof t},f=function(t){return"string"==typeof t},p=function(t){return"number"==typeof t},h=function(t){return void 0!==t},g=function(t){return"object"==typeof t},v=function(t){return void 0===t||null===t||f(t)&&0===t.length||g(t)&&!(t instanceof Date)&&0===Object.keys(t).length||p(t)&&isNaN(t)};!function(){try{new MouseEvent("t")}catch(t){return function(t,e,n){void 0===n&&(n={bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});var o=c.createEvent("MouseEvent");o.initMouseEvent(e,n.bubbles,n.cancelable,s,0,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),t.dispatchEvent(o)}}}();function b(t){var e;if(t instanceof Date)e=t;else if(f(t)){var n=this.config;e=this.format.dataTime(n.data_xFormat)(t)}else p(t)&&!isNaN(t)&&(e=new Date(+t));return(!e||isNaN(+e))&&console&&console.error&&console.error("Failed to parse x '"+t+"' to Date object"),e}function x(t){var e,n,o,r=this.config,i=function(){var t=n.shift();return t&&e&&g(e)&&t in e?(e=e[t],i()):t?void 0:e};Object.keys(r).forEach((function(a){e=t,n=a.split("_"),o=i(),h(o)&&(r[a]=o)}))}var y=function(){function t(t){void 0===t&&(t={}),this.$$=void 0,this.options=void 0,this.options=t}var e=t.prototype;return e.$beforeInit=function(){},e.$init=function(){},e.$afterInit=function(){},e.$redraw=function(){},e.$willDestroy=function(){var t=this;Object.keys(this).forEach((function(e){t[e]=null,delete t[e]}))},t}();y.version="2.2.4";var m=function(){return{colors:void 0,epochs:[],lines:[],scale_min:void 0,scale_max:void 0,scale_width:20,scale_format:void 0,padding_top:0,padding_right:0,padding_bottom:0,padding_left:0,regions:[]}},S="bb-colorscale",w="bb-stanford-elements",_="bb-stanford-line",$="bb-stanford-lines",E="bb-stanford-region",j="bb-stanford-regions";function C(t,e){return t.epochs<e.epochs?-1:t.epochs>e.epochs?1:0}function M(t){for(var e,n=function(t){for(var e,n,o=0,r=0,i=t.length,a=i-1;r<i;a=r,r++)e=t[r],n=t[a],o+=e.x*n.y,o-=e.y*n.x;return o/2}(t),o=0,r=0,i=0,a=t.length,s=a-1;i<a;s=i,i++){var c=t[i],l=t[s];e=c.x*l.y-l.x*c.y,o+=(c.x+l.x)*e,r+=(c.y+l.y)*e}return{x:o/(e=6*n),y:r/e}}var O=function(){function t(t){this.owner=void 0,this.owner=t;var e=t.$$.$el.main.select(".bb-chart").append("g").attr("class",w);e.append("g").attr("class",$),e.append("g").attr("class",j)}var e=t.prototype;return e.updateStanfordLines=function(t){var e=this.owner.$$,n=e.config,o=e.$el.main,r=n.axis_rotated,i=this.xvCustom.bind(e),a=this.yvCustom.bind(e),s=o.select("."+$).style("shape-rendering","geometricprecision").selectAll("."+_).data(this.owner.config.lines);s.exit().transition().duration(t).style("opacity","0").remove();var c=s.enter().append("g");c.append("line").style("opacity","0"),c.merge(s).attr("class",(function(t){return _+(t.class?" "+t.class:"")})).select("line").transition().duration(t).attr("x1",(function(t){return r?a(t,"y1"):i(t,"x1")})).attr("x2",(function(t){return r?a(t,"y2"):i(t,"x2")})).attr("y1",(function(t){return r?i(t,"x1"):a(t,"y1")})).attr("y2",(function(t){return r?i(t,"x2"):a(t,"y2")})).transition().style("opacity","1")},e.updateStanfordRegions=function(t){var e=this.owner.$$,n=e.config,o=e.$el.main,r=n.axis_rotated,i=this.xvCustom.bind(e),a=this.yvCustom.bind(e),s=this.owner.countEpochsInRegion.bind(e),c=o.select("."+j).selectAll("."+E).data(this.owner.config.regions);c.exit().transition().duration(t).style("opacity","0").remove();var l=c.enter().append("g");l.append("polygon").style("opacity","0"),l.append("text").attr("transform",r?"rotate(-90)":"").style("opacity","0"),(c=l.merge(c)).attr("class",(function(t){return E+(t.class?" "+t.class:"")})).select("polygon").transition().duration(t).attr("points",(function(t){return t.points.map((function(t){return[r?a(t,"y"):i(t,"x"),r?i(t,"x"):a(t,"y")].join(",")})).join(" ")})).transition().style("opacity",(function(t){return(t.opacity?t.opacity:.2)+""})),c.select("text").transition().duration(t).attr("x",(function(t){return r?a(M(t.points),"y"):i(M(t.points),"x")})).attr("y",(function(t){return r?i(M(t.points),"x"):a(M(t.points),"y")})).text((function(t){if(t.text){var e=s(t.points),n=e.value,o=e.percentage;return t.text(n,o)}return""})).attr("text-anchor","middle").attr("dominant-baseline","middle").transition().style("opacity","1")},e.updateStanfordElements=function(t){void 0===t&&(t=0),this.updateStanfordLines(t),this.updateStanfordRegions(t)},e.xvCustom=function(t,e){var n=this,o=n.axis,r=n.config,i=e?t[e]:n.getBaseValue(t);return o.isTimeSeries()?i=b.call(n,i):o.isCategorized()&&f(i)&&(i=r.axis_x_categories.indexOf(t.value)),Math.ceil(n.scale.x(i))},e.yvCustom=function(t,e){var n=this,o=t.axis&&"y2"===t.axis?n.scale.y2:n.scale.y,r=e?t[e]:n.getBaseValue(t);return Math.ceil(o(r))},t}(),q=l(7),N=l(8),F=function(){function t(t){this.owner=void 0,this.colorScale=void 0,this.owner=t}var e=t.prototype;return e.drawColorScale=function(){var t=this.owner,e=t.$$,n=t.config,o=e.data.targets[0],i=e.state.height-n.padding_bottom-n.padding_top,a=n.scale_width,s=function(t,e,n){void 0===n&&(n=1);for(var o=[],r=0|Math.max(0,Math.ceil((e-t)/n)),i=t;i<r;i++)o.push(t+i*n);return o}(n.padding_bottom,i,5),c=(0,r.scaleSequential)(o.colors).domain([s[s.length-1],s[0]]);this.colorScale&&this.colorScale.remove(),this.colorScale=e.$el.svg.append("g").attr("width",50).attr("height",i).attr("class",S),this.colorScale.append("g").attr("transform","translate(0, "+n.padding_top+")").selectAll("bars").data(s).enter().append("rect").attr("y",(function(t,e){return 5*e})).attr("x",0).attr("width",a).attr("height",5).attr("fill",(function(t){return c(t)}));var l=(0,r.scaleLog)().domain([o.minEpochs,o.maxEpochs]).range([s[0]+n.padding_top+s[s.length-1]+5-1,s[0]+n.padding_top]),u=(0,q.axisRight)(l),f=n.scale_format;"pow10"===f?u.tickValues([1,10,100,1e3,1e4,1e5,1e6,1e7]):d(f)?u.tickFormat(f):u.tickFormat((0,N.format)("d"));var p=this.colorScale.append("g").attr("class","legend axis").attr("transform","translate("+a+",0)").call(u);"pow10"===f&&p.selectAll(".tick text").text(null).filter((function(t){return t/Math.pow(10,Math.ceil(Math.log(t)/Math.LN10-1e-12))==1})).text(10).append("tspan").attr("dy","-.7em").text((function(t){return Math.round(Math.log(t)/Math.LN10)})),this.colorScale.attr("transform","translate("+(e.state.current.width-this.xForColorScale())+", 0)")},e.xForColorScale=function(){return this.owner.config.padding_right+this.colorScale.node().getBBox().width},e.getColorScalePadding=function(){return this.xForColorScale()+this.owner.config.padding_left+20},t}(),D=function(s){function c(e){var n;return(n=s.call(this,e)||this).config=void 0,n.colorScale=void 0,n.elements=void 0,n.config=new m,t(n)||t(n)}var l,u;u=s,(l=c).prototype=Object.create(u.prototype),l.prototype.constructor=l,e(l,u);var p=c.prototype;return p.$beforeInit=function(){var t=this,e=this.$$;e.config.data_xSort=!1,e.isMultipleX=function(){return!0},e.showGridFocus=function(){},e.labelishData=function(t){return t.values},e.opacityForCircle=function(){return 1};var n=e.getCurrentPaddingRight.bind(e);e.getCurrentPaddingRight=function(){return n()+(t.colorScale?t.colorScale.getColorScalePadding():0)}},p.$init=function(){var t=this.$$;x.call(this,this.options),t.color=this.getStanfordPointColor.bind(t),this.colorScale=new F(this),this.elements=new O(this),this.convertData(),this.initStanfordData(),this.setStanfordTooltip(),this.colorScale.drawColorScale(),this.$redraw()},p.$redraw=function(t){this.colorScale&&this.colorScale.drawColorScale(),this.elements&&this.elements.updateStanfordElements(t)},p.getOptions=function(){return new m},p.convertData=function(){var t=this.$$.data.targets,e=this.options.epochs;t.forEach((function(t){t.values.forEach((function(t,n){t.epochs=e[n]})),t.minEpochs=void 0,t.maxEpochs=void 0,t.colors=void 0,t.colorscale=void 0}))},p.xvCustom=function(t,e){var n=this,o=n.axis,r=n.config,i=e?t[e]:n.getBaseValue(t);return o.isTimeSeries()?i=b.call(n,i):o.isCategorized()&&f(i)&&(i=r.axis_x_categories.indexOf(t.value)),Math.ceil(n.scale.x(i))},p.yvCustom=function(t,e){var n=this.scale,o=t.axis&&"y2"===t.axis?n.y2:n.y,r=e?t[e]:this.getBaseValue(t);return Math.ceil(o(r))},p.initStanfordData=function(){var t=this.config,e=this.$$.data.targets[0];e.values.sort(C);var i=e.values.map((function(t){return t.epochs}));e.minEpochs=isNaN(t.scale_min)?Math.min.apply(Math,i):t.scale_min,e.maxEpochs=isNaN(t.scale_max)?Math.max.apply(Math,i):t.scale_max,e.colors=d(t.colors)?t.colors:(0,n.interpolateHslLong)((0,o.hsl)(250,1,.5),(0,o.hsl)(0,1,.5)),e.colorscale=(0,r.scaleSequentialLog)(e.colors).domain([e.minEpochs,e.maxEpochs])},p.getStanfordPointColor=function(t){return this.data.targets[0].colorscale(t.epochs)},p.setStanfordTooltip=function(){var t=this.$$.config;v(t.tooltip_contents)&&(t.tooltip_contents=function(e,n,o,r){var s='<table class="'+i+'"><tbody>';return e.forEach((function(e){s+="<tr>\n\t\t\t\t\t\t\t<th>"+n(t.data_x)+'</th>\n\t\t\t\t\t\t\t<th class="value">'+o(e.x)+"</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>"+n(e.id)+'</th>\n\t\t\t\t\t\t\t<th class="value">'+o(e.value)+'</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class="'+a+"-"+e.id+'">\n\t\t\t\t\t\t\t<td class="name"><span style="background-color:'+r(e)+'"></span>'+n("Epochs")+'</td>\n\t\t\t\t\t\t\t<td class="value">'+o(e.epochs)+"</td>\n\t\t\t\t\t\t</tr>"})),s+"</tbody></table>"})},p.countEpochsInRegion=function(t){var e=this.data.targets[0],n=e.values.reduce((function(t,e){return t+ +e.epochs}),0),o=e.values.reduce((function(e,n){return function(t,e){for(var n=t.x,o=t.value,r=!1,i=0,a=e.length-1;i<e.length;a=i++){var s=e[i].x,c=e[i].y,l=e[a].x,u=e[a].y;c>o!=u>o&&n<(l-s)*(o-c)/(u-c)+s&&(r=!r)}return r}(n,t)?e+ +n.epochs:e}),0);return{value:o,percentage:0===o?0:+(o/n*100).toFixed(1)}},c}(y)}(),u=u.default}()}));
|
|
12
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("d3-interpolate"),require("d3-color"),require("d3-scale"),require("d3-selection"),require("d3-brush"),require("d3-axis"),require("d3-format")):"function"==typeof define&&define.amd?define("bb",["d3-interpolate","d3-color","d3-scale","d3-selection","d3-brush","d3-axis","d3-format"],e):"object"==typeof exports?exports.bb=e(require("d3-interpolate"),require("d3-color"),require("d3-scale"),require("d3-selection"),require("d3-brush"),require("d3-axis"),require("d3-format")):(t.bb=t.bb||{},t.bb.plugin=t.bb.plugin||{},t.bb.plugin.stanford=e(t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3))}(this,(function(t,e,n,r,o,a,i){return function(){"use strict";var s=[,function(t){t.exports=r},,function(e){e.exports=t},function(t){t.exports=e},function(t){t.exports=n},function(t){t.exports=o},function(t){t.exports=a},function(t){t.exports=i}],c={};function l(t){var e=c[t];if(void 0!==e)return e.exports;var n=c[t]={exports:{}};return s[t](n,n.exports,l),n.exports}l.d=function(t,e){for(var n in e)l.o(e,n)&&!l.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},l.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var b={};return function(){function t(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function e(t,n){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},e(t,n)}l.d(b,{default:function(){return L}});var n=l(3),r=l(4),o=l(5),a={arc:"bb-arc",arcLabelLine:"bb-arc-label-line",arcs:"bb-arcs",area:"bb-area",areas:"bb-areas",axis:"bb-axis",axisX:"bb-axis-x",axisXLabel:"bb-axis-x-label",axisY:"bb-axis-y",axisY2:"bb-axis-y2",axisY2Label:"bb-axis-y2-label",axisYLabel:"bb-axis-y-label",bar:"bb-bar",bars:"bb-bars",brush:"bb-brush",button:"bb-button",buttonZoomReset:"bb-zoom-reset",chart:"bb-chart",chartArc:"bb-chart-arc",chartArcs:"bb-chart-arcs",chartArcsBackground:"bb-chart-arcs-background",chartArcsGaugeMax:"bb-chart-arcs-gauge-max",chartArcsGaugeMin:"bb-chart-arcs-gauge-min",chartArcsGaugeUnit:"bb-chart-arcs-gauge-unit",chartArcsTitle:"bb-chart-arcs-title",chartArcsGaugeTitle:"bb-chart-arcs-gauge-title",chartBar:"bb-chart-bar",chartBars:"bb-chart-bars",chartCircles:"bb-chart-circles",chartLine:"bb-chart-line",chartLines:"bb-chart-lines",chartRadar:"bb-chart-radar",chartRadars:"bb-chart-radars",chartText:"bb-chart-text",chartTexts:"bb-chart-texts",circle:"bb-circle",circles:"bb-circles",colorPattern:"bb-color-pattern",colorScale:"bb-colorscale",defocused:"bb-defocused",dragarea:"bb-dragarea",empty:"bb-empty",eventRect:"bb-event-rect",eventRects:"bb-event-rects",eventRectsMultiple:"bb-event-rects-multiple",eventRectsSingle:"bb-event-rects-single",focused:"bb-focused",gaugeValue:"bb-gauge-value",grid:"bb-grid",gridLines:"bb-grid-lines",legend:"bb-legend",legendBackground:"bb-legend-background",legendItem:"bb-legend-item",legendItemEvent:"bb-legend-item-event",legendItemFocused:"bb-legend-item-focused",legendItemHidden:"bb-legend-item-hidden",legendItemPoint:"bb-legend-item-point",legendItemTile:"bb-legend-item-tile",level:"bb-level",levels:"bb-levels",line:"bb-line",lines:"bb-lines",main:"bb-main",region:"bb-region",regions:"bb-regions",selectedCircle:"bb-selected-circle",selectedCircles:"bb-selected-circles",shape:"bb-shape",shapes:"bb-shapes",stanfordElements:"bb-stanford-elements",stanfordLine:"bb-stanford-line",stanfordLines:"bb-stanford-lines",stanfordRegion:"bb-stanford-region",stanfordRegions:"bb-stanford-regions",subchart:"bb-subchart",target:"bb-target",text:"bb-text",texts:"bb-texts",title:"bb-title",tooltip:"bb-tooltip",tooltipContainer:"bb-tooltip-container",tooltipName:"bb-tooltip-name",xgrid:"bb-xgrid",xgridFocus:"bb-xgrid-focus",xgridLine:"bb-xgrid-line",xgridLines:"bb-xgrid-lines",xgrids:"bb-xgrids",ygrid:"bb-ygrid",ygridFocus:"bb-ygrid-focus",ygridLine:"bb-ygrid-line",ygridLines:"bb-ygrid-lines",ygrids:"bb-ygrids",zoomBrush:"bb-zoom-brush",EXPANDED:"_expanded_",SELECTED:"_selected_",INCLUDED:"_included_",TextOverlapping:"text-overlapping"};l(1),l(6);var i="object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis||"object"==typeof global&&null!==global&&global.Object===Object&&global||"object"==typeof self&&null!==self&&self.Object===Object&&self||Function("return this")(),s=i&&i.document;var c=function(t){return"function"==typeof t},d=function(t){return"string"==typeof t},u=function(t){return"number"==typeof t},f=function(t){return void 0!==t},h=function(t){return"object"==typeof t},p=function(t){return void 0===t||null===t||d(t)&&0===t.length||h(t)&&!(t instanceof Date)&&0===Object.keys(t).length||u(t)&&isNaN(t)};!function(){try{new MouseEvent("t")}catch(t){return function(t,e,n){void 0===n&&(n={bubbles:!1,cancelable:!1,screenX:0,screenY:0,clientX:0,clientY:0});var r=s.createEvent("MouseEvent");r.initMouseEvent(e,n.bubbles,n.cancelable,i,0,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),t.dispatchEvent(r)}}}();function g(t){var e;if(t instanceof Date)e=t;else if(d(t)){var n=this.config;e=this.format.dataTime(n.data_xFormat)(t)}else u(t)&&!isNaN(t)&&(e=new Date(+t));return(!e||isNaN(+e))&&console&&console.error&&console.error("Failed to parse x '"+t+"' to Date object"),e}function x(t){var e,n,r,o=this.config,a=function(){var t=n.shift();return t&&e&&h(e)&&t in e?(e=e[t],a()):t?void 0:e};Object.keys(o).forEach((function(i){e=t,n=i.split("_"),r=a(),f(r)&&(o[i]=r)}))}var v=function(){function t(t){void 0===t&&(t={}),this.$$=void 0,this.options=void 0,this.options=t}var e=t.prototype;return e.$beforeInit=function(){},e.$init=function(){},e.$afterInit=function(){},e.$redraw=function(){},e.$willDestroy=function(){var t=this;Object.keys(this).forEach((function(e){t[e]=null,delete t[e]}))},t}();v.version="2.2.7";var m=function(){return{colors:void 0,epochs:[],lines:[],scale_min:void 0,scale_max:void 0,scale_width:20,scale_format:void 0,padding_top:0,padding_right:0,padding_bottom:0,padding_left:0,regions:[]}},y={colorScale:"bb-colorscale",stanfordElements:"bb-stanford-elements",stanfordLine:"bb-stanford-line",stanfordLines:"bb-stanford-lines",stanfordRegion:"bb-stanford-region",stanfordRegions:"bb-stanford-regions"};function S(t,e){return t.epochs<e.epochs?-1:t.epochs>e.epochs?1:0}function _(t){for(var e,n=function(t){for(var e,n,r=0,o=0,a=t.length,i=a-1;o<a;i=o,o++)e=t[o],n=t[i],r+=e.x*n.y,r-=e.y*n.x;return r/2}(t),r=0,o=0,a=0,i=t.length,s=i-1;a<i;s=a,a++){var c=t[a],l=t[s];e=c.x*l.y-l.x*c.y,r+=(c.x+l.x)*e,o+=(c.y+l.y)*e}return{x:r/(e=6*n),y:o/e}}var w=function(){function t(t){this.owner=void 0,this.owner=t;var e=t.$$.$el.main.select(".bb-chart").append("g").attr("class",y.stanfordElements);e.append("g").attr("class",y.stanfordLines),e.append("g").attr("class",y.stanfordRegions)}var e=t.prototype;return e.updateStanfordLines=function(t){var e=this.owner.$$,n=e.config,r=e.$el.main,o=n.axis_rotated,a=this.xvCustom.bind(e),i=this.yvCustom.bind(e),s=r.select("."+y.stanfordLines).style("shape-rendering","geometricprecision").selectAll("."+y.stanfordLine).data(this.owner.config.lines);s.exit().transition().duration(t).style("opacity","0").remove();var c=s.enter().append("g");c.append("line").style("opacity","0"),c.merge(s).attr("class",(function(t){return y.stanfordLine+(t.class?" "+t.class:"")})).select("line").transition().duration(t).attr("x1",(function(t){return o?i(t,"y1"):a(t,"x1")})).attr("x2",(function(t){return o?i(t,"y2"):a(t,"x2")})).attr("y1",(function(t){return o?a(t,"x1"):i(t,"y1")})).attr("y2",(function(t){return o?a(t,"x2"):i(t,"y2")})).transition().style("opacity","1")},e.updateStanfordRegions=function(t){var e=this.owner.$$,n=e.config,r=e.$el.main,o=n.axis_rotated,a=this.xvCustom.bind(e),i=this.yvCustom.bind(e),s=this.owner.countEpochsInRegion.bind(e),c=r.select("."+y.stanfordRegions).selectAll("."+y.stanfordRegion).data(this.owner.config.regions);c.exit().transition().duration(t).style("opacity","0").remove();var l=c.enter().append("g");l.append("polygon").style("opacity","0"),l.append("text").attr("transform",o?"rotate(-90)":"").style("opacity","0"),(c=l.merge(c)).attr("class",(function(t){return y.stanfordRegion+(t.class?" "+t.class:"")})).select("polygon").transition().duration(t).attr("points",(function(t){return t.points.map((function(t){return[o?i(t,"y"):a(t,"x"),o?a(t,"x"):i(t,"y")].join(",")})).join(" ")})).transition().style("opacity",(function(t){return(t.opacity?t.opacity:.2)+""})),c.select("text").transition().duration(t).attr("x",(function(t){return o?i(_(t.points),"y"):a(_(t.points),"x")})).attr("y",(function(t){return o?a(_(t.points),"x"):i(_(t.points),"y")})).text((function(t){if(t.text){var e=s(t.points),n=e.value,r=e.percentage;return t.text(n,r)}return""})).attr("text-anchor","middle").attr("dominant-baseline","middle").transition().style("opacity","1")},e.updateStanfordElements=function(t){void 0===t&&(t=0),this.updateStanfordLines(t),this.updateStanfordRegions(t)},e.xvCustom=function(t,e){var n=this,r=n.axis,o=n.config,a=e?t[e]:n.getBaseValue(t);return r.isTimeSeries()?a=g.call(n,a):r.isCategorized()&&d(a)&&(a=o.axis_x_categories.indexOf(t.value)),Math.ceil(n.scale.x(a))},e.yvCustom=function(t,e){var n=this,r=t.axis&&"y2"===t.axis?n.scale.y2:n.scale.y,o=e?t[e]:n.getBaseValue(t);return Math.ceil(r(o))},t}(),E=l(7),$=l(8),C=function(){function t(t){this.owner=void 0,this.colorScale=void 0,this.owner=t}var e=t.prototype;return e.drawColorScale=function(){var t=this.owner,e=t.$$,n=t.config,r=e.data.targets[0],a=e.state.height-n.padding_bottom-n.padding_top,i=n.scale_width,s=function(t,e,n){void 0===n&&(n=1);for(var r=[],o=0|Math.max(0,Math.ceil((e-t)/n)),a=t;a<o;a++)r.push(t+a*n);return r}(n.padding_bottom,a,5),l=(0,o.scaleSequential)(r.colors).domain([s[s.length-1],s[0]]);this.colorScale&&this.colorScale.remove(),this.colorScale=e.$el.svg.append("g").attr("width",50).attr("height",a).attr("class",y.colorScale),this.colorScale.append("g").attr("transform","translate(0, "+n.padding_top+")").selectAll("bars").data(s).enter().append("rect").attr("y",(function(t,e){return 5*e})).attr("x",0).attr("width",i).attr("height",5).attr("fill",(function(t){return l(t)}));var b=(0,o.scaleLog)().domain([r.minEpochs,r.maxEpochs]).range([s[0]+n.padding_top+s[s.length-1]+5-1,s[0]+n.padding_top]),d=(0,E.axisRight)(b),u=n.scale_format;"pow10"===u?d.tickValues([1,10,100,1e3,1e4,1e5,1e6,1e7]):c(u)?d.tickFormat(u):d.tickFormat((0,$.format)("d"));var f=this.colorScale.append("g").attr("class","legend axis").attr("transform","translate("+i+",0)").call(d);"pow10"===u&&f.selectAll(".tick text").text(null).filter((function(t){return t/Math.pow(10,Math.ceil(Math.log(t)/Math.LN10-1e-12))==1})).text(10).append("tspan").attr("dy","-.7em").text((function(t){return Math.round(Math.log(t)/Math.LN10)})),this.colorScale.attr("transform","translate("+(e.state.current.width-this.xForColorScale())+", 0)")},e.xForColorScale=function(){return this.owner.config.padding_right+this.colorScale.node().getBBox().width},e.getColorScalePadding=function(){return this.xForColorScale()+this.owner.config.padding_left+20},t}(),L=function(i){function s(e){var n;return(n=i.call(this,e)||this).config=void 0,n.colorScale=void 0,n.elements=void 0,n.config=new m,t(n)||t(n)}var l,b;b=i,(l=s).prototype=Object.create(b.prototype),l.prototype.constructor=l,e(l,b);var u=s.prototype;return u.$beforeInit=function(){var t=this,e=this.$$;e.config.data_xSort=!1,e.isMultipleX=function(){return!0},e.showGridFocus=function(){},e.labelishData=function(t){return t.values},e.opacityForCircle=function(){return 1};var n=e.getCurrentPaddingRight.bind(e);e.getCurrentPaddingRight=function(){return n()+(t.colorScale?t.colorScale.getColorScalePadding():0)}},u.$init=function(){var t=this.$$;x.call(this,this.options),t.color=this.getStanfordPointColor.bind(t),this.colorScale=new C(this),this.elements=new w(this),this.convertData(),this.initStanfordData(),this.setStanfordTooltip(),this.colorScale.drawColorScale(),this.$redraw()},u.$redraw=function(t){this.colorScale&&this.colorScale.drawColorScale(),this.elements&&this.elements.updateStanfordElements(t)},u.getOptions=function(){return new m},u.convertData=function(){var t=this.$$.data.targets,e=this.options.epochs;t.forEach((function(t){t.values.forEach((function(t,n){t.epochs=e[n]})),t.minEpochs=void 0,t.maxEpochs=void 0,t.colors=void 0,t.colorscale=void 0}))},u.xvCustom=function(t,e){var n=this,r=n.axis,o=n.config,a=e?t[e]:n.getBaseValue(t);return r.isTimeSeries()?a=g.call(n,a):r.isCategorized()&&d(a)&&(a=o.axis_x_categories.indexOf(t.value)),Math.ceil(n.scale.x(a))},u.yvCustom=function(t,e){var n=this.scale,r=t.axis&&"y2"===t.axis?n.y2:n.y,o=e?t[e]:this.getBaseValue(t);return Math.ceil(r(o))},u.initStanfordData=function(){var t=this.config,e=this.$$.data.targets[0];e.values.sort(S);var a=e.values.map((function(t){return t.epochs}));e.minEpochs=isNaN(t.scale_min)?Math.min.apply(Math,a):t.scale_min,e.maxEpochs=isNaN(t.scale_max)?Math.max.apply(Math,a):t.scale_max,e.colors=c(t.colors)?t.colors:(0,n.interpolateHslLong)((0,r.hsl)(250,1,.5),(0,r.hsl)(0,1,.5)),e.colorscale=(0,o.scaleSequentialLog)(e.colors).domain([e.minEpochs,e.maxEpochs])},u.getStanfordPointColor=function(t){return this.data.targets[0].colorscale(t.epochs)},u.setStanfordTooltip=function(){var t=this.$$.config;p(t.tooltip_contents)&&(t.tooltip_contents=function(e,n,r,o){var i='<table class="'+a.tooltip+'"><tbody>';return e.forEach((function(e){i+="<tr>\n\t\t\t\t\t\t\t<th>"+n(t.data_x)+'</th>\n\t\t\t\t\t\t\t<th class="value">'+r(e.x)+"</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>"+n(e.id)+'</th>\n\t\t\t\t\t\t\t<th class="value">'+r(e.value)+'</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class="'+a.tooltipName+"-"+e.id+'">\n\t\t\t\t\t\t\t<td class="name"><span style="background-color:'+o(e)+'"></span>'+n("Epochs")+'</td>\n\t\t\t\t\t\t\t<td class="value">'+r(e.epochs)+"</td>\n\t\t\t\t\t\t</tr>"})),i+"</tbody></table>"})},u.countEpochsInRegion=function(t){var e=this.data.targets[0],n=e.values.reduce((function(t,e){return t+ +e.epochs}),0),r=e.values.reduce((function(e,n){return function(t,e){for(var n=t.x,r=t.value,o=!1,a=0,i=e.length-1;a<e.length;i=a++){var s=e[a].x,c=e[a].y,l=e[i].x,b=e[i].y;c>r!=b>r&&n<(l-s)*(r-c)/(b-c)+s&&(o=!o)}return o}(n,t)?e+ +n.epochs:e}),0);return{value:r,percentage:0===r?0:+(r/n*100).toFixed(1)}},s}(v)}(),b=b.default}()}));
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 2.2.
|
|
8
|
+
* @version 2.2.7
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -14,7 +14,7 @@ import { polygonCentroid, polygonArea } from 'd3-polygon';
|
|
|
14
14
|
import { selectAll, select } from 'd3-selection';
|
|
15
15
|
import 'd3-brush';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/******************************************************************************
|
|
18
18
|
Copyright (c) Microsoft Corporation.
|
|
19
19
|
|
|
20
20
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -28,8 +28,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
28
28
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
29
29
|
PERFORMANCE OF THIS SOFTWARE.
|
|
30
30
|
***************************************************************************** */
|
|
31
|
-
|
|
32
31
|
/* global Reflect, Promise */
|
|
32
|
+
|
|
33
33
|
var _extendStatics = function extendStatics(d, b) {
|
|
34
34
|
return _extendStatics = Object.setPrototypeOf || {
|
|
35
35
|
__proto__: []
|
|
@@ -39,19 +39,16 @@ var _extendStatics = function extendStatics(d, b) {
|
|
|
39
39
|
for (var p in b) Object.prototype.hasOwnProperty.call(b, p) && (d[p] = b[p]);
|
|
40
40
|
}, _extendStatics(d, b);
|
|
41
41
|
};
|
|
42
|
-
|
|
43
42
|
function __extends(d, b) {
|
|
44
43
|
function __() {
|
|
45
44
|
this.constructor = d;
|
|
46
45
|
}
|
|
47
|
-
|
|
48
46
|
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + (b + "") + " is not a constructor or null");
|
|
49
47
|
_extendStatics(d, b), d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
50
48
|
}
|
|
51
|
-
function __spreadArray(to, from) {
|
|
52
|
-
for (var i = 0,
|
|
53
|
-
|
|
54
|
-
return to;
|
|
49
|
+
function __spreadArray(to, from, pack) {
|
|
50
|
+
if (pack || arguments.length === 2) for (var ar, i = 0, l = from.length; i < l; i++) (ar || !(i in from)) && (ar || (ar = Array.prototype.slice.call(from, 0, i)), ar[i] = from[i]);
|
|
51
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
/**
|
|
@@ -112,7 +109,7 @@ function mergeObj(target) {
|
|
|
112
109
|
}
|
|
113
110
|
});
|
|
114
111
|
}
|
|
115
|
-
return mergeObj.apply(void 0, __spreadArray([target], objectN));
|
|
112
|
+
return mergeObj.apply(void 0, __spreadArray([target], objectN, false));
|
|
116
113
|
}
|
|
117
114
|
// emulate event
|
|
118
115
|
({
|
|
@@ -199,12 +196,10 @@ function loadConfig(config) {
|
|
|
199
196
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
200
197
|
* billboard.js project is licensed under the MIT license
|
|
201
198
|
*/
|
|
202
|
-
|
|
203
199
|
/**
|
|
204
200
|
* Base class to generate billboard.js plugin
|
|
205
201
|
* @class Plugin
|
|
206
202
|
*/
|
|
207
|
-
|
|
208
203
|
/**
|
|
209
204
|
* Version info string for plugin
|
|
210
205
|
* @name version
|
|
@@ -233,43 +228,40 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
233
228
|
function Plugin(options) {
|
|
234
229
|
options === void 0 && (options = {}), this.$$, this.options = options;
|
|
235
230
|
}
|
|
231
|
+
|
|
236
232
|
/**
|
|
237
233
|
* Lifecycle hook for 'beforeInit' phase.
|
|
238
234
|
* @private
|
|
239
235
|
*/
|
|
240
|
-
|
|
241
|
-
|
|
242
236
|
var _proto = Plugin.prototype;
|
|
243
237
|
return _proto.$beforeInit = function $beforeInit() {}
|
|
238
|
+
|
|
244
239
|
/**
|
|
245
240
|
* Lifecycle hook for 'init' phase.
|
|
246
241
|
* @private
|
|
247
|
-
|
|
248
|
-
|
|
242
|
+
*/, _proto.$init = function $init() {}
|
|
243
|
+
|
|
249
244
|
/**
|
|
250
245
|
* Lifecycle hook for 'afterInit' phase.
|
|
251
246
|
* @private
|
|
252
|
-
|
|
253
|
-
|
|
247
|
+
*/, _proto.$afterInit = function $afterInit() {}
|
|
248
|
+
|
|
254
249
|
/**
|
|
255
250
|
* Lifecycle hook for 'redraw' phase.
|
|
256
251
|
* @private
|
|
257
|
-
|
|
258
|
-
|
|
252
|
+
*/, _proto.$redraw = function $redraw() {}
|
|
253
|
+
|
|
259
254
|
/**
|
|
260
255
|
* Lifecycle hook for 'willDestroy' phase.
|
|
261
256
|
* @private
|
|
262
|
-
|
|
263
|
-
, _proto.$willDestroy = function $willDestroy() {
|
|
257
|
+
*/, _proto.$willDestroy = function $willDestroy() {
|
|
264
258
|
var _this = this;
|
|
265
|
-
|
|
266
259
|
Object.keys(this).forEach(function (key) {
|
|
267
260
|
_this[key] = null, delete _this[key];
|
|
268
261
|
});
|
|
269
262
|
}, Plugin;
|
|
270
263
|
}();
|
|
271
|
-
|
|
272
|
-
Plugin.version = "#2.2.5#";
|
|
264
|
+
Plugin.version = "#2.2.7#";
|
|
273
265
|
|
|
274
266
|
/**
|
|
275
267
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -418,12 +410,12 @@ var TextOverlap = /** @class */ (function (_super) {
|
|
|
418
410
|
// @ts-ignore
|
|
419
411
|
.attr("display", polygonArea(cell) < area ? "none" : null)
|
|
420
412
|
.attr("text-anchor", txtAnchor)
|
|
421
|
-
.attr("dy", "0."
|
|
422
|
-
.attr("transform", "translate("
|
|
413
|
+
.attr("dy", "0.".concat(angle === 1 ? 71 : 35, "em"))
|
|
414
|
+
.attr("transform", "translate(".concat(xTranslate, ", ").concat(yTranslate, ")"));
|
|
423
415
|
}
|
|
424
416
|
});
|
|
425
417
|
};
|
|
426
418
|
return TextOverlap;
|
|
427
419
|
}(Plugin));
|
|
428
420
|
|
|
429
|
-
export default
|
|
421
|
+
export { TextOverlap as default };
|