( function ( ) { var nv = window . nv || { } ; nv . version = "1.1.9b" ; nv . dev = true ; window . nv = nv ; nv . tooltip = { } ; nv . utils = { } ; nv . models = { } ; nv . charts = { } ; nv . graphs = [ ] ; nv . logs = { } ; nv . dispatch = d3 . dispatch ( "render_start" , "render_end" ) ; if ( nv . dev ) { nv . dispatch . on ( "render_start" , function ( e ) { nv . logs . startTime = + new Date } ) ; nv . dispatch . on ( "render_end" , function ( e ) { nv . logs . endTime = + new Date ; nv . logs . totalTime = nv . logs . endTime - nv . logs . startTime ; nv . log ( "total" , nv . logs . totalTime ) } ) } nv . log = function ( ) { if ( nv . dev && console . log && console . log . apply ) console . log . apply ( console , arguments ) ; else if ( nv . dev && console . log && Function . prototype . bind ) { var log = Function . prototype . bind . call ( console . log , console ) ; log . apply ( console , arguments ) } return arguments [ arguments . length - 1 ] } ; nv . render = function render ( step ) { step = step || 1 ; nv . render . active = true ; nv . dispatch . render _start ( ) ; setTimeout ( function ( ) { var chart , graph ; for ( var i = 0 ; i < step && ( graph = nv . render . queue [ i ] ) ; i ++ ) { chart = graph . generate ( ) ; if ( typeof graph . callback == typeof Function ) graph . callback ( chart ) ; nv . graphs . push ( chart ) } nv . render . queue . splice ( 0 , i ) ; if ( nv . render . queue . length ) setTimeout ( arguments . callee , 0 ) ; else { nv . render . active = false ; nv . dispatch . render _end ( ) } } , 0 ) } ; nv . render . active = false ; nv . render . queue = [ ] ; nv . addGraph = function ( obj ) { if ( typeof arguments [ 0 ] === typeof Function ) obj = { generate : arguments [ 0 ] , callback : arguments [ 1 ] } ; nv . render . queue . push ( obj ) ; if ( ! nv . render . active ) nv . render ( ) } ; nv . identity = function ( d ) { return d } ; nv . strip = function ( s ) { return s . replace ( /(\s|&)/g , "" ) } ; function daysInMonth ( month , year ) { return new Date ( year , month + 1 , 0 ) . getDate ( ) } function d3 _time _range ( floor , step , number ) { return function ( t0 , t1 , dt ) { var time = floor ( t0 ) , times = [ ] ; if ( time < t0 ) step ( time ) ; if ( dt > 1 ) { while ( time < t1 ) { var date = new Date ( + time ) ; if ( number ( date ) % dt === 0 ) times . push ( date ) ; step ( time ) } } else { while ( time < t1 ) { times . push ( new Date ( + time ) ) ; step ( time ) } } return times } } d3 . time . monthEnd = function ( date ) { return new Date ( date . getFullYear ( ) , date . getMonth ( ) , 0 ) } ; d3 . time . monthEnds = d3 _time _range ( d3 . time . monthEnd , function ( date ) { date . setUTCDate ( date . getUTCDate ( ) + 1 ) ; date . setDate ( daysInMonth ( date . getMonth ( ) + 1 , date . getFullYear ( ) ) ) } , function ( date ) { return date . getMonth ( ) } ) ; nv . interactiveGuideline = function ( ) { "use strict" ; var tooltip = nv . models . tooltip ( ) ; var width = null , height = null , margin = { left : 0 , top : 0 } , xScale = d3 . scale . linear ( ) , yScale = d3 . scale . linear ( ) , dispatch = d3 . dispatch ( "elementMousemove" , "elementMouseout" ) , showGuideLine = true , svgContainer = null ; var isMSIE = navigator . userAgent . indexOf ( "MSIE" ) !== - 1 ; function layer ( selection ) { selection . each ( function ( data ) { var container = d3 . select ( this ) ; var availableWidth = width || 960 , availableHeight = height || 400 ; var wrap = container . selectAll ( "g.nv-wrap.nv-interactiveLineLayer" ) . data ( [ data ] ) ; var wrapEnter = wrap . enter ( ) . append ( "g" ) . attr ( "class" , " nv-wrap nv-interactiveLineLayer" ) ; wrapEnter . append ( "g" ) . attr ( "class" , "nv-interactiveGuideLine" ) ; if ( ! svgContainer ) { return } function mouseHandler ( ) { var d3mouse = d3 . mouse ( this ) ; var mouseX = d3mouse [ 0 ] ; var mouseY = d3mouse [ 1 ] ; var subtractMargin = true ; var mouseOutAnyReason = false ; if ( isMSIE ) { mouseX = d3 . event . offsetX ; mouseY = d3 . event . offsetY ; if ( d3 . event . target . tagName !== "svg" ) subtractMargin = false ; if ( d3 . event . target . className . baseVal . match ( "nv-legend" ) ) mouseOutAnyReason = true } if ( subtractMargin ) { mouseX -= margin . left ; mouseY -= margin . top } if ( mouseX < 0 || mouseY < 0 || mouseX > availableWidth || mouseY > availableHeight || d3 . event . relatedTarget && d3 . event . relatedTarget . ownerSVGElement === undefined || mouseOutAnyReason ) { if ( isMSIE ) { if ( d3 . event . relatedTarget && d3 . event . relatedTarget . ownerSVGElement === undefined && d3 . event . relatedTarget . className . match ( tooltip . nvPointerEventsClass ) ) { return } } dispatch . elementMouseout ( { mouseX : mouseX , mouseY : mouseY } ) ; layer . renderGuideLine ( null ) ; return } var pointXValue = xScale . invert ( mouseX ) ; dispatch . elementMousemove ( { mouseX : mouseX , mouseY : mouseY , pointXValue : pointXValue } ) } svgContainer . on ( "mousemove" , mouseHandler , true ) . on ( "mouseout" , mouseHandler , true ) ; layer . renderGuideLine = function ( x ) { if ( ! showGuideLine ) return ; var line = wrap . select ( ".nv-interactiveGuideLine" ) . selectAll ( "line" ) . data ( x != null ? [ nv . utils . NaNtoZero ( x ) ] : [ ] , String ) ; line . enter ( ) . append ( "line" ) . attr ( "class" , " nv - guide
bullet . width ( availableWidth ) . height ( availableHeight ) ; var bulletWrap = g . select ( ".nv-bulletWrap" ) ; d3 . transition ( bulletWrap ) . call ( bullet ) ; var format = tickFormat || x1 . tickFormat ( availableWidth / 100 ) ; var tick = g . selectAll ( "g.nv-tick" ) . data ( x1 . ticks ( availableWidth / 50 ) , function ( d ) { return this . textContent || format ( d ) } ) ; var tickEnter = tick . enter ( ) . append ( "g" ) . attr ( "class" , "nv-tick" ) . attr ( "transform" , function ( d ) { return "translate(" + x0 ( d ) + ",0)" } ) . style ( "opacity" , 1e-6 ) ; tickEnter . append ( "line" ) . attr ( "y1" , availableHeight ) . attr ( "y2" , availableHeight * 7 / 6 ) ; tickEnter . append ( "text" ) . attr ( "text-anchor" , "middle" ) . attr ( "dy" , "1em" ) . attr ( "y" , availableHeight * 7 / 6 ) . text ( format ) ; var tickUpdate = d3 . transition ( tick ) . attr ( "transform" , function ( d ) { return "translate(" + x1 ( d ) + ",0)" } ) . style ( "opacity" , 1 ) ; tickUpdate . select ( "line" ) . attr ( "y1" , availableHeight ) . attr ( "y2" , availableHeight * 7 / 6 ) ; tickUpdate . select ( "text" ) . attr ( "y" , availableHeight * 7 / 6 ) ; d3 . transition ( tick . exit ( ) ) . attr ( "transform" , function ( d ) { return "translate(" + x1 ( d ) + ",0)" } ) . style ( "opacity" , 1e-6 ) . remove ( ) ; dispatch . on ( "tooltipShow" , function ( e ) { e . key = d . title ; if ( tooltips ) showTooltip ( e , that . parentNode ) } ) } ) ; d3 . timer . flush ( ) ; return chart } bullet . dispatch . on ( "elementMouseover.tooltip" , function ( e ) { dispatch . tooltipShow ( e ) } ) ; bullet . dispatch . on ( "elementMouseout.tooltip" , function ( e ) { dispatch . tooltipHide ( e ) } ) ; dispatch . on ( "tooltipHide" , function ( ) { if ( tooltips ) nv . tooltip . cleanup ( ) } ) ; chart . dispatch = dispatch ; chart . bullet = bullet ; d3 . rebind ( chart , bullet , "color" ) ; chart . orient = function ( x ) { if ( ! arguments . length ) return orient ; orient = x ; reverse = orient == "right" || orient == "bottom" ; return chart } ; chart . ranges = function ( x ) { if ( ! arguments . length ) return ranges ; ranges = x ; return chart } ; chart . markers = function ( x ) { if ( ! arguments . length ) return markers ; markers = x ; return chart } ; chart . measures = function ( x ) { if ( ! arguments . length ) return measures ; measures = x ; return chart } ; chart . width = function ( x ) { if ( ! arguments . length ) return width ; width = x ; return chart } ; chart . height = function ( x ) { if ( ! arguments . length ) return height ; height = x ; return chart } ; chart . margin = function ( _ ) { if ( ! arguments . length ) return margin ; margin . top = typeof _ . top != "undefined" ? _ . top : margin . top ; margin . right = typeof _ . right != "undefined" ? _ . right : margin . right ; margin . bottom = typeof _ . bottom != "undefined" ? _ . bottom : margin . bottom ; margin . left = typeof _ . left != "undefined" ? _ . left : margin . left ; return chart } ; chart . tickFormat = function ( x ) { if ( ! arguments . length ) return tickFormat ; tickFormat = x ; return chart } ; chart . tooltips = function ( _ ) { if ( ! arguments . length ) return tooltips ; tooltips = _ ; return chart } ; chart . tooltipContent = function ( _ ) { if ( ! arguments . length ) return tooltip ; tooltip = _ ; return chart } ; chart . noData = function ( _ ) { if ( ! arguments . length ) return noData ; noData = _ ; return chart } ; return chart } ; nv . models . cumulativeLineChart = function ( ) { "use strict" ; var lines = nv . models . line ( ) , xAxis = nv . models . axis ( ) , yAxis = nv . models . axis ( ) , legend = nv . models . legend ( ) , controls = nv . models . legend ( ) , interactiveLayer = nv . interactiveGuideline ( ) ; var margin = { top : 30 , right : 30 , bottom : 50 , left : 60 } , color = nv . utils . defaultColor ( ) , width = null , height = null , showLegend = true , showXAxis = true , showYAxis = true , rightAlignYAxis = false , tooltips = true , showControls = true , useInteractiveGuideline = false , rescaleY = true , tooltip = function ( key , x , y , e , graph ) { return "<h3>" + key + "</h3>" + "<p>" + y + " at " + x + "</p>" } , x , y , id = lines . id ( ) , state = { index : 0 , rescaleY : rescaleY } , defaultState = null , noData = "No Data Available." , average = function ( d ) { return d . average } , dispatch = d3 . dispatch ( "tooltipShow" , "tooltipHide" , "stateChange" , "changeState" ) ; xAxis . orient ( "bottom" ) . tickPadding ( 7 ) ; yAxis . orient ( rightAlignYAxis ? "right" : "left" ) ; controls . updateState ( false ) ; var dx = d3 . scale . linear ( ) , index = { i : 0 , x : 0 } ; var showTooltip = function ( e , offsetElement ) { var left = e . pos [ 0 ] + ( offsetElement . offsetLeft || 0 ) , top = e . pos [ 1 ] + ( offsetElement . offsetTop || 0 ) , x = xAxis . tickFormat ( ) ( lines . x ( ) ( e . point , e . pointIndex ) ) , y = yAxis . tickFormat ( ) ( lines . y ( ) ( e . point , e . pointIndex ) ) , content = tooltip ( e . series . key , x , y , e , chart ) ; nv . tooltip . show ( [ left , top ] , content , null , null , offsetElement ) } ; function chart ( selection ) { selection . each ( function ( data ) { var container = d3 . select ( this ) . classed ( "nv-chart-" + id , true ) , that = this ; var
} ) ; defsEnter . append ( "clipPath" ) . attr ( "id" , "nv-chart-clip-path-" + id ) . append ( "rect" ) ; wrap . select ( "#nv-chart-clip-path-" + id + " rect" ) . attr ( "width" , availableWidth ) . attr ( "height" , availableHeight ) ; g . attr ( "clip-path" , clipEdge ? "url(#nv-chart-clip-path-" + id + ")" : "" ) ; var bars = wrap . select ( ".nv-bars" ) . selectAll ( ".nv-bar" ) . data ( function ( d ) { return d } , function ( d , i ) { return getX ( d , i ) } ) ; bars . exit ( ) . remove ( ) ; var barsEnter = bars . enter ( ) . append ( "rect" ) . attr ( "x" , 0 ) . attr ( "y" , function ( d , i ) { return nv . utils . NaNtoZero ( y ( Math . max ( 0 , getY ( d , i ) ) ) ) } ) . attr ( "height" , function ( d , i ) { return nv . utils . NaNtoZero ( Math . abs ( y ( getY ( d , i ) ) - y ( 0 ) ) ) } ) . on ( "mouseover" , function ( d , i ) { if ( ! interactive ) return ; d3 . select ( this ) . classed ( "hover" , true ) ; dispatch . elementMouseover ( { point : d , series : data [ 0 ] , pos : [ x ( getX ( d , i ) ) , y ( getY ( d , i ) ) ] , pointIndex : i , seriesIndex : 0 , e : d3 . event } ) } ) . on ( "mouseout" , function ( d , i ) { if ( ! interactive ) return ; d3 . select ( this ) . classed ( "hover" , false ) ; dispatch . elementMouseout ( { point : d , series : data [ 0 ] , pointIndex : i , seriesIndex : 0 , e : d3 . event } ) } ) . on ( "click" , function ( d , i ) { if ( ! interactive ) return ; dispatch . elementClick ( { value : getY ( d , i ) , data : d , index : i , pos : [ x ( getX ( d , i ) ) , y ( getY ( d , i ) ) ] , e : d3 . event , id : id } ) ; d3 . event . stopPropagation ( ) } ) . on ( "dblclick" , function ( d , i ) { if ( ! interactive ) return ; dispatch . elementDblClick ( { value : getY ( d , i ) , data : d , index : i , pos : [ x ( getX ( d , i ) ) , y ( getY ( d , i ) ) ] , e : d3 . event , id : id } ) ; d3 . event . stopPropagation ( ) } ) ; bars . attr ( "fill" , function ( d , i ) { return color ( d , i ) } ) . attr ( "class" , function ( d , i , j ) { return ( getY ( d , i ) < 0 ? "nv-bar negative" : "nv-bar positive" ) + " nv-bar-" + j + "-" + i } ) . attr ( "transform" , function ( d , i ) { return "translate(" + ( x ( getX ( d , i ) ) - availableWidth / data [ 0 ] . values . length * . 45 ) + ",0)" } ) . attr ( "width" , availableWidth / data [ 0 ] . values . length * . 9 ) ; bars . transition ( ) . duration ( transitionDuration ) . attr ( "y" , function ( d , i ) { var rval = getY ( d , i ) < 0 ? y ( 0 ) : y ( 0 ) - y ( getY ( d , i ) ) < 1 ? y ( 0 ) - 1 : y ( getY ( d , i ) ) ; return nv . utils . NaNtoZero ( rval ) } ) . attr ( "height" , function ( d , i ) { return nv . utils . NaNtoZero ( Math . max ( Math . abs ( y ( getY ( d , i ) ) - y ( 0 ) ) , 1 ) ) } ) } ) ; return chart } chart . highlightPoint = function ( pointIndex , isHoverOver ) { d3 . select ( ".nv-historicalBar-" + id ) . select ( ".nv-bars .nv-bar-0-" + pointIndex ) . classed ( "hover" , isHoverOver ) } ; chart . clearHighlights = function ( ) { d3 . select ( ".nv-historicalBar-" + id ) . select ( ".nv-bars .nv-bar.hover" ) . classed ( "hover" , false ) } ; chart . dispatch = dispatch ; chart . x = function ( _ ) { if ( ! arguments . length ) return getX ; getX = _ ; return chart } ; chart . y = function ( _ ) { if ( ! arguments . length ) return getY ; getY = _ ; return chart } ; chart . margin = function ( _ ) { if ( ! arguments . length ) return margin ; margin . top = typeof _ . top != "undefined" ? _ . top : margin . top ; margin . right = typeof _ . right != "undefined" ? _ . right : margin . right ; margin . bottom = typeof _ . bottom != "undefined" ? _ . bottom : margin . bottom ; margin . left = typeof _ . left != "undefined" ? _ . left : margin . left ; return chart } ; chart . width = function ( _ ) { if ( ! arguments . length ) return width ; width = _ ; return chart } ; chart . height = function ( _ ) { if ( ! arguments . length ) return height ; height = _ ; return chart } ; chart . xScale = function ( _ ) { if ( ! arguments . length ) return x ; x = _ ; return chart } ; chart . yScale = function ( _ ) { if ( ! arguments . length ) return y ; y = _ ; return chart } ; chart . xDomain = function ( _ ) { if ( ! arguments . length ) return xDomain ; xDomain = _ ; return chart } ; chart . yDomain = function ( _ ) { if ( ! arguments . length ) return yDomain ; yDomain = _ ; return chart } ; chart . xRange = function ( _ ) { if ( ! arguments . length ) return xRange ; xRange = _ ; return chart } ; chart . yRange = function ( _ ) { if ( ! arguments . length ) return yRange ; yRange = _ ; return chart } ; chart . forceX = function ( _ ) { if ( ! arguments . length ) return forceX ; forceX = _ ; return chart } ; chart . forceY = function ( _ ) { if ( ! arguments . length ) return forceY ; forceY = _ ; return chart } ; chart . padData = function ( _ ) { if ( ! arguments . length ) return padData ; padData = _ ; return chart } ; chart . clipEdge = function ( _ ) { if ( ! arguments . length ) return clipEdge ; clipEdge = _ ; return chart } ; chart . color = function ( _ ) { if ( ! arguments . length ) return color ; color = nv . utils . getColor ( _ ) ; return chart } ; chart . id = function ( _ ) { if ( ! arguments . length ) return id ; id = _ ; return chart } ; chart . interactive = function ( _ ) { if ( ! arguments . length ) return interactive ; interactive = false ; return chart } ; chart . transitionDuration = function ( _ ) { if ( ! arguments . length ) return transitionDuration ; t
interactiveLayer . tooltip . position ( { left : pointXLocation + margin . left , top : e . mouseY + margin . top } ) . chartContainer ( that . parentNode ) . enabled ( tooltips ) . valueFormatter ( function ( d , i ) { return yAxis . tickFormat ( ) ( d ) } ) . data ( { value : xValue , series : allData } ) ( ) ; interactiveLayer . renderGuideLine ( pointXLocation ) } ) ; interactiveLayer . dispatch . on ( "elementMouseout" , function ( e ) { dispatch . tooltipHide ( ) ; lines . clearHighlights ( ) } ) ; dispatch . on ( "tooltipShow" , function ( e ) { if ( tooltips ) showTooltip ( e , that . parentNode ) } ) ; dispatch . on ( "changeState" , function ( e ) { if ( typeof e . disabled !== "undefined" ) { data . forEach ( function ( series , i ) { series . disabled = e . disabled [ i ] } ) ; state . disabled = e . disabled } chart . update ( ) } ) } ) ; return chart } lines . dispatch . on ( "elementMouseover.tooltip" , function ( e ) { e . pos = [ e . pos [ 0 ] + margin . left , e . pos [ 1 ] + margin . top ] ; dispatch . tooltipShow ( e ) } ) ; lines . dispatch . on ( "elementMouseout.tooltip" , function ( e ) { dispatch . tooltipHide ( e ) } ) ; dispatch . on ( "tooltipHide" , function ( ) { if ( tooltips ) nv . tooltip . cleanup ( ) } ) ; chart . dispatch = dispatch ; chart . lines = lines ; chart . legend = legend ; chart . xAxis = xAxis ; chart . yAxis = yAxis ; chart . interactiveLayer = interactiveLayer ; d3 . rebind ( chart , lines , "defined" , "isArea" , "x" , "y" , "size" , "xScale" , "yScale" , "xDomain" , "yDomain" , "xRange" , "yRange" , "forceX" , "forceY" , "interactive" , "clipEdge" , "clipVoronoi" , "useVoronoi" , "id" , "interpolate" ) ; chart . margin = function ( _ ) { if ( ! arguments . length ) return margin ; margin . top = typeof _ . top != "undefined" ? _ . top : margin . top ; margin . right = typeof _ . right != "undefined" ? _ . right : margin . right ; margin . bottom = typeof _ . bottom != "undefined" ? _ . bottom : margin . bottom ; margin . left = typeof _ . left != "undefined" ? _ . left : margin . left ; return chart } ; chart . width = function ( _ ) { if ( ! arguments . length ) return width ; width = _ ; return chart } ; chart . height = function ( _ ) { if ( ! arguments . length ) return height ; height = _ ; return chart } ; chart . color = function ( _ ) { if ( ! arguments . length ) return color ; color = nv . utils . getColor ( _ ) ; legend . color ( color ) ; return chart } ; chart . showLegend = function ( _ ) { if ( ! arguments . length ) return showLegend ; showLegend = _ ; return chart } ; chart . showXAxis = function ( _ ) { if ( ! arguments . length ) return showXAxis ; showXAxis = _ ; return chart } ; chart . showYAxis = function ( _ ) { if ( ! arguments . length ) return showYAxis ; showYAxis = _ ; return chart } ; chart . rightAlignYAxis = function ( _ ) { if ( ! arguments . length ) return rightAlignYAxis ; rightAlignYAxis = _ ; yAxis . orient ( _ ? "right" : "left" ) ; return chart } ; chart . useInteractiveGuideline = function ( _ ) { if ( ! arguments . length ) return useInteractiveGuideline ; useInteractiveGuideline = _ ; if ( _ === true ) { chart . interactive ( false ) ; chart . useVoronoi ( false ) } return chart } ; chart . tooltips = function ( _ ) { if ( ! arguments . length ) return tooltips ; tooltips = _ ; return chart } ; chart . tooltipContent = function ( _ ) { if ( ! arguments . length ) return tooltip ; tooltip = _ ; return chart } ; chart . state = function ( _ ) { if ( ! arguments . length ) return state ; state = _ ; return chart } ; chart . defaultState = function ( _ ) { if ( ! arguments . length ) return defaultState ; defaultState = _ ; return chart } ; chart . noData = function ( _ ) { if ( ! arguments . length ) return noData ; noData = _ ; return chart } ; chart . transitionDuration = function ( _ ) { if ( ! arguments . length ) return lines . transitionDuration ( ) ; lines . transitionDuration ( _ ) ; xAxis . transitionDuration ( _ ) ; yAxis . transitionDuration ( _ ) ; return chart } ; return chart } ; nv . models . linePlusBarChart = function ( ) { "use strict" ; var lines = nv . models . line ( ) , bars = nv . models . historicalBar ( ) , xAxis = nv . models . axis ( ) , y1Axis = nv . models . axis ( ) , y2Axis = nv . models . axis ( ) , legend = nv . models . legend ( ) ; var margin = { top : 30 , right : 60 , bottom : 50 , left : 60 } , width = null , height = null , getX = function ( d ) { return d . x } , getY = function ( d ) { return d . y } , color = nv . utils . defaultColor ( ) , showLegend = true , tooltips = true , tooltip = function ( key , x , y , e , graph ) { return "<h3>" + key + "</h3>" + "<p>" + y + " at " + x + "</p>" } , x , y1 , y2 , state = { } , defaultState = null , noData = "No Data Available." , dispatch = d3 . dispatch ( "tooltipShow" , "tooltipHide" , "stateChange" , "changeState" ) ; bars . padData ( true ) ; lines . clipEdge ( false ) . padData ( true ) ; xAxis . orient ( "bottom" ) . tickPadding ( 7 ) . highlightZero ( false ) ; y1Axis . orient ( "left" ) ; y2Axis . orient ( "right" ) ; var showTooltip = function ( e , offsetElement ) { var left = e . pos [ 0 ] + ( offsetElement . offsetLeft || 0 ) , top = e . pos [ 1 ] + ( offsetElement . offsetTop || 0 ) , x = xAxis . tickFormat
posBase = posBase + f . size } } ) } ) ; var seriesData = xDomain && yDomain ? [ ] : data . map ( function ( d ) { return d . values . map ( function ( d , i ) { return { x : getX ( d , i ) , y : getY ( d , i ) , y0 : d . y0 , y1 : d . y1 } } ) } ) ; x . domain ( xDomain || d3 . merge ( seriesData ) . map ( function ( d ) { return d . x } ) ) . rangeBands ( xRange || [ 0 , availableWidth ] , groupSpacing ) ; y . domain ( yDomain || d3 . extent ( d3 . merge ( seriesData ) . map ( function ( d ) { return stacked ? d . y > 0 ? d . y1 : d . y1 + d . y : d . y } ) . concat ( forceY ) ) ) . range ( yRange || [ availableHeight , 0 ] ) ; if ( x . domain ( ) [ 0 ] === x . domain ( ) [ 1 ] ) x . domain ( ) [ 0 ] ? x . domain ( [ x . domain ( ) [ 0 ] - x . domain ( ) [ 0 ] * . 01 , x . domain ( ) [ 1 ] + x . domain ( ) [ 1 ] * . 01 ] ) : x . domain ( [ - 1 , 1 ] ) ; if ( y . domain ( ) [ 0 ] === y . domain ( ) [ 1 ] ) y . domain ( ) [ 0 ] ? y . domain ( [ y . domain ( ) [ 0 ] + y . domain ( ) [ 0 ] * . 01 , y . domain ( ) [ 1 ] - y . domain ( ) [ 1 ] * . 01 ] ) : y . domain ( [ - 1 , 1 ] ) ; x0 = x0 || x ; y0 = y0 || y ; var wrap = container . selectAll ( "g.nv-wrap.nv-multibar" ) . data ( [ data ] ) ; var wrapEnter = wrap . enter ( ) . append ( "g" ) . attr ( "class" , "nvd3 nv-wrap nv-multibar" ) ; var defsEnter = wrapEnter . append ( "defs" ) ; var gEnter = wrapEnter . append ( "g" ) ; var g = wrap . select ( "g" ) ; gEnter . append ( "g" ) . attr ( "class" , "nv-groups" ) ; wrap . attr ( "transform" , "translate(" + margin . left + "," + margin . top + ")" ) ; defsEnter . append ( "clipPath" ) . attr ( "id" , "nv-edge-clip-" + id ) . append ( "rect" ) ; wrap . select ( "#nv-edge-clip-" + id + " rect" ) . attr ( "width" , availableWidth ) . attr ( "height" , availableHeight ) ; g . attr ( "clip-path" , clipEdge ? "url(#nv-edge-clip-" + id + ")" : "" ) ; var groups = wrap . select ( ".nv-groups" ) . selectAll ( ".nv-group" ) . data ( function ( d ) { return d } , function ( d ) { return d . key } ) ; groups . enter ( ) . append ( "g" ) . style ( "stroke-opacity" , 1e-6 ) . style ( "fill-opacity" , 1e-6 ) ; groups . exit ( ) . transition ( ) . duration ( transitionDuration ) . selectAll ( "rect.nv-bar" ) . delay ( function ( d , i ) { if ( transitionDuration <= 10 ) return 0 ; else return i * delay / data [ 0 ] . values . length } ) . attr ( "y" , function ( d ) { return stacked ? y0 ( d . y0 ) : y0 ( 0 ) } ) . attr ( "height" , 0 ) . remove ( ) ; groups . attr ( "class" , function ( d , i ) { return "nv-group nv-series-" + i } ) . classed ( "hover" , function ( d ) { return d . hover } ) . style ( "fill" , function ( d , i ) { return color ( d , i ) } ) . style ( "stroke" , function ( d , i ) { return color ( d , i ) } ) ; groups . transition ( ) . duration ( transitionDuration ) . style ( "stroke-opacity" , 1 ) . style ( "fill-opacity" , . 75 ) ; var bars = groups . selectAll ( "rect.nv-bar" ) . data ( function ( d ) { return hideable && ! data . length ? hideable . values : d . values } ) ; bars . exit ( ) . remove ( ) ; var barsEnter = bars . enter ( ) . append ( "rect" ) . attr ( "class" , function ( d , i ) { return getY ( d , i ) < 0 ? "nv-bar negative" : "nv-bar positive" } ) . attr ( "x" , function ( d , i , j ) { return stacked ? 0 : j * x . rangeBand ( ) / data . length } ) . attr ( "y" , function ( d ) { return y0 ( stacked ? d . y0 : 0 ) } ) . attr ( "height" , 0 ) . attr ( "width" , x . rangeBand ( ) / ( stacked ? 1 : data . length ) ) ; bars . style ( "fill" , function ( d , i , j ) { return color ( d , j , i ) } ) . style ( "stroke" , function ( d , i , j ) { return color ( d , j , i ) } ) . on ( "mouseover" , function ( d , i ) { d3 . select ( this ) . classed ( "hover" , true ) ; dispatch . elementMouseover ( { value : getY ( d , i ) , point : d , series : data [ d . series ] , pos : [ x ( getX ( d , i ) ) + x . rangeBand ( ) * ( stacked ? data . length / 2 : d . series + . 5 ) / data . length , y ( getY ( d , i ) + ( stacked ? d . y0 : 0 ) ) ] , pointIndex : i , seriesIndex : d . series , e : d3 . event } ) } ) . on ( "mouseout" , function ( d , i ) { d3 . select ( this ) . classed ( "hover" , false ) ; dispatch . elementMouseout ( { value : getY ( d , i ) , point : d , series : data [ d . series ] , pointIndex : i , seriesIndex : d . series , e : d3 . event } ) } ) . on ( "click" , function ( d , i ) { dispatch . elementClick ( { value : getY ( d , i ) , point : d , series : data [ d . series ] , pos : [ x ( getX ( d , i ) ) + x . rangeBand ( ) * ( stacked ? data . length / 2 : d . series + . 5 ) / data . length , y ( getY ( d , i ) + ( stacked ? d . y0 : 0 ) ) ] , pointIndex : i , seriesIndex : d . series , e : d3 . event } ) ; d3 . event . stopPropagation ( ) } ) . on ( "dblclick" , function ( d , i ) { dispatch . elementDblClick ( { value : getY ( d , i ) , point : d , series : data [ d . series ] , pos : [ x ( getX ( d , i ) ) + x . rangeBand ( ) * ( stacked ? data . length / 2 : d . series + . 5 ) / data . length , y ( getY ( d , i ) + ( stacked ? d . y0 : 0 ) ) ] , pointIndex : i , seriesIndex : d . series , e : d3 . event } ) ; d3 . event . stopPropagation ( ) } ) ; bars . attr ( "class" , function ( d , i ) { return getY ( d , i ) < 0 ? "nv-bar negative" : "nv-bar positive" } ) . attr ( "transform" , function ( d , i ) { return "translate(" + x ( getX ( d , i ) ) + ",0)" } ) ; if ( barColor ) { if ( ! disabled ) disabled = data . map ( function ( ) { return true } ) ; bars . style ( "fill" , function ( d , i , j ) { return d3 . rgb ( barColor ( d , i ) ) . darker ( disabled . map ( function ( d , i ) { return i } ) . filter ( function ( d , i ) { return ! disabled [ i ] } )
var showTooltip = function ( e , offsetElement ) { var left = e . pos [ 0 ] + ( offsetElement . offsetLeft || 0 ) , top = e . pos [ 1 ] + ( offsetElement . offsetTop || 0 ) , x = xAxis . tickFormat ( ) ( lines1 . x ( ) ( e . point , e . pointIndex ) ) , y = ( e . series . yAxis == 2 ? yAxis2 : yAxis1 ) . tickFormat ( ) ( lines1 . y ( ) ( e . point , e . pointIndex ) ) , content = tooltip ( e . series . key , x , y , e , chart ) ; nv . tooltip . show ( [ left , top ] , content , undefined , undefined , offsetElement . offsetParent ) } ; function chart ( selection ) { selection . each ( function ( data ) { var container = d3 . select ( this ) , that = this ; chart . update = function ( ) { container . transition ( ) . call ( chart ) } ; chart . container = this ; var availableWidth = ( width || parseInt ( container . style ( "width" ) ) || 960 ) - margin . left - margin . right , availableHeight = ( height || parseInt ( container . style ( "height" ) ) || 400 ) - margin . top - margin . bottom ; var dataLines1 = data . filter ( function ( d ) { return ! d . disabled && d . type == "line" && d . yAxis == 1 } ) ; var dataLines2 = data . filter ( function ( d ) { return ! d . disabled && d . type == "line" && d . yAxis == 2 } ) ; var dataBars1 = data . filter ( function ( d ) { return ! d . disabled && d . type == "bar" && d . yAxis == 1 } ) ; var dataBars2 = data . filter ( function ( d ) { return ! d . disabled && d . type == "bar" && d . yAxis == 2 } ) ; var dataStack1 = data . filter ( function ( d ) { return ! d . disabled && d . type == "area" && d . yAxis == 1 } ) ; var dataStack2 = data . filter ( function ( d ) { return ! d . disabled && d . type == "area" && d . yAxis == 2 } ) ; var series1 = data . filter ( function ( d ) { return ! d . disabled && d . yAxis == 1 } ) . map ( function ( d ) { return d . values . map ( function ( d , i ) { return { x : d . x , y : d . y } } ) } ) ; var series2 = data . filter ( function ( d ) { return ! d . disabled && d . yAxis == 2 } ) . map ( function ( d ) { return d . values . map ( function ( d , i ) { return { x : d . x , y : d . y } } ) } ) ; x . domain ( d3 . extent ( d3 . merge ( series1 . concat ( series2 ) ) , function ( d ) { return d . x } ) ) . range ( [ 0 , availableWidth ] ) ; var wrap = container . selectAll ( "g.wrap.multiChart" ) . data ( [ data ] ) ; var gEnter = wrap . enter ( ) . append ( "g" ) . attr ( "class" , "wrap nvd3 multiChart" ) . append ( "g" ) ; gEnter . append ( "g" ) . attr ( "class" , "x axis" ) ; gEnter . append ( "g" ) . attr ( "class" , "y1 axis" ) ; gEnter . append ( "g" ) . attr ( "class" , "y2 axis" ) ; gEnter . append ( "g" ) . attr ( "class" , "lines1Wrap" ) ; gEnter . append ( "g" ) . attr ( "class" , "lines2Wrap" ) ; gEnter . append ( "g" ) . attr ( "class" , "bars1Wrap" ) ; gEnter . append ( "g" ) . attr ( "class" , "bars2Wrap" ) ; gEnter . append ( "g" ) . attr ( "class" , "stack1Wrap" ) ; gEnter . append ( "g" ) . attr ( "class" , "stack2Wrap" ) ; gEnter . append ( "g" ) . attr ( "class" , "legendWrap" ) ; var g = wrap . select ( "g" ) ; if ( showLegend ) { legend . width ( availableWidth / 2 ) ; g . select ( ".legendWrap" ) . datum ( data . map ( function ( series ) { series . originalKey = series . originalKey === undefined ? series . key : series . originalKey ; series . key = series . originalKey + ( series . yAxis == 1 ? "" : " (right axis)" ) ; return series } ) ) . call ( legend ) ; if ( margin . top != legend . height ( ) ) { margin . top = legend . height ( ) ; availableHeight = ( height || parseInt ( container . style ( "height" ) ) || 400 ) - margin . top - margin . bottom } g . select ( ".legendWrap" ) . attr ( "transform" , "translate(" + availableWidth / 2 + "," + - margin . top + ")" ) } lines1 . width ( availableWidth ) . height ( availableHeight ) . interpolate ( "monotone" ) . color ( data . map ( function ( d , i ) { return d . color || color [ i % color . length ] } ) . filter ( function ( d , i ) { return ! data [ i ] . disabled && data [ i ] . yAxis == 1 && data [ i ] . type == "line" } ) ) ; lines2 . width ( availableWidth ) . height ( availableHeight ) . interpolate ( "monotone" ) . color ( data . map ( function ( d , i ) { return d . color || color [ i % color . length ] } ) . filter ( function ( d , i ) { return ! data [ i ] . disabled && data [ i ] . yAxis == 2 && data [ i ] . type == "line" } ) ) ; bars1 . width ( availableWidth ) . height ( availableHeight ) . color ( data . map ( function ( d , i ) { return d . color || color [ i % color . length ] } ) . filter ( function ( d , i ) { return ! data [ i ] . disabled && data [ i ] . yAxis == 1 && data [ i ] . type == "bar" } ) ) ; bars2 . width ( availableWidth ) . height ( availableHeight ) . color ( data . map ( function ( d , i ) { return d . color || color [ i % color . length ] } ) . filter ( function ( d , i ) { return ! data [ i ] . disabled && data [ i ] . yAxis == 2 && data [ i ] . type == "bar" } ) ) ; stack1 . width ( availableWidth ) . height ( availableHeight ) . color ( data . map ( function ( d , i ) { return d . color || color [ i % color . length ] } ) . filter ( function ( d , i ) { return ! data [ i ] . disabled && data [ i ] . yAxis == 1 && data [ i ] . type == "area" } ) ) ; stack2 . width ( availableWidth ) . height ( availableHeight ) . color ( data . map ( function ( d , i ) { return d . color || color [ i % color . length ] } ) . filter ( function ( d , i ) { return ! data [ i ] . disabled && data [ i ] . yAxis == 2 && data [ i ] . t
pointPaths . enter ( ) . append ( "path" ) . attr ( "class" , function ( d , i ) { return "nv-path-" + i } ) ; pointPaths . exit ( ) . remove ( ) ; pointPaths . attr ( "d" , function ( d ) { if ( d . data . length === 0 ) return "M 0 0" ; else return "M" + d . data . join ( "L" ) + "Z" } ) ; var mouseEventCallback = function ( d , mDispatch ) { if ( needsUpdate ) return 0 ; var series = data [ d . series ] ; if ( typeof series === "undefined" ) return ; var point = series . values [ d . point ] ; mDispatch ( { point : point , series : series , pos : [ x ( getX ( point , d . point ) ) + margin . left , y ( getY ( point , d . point ) ) + margin . top ] , seriesIndex : d . series , pointIndex : d . point } ) } ; pointPaths . on ( "click" , function ( d ) { mouseEventCallback ( d , dispatch . elementClick ) } ) . on ( "mouseover" , function ( d ) { mouseEventCallback ( d , dispatch . elementMouseover ) } ) . on ( "mouseout" , function ( d , i ) { mouseEventCallback ( d , dispatch . elementMouseout ) } ) } else { wrap . select ( ".nv-groups" ) . selectAll ( ".nv-group" ) . selectAll ( ".nv-point" ) . on ( "click" , function ( d , i ) { if ( needsUpdate || ! data [ d . series ] ) return 0 ; var series = data [ d . series ] , point = series . values [ i ] ; dispatch . elementClick ( { point : point , series : series , pos : [ x ( getX ( point , i ) ) + margin . left , y ( getY ( point , i ) ) + margin . top ] , seriesIndex : d . series , pointIndex : i } ) } ) . on ( "mouseover" , function ( d , i ) { if ( needsUpdate || ! data [ d . series ] ) return 0 ; var series = data [ d . series ] , point = series . values [ i ] ; dispatch . elementMouseover ( { point : point , series : series , pos : [ x ( getX ( point , i ) ) + margin . left , y ( getY ( point , i ) ) + margin . top ] , seriesIndex : d . series , pointIndex : i } ) } ) . on ( "mouseout" , function ( d , i ) { if ( needsUpdate || ! data [ d . series ] ) return 0 ; var series = data [ d . series ] , point = series . values [ i ] ; dispatch . elementMouseout ( { point : point , series : series , seriesIndex : d . series , pointIndex : i } ) } ) } needsUpdate = false } needsUpdate = true ; var groups = wrap . select ( ".nv-groups" ) . selectAll ( ".nv-group" ) . data ( function ( d ) { return d } , function ( d ) { return d . key } ) ; groups . enter ( ) . append ( "g" ) . style ( "stroke-opacity" , 1e-6 ) . style ( "fill-opacity" , 1e-6 ) ; groups . exit ( ) . transition ( ) . duration ( transitionDuration ) . style ( "stroke-opacity" , 1e-6 ) . style ( "fill-opacity" , 1e-6 ) . remove ( ) ; groups . attr ( "class" , function ( d , i ) { return "nv-group nv-series-" + i } ) . classed ( "hover" , function ( d ) { return d . hover } ) ; groups . transition ( ) . duration ( transitionDuration ) . style ( "fill" , function ( d , i ) { return color ( d , i ) } ) . style ( "stroke" , function ( d , i ) { return color ( d , i ) } ) . style ( "stroke-opacity" , 1 ) . style ( "fill-opacity" , . 5 ) ; if ( onlyCircles ) { var points = groups . selectAll ( "circle.nv-point" ) . data ( function ( d ) { return d . values } , pointKey ) ; points . enter ( ) . append ( "circle" ) . style ( "fill" , function ( d , i ) { return d . color } ) . style ( "stroke" , function ( d , i ) { return d . color } ) . attr ( "cx" , function ( d , i ) { return nv . utils . NaNtoZero ( x0 ( getX ( d , i ) ) ) } ) . attr ( "cy" , function ( d , i ) { return nv . utils . NaNtoZero ( y0 ( getY ( d , i ) ) ) } ) . attr ( "r" , function ( d , i ) { return Math . sqrt ( z ( getSize ( d , i ) ) / Math . PI ) } ) ; points . exit ( ) . remove ( ) ; groups . exit ( ) . selectAll ( "path.nv-point" ) . transition ( ) . duration ( transitionDuration ) . attr ( "cx" , function ( d , i ) { return nv . utils . NaNtoZero ( x ( getX ( d , i ) ) ) } ) . attr ( "cy" , function ( d , i ) { return nv . utils . NaNtoZero ( y ( getY ( d , i ) ) ) } ) . remove ( ) ; points . each ( function ( d , i ) { d3 . select ( this ) . classed ( "nv-point" , true ) . classed ( "nv-point-" + i , true ) . classed ( "hover" , false ) } ) ; points . transition ( ) . duration ( transitionDuration ) . attr ( "cx" , function ( d , i ) { return nv . utils . NaNtoZero ( x ( getX ( d , i ) ) ) } ) . attr ( "cy" , function ( d , i ) { return nv . utils . NaNtoZero ( y ( getY ( d , i ) ) ) } ) . attr ( "r" , function ( d , i ) { return Math . sqrt ( z ( getSize ( d , i ) ) / Math . PI ) } ) } else { var points = groups . selectAll ( "path.nv-point" ) . data ( function ( d ) { return d . values } ) ; points . enter ( ) . append ( "path" ) . style ( "fill" , function ( d , i ) { return d . color } ) . style ( "stroke" , function ( d , i ) { return d . color } ) . attr ( "transform" , function ( d , i ) { return "translate(" + x0 ( getX ( d , i ) ) + "," + y0 ( getY ( d , i ) ) + ")" } ) . attr ( "d" , d3 . svg . symbol ( ) . type ( getShape ) . size ( function ( d , i ) { return z ( getSize ( d , i ) ) } ) ) ; points . exit ( ) . remove ( ) ; groups . exit ( ) . selectAll ( "path.nv-point" ) . transition ( ) . duration ( transitionDuration ) . attr ( "transform" , function ( d , i ) { return "translate(" + x ( getX ( d , i ) ) + "," + y ( getY ( d , i ) ) + ")" } ) . remove ( ) ; points . each ( function ( d , i ) { d3 . select ( this ) . classed ( "nv-point" , true ) . classed ( "nv-point-" + i , true ) . classed ( "hover" , false ) } ) ; points . transition ( ) . duration ( transitionDuration ) . attr ( "transform" , function ( d , i ) { return "translate(" +
yAxis . transitionDuration ( _ ) ; distX . transitionDuration ( _ ) ; distY . transitionDuration ( _ ) ; return chart } ; return chart } ; nv . models . sparkline = function ( ) { "use strict" ; var margin = { top : 2 , right : 0 , bottom : 2 , left : 0 } , width = 400 , height = 32 , animate = true , x = d3 . scale . linear ( ) , y = d3 . scale . linear ( ) , getX = function ( d ) { return d . x } , getY = function ( d ) { return d . y } , color = nv . utils . getColor ( [ "#000" ] ) , xDomain , yDomain , xRange , yRange ; function chart ( selection ) { selection . each ( function ( data ) { var availableWidth = width - margin . left - margin . right , availableHeight = height - margin . top - margin . bottom , container = d3 . select ( this ) ; x . domain ( xDomain || d3 . extent ( data , getX ) ) . range ( xRange || [ 0 , availableWidth ] ) ; y . domain ( yDomain || d3 . extent ( data , getY ) ) . range ( yRange || [ availableHeight , 0 ] ) ; var wrap = container . selectAll ( "g.nv-wrap.nv-sparkline" ) . data ( [ data ] ) ; var wrapEnter = wrap . enter ( ) . append ( "g" ) . attr ( "class" , "nvd3 nv-wrap nv-sparkline" ) ; var gEnter = wrapEnter . append ( "g" ) ; var g = wrap . select ( "g" ) ; wrap . attr ( "transform" , "translate(" + margin . left + "," + margin . top + ")" ) ; var paths = wrap . selectAll ( "path" ) . data ( function ( d ) { return [ d ] } ) ; paths . enter ( ) . append ( "path" ) ; paths . exit ( ) . remove ( ) ; paths . style ( "stroke" , function ( d , i ) { return d . color || color ( d , i ) } ) . attr ( "d" , d3 . svg . line ( ) . x ( function ( d , i ) { return x ( getX ( d , i ) ) } ) . y ( function ( d , i ) { return y ( getY ( d , i ) ) } ) ) ; var points = wrap . selectAll ( "circle.nv-point" ) . data ( function ( data ) { var yValues = data . map ( function ( d , i ) { return getY ( d , i ) } ) ; function pointIndex ( index ) { if ( index != - 1 ) { var result = data [ index ] ; result . pointIndex = index ; return result } else { return null } } var maxPoint = pointIndex ( yValues . lastIndexOf ( y . domain ( ) [ 1 ] ) ) , minPoint = pointIndex ( yValues . indexOf ( y . domain ( ) [ 0 ] ) ) , currentPoint = pointIndex ( yValues . length - 1 ) ; return [ minPoint , maxPoint , currentPoint ] . filter ( function ( d ) { return d != null } ) } ) ; points . enter ( ) . append ( "circle" ) ; points . exit ( ) . remove ( ) ; points . attr ( "cx" , function ( d , i ) { return x ( getX ( d , d . pointIndex ) ) } ) . attr ( "cy" , function ( d , i ) { return y ( getY ( d , d . pointIndex ) ) } ) . attr ( "r" , 2 ) . attr ( "class" , function ( d , i ) { return getX ( d , d . pointIndex ) == x . domain ( ) [ 1 ] ? "nv-point nv-currentValue" : getY ( d , d . pointIndex ) == y . domain ( ) [ 0 ] ? "nv-point nv-minValue" : "nv-point nv-maxValue" } ) } ) ; return chart } chart . margin = function ( _ ) { if ( ! arguments . length ) return margin ; margin . top = typeof _ . top != "undefined" ? _ . top : margin . top ; margin . right = typeof _ . right != "undefined" ? _ . right : margin . right ; margin . bottom = typeof _ . bottom != "undefined" ? _ . bottom : margin . bottom ; margin . left = typeof _ . left != "undefined" ? _ . left : margin . left ; return chart } ; chart . width = function ( _ ) { if ( ! arguments . length ) return width ; width = _ ; return chart } ; chart . height = function ( _ ) { if ( ! arguments . length ) return height ; height = _ ; return chart } ; chart . x = function ( _ ) { if ( ! arguments . length ) return getX ; getX = d3 . functor ( _ ) ; return chart } ; chart . y = function ( _ ) { if ( ! arguments . length ) return getY ; getY = d3 . functor ( _ ) ; return chart } ; chart . xScale = function ( _ ) { if ( ! arguments . length ) return x ; x = _ ; return chart } ; chart . yScale = function ( _ ) { if ( ! arguments . length ) return y ; y = _ ; return chart } ; chart . xDomain = function ( _ ) { if ( ! arguments . length ) return xDomain ; xDomain = _ ; return chart } ; chart . yDomain = function ( _ ) { if ( ! arguments . length ) return yDomain ; yDomain = _ ; return chart } ; chart . xRange = function ( _ ) { if ( ! arguments . length ) return xRange ; xRange = _ ; return chart } ; chart . yRange = function ( _ ) { if ( ! arguments . length ) return yRange ; yRange = _ ; return chart } ; chart . animate = function ( _ ) { if ( ! arguments . length ) return animate ; animate = _ ; return chart } ; chart . color = function ( _ ) { if ( ! arguments . length ) return color ; color = nv . utils . getColor ( _ ) ; return chart } ; return chart } ; nv . models . sparklinePlus = function ( ) { "use strict" ; var sparkline = nv . models . sparkline ( ) ; var margin = { top : 15 , right : 100 , bottom : 10 , left : 50 } , width = null , height = null , x , y , index = [ ] , paused = false , xTickFormat = d3 . format ( ",r" ) , yTickFormat = d3 . format ( ",.2f" ) , showValue = true , alignValue = true , rightAlignValue = false , noData = "No Data Available." ; function chart ( selection ) { selection . each ( function ( data ) { var container = d3 . select ( this ) ; var availableWidth = ( width || parseInt ( container . style ( "width" ) ) || 960 ) - margin . left - margin . right , availableHeight = ( height || parseInt ( container . style ( "height" ) ) || 400 ) - margin . top - margin . bottom ; chart . update = function ( ) { chart ( selection ) } ; char