UNPKG

zingchart

Version:

Our JavaScript charting library is a commercial product. But the full branded version is free to try, forever.

8 lines (7 loc) 4.61 kB
/* All of the code within the ZingChart software is developed and copyrighted by ZingChart, Inc., and may not be copied, replicated, or used in any other software or application without prior permission from ZingChart. All usage must coincide with the ZingChart End User License Agreement which can be requested by email at support@zingchart.com. Build 2.9.11 */ zingchart.setModule("populationpyramid"),function(){var e,a,i,t,r,s,l="",p="";ZC.ZCPopulationPyramid={getDefaults:function(e){var a={};return ZC._cp_(ZC.ZCPopulationPyramid.B8,a),ZC.ZCPopulationPyramid.NR[e]&&ZC._cp_(ZC.ZCPopulationPyramid.NR[e],a),a},B8:{},NR:{light:{"background-color":"#FFFFFF",legend:{"adjust-layout":!1,"margin-top":10}},dark:{"background-color":"#221F1F",legend:{"adjust-layout":!1,"margin-top":10}},classic:{"background-color":"#E3EBED"}}},zingchart.bind(null,"dataparse",function(e,a){for(var i,t,r,s=zingchart.getLoader(e.id),c=-1,n=null,g=null,h=0,d=0,o=ZC.ZCPopulationPyramid.getDefaults(e.theme),_=0,u=a.graphset.length;_<u;_++)if(t=s.A5I(a,_),a.graphset[_].x=t.graph.x,a.graphset[_].y=t.graph.y,a.graphset[_].width=t.graph.width,a.graphset[_].height=t.graph.height,a.graphset[_].type&&("population-pyramid"===a.graphset[_].type||"pop-pyramid"===a.graphset[_].type)){s.A1I=!0;var C=a.graphset[_].type;a.graphset[_]["plugin-type"]=C;var x=a.graphset[_];ZC._todash_(x);var Z={};x.options&&(Z=x.options[C]||x.options),ZC._todash_(Z);var b=Z.aspect||"hbar",v=Z["label-placement"]||"side",m=!1;null!==ZC._n_(x.legend)&&ZC._b_(x.legend.shared)&&(m=!0),l=b,p=v;var y=t.graph.x,f=t.graph.y,P=t.graph.width,w=t.graph.height;if("middle"===p){var B=x["scale-x"]||{},F=B.labels||B.values;for(i=0;i<F.length;i++)(r=zingchart.getInstance(s,"textbox")).append(B.item),r.AM=F[i],r.parse(),h=ZC.BQ(h,ZC._i_(r.I)),d=ZC.BQ(d,ZC._i_(r.F))}switch(n={},g={},ZC._cp_(o,n),ZC._cp_(o,g),ZC._cp_(x,n),ZC._cp_(x,g),n.series=[].concat(x.series),g.series=[].concat(x.series),n.type=b,n.id=n.id||"pp",n.id+="_ppside1",n.plotarea=n.plotarea||{},n.legend=n.legend||{},ZC._cp_(Z["side-1"],n),m&&(n.legend.force=!0),n["scale-y"]=n["scale-y"]||{},b){case"hbar":case"vline":case"varea":n.x=y,n.y=f,n.width=P/2+h/2,n.height=w,n["scale-y"].mirrored=!0,"side"===v?n.plotarea["margin-right"]=0:(n.plotarea["margin-right"]=h+12,n["scale-x-2"]=g["scale-x-2"]||{},ZC._cp_(n["scale-x"],n["scale-x-2"]),n["scale-x"].visible=!1,n["scale-x-2"].item={visible:!1});break;case"bar":case"vbar":case"line":case"area":n.x=y,n.y=f,n.width=P,n.height=w/2+d/2,"side"===v?(n.plotarea["margin-bottom"]=0,n["scale-x-2"]=g["scale-x-2"]||{},ZC._cp_(n["scale-x"],n["scale-x-2"]),n["scale-x"].visible=!1):(n.plotarea["margin-bottom"]=d+12,n["scale-x"].item=n["scale-x"].item||{})}for(i=n.series.length-1;i>=0;i--)if(1!==n.series[i]["data-side"])if(m){var z={};ZC._cp_(n.series[i],z),z.values=[],z.ignore=!0,n.series[i]=z}else n.series.splice(i,1);switch(g.type=b,g.legend=g.legend||{},ZC._cp_(Z["side-2"],g),m&&(g.legend.visible=!1),g.id=g.id||"pp",g.id+="_ppside2",g.plotarea=g.plotarea||{},g["scale-y"]=g["scale-y"]||{},b){case"hbar":case"vline":case"varea":g.x=y+P/2+h/2,g.y=f,g.width=P/2-h/2,g.height=w,"side"===v?(g.plotarea["margin-left"]=0,g["scale-y"].mirrored=!1,g["scale-x-2"]=g["scale-x-2"]||{},ZC._cp_(g["scale-x"],g["scale-x-2"]),g["scale-x"].visible=!1):g.plotarea["margin-left"]=0;break;case"bar":case"vbar":case"line":case"area":g.x=y,g.y=f+w/2+d/2,g.width=P,g.height=w/2-d/2,g["scale-y"].mirrored=!0,"side"===v?g.plotarea["margin-top"]=0:(g.plotarea["margin-top"]=0,g["scale-x-2"]=g["scale-x-2"]||{},ZC._cp_(g["scale-x"],g["scale-x-2"]),g["scale-x"].visible=!1,g["scale-x-2"].item={visible:!1})}for(i=g.series.length-1;i>=0;i--)2!==g.series[i]["data-side"]&&(m?g.series[i]={values:[],ignore:!0}:g.series.splice(i,1));switch(b){case"hbar":case"vline":case"varea":n.title&&null===ZC._n_(n.title.visible)&&(n.title.visible=!1),g.title&&(null===ZC._n_(g.title.width)&&(g.title.width="200%"),null===ZC._n_(g.title.x)&&(g.title.x="-100%"));break;default:g.title&&null===ZC._n_(g.title.visible)&&(g.title.visible=!1)}c=_}return n&&g&&(a.graphset.splice(c,1),a.graphset.push(n),a.graphset.push(g)),a});var c=[];zingchart.bind(null,"gparse",function(p){var n,g,h,d=zingchart.getLoader(p.id);if(-1!==ZC.AV(["bar","vbar","line","area"],l)&&(h=zingchart.getGraph(d,p.graphid),-1!==p.graphid.indexOf("ppside1")&&(e=h.P.iX,i=h.P.I,c.push(p.graphid)),-1!==p.graphid.indexOf("ppside2")))for(a=h.P.iX,t=h.P.I,c.push(p.graphid),r=ZC.BQ(e,a),s=ZC.CY(i,t),n=0;n<c.length;n++)for((h=zingchart.getGraph(d,c[n])).P.iX=r,h.P.I=s,g=0;g<h.BO.length;g++)h.BO[g].A5D(),h.BO[g].J2()})}();