text: !function(e,t){var n="OMHWebVisualizations";e[n]=t(e,n)}(this,function(e,t){var n,a=e.hasOwnProperty(t)?e[t]:{};return n=function(e,t,n,a){"function"==typeof jQuery&&t instanceof jQuery&&(t=t[0]),t.node||(t=d3.select(t)),a||(a={}),t.classed("omh-chart-container",!0);var i,r=n.split(/\s*,\s*/),o=null,l=new OMHWebVisualizations.ChartConfiguration(a),s=new OMHWebVisualizations.DataParser(e,r,l),u=new OMHWebVisualizations.ChartStyles(l),c=new OMHWebVisualizations.ChartInteractions(t,r[0],l,s,u);this.initialized=!1;var d=new Plottable.Scales.Time,g=new Plottable.Scales.Linear,f=null,h=l.getMeasureSettings(r[0]).yAxis.range;h&&g.domainMin(h.min).domainMax(h.max);var b=new Plottable.Axes.Time(d,"bottom").margin(15).addClass("x-axis"),p=new Plottable.Axes.Numeric(g,"left"),m=new Plottable.Components.AxisLabel(l.getMeasureSettings(r[0]).yAxis.label,"0").padding(5).xAlignment("right").yAlignment("top"),v=[],x=(new Plottable.Plots.Scatter).x(function(e){return e.x},d).y(function(e){return e.y},g);u.setStylesForPlot(u.getConfiguredDefaultStylesForPlot(x),x);var y=[],P=0,S=[];d3.entries(s.getAllMeasureData()).forEach(function(e){var t=e.key;"clustered_bar"===l.getMeasureSettings(t).chart.type&&P++});var w,C,A=[];if(r.forEach(function(e){var t=l.getMeasureSettings(e);if(t.chart&&t.chart.gridlines){var n=t.chart.gridlines;n.forEach(function(e){e.hasOwnProperty("visible")&&e.visible!==!0||A.push(e)})}}),A.length>0){A.sort(function(e,t){return e.value-t.value});var M=new Plottable.Scales.Linear;M.domain(g.domain()),M.range(g.range()),f=function(e){M.domain(e.domain()),M.range(e.range())},g.onUpdate(f);var D=function(e){var t=A.map(function(e){return e.value});return t};M.tickGenerator(D),C=new Plottable.Axes.Numeric(M,"right").tickLabelPosition("top").tickLabelPadding(1).showEndTickLabels(!0).addClass("gridlines-axis"),C.formatter(function(e){for(var t in A)if(A[t].value===e){var n=A[t].label?A[t].label:A[t].value;return String(n)}}),w=new Plottable.Components.Gridlines(null,M),v.push(w),v.push(C)}r.forEach(function(e){if(s.hasMeasureData(e)){var t=s.getMeasureData(e),n=new Plottable.Dataset(t),a=l.getMeasureSettings(e);if(n.measure=e,"clustered_bar"===a.chart.type){var i=g;if(y.length>0){var r=a.yAxis.range,o=a.yAxis.label;i=(new Plottable.Scales.Linear).domainMin(r.min).domainMax(r.max);var c=new Plottable.Axes.Numeric(i,"right"),f=new Plottable.Components.AxisLabel(o,"0").padding(5).xAlignment("left").yAlignment("top");S.push({measure:e,axis:c,label:f,scale:i})}var h=(new Plottable.Plots.ClusteredBar).x(function(e){return e.x},d).y(function(e){return e.y},i);u.setStylesForPlot(u.getConfiguredDefaultStylesForPlot(h),h),y.push(h);for(var p=0;p<P;p++)p===y.length-1?h.addDataset(n):h.addDataset(new Plottable.Dataset([]));var m=b.axisConfigurations(),w=[];m.forEach(function(e){"day"!==e[0].interval&&"month"!==e[0].interval&&"year"!==e[0].interval||w.push(e)}),b.axisConfigurations(w),h.addClass("clustered-bar-plot-"+e),v.push(h)}else{var C=(new Plottable.Plots.Line).x(function(e){return e.x},d).y(function(e){return e.y},g);u.setStylesForPlot(u.getConfiguredDefaultStylesForPlot(C),C),C.addDataset(n),x.addDataset(n),C.addClass("line-plot-"+e),v.push(C)}}}),x.addClass("point-plot"),v.push(x);var T=null,E=null,L=l.getInterfaceSettings().legend;if(L&&L.visible){T=new Plottable.Scales.Color,E=new Plottable.Components.Legend(T);var z=[],G=[];d3.entries(s.getAllMeasureData()).forEach(function(e){var t=e.key,n=l.getMeasureSettings(t),a=n.legend.seriesName,i=n.legend.seriesColor;a&&i&&(z.push(a),G.push(i))}),T.domain(z),T.range(G),E.maxEntriesPerRow(2),E.symbol(Plottable.SymbolFactories.square),E.xAlignment("right"),E.yAlignment("top"),v.push(E)}var I=l.getInterfaceSettings().axes.xAxis.visible,F=l.getInterfaceSettings().axes.yAxis.visible,O=new Plottable.Components.Group(v),k=F?new Plottable.Components.Group([p,m]):null,W=[k,O],H=[null,I?b:null];F&&S.forEach(function(e){W.push(new Plottable.Components.Group([e.axis,e.label])),H.push(null)}),o=new Plottable.Components.Table([W,H]),o.yAlignment("bottom"),c.addToComponents({plots:v,plotGroup:O,table:o,xScale:d,xAxis:b}),this.destroy=function(){c.destroy(),o&&o.destroy(),f&&g.offUpdate(f)},this.getComponents=function(){if(!this.initialized)return{};var e={};e[r[0]]=g;var t={};t[r[0]]=p;var n={};n[r[0]]=m;var a={};a[r[0]]=d;var i={};i[r[0]]=b;var l={};return l[r[0]]=T,S.forEach(function(a){e[a.measure]=a.scale,t[a.measure]=a.axis,n[a.measure]=a.label}),{xScales:a,yScales:e,colorScales:l,gridlines:{gridlines:w,yAxis:C,values:A},legends:[E],xAxes:i,yAxes:t,plots:v,yLabels:n,table:o,tooltip:c.getTooltip(),toolbar:c.getToolbar(),panZoomInteractions:{plotGroup:c.getPanZoomInteraction(),xAxis:c.getpanZoomInteractionXAxis()}}},this.getPlots=function(e){return e?v.filter(function(t){return t instanceof e}):v},this.addGridline=function(e,t){A.push({value:e,label:t?t:e})},this.getMeasures=function(){return r},this.getStyles=function(){return u},this.getInteractions=function(){return c},this.getConfiguration=function(){return l},this.getParser=function(){return s},this.getD3Selection=function(){return i},this.renderTo=function(e){return this.initialized?(i=d3.select(e),c.addToSelection(i),o.renderTo(i),u.addToSelection(i),void c.addTooltipsToEntities(x.entities())):void console.log("Warning: chart could not be rendered because it was not successfully initialized.")},this.initialized=!0},a.Chart=n,a});