ledgerrb/public/app/bower_components/angularjs-nvd3-directives/dist/angularjs-nvd3-directives.min.js

3 lines
64 KiB
JavaScript
Raw Normal View History

2014-07-31 18:00:20 +02:00
!function(){"use strict";function initializeLegendMargin(scope,attrs){var margin=scope.$eval(attrs.legendmargin)||{left:0,top:5,bottom:5,right:0};"object"!=typeof margin&&(margin={left:margin,top:margin,bottom:margin,right:margin}),scope.legendmargin=margin}function configureLegend(chart,scope,attrs){chart.legend&&attrs.showlegend&&"true"===attrs.showlegend&&(initializeLegendMargin(scope,attrs),chart.legend.margin(scope.legendmargin),chart.legend.width(void 0===attrs.legendwidth?400:+attrs.legendwidth),chart.legend.height(void 0===attrs.legendheight?20:+attrs.legendheight),chart.legend.key(void 0===attrs.legendkey?function(d){return d.key}:scope.legendkey()),chart.legend.color(void 0===attrs.legendcolor?nv.utils.defaultColor():scope.legendcolor()),chart.legend.align(void 0===attrs.legendalign?!0:"true"===attrs.legendalign),chart.legend.rightAlign(void 0===attrs.legendrightalign?!0:"true"===attrs.legendrightalign),chart.legend.updateState(void 0===attrs.legendupdatestate?!0:"true"===attrs.legendupdatestate),chart.legend.radioButtonMode(void 0===attrs.legendradiobuttonmode?!1:"true"===attrs.legendradiobuttonmode))}function processEvents(chart,scope){chart.dispatch&&(chart.dispatch.tooltipShow&&chart.dispatch.on("tooltipShow.directive",function(event){scope.$emit("tooltipShow.directive",event)}),chart.dispatch.tooltipHide&&chart.dispatch.on("tooltipHide.directive",function(event){scope.$emit("tooltipHide.directive",event)}),chart.dispatch.beforeUpdate&&chart.dispatch.on("beforeUpdate.directive",function(event){scope.$emit("beforeUpdate.directive",event)}),chart.dispatch.stateChange&&chart.dispatch.on("stateChange.directive",function(event){scope.$emit("stateChange.directive",event)}),chart.dispatch.changeState&&chart.dispatch.on("changeState.directive",function(event){scope.$emit("changeState.directive",event)})),chart.lines&&(chart.lines.dispatch.on("elementMouseover.tooltip.directive",function(event){scope.$emit("elementMouseover.tooltip.directive",event)}),chart.lines.dispatch.on("elementMouseout.tooltip.directive",function(event){scope.$emit("elementMouseout.tooltip.directive",event)}),chart.lines.dispatch.on("elementClick.directive",function(event){scope.$emit("elementClick.directive",event)})),chart.stacked&&chart.stacked.dispatch&&(chart.stacked.dispatch.on("areaClick.toggle.directive",function(event){scope.$emit("areaClick.toggle.directive",event)}),chart.stacked.dispatch.on("tooltipShow.directive",function(event){scope.$emit("tooltipShow.directive",event)}),chart.stacked.dispatch.on("tooltipHide.directive",function(event){scope.$emit("tooltipHide.directive",event)})),chart.interactiveLayer&&(chart.interactiveLayer.elementMouseout&&chart.interactiveLayer.dispatch.on("elementMouseout.directive",function(event){scope.$emit("elementMouseout.directive",event)}),chart.interactiveLayer.elementMousemove&&chart.interactiveLayer.dispatch.on("elementMousemove.directive",function(event){scope.$emit("elementMousemove.directive",event)})),chart.discretebar&&(chart.discretebar.dispatch.on("elementMouseover.tooltip.directive",function(event){scope.$emit("elementMouseover.tooltip.directive",event)}),chart.discretebar.dispatch.on("elementMouseout.tooltip.directive",function(event){scope.$emit("elementMouseover.tooltip.directive",event)}),chart.discretebar.dispatch.on("elementClick.directive",function(event){scope.$emit("elementClick.directive",event)})),chart.multibar&&(chart.multibar.dispatch.on("elementMouseover.tooltip.directive",function(event){scope.$emit("elementMouseover.tooltip.directive",event)}),chart.multibar.dispatch.on("elementMouseout.tooltip.directive",function(event){scope.$emit("elementMouseover.tooltip.directive",event)}),chart.multibar.dispatch.on("elementClick.directive",function(event){scope.$emit("elementClick.directive",event)})),chart.pie&&(chart.pie.dispatch.on("elementMouseover.tooltip.directive",function(event){scope.$emit("elementMouseover.tooltip.directive",event)}),chart.pie.dispatch.on("elementMouseout.tooltip.directive",function(event){scope.$emit("elementMouseover.tooltip.directive",event)}),chart.p
}}],link:function(scope,element,attrs){scope.$watch("data",function(data){if(data){if(scope.chart)return scope.d3Call(data,scope.chart);nv.addGraph({generate:function(){initializeMargin(scope,attrs);var chart=nv.models.multiBarChart().width(scope.width).height(scope.height).margin(scope.margin).x(void 0===attrs.x?function(d){return d[0]}:scope.x()).y(void 0===attrs.y?function(d){return d[1]}:scope.y()).forceY(void 0===attrs.forcey?[0]:scope.$eval(attrs.forcey)).showLegend(void 0===attrs.showlegend?!1:"true"===attrs.showlegend).showControls(void 0===attrs.showcontrols?!1:"true"===attrs.showcontrols).showXAxis(void 0===attrs.showxaxis?!1:"true"===attrs.showxaxis).showYAxis(void 0===attrs.showyaxis?!1:"true"===attrs.showyaxis).tooltips(void 0===attrs.tooltips?!1:"true"===attrs.tooltips).reduceXTicks(void 0===attrs.reducexticks?!1:"true"===attrs.reducexticks).staggerLabels(void 0===attrs.staggerlabels?!1:"true"===attrs.staggerlabels).noData(void 0===attrs.nodata?"No Data Available.":scope.nodata).rotateLabels(void 0===attrs.rotatelabels?0:attrs.rotatelabels).color(void 0===attrs.color?nv.utils.defaultColor():scope.color()).delay(void 0===attrs.delay?1200:attrs.delay).stacked(void 0===attrs.stacked?!1:"true"===attrs.stacked);return attrs.tooltipcontent&&chart.tooltipContent(scope.tooltipcontent()),scope.d3Call(data,chart),nv.utils.windowResize(chart.update),scope.chart=chart,chart},callback:void 0===attrs.callback?null:scope.callback()})}},void 0===attrs.objectequality?!1:"true"===attrs.objectequality)}}}]).directive("nvd3DiscreteBarChart",[function(){return{restrict:"EA",scope:{data:"=",width:"@",height:"@",id:"@",tooltips:"@",showxaxis:"@",showyaxis:"@",tooltipcontent:"&",staggerlabels:"@",color:"&",margin:"&",nodata:"@",x:"&",y:"&",forcey:"@",showvalues:"@",valueformat:"&",callback:"&",xaxisorient:"&",xaxisticks:"&",xaxistickvalues:"&xaxistickvalues",xaxisticksubdivide:"&",xaxisticksize:"&",xaxistickpadding:"&",xaxistickformat:"&",xaxislabel:"@",xaxisscale:"&",xaxisdomain:"&",xaxisrange:"&",xaxisrangeband:"&",xaxisrangebands:"&",xaxisshowmaxmin:"@",xaxishighlightzero:"@",xaxisrotatelabels:"@",xaxisrotateylabel:"@",xaxisstaggerlabels:"@",xaxisaxislabeldistance:"@",yaxisorient:"&",yaxisticks:"&",yaxistickvalues:"&yaxistickvalues",yaxisticksubdivide:"&",yaxisticksize:"&",yaxistickpadding:"&",yaxistickformat:"&",yaxislabel:"@",yaxisscale:"&",yaxisdomain:"&",yaxisrange:"&",yaxisrangeband:"&",yaxisrangebands:"&",yaxisshowmaxmin:"@",yaxishighlightzero:"@",yaxisrotatelabels:"@",yaxisrotateylabel:"@",yaxisstaggerlabels:"@",yaxislabeldistance:"@",legendmargin:"&",legendwidth:"@",legendheight:"@",legendkey:"@",legendcolor:"&",legendalign:"@",legendrightalign:"@",legendupdatestate:"@",legendradiobuttonmode:"@",objectequality:"@",transitionduration:"@"},controller:["$scope","$element","$attrs",function($scope,$element,$attrs){$scope.d3Call=function(data,chart){checkElementID($scope,$attrs,$element,chart,data)}}],link:function(scope,element,attrs){scope.$watch("data",function(data){if(data){if(scope.chart)return scope.d3Call(data,scope.chart);nv.addGraph({generate:function(){initializeMargin(scope,attrs);var chart=nv.models.discreteBarChart().width(scope.width).height(scope.height).margin(scope.margin).x(void 0===attrs.x?function(d){return d[0]}:scope.x()).y(void 0===attrs.y?function(d){return d[1]}:scope.y()).forceY(void 0===attrs.forcey?[0]:scope.$eval(attrs.forcey)).showValues(void 0===attrs.showvalues?!1:"true"===attrs.showvalues).tooltips(void 0===attrs.tooltips?!1:"true"===attrs.tooltips).showXAxis(void 0===attrs.showxaxis?!1:"true"===attrs.showxaxis).showYAxis(void 0===attrs.showyaxis?!1:"true"===attrs.showyaxis).noData(void 0===attrs.nodata?"No Data Available.":scope.nodata).staggerLabels(void 0===attrs.staggerlabels?!1:"true"===attrs.staggerlabels).color(void 0===attrs.color?nv.utils.defaultColor():scope.color());return attrs.tooltipcontent&&chart.tooltipContent(scope.tooltipcontent()),attrs.valueformat&&chart.valueFormat(scope.valueformat()),scope.d3Call(data,chart),nv.utils.windowResize(chart.update),scope.chart=chart,chart}
}).sort(function(a,b){return a[0]<b[0]?-1:a[0]===b[0]?0:1}),scope.bandlineProperties.twentyFithPercentile=d3.quantile(sortedValues,.25),scope.bandlineProperties.median=d3.median(sortedValues),scope.bandlineProperties.seventyFithPercentile=d3.quantile(sortedValues,.75),attrs.xScale&&chart.xScale(scope.xScale()),attrs.yScale&&chart.yScale(scope.yScale()),configureXaxis(chart,scope,attrs),configureYaxis(chart,scope,attrs),processEvents(chart,scope),scope.d3Call(data,chart),nv.utils.windowResize(chart.update),scope.chart=chart,chart},callback:void 0===attrs.callback?null:scope.callback()})}},void 0===attrs.objectequality?!1:"true"===attrs.objectequality)}}}])}();