Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vizabi-barrankchart

Package Overview
Dependencies
Maintainers
3
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vizabi-barrankchart - npm Package Compare versions

Comparing version 2.4.1 to 2.4.2

99

build/barrankchart.js

@@ -36,16 +36,33 @@ /******/ (function(modules) { // webpackBootstrap

/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules

@@ -66,4 +83,5 @@ /******/ __webpack_require__.n = function(module) {

/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 6);
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })

@@ -75,2 +93,9 @@ /************************************************************************/

module.exports = __webpack_require__(1);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";

@@ -83,5 +108,5 @@

__webpack_require__(3);
__webpack_require__(2);
var _component = __webpack_require__(1);
var _component = __webpack_require__(3);

@@ -92,3 +117,3 @@ var _component2 = _interopRequireDefault(_component);

var VERSION_INFO = { version: "2.4.1", build: 1546089721455 };
var VERSION_INFO = { version: "2.4.2", build: 1547630347335 };

@@ -217,3 +242,3 @@ exports.default = Vizabi.Tool.extend("BarRankChart", {

"sidebar": ["timedisplay", "colors", "find"],
"moreoptions": ["opacity", "speed", "colors", "presentation", "about"]
"moreoptions": ["opacity", "speed", "colors", "presentation", "technical", "about"]
},

@@ -228,5 +253,11 @@ presentation: false

/***/ }),
/* 1 */
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";

@@ -243,3 +274,3 @@

var _css = __webpack_require__(2);
var _css = __webpack_require__(4);

@@ -275,3 +306,3 @@ var _css2 = _interopRequireDefault(_css);

this.name = 'barrankchart';
this.template = __webpack_require__(4);
this.template = __webpack_require__(6);

@@ -1082,3 +1113,3 @@ //define expected models for this component

/***/ }),
/* 2 */
/* 4 */
/***/ (function(module, exports, __webpack_require__) {

@@ -1092,9 +1123,3 @@

module.exports = factory(root);
} else if (typeof define == 'function' && define.amd) {
// For AMD. Register as an anonymous module.
define([], factory.bind(root, root));
} else {
// For browser globals (not exposing the function separately).
factory(root);
}
} else {}
}(typeof global != 'undefined' ? global : this, function(root) {

@@ -1194,17 +1219,5 @@

/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5)))
/***/ }),
/* 3 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 4 */
/***/ (function(module, exports) {
module.exports = "<!-- Bar Chart Component -->\n<div class=\"vzb-barrankchart\">\n <svg class=\"vzb-br-header\">\n <g class=\"vzb-br-title\">\n <text></text>\n </g>\n <g class=\"vzb-br-total\">\n <text></text>\n </g>\n <g class=\"vzb-br-axis-info vzb-noexport\"></g>\n </svg>\n\n <div class=\"vzb-br-barsviewport vzb-dialog-scrollable\">\n <svg class=\"vzb-br-bars-svg vzb-export\">\n <g class=\"vzb-br-bars\"></g>\n <rect class=\"vzb-br-forecastoverlay vzb-hidden\" x=\"0\" y=\"0\" width=\"100%\" height=\"100%\" fill=\"url(#vzb-br-pattern-lines)\" pointer-events='none'></rect>\n </svg>\n </div>\n\n <svg class=\"vzb-data-warning-svg\">\n <g class=\"vzb-data-warning vzb-noexport\">\n <svg></svg>\n <text></text>\n </g>\n <g class=\"vzb-data-warning vzb-data-warning-missed-positions\">\n <text></text>\n </g>\n </svg>\n\n <svg class=\"vzb-br-tooltip-svg vzb-hidden\">\n <g class=\"vzb-br-tooltip vzb-hidden\">\n <rect class=\"vzb-tooltip-border\"></rect>\n <text class=\"vzb-tooltip-text\"></text>\n </g>\n </svg>\n \n <svg>\n <defs>\n <pattern id=\"vzb-br-pattern-lines\" x=\"0\" y=\"0\" patternUnits=\"userSpaceOnUse\" width=\"50\" height=\"50\" viewBox=\"0 0 10 10\"> \n <path d='M-1,1 l2,-2M0,10 l10,-10M9,11 l2,-2' stroke='black' stroke-width='3' opacity='0.08'/>\n </pattern> \n </defs>\n</svg>\n</div>\n";
/***/ }),
/* 5 */

@@ -1222,7 +1235,6 @@ /***/ (function(module, exports) {

// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1,eval)("this");
} catch(e) {
g = g || new Function("return this")();
} catch (e) {
// This works if the window reference is available
if(typeof window === "object")
g = window;
if (typeof window === "object") g = window;
}

@@ -1239,9 +1251,8 @@

/* 6 */
/***/ (function(module, exports, __webpack_require__) {
/***/ (function(module, exports) {
module.exports = __webpack_require__(0);
module.exports = "<!-- Bar Chart Component -->\n<div class=\"vzb-barrankchart\">\n <svg class=\"vzb-br-header\">\n <g class=\"vzb-br-title\">\n <text></text>\n </g>\n <g class=\"vzb-br-total\">\n <text></text>\n </g>\n <g class=\"vzb-br-axis-info vzb-noexport\"></g>\n </svg>\n\n <div class=\"vzb-br-barsviewport vzb-dialog-scrollable\">\n <svg class=\"vzb-br-bars-svg vzb-export\">\n <g class=\"vzb-br-bars\"></g>\n <rect class=\"vzb-br-forecastoverlay vzb-hidden\" x=\"0\" y=\"0\" width=\"100%\" height=\"100%\" fill=\"url(#vzb-br-pattern-lines)\" pointer-events='none'></rect>\n </svg>\n </div>\n\n <svg class=\"vzb-data-warning-svg\">\n <g class=\"vzb-data-warning vzb-noexport\">\n <svg></svg>\n <text></text>\n </g>\n <g class=\"vzb-data-warning vzb-data-warning-missed-positions\">\n <text></text>\n </g>\n </svg>\n\n <svg class=\"vzb-br-tooltip-svg vzb-hidden\">\n <g class=\"vzb-br-tooltip vzb-hidden\">\n <rect class=\"vzb-tooltip-border\"></rect>\n <text class=\"vzb-tooltip-text\"></text>\n </g>\n </svg>\n \n <svg>\n <defs>\n <pattern id=\"vzb-br-pattern-lines\" x=\"0\" y=\"0\" patternUnits=\"userSpaceOnUse\" width=\"50\" height=\"50\" viewBox=\"0 0 10 10\"> \n <path d='M-1,1 l2,-2M0,10 l10,-10M9,11 l2,-2' stroke='black' stroke-width='3' opacity='0.08'/>\n </pattern> \n </defs>\n</svg>\n</div>\n";
/***/ })
/******/ ]);
//# sourceMappingURL=barrankchart.js.map

@@ -1,2 +0,2 @@

!function(t){function e(a){if(i[a])return i[a].exports;var r=i[a]={i:a,l:!1,exports:{}};return t[a].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};e.m=t,e.c=i,e.i=function(t){return t},e.d=function(t,i,a){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:a})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=6)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),i(3);var a=i(1),r=function(t){return t&&t.__esModule?t:{default:t}}(a),n={version:"2.4.1",build:1546089721455};e.default=Vizabi.Tool.extend("BarRankChart",{init:function(t,e){this.name="barrankchart",this.components=[{component:r.default,placeholder:".vzb-tool-viz",model:["state.time","state.marker","locale","ui"]},{component:Vizabi.Component.get("timeslider"),placeholder:".vzb-tool-timeslider",model:["state.time","state.marker","ui"]},{component:Vizabi.Component.get("dialogs"),placeholder:".vzb-tool-dialogs",model:["state","ui","locale"]},{component:Vizabi.Component.get("buttonlist"),placeholder:".vzb-tool-buttonlist",model:["state","ui","locale"]},{component:Vizabi.Component.get("treemenu"),placeholder:".vzb-tool-treemenu",model:["state.marker","state.time","locale","ui"]},{component:Vizabi.Component.get("datanotes"),placeholder:".vzb-tool-datanotes",model:["state.marker","locale"]},{component:Vizabi.Component.get("datawarning"),placeholder:".vzb-tool-datawarning",model:["locale"]},{component:Vizabi.Component.get("steppedspeedslider"),placeholder:".vzb-tool-stepped-speed-slider",model:["state.time","locale"]}],this._super(t,e)},default_model:{state:{time:{autoconfig:{type:"time"}},entities:{autoconfig:{type:"entity_domain",excludeIDs:["tag"]}},entities_colorlegend:{autoconfig:{type:"entity_domain",excludeIDs:["tag"]}},marker:{space:["entities","time"],axis_x:{use:"indicator",autoconfig:{type:"measure"},allow:{scales:["linear","log"]}},label:{use:"property",autoconfig:{includeOnlyIDs:["name"],type:"string"}},color:{syncModels:["marker_colorlegend"],autoconfig:{}}},marker_colorlegend:{space:["entities_colorlegend"],label:{use:"property",which:"name"},hook_rank:{use:"property",which:"rank"},hook_geoshape:{use:"property",which:"shape_lores_svg"}}},locale:{},ui:{chart:{},datawarning:{doubtDomain:[],doubtRange:[]},buttons:["colors","find","moreoptions","presentation","sidebarcollapse","fullscreen"],dialogs:{popup:["timedisplay","colors","find","moreoptions"],sidebar:["timedisplay","colors","find"],moreoptions:["opacity","speed","colors","presentation","about"]},presentation:!1}},versionInfo:n})},function(t,e,i){"use strict";function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function r(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}Object.defineProperty(e,"__esModule",{value:!0});var n,o=function(){function t(t,e){var i=[],a=!0,r=!1,n=void 0;try{for(var o,s=t[Symbol.iterator]();!(a=(o=s.next()).done)&&(i.push(o.value),!e||i.length!==e);a=!0);}catch(t){r=!0,n=t}finally{try{!a&&s.return&&s.return()}finally{if(r)throw n}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=i(2),l=function(t){return t&&t.__esModule?t:{default:t}}(s),h=Vizabi.utils,c=Vizabi.helpers["d3.axisWithLabelPicker"],d=Vizabi.iconset.question,u=Vizabi.iconset.warn,g=Vizabi.Component.extend("barrankchart",(n={init:function(t,e){var a=this;this.name="barrankchart",this.template=i(4),this.model_expects=[{name:"time",type:"time"},{name:"marker",type:"marker"},{name:"locale",type:"locale"},{name:"ui",type:"ui"}],this.model_binds={"change:time.value":function(){a.model._ready&&a._readyOnce&&a.onTimeChange()},"change:marker.select":function(){a._readyOnce&&(a._selectBars(),a._updateOpacity(),a._updateDoubtOpacity(),a._scroll())},"change:marker.axis_x.scaleType":function(){a._readyOnce&&a.loadData()&&a.draw(!0)},"change:marker.color.palette":function(){a._drawColors()},"change:marker.highlight":function(){a._updateOpacity()},"change:marker.opacitySelectDim":function(){a._updateOpacity()},"change:marker.opacityRegular":function(){a._updateOpacity()},"change:ui.chart.showForecastOverlay":function(){a._readyOnce&&a._updateForecastOverlay()}},this._super(t,e),this.xScale=null,this.cScale=d3.scaleOrdinal(d3.schemeCategory10),this.xAxis=c("bottom")},onTimeChange:function(){var t=this;this.model.marker.getFrame(this.model.time.value,function(e){t.values=e,t.values&&t.loadData()&&t.draw()})},readyOnce:function(){this.element=d3.select(this.element),this.header=this.element.select(".vzb-br-header"),this.infoEl=this.element.select(".vzb-br-axis-info"),this.barViewport=this.element.select(".vzb-br-barsviewport"),this.barSvg=this.element.select(".vzb-br-bars-svg"),this.barContainer=this.element.select(".vzb-br-bars"),this.dataWarningEl=this.element.select(".vzb-data-warning"),this.tooltipSvg=this.element.select(".vzb-br-tooltip-svg"),this.tooltip=this.element.select(".vzb-br-tooltip"),this.forecastOverlay=this.element.select(".vzb-br-forecastoverlay"),this.missedPositionsWarningEl=this.element.select(".vzb-data-warning-missed-positions");var t=this._createTooltipInteract(this.element,this.missedPositionsWarningEl);this.missedPositionsWarningEl.on("mouseover",t.mouseOver).on("mouseout",t.mouseOut),this.wScale=d3.scaleLinear().domain(this.model.ui.datawarning.doubtDomain).range(this.model.ui.datawarning.doubtRange),this.xAxis.tickFormat(this.model.marker.axis_x.getTickFormatter()),this._localeId=this.model.locale.id,this._entityLabels={},this._presentation=!this.model.ui.presentation,this._formatter=this.model.marker.axis_x.getTickFormatter(),this.ready(),this._selectBars()},ready:function(){var t=this;this.TIMEDIM=this.model.time.getDimension(),this.KEYS=h.unique(this.model.marker._getAllDimensions({exceptType:"time"})),this.KEY=this.KEYS.join(","),this.dataKeys=this.model.marker.getDataKeysPerHook(),this.labelNames=this.model.marker.getLabelHookNames(),this.model.marker.getFrame(this.model.time.value,function(e){t.values=e,t.values&&(t.markerKeys=t.model.marker.getKeys(),t.loadData()&&(t.draw(!0),t._updateOpacity(),t._drawColors()))})},resize:function(){this.draw(!0),this._drawColors()},loadData:function(){var t=this,e=this;this.translator=this.model.locale.getTFunction();var i=this.values.axis_x,a=Object.keys(i).length;if(!a)return!1;this.nullValuesCount=0,this.sortedEntities=this._sortByIndicator(i,this.dataKeys.axis_x),this.header.select(".vzb-br-title").select("text").on("click",function(){return t.parent.findChildByName("gapminder-treemenu").markerID("axis_x").alignX("left").alignY("top").updateView().toggle()}),this.xScale=this.model.marker.axis_x.getScale().copy(),this.cScale=this.model.marker.color.getScale(),h.setIcon(this.dataWarningEl,u).select("svg").attr("width",0).attr("height",0),this.dataWarningEl.append("text").text(this.translator("hints/dataWarning")),this.dataWarningEl.on("click",function(){return t.parent.findChildByName("gapminder-datawarning").toggle()}).on("mouseover",function(){return t._updateDoubtOpacity(1)}).on("mouseout",function(){return t._updateDoubtOpacity()}),this.missedPositionsWarningEl.classed("vzb-hidden",1-this.nullValuesCount/a>.85).select("text").attr("data-text",this.translator("hints/barrank/missedPositionsTooltip")).text(this.translator("hints/barrank/missedPositionsWarning"));var r=this.model.marker.axis_x.getConceptprops();return h.setIcon(this.infoEl,d).select("svg").attr("width",0).attr("height",0).style("opacity",Number(Boolean(r.description||r.sourceLink))),this.infoEl.on("click",function(){t.parent.findChildByName("gapminder-datanotes").pin()}),this.infoEl.on("mouseover",function(){var t=this.getBBox(),i=h.makeAbsoluteContext(this,this.farthestViewportElement),a=i(t.x-10,t.y+t.height+10);e.parent.findChildByName("gapminder-datanotes").setHook("axis_x").show().setPos(a.x,a.y)}),this.infoEl.on("mouseout",function(){e.parent.findChildByName("gapminder-datanotes").hide()}),!0},draw:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.time_1=null==this.time?this.model.time.value:this.time,this.time=this.model.time.value;var e=this.model.time.playing&&this.time-this.time_1>0?this.model.time.delayAnimations:0;this._updateForecastOverlay(),this.drawAxes(e,t)||this.drawData(e,t)},_updateForecastOverlay:function(){this.forecastOverlay.classed("vzb-hidden",this.model.time.value<=this.model.time.endBeforeForecast||!this.model.time.endBeforeForecast||!this.model.ui.chart.showForecastOverlay)},drawAxes:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e={small:{margin:{top:60,right:20,left:5,bottom:20},headerMargin:{top:10,right:20,bottom:20,left:20},infoElHeight:16,infoElMargin:5,barHeight:18,barMargin:3,barLabelMargin:5,barValueMargin:5,barRankMargin:6,scrollMargin:25},medium:{margin:{top:60,right:25,left:5,bottom:20},headerMargin:{top:10,right:20,bottom:20,left:20},infoElHeight:16,infoElMargin:5,barHeight:21,barMargin:3,barLabelMargin:5,barValueMargin:5,barRankMargin:10,scrollMargin:30},large:{margin:{top:60,right:30,left:5,bottom:20},headerMargin:{top:10,right:20,bottom:20,left:20},infoElHeight:16,infoElMargin:5,barHeight:28,barMargin:4,barLabelMargin:5,barValueMargin:5,barRankMargin:10,scrollMargin:30}},i={medium:{margin:{top:60,right:30,left:10,bottom:40},headerMargin:{top:10,right:20,bottom:20,left:20},infoElHeight:25,infoElMargin:10,barHeight:25,barMargin:6},large:{margin:{top:60,right:35,left:10,bottom:40},headerMargin:{top:10,right:20,bottom:20,left:20},infoElHeight:16,infoElMargin:10,barHeight:30,barMargin:6}};this.activeProfile=this.getActiveProfile(e,i);var a=this.activeProfile,r=a.margin,n=a.headerMargin,o=a.infoElHeight,s=a.infoElMargin;if(this.height=parseInt(this.element.style("height"),10)||0,this.width=parseInt(this.element.style("width"),10)||0,!this.height||!this.width)return h.warn("Dialog resize() abort: vizabi container is too little or has display:none");this.barViewport.style("height",this.height-r.bottom-r.top+"px"),this.header.attr("height",r.top);var l=this.header.select(".vzb-br-title"),c=this.model.marker.axis_x.getConceptprops(),d=c.name,u=c.unit,g=l.select("text");if(u){g.text(d+", "+u);n.left+l.node().getBBox().width+s+o>this.width-n.right&&g.text(d)}else g.text(d);var m=l.node().getBBox(),b=n.left,p=n.top+m.height;l.attr("transform","translate("+b+", "+p+")");var f=this.infoEl;f.select("svg").attr("width",o+"px").attr("height",o+"px");var v=b+l.node().getBBox().width+s,y=n.top+o/4;f.attr("transform","translate("+v+", "+y+")");var x=this.header.select(".vzb-br-total");t?x.select("text").transition("text").delay(t).text(this.model.time.formatDate(this.time)):x.select("text").interrupt().text(this.model.time.formatDate(this.time)),x.style("opacity",Number("large"!==this.getLayoutProfile()));var _=x.node().getBBox(),w=this.width-n.right-_.width,z=n.top+_.height;x.attr("transform","translate("+w+", "+z+")").classed("vzb-transparent",m.width+_.width+10>this.width),this.element.select(".vzb-data-warning-svg").style("height",r.bottom+"px");var k=this.dataWarningEl.select("text").node().getBBox();this.dataWarningEl.attr("transform","translate("+(this.width-r.right-k.width)+", "+k.height+")"),this.dataWarningEl.select("svg").attr("width",k.height).attr("height",k.height).attr("x",-k.height-5).attr("y",1-k.height),this.missedPositionsWarningEl.attr("transform","translate("+(this.width-r.right-k.width-3*k.height)+", "+k.height+")"),this._updateDoubtOpacity()},drawData:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=this.KEY;this._createAndDeleteBars(this.barContainer.selectAll(".vzb-br-bar").data(this.sortedEntities,function(t){return t[a]}));var n=this.model.ui.presentation,o=this._presentation!==n;o&&(this._presentation=n);var s="undefined"===typeof this._entitiesCount||this._entitiesCount!==this.sortedEntities.length;(o||s)&&s&&(this._entitiesCount=this.sortedEntities.length),this._resizeSvg(),this._scroll(e),this._drawColors();var l=this.activeProfile,h=l.barLabelMargin,c=l.barValueMargin,d=l.barRankMargin,u=l.scrollMargin,g=l.margin,m=this.model.marker.axis_x,b=m.getLimits(m.which),p=Math.abs(b.max)>=Math.abs(b.min),f=p?b.min<0:b.max>0,v=(this.width-g.right-g.left-h-u-(f?0:this._getWidestLabelWidth()))/(f?2:1);this.xScale.range([0,v]),"log"!==this.model.marker.axis_x.scaleType&&this.xScale.domain([0,Math.max.apply(Math,r(this.xScale.domain()))]);var y=f?v:this._getWidestLabelWidth(),x=function(e){return t.xScale(e)},_=function(t){return p?t>=0:t>0},w=function(t){return _(t)?"end":"start"},z=function(t){return _(t)?"start":"end"},k=function(t){return _(t)?-h:h},C=function(t){return _(t)?c:-c},S=this._getWidestLabelWidth(!0)+(p?g.left:g.right)<y;this.barContainer.attr("transform","translate("+(y+(p?g.left:g.right)+h)+", 0)"),this.sortedEntities.forEach(function(a){var r=a.value;if((i||o||a.isNew||a.changedValue)&&(a.barLabel.attr("x",k(r)).attr("y",t.activeProfile.barHeight/2).attr("text-anchor",w(r)).text(S?a.label:a.labelSmall),a.barRect.attr("rx",t.activeProfile.barHeight/4).attr("ry",t.activeProfile.barHeight/4).attr("height",t.activeProfile.barHeight),a.barValue.attr("x",C(r)).attr("y",t.activeProfile.barHeight/2).attr("text-anchor",z(r)),a.barRank.text(function(t,e){return r||0===r?"#"+t.rank:""}).attr("y",t.activeProfile.barHeight/2)),i||a.changedWidth||o){var n=Math.max(0,r&&x(Math.abs(r)))||0;(i||a.changedValue)&&(a.barValue.text(t._formatter(r)||t.translator("hints/nodata")),a.barValueWidth=c+a.barValue.node().getBBox().width),(i||a.changedWidth||o)&&(a.barRect.transition().duration(e).ease(d3.easeLinear).attr("width",n),a.barRank.transition().duration(e).ease(d3.easeLinear).attr("x",(Math.max(n,a.barValueWidth)+d)*(_(r)?1:-1)).attr("text-anchor",z(r))),a.barRect.attr("x",r<0?-n:0)}(i||a.changedIndex||o)&&(!e&&a.self.interrupt(),(e?a.self.transition().duration(e).ease(d3.easeLinear):a.self).attr("transform","translate(0, "+t._getBarPosition(a.index)+")"),a.barRank.text(function(t,e){return r||0===r?"#"+t.rank:""}))})},_resizeSvg:function(){var t=this.activeProfile,e=t.barHeight,i=t.barMargin;this.barSvg.attr("height",(e+i)*this.sortedEntities.length+"px")},_scroll:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.barContainer.select(".vzb-selected");if(!e.empty()){var i=e.datum(),a=this._getBarPosition(i.index),r=this.activeProfile.margin,n=this.height-r.top-r.bottom,o=a-(n+this.activeProfile.barHeight)/2;this.barViewport.transition().duration(t).tween("scrollfor"+i.entity,this._scrollTopTween(o))}},_getLabelText:function(t,e,i){return this.KEYS.map(function(a){return t[e[a]]?t[e[a]][i[a]]:i[a]}).join(", ")},_createAndDeleteBars:function(t){var e=this,i=this.KEYS,a=(this.dataKeys,o(this.sortedEntities,1)),r=a[0];this._entityLabels[r.entity]||(this._entityLabels[r.entity]=r.label);var n=this._getLabelText(this.values,this.labelNames,r.entity),s=this._entityLabels[r.entity]!==n&&this.model.locale.id!==this._localeId;s&&(this._localeId=this.model.locale.id,this._entityLabels[r.entity]=n),t.exit().remove(),t=(s?t:t.enter().append("g")).each(function(t){var a=d3.select(this),r=t.label,n=r.length<12?r:r.substring(0,9)+"...",o=a.select(".vzb-br-label"),l=o.size()?o:a.append("text").attr("class","vzb-br-label").attr("dy",".325em"),c=l.text(r).node().getBBox().width,d=l.text(n).node().getBBox().width;if(Object.assign(t,{labelWidth:c,labelSmallWidth:d,labelSmall:n,barLabel:l}),!s){a.attr("class","vzb-br-bar").classed("vzb-selected",e.model.marker.isSelected(t.entity)).attr("id","vzb-br-bar-"+h.getKey(t.entity,i)+"-"+e._id).on("mousemove",function(t){return e.model.marker.highlightMarker(t.entity)}).on("mouseout",function(){return e.model.marker.clearHighlighted()}).on("click",function(t){e.model.marker.selectMarker(t.entity)});var u=a.append("rect").attr("stroke","transparent"),g=a.append("text").attr("class","vzb-br-value").attr("dy",".325em"),m=a.append("text").attr("class","vzb-br-rank").attr("dy",".325em");Object.assign(t,{self:a,isNew:!0,barRect:u,barValue:g,barRank:m})}}).merge(t)},_getWidestLabelWidth:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=t?"labelWidth":"labelSmallWidth",i=t?"label":"labelSmall",a=this.sortedEntities.reduce(function(t,i){return t[e]<i[e]?i:t}),r=a.barLabel.text(),n=a.barLabel.text(a[i]).node().getBBox().width;return a.barLabel.text(r),n},_drawColors:function(){var t=this,e=this,i=this.dataKeys;this.barContainer.selectAll(".vzb-br-bar>rect").each(function(t){var a=t.entity,r=d3.select(this),n=e.values.color[h.getKey(a,i.color)],o=n||0===n,s=o?String(e._getColor(n)):"rgb(253, 253, 253)",l=o?"transparent":"rgb(51, 51, 51)";r.style("fill")!==s&&r.style("fill",s),r.style("stroke")!==l&&r.style("stroke",l)}),this.barContainer.selectAll(".vzb-br-bar>text").style("fill",function(e){var a=e.entity;return t._getDarkerColor(t.values.color[h.getKey(a,i.color)]||null)})},_getColor:function(t){return d3.rgb(this.cScale(t))},_getDarkerColor:function(t){return this._getColor(t).darker(2)},_scrollTopTween:function(t){return function(){var e=this,i=d3.interpolateNumber(this.scrollTop,t);return function(t){e.scrollTop=i(t)}}},_getBarPosition:function(t){return(this.activeProfile.barHeight+this.activeProfile.barMargin)*t},_entities:{},_sortByIndicator:function(t,e){var i=this,r=this.KEYS;this.KEY,this.dataKeys;return this.markerKeys.map(function(n){var o,s=h.getKey(n,r),l=i._entities[s],c=t[h.getKey(n,e)];!c&&0!==c&&i.nullValuesCount++;var d=i._getLabelText(i.values,i.labelNames,n),u=i._formatter(c);return l?Object.assign(l,{value:c,label:d,formattedValue:u,changedValue:u!==l.formattedValue,changedWidth:c!==l.value,isNew:!1}):i._entities[s]=(o={entity:n,value:c,label:d,formattedValue:u},a(o,i.KEY,s),a(o,"changedValue",!0),a(o,"changedWidth",!0),a(o,"isNew",!0),o)}).sort(function(t,e){var i=t.value,a=e.value;return(a||(0===a?0:-1/0))-(i||(0===i?0:-1/0))}).map(function(t,e,i){return Object.assign(t,{index:e,rank:e&&i[e-1].formattedValue===t.formattedValue?i[e-1].rank:e+1,changedIndex:e!==t.index})})},_selectBars:function(){var t=this,e=this.KEYS,i=this.model.marker.select;this.barContainer.classed("vzb-dimmed-selected",!1),this.barContainer.selectAll(".vzb-br-bar.vzb-selected").classed("vzb-selected",!1),i.length&&(this.barContainer.classed("vzb-dimmed-selected",!0),i.forEach(function(i){t.barContainer.select("#vzb-br-bar-"+(0,l.default)(h.getKey(i,e))+"-"+t._id).classed("vzb-selected",!0)}))},_updateOpacity:function(){var t=this.model.marker,e=t.highlight,i=t.select,a=t.opacityHighlightDim,r=t.opacitySelectDim,n=t.opacityRegular,o=e.length>0,s=i.length>0;this.barContainer.selectAll(".vzb-br-bar").style("opacity",function(e){return o&&t.isHighlighted(e.entity)?1:s?t.isSelected(e.entity)?n:r:o?a:n})},_updateDoubtOpacity:function(t){this.dataWarningEl.style("opacity",t||(this.model.marker.select.length?1:this.wScale(+this.model.time.value.getUTCFullYear().toString())))}},a(n,"_getLabelText",function(t,e,i){return this.KEYS.map(function(a){return t[e[a]]?t[e[a]][i[a]]:i[a]}).join(", ")}),a(n,"_createTooltipInteract",function(t,e){var i=this;return{mouseOver:function(){var a=d3.event,r=d3.mouse(t.node()),n=e.node().getBBox(),o=d3.mouse(e.node());i.tooltipSvg.classed("vzb-hidden",!1),i._setTooltip(d3.select(a.target).attr("data-text"),r[0]-o[0],r[1]-o[1]+n.y)},mouseOut:function(){i.tooltipSvg.classed("vzb-hidden",!0),i._setTooltip()},tap:function(){}}}),a(n,"_setTooltip",function(t,e,i){if(t){this.tooltip.classed("vzb-hidden",!1).selectAll("text").text(t);var a=this.tooltip.select("text").node().getBBox();e-a.width<0?e=a.width+5:e-=5,i-a.height<0?i+=a.height:i-=11,this.tooltip.attr("transform","translate("+e+","+i+")"),this.tooltip.selectAll("rect").attr("width",a.width+8).attr("height",1.2*a.height).attr("x",-a.width-4).attr("y",.85*-a.height).attr("rx",.2*a.height).attr("ry",.2*a.height)}else this.tooltip.classed("vzb-hidden",!0)}),n));e.default=g},function(t,e,i){(function(e){!function(e,i){t.exports=i(e)}("undefined"!=typeof e?e:this,function(t){if(t.CSS&&t.CSS.escape)return t.CSS.escape;var e=function(t){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var e,i=String(t),a=i.length,r=-1,n="",o=i.charCodeAt(0);++r<a;)e=i.charCodeAt(r),n+=0!=e?e>=1&&e<=31||127==e||0==r&&e>=48&&e<=57||1==r&&e>=48&&e<=57&&45==o?"\\"+e.toString(16)+" ":(0!=r||1!=a||45!=e)&&(e>=128||45==e||95==e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122)?i.charAt(r):"\\"+i.charAt(r):"�";return n};return t.CSS||(t.CSS={}),t.CSS.escape=e,e})}).call(e,i(5))},function(t,e){},function(t,e){t.exports='\x3c!-- Bar Chart Component --\x3e\n<div class="vzb-barrankchart">\n <svg class="vzb-br-header">\n <g class="vzb-br-title">\n <text></text>\n </g>\n <g class="vzb-br-total">\n <text></text>\n </g>\n <g class="vzb-br-axis-info vzb-noexport"></g>\n </svg>\n\n <div class="vzb-br-barsviewport vzb-dialog-scrollable">\n <svg class="vzb-br-bars-svg vzb-export">\n <g class="vzb-br-bars"></g>\n <rect class="vzb-br-forecastoverlay vzb-hidden" x="0" y="0" width="100%" height="100%" fill="url(#vzb-br-pattern-lines)" pointer-events=\'none\'></rect>\n </svg>\n </div>\n\n <svg class="vzb-data-warning-svg">\n <g class="vzb-data-warning vzb-noexport">\n <svg></svg>\n <text></text>\n </g>\n <g class="vzb-data-warning vzb-data-warning-missed-positions">\n <text></text>\n </g>\n </svg>\n\n <svg class="vzb-br-tooltip-svg vzb-hidden">\n <g class="vzb-br-tooltip vzb-hidden">\n <rect class="vzb-tooltip-border"></rect>\n <text class="vzb-tooltip-text"></text>\n </g>\n </svg>\n \n <svg>\n <defs>\n <pattern id="vzb-br-pattern-lines" x="0" y="0" patternUnits="userSpaceOnUse" width="50" height="50" viewBox="0 0 10 10"> \n <path d=\'M-1,1 l2,-2M0,10 l10,-10M9,11 l2,-2\' stroke=\'black\' stroke-width=\'3\' opacity=\'0.08\'/>\n </pattern> \n </defs>\n</svg>\n</div>\n'},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"===typeof window&&(i=window)}t.exports=i},function(t,e,i){t.exports=i(0)}]);
!function(i){var a={};function r(t){if(a[t])return a[t].exports;var e=a[t]={i:t,l:!1,exports:{}};return i[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}r.m=i,r.c=a,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(i,a,function(t){return e[t]}.bind(null,a));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,i){t.exports=i(1)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),i(2);var a,r=i(3),n=(a=r)&&a.__esModule?a:{default:a};e.default=Vizabi.Tool.extend("BarRankChart",{init:function(t,e){this.name="barrankchart",this.components=[{component:n.default,placeholder:".vzb-tool-viz",model:["state.time","state.marker","locale","ui"]},{component:Vizabi.Component.get("timeslider"),placeholder:".vzb-tool-timeslider",model:["state.time","state.marker","ui"]},{component:Vizabi.Component.get("dialogs"),placeholder:".vzb-tool-dialogs",model:["state","ui","locale"]},{component:Vizabi.Component.get("buttonlist"),placeholder:".vzb-tool-buttonlist",model:["state","ui","locale"]},{component:Vizabi.Component.get("treemenu"),placeholder:".vzb-tool-treemenu",model:["state.marker","state.time","locale","ui"]},{component:Vizabi.Component.get("datanotes"),placeholder:".vzb-tool-datanotes",model:["state.marker","locale"]},{component:Vizabi.Component.get("datawarning"),placeholder:".vzb-tool-datawarning",model:["locale"]},{component:Vizabi.Component.get("steppedspeedslider"),placeholder:".vzb-tool-stepped-speed-slider",model:["state.time","locale"]}],this._super(t,e)},default_model:{state:{time:{autoconfig:{type:"time"}},entities:{autoconfig:{type:"entity_domain",excludeIDs:["tag"]}},entities_colorlegend:{autoconfig:{type:"entity_domain",excludeIDs:["tag"]}},marker:{space:["entities","time"],axis_x:{use:"indicator",autoconfig:{type:"measure"},allow:{scales:["linear","log"]}},label:{use:"property",autoconfig:{includeOnlyIDs:["name"],type:"string"}},color:{syncModels:["marker_colorlegend"],autoconfig:{}}},marker_colorlegend:{space:["entities_colorlegend"],label:{use:"property",which:"name"},hook_rank:{use:"property",which:"rank"},hook_geoshape:{use:"property",which:"shape_lores_svg"}}},locale:{},ui:{chart:{},datawarning:{doubtDomain:[],doubtRange:[]},buttons:["colors","find","moreoptions","presentation","sidebarcollapse","fullscreen"],dialogs:{popup:["timedisplay","colors","find","moreoptions"],sidebar:["timedisplay","colors","find"],moreoptions:["opacity","speed","colors","presentation","technical","about"]},presentation:!1}},versionInfo:{version:"2.4.2",build:1547630347335}})},function(t,e,i){},function(t,e,a){"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0});var r,n=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var i=[],a=!0,r=!1,n=void 0;try{for(var o,s=t[Symbol.iterator]();!(a=(o=s.next()).done)&&(i.push(o.value),!e||i.length!==e);a=!0);}catch(t){r=!0,n=t}finally{try{!a&&s.return&&s.return()}finally{if(r)throw n}}return i}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=a(4),s=(r=o)&&r.__esModule?r:{default:r};function c(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var w=Vizabi.utils,l=Vizabi.helpers["d3.axisWithLabelPicker"],h=Vizabi.iconset.question,d=Vizabi.iconset.warn,g=Vizabi.Component.extend("barrankchart",(c(i={init:function(t,e){var i=this;this.name="barrankchart",this.template=a(6),this.model_expects=[{name:"time",type:"time"},{name:"marker",type:"marker"},{name:"locale",type:"locale"},{name:"ui",type:"ui"}],this.model_binds={"change:time.value":function(){i.model._ready&&i._readyOnce&&i.onTimeChange()},"change:marker.select":function(){i._readyOnce&&(i._selectBars(),i._updateOpacity(),i._updateDoubtOpacity(),i._scroll())},"change:marker.axis_x.scaleType":function(){i._readyOnce&&i.loadData()&&i.draw(!0)},"change:marker.color.palette":function(){i._drawColors()},"change:marker.highlight":function(){i._updateOpacity()},"change:marker.opacitySelectDim":function(){i._updateOpacity()},"change:marker.opacityRegular":function(){i._updateOpacity()},"change:ui.chart.showForecastOverlay":function(){i._readyOnce&&i._updateForecastOverlay()}},this._super(t,e),this.xScale=null,this.cScale=d3.scaleOrdinal(d3.schemeCategory10),this.xAxis=l("bottom")},onTimeChange:function(){var e=this;this.model.marker.getFrame(this.model.time.value,function(t){e.values=t,e.values&&e.loadData()&&e.draw()})},readyOnce:function(){this.element=d3.select(this.element),this.header=this.element.select(".vzb-br-header"),this.infoEl=this.element.select(".vzb-br-axis-info"),this.barViewport=this.element.select(".vzb-br-barsviewport"),this.barSvg=this.element.select(".vzb-br-bars-svg"),this.barContainer=this.element.select(".vzb-br-bars"),this.dataWarningEl=this.element.select(".vzb-data-warning"),this.tooltipSvg=this.element.select(".vzb-br-tooltip-svg"),this.tooltip=this.element.select(".vzb-br-tooltip"),this.forecastOverlay=this.element.select(".vzb-br-forecastoverlay"),this.missedPositionsWarningEl=this.element.select(".vzb-data-warning-missed-positions");var t=this._createTooltipInteract(this.element,this.missedPositionsWarningEl);this.missedPositionsWarningEl.on("mouseover",t.mouseOver).on("mouseout",t.mouseOut),this.wScale=d3.scaleLinear().domain(this.model.ui.datawarning.doubtDomain).range(this.model.ui.datawarning.doubtRange),this.xAxis.tickFormat(this.model.marker.axis_x.getTickFormatter()),this._localeId=this.model.locale.id,this._entityLabels={},this._presentation=!this.model.ui.presentation,this._formatter=this.model.marker.axis_x.getTickFormatter(),this.ready(),this._selectBars()},ready:function(){var e=this;this.TIMEDIM=this.model.time.getDimension(),this.KEYS=w.unique(this.model.marker._getAllDimensions({exceptType:"time"})),this.KEY=this.KEYS.join(","),this.dataKeys=this.model.marker.getDataKeysPerHook(),this.labelNames=this.model.marker.getLabelHookNames(),this.model.marker.getFrame(this.model.time.value,function(t){e.values=t,e.values&&(e.markerKeys=e.model.marker.getKeys(),e.loadData()&&(e.draw(!0),e._updateOpacity(),e._drawColors()))})},resize:function(){this.draw(!0),this._drawColors()},loadData:function(){var t=this,i=this;this.translator=this.model.locale.getTFunction();var e=this.values.axis_x,a=Object.keys(e).length;if(!a)return!1;this.nullValuesCount=0,this.sortedEntities=this._sortByIndicator(e,this.dataKeys.axis_x),this.header.select(".vzb-br-title").select("text").on("click",function(){return t.parent.findChildByName("gapminder-treemenu").markerID("axis_x").alignX("left").alignY("top").updateView().toggle()}),this.xScale=this.model.marker.axis_x.getScale().copy(),this.cScale=this.model.marker.color.getScale(),w.setIcon(this.dataWarningEl,d).select("svg").attr("width",0).attr("height",0),this.dataWarningEl.append("text").text(this.translator("hints/dataWarning")),this.dataWarningEl.on("click",function(){return t.parent.findChildByName("gapminder-datawarning").toggle()}).on("mouseover",function(){return t._updateDoubtOpacity(1)}).on("mouseout",function(){return t._updateDoubtOpacity()}),this.missedPositionsWarningEl.classed("vzb-hidden",.85<1-this.nullValuesCount/a).select("text").attr("data-text",this.translator("hints/barrank/missedPositionsTooltip")).text(this.translator("hints/barrank/missedPositionsWarning"));var r=this.model.marker.axis_x.getConceptprops();return w.setIcon(this.infoEl,h).select("svg").attr("width",0).attr("height",0).style("opacity",Number(Boolean(r.description||r.sourceLink))),this.infoEl.on("click",function(){t.parent.findChildByName("gapminder-datanotes").pin()}),this.infoEl.on("mouseover",function(){var t=this.getBBox(),e=w.makeAbsoluteContext(this,this.farthestViewportElement)(t.x-10,t.y+t.height+10);i.parent.findChildByName("gapminder-datanotes").setHook("axis_x").show().setPos(e.x,e.y)}),this.infoEl.on("mouseout",function(){i.parent.findChildByName("gapminder-datanotes").hide()}),!0},draw:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.time_1=null==this.time?this.model.time.value:this.time,this.time=this.model.time.value;var e=this.model.time.playing&&0<this.time-this.time_1?this.model.time.delayAnimations:0;this._updateForecastOverlay(),this.drawAxes(e,t)||this.drawData(e,t)},_updateForecastOverlay:function(){this.forecastOverlay.classed("vzb-hidden",this.model.time.value<=this.model.time.endBeforeForecast||!this.model.time.endBeforeForecast||!this.model.ui.chart.showForecastOverlay)},drawAxes:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;this.activeProfile=this.getActiveProfile({small:{margin:{top:60,right:20,left:5,bottom:20},headerMargin:{top:10,right:20,bottom:20,left:20},infoElHeight:16,infoElMargin:5,barHeight:18,barMargin:3,barLabelMargin:5,barValueMargin:5,barRankMargin:6,scrollMargin:25},medium:{margin:{top:60,right:25,left:5,bottom:20},headerMargin:{top:10,right:20,bottom:20,left:20},infoElHeight:16,infoElMargin:5,barHeight:21,barMargin:3,barLabelMargin:5,barValueMargin:5,barRankMargin:10,scrollMargin:30},large:{margin:{top:60,right:30,left:5,bottom:20},headerMargin:{top:10,right:20,bottom:20,left:20},infoElHeight:16,infoElMargin:5,barHeight:28,barMargin:4,barLabelMargin:5,barValueMargin:5,barRankMargin:10,scrollMargin:30}},{medium:{margin:{top:60,right:30,left:10,bottom:40},headerMargin:{top:10,right:20,bottom:20,left:20},infoElHeight:25,infoElMargin:10,barHeight:25,barMargin:6},large:{margin:{top:60,right:35,left:10,bottom:40},headerMargin:{top:10,right:20,bottom:20,left:20},infoElHeight:16,infoElMargin:10,barHeight:30,barMargin:6}});var e=this.activeProfile,i=e.margin,a=e.headerMargin,r=e.infoElHeight,n=e.infoElMargin;if(this.height=parseInt(this.element.style("height"),10)||0,this.width=parseInt(this.element.style("width"),10)||0,!this.height||!this.width)return w.warn("Dialog resize() abort: vizabi container is too little or has display:none");this.barViewport.style("height",this.height-i.bottom-i.top+"px"),this.header.attr("height",i.top);var o=this.header.select(".vzb-br-title"),s=this.model.marker.axis_x.getConceptprops(),l=s.name,h=s.unit,d=o.select("text");h?(d.text(l+", "+h),a.left+o.node().getBBox().width+n+r>this.width-a.right&&d.text(l)):d.text(l);var c=o.node().getBBox(),g=a.left,u=a.top+c.height;o.attr("transform","translate("+g+", "+u+")");var b=this.infoEl;b.select("svg").attr("width",r+"px").attr("height",r+"px");var m=g+o.node().getBBox().width+n,p=a.top+r/4;b.attr("transform","translate("+m+", "+p+")");var v=this.header.select(".vzb-br-total");t?v.select("text").transition("text").delay(t).text(this.model.time.formatDate(this.time)):v.select("text").interrupt().text(this.model.time.formatDate(this.time)),v.style("opacity",Number("large"!==this.getLayoutProfile()));var f=v.node().getBBox(),y=this.width-a.right-f.width,x=a.top+f.height;v.attr("transform","translate("+y+", "+x+")").classed("vzb-transparent",c.width+f.width+10>this.width),this.element.select(".vzb-data-warning-svg").style("height",i.bottom+"px");var _=this.dataWarningEl.select("text").node().getBBox();this.dataWarningEl.attr("transform","translate("+(this.width-i.right-_.width)+", "+_.height+")"),this.dataWarningEl.select("svg").attr("width",_.height).attr("height",_.height).attr("x",-_.height-5).attr("y",1-_.height),this.missedPositionsWarningEl.attr("transform","translate("+(this.width-i.right-_.width-3*_.height)+", "+_.height+")"),this._updateDoubtOpacity()},drawData:function(){var s=this,l=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,h=1<arguments.length&&void 0!==arguments[1]&&arguments[1],e=this.KEY;this._createAndDeleteBars(this.barContainer.selectAll(".vzb-br-bar").data(this.sortedEntities,function(t){return t[e]}));var t=this.model.ui.presentation,d=this._presentation!==t;d&&(this._presentation=t);var i=void 0===this._entitiesCount||this._entitiesCount!==this.sortedEntities.length;(d||i)&&i&&(this._entitiesCount=this.sortedEntities.length),this._resizeSvg(),this._scroll(l),this._drawColors();var a=this.activeProfile,c=a.barLabelMargin,g=a.barValueMargin,u=a.barRankMargin,r=a.scrollMargin,n=a.margin,o=this.model.marker.axis_x,b=o.getLimits(o.which),m=Math.abs(b.max)>=Math.abs(b.min),p=m?b.min<0:0<b.max,v=(this.width-n.right-n.left-c-r-(p?0:this._getWidestLabelWidth()))/(p?2:1);this.xScale.range([0,v]),"log"!==this.model.marker.axis_x.scaleType&&this.xScale.domain([0,Math.max.apply(Math,function(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}(this.xScale.domain()))]);var f=p?v:this._getWidestLabelWidth(),y=function(t){return m?0<=t:0<t},x=function(t){return y(t)?"start":"end"},_=this._getWidestLabelWidth(!0)+(m?n.left:n.right)<f;this.barContainer.attr("transform","translate("+(f+(m?n.left:n.right)+c)+", 0)"),this.sortedEntities.forEach(function(t){var e,i,a,r,n=t.value;if((h||d||t.isNew||t.changedValue)&&(t.barLabel.attr("x",(a=n,y(a)?-c:c)).attr("y",s.activeProfile.barHeight/2).attr("text-anchor",(i=n,y(i)?"end":"start")).text(_?t.label:t.labelSmall),t.barRect.attr("rx",s.activeProfile.barHeight/4).attr("ry",s.activeProfile.barHeight/4).attr("height",s.activeProfile.barHeight),t.barValue.attr("x",(e=n,y(e)?g:-g)).attr("y",s.activeProfile.barHeight/2).attr("text-anchor",x(n)),t.barRank.text(function(t,e){return n||0===n?"#"+t.rank:""}).attr("y",s.activeProfile.barHeight/2)),h||t.changedWidth||d){var o=Math.max(0,n&&(r=Math.abs(n),s.xScale(r)))||0;(h||t.changedValue)&&(t.barValue.text(s._formatter(n)||s.translator("hints/nodata")),t.barValueWidth=g+t.barValue.node().getBBox().width),(h||t.changedWidth||d)&&(t.barRect.transition().duration(l).ease(d3.easeLinear).attr("width",o),t.barRank.transition().duration(l).ease(d3.easeLinear).attr("x",(Math.max(o,t.barValueWidth)+u)*(y(n)?1:-1)).attr("text-anchor",x(n))),t.barRect.attr("x",n<0?-o:0)}(h||t.changedIndex||d)&&(!l&&t.self.interrupt(),(l?t.self.transition().duration(l).ease(d3.easeLinear):t.self).attr("transform","translate(0, "+s._getBarPosition(t.index)+")"),t.barRank.text(function(t,e){return n||0===n?"#"+t.rank:""}))})},_resizeSvg:function(){var t=this.activeProfile,e=t.barHeight,i=t.barMargin;this.barSvg.attr("height",(e+i)*this.sortedEntities.length+"px")},_scroll:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=this.barContainer.select(".vzb-selected");if(!e.empty()){var i=e.datum(),a=this._getBarPosition(i.index),r=this.activeProfile.margin,n=a-(this.height-r.top-r.bottom+this.activeProfile.barHeight)/2;this.barViewport.transition().duration(t).tween("scrollfor"+i.entity,this._scrollTopTween(n))}},_getLabelText:function(e,i,a){return this.KEYS.map(function(t){return e[i[t]]?e[i[t]][a[t]]:a[t]}).join(", ")},_createAndDeleteBars:function(t){var c=this,g=this.KEYS,e=(this.dataKeys,n(this.sortedEntities,1)[0]);this._entityLabels[e.entity]||(this._entityLabels[e.entity]=e.label);var i=this._getLabelText(this.values,this.labelNames,e.entity),u=this._entityLabels[e.entity]!==i&&this.model.locale.id!==this._localeId;u&&(this._localeId=this.model.locale.id,this._entityLabels[e.entity]=i),t.exit().remove(),t=(u?t:t.enter().append("g")).each(function(t){var e=d3.select(this),i=t.label,a=i.length<12?i:i.substring(0,9)+"...",r=e.select(".vzb-br-label"),n=r.size()?r:e.append("text").attr("class","vzb-br-label").attr("dy",".325em"),o=n.text(i).node().getBBox().width,s=n.text(a).node().getBBox().width;if(Object.assign(t,{labelWidth:o,labelSmallWidth:s,labelSmall:a,barLabel:n}),!u){e.attr("class","vzb-br-bar").classed("vzb-selected",c.model.marker.isSelected(t.entity)).attr("id","vzb-br-bar-"+w.getKey(t.entity,g)+"-"+c._id).on("mousemove",function(t){return c.model.marker.highlightMarker(t.entity)}).on("mouseout",function(){return c.model.marker.clearHighlighted()}).on("click",function(t){c.model.marker.selectMarker(t.entity)});var l=e.append("rect").attr("stroke","transparent"),h=e.append("text").attr("class","vzb-br-value").attr("dy",".325em"),d=e.append("text").attr("class","vzb-br-rank").attr("dy",".325em");Object.assign(t,{self:e,isNew:!0,barRect:l,barValue:h,barRank:d})}}).merge(t)},_getWidestLabelWidth:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=t?"labelWidth":"labelSmallWidth",e=t?"label":"labelSmall",a=this.sortedEntities.reduce(function(t,e){return t[i]<e[i]?e:t}),r=a.barLabel.text(),n=a.barLabel.text(a[e]).node().getBBox().width;return a.barLabel.text(r),n},_drawColors:function(){var i=this,s=this,l=this.dataKeys;this.barContainer.selectAll(".vzb-br-bar>rect").each(function(t){var e=t.entity,i=d3.select(this),a=s.values.color[w.getKey(e,l.color)],r=a||0===a,n=r?String(s._getColor(a)):"rgb(253, 253, 253)",o=r?"transparent":"rgb(51, 51, 51)";i.style("fill")!==n&&i.style("fill",n),i.style("stroke")!==o&&i.style("stroke",o)}),this.barContainer.selectAll(".vzb-br-bar>text").style("fill",function(t){var e=t.entity;return i._getDarkerColor(i.values.color[w.getKey(e,l.color)]||null)})},_getColor:function(t){return d3.rgb(this.cScale(t))},_getDarkerColor:function(t){return this._getColor(t).darker(2)},_scrollTopTween:function(t){return function(){var e=this,i=d3.interpolateNumber(this.scrollTop,t);return function(t){e.scrollTop=i(t)}}},_getBarPosition:function(t){return(this.activeProfile.barHeight+this.activeProfile.barMargin)*t},_entities:{},_sortByIndicator:function(s,l){var h=this,d=this.KEYS;this.KEY,this.dataKeys;return this.markerKeys.map(function(t){var e,i=w.getKey(t,d),a=h._entities[i],r=s[w.getKey(t,l)];!r&&0!==r&&h.nullValuesCount++;var n=h._getLabelText(h.values,h.labelNames,t),o=h._formatter(r);return a?Object.assign(a,{value:r,label:n,formattedValue:o,changedValue:o!==a.formattedValue,changedWidth:r!==a.value,isNew:!1}):h._entities[i]=(c(e={entity:t,value:r,label:n,formattedValue:o},h.KEY,i),c(e,"changedValue",!0),c(e,"changedWidth",!0),c(e,"isNew",!0),e)}).sort(function(t,e){var i=t.value,a=e.value;return(a||(0===a?0:-1/0))-(i||(0===i?0:-1/0))}).map(function(t,e,i){return Object.assign(t,{index:e,rank:e&&i[e-1].formattedValue===t.formattedValue?i[e-1].rank:e+1,changedIndex:e!==t.index})})},_selectBars:function(){var e=this,i=this.KEYS,t=this.model.marker.select;this.barContainer.classed("vzb-dimmed-selected",!1),this.barContainer.selectAll(".vzb-br-bar.vzb-selected").classed("vzb-selected",!1),t.length&&(this.barContainer.classed("vzb-dimmed-selected",!0),t.forEach(function(t){e.barContainer.select("#vzb-br-bar-"+(0,s.default)(w.getKey(t,i))+"-"+e._id).classed("vzb-selected",!0)}))},_updateOpacity:function(){var e=this.model.marker,t=e.highlight,i=e.select,a=e.opacityHighlightDim,r=e.opacitySelectDim,n=e.opacityRegular,o=0<t.length,s=0<i.length;this.barContainer.selectAll(".vzb-br-bar").style("opacity",function(t){return o&&e.isHighlighted(t.entity)?1:s?e.isSelected(t.entity)?n:r:o?a:n})},_updateDoubtOpacity:function(t){this.dataWarningEl.style("opacity",t||(this.model.marker.select.length?1:this.wScale(+this.model.time.value.getUTCFullYear().toString())))}},"_getLabelText",function(e,i,a){return this.KEYS.map(function(t){return e[i[t]]?e[i[t]][a[t]]:a[t]}).join(", ")}),c(i,"_createTooltipInteract",function(r,n){var o=this;return{mouseOver:function(){var t=d3.event,e=d3.mouse(r.node()),i=n.node().getBBox(),a=d3.mouse(n.node());o.tooltipSvg.classed("vzb-hidden",!1),o._setTooltip(d3.select(t.target).attr("data-text"),e[0]-a[0],e[1]-a[1]+i.y)},mouseOut:function(){o.tooltipSvg.classed("vzb-hidden",!0),o._setTooltip()},tap:function(){}}}),c(i,"_setTooltip",function(t,e,i){if(t){this.tooltip.classed("vzb-hidden",!1).selectAll("text").text(t);var a=this.tooltip.select("text").node().getBBox();e-a.width<0?e=a.width+5:e-=5,i-a.height<0?i+=a.height:i-=11,this.tooltip.attr("transform","translate("+e+","+i+")"),this.tooltip.selectAll("rect").attr("width",a.width+8).attr("height",1.2*a.height).attr("x",-a.width-4).attr("y",.85*-a.height).attr("rx",.2*a.height).attr("ry",.2*a.height)}else this.tooltip.classed("vzb-hidden",!0)}),i));e.default=g},function(i,t,e){(function(t){var e;e=void 0!==t?t:this,i.exports=function(t){if(t.CSS&&t.CSS.escape)return t.CSS.escape;var e=function(t){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var e,i=String(t),a=i.length,r=-1,n="",o=i.charCodeAt(0);++r<a;)0!=(e=i.charCodeAt(r))?n+=1<=e&&e<=31||127==e||0==r&&48<=e&&e<=57||1==r&&48<=e&&e<=57&&45==o?"\\"+e.toString(16)+" ":0==r&&1==a&&45==e||!(128<=e||45==e||95==e||48<=e&&e<=57||65<=e&&e<=90||97<=e&&e<=122)?"\\"+i.charAt(r):i.charAt(r):n+="�";return n};return t.CSS||(t.CSS={}),t.CSS.escape=e}(e)}).call(this,e(5))},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e){t.exports='\x3c!-- Bar Chart Component --\x3e\n<div class="vzb-barrankchart">\n <svg class="vzb-br-header">\n <g class="vzb-br-title">\n <text></text>\n </g>\n <g class="vzb-br-total">\n <text></text>\n </g>\n <g class="vzb-br-axis-info vzb-noexport"></g>\n </svg>\n\n <div class="vzb-br-barsviewport vzb-dialog-scrollable">\n <svg class="vzb-br-bars-svg vzb-export">\n <g class="vzb-br-bars"></g>\n <rect class="vzb-br-forecastoverlay vzb-hidden" x="0" y="0" width="100%" height="100%" fill="url(#vzb-br-pattern-lines)" pointer-events=\'none\'></rect>\n </svg>\n </div>\n\n <svg class="vzb-data-warning-svg">\n <g class="vzb-data-warning vzb-noexport">\n <svg></svg>\n <text></text>\n </g>\n <g class="vzb-data-warning vzb-data-warning-missed-positions">\n <text></text>\n </g>\n </svg>\n\n <svg class="vzb-br-tooltip-svg vzb-hidden">\n <g class="vzb-br-tooltip vzb-hidden">\n <rect class="vzb-tooltip-border"></rect>\n <text class="vzb-tooltip-text"></text>\n </g>\n </svg>\n \n <svg>\n <defs>\n <pattern id="vzb-br-pattern-lines" x="0" y="0" patternUnits="userSpaceOnUse" width="50" height="50" viewBox="0 0 10 10"> \n <path d=\'M-1,1 l2,-2M0,10 l10,-10M9,11 l2,-2\' stroke=\'black\' stroke-width=\'3\' opacity=\'0.08\'/>\n </pattern> \n </defs>\n</svg>\n</div>\n'}]);
//# sourceMappingURL=barrankchart.min.js.map
{
"name": "vizabi-barrankchart",
"version": "2.4.1",
"version": "2.4.2",
"description": "Bar rank chart tool for Vizabi 📊",

@@ -5,0 +5,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc