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

g-chartframe

Package Overview
Dependencies
Maintainers
5
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

g-chartframe - npm Package Compare versions

Comparing version 5.3.2 to 5.3.3

.github/CODEOWNERS

2

build/g-chartframe.min.js

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

!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define(["exports"],factory):factory(global.gChartframe=global.gChartframe||{})}(this,function(exports){"use strict";function namespace(name){var prefix=name+="",i=prefix.indexOf(":");return i>=0&&"xmlns"!==(prefix=name.slice(0,i))&&(name=name.slice(i+1)),namespaces.hasOwnProperty(prefix)?{space:namespaces[prefix],local:name}:name}function creator(name){var fullname=namespace(name);return(fullname.local?function(fullname){return function(){return this.ownerDocument.createElementNS(fullname.space,fullname.local)}}:function(name){return function(){var document=this.ownerDocument,uri=this.namespaceURI;return uri===xhtml&&document.documentElement.namespaceURI===xhtml?document.createElement(name):document.createElementNS(uri,name)}})(fullname)}function contextListener(listener,index,group){return function(event1){var event0=event;event=event1;try{listener.call(this,this.__data__,index,group)}finally{event=event0}}}function onAdd(typename,value,capture){var wrap=filterEvents.hasOwnProperty(typename.type)?function(listener,index,group){return listener=contextListener(listener,index,group),function(event){var related=event.relatedTarget;related&&(related===this||8&related.compareDocumentPosition(this))||listener.call(this,event)}}:contextListener;return function(d,i,group){var o,on=this.__on,listener=wrap(value,i,group);if(on)for(var j=0,m=on.length;j<m;++j)if((o=on[j]).type===typename.type&&o.name===typename.name)return this.removeEventListener(o.type,o.listener,o.capture),this.addEventListener(o.type,o.listener=listener,o.capture=capture),void(o.value=value);this.addEventListener(typename.type,listener,capture),o={type:typename.type,name:typename.name,value:value,listener:listener,capture:capture},on?on.push(o):this.__on=[o]}}function selector(selector){return null==selector?function(){}:function(){return this.querySelector(selector)}}function sparse(update){return new Array(update.length)}function EnterNode(parent,datum){this.ownerDocument=parent.ownerDocument,this.namespaceURI=parent.namespaceURI,this._next=null,this._parent=parent,this.__data__=datum}function ascending(a,b){return a<b?-1:a>b?1:a>=b?0:NaN}function defaultView(node){return node.ownerDocument&&node.ownerDocument.defaultView||node.document&&node||node.defaultView}function classArray(string){return string.trim().split(/^|\s+/)}function classList(node){return node.classList||new ClassList(node)}function ClassList(node){this._node=node,this._names=classArray(node.getAttribute("class")||"")}function classedAdd(node,names){for(var list=classList(node),i=-1,n=names.length;++i<n;)list.add(names[i])}function classedRemove(node,names){for(var list=classList(node),i=-1,n=names.length;++i<n;)list.remove(names[i])}function raise(){this.nextSibling&&this.parentNode.appendChild(this)}function lower(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function remove(){var parent=this.parentNode;parent&&parent.removeChild(this)}function dispatchEvent(node,type,params){var window=defaultView(node),event=window.CustomEvent;"function"==typeof event?event=new event(type,params):(event=window.document.createEvent("Event"),params?(event.initEvent(type,params.bubbles,params.cancelable),event.detail=params.detail):event.initEvent(type,!1,!1)),node.dispatchEvent(event)}function Selection(groups,parents){this._groups=groups,this._parents=parents}function select(selector){return"string"==typeof selector?new Selection([[document.querySelector(selector)]],[document.documentElement]):new Selection([[selector]],root)}function chartFrame(configObject){function attributeStyle(parent,style){Object.keys(style).forEach(function(attribute){parent.attr(attribute,style[attribute])})}function frame(p){if(p.attr("class",containerClass).attr("font-family","MetricWeb,sans-serif"),p.attr("role","img"),"svg"===p.node().nodeName.toLowerCase()&&(p.attr("width",graphicWidth).attr("height",graphicHeight).attr("viewBox",["0 0",graphicWidth,graphicHeight].join(" ")),!1===a11yTitle&&!1===title||(p.append("title").text(a11yTitle||title).attr("id","".concat(containerClass,"__chart-a11y-title")),p.attr("aria-labelledby","".concat(containerClass,"__chart-a11y-title"))),!1!==a11yDesc&&(p.append("desc").text(a11yDesc).attr("id","".concat(containerClass,"__chart-a11y-desc")),p.attr("aria-labelledby","".concat(p.attr("aria-labelledby")?"".concat(p.attr("aria-labelledby")," "):"").concat(containerClass,"__chart-a11y-desc")))),void 0===backgroundColor||p.select("#chart-background").size()||p.append("rect").attr("role","presentation").attr("id","chart-background").attr("class","chart-background").attr("x",0).attr("y",0).attr("width",graphicWidth).attr("height",graphicHeight).attr("fill",backgroundColor),blackbar&&!p.selectAll("rect.black-bar").size()&&p.append("rect").attr("class","black-bar").attr("width",60).attr("height",4).style("fill",blackbar),whitebar&&!p.selectAll("rect.white-bar").size()&&p.append("rect").attr("class","white-bar").attr("width",60).attr("height",4).style("fill",whitebar).attr("transform","translate(".concat(margin.left,",").concat(margin.left,")")),goalposts&&!p.selectAll("path.chart-goalposts").size()){var goalpostPaths=["M 0, ".concat(graphicHeight," L ").concat(graphicWidth,", ").concat(graphicHeight),"M 0, 15 L 0, 0 L ".concat(graphicWidth,", 0 L ").concat(graphicWidth,", 15")];p.append("path").attr("class","chart-goalposts").attr("d",goalpostPaths).attr("stroke-width",.3).attr("fill","none").attr("stroke",goalposts)}var titleLineCount=title?title.split("|").length:0,subtitleLineCount=subtitle?subtitle.split("|").length:0,sourceLineCount=source?source.split("|").length:0;if(title&&!p.select("text.chart-title").size()&&p.append("text").attr("class","chart-title").attr("id","".concat(containerClass,"title")).call(function(titleText){titleText.selectAll("tspan").data(title.split("|")).enter().append("tspan").text(function(d){return d}).attr("y",function(d,i){return titlePosition.y+i*titleLineHeight}).attr("x",titlePosition.x).call(attributeStyle,titleStyle)}),subtitle&&!p.select("text.chart-subtitle").size()&&p.append("text").attr("id","".concat(containerClass,"subtitle")).attr("class","chart-subtitle").call(function(subtitleText){subtitleText.selectAll("tspan").data(subtitle.split("|")).enter().append("tspan").text(function(d){return d}).attr("id","".concat(containerClass,"subtitle")).attr("y",function(d,i){return titleLineCount>1?titlePosition.y+titleLineCount*titleLineHeight+subtitleLineHeight*i:subtitlePosition.y+i*subtitleLineHeight}).attr("x",subtitlePosition.x).call(attributeStyle,subtitleStyle)}),source&&!p.selectAll("text.chart-source").size()&&p.append("text").attr("class","chart-source").attr("id","".concat(containerClass,"source")).call(function(sourceText){sourceText.selectAll("tspan").data(source.split("|")).enter().append("tspan").text(function(d){return d}).attr("id","".concat(containerClass,"source")).attr("y",function(d,i){return sourcePosition.y?sourcePosition.y+i*sourceLineHeight:graphicHeight-(margin.bottom-sourcePlotYOffset)+1.5*sourceLineHeight+i*sourceLineHeight}).attr("x",sourcePosition.x).call(attributeStyle,sourceStyle)}),copyrightStyle&&!p.selectAll("text.chart-copyright").size()&&p.append("text").attr("class","chart-copyright").append("tspan").text(copyright).attr("x",sourcePosition.x).attr("y",function(){return sourceLineCount>1?graphicHeight-(margin.bottom-sourcePlotYOffset)+1.125*sourceLineHeight+sourceLineCount*sourceLineHeight*1.2:graphicHeight-(margin.bottom-sourcePlotYOffset)+2.5*sourceLineHeight}).call(attributeStyle,copyrightStyle),!autoPosition||"ft-printgraphic"!==containerClass&&"ft-socialgraphic"!==containerClass&&"ft-videographic"!==containerClass?autoPosition&&(margin.top=titlePosition.y+titleLineCount*titleLineHeight+subtitleLineCount*subtitleLineHeight+28-plotAdjuster):margin.top=titlePosition.y+titleLineCount*titleLineHeight+subtitleLineCount*subtitleLineHeight+rem/3,watermarkMarkup&&!p.selectAll("g.chart-watermark").size()&&"svg"!==p.node().ownerDocument.doctype.name&&p.append("g").attr("class","chart-watermark").html(watermarkMarkup).attr("role","presentation").attr("transform","translate(".concat(graphicWidth-watermarkWidth-watermarkOffsetX,",").concat(graphicHeight-watermarkHeight-watermarkOffsetY,") scale(1) ")),(plot=p.selectAll("g.chart-plot").size()?p.select("g.chart-plot"):p.append("g").attr("class","chart-plot")).attr("transform","translate(".concat(margin.left,",").concat(margin.top,")")),a11yPlotPresentation&&plot.attr("role","presentation"),showDownloadPngButtons&&"svg"!==p.node().ownerDocument.doctype.name){var parent;if(!(parent=select("svg"===p.node().nodeName.toLowerCase()?p.node().parentNode:p.node())).selectAll(".button-holder").size()){var holder=parent.append("div").attr("class","button-holder");holder.append("button").attr("class","save-png-button save-png-button__1x").text("Save as .png").style("float","left").style("opacity",.6).on("click",function(){return savePNG(p,1)}),holder.append("button").attr("class","save-png-button save-png-button__2x").style("float","left").style("opacity",.6).text("Save as double size .png").on("click",function(){return savePNG(p,2)})}}}var backgroundColor,plot,autoPosition=!1,a11yDesc="A graphic by the Financial Times",a11yPlotPresentation=!0,a11yTitle="A chart",containerClass="g-chartframe",copyright="© FT",copyrightStyle=!1,goalposts=!1,blackbar=!1,whitebar=!1,fullYear=!1,showDownloadPngButtons=!0,graphicHeight=400,graphicWidth=500,plotAdjuster=0,rem=18,subtitle="some supporting information, units perhaps",subtitleLineHeight=20,subtitleStyle={},source="Source: research",sourceLineHeight=16,sourcePlotYOffset=46,sourceStyle={},title="Title: A description of the charts purpose",titleLineHeight=32,titleStyle={},watermarkLocation="icons.svg#ft-logo",watermarkMarkup="",watermarkOffsetX=40,watermarkOffsetY=0,watermarkWidth=124,watermarkHeight=10,units="px",margin={top:100,left:1,bottom:20,right:20},subtitlePosition={x:1,y:67},sourcePosition={x:1},titlePosition={x:1,y:30},convertFrom={mm:function(x){return 2.83464480558843*x},px:function(x){return x}},custom={};return frame.a11y=function(){var _ref=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},newTitle=_ref.title,newDesc=_ref.desc;return void 0!==newTitle&&(a11yTitle=newTitle),void 0!==newDesc&&(a11yDesc=newDesc),void 0===newTitle&&void 0===newDesc?{title:a11yTitle,desc:a11yDesc}:frame},frame.a11yDesc=function(x){return void 0===x?a11yDesc:(a11yDesc=x,frame)},frame.a11yPlotPresentation=function(x){return void 0===x?a11yPlotPresentation:(a11yPlotPresentation=x,frame)},frame.a11yTitle=function(x){return void 0===x?a11yTitle:(a11yTitle=x,frame)},frame.autoPosition=function(x){return void 0===x?autoPosition:(autoPosition=x,frame)},frame.backgroundColor=function(x){return void 0===x?backgroundColor:(backgroundColor=x,frame)},frame.backgroundColour=function(){return console.error("gChartframe.backgroundColour() is deprecated and will be removed next version."),console.error("Please use gChartframe.backgroundColor() instead."),frame.backgroundColor.apply(frame,arguments)},frame.blackbar=function(x){return void 0===x?blackbar:(blackbar=x,frame)},frame.containerClass=function(x){return void 0===x?containerClass:(containerClass=x,frame)},frame.copyright=function(x){return void 0===x?copyright:(copyright=x,frame)},frame.copyrightStyle=function(x){return void 0===x?copyrightStyle:(copyrightStyle=x,frame)},frame.dimension=function(){return{width:graphicWidth-(margin.left+margin.right),height:graphicHeight-(margin.top+margin.bottom)}},frame.extend=function(key,value){return custom[key]=value,frame[key]=function(d){return void 0===d?custom[key]:(custom[key]=d,frame)},frame},frame.fullYear=function(x){return void 0===x?fullYear:(fullYear=x,frame)},frame.goalposts=function(x){return void 0===x?goalposts:(goalposts=x,frame)},frame.height=function(x){return void 0===x?graphicHeight:(graphicHeight=convertFrom[units](x),frame)},frame.margin=function(x){return void 0===x?margin:(Object.keys(x).forEach(function(k){margin[k]=x[k]}),frame)},frame.plot=function(){return plot},frame.plotAdjuster=function(x){return void 0===x?plotAdjuster:(plotAdjuster=x,frame)},frame.rem=function(x){return void 0===x?rem:(rem=x,frame)},frame.showDownloadPngButtons=function(d){return void 0===d?showDownloadPngButtons:(showDownloadPngButtons=d,frame)},frame.source=function(x){return void 0===x?source:(source=x,frame)},frame.sourceLineHeight=function(x){return void 0===x?sourceLineHeight:(sourceLineHeight=x,frame)},frame.sourcePlotYOffset=function(x){return void 0===x?sourcePlotYOffset:(sourcePlotYOffset=x,frame)},frame.sourceStyle=function(x){return void 0===x?sourceStyle:(sourceStyle=x,frame)},frame.sourceX=function(x){return void 0===x?sourcePosition.x:(sourcePosition.x=x,frame)},frame.sourceY=function(x){return void 0===x?sourcePosition.y:(sourcePosition.y=x,frame)},frame.subtitle=function(x){return void 0===x?subtitle:(subtitle=x,frame)},frame.subtitleLineHeight=function(x){return void 0===x?subtitleLineHeight:(subtitleLineHeight=x,frame)},frame.subtitleStyle=function(x){return void 0===x?subtitleStyle:(subtitleStyle=x,frame)},frame.subtitleX=function(x){return void 0===x?subtitlePosition.x:(subtitlePosition.x=x,frame)},frame.subtitleY=function(x){return void 0===x?subtitlePosition.y:(subtitlePosition.y=x,frame)},frame.title=function(x){return void 0===x?title:(title=x,frame)},frame.titleStyle=function(x){return void 0===x?titleStyle:(titleStyle=x,frame)},frame.titleLineHeight=function(x){return void 0===x?titleLineHeight:(titleLineHeight=x,frame)},frame.titleX=function(x){return void 0===x?titlePosition.x:(titlePosition.x=x,frame)},frame.titleY=function(x){return void 0===x?titlePosition.y:(titlePosition.y=x,frame)},frame.units=function(x){return void 0===x?units:(units=x,frame)},frame.watermark=function(x){return void 0===x?watermarkMarkup:(watermarkLocation="",watermarkMarkup=x,frame)},frame.watermarkOffsetY=function(x){return void 0===x?watermarkOffsetY:(watermarkOffsetY=x,frame)},frame.watermarkOffsetX=function(x){return void 0===x?watermarkOffsetX:(watermarkOffsetX=x,frame)},frame.watermarkLocation=function(x){return void 0===x?watermarkLocation:(watermarkMarkup="",watermarkLocation=x,frame)},frame.watermarkWidth=function(x){return void 0===x?watermarkWidth:(watermarkWidth=x,frame)},frame.watermarkHeight=function(x){return void 0===x?watermarkHeight:(watermarkHeight=x,frame)},frame.whitebar=function(x){return void 0===x?whitebar:(whitebar=x,frame)},frame.width=function(x){return x?(graphicWidth=convertFrom[units](x),frame):graphicWidth},frame.attrs=function(x){return void 0===x?Object.assign({},{a11yDesc:a11yDesc,a11yPlotPresentation:a11yPlotPresentation,a11yTitle:a11yTitle,autoPosition:autoPosition,containerClass:containerClass,copyright:copyright,copyrightStyle:copyrightStyle,blackbar:blackbar,backgroundColor:backgroundColor,goalposts:goalposts,graphicHeight:graphicHeight,graphicWidth:graphicWidth,margin:margin,plot:plot,plotAdjuster:plotAdjuster,rem:rem,subtitle:subtitle,subtitleLineHeight:subtitleLineHeight,subtitlePosition:subtitlePosition,subtitleStyle:subtitleStyle,source:source,sourceLineHeight:sourceLineHeight,sourcePosition:sourcePosition,sourceStyle:sourceStyle,title:title,titleLineHeight:titleLineHeight,titlePosition:titlePosition,titleStyle:titleStyle,watermarkLocation:watermarkLocation,watermarkMarkup:watermarkMarkup,watermarkOffsetX:watermarkOffsetX,watermarkOffsetY:watermarkOffsetY,watermarkHeight:watermarkHeight,watermarkWidth:watermarkWidth,whitebar:whitebar,units:units},custom):(Object.keys(x).forEach(function(setterName){var value=x[setterName];(function(functionToCheck){return functionToCheck&&"[object Function]"==={}.toString.call(functionToCheck)})(frame[setterName])&&frame[setterName](value)}),frame)},void 0!==configObject&&frame.attrs(configObject),frame}function savePNG(svg,scaleFactor){svg.selectAll(classes.join(", ")).each(function(){for(var element=this,computedStyle=getComputedStyle(element,null),i=0;i<computedStyle.length;i+=1){var property=computedStyle.item(i),value=computedStyle.getPropertyValue(property);element.style[property]=value}}),saveSvgAsPng_1(svg.node(),"".concat(svg.select("title").text().replace(/\s/g,"-").toLowerCase(),".png"),{scale:scaleFactor})}var saveSvgAsPng_1=function(fn,module){return module={exports:{}},fn(module,module.exports),module.exports}(function(module,exports){!function(){function requireDomNode(el){if(!function(obj){return obj instanceof HTMLElement||obj instanceof SVGElement}(el))throw new Error("an HTMLElement or SVGElement is required; got "+el)}function isExternal(url){return url&&0==url.lastIndexOf("http",0)&&-1==url.lastIndexOf(window.location.host)}function styles(el,options,cssLoadedCallback){function processFontQueue(queue){function processNext(font){function transferFailed(e){console.warn("Failed to load font from: "+font.url),console.warn(e),css+=font.text+"\n",processFontQueue()}var oReq=new XMLHttpRequest;oReq.addEventListener("load",function(){var fontInBase64=function(buffer){for(var binary="",bytes=new Uint8Array(buffer),len=bytes.byteLength,i=0;i<len;i++)binary+=String.fromCharCode(bytes[i]);return window.btoa(binary)}(oReq.response);!function(font,fontInBase64){var dataUrl='url("data:'+font.format+";base64,"+fontInBase64+'")';css+=font.text.replace(font.fontUrlRegexp,dataUrl)+"\n",setTimeout(function(){processFontQueue(queue)},0)}(font,fontInBase64)}),oReq.addEventListener("error",transferFailed),oReq.addEventListener("abort",transferFailed),oReq.open("GET",font.url),oReq.responseType="arraybuffer",oReq.send()}if(queue.length>0){processNext(queue.pop())}else cssLoadedCallback(css)}for(var selectorRemap=options.selectorRemap,modifyStyle=options.modifyStyle,css="",fontsQueue=[],sheets=document.styleSheets,i=0;i<sheets.length;i++){try{var rules=sheets[i].cssRules}catch(e){console.warn("Stylesheet could not be loaded: "+sheets[i].href);continue}if(null!=rules)for(var match,j=0;j<rules.length;j++,match=null){var rule=rules[j];if(void 0!==rule.style){var selectorText;try{selectorText=rule.selectorText}catch(err){console.warn('The following CSS rule has an invalid selector: "'+rule+'"',err)}try{selectorText&&(match=el.querySelector(selectorText)||el.parentNode.querySelector(selectorText))}catch(err){console.warn('Invalid CSS selector "'+selectorText+'"',err)}if(match){var selector=selectorRemap?selectorRemap(rule.selectorText):rule.selectorText,cssText=modifyStyle?modifyStyle(rule.style.cssText):rule.style.cssText;css+=selector+" { "+cssText+" }\n"}else if(rule.cssText.match(/^@font-face/)){var fontUrlRegexp=/url\(["']?(.+?)["']?\)/,fontUrlMatch=rule.cssText.match(fontUrlRegexp),externalFontUrl=fontUrlMatch&&fontUrlMatch[1]||"";externalFontUrl.match(/^data:/)&&(externalFontUrl=""),externalFontUrl?(externalFontUrl.startsWith("../")?externalFontUrl=sheets[i].href+"/../"+externalFontUrl:externalFontUrl.startsWith("./")&&(externalFontUrl=sheets[i].href+"/."+externalFontUrl),fontsQueue.push({text:rule.cssText,fontUrlRegexp:fontUrlRegexp,format:function(fontUrl){for(var supportedFormats={woff2:"font/woff2",woff:"font/woff",otf:"application/x-font-opentype",ttf:"application/x-font-ttf",eot:"application/vnd.ms-fontobject",sfnt:"application/font-sfnt",svg:"image/svg+xml"},extensions=Object.keys(supportedFormats),i=0;i<extensions.length;++i){var extension=extensions[i];if(fontUrl.indexOf("."+extension)>0)return supportedFormats[extension]}return console.error("Unknown font format for "+fontUrl+"; Fonts may not be working correctly"),"application/octet-stream"}(externalFontUrl),url:externalFontUrl})):css+=rule.cssText+"\n"}}}}processFontQueue(fontsQueue)}function getDimension(el,clone,dim){var v=el.viewBox&&el.viewBox.baseVal&&el.viewBox.baseVal[dim]||null!==clone.getAttribute(dim)&&!clone.getAttribute(dim).match(/%$/)&&parseInt(clone.getAttribute(dim))||el.getBoundingClientRect()[dim]||parseInt(clone.style[dim])||parseInt(window.getComputedStyle(el).getPropertyValue(dim));return void 0===v||null===v||isNaN(parseFloat(v))?0:v}function uriToBlob(uri){for(var byteString=window.atob(uri.split(",")[1]),mimeString=uri.split(",")[0].split(":")[1].split(";")[0],buffer=new ArrayBuffer(byteString.length),intArray=new Uint8Array(buffer),i=0;i<byteString.length;i++)intArray[i]=byteString.charCodeAt(i);return new Blob([buffer],{type:mimeString})}var out$=exports||!1||this;out$.prepareSvg=function(el,options,cb){requireDomNode(el),(options=options||{}).scale=options.scale||1,options.responsive=options.responsive||!1;var xmlns="http://www.w3.org/2000/xmlns/";!function(el,callback){requireDomNode(el);var images=el.querySelectorAll("image"),left=images.length,checkDone=function(){0===left&&callback()};checkDone();for(var i=0;i<images.length;i++)!function(image){var href=image.getAttributeNS("http://www.w3.org/1999/xlink","href");if(href&&isExternal(href.value))console.warn("Cannot render embedded images linking to external hosts: "+href.value);else{var canvas=document.createElement("canvas"),ctx=canvas.getContext("2d"),img=new Image;img.crossOrigin="anonymous",(href=href||image.getAttribute("href"))?(img.src=href,img.onload=function(){canvas.width=img.width,canvas.height=img.height,ctx.drawImage(img,0,0),image.setAttributeNS("http://www.w3.org/1999/xlink","href",canvas.toDataURL("image/png")),left--,checkDone()},img.onerror=function(){console.log("Could not load "+href),left--,checkDone()}):(left--,checkDone())}}(images[i])}(el,function(){var width,height,outer=document.createElement("div"),clone=el.cloneNode(!0);if("svg"==el.tagName)width=options.width||getDimension(el,clone,"width"),height=options.height||getDimension(el,clone,"height");else{if(!el.getBBox)return void console.error("Attempted to render non-SVG element",el);var box=el.getBBox();width=box.x+box.width,height=box.y+box.height,clone.setAttribute("transform",clone.getAttribute("transform").replace(/translate\(.*?\)/,""));var svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.appendChild(clone),clone=svg}clone.setAttribute("version","1.1"),clone.getAttribute("xmlns")||clone.setAttributeNS(xmlns,"xmlns","http://www.w3.org/2000/svg"),clone.getAttribute("xmlns:xlink")||clone.setAttributeNS(xmlns,"xmlns:xlink","http://www.w3.org/1999/xlink"),options.responsive?(clone.removeAttribute("width"),clone.removeAttribute("height"),clone.setAttribute("preserveAspectRatio","xMinYMin meet")):(clone.setAttribute("width",width*options.scale),clone.setAttribute("height",height*options.scale)),clone.setAttribute("viewBox",[options.left||0,options.top||0,width,height].join(" "));for(var fos=clone.querySelectorAll("foreignObject > *"),i=0;i<fos.length;i++)fos[i].getAttribute("xmlns")||fos[i].setAttributeNS(xmlns,"xmlns","http://www.w3.org/1999/xhtml");outer.appendChild(clone),styles(el,options,function(css){var s=document.createElement("style");s.setAttribute("type","text/css"),s.innerHTML="<![CDATA[\n"+css+"\n]]>";var defs=document.createElement("defs");if(defs.appendChild(s),clone.insertBefore(defs,clone.firstChild),cb){var outHtml=outer.innerHTML;outHtml=outHtml.replace(/NS\d+:href/gi,'xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href'),cb(outHtml,width,height)}})})},out$.svgAsDataUri=function(el,options,cb){out$.prepareSvg(el,options,function(svg){var uri="data:image/svg+xml;base64,"+window.btoa(function(data){return data=encodeURIComponent(data),data=data.replace(/%([0-9A-F]{2})/g,function(match,p1){var c=String.fromCharCode("0x"+p1);return"%"===c?"%25":c}),decodeURIComponent(data)}('<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [<!ENTITY nbsp "&#160;">]>'+svg));cb&&cb(uri)})},out$.svgAsPngUri=function(el,options,cb){requireDomNode(el),(options=options||{}).encoderType=options.encoderType||"image/png",options.encoderOptions=options.encoderOptions||.8;var convertToPng=function(src,w,h){var canvas=document.createElement("canvas"),context=canvas.getContext("2d");canvas.width=w,canvas.height=h,options.canvg?options.canvg(canvas,src):context.drawImage(src,0,0),options.backgroundColor&&(context.globalCompositeOperation="destination-over",context.fillStyle=options.backgroundColor,context.fillRect(0,0,canvas.width,canvas.height));var png;try{png=canvas.toDataURL(options.encoderType,options.encoderOptions)}catch(e){if("undefined"!=typeof SecurityError&&e instanceof SecurityError||"SecurityError"==e.name)return void console.error("Rendered SVG images cannot be downloaded in this browser.");throw e}cb(png)};options.canvg?out$.prepareSvg(el,options,convertToPng):out$.svgAsDataUri(el,options,function(uri){var image=new Image;image.onload=function(){convertToPng(image,image.width,image.height)},image.onerror=function(){console.error("There was an error loading the data URI as an image on the following SVG\n",window.atob(uri.slice(26)),"\n","Open the following link to see browser's diagnosis\n",uri)},image.src=uri})},out$.download=function(name,uri){if(navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(uriToBlob(uri),name);else{var saveLink=document.createElement("a");if("download"in saveLink){saveLink.download=name,saveLink.style.display="none",document.body.appendChild(saveLink);try{var blob=uriToBlob(uri),url=URL.createObjectURL(blob);saveLink.href=url,saveLink.onclick=function(){requestAnimationFrame(function(){URL.revokeObjectURL(url)})}}catch(e){console.warn("This browser does not support object URLs. Falling back to string URL."),saveLink.href=uri}saveLink.click(),document.body.removeChild(saveLink)}else window.open(uri,"_temp","menubar=no,toolbar=no,status=no")}},out$.saveSvg=function(el,name,options){requireDomNode(el),options=options||{},out$.svgAsDataUri(el,options,function(uri){out$.download(name,uri)})},out$.saveSvgAsPng=function(el,name,options){requireDomNode(el),options=options||{},out$.svgAsPngUri(el,options,function(uri){out$.download(name,uri)})}}()}).saveSvgAsPng,xhtml="http://www.w3.org/1999/xhtml",namespaces={svg:"http://www.w3.org/2000/svg",xhtml:xhtml,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},matcher=function(selector){return function(){return this.matches(selector)}};if("undefined"!=typeof document){var element=document.documentElement;if(!element.matches){var vendorMatches=element.webkitMatchesSelector||element.msMatchesSelector||element.mozMatchesSelector||element.oMatchesSelector;matcher=function(selector){return function(){return vendorMatches.call(this,selector)}}}}var matcher$1=matcher,filterEvents={},event=null;if("undefined"!=typeof document){"onmouseenter"in document.documentElement||(filterEvents={mouseenter:"mouseover",mouseleave:"mouseout"})}EnterNode.prototype={constructor:EnterNode,appendChild:function(child){return this._parent.insertBefore(child,this._next)},insertBefore:function(child,next){return this._parent.insertBefore(child,next)},querySelector:function(selector){return this._parent.querySelector(selector)},querySelectorAll:function(selector){return this._parent.querySelectorAll(selector)}};var keyPrefix="$";ClassList.prototype={add:function(name){this._names.indexOf(name)<0&&(this._names.push(name),this._node.setAttribute("class",this._names.join(" ")))},remove:function(name){var i=this._names.indexOf(name);i>=0&&(this._names.splice(i,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(name){return this._names.indexOf(name)>=0}};var root=[null];Selection.prototype=function(){return new Selection([[document.documentElement]],root)}.prototype={constructor:Selection,select:function(select){"function"!=typeof select&&(select=selector(select));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,subnode,group=groups[j],n=group.length,subgroup=subgroups[j]=new Array(n),i=0;i<n;++i)(node=group[i])&&(subnode=select.call(node,node.__data__,i,group))&&("__data__"in node&&(subnode.__data__=node.__data__),subgroup[i]=subnode);return new Selection(subgroups,this._parents)},selectAll:function(select){"function"!=typeof select&&(select=function(selector){return null==selector?function(){return[]}:function(){return this.querySelectorAll(selector)}}(select));for(var groups=this._groups,m=groups.length,subgroups=[],parents=[],j=0;j<m;++j)for(var node,group=groups[j],n=group.length,i=0;i<n;++i)(node=group[i])&&(subgroups.push(select.call(node,node.__data__,i,group)),parents.push(node));return new Selection(subgroups,parents)},filter:function(match){"function"!=typeof match&&(match=matcher$1(match));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,group=groups[j],n=group.length,subgroup=subgroups[j]=[],i=0;i<n;++i)(node=group[i])&&match.call(node,node.__data__,i,group)&&subgroup.push(node);return new Selection(subgroups,this._parents)},data:function(value,key){if(!value)return data=new Array(this.size()),j=-1,this.each(function(d){data[++j]=d}),data;var bind=key?function(parent,group,enter,update,exit,data,key){var i,node,keyValue,nodeByKeyValue={},groupLength=group.length,dataLength=data.length,keyValues=new Array(groupLength);for(i=0;i<groupLength;++i)(node=group[i])&&(keyValues[i]=keyValue=keyPrefix+key.call(node,node.__data__,i,group),keyValue in nodeByKeyValue?exit[i]=node:nodeByKeyValue[keyValue]=node);for(i=0;i<dataLength;++i)(node=nodeByKeyValue[keyValue=keyPrefix+key.call(parent,data[i],i,data)])?(update[i]=node,node.__data__=data[i],nodeByKeyValue[keyValue]=null):enter[i]=new EnterNode(parent,data[i]);for(i=0;i<groupLength;++i)(node=group[i])&&nodeByKeyValue[keyValues[i]]===node&&(exit[i]=node)}:function(parent,group,enter,update,exit,data){for(var node,i=0,groupLength=group.length,dataLength=data.length;i<dataLength;++i)(node=group[i])?(node.__data__=data[i],update[i]=node):enter[i]=new EnterNode(parent,data[i]);for(;i<groupLength;++i)(node=group[i])&&(exit[i]=node)},parents=this._parents,groups=this._groups;"function"!=typeof value&&(value=function(x){return function(){return x}}(value));for(var m=groups.length,update=new Array(m),enter=new Array(m),exit=new Array(m),j=0;j<m;++j){var parent=parents[j],group=groups[j],groupLength=group.length,data=value.call(parent,parent&&parent.__data__,j,parents),dataLength=data.length,enterGroup=enter[j]=new Array(dataLength),updateGroup=update[j]=new Array(dataLength);bind(parent,group,enterGroup,updateGroup,exit[j]=new Array(groupLength),data,key);for(var previous,next,i0=0,i1=0;i0<dataLength;++i0)if(previous=enterGroup[i0]){for(i0>=i1&&(i1=i0+1);!(next=updateGroup[i1])&&++i1<dataLength;);previous._next=next||null}}return update=new Selection(update,parents),update._enter=enter,update._exit=exit,update},enter:function(){return new Selection(this._enter||this._groups.map(sparse),this._parents)},exit:function(){return new Selection(this._exit||this._groups.map(sparse),this._parents)},merge:function(selection){for(var groups0=this._groups,groups1=selection._groups,m0=groups0.length,m1=groups1.length,m=Math.min(m0,m1),merges=new Array(m0),j=0;j<m;++j)for(var node,group0=groups0[j],group1=groups1[j],n=group0.length,merge=merges[j]=new Array(n),i=0;i<n;++i)(node=group0[i]||group1[i])&&(merge[i]=node);for(;j<m0;++j)merges[j]=groups0[j];return new Selection(merges,this._parents)},order:function(){for(var groups=this._groups,j=-1,m=groups.length;++j<m;)for(var node,group=groups[j],i=group.length-1,next=group[i];--i>=0;)(node=group[i])&&(next&&next!==node.nextSibling&&next.parentNode.insertBefore(node,next),next=node);return this},sort:function(compare){function compareNode(a,b){return a&&b?compare(a.__data__,b.__data__):!a-!b}compare||(compare=ascending);for(var groups=this._groups,m=groups.length,sortgroups=new Array(m),j=0;j<m;++j){for(var node,group=groups[j],n=group.length,sortgroup=sortgroups[j]=new Array(n),i=0;i<n;++i)(node=group[i])&&(sortgroup[i]=node);sortgroup.sort(compareNode)}return new Selection(sortgroups,this._parents).order()},call:function(){var callback=arguments[0];return arguments[0]=this,callback.apply(null,arguments),this},nodes:function(){var nodes=new Array(this.size()),i=-1;return this.each(function(){nodes[++i]=this}),nodes},node:function(){for(var groups=this._groups,j=0,m=groups.length;j<m;++j)for(var group=groups[j],i=0,n=group.length;i<n;++i){var node=group[i];if(node)return node}return null},size:function(){var size=0;return this.each(function(){++size}),size},empty:function(){return!this.node()},each:function(callback){for(var groups=this._groups,j=0,m=groups.length;j<m;++j)for(var node,group=groups[j],i=0,n=group.length;i<n;++i)(node=group[i])&&callback.call(node,node.__data__,i,group);return this},attr:function(name,value){var fullname=namespace(name);if(arguments.length<2){var node=this.node();return fullname.local?node.getAttributeNS(fullname.space,fullname.local):node.getAttribute(fullname)}return this.each((null==value?fullname.local?function(fullname){return function(){this.removeAttributeNS(fullname.space,fullname.local)}}:function(name){return function(){this.removeAttribute(name)}}:"function"==typeof value?fullname.local?function(fullname,value){return function(){var v=value.apply(this,arguments);null==v?this.removeAttributeNS(fullname.space,fullname.local):this.setAttributeNS(fullname.space,fullname.local,v)}}:function(name,value){return function(){var v=value.apply(this,arguments);null==v?this.removeAttribute(name):this.setAttribute(name,v)}}:fullname.local?function(fullname,value){return function(){this.setAttributeNS(fullname.space,fullname.local,value)}}:function(name,value){return function(){this.setAttribute(name,value)}})(fullname,value))},style:function(name,value,priority){return arguments.length>1?this.each((null==value?function(name){return function(){this.style.removeProperty(name)}}:"function"==typeof value?function(name,value,priority){return function(){var v=value.apply(this,arguments);null==v?this.style.removeProperty(name):this.style.setProperty(name,v,priority)}}:function(name,value,priority){return function(){this.style.setProperty(name,value,priority)}})(name,value,null==priority?"":priority)):function(node,name){return node.style.getPropertyValue(name)||defaultView(node).getComputedStyle(node,null).getPropertyValue(name)}(this.node(),name)},property:function(name,value){return arguments.length>1?this.each((null==value?function(name){return function(){delete this[name]}}:"function"==typeof value?function(name,value){return function(){var v=value.apply(this,arguments);null==v?delete this[name]:this[name]=v}}:function(name,value){return function(){this[name]=value}})(name,value)):this.node()[name]},classed:function(name,value){var names=classArray(name+"");if(arguments.length<2){for(var list=classList(this.node()),i=-1,n=names.length;++i<n;)if(!list.contains(names[i]))return!1;return!0}return this.each(("function"==typeof value?function(names,value){return function(){(value.apply(this,arguments)?classedAdd:classedRemove)(this,names)}}:value?function(names){return function(){classedAdd(this,names)}}:function(names){return function(){classedRemove(this,names)}})(names,value))},text:function(value){return arguments.length?this.each(null==value?function(){this.textContent=""}:("function"==typeof value?function(value){return function(){var v=value.apply(this,arguments);this.textContent=null==v?"":v}}:function(value){return function(){this.textContent=value}})(value)):this.node().textContent},html:function(value){return arguments.length?this.each(null==value?function(){this.innerHTML=""}:("function"==typeof value?function(value){return function(){var v=value.apply(this,arguments);this.innerHTML=null==v?"":v}}:function(value){return function(){this.innerHTML=value}})(value)):this.node().innerHTML},raise:function(){return this.each(raise)},lower:function(){return this.each(lower)},append:function(name){var create="function"==typeof name?name:creator(name);return this.select(function(){return this.appendChild(create.apply(this,arguments))})},insert:function(name,before){var create="function"==typeof name?name:creator(name),select=null==before?function(){return null}:"function"==typeof before?before:selector(before);return this.select(function(){return this.insertBefore(create.apply(this,arguments),select.apply(this,arguments)||null)})},remove:function(){return this.each(remove)},datum:function(value){return arguments.length?this.property("__data__",value):this.node().__data__},on:function(typename,value,capture){var i,t,typenames=(typename+"").trim().split(/^|\s+/).map(function(t){var name="",i=t.indexOf(".");return i>=0&&(name=t.slice(i+1),t=t.slice(0,i)),{type:t,name:name}}),n=typenames.length;if(!(arguments.length<2)){for(on=value?onAdd:function(typename){return function(){var on=this.__on;if(on){for(var o,j=0,i=-1,m=on.length;j<m;++j)o=on[j],typename.type&&o.type!==typename.type||o.name!==typename.name?on[++i]=o:this.removeEventListener(o.type,o.listener,o.capture);++i?on.length=i:delete this.__on}}},null==capture&&(capture=!1),i=0;i<n;++i)this.each(on(typenames[i],value,capture));return this}var on=this.node().__on;if(on)for(var o,j=0,m=on.length;j<m;++j)for(i=0,o=on[j];i<n;++i)if((t=typenames[i]).type===o.type&&t.name===o.name)return o.value},dispatch:function(type,params){return this.each(("function"==typeof params?function(type,params){return function(){return dispatchEvent(this,type,params.apply(this,arguments))}}:function(type,params){return function(){return dispatchEvent(this,type,params)}})(type,params))}};var classes=[".annotation",".lines",".highlights",".axis path",".axis text",".axis line",".axis",".baseline",".baseline line",".legend",".legend text",".chart-goalposts",".chart-title",".chart-subtitle",".chart-source",".chart-copyright",".chart-watermark",".annotations-holder",".lines highlighlines",".highlights",".annotation",".annotations-holder line",".annotations-holder text",".line path",".highlights rects"],watermarkPath={light:'<path fill="#8e9095" id="logo" d="M3,8.5c0,0.7,0.2,0.9,1.5,0.9v0.4H0V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2h6.1c0.8,0,1.1,0,1.4-0.1l0,2.7H7.2c-0.2-2-0.7-2.2-2.6-2.2H3v4h1.3c1.3,0,1.3-0.2,1.4-1.2h0.4v2.9H5.7c-0.1-1-0.2-1.2-1.4-1.2H3V8.5zM8.4,9.8V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2h4.2v0.4c-0.9,0-1.2,0.1-1.2,0.8v7.1c0,0.8,0.3,0.8,1.2,0.8v0.4H8.4z M22,10l-6.6-8.2v6.7c0,0.8,0.5,0.9,1.5,0.9v0.4h-3.5V9.4c0.9,0,1.4-0.1,1.4-0.9V1.1c-0.4-0.4-0.7-0.5-1.4-0.5V0.2h3.1l5.1,6.5V1.5c0-0.8-0.5-0.9-1.5-0.9V0.2h3.5v0.4c-0.9,0-1.4,0.1-1.4,0.9V10H22z M26.7,9.8h-3.5V9.4c0.9,0,1.3-0.1,1.6-0.9L28,0.1h0.9l3.4,8.5c0.3,0.8,0.4,0.8,1.1,0.8v0.4h-4.1V9.4c1.2,0,1.4-0.1,1.1-0.8l-1-2.6h-3l-0.9,2.5c-0.3,0.8,0.2,0.9,1.2,0.9V9.8z M26.6,5.5h2.6L27.9,2L26.6,5.5z M42.6,10l-6.6-8.2v6.7c0,0.8,0.5,0.9,1.5,0.9v0.4H34V9.4c0.8,0,1.3-0.1,1.3-0.9V1.1c-0.5-0.4-0.8-0.5-1.6-0.5V0.2H37l5.1,6.5V1.5c0-0.8-0.5-0.9-1.5-0.9V0.2h3.5v0.4c-0.9,0-1.4,0.1-1.4,0.9V10H42.6z M52.4,0.1h0.2L52.7,3l-0.4,0c-0.2-1.7-1.1-2.5-2.7-2.5c-1.8,0-3.2,1.5-3.2,3.9c0,3,1.9,4.7,3.9,4.7c0.9,0,1.6-0.2,2.4-1.1L53,8.4c-0.6,0.9-1.8,1.6-3.5,1.6c-2.4,0-4.9-1.8-4.9-4.9c0-3,2.3-5.1,5-5.1c1.3,0,2,0.6,2.3,0.6C52.2,0.6,52.3,0.4,52.4,0.1z M53.8,9.8V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2H58v0.4c-0.9,0-1.2,0.1-1.2,0.8v7.1c0,0.8,0.3,0.8,1.2,0.8v0.4H53.8z M61.9,9.8h-3.3V9.4c0.7,0,1.1-0.1,1.4-0.9l3.2-8.4h0.9l3.4,8.5c0.3,0.8,0.4,0.8,1.1,0.8v0.4h-4.1V9.4c1.2,0,1.4-0.1,1.1-0.8l-1-2.6h-3l-0.9,2.5c-0.3,0.8,0.2,0.9,1.2,0.9V9.8z M61.8,5.5h2.6L63,2L61.8,5.5z M69.3,9.8V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2h4.1v0.4c-0.9,0-1.2,0.1-1.2,0.8v7.2c0,0.6,0.3,0.7,0.8,0.7h0.5c1.9,0,2.5-0.3,3-2.4L77,7l-0.3,2.9H69.3z M89.4,0.1l0,2.9h-0.4c-0.2-2.1-0.7-2.3-2.6-2.3H86v7.9c0,0.8,0.3,0.9,1.5,0.9v0.4h-4.8V9.4c1.2,0,1.5-0.1,1.5-0.9V0.6h-0.6c-1.9,0-2.3,0.3-2.6,2.3h-0.4l0-2.9c0.3,0,0.5,0.1,1.4,0.1h6C88.9,0.2,89.2,0.1,89.4,0.1z M90.4,9.8V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2h4.2v0.4c-0.9,0-1.2,0.1-1.2,0.8v7.1c0,0.8,0.3,0.8,1.2,0.8v0.4H90.4z M107,0.2v0.4c-0.9,0-1.3,0-1.2,0.8l0.8,7.2c0.1,0.7,0.4,0.8,1.2,0.8v0.4h-4.1V9.4c0.9,0,1.2-0.1,1.1-0.8L104,1l-3.1,9h-0.1l-3-9l-0.7,7.5c-0.1,0.8,0.4,0.8,1.3,0.8v0.4h-3.2V9.4c0.9,0,1.2-0.1,1.2-0.8l0.7-7.2c0.1-0.8-0.3-0.8-1.2-0.8V0.2h3.4l2,6.6l2.2-6.6H107z M114.8,6.3h-0.4c-0.1-1-0.2-1.2-1.4-1.2h-1.5v3.5c0,0.6,0.3,0.7,0.8,0.7h0.8c1.9,0,2.5-0.3,3-2.4l0.4,0l-0.3,2.9h-7.6V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2h7.3l0,2.4h-0.4c-0.2-1.7-0.7-1.9-2.6-1.9h-1.4v3.9h1.5c1.3,0,1.3-0.2,1.4-1.2h0.4V6.3z M122.5,7.8c0-0.9-0.6-1.3-1.5-1.9l-1.5-0.8c-1.2-0.6-1.8-1.3-1.8-2.5c0-1.5,1.3-2.7,3-2.7c1.2,0,1.8,0.6,2.1,0.6c0.2,0,0.3-0.1,0.4-0.4h0.3l0.1,2.7l-0.4,0c-0.2-1.3-1.1-2.3-2.5-2.3c-1,0-1.7,0.6-1.7,1.4c0,0.9,0.7,1.3,1.5,1.7l1.3,0.7c1.2,0.7,2.1,1.4,2.1,2.7c0,1.7-1.5,2.9-3.3,2.9c-1.3,0-1.9-0.6-2.3-0.6c-0.2,0-0.3,0.2-0.4,0.5h-0.3L117.4,7l0.4,0c0.3,1.8,1.5,2.5,2.8,2.5C121.6,9.5,122.5,9,122.5,7.8z"/>'};exports.frame=chartFrame,exports.webFrameS=function(configObject){var f=chartFrame().autoPosition(!0).containerClass("ft-webgraphic-s").backgroundColor("#FFF1E0").blackbar("#000").width(300).margin({bottom:90,right:5,left:15}).rem(14).plotAdjuster(0).titleStyle({"font-size":20,"font-family":"MetricWeb,sans-serif","font-weight":400,fill:"#000"}).titleY(32).titleLineHeight(24).subtitleLineHeight(20).subtitleStyle({"font-size":18,"font-family":"MetricWeb,sans-serif",fill:"#66605C"}).subtitleY(64).sourceLineHeight(12).sourcePlotYOffset(38).sourceStyle({"font-size":"12px","font-family":"MetricWeb,sans-serif",fill:"#66605C"}).copyrightStyle({"font-size":"12px","font-style":"italic","font-family":"MetricWeb,sans-serif",fill:"#66605C"});return void 0!==configObject&&f.attrs(configObject),f},exports.webFrameM=function(configObject){var f=chartFrame().autoPosition(!0).containerClass("ft-webgraphic-m").backgroundColor("#FFF1E0").blackbar("#000").width(700).height(500).margin({bottom:104,right:5,left:20}).rem(16).plotAdjuster(4).titleY(32).titleStyle({"font-size":24,"font-family":"MetricWeb,sans-serif","font-weight":400,fill:"#000"}).titleLineHeight(28).subtitleLineHeight(20).subtitleStyle({"font-size":18,"font-family":"MetricWeb,sans-serif",fill:"#66605C"}).subtitleY(64).sourceLineHeight(16).sourcePlotYOffset(44).sourceStyle({"font-size":"14px","font-family":"MetricWeb,sans-serif",fill:"#66605C"}).copyrightStyle({"font-size":"14px","font-style":"italic","font-family":"MetricWeb,sans-serif",fill:"#66605C"});return void 0!==configObject&&f.attrs(configObject),f},exports.webFrameMDefault=function(configObject){var f=chartFrame().autoPosition(!0).containerClass("ft-webgraphic-m-default").backgroundColor("#FFF1E0").blackbar("#000").width(700).height(500).margin({bottom:115,right:5,left:20}).rem(20).plotAdjuster(8).titleY(32).titleStyle({"font-size":28,"font-family":"MetricWeb,sans-serif","font-weight":400,fill:"#000"}).titleLineHeight(28).subtitleLineHeight(28).subtitleStyle({"font-size":24,"font-family":"MetricWeb,sans-serif",fill:"#66605C"}).subtitleY(68).sourceLineHeight(18).sourcePlotYOffset(34).sourceStyle({"font-size":"16px","font-family":"MetricWeb,sans-serif",fill:"#66605C"}).copyrightStyle({"font-size":"14px","font-style":"italic","font-family":"MetricWeb,sans-serif",fill:"#66605C"});return void 0!==configObject&&f.attrs(configObject),f},exports.webFrameL=function(configObject){var f=chartFrame().autoPosition(!0).containerClass("ft-webgraphic-l").backgroundColor("#FFF1E0").width(1180).height(700).blackbar("#000").fullYear(!0).margin({bottom:105,right:5,left:20}).rem(18).plotAdjuster(8).titleY(32).titleStyle({"font-size":28,"font-family":"MetricWeb,sans-serif","font-weight":400,fill:"#000"}).titleLineHeight(32).subtitleLineHeight(20).subtitleY(64).subtitleStyle({"font-size":18,"font-family":"MetricWeb,sans-serif",fill:"#66605C"}).sourceLineHeight(16).sourcePlotYOffset(44).sourceStyle({"font-size":"16px","font-family":"MetricWeb,sans-serif",fill:"#66605C"}).copyrightStyle({"font-size":"16px","font-style":"italic","font-family":"MetricWeb,sans-serif",fill:"#66605C"});return void 0!==configObject&&f.attrs(configObject),f},exports.printFrame=function(configObject){var f=chartFrame().containerClass("ft-printgraphic").autoPosition(!0).backgroundColor("#FFF").goalposts("#000").units("mm").width(112.25).height(68).margin({top:40,left:15,bottom:35,right:7}).rem(9.6).titleStyle({"font-size":"12px",fill:"#000000","font-weight":"600","font-family":"MetricWeb,sans-serif"}).titleX(7).titleY(15).titleLineHeight(13).subtitleStyle({fill:"#000000","font-size":"9.6px","font-weight":400,"font-family":"MetricWeb,sans-serif"}).subtitleLineHeight(10).subtitleX(7).subtitleY(27).sourceStyle({fill:"#000000","font-size":"7.2px","font-weight":400,"font-family":"MetricWeb,sans-serif"}).sourceX(7).sourcePlotYOffset(18).sourceLineHeight(8);return void 0!==configObject&&f.attrs(configObject),f},exports.socialFrame=function(configObject){var f=chartFrame().autoPosition(!0).containerClass("ft-socialgraphic").backgroundColor("#262a33").whitebar("#fff").width(612).height(612).watermark(watermarkPath.light).watermarkOffsetX(40).watermarkOffsetY(40).margin({left:40,right:40,bottom:138,top:140}).rem(24).titleX(40).titleY(80).titleLineHeight(32).titleStyle({"font-size":"30px",fill:"#ffffff","font-weight":400,"font-family":"MetricWeb,sans-serif"}).subtitleX(40).subtitleY(112).subtitleLineHeight(28).subtitleStyle({"font-size":"24px",fill:"#8e9095","font-weight":400,"font-family":"MetricWeb,sans-serif"}).sourceX(40).sourceLineHeight(20).sourcePlotYOffset(66).sourceStyle({"font-size":"20px",fill:"#8e9095","font-weight":400,"font-family":"MetricWeb,sans-serif"});return void 0!==configObject&&f.attrs(configObject),f},exports.videoFrame=function(configObject){var f=chartFrame().autoPosition(!0).backgroundColor("#262a33").containerClass("ft-videographic").width(1920).height(1080).margin({left:207,right:207,bottom:210,top:233}).rem(48).titleX(207).titleY(130).titleLineHeight(68).titleStyle({"font-size":"72px",fill:"#ffffff","font-weight":400,"font-family":"MetricWeb,sans-serif"}).subtitleX(207).subtitleY(200).subtitleLineHeight(48).subtitleStyle({"font-size":"48px",fill:"#8e9095","font-weight":400,"font-family":"MetricWeb,sans-serif"}).sourceX(207).sourcePlotYOffset(60).sourceLineHeight(38).sourceStyle({"font-size":"36px",fill:"#8e9095","font-weight":400,"font-family":"MetricWeb,sans-serif"});return void 0!==configObject&&f.attrs(configObject),f}});
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports):"function"==typeof define&&define.amd?define(["exports"],factory):(global="undefined"!=typeof globalThis?globalThis:global||self,factory(global.gChartframe={}))}(this,function(exports){"use strict";function namespace(name){var prefix=name+="",i=prefix.indexOf(":");return i>=0&&"xmlns"!==(prefix=name.slice(0,i))&&(name=name.slice(i+1)),namespaces.hasOwnProperty(prefix)?{space:namespaces[prefix],local:name}:name}function creator(name){var fullname=namespace(name);return(fullname.local?function(fullname){return function(){return this.ownerDocument.createElementNS(fullname.space,fullname.local)}}:function(name){return function(){var document=this.ownerDocument,uri=this.namespaceURI;return uri===xhtml&&document.documentElement.namespaceURI===xhtml?document.createElement(name):document.createElementNS(uri,name)}})(fullname)}function selector(selector){return null==selector?function(){}:function(){return this.querySelector(selector)}}function array(x){return"object"==typeof x&&"length"in x?x:Array.from(x)}function childMatcher(selector){return function(node){return node.matches(selector)}}function sparse(update){return new Array(update.length)}function EnterNode(parent,datum){this.ownerDocument=parent.ownerDocument,this.namespaceURI=parent.namespaceURI,this._next=null,this._parent=parent,this.__data__=datum}function datum(node){return node.__data__}function ascending(a,b){return a<b?-1:a>b?1:a>=b?0:NaN}function defaultView(node){return node.ownerDocument&&node.ownerDocument.defaultView||node.document&&node||node.defaultView}function classArray(string){return string.trim().split(/^|\s+/)}function classList(node){return node.classList||new ClassList(node)}function ClassList(node){this._node=node,this._names=classArray(node.getAttribute("class")||"")}function classedAdd(node,names){for(var list=classList(node),i=-1,n=names.length;++i<n;)list.add(names[i])}function classedRemove(node,names){for(var list=classList(node),i=-1,n=names.length;++i<n;)list.remove(names[i])}function raise(){this.nextSibling&&this.parentNode.appendChild(this)}function lower(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function remove(){var parent=this.parentNode;parent&&parent.removeChild(this)}function dispatchEvent(node,type,params){var window=defaultView(node),event=window.CustomEvent;"function"==typeof event?event=new event(type,params):(event=window.document.createEvent("Event"),params?(event.initEvent(type,params.bubbles,params.cancelable),event.detail=params.detail):event.initEvent(type,!1,!1)),node.dispatchEvent(event)}function Selection(groups,parents){this._groups=groups,this._parents=parents}function select(selector){return"string"==typeof selector?new Selection([[document.querySelector(selector)]],[document.documentElement]):new Selection([[selector]],root)}function chartFrame(configObject){function attributeStyle(parent,style){Object.keys(style).forEach(function(attribute){parent.attr(attribute,style[attribute])})}function frame(p){if(p.attr("class",containerClass).attr("font-family","MetricWeb,sans-serif"),p.attr("role","img"),"svg"===p.node().nodeName.toLowerCase()&&(p.attr("width",graphicWidth).attr("height",graphicHeight).attr("viewBox",["0 0",graphicWidth,graphicHeight].join(" ")),!1===a11yTitle&&!1===title||(p.append("title").text(a11yTitle||title).attr("id","".concat(containerClass,"__chart-a11y-title")),p.attr("aria-labelledby","".concat(containerClass,"__chart-a11y-title"))),!1!==a11yDesc&&(p.append("desc").text(a11yDesc).attr("id","".concat(containerClass,"__chart-a11y-desc")),p.attr("aria-labelledby","".concat(p.attr("aria-labelledby")?"".concat(p.attr("aria-labelledby")," "):"").concat(containerClass,"__chart-a11y-desc")))),void 0===backgroundColor||p.select("#chart-background").size()||p.append("rect").attr("role","presentation").attr("id","chart-background").attr("class","chart-background").attr("x",0).attr("y",0).attr("width",graphicWidth).attr("height",graphicHeight).attr("fill",backgroundColor),blackbar&&!p.selectAll("rect.black-bar").size()&&p.append("rect").attr("class","black-bar").attr("width",60).attr("height",4).style("fill",blackbar),whitebar&&!p.selectAll("rect.white-bar").size()&&p.append("rect").attr("class","white-bar").attr("width",60).attr("height",4).style("fill",whitebar).attr("transform","translate(".concat(margin.left,",").concat(margin.left,")")),goalposts&&!p.selectAll("path.chart-goalposts").size()){var goalpostPaths=["M 0, ".concat(graphicHeight," L ").concat(graphicWidth,", ").concat(graphicHeight),"M 0, 15 L 0, 0 L ".concat(graphicWidth,", 0 L ").concat(graphicWidth,", 15")];p.append("path").attr("class","chart-goalposts").attr("d",goalpostPaths).attr("stroke-width",.3).attr("fill","none").attr("stroke",goalposts)}var titleLineCount=title?title.split("|").length:0,subtitleLineCount=subtitle?subtitle.split("|").length:0,sourceLineCount=source?source.split("|").length:0;if(title&&!p.select("text.chart-title").size()&&p.append("text").attr("class","chart-title").attr("id","".concat(containerClass,"title")).call(function(titleText){titleText.selectAll("tspan").data(title.split("|")).enter().append("tspan").text(function(d){return d}).attr("y",function(d,i){return titlePosition.y+i*titleLineHeight}).attr("x",titlePosition.x).call(attributeStyle,titleStyle)}),subtitle&&!p.select("text.chart-subtitle").size()&&p.append("text").attr("id","".concat(containerClass,"subtitle")).attr("class","chart-subtitle").call(function(subtitleText){subtitleText.selectAll("tspan").data(subtitle.split("|")).enter().append("tspan").text(function(d){return d}).attr("id","".concat(containerClass,"subtitle")).attr("y",function(d,i){return titleLineCount>1?titlePosition.y+titleLineCount*titleLineHeight+subtitleLineHeight*i:subtitlePosition.y+i*subtitleLineHeight}).attr("x",subtitlePosition.x).call(attributeStyle,subtitleStyle)}),source&&!p.selectAll("text.chart-source").size()&&p.append("text").attr("class","chart-source").attr("id","".concat(containerClass,"source")).call(function(sourceText){sourceText.selectAll("tspan").data(source.split("|")).enter().append("tspan").text(function(d){return d}).attr("id","".concat(containerClass,"source")).attr("y",function(d,i){return sourcePosition.y?sourcePosition.y+i*sourceLineHeight:graphicHeight-(margin.bottom-sourcePlotYOffset)+1.5*sourceLineHeight+i*sourceLineHeight}).attr("x",sourcePosition.x).call(attributeStyle,sourceStyle)}),copyrightStyle&&!p.selectAll("text.chart-copyright").size()&&p.append("text").attr("class","chart-copyright").append("tspan").text(copyright).attr("x",sourcePosition.x).attr("y",function(){return sourceLineCount>1?graphicHeight-(margin.bottom-sourcePlotYOffset)+1.125*sourceLineHeight+sourceLineCount*sourceLineHeight*1.2:graphicHeight-(margin.bottom-sourcePlotYOffset)+2.5*sourceLineHeight}).call(attributeStyle,copyrightStyle),!autoPosition||"ft-printgraphic"!==containerClass&&"ft-socialgraphic"!==containerClass&&"ft-videographic"!==containerClass?autoPosition&&(margin.top=titlePosition.y+titleLineCount*titleLineHeight+subtitleLineCount*subtitleLineHeight+28-plotAdjuster):margin.top=titlePosition.y+titleLineCount*titleLineHeight+subtitleLineCount*subtitleLineHeight+rem/3,watermarkMarkup&&!p.selectAll("g.chart-watermark").size()&&"svg"!==p.node().ownerDocument.doctype.name&&p.append("g").attr("class","chart-watermark").html(watermarkMarkup).attr("role","presentation").attr("transform","translate(".concat(graphicWidth-watermarkWidth-watermarkOffsetX,",").concat(graphicHeight-watermarkHeight-watermarkOffsetY,") scale(1) ")),(plot=p.selectAll("g.chart-plot").size()?p.select("g.chart-plot"):p.append("g").attr("class","chart-plot")).attr("transform","translate(".concat(margin.left,",").concat(margin.top,")")),a11yPlotPresentation&&plot.attr("role","presentation"),showDownloadPngButtons&&"svg"!==p.node().ownerDocument.doctype.name){var parent;if(!(parent=select("svg"===p.node().nodeName.toLowerCase()?p.node().parentNode:p.node())).selectAll(".button-holder").size()){var holder=parent.append("div").attr("class","button-holder");holder.append("button").attr("class","save-png-button save-png-button__1x").text("Save as .png").style("float","left").style("opacity",.6).on("click",function(){return savePNG(p,1)}),holder.append("button").attr("class","save-png-button save-png-button__2x").style("float","left").style("opacity",.6).text("Save as double size .png").on("click",function(){return savePNG(p,2)})}}}var backgroundColor,plot,autoPosition=!1,a11yDesc="A graphic by the Financial Times",a11yPlotPresentation=!0,a11yTitle="A chart",containerClass="g-chartframe",copyright="© FT",copyrightStyle=!1,goalposts=!1,blackbar=!1,whitebar=!1,fullYear=!1,showDownloadPngButtons=!0,graphicHeight=400,graphicWidth=500,plotAdjuster=0,rem=18,subtitle="some supporting information, units perhaps",subtitleLineHeight=20,subtitleStyle={},source="Source: research",sourceLineHeight=16,sourcePlotYOffset=46,sourceStyle={},title="Title: A description of the charts purpose",titleLineHeight=32,titleStyle={},watermarkLocation="icons.svg#ft-logo",watermarkMarkup="",watermarkOffsetX=40,watermarkOffsetY=0,watermarkWidth=124,watermarkHeight=10,units="px",margin={top:100,left:1,bottom:20,right:20},subtitlePosition={x:1,y:67},sourcePosition={x:1},titlePosition={x:1,y:30},convertFrom={mm:function(x){return 2.83464480558843*x},px:function(x){return x}},custom={};return frame.a11y=function(){var _ref=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},newTitle=_ref.title,newDesc=_ref.desc;return void 0!==newTitle&&(a11yTitle=newTitle),void 0!==newDesc&&(a11yDesc=newDesc),void 0===newTitle&&void 0===newDesc?{title:a11yTitle,desc:a11yDesc}:frame},frame.a11yDesc=function(x){return void 0===x?a11yDesc:(a11yDesc=x,frame)},frame.a11yPlotPresentation=function(x){return void 0===x?a11yPlotPresentation:(a11yPlotPresentation=x,frame)},frame.a11yTitle=function(x){return void 0===x?a11yTitle:(a11yTitle=x,frame)},frame.autoPosition=function(x){return void 0===x?autoPosition:(autoPosition=x,frame)},frame.backgroundColor=function(x){return void 0===x?backgroundColor:(backgroundColor=x,frame)},frame.backgroundColour=function(){return console.error("gChartframe.backgroundColour() is deprecated and will be removed next version."),console.error("Please use gChartframe.backgroundColor() instead."),frame.backgroundColor.apply(frame,arguments)},frame.blackbar=function(x){return void 0===x?blackbar:(blackbar=x,frame)},frame.containerClass=function(x){return void 0===x?containerClass:(containerClass=x,frame)},frame.copyright=function(x){return void 0===x?copyright:(copyright=x,frame)},frame.copyrightStyle=function(x){return void 0===x?copyrightStyle:(copyrightStyle=x,frame)},frame.dimension=function(){return{width:graphicWidth-(margin.left+margin.right),height:graphicHeight-(margin.top+margin.bottom)}},frame.extend=function(key,value){return custom[key]=value,frame[key]=function(d){return void 0===d?custom[key]:(custom[key]=d,frame)},frame},frame.fullYear=function(x){return void 0===x?fullYear:(fullYear=x,frame)},frame.goalposts=function(x){return void 0===x?goalposts:(goalposts=x,frame)},frame.height=function(x){return void 0===x?graphicHeight:(graphicHeight=convertFrom[units](x),frame)},frame.margin=function(x){return void 0===x?margin:(Object.keys(x).forEach(function(k){margin[k]=x[k]}),frame)},frame.plot=function(){return plot},frame.plotAdjuster=function(x){return void 0===x?plotAdjuster:(plotAdjuster=x,frame)},frame.rem=function(x){return void 0===x?rem:(rem=x,frame)},frame.showDownloadPngButtons=function(d){return void 0===d?showDownloadPngButtons:(showDownloadPngButtons=d,frame)},frame.source=function(x){return void 0===x?source:(source=x,frame)},frame.sourceLineHeight=function(x){return void 0===x?sourceLineHeight:(sourceLineHeight=x,frame)},frame.sourcePlotYOffset=function(x){return void 0===x?sourcePlotYOffset:(sourcePlotYOffset=x,frame)},frame.sourceStyle=function(x){return void 0===x?sourceStyle:(sourceStyle=x,frame)},frame.sourceX=function(x){return void 0===x?sourcePosition.x:(sourcePosition.x=x,frame)},frame.sourceY=function(x){return void 0===x?sourcePosition.y:(sourcePosition.y=x,frame)},frame.subtitle=function(x){return void 0===x?subtitle:(subtitle=x,frame)},frame.subtitleLineHeight=function(x){return void 0===x?subtitleLineHeight:(subtitleLineHeight=x,frame)},frame.subtitleStyle=function(x){return void 0===x?subtitleStyle:(subtitleStyle=x,frame)},frame.subtitleX=function(x){return void 0===x?subtitlePosition.x:(subtitlePosition.x=x,frame)},frame.subtitleY=function(x){return void 0===x?subtitlePosition.y:(subtitlePosition.y=x,frame)},frame.title=function(x){return void 0===x?title:(title=x,frame)},frame.titleStyle=function(x){return void 0===x?titleStyle:(titleStyle=x,frame)},frame.titleLineHeight=function(x){return void 0===x?titleLineHeight:(titleLineHeight=x,frame)},frame.titleX=function(x){return void 0===x?titlePosition.x:(titlePosition.x=x,frame)},frame.titleY=function(x){return void 0===x?titlePosition.y:(titlePosition.y=x,frame)},frame.units=function(x){return void 0===x?units:(units=x,frame)},frame.watermark=function(x){return void 0===x?watermarkMarkup:(watermarkLocation="",watermarkMarkup=x,frame)},frame.watermarkOffsetY=function(x){return void 0===x?watermarkOffsetY:(watermarkOffsetY=x,frame)},frame.watermarkOffsetX=function(x){return void 0===x?watermarkOffsetX:(watermarkOffsetX=x,frame)},frame.watermarkLocation=function(x){return void 0===x?watermarkLocation:(watermarkMarkup="",watermarkLocation=x,frame)},frame.watermarkWidth=function(x){return void 0===x?watermarkWidth:(watermarkWidth=x,frame)},frame.watermarkHeight=function(x){return void 0===x?watermarkHeight:(watermarkHeight=x,frame)},frame.whitebar=function(x){return void 0===x?whitebar:(whitebar=x,frame)},frame.width=function(x){return x?(graphicWidth=convertFrom[units](x),frame):graphicWidth},frame.attrs=function(x){return void 0===x?Object.assign({},{a11yDesc:a11yDesc,a11yPlotPresentation:a11yPlotPresentation,a11yTitle:a11yTitle,autoPosition:autoPosition,containerClass:containerClass,copyright:copyright,copyrightStyle:copyrightStyle,blackbar:blackbar,backgroundColor:backgroundColor,goalposts:goalposts,graphicHeight:graphicHeight,graphicWidth:graphicWidth,margin:margin,plot:plot,plotAdjuster:plotAdjuster,rem:rem,subtitle:subtitle,subtitleLineHeight:subtitleLineHeight,subtitlePosition:subtitlePosition,subtitleStyle:subtitleStyle,source:source,sourceLineHeight:sourceLineHeight,sourcePosition:sourcePosition,sourceStyle:sourceStyle,title:title,titleLineHeight:titleLineHeight,titlePosition:titlePosition,titleStyle:titleStyle,watermarkLocation:watermarkLocation,watermarkMarkup:watermarkMarkup,watermarkOffsetX:watermarkOffsetX,watermarkOffsetY:watermarkOffsetY,watermarkHeight:watermarkHeight,watermarkWidth:watermarkWidth,whitebar:whitebar,units:units},custom):(Object.keys(x).forEach(function(setterName){var value=x[setterName];(function(functionToCheck){return functionToCheck&&"[object Function]"==={}.toString.call(functionToCheck)})(frame[setterName])&&frame[setterName](value)}),frame)},void 0!==configObject&&frame.attrs(configObject),frame}function savePNG(svg,scaleFactor){svg.selectAll(classes.join(", ")).each(function(){for(var element=this,computedStyle=getComputedStyle(element,null),i=0;i<computedStyle.length;i+=1){var property=computedStyle.item(i),value=computedStyle.getPropertyValue(property);element.style[property]=value}}),saveSvgAsPng_1(svg.node(),"".concat(svg.select("title").text().replace(/\s/g,"-").toLowerCase(),".png"),{scale:scaleFactor})}var saveSvgAsPng_1=function(fn,module){return module={exports:{}},fn(module,module.exports),module.exports}(function(module,exports){!function(){var out$=exports||!1||this||window;out$.default=out$;var xmlNs="http://www.w3.org/2000/xmlns/",svgNs="http://www.w3.org/2000/svg",urlRegex=/url\(["']?(.+?)["']?\)/,fontFormats={woff2:"font/woff2",woff:"font/woff",otf:"application/x-font-opentype",ttf:"application/x-font-ttf",eot:"application/vnd.ms-fontobject",sfnt:"application/font-sfnt",svg:"image/svg+xml"},isElement=function(obj){return obj instanceof HTMLElement||obj instanceof SVGElement},requireDomNode=function(el){if(!isElement(el))throw new Error("an HTMLElement or SVGElement is required; got "+el)},requireDomNodePromise=function(el){return new Promise(function(resolve,reject){isElement(el)?resolve(el):reject(new Error("an HTMLElement or SVGElement is required; got "+el))})},getDimension=function(el,clone,dim){var v=el.viewBox&&el.viewBox.baseVal&&el.viewBox.baseVal[dim]||null!==clone.getAttribute(dim)&&!clone.getAttribute(dim).match(/%$/)&&parseInt(clone.getAttribute(dim))||el.getBoundingClientRect()[dim]||parseInt(clone.style[dim])||parseInt(window.getComputedStyle(el).getPropertyValue(dim));return void 0===v||null===v||isNaN(parseFloat(v))?0:v},uriToBlob=function(uri){for(var byteString=window.atob(uri.split(",")[1]),mimeString=uri.split(",")[0].split(":")[1].split(";")[0],buffer=new ArrayBuffer(byteString.length),intArray=new Uint8Array(buffer),i=0;i<byteString.length;i++)intArray[i]=byteString.charCodeAt(i);return new Blob([buffer],{type:mimeString})},detectCssFont=function(rule,href){var match=rule.cssText.match(urlRegex),url=match&&match[1]||"";if(url&&!url.match(/^data:/)&&"about:blank"!==url){var fullUrl=url.startsWith("../")?href+"/../"+url:url.startsWith("./")?href+"/."+url:url;return{text:rule.cssText,format:function(fontUrl){var formats=Object.keys(fontFormats).filter(function(extension){return fontUrl.indexOf("."+extension)>0}).map(function(extension){return fontFormats[extension]});return formats?formats[0]:(console.error("Unknown font format for "+fontUrl+". Fonts may not be working correctly."),"application/octet-stream")}(fullUrl),url:fullUrl}}},inlineImages=function(el){return Promise.all(Array.from(el.querySelectorAll("image")).map(function(image){var href=image.getAttributeNS("http://www.w3.org/1999/xlink","href")||image.getAttribute("href");return href?(function(url){return url&&0===url.lastIndexOf("http",0)&&-1===url.lastIndexOf(window.location.host)}(href)&&(href+=(-1===href.indexOf("?")?"?":"&")+"t="+(new Date).valueOf()),new Promise(function(resolve,reject){var canvas=document.createElement("canvas"),img=new Image;img.crossOrigin="anonymous",img.src=href,img.onerror=function(){return reject(new Error("Could not load "+href))},img.onload=function(){canvas.width=img.width,canvas.height=img.height,canvas.getContext("2d").drawImage(img,0,0),image.setAttributeNS("http://www.w3.org/1999/xlink","href",canvas.toDataURL("image/png")),resolve(!0)}})):Promise.resolve(null)}))},cachedFonts={},inlineFonts=function(fonts){return Promise.all(fonts.map(function(font){return new Promise(function(resolve,reject){if(cachedFonts[font.url])return resolve(cachedFonts[font.url]);var req=new XMLHttpRequest;req.addEventListener("load",function(){var fontInBase64=function(buffer){for(var binary="",bytes=new Uint8Array(buffer),i=0;i<bytes.byteLength;i++)binary+=String.fromCharCode(bytes[i]);return window.btoa(binary)}(req.response),fontUri=font.text.replace(urlRegex,'url("data:'+font.format+";base64,"+fontInBase64+'")')+"\n";cachedFonts[font.url]=fontUri,resolve(fontUri)}),req.addEventListener("error",function(e){console.warn("Failed to load font from: "+font.url,e),cachedFonts[font.url]=null,resolve(null)}),req.addEventListener("abort",function(e){console.warn("Aborted loading font from: "+font.url,e),resolve(null)}),req.open("GET",font.url),req.responseType="arraybuffer",req.send()})})).then(function(fontCss){return fontCss.filter(function(x){return x}).join("")})},cachedRules=null,inlineCss=function(el,options){var _ref=options||{},selectorRemap=_ref.selectorRemap,modifyStyle=_ref.modifyStyle,fonts=_ref.fonts,excludeUnusedCss=_ref.excludeUnusedCss,generateCss=_ref.modifyCss||function(selector,properties){return(selectorRemap?selectorRemap(selector):selector)+"{"+(modifyStyle?modifyStyle(properties):properties)+"}\n"},css=[],detectFonts=void 0===fonts,fontList=fonts||[];return(cachedRules||(cachedRules=Array.from(document.styleSheets).map(function(sheet){try{return{rules:sheet.cssRules,href:sheet.href}}catch(e){return console.warn("Stylesheet could not be loaded: "+sheet.href,e),{}}}))).forEach(function(_ref2){var rules=_ref2.rules,href=_ref2.href;rules&&Array.from(rules).forEach(function(rule){if(void 0!==rule.style)if(function(el,selector){if(selector)try{return el.querySelector(selector)||el.parentNode&&el.parentNode.querySelector(selector)}catch(err){console.warn('Invalid CSS selector "'+selector+'"',err)}}(el,rule.selectorText))css.push(generateCss(rule.selectorText,rule.style.cssText));else if(detectFonts&&rule.cssText.match(/^@font-face/)){var font=detectCssFont(rule,href);font&&fontList.push(font)}else excludeUnusedCss||css.push(rule.cssText)})}),inlineFonts(fontList).then(function(fontCss){return css.join("\n")+fontCss})},downloadOptions=function(){if(!(navigator.msSaveOrOpenBlob||"download"in document.createElement("a")))return{popup:window.open()}};out$.prepareSvg=function(el,options,done){requireDomNode(el);var _ref3=options||{},_ref3$left=_ref3.left,left=void 0===_ref3$left?0:_ref3$left,_ref3$top=_ref3.top,top=void 0===_ref3$top?0:_ref3$top,w=_ref3.width,h=_ref3.height,_ref3$scale=_ref3.scale,scale=void 0===_ref3$scale?1:_ref3$scale,_ref3$responsive=_ref3.responsive,responsive=void 0!==_ref3$responsive&&_ref3$responsive,_ref3$excludeCss=_ref3.excludeCss,excludeCss=void 0!==_ref3$excludeCss&&_ref3$excludeCss;return inlineImages(el).then(function(){var clone=el.cloneNode(!0);clone.style.backgroundColor=(options||{}).backgroundColor||el.style.backgroundColor;var _getDimensions=function(el,clone,width,height){if("svg"===el.tagName)return{width:width||getDimension(el,clone,"width"),height:height||getDimension(el,clone,"height")};if(el.getBBox){var _el$getBBox=el.getBBox(),x=_el$getBBox.x,y=_el$getBBox.y;return{width:x+_el$getBBox.width,height:y+_el$getBBox.height}}}(el,clone,w,h),width=_getDimensions.width,height=_getDimensions.height;if("svg"!==el.tagName){if(!el.getBBox)return void console.error("Attempted to render non-SVG element",el);null!=clone.getAttribute("transform")&&clone.setAttribute("transform",clone.getAttribute("transform").replace(/translate\(.*?\)/,""));var svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.appendChild(clone),clone=svg}if(clone.setAttribute("version","1.1"),clone.setAttribute("viewBox",[left,top,width,height].join(" ")),clone.getAttribute("xmlns")||clone.setAttributeNS(xmlNs,"xmlns",svgNs),clone.getAttribute("xmlns:xlink")||clone.setAttributeNS(xmlNs,"xmlns:xlink","http://www.w3.org/1999/xlink"),responsive?(clone.removeAttribute("width"),clone.removeAttribute("height"),clone.setAttribute("preserveAspectRatio","xMinYMin meet")):(clone.setAttribute("width",width*scale),clone.setAttribute("height",height*scale)),Array.from(clone.querySelectorAll("foreignObject > *")).forEach(function(foreignObject){foreignObject.setAttributeNS(xmlNs,"xmlns","svg"===foreignObject.tagName?svgNs:"http://www.w3.org/1999/xhtml")}),!excludeCss)return inlineCss(el,options).then(function(css){var style=document.createElement("style");style.setAttribute("type","text/css"),style.innerHTML="<![CDATA[\n"+css+"\n]]>";var defs=document.createElement("defs");defs.appendChild(style),clone.insertBefore(defs,clone.firstChild);var outer=document.createElement("div");outer.appendChild(clone);var src=outer.innerHTML.replace(/NS\d+:href/gi,'xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href');if("function"!=typeof done)return{src:src,width:width,height:height};done(src,width,height)});var outer=document.createElement("div");outer.appendChild(clone);var src=outer.innerHTML;if("function"!=typeof done)return{src:src,width:width,height:height};done(src,width,height)})},out$.svgAsDataUri=function(el,options,done){return requireDomNode(el),out$.prepareSvg(el,options).then(function(_ref4){var src=_ref4.src,width=_ref4.width,height=_ref4.height,svgXml="data:image/svg+xml;base64,"+window.btoa(function(data){return decodeURIComponent(encodeURIComponent(data).replace(/%([0-9A-F]{2})/g,function(match,p1){var c=String.fromCharCode("0x"+p1);return"%"===c?"%25":c}))}('<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [<!ENTITY nbsp "&#160;">]>'+src));return"function"==typeof done&&done(svgXml,width,height),svgXml})},out$.svgAsPngUri=function(el,options,done){requireDomNode(el);var _ref5=options||{},_ref5$encoderType=_ref5.encoderType,encoderType=void 0===_ref5$encoderType?"image/png":_ref5$encoderType,_ref5$encoderOptions=_ref5.encoderOptions,encoderOptions=void 0===_ref5$encoderOptions?.8:_ref5$encoderOptions,canvg=_ref5.canvg,convertToPng=function(_ref6){var src=_ref6.src,width=_ref6.width,height=_ref6.height,canvas=document.createElement("canvas"),context=canvas.getContext("2d"),pixelRatio=window.devicePixelRatio||1;canvas.width=width*pixelRatio,canvas.height=height*pixelRatio,canvas.style.width=canvas.width+"px",canvas.style.height=canvas.height+"px",context.setTransform(pixelRatio,0,0,pixelRatio,0,0),canvg?canvg(canvas,src):context.drawImage(src,0,0);var png=void 0;try{png=canvas.toDataURL(encoderType,encoderOptions)}catch(e){if("undefined"!=typeof SecurityError&&e instanceof SecurityError||"SecurityError"===e.name)return void console.error("Rendered SVG images cannot be downloaded in this browser.");throw e}return"function"==typeof done&&done(png,canvas.width,canvas.height),Promise.resolve(png)};return canvg?out$.prepareSvg(el,options).then(convertToPng):out$.svgAsDataUri(el,options).then(function(uri){return new Promise(function(resolve,reject){var image=new Image;image.onload=function(){return resolve(convertToPng({src:image,width:image.width,height:image.height}))},image.onerror=function(){reject("There was an error loading the data URI as an image on the following SVG\n"+window.atob(uri.slice(26))+"Open the following link to see browser's diagnosis\n"+uri)},image.src=uri})})},out$.download=function(name,uri,options){if(navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(uriToBlob(uri),name);else{var saveLink=document.createElement("a");if("download"in saveLink){saveLink.download=name,saveLink.style.display="none",document.body.appendChild(saveLink);try{var blob=uriToBlob(uri),url=URL.createObjectURL(blob);saveLink.href=url,saveLink.onclick=function(){return requestAnimationFrame(function(){return URL.revokeObjectURL(url)})}}catch(e){console.error(e),console.warn("Error while getting object URL. Falling back to string URL."),saveLink.href=uri}saveLink.click(),document.body.removeChild(saveLink)}else options&&options.popup&&(options.popup.document.title=name,options.popup.location.replace(uri))}},out$.saveSvg=function(el,name,options){var downloadOpts=downloadOptions();return requireDomNodePromise(el).then(function(el){return out$.svgAsDataUri(el,options||{})}).then(function(uri){return out$.download(name,uri,downloadOpts)})},out$.saveSvgAsPng=function(el,name,options){var downloadOpts=downloadOptions();return requireDomNodePromise(el).then(function(el){return out$.svgAsPngUri(el,options||{})}).then(function(uri){return out$.download(name,uri,downloadOpts)})}}()}).saveSvgAsPng,xhtml="http://www.w3.org/1999/xhtml",namespaces={svg:"http://www.w3.org/2000/svg",xhtml:xhtml,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},find=Array.prototype.find,filter=Array.prototype.filter;EnterNode.prototype={constructor:EnterNode,appendChild:function(child){return this._parent.insertBefore(child,this._next)},insertBefore:function(child,next){return this._parent.insertBefore(child,next)},querySelector:function(selector){return this._parent.querySelector(selector)},querySelectorAll:function(selector){return this._parent.querySelectorAll(selector)}},ClassList.prototype={add:function(name){this._names.indexOf(name)<0&&(this._names.push(name),this._node.setAttribute("class",this._names.join(" ")))},remove:function(name){var i=this._names.indexOf(name);i>=0&&(this._names.splice(i,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(name){return this._names.indexOf(name)>=0}};var root=[null];Selection.prototype={constructor:Selection,select:function(select){"function"!=typeof select&&(select=selector(select));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,subnode,group=groups[j],n=group.length,subgroup=subgroups[j]=new Array(n),i=0;i<n;++i)(node=group[i])&&(subnode=select.call(node,node.__data__,i,group))&&("__data__"in node&&(subnode.__data__=node.__data__),subgroup[i]=subnode);return new Selection(subgroups,this._parents)},selectAll:function(select){select="function"==typeof select?function(select){return function(){var group=select.apply(this,arguments);return null==group?[]:array(group)}}(select):function(selector){return null==selector?function(){return[]}:function(){return this.querySelectorAll(selector)}}(select);for(var groups=this._groups,m=groups.length,subgroups=[],parents=[],j=0;j<m;++j)for(var node,group=groups[j],n=group.length,i=0;i<n;++i)(node=group[i])&&(subgroups.push(select.call(node,node.__data__,i,group)),parents.push(node));return new Selection(subgroups,parents)},selectChild:function(match){return this.select(null==match?function(){return this.firstElementChild}:function(match){return function(){return find.call(this.children,match)}}("function"==typeof match?match:childMatcher(match)))},selectChildren:function(match){return this.selectAll(null==match?function(){return this.children}:function(match){return function(){return filter.call(this.children,match)}}("function"==typeof match?match:childMatcher(match)))},filter:function(match){"function"!=typeof match&&(match=function(selector){return function(){return this.matches(selector)}}(match));for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j)for(var node,group=groups[j],n=group.length,subgroup=subgroups[j]=[],i=0;i<n;++i)(node=group[i])&&match.call(node,node.__data__,i,group)&&subgroup.push(node);return new Selection(subgroups,this._parents)},data:function(value,key){if(!arguments.length)return Array.from(this,datum);var bind=key?function(parent,group,enter,update,exit,data,key){var i,node,keyValue,nodeByKeyValue=new Map,groupLength=group.length,dataLength=data.length,keyValues=new Array(groupLength);for(i=0;i<groupLength;++i)(node=group[i])&&(keyValues[i]=keyValue=key.call(node,node.__data__,i,group)+"",nodeByKeyValue.has(keyValue)?exit[i]=node:nodeByKeyValue.set(keyValue,node));for(i=0;i<dataLength;++i)keyValue=key.call(parent,data[i],i,data)+"",(node=nodeByKeyValue.get(keyValue))?(update[i]=node,node.__data__=data[i],nodeByKeyValue.delete(keyValue)):enter[i]=new EnterNode(parent,data[i]);for(i=0;i<groupLength;++i)(node=group[i])&&nodeByKeyValue.get(keyValues[i])===node&&(exit[i]=node)}:function(parent,group,enter,update,exit,data){for(var node,i=0,groupLength=group.length,dataLength=data.length;i<dataLength;++i)(node=group[i])?(node.__data__=data[i],update[i]=node):enter[i]=new EnterNode(parent,data[i]);for(;i<groupLength;++i)(node=group[i])&&(exit[i]=node)},parents=this._parents,groups=this._groups;"function"!=typeof value&&(value=function(x){return function(){return x}}(value));for(var m=groups.length,update=new Array(m),enter=new Array(m),exit=new Array(m),j=0;j<m;++j){var parent=parents[j],group=groups[j],groupLength=group.length,data=array(value.call(parent,parent&&parent.__data__,j,parents)),dataLength=data.length,enterGroup=enter[j]=new Array(dataLength),updateGroup=update[j]=new Array(dataLength);bind(parent,group,enterGroup,updateGroup,exit[j]=new Array(groupLength),data,key);for(var previous,next,i0=0,i1=0;i0<dataLength;++i0)if(previous=enterGroup[i0]){for(i0>=i1&&(i1=i0+1);!(next=updateGroup[i1])&&++i1<dataLength;);previous._next=next||null}}return update=new Selection(update,parents),update._enter=enter,update._exit=exit,update},enter:function(){return new Selection(this._enter||this._groups.map(sparse),this._parents)},exit:function(){return new Selection(this._exit||this._groups.map(sparse),this._parents)},join:function(onenter,onupdate,onexit){var enter=this.enter(),update=this,exit=this.exit();return enter="function"==typeof onenter?onenter(enter):enter.append(onenter+""),null!=onupdate&&(update=onupdate(update)),null==onexit?exit.remove():onexit(exit),enter&&update?enter.merge(update).order():update},merge:function(selection){if(!(selection instanceof Selection))throw new Error("invalid merge");for(var groups0=this._groups,groups1=selection._groups,m0=groups0.length,m1=groups1.length,m=Math.min(m0,m1),merges=new Array(m0),j=0;j<m;++j)for(var node,group0=groups0[j],group1=groups1[j],n=group0.length,merge=merges[j]=new Array(n),i=0;i<n;++i)(node=group0[i]||group1[i])&&(merge[i]=node);for(;j<m0;++j)merges[j]=groups0[j];return new Selection(merges,this._parents)},selection:function(){return this},order:function(){for(var groups=this._groups,j=-1,m=groups.length;++j<m;)for(var node,group=groups[j],i=group.length-1,next=group[i];--i>=0;)(node=group[i])&&(next&&4^node.compareDocumentPosition(next)&&next.parentNode.insertBefore(node,next),next=node);return this},sort:function(compare){function compareNode(a,b){return a&&b?compare(a.__data__,b.__data__):!a-!b}compare||(compare=ascending);for(var groups=this._groups,m=groups.length,sortgroups=new Array(m),j=0;j<m;++j){for(var node,group=groups[j],n=group.length,sortgroup=sortgroups[j]=new Array(n),i=0;i<n;++i)(node=group[i])&&(sortgroup[i]=node);sortgroup.sort(compareNode)}return new Selection(sortgroups,this._parents).order()},call:function(){var callback=arguments[0];return arguments[0]=this,callback.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var groups=this._groups,j=0,m=groups.length;j<m;++j)for(var group=groups[j],i=0,n=group.length;i<n;++i){var node=group[i];if(node)return node}return null},size:function(){let size=0;for(const node of this)++size;return size},empty:function(){return!this.node()},each:function(callback){for(var groups=this._groups,j=0,m=groups.length;j<m;++j)for(var node,group=groups[j],i=0,n=group.length;i<n;++i)(node=group[i])&&callback.call(node,node.__data__,i,group);return this},attr:function(name,value){var fullname=namespace(name);if(arguments.length<2){var node=this.node();return fullname.local?node.getAttributeNS(fullname.space,fullname.local):node.getAttribute(fullname)}return this.each((null==value?fullname.local?function(fullname){return function(){this.removeAttributeNS(fullname.space,fullname.local)}}:function(name){return function(){this.removeAttribute(name)}}:"function"==typeof value?fullname.local?function(fullname,value){return function(){var v=value.apply(this,arguments);null==v?this.removeAttributeNS(fullname.space,fullname.local):this.setAttributeNS(fullname.space,fullname.local,v)}}:function(name,value){return function(){var v=value.apply(this,arguments);null==v?this.removeAttribute(name):this.setAttribute(name,v)}}:fullname.local?function(fullname,value){return function(){this.setAttributeNS(fullname.space,fullname.local,value)}}:function(name,value){return function(){this.setAttribute(name,value)}})(fullname,value))},style:function(name,value,priority){return arguments.length>1?this.each((null==value?function(name){return function(){this.style.removeProperty(name)}}:"function"==typeof value?function(name,value,priority){return function(){var v=value.apply(this,arguments);null==v?this.style.removeProperty(name):this.style.setProperty(name,v,priority)}}:function(name,value,priority){return function(){this.style.setProperty(name,value,priority)}})(name,value,null==priority?"":priority)):function(node,name){return node.style.getPropertyValue(name)||defaultView(node).getComputedStyle(node,null).getPropertyValue(name)}(this.node(),name)},property:function(name,value){return arguments.length>1?this.each((null==value?function(name){return function(){delete this[name]}}:"function"==typeof value?function(name,value){return function(){var v=value.apply(this,arguments);null==v?delete this[name]:this[name]=v}}:function(name,value){return function(){this[name]=value}})(name,value)):this.node()[name]},classed:function(name,value){var names=classArray(name+"");if(arguments.length<2){for(var list=classList(this.node()),i=-1,n=names.length;++i<n;)if(!list.contains(names[i]))return!1;return!0}return this.each(("function"==typeof value?function(names,value){return function(){(value.apply(this,arguments)?classedAdd:classedRemove)(this,names)}}:value?function(names){return function(){classedAdd(this,names)}}:function(names){return function(){classedRemove(this,names)}})(names,value))},text:function(value){return arguments.length?this.each(null==value?function(){this.textContent=""}:("function"==typeof value?function(value){return function(){var v=value.apply(this,arguments);this.textContent=null==v?"":v}}:function(value){return function(){this.textContent=value}})(value)):this.node().textContent},html:function(value){return arguments.length?this.each(null==value?function(){this.innerHTML=""}:("function"==typeof value?function(value){return function(){var v=value.apply(this,arguments);this.innerHTML=null==v?"":v}}:function(value){return function(){this.innerHTML=value}})(value)):this.node().innerHTML},raise:function(){return this.each(raise)},lower:function(){return this.each(lower)},append:function(name){var create="function"==typeof name?name:creator(name);return this.select(function(){return this.appendChild(create.apply(this,arguments))})},insert:function(name,before){var create="function"==typeof name?name:creator(name),select=null==before?function(){return null}:"function"==typeof before?before:selector(before);return this.select(function(){return this.insertBefore(create.apply(this,arguments),select.apply(this,arguments)||null)})},remove:function(){return this.each(remove)},clone:function(deep){return this.select(deep?function(){var clone=this.cloneNode(!0),parent=this.parentNode;return parent?parent.insertBefore(clone,this.nextSibling):clone}:function(){var clone=this.cloneNode(!1),parent=this.parentNode;return parent?parent.insertBefore(clone,this.nextSibling):clone})},datum:function(value){return arguments.length?this.property("__data__",value):this.node().__data__},on:function(typename,value,options){var i,t,typenames=(typename+"").trim().split(/^|\s+/).map(function(t){var name="",i=t.indexOf(".");return i>=0&&(name=t.slice(i+1),t=t.slice(0,i)),{type:t,name:name}}),n=typenames.length;if(!(arguments.length<2)){for(on=value?function(typename,value,options){return function(){var o,on=this.__on,listener=function(listener){return function(event){listener.call(this,event,this.__data__)}}(value);if(on)for(var j=0,m=on.length;j<m;++j)if((o=on[j]).type===typename.type&&o.name===typename.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=listener,o.options=options),void(o.value=value);this.addEventListener(typename.type,listener,options),o={type:typename.type,name:typename.name,value:value,listener:listener,options:options},on?on.push(o):this.__on=[o]}}:function(typename){return function(){var on=this.__on;if(on){for(var o,j=0,i=-1,m=on.length;j<m;++j)o=on[j],typename.type&&o.type!==typename.type||o.name!==typename.name?on[++i]=o:this.removeEventListener(o.type,o.listener,o.options);++i?on.length=i:delete this.__on}}},i=0;i<n;++i)this.each(on(typenames[i],value,options));return this}var on=this.node().__on;if(on)for(var o,j=0,m=on.length;j<m;++j)for(i=0,o=on[j];i<n;++i)if((t=typenames[i]).type===o.type&&t.name===o.name)return o.value},dispatch:function(type,params){return this.each(("function"==typeof params?function(type,params){return function(){return dispatchEvent(this,type,params.apply(this,arguments))}}:function(type,params){return function(){return dispatchEvent(this,type,params)}})(type,params))},[Symbol.iterator]:function*(){for(var groups=this._groups,j=0,m=groups.length;j<m;++j)for(var node,group=groups[j],i=0,n=group.length;i<n;++i)(node=group[i])&&(yield node)}};var classes=[".annotation",".lines",".highlights",".axis path",".axis text",".axis line",".axis",".baseline",".baseline line",".legend",".legend text",".chart-goalposts",".chart-title",".chart-subtitle",".chart-source",".chart-copyright",".chart-watermark",".annotations-holder",".lines highlighlines",".highlights",".annotation",".annotations-holder line",".annotations-holder text",".line path",".highlights rects"],watermarkPath={light:'<path fill="#8e9095" id="logo" d="M3,8.5c0,0.7,0.2,0.9,1.5,0.9v0.4H0V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2h6.1c0.8,0,1.1,0,1.4-0.1l0,2.7H7.2c-0.2-2-0.7-2.2-2.6-2.2H3v4h1.3c1.3,0,1.3-0.2,1.4-1.2h0.4v2.9H5.7c-0.1-1-0.2-1.2-1.4-1.2H3V8.5zM8.4,9.8V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2h4.2v0.4c-0.9,0-1.2,0.1-1.2,0.8v7.1c0,0.8,0.3,0.8,1.2,0.8v0.4H8.4z M22,10l-6.6-8.2v6.7c0,0.8,0.5,0.9,1.5,0.9v0.4h-3.5V9.4c0.9,0,1.4-0.1,1.4-0.9V1.1c-0.4-0.4-0.7-0.5-1.4-0.5V0.2h3.1l5.1,6.5V1.5c0-0.8-0.5-0.9-1.5-0.9V0.2h3.5v0.4c-0.9,0-1.4,0.1-1.4,0.9V10H22z M26.7,9.8h-3.5V9.4c0.9,0,1.3-0.1,1.6-0.9L28,0.1h0.9l3.4,8.5c0.3,0.8,0.4,0.8,1.1,0.8v0.4h-4.1V9.4c1.2,0,1.4-0.1,1.1-0.8l-1-2.6h-3l-0.9,2.5c-0.3,0.8,0.2,0.9,1.2,0.9V9.8z M26.6,5.5h2.6L27.9,2L26.6,5.5z M42.6,10l-6.6-8.2v6.7c0,0.8,0.5,0.9,1.5,0.9v0.4H34V9.4c0.8,0,1.3-0.1,1.3-0.9V1.1c-0.5-0.4-0.8-0.5-1.6-0.5V0.2H37l5.1,6.5V1.5c0-0.8-0.5-0.9-1.5-0.9V0.2h3.5v0.4c-0.9,0-1.4,0.1-1.4,0.9V10H42.6z M52.4,0.1h0.2L52.7,3l-0.4,0c-0.2-1.7-1.1-2.5-2.7-2.5c-1.8,0-3.2,1.5-3.2,3.9c0,3,1.9,4.7,3.9,4.7c0.9,0,1.6-0.2,2.4-1.1L53,8.4c-0.6,0.9-1.8,1.6-3.5,1.6c-2.4,0-4.9-1.8-4.9-4.9c0-3,2.3-5.1,5-5.1c1.3,0,2,0.6,2.3,0.6C52.2,0.6,52.3,0.4,52.4,0.1z M53.8,9.8V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2H58v0.4c-0.9,0-1.2,0.1-1.2,0.8v7.1c0,0.8,0.3,0.8,1.2,0.8v0.4H53.8z M61.9,9.8h-3.3V9.4c0.7,0,1.1-0.1,1.4-0.9l3.2-8.4h0.9l3.4,8.5c0.3,0.8,0.4,0.8,1.1,0.8v0.4h-4.1V9.4c1.2,0,1.4-0.1,1.1-0.8l-1-2.6h-3l-0.9,2.5c-0.3,0.8,0.2,0.9,1.2,0.9V9.8z M61.8,5.5h2.6L63,2L61.8,5.5z M69.3,9.8V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2h4.1v0.4c-0.9,0-1.2,0.1-1.2,0.8v7.2c0,0.6,0.3,0.7,0.8,0.7h0.5c1.9,0,2.5-0.3,3-2.4L77,7l-0.3,2.9H69.3z M89.4,0.1l0,2.9h-0.4c-0.2-2.1-0.7-2.3-2.6-2.3H86v7.9c0,0.8,0.3,0.9,1.5,0.9v0.4h-4.8V9.4c1.2,0,1.5-0.1,1.5-0.9V0.6h-0.6c-1.9,0-2.3,0.3-2.6,2.3h-0.4l0-2.9c0.3,0,0.5,0.1,1.4,0.1h6C88.9,0.2,89.2,0.1,89.4,0.1z M90.4,9.8V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2h4.2v0.4c-0.9,0-1.2,0.1-1.2,0.8v7.1c0,0.8,0.3,0.8,1.2,0.8v0.4H90.4z M107,0.2v0.4c-0.9,0-1.3,0-1.2,0.8l0.8,7.2c0.1,0.7,0.4,0.8,1.2,0.8v0.4h-4.1V9.4c0.9,0,1.2-0.1,1.1-0.8L104,1l-3.1,9h-0.1l-3-9l-0.7,7.5c-0.1,0.8,0.4,0.8,1.3,0.8v0.4h-3.2V9.4c0.9,0,1.2-0.1,1.2-0.8l0.7-7.2c0.1-0.8-0.3-0.8-1.2-0.8V0.2h3.4l2,6.6l2.2-6.6H107z M114.8,6.3h-0.4c-0.1-1-0.2-1.2-1.4-1.2h-1.5v3.5c0,0.6,0.3,0.7,0.8,0.7h0.8c1.9,0,2.5-0.3,3-2.4l0.4,0l-0.3,2.9h-7.6V9.4c0.9,0,1.2-0.1,1.2-0.8V1.4c0-0.8-0.3-0.8-1.2-0.8V0.2h7.3l0,2.4h-0.4c-0.2-1.7-0.7-1.9-2.6-1.9h-1.4v3.9h1.5c1.3,0,1.3-0.2,1.4-1.2h0.4V6.3z M122.5,7.8c0-0.9-0.6-1.3-1.5-1.9l-1.5-0.8c-1.2-0.6-1.8-1.3-1.8-2.5c0-1.5,1.3-2.7,3-2.7c1.2,0,1.8,0.6,2.1,0.6c0.2,0,0.3-0.1,0.4-0.4h0.3l0.1,2.7l-0.4,0c-0.2-1.3-1.1-2.3-2.5-2.3c-1,0-1.7,0.6-1.7,1.4c0,0.9,0.7,1.3,1.5,1.7l1.3,0.7c1.2,0.7,2.1,1.4,2.1,2.7c0,1.7-1.5,2.9-3.3,2.9c-1.3,0-1.9-0.6-2.3-0.6c-0.2,0-0.3,0.2-0.4,0.5h-0.3L117.4,7l0.4,0c0.3,1.8,1.5,2.5,2.8,2.5C121.6,9.5,122.5,9,122.5,7.8z"/>'};exports.frame=chartFrame,exports.printFrame=function(configObject){var f=chartFrame().containerClass("ft-printgraphic").autoPosition(!0).backgroundColor("#FFF").goalposts("#000").units("mm").width(112.25).height(68).margin({top:40,left:15,bottom:35,right:7}).rem(9.6).titleStyle({"font-size":"12px",fill:"#000000","font-weight":"600","font-family":"MetricWeb,sans-serif"}).titleX(7).titleY(15).titleLineHeight(13).subtitleStyle({fill:"#000000","font-size":"9.6px","font-weight":400,"font-family":"MetricWeb,sans-serif"}).subtitleLineHeight(10).subtitleX(7).subtitleY(27).sourceStyle({fill:"#000000","font-size":"7.2px","font-weight":400,"font-family":"MetricWeb,sans-serif"}).sourceX(7).sourcePlotYOffset(18).sourceLineHeight(8);return void 0!==configObject&&f.attrs(configObject),f},exports.socialFrame=function(configObject){var f=chartFrame().autoPosition(!0).containerClass("ft-socialgraphic").backgroundColor("#262a33").whitebar("#fff").width(612).height(612).watermark(watermarkPath.light).watermarkOffsetX(40).watermarkOffsetY(40).margin({left:40,right:40,bottom:138,top:140}).rem(24).titleX(40).titleY(80).titleLineHeight(32).titleStyle({"font-size":"30px",fill:"#ffffff","font-weight":400,"font-family":"MetricWeb,sans-serif"}).subtitleX(40).subtitleY(112).subtitleLineHeight(28).subtitleStyle({"font-size":"24px",fill:"#8e9095","font-weight":400,"font-family":"MetricWeb,sans-serif"}).sourceX(40).sourceLineHeight(20).sourcePlotYOffset(66).sourceStyle({"font-size":"20px",fill:"#8e9095","font-weight":400,"font-family":"MetricWeb,sans-serif"});return void 0!==configObject&&f.attrs(configObject),f},exports.videoFrame=function(configObject){var f=chartFrame().autoPosition(!0).backgroundColor("#262a33").containerClass("ft-videographic").width(1920).height(1080).margin({left:207,right:207,bottom:210,top:233}).rem(48).titleX(207).titleY(130).titleLineHeight(68).titleStyle({"font-size":"72px",fill:"#ffffff","font-weight":400,"font-family":"MetricWeb,sans-serif"}).subtitleX(207).subtitleY(200).subtitleLineHeight(48).subtitleStyle({"font-size":"48px",fill:"#8e9095","font-weight":400,"font-family":"MetricWeb,sans-serif"}).sourceX(207).sourcePlotYOffset(60).sourceLineHeight(38).sourceStyle({"font-size":"36px",fill:"#8e9095","font-weight":400,"font-family":"MetricWeb,sans-serif"});return void 0!==configObject&&f.attrs(configObject),f},exports.webFrameL=function(configObject){var f=chartFrame().autoPosition(!0).containerClass("ft-webgraphic-l").backgroundColor("#FFF1E0").width(1180).height(700).blackbar("#000").fullYear(!0).margin({bottom:105,right:5,left:20}).rem(18).plotAdjuster(8).titleY(32).titleStyle({"font-size":28,"font-family":"MetricWeb,sans-serif","font-weight":400,fill:"#000"}).titleLineHeight(32).subtitleLineHeight(20).subtitleY(64).subtitleStyle({"font-size":18,"font-family":"MetricWeb,sans-serif",fill:"#66605C"}).sourceLineHeight(16).sourcePlotYOffset(44).sourceStyle({"font-size":"16px","font-family":"MetricWeb,sans-serif",fill:"#66605C"}).copyrightStyle({"font-size":"16px","font-style":"italic","font-family":"MetricWeb,sans-serif",fill:"#66605C"});return void 0!==configObject&&f.attrs(configObject),f},exports.webFrameM=function(configObject){var f=chartFrame().autoPosition(!0).containerClass("ft-webgraphic-m").backgroundColor("#FFF1E0").blackbar("#000").width(700).height(500).margin({bottom:104,right:5,left:20}).rem(16).plotAdjuster(4).titleY(32).titleStyle({"font-size":24,"font-family":"MetricWeb,sans-serif","font-weight":400,fill:"#000"}).titleLineHeight(28).subtitleLineHeight(20).subtitleStyle({"font-size":18,"font-family":"MetricWeb,sans-serif",fill:"#66605C"}).subtitleY(64).sourceLineHeight(16).sourcePlotYOffset(44).sourceStyle({"font-size":"14px","font-family":"MetricWeb,sans-serif",fill:"#66605C"}).copyrightStyle({"font-size":"14px","font-style":"italic","font-family":"MetricWeb,sans-serif",fill:"#66605C"});return void 0!==configObject&&f.attrs(configObject),f},exports.webFrameMDefault=function(configObject){var f=chartFrame().autoPosition(!0).containerClass("ft-webgraphic-m-default").backgroundColor("#FFF1E0").blackbar("#000").width(700).height(500).margin({bottom:115,right:5,left:20}).rem(20).plotAdjuster(8).titleY(32).titleStyle({"font-size":28,"font-family":"MetricWeb,sans-serif","font-weight":400,fill:"#000"}).titleLineHeight(28).subtitleLineHeight(28).subtitleStyle({"font-size":24,"font-family":"MetricWeb,sans-serif",fill:"#66605C"}).subtitleY(68).sourceLineHeight(18).sourcePlotYOffset(34).sourceStyle({"font-size":"16px","font-family":"MetricWeb,sans-serif",fill:"#66605C"}).copyrightStyle({"font-size":"14px","font-style":"italic","font-family":"MetricWeb,sans-serif",fill:"#66605C"});return void 0!==configObject&&f.attrs(configObject),f},exports.webFrameS=function(configObject){var f=chartFrame().autoPosition(!0).containerClass("ft-webgraphic-s").backgroundColor("#FFF1E0").blackbar("#000").width(300).margin({bottom:90,right:5,left:15}).rem(14).plotAdjuster(0).titleStyle({"font-size":20,"font-family":"MetricWeb,sans-serif","font-weight":400,fill:"#000"}).titleY(32).titleLineHeight(24).subtitleLineHeight(20).subtitleStyle({"font-size":18,"font-family":"MetricWeb,sans-serif",fill:"#66605C"}).subtitleY(64).sourceLineHeight(12).sourcePlotYOffset(38).sourceStyle({"font-size":"12px","font-family":"MetricWeb,sans-serif",fill:"#66605C"}).copyrightStyle({"font-size":"12px","font-style":"italic","font-family":"MetricWeb,sans-serif",fill:"#66605C"});return void 0!==configObject&&f.attrs(configObject),f},Object.defineProperty(exports,"__esModule",{value:!0})});

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

{"name":"g-chartframe","version":"5.3.2","description":"FT styled frames for D3 graphics","license":"ISC","jsnext:main":"index.js","main":"build/g-chartframe.js","keywords":["dom","visualization","svg","d3"],"repository":{"type":"git","url":"https://github.com/Financial-Times/g-chartframe/"},"scripts":{"watch":"watch 'npm run build' ./src","build":"mkdir -p build && rollup -c && npm run minify","minify":"uglifyjs --compress --minify -- build/g-chartframe.js > build/g-chartframe.min.js","test":"jest --coverage","prepare":"npm run build","report-coverage":"codecov"},"homepage":"https://github.com/Financial-Times/g-chartframe/","contributors":["Ændrew Rininsland <aendrew@aendrew.com> (https://www.aendrew.com)","Bob Haslett","Steve Bernard","Tom Pearson","Anna Leach"],"devDependencies":{"@babel/core":"^7.2.0","@babel/preset-env":"^7.2.0","@babel/register":"^7.0.0","babel-core":"^7.0.0-bridge.0","babel-jest":"^23.6.0","codecov":"^3.0.0","eslint":"^4.11.0","eslint-config-airbnb-base":"^12.1.0","eslint-plugin-import":"^2.8.0","jest":"^23.6.0","jsdom":"^11.6.0","npm-prepublish":"^1.2.3","prettier-eslint":"^8.8.2","rollup":"0.25","rollup-plugin-babel":"^4.1.0","rollup-plugin-commonjs":"^8.2.6","rollup-plugin-node-resolve":"^3.0.0","uglify-es":"^3.1.10","watch":"^0.17.1"},"dependencies":{"d3-selection":"^1.1.0","save-svg-as-png":"^1.2.0"},"babel":{"presets":["@babel/env"]}}
{"name":"g-chartframe","version":"5.3.3","description":"FT styled frames for D3 graphics","license":"ISC","jsnext:main":"index.js","main":"build/g-chartframe.js","module":"build/g-chartframe.mjs","keywords":["dom","visualization","svg","d3"],"repository":{"type":"git","url":"https://github.com/Financial-Times/g-chartframe/"},"scripts":{"watch":"watch 'npm run build' ./src","build":"mkdir -p build && rollup -c && npm run minify","minify":"uglifyjs --compress --minify -- build/g-chartframe.js > build/g-chartframe.min.js","test":"jest --coverage","prepare":"npm run build","report-coverage":"codecov"},"homepage":"https://github.com/Financial-Times/g-chartframe/","contributors":["Ændrew Rininsland <aendrew@aendrew.com> (https://www.aendrew.com)","Bob Haslett","Steve Bernard","Tom Pearson","Anna Leach"],"devDependencies":{"@babel/core":"^7.14.0","@babel/preset-env":"^7.14.1","@babel/register":"^7.13.16","babel-core":"^7.0.0-bridge.0","babel-jest":"^26.6.3","eslint":"^7.26.0","eslint-config-airbnb-base":"^14.2.1","eslint-config-prettier":"^8.3.0","eslint-plugin-import":"^2.22.1","jest":"^26.6.3","jsdom":"^16.5.3","npm-prepublish":"^1.2.3","prettier":"^2.3.0","prettier-eslint":"^12.0.0","rollup":"2.47","rollup-plugin-babel":"^4.1.0","rollup-plugin-commonjs":"^8.2.6","rollup-plugin-node-resolve":"^3.0.0","uglify-es":"^3.1.10","watch":"^1.0.2"},"dependencies":{"d3-selection":"^2.0.0","save-svg-as-png":"^1.4.17"},"babel":{"presets":["@babel/env"]}}

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

# g-chartframe [![codecov](https://codecov.io/gh/financial-times/g-chartframe/branch/master/graph/badge.svg)](https://codecov.io/gh/financial-times/g-chartframe)
# g-chartframe

@@ -7,3 +7,3 @@ For making the boring but necessary stuff on D3 charts in as painless a fashion as possible.

If you use NPM, `npm install g-chartframe`. Otherwise, download the [latest release](https://github.com/ft-interactive/g-chartframe/releases/latest). Or you could include it stright in your page via unpkg (or equiv) https://unpkg.com/g-chartframe@0.3.0/build/g-chartframe.js
If you use NPM, `npm install g-chartframe`. Otherwise, download the [latest release](https://github.com/ft-interactive/g-chartframe/releases/latest). Or you could include it stright in your page via unpkg (or equiv) https://unpkg.com/g-chartframe@0.3.0/build/g-chartframe.js

@@ -29,24 +29,26 @@ ## Use

Configure your own frame...
```js
const myFrame = gChartframe.frame()
.width(350)
.height(350)
.margin({top:20,left:20,bottom:20,right:20,})
.title('My totally custom title')
.subtitle('hello hello hello')
const myFrame = gChartframe
.frame()
.width(350)
.height(350)
.margin({ top: 20, left: 20, bottom: 20, right: 20 })
.title("My totally custom title")
.subtitle("hello hello hello");
d3.select('.custom-chart-container')
.append('svg')
.call(myFrame);
d3.select(".custom-chart-container")
.append("svg")
.call(myFrame);
```
You may also set frame properties en-masse via the `attrs` function. Though note: if you're relying on setting units you should do so before calling `attrs` as you can't guarantee in which order the setters will be called.
You may also set frame properties en-masse via the `attrs` function. Though note: if you're relying on setting units you should do so before calling `attrs` as you can't guarantee in which order the setters will be called.
```js
myFrame.attrs({
title:'A different title',
subtitle:'A different subtitle',
width:600,
title: "A different title",
subtitle: "A different subtitle",
width: 600,
...etc
})
});
```

@@ -61,2 +63,3 @@

Make a new chart frame drawer:
```js

@@ -68,29 +71,38 @@ const myFrame = gChartframe.frame();

e.g.
e.g.
```js
const config = {
title:'The fastest cars in the world',
subtitle:'acceleration m/s<sup>2</sup>',
source:'Guiness book of records',
}
title: "The fastest cars in the world",
subtitle: "acceleration m/s<sup>2</sup>",
source: "Guiness book of records"
};
const myFrame = gChartframe.frame(config);
```
```
Most of the time you won't want to use this though but instead use one of the pre configured chartframe factories...
```js
const myFrame = gChartframe.webFrame(config);
```
or...
```js
const myFrame = gChartframe.printFrame(config);
```
or...
```js
const myFrame = gChartframe.socialFrame(config);
```
or...
```js
const myFrame = gChartframe.videoFrame(config);
```
these provide appropriate positioning, size and fonts for the specified use within the FT (web, print, social media or video)

@@ -111,3 +123,3 @@

```js
myFrame.backgroundColor('#00FF00');
myFrame.backgroundColor("#00FF00");
```

@@ -120,11 +132,13 @@

```js
myFrame.containerClass('special-frame');
myFrame.containerClass("special-frame");
```
would allow you to target the frames contents in your CSS like this...
```css
.special-frame line{
stroke-width:2;
stroke:#00FF00;
stroke-opacity:0.5;
fill:none;
.special-frame line {
stroke-width: 2;
stroke: #00ff00;
stroke-opacity: 0.5;
fill: none;
}

@@ -140,7 +154,5 @@ ```

const dimension = myFrame.dimension(); // e.g. { width: 200 ,height: 550,}
const horizontalScale = d3.linearScale()
.range([0, dimension.width]);
const horizontalScale = d3.linearScale().range([0, dimension.width]);
const verticalScale = d.lineaScale()
.range([dimension.height, 0]);
const verticalScale = d.lineaScale().range([dimension.height, 0]);
```

@@ -178,4 +190,3 @@

```js
myFrame.source('Source:FT Research|Graphic: Pam Ampersand');
myFrame.source("Source:FT Research|Graphic: Pam Ampersand");
```

@@ -241,3 +252,3 @@

<a id="frame-watermarkLocation" href="#frame-watermarkLocation">#</a>frame.**watermarkLocation(_[href]_)**
<a id="frame-watermarkLocation" href="#frame-watermarkLocation">#</a>frame.**watermarkLocation(_[href]_)**

@@ -248,7 +259,5 @@ The user can set a URL for a watermark SVG to be used.

Set the height for the frames container (typically be an SVG).
If no argument is specified returns the current value.
👉 _Note_: If the chart frame is being called on an SVG element the width, height and title functions will re-write those properties of the parent SVG. If you don't want this to happen you can avoid it by calling the function on a group element instead.

@@ -258,2 +267,6 @@

Copyright (c) 2015, 2016, 2017 Financial Times
# Licence
This software is published by the Financial Times under the [MIT licence](https://opensource.org/licenses/MIT).
Please note the MIT licence only covers the software, and does not cover any FT content or branding incorporated into the software or made available using the software. FT content is copyright © The Financial Times Limited, and FT and 'Financial Times' are trademarks of The Financial Times Limited, all rights reserved. For more information about republishing FT content, please contact our [republishing department](https://ft.com/republishing).

@@ -1,13 +0,10 @@

import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import commonjs from "rollup-plugin-commonjs";
import resolve from "rollup-plugin-node-resolve";
import babel from "rollup-plugin-babel";
export default {
entry: 'index.js',
dest: 'build/g-chartframe.js',
format: 'umd',
moduleName: 'gChartframe',
const baseConfig = {
input: "index.js",
plugins: [
babel({
exclude: 'node_modules/**',
exclude: "node_modules/**"
}),

@@ -17,8 +14,30 @@ resolve(),

namedExports: {
'node_modules/save-svg-as-png/saveSvgAsPng.js': [
'saveSvgAsPng',
],
},
}),
"node_modules/save-svg-as-png/lib/saveSvgAsPng.js": [
"saveSvgAsPng"
]
}
})
],
onwarn: function(warning, warn) {
if (warning.code === "CIRCULAR_DEPENDENCY") return;
warn(warning);
}
};
export default [
{
...baseConfig,
output: {
file: "build/g-chartframe.mjs",
format: "es"
}
},
{
...baseConfig,
output: {
file: "build/g-chartframe.js",
format: "umd",
name: "gChartframe"
}
}
];

@@ -1,12 +0,12 @@

import { saveSvgAsPng } from 'save-svg-as-png';
import * as d3 from 'd3-selection';
import { saveSvgAsPng } from "save-svg-as-png";
import * as d3 from "d3-selection";
function chartFrame(configObject) {
let autoPosition = false;
let a11yDesc = 'A graphic by the Financial Times';
let a11yDesc = "A graphic by the Financial Times";
let a11yPlotPresentation = true;
let a11yTitle = 'A chart';
let a11yTitle = "A chart";
let backgroundColor;
let containerClass = 'g-chartframe';
let copyright = '© FT';
let containerClass = "g-chartframe";
let copyright = "© FT";
let copyrightStyle = false;

@@ -23,14 +23,14 @@ let goalposts = false; // goalpost is the bit at the top and bottom of pritn charts

let rem = 18;
let subtitle = 'some supporting information, units perhaps';
let subtitle = "some supporting information, units perhaps";
let subtitleLineHeight = 20;
let subtitleStyle = {};
let source = 'Source: research';
let source = "Source: research";
let sourceLineHeight = 16;
let sourcePlotYOffset = 46;
let sourceStyle = {};
let title = 'Title: A description of the charts purpose';
let title = "Title: A description of the charts purpose";
let titleLineHeight = 32;
let titleStyle = {};
let watermarkLocation = 'icons.svg#ft-logo';
let watermarkMarkup = '';
let watermarkLocation = "icons.svg#ft-logo";
let watermarkMarkup = "";
let watermarkOffsetX = 40;

@@ -40,3 +40,3 @@ let watermarkOffsetY = 0;

let watermarkHeight = 10;
let units = 'px';
let units = "px";

@@ -47,3 +47,3 @@ const margin = {

bottom: 20,
right: 20,
right: 20
};

@@ -59,3 +59,3 @@ const subtitlePosition = { x: 1, y: 67 };

return x;
},
}
};

@@ -66,3 +66,3 @@ const custom = {};

function attributeStyle(parent, style) {
Object.keys(style).forEach((attribute) => {
Object.keys(style).forEach(attribute => {
parent.attr(attribute, style[attribute]);

@@ -74,16 +74,16 @@ });

// overall graphic properties
p.attr('class', containerClass).attr(
'font-family',
'MetricWeb,sans-serif',
p.attr("class", containerClass).attr(
"font-family",
"MetricWeb,sans-serif"
);
p.attr('role', 'img');
p.attr("role", "img");
/* istanbul ignore next This is already well tested. */
if (p.node().nodeName.toLowerCase() === 'svg') {
p.attr('width', graphicWidth)
.attr('height', graphicHeight)
if (p.node().nodeName.toLowerCase() === "svg") {
p.attr("width", graphicWidth)
.attr("height", graphicHeight)
.attr(
'viewBox',
['0 0', graphicWidth, graphicHeight].join(' '),
"viewBox",
["0 0", graphicWidth, graphicHeight].join(" ")
);

@@ -93,8 +93,8 @@

if (a11yTitle !== false || title !== false) {
p.append('title')
p.append("title")
.text(a11yTitle || title)
.attr('id', `${containerClass}__chart-a11y-title`);
.attr("id", `${containerClass}__chart-a11y-title`);
p.attr(
'aria-labelledby',
`${containerClass}__chart-a11y-title`,
"aria-labelledby",
`${containerClass}__chart-a11y-title`
);

@@ -104,12 +104,12 @@ }

if (a11yDesc !== false) {
p.append('desc')
p.append("desc")
.text(a11yDesc)
.attr('id', `${containerClass}__chart-a11y-desc`);
.attr("id", `${containerClass}__chart-a11y-desc`);
p.attr(
'aria-labelledby',
"aria-labelledby",
`${
p.attr('aria-labelledby')
? `${p.attr('aria-labelledby')} `
: ''
}${containerClass}__chart-a11y-desc`,
p.attr("aria-labelledby")
? `${p.attr("aria-labelledby")} `
: ""
}${containerClass}__chart-a11y-desc`
);

@@ -122,73 +122,73 @@ }

backgroundColor !== undefined &&
!p.select('#chart-background').size()
!p.select("#chart-background").size()
) {
// @TODO remove second guard; see #62.
p.append('rect')
.attr('role', 'presentation')
.attr('id', 'chart-background')
.attr('class', 'chart-background')
.attr('x', 0)
.attr('y', 0)
.attr('width', graphicWidth)
.attr('height', graphicHeight)
.attr('fill', backgroundColor);
p.append("rect")
.attr("role", "presentation")
.attr("id", "chart-background")
.attr("class", "chart-background")
.attr("x", 0)
.attr("y", 0)
.attr("width", graphicWidth)
.attr("height", graphicHeight)
.attr("fill", backgroundColor);
}
// 'blackbar' (the short black bar above web graphics) @TODO remove second guard; see #62.
if (blackbar && !p.selectAll('rect.black-bar').size()) {
p.append('rect')
.attr('class', 'black-bar')
.attr('width', 60)
.attr('height', 4)
.style('fill', blackbar);
if (blackbar && !p.selectAll("rect.black-bar").size()) {
p.append("rect")
.attr("class", "black-bar")
.attr("width", 60)
.attr("height", 4)
.style("fill", blackbar);
}
if (whitebar && !p.selectAll('rect.white-bar').size()) {
p.append('rect')
.attr('class', 'white-bar')
.attr('width', 60)
.attr('height', 4)
.style('fill', whitebar)
.attr('transform', `translate(${margin.left},${margin.left})`);
if (whitebar && !p.selectAll("rect.white-bar").size()) {
p.append("rect")
.attr("class", "white-bar")
.attr("width", 60)
.attr("height", 4)
.style("fill", whitebar)
.attr("transform", `translate(${margin.left},${margin.left})`);
}
// 'goalposts' (the bit at the top and the bottom of print charts) @TODO remove second guard; see #62.
if (goalposts && !p.selectAll('path.chart-goalposts').size()) {
if (goalposts && !p.selectAll("path.chart-goalposts").size()) {
const goalpostPaths = [
`M 0, ${graphicHeight} L ${graphicWidth}, ${graphicHeight}`,
`M 0, 15 L 0, 0 L ${graphicWidth}, 0 L ${graphicWidth}, 15`,
`M 0, 15 L 0, 0 L ${graphicWidth}, 0 L ${graphicWidth}, 15`
];
p.append('path')
.attr('class', 'chart-goalposts')
.attr('d', goalpostPaths)
.attr('stroke-width', 0.3)
.attr('fill', 'none')
.attr('stroke', goalposts);
p.append("path")
.attr("class", "chart-goalposts")
.attr("d", goalpostPaths)
.attr("stroke-width", 0.3)
.attr("fill", "none")
.attr("stroke", goalposts);
}
/* istanbul ignore next This is already well tested. */
const titleLineCount = title ? title.split('|').length : 0;
const titleLineCount = title ? title.split("|").length : 0;
/* istanbul ignore next This is already well tested. */
const subtitleLineCount = subtitle ? subtitle.split('|').length : 0;
const subtitleLineCount = subtitle ? subtitle.split("|").length : 0;
/* istanbul ignore next This is already well tested. */
const sourceLineCount = source ? source.split('|').length : 0;
const sourceLineCount = source ? source.split("|").length : 0;
// title; @TODO remove existence guard see #62
if (title && !p.select('text.chart-title').size()) {
p.append('text')
.attr('class', 'chart-title')
.attr('id', `${containerClass}title`)
.call((titleText) => {
if (title && !p.select("text.chart-title").size()) {
p.append("text")
.attr("class", "chart-title")
.attr("id", `${containerClass}title`)
.call(titleText => {
titleText
.selectAll('tspan')
.data(title.split('|'))
.selectAll("tspan")
.data(title.split("|"))
.enter()
.append('tspan')
.append("tspan")
.text(d => d)
.attr(
'y',
(d, i) => titlePosition.y + i * titleLineHeight,
"y",
(d, i) => titlePosition.y + i * titleLineHeight
)
.attr('x', titlePosition.x)
.attr("x", titlePosition.x)
.call(attributeStyle, titleStyle);

@@ -200,16 +200,16 @@ });

/* istanbul ignore next This is already well tested. */
if (subtitle && !p.select('text.chart-subtitle').size()) {
if (subtitle && !p.select("text.chart-subtitle").size()) {
// subtitle
p.append('text')
.attr('id', `${containerClass}subtitle`)
.attr('class', 'chart-subtitle')
.call((subtitleText) => {
p.append("text")
.attr("id", `${containerClass}subtitle`)
.attr("class", "chart-subtitle")
.call(subtitleText => {
subtitleText
.selectAll('tspan')
.data(subtitle.split('|'))
.selectAll("tspan")
.data(subtitle.split("|"))
.enter()
.append('tspan')
.append("tspan")
.text(d => d)
.attr('id', `${containerClass}subtitle`)
.attr('y', (d, i) => {
.attr("id", `${containerClass}subtitle`)
.attr("y", (d, i) => {
if (titleLineCount > 1) {

@@ -225,3 +225,3 @@ return (

.attr('x', subtitlePosition.x)
.attr("x", subtitlePosition.x)
.call(attributeStyle, subtitleStyle);

@@ -233,15 +233,15 @@ });

/* istanbul ignore next This is already well tested. */
if (source && !p.selectAll('text.chart-source').size()) {
p.append('text')
.attr('class', 'chart-source')
.attr('id', `${containerClass}source`)
.call((sourceText) => {
if (source && !p.selectAll("text.chart-source").size()) {
p.append("text")
.attr("class", "chart-source")
.attr("id", `${containerClass}source`)
.call(sourceText => {
sourceText
.selectAll('tspan')
.data(source.split('|'))
.selectAll("tspan")
.data(source.split("|"))
.enter()
.append('tspan')
.append("tspan")
.text(d => d)
.attr('id', `${containerClass}source`)
.attr('y', (d, i) => {
.attr("id", `${containerClass}source`)
.attr("y", (d, i) => {
/* istanbul ignore next I don't know how to test this. */

@@ -258,3 +258,3 @@ if (sourcePosition.y) {

})
.attr('x', sourcePosition.x)
.attr("x", sourcePosition.x)
.call(attributeStyle, sourceStyle);

@@ -265,9 +265,9 @@ });

// copyright
if (copyrightStyle && !p.selectAll('text.chart-copyright').size()) {
p.append('text')
.attr('class', 'chart-copyright')
.append('tspan')
if (copyrightStyle && !p.selectAll("text.chart-copyright").size()) {
p.append("text")
.attr("class", "chart-copyright")
.append("tspan")
.text(copyright)
.attr('x', sourcePosition.x)
.attr('y', () => {
.attr("x", sourcePosition.x)
.attr("y", () => {
/* istanbul ignore next I don't know how to test this. */

@@ -294,5 +294,5 @@ if (sourceLineCount > 1) {

autoPosition &&
(containerClass === 'ft-printgraphic' ||
containerClass === 'ft-socialgraphic' ||
containerClass === 'ft-videographic')
(containerClass === "ft-printgraphic" ||
containerClass === "ft-socialgraphic" ||
containerClass === "ft-videographic")
) {

@@ -316,11 +316,11 @@ margin.top =

watermarkMarkup &&
!p.selectAll('g.chart-watermark').size() &&
p.node().ownerDocument.doctype.name !== 'svg'
!p.selectAll("g.chart-watermark").size() &&
p.node().ownerDocument.doctype.name !== "svg"
) {
p.append('g')
.attr('class', 'chart-watermark')
p.append("g")
.attr("class", "chart-watermark")
.html(watermarkMarkup) // This needs to be .text() to work in pure SVG context
.attr('role', 'presentation')
.attr("role", "presentation")
.attr(
'transform',
"transform",
`translate(${graphicWidth -

@@ -330,3 +330,3 @@ watermarkWidth -

watermarkHeight -
watermarkOffsetY}) scale(1) `,
watermarkOffsetY}) scale(1) `
);

@@ -337,13 +337,13 @@ }

/* istanbul ignore next I don't know how to test this. */
if (!p.selectAll('g.chart-plot').size()) {
plot = p.append('g').attr('class', 'chart-plot');
if (!p.selectAll("g.chart-plot").size()) {
plot = p.append("g").attr("class", "chart-plot");
} else {
plot = p.select('g.chart-plot');
plot = p.select("g.chart-plot");
}
plot.attr('transform', `translate(${margin.left},${margin.top})`);
plot.attr("transform", `translate(${margin.left},${margin.top})`);
/* istanbul ignore next This is already well tested. */
if (a11yPlotPresentation) {
plot.attr('role', 'presentation'); // include this extra role if a11yPlotPresentation
plot.attr("role", "presentation"); // include this extra role if a11yPlotPresentation
}

@@ -354,6 +354,6 @@

showDownloadPngButtons &&
p.node().ownerDocument.doctype.name !== 'svg'
p.node().ownerDocument.doctype.name !== "svg"
) {
let parent;
if (p.node().nodeName.toLowerCase() === 'svg') {
if (p.node().nodeName.toLowerCase() === "svg") {
parent = d3.select(p.node().parentNode);

@@ -365,22 +365,22 @@ } else {

// Prevent this from being rendered twice; @TODO remove check (#62)
if (!parent.selectAll('.button-holder').size()) {
if (!parent.selectAll(".button-holder").size()) {
const holder = parent
.append('div')
.attr('class', 'button-holder');
.append("div")
.attr("class", "button-holder");
holder
.append('button')
.attr('class', 'save-png-button save-png-button__1x')
.text('Save as .png')
.style('float', 'left')
.style('opacity', 0.6)
.on('click', () => savePNG(p, 1));
.append("button")
.attr("class", "save-png-button save-png-button__1x")
.text("Save as .png")
.style("float", "left")
.style("opacity", 0.6)
.on("click", () => savePNG(p, 1));
holder
.append('button')
.attr('class', 'save-png-button save-png-button__2x')
.style('float', 'left')
.style('opacity', 0.6)
.text('Save as double size .png')
.on('click', () => savePNG(p, 2));
.append("button")
.attr("class", "save-png-button save-png-button__2x")
.style("float", "left")
.style("opacity", 0.6)
.text("Save as double size .png")
.on("click", () => savePNG(p, 2));
}

@@ -401,3 +401,3 @@ }

frame.a11yDesc = (x) => {
frame.a11yDesc = x => {
if (x === undefined) return a11yDesc;

@@ -408,3 +408,3 @@ a11yDesc = x;

frame.a11yPlotPresentation = (x) => {
frame.a11yPlotPresentation = x => {
if (x === undefined) return a11yPlotPresentation;

@@ -415,3 +415,3 @@ a11yPlotPresentation = x;

frame.a11yTitle = (x) => {
frame.a11yTitle = x => {
if (x === undefined) return a11yTitle;

@@ -422,3 +422,3 @@ a11yTitle = x;

frame.autoPosition = (x) => {
frame.autoPosition = x => {
if (x === undefined) return autoPosition;

@@ -429,3 +429,3 @@ autoPosition = x;

frame.backgroundColor = (x) => {
frame.backgroundColor = x => {
if (x === undefined) return backgroundColor;

@@ -437,8 +437,10 @@ backgroundColor = x;

frame.backgroundColour = (...args) => {
console.error('gChartframe.backgroundColour() is deprecated and will be removed next version.');
console.error('Please use gChartframe.backgroundColor() instead.');
console.error(
"gChartframe.backgroundColour() is deprecated and will be removed next version."
);
console.error("Please use gChartframe.backgroundColor() instead.");
return frame.backgroundColor(...args);
};
frame.blackbar = (x) => {
frame.blackbar = x => {
if (x === undefined) return blackbar;

@@ -449,3 +451,3 @@ blackbar = x;

frame.containerClass = (x) => {
frame.containerClass = x => {
if (x === undefined) return containerClass;

@@ -456,3 +458,3 @@ containerClass = x;

frame.copyright = (x) => {
frame.copyright = x => {
if (x === undefined) return copyright;

@@ -463,3 +465,3 @@ copyright = x;

frame.copyrightStyle = (x) => {
frame.copyrightStyle = x => {
if (x === undefined) return copyrightStyle;

@@ -472,3 +474,3 @@ copyrightStyle = x;

width: graphicWidth - (margin.left + margin.right),
height: graphicHeight - (margin.top + margin.bottom),
height: graphicHeight - (margin.top + margin.bottom)
});

@@ -478,3 +480,3 @@

custom[key] = value;
frame[key] = (d) => {
frame[key] = d => {
if (d === undefined) return custom[key];

@@ -488,3 +490,3 @@ custom[key] = d;

frame.fullYear = (x) => {
frame.fullYear = x => {
if (x === undefined) return fullYear;

@@ -495,3 +497,3 @@ fullYear = x;

frame.goalposts = (x) => {
frame.goalposts = x => {
if (x === undefined) return goalposts;

@@ -502,3 +504,3 @@ goalposts = x;

frame.height = (x) => {
frame.height = x => {
if (x === undefined) return graphicHeight;

@@ -509,5 +511,5 @@ graphicHeight = convertFrom[units](x);

frame.margin = (x) => {
frame.margin = x => {
if (x === undefined) return margin;
Object.keys(x).forEach((k) => {
Object.keys(x).forEach(k => {
margin[k] = x[k];

@@ -520,3 +522,3 @@ });

frame.plotAdjuster = (x) => {
frame.plotAdjuster = x => {
if (x === undefined) return plotAdjuster;

@@ -527,3 +529,3 @@ plotAdjuster = x;

frame.rem = (x) => {
frame.rem = x => {
if (x === undefined) return rem;

@@ -534,4 +536,4 @@ rem = x;

frame.showDownloadPngButtons = (d) => {
if (typeof d === 'undefined') return showDownloadPngButtons;
frame.showDownloadPngButtons = d => {
if (typeof d === "undefined") return showDownloadPngButtons;
showDownloadPngButtons = d;

@@ -542,3 +544,3 @@

frame.source = (x) => {
frame.source = x => {
if (x === undefined) return source;

@@ -549,3 +551,3 @@ source = x;

frame.sourceLineHeight = (x) => {
frame.sourceLineHeight = x => {
if (x === undefined) return sourceLineHeight;

@@ -556,3 +558,3 @@ sourceLineHeight = x;

frame.sourcePlotYOffset = (x) => {
frame.sourcePlotYOffset = x => {
if (x === undefined) return sourcePlotYOffset;

@@ -563,3 +565,3 @@ sourcePlotYOffset = x;

frame.sourceStyle = (x) => {
frame.sourceStyle = x => {
if (x === undefined) return sourceStyle;

@@ -570,3 +572,3 @@ sourceStyle = x;

frame.sourceX = (x) => {
frame.sourceX = x => {
if (x === undefined) return sourcePosition.x;

@@ -577,3 +579,3 @@ sourcePosition.x = x;

frame.sourceY = (x) => {
frame.sourceY = x => {
if (x === undefined) return sourcePosition.y;

@@ -584,3 +586,3 @@ sourcePosition.y = x;

frame.subtitle = (x) => {
frame.subtitle = x => {
if (x === undefined) return subtitle;

@@ -591,3 +593,3 @@ subtitle = x;

frame.subtitleLineHeight = (x) => {
frame.subtitleLineHeight = x => {
if (x === undefined) return subtitleLineHeight;

@@ -598,3 +600,3 @@ subtitleLineHeight = x;

frame.subtitleStyle = (x) => {
frame.subtitleStyle = x => {
if (x === undefined) return subtitleStyle;

@@ -605,3 +607,3 @@ subtitleStyle = x;

frame.subtitleX = (x) => {
frame.subtitleX = x => {
if (x === undefined) return subtitlePosition.x;

@@ -612,3 +614,3 @@ subtitlePosition.x = x;

frame.subtitleY = (x) => {
frame.subtitleY = x => {
if (x === undefined) return subtitlePosition.y;

@@ -619,3 +621,3 @@ subtitlePosition.y = x;

frame.title = (x) => {
frame.title = x => {
if (x === undefined) return title;

@@ -626,3 +628,3 @@ title = x;

frame.titleStyle = (x) => {
frame.titleStyle = x => {
if (x === undefined) return titleStyle;

@@ -633,3 +635,3 @@ titleStyle = x;

frame.titleLineHeight = (x) => {
frame.titleLineHeight = x => {
if (x === undefined) return titleLineHeight;

@@ -640,3 +642,3 @@ titleLineHeight = x;

frame.titleX = (x) => {
frame.titleX = x => {
if (x === undefined) return titlePosition.x;

@@ -647,3 +649,3 @@ titlePosition.x = x;

frame.titleY = (x) => {
frame.titleY = x => {
if (x === undefined) return titlePosition.y;

@@ -654,3 +656,3 @@ titlePosition.y = x;

frame.units = (x) => {
frame.units = x => {
if (x === undefined) return units;

@@ -661,5 +663,5 @@ units = x;

frame.watermark = (x) => {
frame.watermark = x => {
if (x === undefined) return watermarkMarkup;
watermarkLocation = '';
watermarkLocation = "";
watermarkMarkup = x;

@@ -669,3 +671,3 @@ return frame;

frame.watermarkOffsetY = (x) => {
frame.watermarkOffsetY = x => {
if (x === undefined) return watermarkOffsetY;

@@ -676,3 +678,3 @@ watermarkOffsetY = x;

frame.watermarkOffsetX = (x) => {
frame.watermarkOffsetX = x => {
if (x === undefined) return watermarkOffsetX;

@@ -683,5 +685,5 @@ watermarkOffsetX = x;

frame.watermarkLocation = (x) => {
frame.watermarkLocation = x => {
if (x === undefined) return watermarkLocation;
watermarkMarkup = '';
watermarkMarkup = "";
watermarkLocation = x;

@@ -691,3 +693,3 @@ return frame;

frame.watermarkWidth = (x) => {
frame.watermarkWidth = x => {
if (x === undefined) return watermarkWidth;

@@ -698,3 +700,3 @@ watermarkWidth = x;

frame.watermarkHeight = (x) => {
frame.watermarkHeight = x => {
if (x === undefined) return watermarkHeight;

@@ -705,3 +707,3 @@ watermarkHeight = x;

frame.whitebar = (x) => {
frame.whitebar = x => {
if (x === undefined) return whitebar;

@@ -712,3 +714,3 @@ whitebar = x;

frame.width = (x) => {
frame.width = x => {
if (!x) return graphicWidth;

@@ -719,3 +721,3 @@ graphicWidth = convertFrom[units](x);

frame.attrs = (x) => {
frame.attrs = x => {
if (x === undefined) {

@@ -760,9 +762,9 @@ return Object.assign(

whitebar,
units,
units
},
custom,
custom
);
}
Object.keys(x).forEach((setterName) => {
Object.keys(x).forEach(setterName => {
const value = x[setterName];

@@ -788,3 +790,3 @@ /* istanbul ignore next I don't know why this won't cover. */

functionToCheck &&
getType.toString.call(functionToCheck) === '[object Function]'
getType.toString.call(functionToCheck) === "[object Function]"
);

@@ -794,27 +796,27 @@ }

const classes = [
'.annotation',
'.lines',
'.highlights',
'.axis path',
'.axis text',
'.axis line',
'.axis',
'.baseline',
'.baseline line',
'.legend',
'.legend text',
'.chart-goalposts',
'.chart-title',
'.chart-subtitle',
'.chart-source',
'.chart-copyright',
'.chart-watermark',
'.annotations-holder',
'.lines highlighlines',
'.highlights',
'.annotation',
'.annotations-holder line',
'.annotations-holder text',
'.line path',
'.highlights rects',
".annotation",
".lines",
".highlights",
".axis path",
".axis text",
".axis line",
".axis",
".baseline",
".baseline line",
".legend",
".legend text",
".chart-goalposts",
".chart-title",
".chart-subtitle",
".chart-source",
".chart-copyright",
".chart-watermark",
".annotations-holder",
".lines highlighlines",
".highlights",
".annotation",
".annotations-holder line",
".annotations-holder text",
".line path",
".highlights rects"
];

@@ -824,3 +826,3 @@

function savePNG(svg, scaleFactor) {
svg.selectAll(classes.join(', ')).each(function inlineProps() {
svg.selectAll(classes.join(", ")).each(function inlineProps() {
const element = this;

@@ -840,7 +842,7 @@ const computedStyle = getComputedStyle(element, null);

`${svg
.select('title')
.select("title")
.text()
.replace(/\s/g, '-')
.replace(/\s/g, "-")
.toLowerCase()}.png`,
{ scale: scaleFactor },
{ scale: scaleFactor }
);

@@ -847,0 +849,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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