forked from flrs/visavail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisavail.min.js
1 lines (1 loc) · 19.9 KB
/
visavail.min.js
1
(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.visavail=e()})(this,function(){function t(t,e){function a(t){var e={ddd:"a",dddd:"A",MMM:"b",MMMM:"B",lll:"c",DD:"d",D:"e","YYYY-MM-DD":"F",HH:"H",H:"H",hh:"I",h:"I",DDDD:"j",DDD:"-j",MM:"m",M:"-m",mm:"M",m:"-M",A:"p",a:"P",ss:"S",s:"-S",E:"u",d:"w",WW:"W",ll:"x",LTS:"X",YY:"y",YYYY:"Y",ZZ:"z",z:"Z",SSS:"L","%":"%"},a=t.split(/( |\/|:|,|\]|\[|\.)/),r=a.map(function(t){return":"==t[0]||"/"==t[0]||" "==t[0]||","==t[0]?t:"["!=t[0]&&"]"!=t[0]?e.hasOwnProperty(t)?"%"+e[t]:t.length>0?"["+t+"]":t:void 0}).join("");return r}function r(){return p.LTS.indexOf("a")>-1||p.LTS.indexOf("A")>-1}function n(t){return(o.timeSecond(t)<t?o.timeFormat(l.custom_time_format.format_millisecond):o.timeMinute(t)<t?o.timeFormat(l.custom_time_format.format_second):o.timeHour(t)<t?o.timeFormat(l.custom_time_format.format_minute):o.timeDay(t)<t?o.timeFormat(l.custom_time_format.format_hour):o.timeMonth(t)<t?o.timeWeek(t)<t?o.timeFormat(l.custom_time_format.format_day):o.timeFormat(l.custom_time_format.format_week):o.timeYear(t)<t?o.timeFormat(l.custom_time_format.format_month):o.timeFormat(l.custom_time_format.format_year))(t)}function i(t){t.each(function(e){function a(t){B.select("#vGrid").selectAll("line.vert_grid").data(t.ticks(l.ticks_for_graph)).enter().append("line").attr("x1",function(e){return t(e)}).attr("x2",function(e){return t(e)}).attr("y1",0).attr("y2",l.graph.height*S+l.line_spacing*S-1+l.margin.bottom).attr("class","vert_grid")}function r(t,e,a){x.style("left",function(){return l.width<t+x.property("offsetWidth")+l.tooltip.left_spacing?t-x.property("offsetWidth")-l.tooltip.left_spacing+"px":t+l.tooltip.left_spacing+"px"}),"top"===l.tooltip.position&&(l.width<t+x.property("offsetWidth")+l.tooltip.left_spacing?x.style("border-right","solid thin rgb(0, 0, 0)").style("border-left","none"):x.style("border-left","solid thin rgb(0, 0, 0)").style("border-right","none")),"overlay"===l.tooltip.position&&(document.getElementById(l.id_div_graph).offsetHeight<e+x.property("offsetHeight")?x.style("top",document.getElementById(l.id_div_graph).offsetHeight-x.property("offsetHeight")+"px"):x.style("top",e+"px"))}function i(t){l.tooltip.hover_zoom.enabled&&o.select(t).transition().duration(l.tooltip.duration).attr("x",function(t){return f(t,l.xScale,0)}).attr("width",function(t){return u(t,l.xScale,0)}).attr("y",l.line_spacing).attr("height",l.graph.height).attr("transform",function(t){return h(t,l.xScale,0)}),x.transition().duration(l.tooltip.duration).style("opacity",0)}function d(t,e,a,r,n,i){l.tooltip.hover_zoom.enabled&&o.select(t).transition().duration(l.tooltip.duration).attr("x",function(t){return"rhombus"==l.graph.type||"circle"==l.graph.type?f(t,l.xScale,l.line_spacing*l.tooltip.hover_zoom.ratio*2):f(t,l.xScale,0)}).attr("width",function(t){return"rhombus"==l.graph.type||"circle"==l.graph.type?u(t,l.xScale,l.line_spacing*l.tooltip.hover_zoom.ratio):u(t,l.xScale,0)}).attr("y",l.line_spacing-l.line_spacing*l.tooltip.hover_zoom.ratio/2).attr("height",l.graph.height+l.line_spacing*l.tooltip.hover_zoom.ratio).attr("transform",function(t){return h(t,l.xScale,l.line_spacing*l.tooltip.hover_zoom.ratio)});var d=t.getCTM().translate(t.getAttribute("x"),t.getAttribute("y"));x.transition().duration(l.tooltip.duration).style("opacity",1),x.html(function(){var t="";if(t=l.custom_categories?" "+n[1]+" ":1===n[1]?'<i class=" '+l.icon.class_has_data+' tooltip_has_data"></i>':'<i class=" '+l.icon.class_has_no_data+' tooltip_has_no_data"></i>',l.tooltip.description){var a=e.filter(function(t){return t.disp_data.indexOf(n)>=0})[0];a&&a.description&&a.description[i]&&(t+=" "+a.description[i]+" ")}return l.is_date_only_format&&!l.tooltip.date_plus_time?n[2]>o.timeSecond.offset(n[0],86400)&&!l.tooltip.only_first_date?l.date_is_descending?t+s(n[2]).format("l")+" - "+s(n[0]).format("l"):t+s(n[0]).format("l")+" - "+s(n[2]).format("l"):l.date_is_descending?t+s(n[2]).format("l"):t+s(n[0]).format("l"):l.tooltip.only_first_date?(console.log("entrato nell'esle"),n[2]>o.timeSecond.offset(n[0],86400)||l.tooltip.date_plus_time?l.date_is_descending?t+s(n[2]).format("l")+" "+s(n[2]).format("LTS"):t+s(n[0]).format("l")+" "+s(n[0]).format("LTS"):l.date_is_descending?t+s(n[2]).format("LTS"):t+s(n[0]).format("LTS")):n[2]>o.timeSecond.offset(n[0],86400)||l.tooltip.date_plus_time?l.date_is_descending?t+s(n[2]).format("l")+" "+s(n[2]).format("LTS")+" - "+s(n[0]).format("l")+" "+s(n[0]).format("LTS"):t+s(n[0]).format("l")+" "+s(n[0]).format("LTS")+" - "+s(n[2]).format("l")+" "+s(n[2]).format("LTS"):l.date_is_descending?t+s(n[2]).format("LTS")+" - "+s(n[0]).format("LTS"):t+s(n[0]).format("LTS")+" - "+s(n[2]).format("LTS")}).style("left",function(){return l.width<a+x.property("offsetWidth")+l.tooltip.left_spacing?a-x.property("offsetWidth")-l.tooltip.left_spacing+"px":a+l.tooltip.left_spacing+"px"}),"top"===l.tooltip.position&&(x.style("top",function(){return l.tooltip.hover_zoom.enabled?window.pageYOffset+d.f-l.tooltip.height-l.tooltip.hover_zoom.ratio*l.line_spacing+"px":window.pageYOffset+d.f-l.tooltip.height+"px"}).style("height",function(){return l.tooltip.hover_zoom.enabled?l.tooltip.hover_zoom.ratio*l.line_spacing+l.graph.height+l.tooltip.height+"px":l.graph.height+l.tooltip.height+"px"}),l.width<a+x.property("offsetWidth")+l.tooltip.left_spacing?x.style("border-right","solid thin rgb(0, 0, 0)").style("border-left","none"):x.style("border-left","solid thin rgb(0, 0, 0)").style("border-right","none")),"overlay"===l.tooltip.position&&x.style("top",r+"px")}function c(t){return+t==+new Date(t.getFullYear(),0,1,0,0,0)}function p(t){return+t==+new Date(t.getFullYear(),t.getMonth(),1,0,0,0)}function _(t){var e=t.ticks(l.ticks_for_graph),a=e.map(c),r=e.map(p);l.emphasize_year_ticks&&!a.every(function(t){return!0===t})&&r.every(function(t){return!0===t})&&(o.selectAll("#"+l.id_div_graph+" g.tick").each(function(t,e){a[e]&&o.select(this).attr("class","tick x_tick_emph")}),o.selectAll("#"+l.id_div_graph+" .vert_grid").each(function(t,e){a[e]&&o.select(this).attr("class","vert_grid vert_grid_emph")})),l.emphasize_month_ticks&&!r.every(function(t){return!0===t})&&(o.selectAll("#"+l.id_div_graph+" g.tick").each(function(t,e){r[e]&&o.select(this).attr("class","tick x_tick_emph")}),o.selectAll("#"+l.id_div_graph+" g.vert_grid").each(function(t,e){r[e]&&o.select(this).attr("class","vert_grid vert_grid_emph")}))}function m(){var t=o.event;t&&"zoom"!==t.type||(t.transform.k||t.transform.x)&&(l.xScale=t.transform.rescaleX(A),t.sourceEvent&&"touchmove"==t.sourceEvent?r(t.sourceEvent.touches[0].layerX,t.sourceEvent.touches[0].layerY):t.sourceEvent&&r(t.sourceEvent.layerX,t.sourceEvent.layerY),F.selectAll("rect").attr("x",function(t){return f(t,l.xScale,0)}).attr("width",function(t){return u(t,l.xScale,0)}).attr("transform",function(t){return h(t,l.xScale,0)}),B.select(".xAxis").call(I.scale(l.xScale)),B.select("#vGrid").selectAll("line").remove(),a(l.xScale),_(l.xScale),l.zoom.onZoom.call(this,l.xScale.domain()))}function f(t,e,a){var r=e(t[0])-a;return l.date_is_descending&&(r=e(t[2])-a),isNaN(r)||r<0||r+a>b?0-a/2:"rhombus"==l.graph.type||"circle"==l.graph.type?e(t[0])-l.graph.width/2:r}function u(t,e,a){var r=e(t[0])-a,n=e(t[2])+a;return l.date_is_descending&&(r=e(t[2])-a,n=e(t[0])+a),isNaN(r)||isNaN(n)||!l.date_is_descending&&n-r<0||n<0&&r<0?0:l.date_is_descending&&n-r<0?-1*(n-r):"rhombus"==l.graph.type||"circle"==l.graph.type?r+a<0?0-a:l.graph.width+a:r<0&&n>0?n>b?b:n-a:n<0&&r>0?r>b?b:r-a:n>b?b-r<0?0:b-r+a:n-r}function h(t,e,a){var r=e(t[0]);return("rhombus"==l.graph.type||"circle"==l.graph.type)&&r>0?"rotate(45 "+r+" "+(l.graph.height/2+l.line_spacing-a)+")":("rhombus"==l.graph.type||"circle"==l.graph.type)&&r<=0?"rotate(45 0 "+(l.graph.height/2+l.line_spacing-a)+")":void 0}function g(){return"circle"==l.graph.type?2e5:0}o.timeFormatDefaultLocale(l.locale);var y,v,x=o.select("#"+l.id_div_container).append("div").attr("class","visavail-tooltip "+l.id).attr("id",l.id).append("div").attr("class",l.tooltip.class+"-"+l.tooltip.position).style("opacity",0),b=l.width-l.margin.left-l.margin.right,w=0;0!==l.max_display_datasets?(y=l.cur_display_first_dataset,v=l.cur_display_first_dataset+l.max_display_datasets>e.length?e.length:l.cur_display_first_dataset+l.max_display_datasets,w=Math.ceil(e.length/l.max_display_datasets)):(y=0,v=e.length),t.attr("data-max-pages",w);for(var S=v-y,M=l.graph.height*S+l.line_spacing*S-1,E=0;E<e.length;E++)if(e[E].description&&(l.tooltip.description=!0),null!=e[E].data[0]&&3==e[E].data[0].length){l.defined_blocks=!0,l.custom_categories||Number.isInteger(e[E].data[0][1])||(l.custom_categories=!0);break}if(l.date_in_utc)var k=function(t){return s.utc(t).toDate()},D=function(t){return s.utc(t).toDate()};else k=function(t){return s(t).toDate()},D=function(t){return s(t).toDate()};var z=new RegExp(/^\d{4}-\d{2}-\d{2}$/),Y=new RegExp(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/);e.forEach(function(t){t.data.forEach(function(e){if(!(e[0]instanceof Date)){if(z.test(e[0]))e[0]=k(e[0]);else{if(!Y.test(e[0]))throw new Error("Date/time format not recognized. Pick between 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'.");e[0]=D(e[0]),l.is_date_only_format=!1}l.defined_blocks?z.test(e[2])?e[2]=k(e[2]):Y.test(e[2])?e[2]=D(e[2]):(e[2]=e[0],"rhombus"!=l.graph.type&&console.error("Date/time format not recognized. Pick between 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'.")):e[2]=o.timeSecond.offset(e[0],t.interval_s)}})});var L=s().year(2999),T=s().year(0);e.forEach(function(t,a){var r=[],n=t.data.length;t.data.forEach(function(t,e){s(t[2]).isSameOrAfter(T)&&(T=t[2]),s(t[0]).isSameOrBefore(L)&&(L=t[0]),0!==e&&e<n?t[1]===r[r.length-1][1]?l.defined_blocks?r[r.length-1][2].getTime()===t[0].getTime()?(r[r.length-1][2]=t[2],r[r.length-1][3]=t[1]):r.push(t):(r[r.length-1][2]=t[2],r[r.length-1][3]=t[1]):(l.defined_blocks||(r[r.length-1][2]=t[0]),r.push(t)):0===e&&(t[3]=t[1],r.push(t))}),e[a].disp_data=r}),0!=l.display_date_range[0]&&(L=s(l.display_date_range[0])),0!=l.display_date_range[1]&&(T=s(l.display_date_range[1]));var A=o.scaleTime().domain([L,T]).range([0,b]);l.xScale=A,l.date_is_descending&&A.domain([T,L]);var I=o.axisTop(A).scale(A).ticks(l.ticks_for_graph).tickFormat(n),B=o.select(this).append("svg").attr("width",b+l.margin.left+l.margin.right).attr("height",M+l.margin.top+l.margin.bottom).append("g").attr("transform","translate("+l.margin.left+","+l.margin.top+")");if(B.append("g").attr("id","g_title"),B.append("g").attr("id","g_axis"),l.zoom.enabled&&(l.zoomed=o.zoom().scaleExtent([1,1/0]).translateExtent([[0,0],[b,l.height]]).extent([[0,0],[b,l.height]]).on("start",function(){var t=o.event;t.sourceEvent&&"brush"===t.sourceEvent.type||(t.sourceEvent&&"touchstart"===t.sourceEvent.type&&t.sourceEvent.cancelable&&(event.preventDefault(),event.stopImmediatePropagation()),(t.transform.k||t.transform.x)&&(start_event=t,l.zoom.onZoomStart.call(this,t)))}).on("zoom",m).on("end",function(){var t=o.event;null!=t&&(t.sourceEvent&&"brush"===t.sourceEvent.type||(t.sourceEvent&&"touchend"===t.sourceEvent.type&&t.sourceEvent.cancelable&&(event.preventDefault(),event.stopImmediatePropagation()),t.transform.k||t.transform.x?(l.scale=o.zoomTransform(B.select("#g_data").node()),l.zoom.onZoomEnd.call(this,A.domain())):(t.transform.k=start_event.transform.k,t.transform.x=start_event.transform.x,l.scale=o.zoomTransform(B.select("#g_data").node()),l.zoom.onZoomEnd.call(this,A.domain()))))})),B.append("g").attr("id","g_data").append("rect").attr("id","zoom").attr("width",b).attr("height",M).attr("fill-opacity",0).attr("cursor","ew-resize").attr("x",0).attr("y",0),l.zoom.enabled&&B.select("#g_data").call(l.zoomed),l.show_y_title){function H(){for(var t=o.select(this),e=t.node().getComputedTextLength(),a=t.text();e>-1*l.padding.left+l.reduce_space_wrap&&a.length>0;)a=a.slice(0,-1),t.text(a+"..."),e=t.node().getComputedTextLength()}B.select("#g_axis").append("g").attr("id","yAxis").selectAll("text").data(e.slice(y,v)).enter().append("g").attr("id",function(t,e){return e}).append("title").text(function(t){return t.measure}),B.select("#yAxis").selectAll("g").append("text").attr("x",l.padding.left).attr("y",l.line_spacing+l.graph.height/2).text(function(t){return t.measure||t.measure_html}).each(H).attr("transform",function(t,e){return"translate(0,"+(l.line_spacing+l.graph.height)*e+")"}).attr("class",function(t){var e="ytitle";return null!=t.measure_url&&(e+=" link"),e}).on("click",function(t){return null!=t.measure_url?window.open(t.measure_url):null})}B.select("#g_axis").append("g").attr("id","vGrid"),S&&a(A),B.select("#g_axis").append("g").attr("id","hGrid").selectAll("line.horz_grid").data(e).enter().append("line").attr("x1",0).attr("x2",b).attr("y1",function(t,e){return(l.line_spacing+l.graph.height)*e+l.line_spacing+l.graph.height/2}).attr("y2",function(t,e){return(l.line_spacing+l.graph.height)*e+l.line_spacing+l.graph.height/2}).attr("class","horz_grid"),S&&B.select("#g_axis").append("g").attr("class","xAxis").call(I);var F=B.select("#g_data").selectAll(".g_data").data(e.slice(y,v)).enter().append("g").attr("transform",function(t,e){return"translate(0,"+(l.line_spacing+l.graph.height)*e+")"}).attr("cursor","pointer").attr("class","dataset");if(F.selectAll("rect").data(function(t){return t.disp_data}).enter().append("rect").attr("x",function(t){return f(t,A,0)}).attr("width",function(t){return u(t,A,0)}).attr("y",l.line_spacing).attr("height",l.graph.height).attr("transform",function(t){return h(t,A,0)}).attr("rx",function(t){return g()}).attr("ry",function(t){return g()}).attr("class",function(t){if(!l.custom_categories)return 1===t[1]?"rect_has_data":"rect_has_no_data";var a=e.filter(function(e){return e.disp_data.indexOf(t)>=0})[0];return a&&a.categories?(o.select(this).attr("fill",a.categories[t[1]].color),""):void 0}).on("mouseover",function(t,a){d(this,e,o.event.layerX,o.event.layerY,t,a)}).on("touchstart",function(t,a){d(this,e,o.event.touches[0].layerX,o.event.touches[0].layerY,t,a)}).on("mouseout",function(){i(this)}).on("touchleave",function(){i(this)}).on("touchcancel",function(){i(this)}).on("click",function(t,e){l.onClickBlock.call(this,t,e)}).on("mousemove",function(){r(o.event.layerX,o.event.layerY,this)}).on("touchmove",function(){r(o.event.touches[0].layerX,o.event.touches[0].layerY)}),_(A),l.title.enabled&&B.select("#g_title").append("text").attr("x",l.padding.left).attr("y",l.padding.top).text(l.title.text).attr("class","heading"),l.sub_title.enabled){var W="";S&&(W=l.is_date_only_format?l.sub_title.from_text+" "+s(L).format("MMMM Y")+" "+l.sub_title.to_text+" "+s(T).format("MMMM Y"):l.sub_title.from_text+" "+s(L).format("l")+" "+s(L).format("LTS")+" "+l.sub_title.to_text+" "+s(T).format("l")+" "+s(T).format("LTS")),B.select("#g_title").append("text").attr("x",l.padding.left).attr("y",l.padding.top+l.title.line_spacing).text(W).attr("class","subheading")}if(!l.custom_categories&&l.legend.enabled){var O=B.select("#g_title").append("g").attr("id","g_legend").attr("transform","translate(0,-12)");O.append("rect").attr("x",b+l.margin.right-150).attr("y",l.padding.top).attr("height",15).attr("width",15).attr("class","rect_has_data"),O.append("text").attr("x",b+l.margin.right-150+20).attr("y",l.padding.top+l.legend.line_space-l.legend.offset/2).text(l.legend.has_data_text).attr("class","legend"),O.append("rect").attr("x",b+l.margin.right-150).attr("y",l.padding.top+l.legend.line_space+l.legend.offset).attr("height",15).attr("width",15).attr("class","rect_has_no_data"),O.append("text").attr("x",b+l.margin.right-150+20).attr("y",l.padding.top+2*l.legend.line_space+l.legend.offset/2).text(l.legend.has_no_data_text).attr("class","legend")}l.scale&&B.select("#g_data").call(l.zoomed.transform,o.zoomIdentity.translate(l.scale.x,l.scale.x).scale(l.scale.k))})}var o=window.d3?window.d3:"undefined"!=typeof require?require("d3"):void 0,s=window.moment?window.moment:"undefined"!=typeof require?require("moment"):void 0;if(!o)throw new Error("Require D3.js before visavail script");if(!s)throw new Error("Require moment before visavail script");var l={id:"",id_div_container:"visavail_container",id_div_graph:"example",margin:{top:65,right:40,bottom:20,left:100},width:960,moment_locale:window.navigator.userLanguage||window.navigator.language,reduce_space_wrap:35,line_spacing:26,padding:{top:-49,bottom:0,right:0,left:-100},emphasize_year_ticks:!0,emphasize_month_ticks:!0,ticks_for_graph:6,max_display_datasets:0,cur_display_first_dataset:0,display_date_range:[0,0],custom_categories:!1,is_date_only_format:!0,date_in_utc:!0,date_is_descending:!1,show_y_title:!0,defined_blocks:!1,tooltip:{class:"tooltip",height:11,position:"top",left_spacing:0,date_plus_time:!1,only_first_date:!1,duration:150,hover_zoom:{enabled:!1,ratio:.4}},legend:{enabled:!0,line_space:12,offset:5,has_no_data_text:"No Data available",has_data_text:"Data available"},title:{enabled:!0,text:"Data Availability Plot",line_spacing:16},sub_title:{enabled:!0,from_text:"from",to_text:"to",line_spacing:16},icon:{class_has_data:"fas fa-fw fa-check",class_has_no_data:"fas fa-fw fa-times"},zoom:{enabled:!1,onZoom:function(){},onZoomStart:function(){},onZoomEnd:function(){}},onClickBlock:function(){},graph:{type:"bar",width:20,height:18,hover_zoom:5},responsive:{enabled:!1,onresize:function(){}},custom_time_format:{format_millisecond:".%L",format_second:":%S",format_minute:"%H:%M",format_hour:"%H",format_day:"%a %d",format_week:"%b %d",format_month:"%B",format_year:"%Y"}};if(null!=t)for(var d in t)if(l.hasOwnProperty(d))if("object"==typeof l[d])for(var c in t[d])l[d].hasOwnProperty(c)&&(l[d][c]=t[d][c]);else l[d]=t[d];s.locale(l.moment_locale);var p=s().creationData().locale._longDateFormat;return l.locale={dateTime:a(p.LLLL),date:a(p.L),time:a(p.LTS),periods:["AM","PM"],days:s.weekdays(),shortDays:s.weekdaysShort(),months:s.months(),shortMonths:s.monthsShort()},l.custom_time_format||(l.custom_time_format={format_millisecond:a("SSS"),format_second:a(":ss"),format_minute:a(p.LT),format_hour:a(p.LT.substring(0,1)+(r()?" "+p.LT.slice(-1):"")),format_day:a("ddd DD"),format_week:a("MMM DD"),format_month:a("MMMM"),format_year:a("YYYY")}),t.hasOwnProperty("width")||(l.width=document.getElementById(l.id_div_graph).offsetWidth),l.id="visavail-"+Math.random().toString(36).substring(7),i.width=function(t){return arguments.length?(l.width=t,i):l.width},i.drawTitle=function(t){return arguments.length?(l.title.enabled=t,i):l.title.enabled},i.maxDisplayDatasets=function(t){return arguments.length?(l.max_display_datasets=t,i):l.max_display_datasets},i.curDisplayFirstDataset=function(t){return arguments.length?(l.cur_display_first_dataset=t,i):l.cur_display_first_dataset},i.emphasizeYearTicks=function(t){return arguments.length?(l.emphasize_year_ticks=t,i):l.emphasize_year_ticks},i.displayDateRange=function(t,e){return arguments.length?(l.display_date_range=t,document.getElementById(l.id_div_graph)?i.updateGraph(e):i):l.display_date_range},i.resizeWidth=function(t){return l.width=t,i.updateGraph()},i.updateGraph=function(t){if(document.getElementById(l.id_div_graph)&&""!=document.getElementById(l.id_div_graph).innerHTML){if(document.getElementById(l.id_div_graph).innerHTML="",document.getElementById(l.id)&&document.getElementById(l.id).remove(),t)return i.createGraph(t);o.select("#"+l.id_div_graph).call(i)}return i},i.createGraph=function(t){return o.select("#"+l.id_div_graph).datum(t).call(i),i},i.destroy=function(t){return document.getElementById(l.id_div_graph)&&(document.getElementById(l.id_div_graph).innerHTML=""),document.getElementById(l.id)&&document.getElementById(l.id).remove(),Object.keys(l).forEach(function(t){l[t]=null}),null},l.responsive.function=function(){l.id_div_container&&document.getElementById(l.id_div_graph)&&""!=document.getElementById(l.id_div_graph).innerHTML&&i.resizeWidth(document.getElementById(l.id_div_graph).offsetWidth)},l.responsive.enabled&&window.addEventListener("resize",l.responsive.function),i.createGraph(e),i}var e={};return Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Element.prototype.remove=Element.prototype.remove||function(){this.parentNode&&this.parentNode.removeChild(this)},e.generate=function(e,a){return new t(e,a)},e});