UNPKG

graphdb-workbench

Version:
2 lines 5.33 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([[41],{112:function(t,e,n){"use strict";n.r(e);n(2),n(7),n(41),n(8),n(216),n(228);angular.module("graphdb.framework.jmx.resources",["toastr","ui.bootstrap","nvd3","graphdb.framework.jmx.resources.controllers","graphdb.framework.core.services.repositories","graphdb.framework.core.directives"])},228:function(t,e){!function(){"use strict";angular.module("nvd3",[]).directive("nvd3",["utils",function(t){return{restrict:"AE",scope:{data:"=",options:"=",api:"=?",events:"=?",config:"=?"},link:function(e,n,i){var a={extended:!1,visible:!0,disabled:!1,autorefresh:!0,refreshDataOnly:!1,deepWatchData:!0,debounce:10};function r(t,n){t&&n&&angular.forEach(t,(function(i,a){void 0===n[a]||null===n[a]?e._config.extended&&(n[a]=i.on):t.on(a+"._",n[a])}))}function o(i){var a=t.deepExtend(function(t){switch(t){case"title":return{enable:!1,text:"Write Your Title",class:"h4",css:{width:e.options.chart.width+"px",textAlign:"center"}};case"subtitle":return{enable:!1,text:"Write Your Subtitle",css:{width:e.options.chart.width+"px",textAlign:"center"}};case"caption":return{enable:!1,text:"Figure 1. Write Your Caption text.",css:{width:e.options.chart.width+"px",textAlign:"center"}}}}(i),e.options[i]||{});e._config.extended&&(e.options[i]=a);var r=angular.element("<div></div>").html(a.html||"").addClass(i).addClass(a.class).removeAttr("style").css(a.css);a.html||r.text(a.text),a.enable&&("title"===i?n.prepend(r):"subtitle"===i?n.find(".title").after(r):"caption"===i&&n.append(r))}e._config=angular.extend(a,e.config),e.api={refresh:function(){e.api.updateWithOptions(e.options)},update:function(){e.chart.update()},updateWithOptions:function(i){e.api.clearElement(),!1!==angular.isDefined(i)&&e._config.visible&&(e.chart=nv.models[i.chart.type](),e.chart.id=Math.random().toString(36).substr(2,15),angular.forEach(e.chart,(function(t,n){["options","_options","_inherited","_d3options","state","id","resizeHandler"].indexOf(n)>=0||("dispatch"===n?(void 0!==i.chart[n]&&null!==i.chart[n]||e._config.extended&&(i.chart[n]={}),r(e.chart[n],i.chart[n])):["lines","lines1","lines2","bars","bars1","bars2","stack1","stack2","stacked","multibar","discretebar","pie","scatter","bullet","sparkline","legend","distX","distY","xAxis","x2Axis","yAxis","yAxis1","yAxis2","y1Axis","y2Axis","y3Axis","y4Axis","interactiveLayer","controls"].indexOf(n)>=0?(void 0!==i.chart[n]&&null!==i.chart[n]||e._config.extended&&(i.chart[n]={}),function(t,n,i){t&&n&&angular.forEach(t,(function(i,a){"dispatch"===a?(void 0!==n[a]&&null!==n[a]||e._config.extended&&(n[a]={}),r(i,n[a])):["scatter","defined","options","axis","rangeBand","rangeBands","_options","_inherited","_d3options","_calls"].indexOf(a)<0&&(void 0===n[a]||null===n[a]?e._config.extended&&(n[a]=i()):t[a](n[a]))}))}(e.chart[n],i.chart[n],i.chart.type)):("xTickFormat"!==n&&"yTickFormat"!==n||"lineWithFocusChart"!==i.chart.type)&&(void 0===i.chart[n]||null===i.chart[n]?e._config.extended&&(i.chart[n]=t()):e.chart[n](i.chart[n])))})),e.api.updateWithData(e.data),(i.title||e._config.extended)&&o("title"),(i.subtitle||e._config.extended)&&o("subtitle"),(i.caption||e._config.extended)&&o("caption"),(i.styles||e._config.extended)&&function(){var i=t.deepExtend({classes:{"with-3d-shadow":!0,"with-transitions":!0,gallery:!1},css:{}},e.options.styles||{});e._config.extended&&(e.options.styles=i);angular.forEach(i.classes,(function(t,e){t?n.addClass(e):n.removeClass(e)})),n.removeAttr("style").css(i.css)}(),nv.addGraph((function(){return e.chart.resizeHandler=nv.utils.windowResize((function(){e.chart.update()})),e.chart}),i.chart.callback))},updateWithData:function(t){t&&(e.options.chart.transitionDuration=+e.options.chart.transitionDuration||250,d3.select(n[0]).select("svg").remove(),d3.select(n[0]).append("svg").attr("height",e.options.chart.height).attr("width",e.options.chart.width||"100%").datum(t).transition().duration(e.options.chart.transitionDuration).call(e.chart))},clearElement:function(){if(n.find(".title").remove(),n.find(".subtitle").remove(),n.find(".caption").remove(),n.empty(),e.chart){e.chart.resizeHandler&&e.chart.resizeHandler.clear();for(var t=0;t<nv.graphs.length;t++)nv.graphs[t].id===e.chart.id&&nv.graphs.splice(t,1)}e.chart=null,nv.tooltip.cleanup()},getScope:function(){return e}},e.$watch("options",t.debounce((function(t){!e._config.disabled&&e._config.autorefresh&&e.api.refresh()}),e._config.debounce,!0),!0),e.$watch("data",(function(t,n){t!==n&&e.chart&&!e._config.disabled&&e._config.autorefresh&&(e._config.refreshDataOnly?e.chart.update():e.api.refresh())}),e._config.deepWatchData),e.$watch("config",(function(t,n){t!==n&&(e._config=angular.extend(a,t),e.api.refresh())}),!0),angular.forEach(e.events,(function(t,n){e.$on(n,(function(n){return t(n,e)}))})),n.on("$destroy",(function(){e.api.clearElement()}))}}}]).factory("utils",(function(){return{debounce:function(t,e,n){var i;return function(){var a=this,r=arguments,o=function(){i=null,n||t.apply(a,r)},c=n&&!i;clearTimeout(i),i=setTimeout(o,e),c&&t.apply(a,r)}},deepExtend:function(t){var e=this;return angular.forEach(arguments,(function(n){n!==t&&angular.forEach(n,(function(n,i){t[i]&&t[i].constructor&&t[i].constructor===Object?e.deepExtend(t[i],n):t[i]=n}))})),t}}}))}()}}]); //# sourceMappingURL=41.e1f4a6d23e7626c8de37.bundle.js.map