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.65 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_ES6 */ zingchart.setModule("populationpyramid"),function(){var e,a,i,l,_,t,r="",C="";ZC.ZCPopulationPyramid={getDefaults:function(e){var a={};return ZC._cp_(ZC.ZCPopulationPyramid.B8,a),ZC.ZCPopulationPyramid.O3[e]&&ZC._cp_(ZC.ZCPopulationPyramid.O3[e],a),a},B8:{},O3:{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,l,_,t=zingchart.getLoader(e.id),Z=-1,p=null,s=null,n=0,c=0,d=ZC.ZCPopulationPyramid.getDefaults(e.theme),o=0,g=a[ZC._[16]].length;o<g;o++)if(l=t.A0P(a,o),a[ZC._[16]][o].x=l.graph.x,a[ZC._[16]][o].y=l.graph.y,a[ZC._[16]][o][ZC._[19]]=l.graph.width,a[ZC._[16]][o][ZC._[20]]=l.graph.height,a[ZC._[16]][o].type&&("population-pyramid"===a[ZC._[16]][o].type||"pop-pyramid"===a[ZC._[16]][o].type)){t.A20=!0;var h=a[ZC._[16]][o].type;a[ZC._[16]][o]["plugin-type"]=h;var u=a[ZC._[16]][o];ZC._todash_(u);var v={};u.options&&(v=u.options[h]||u.options),ZC._todash_(v);var b=v.aspect||"hbar",x=v["label-placement"]||"side",y=!1;null!==ZC._n_(u.legend)&&ZC._b_(u.legend.shared)&&(y=!0),r=b,C=x;var f=l.graph.x,m=l.graph.y,P=l.graph.width,B=l.graph.height;if("middle"===C){var F=u[ZC._[50]]||{},z=F[ZC._[10]]||F[ZC._[5]];for(i=0;i<z.length;i++)(_=zingchart.getInstance(t,"textbox")).append(F.item),_.AN=z[i],_.parse(),n=ZC.BQ(n,ZC._i_(_.I)),c=ZC.BQ(c,ZC._i_(_.F))}switch(p={},s={},ZC._cp_(d,p),ZC._cp_(d,s),ZC._cp_(u,p),ZC._cp_(u,s),p[ZC._[11]]=[].concat(u[ZC._[11]]),s[ZC._[11]]=[].concat(u[ZC._[11]]),p.type=b,p.id=p.id||"pp",p.id+="_ppside1",p.plotarea=p.plotarea||{},p.legend=p.legend||{},ZC._cp_(v["side-1"],p),y&&(p.legend.force=!0),p[ZC._[51]]=p[ZC._[51]]||{},b){case"hbar":case"vline":case"varea":p.x=f,p.y=m,p[ZC._[19]]=P/2+n/2,p[ZC._[20]]=B,p[ZC._[51]].mirrored=!0,"side"===x?p.plotarea[ZC._[58]]=0:(p.plotarea[ZC._[58]]=n+12,p["scale-x-2"]=s["scale-x-2"]||{},ZC._cp_(p[ZC._[50]],p["scale-x-2"]),p[ZC._[50]].visible=!1,p["scale-x-2"].item={visible:!1});break;case"bar":case"vbar":case"line":case"area":p.x=f,p.y=m,p[ZC._[19]]=P,p[ZC._[20]]=B/2+c/2,"side"===x?(p.plotarea[ZC._[59]]=0,p["scale-x-2"]=s["scale-x-2"]||{},ZC._cp_(p[ZC._[50]],p["scale-x-2"]),p[ZC._[50]].visible=!1):(p.plotarea[ZC._[59]]=c+12,p[ZC._[50]].item=p[ZC._[50]].item||{})}for(i=p[ZC._[11]].length-1;i>=0;i--)if(1!==p[ZC._[11]][i]["data-side"])if(y){var O={};ZC._cp_(p[ZC._[11]][i],O),O[ZC._[5]]=[],O.ignore=!0,p[ZC._[11]][i]=O}else p[ZC._[11]].splice(i,1);switch(s.type=b,s.legend=s.legend||{},ZC._cp_(v["side-2"],s),y&&(s.legend.visible=!1),s.id=s.id||"pp",s.id+="_ppside2",s.plotarea=s.plotarea||{},s[ZC._[51]]=s[ZC._[51]]||{},b){case"hbar":case"vline":case"varea":s.x=f+P/2+n/2,s.y=m,s[ZC._[19]]=P/2-n/2,s[ZC._[20]]=B,"side"===x?(s.plotarea[ZC._[60]]=0,s[ZC._[51]].mirrored=!1,s["scale-x-2"]=s["scale-x-2"]||{},ZC._cp_(s[ZC._[50]],s["scale-x-2"]),s[ZC._[50]].visible=!1):s.plotarea[ZC._[60]]=0;break;case"bar":case"vbar":case"line":case"area":s.x=f,s.y=m+B/2+c/2,s[ZC._[19]]=P,s[ZC._[20]]=B/2-c/2,s[ZC._[51]].mirrored=!0,"side"===x?s.plotarea[ZC._[57]]=0:(s.plotarea[ZC._[57]]=0,s["scale-x-2"]=s["scale-x-2"]||{},ZC._cp_(s[ZC._[50]],s["scale-x-2"]),s[ZC._[50]].visible=!1,s["scale-x-2"].item={visible:!1})}for(i=s[ZC._[11]].length-1;i>=0;i--)2!==s[ZC._[11]][i]["data-side"]&&(y?s[ZC._[11]][i]={values:[],ignore:!0}:s[ZC._[11]].splice(i,1));switch(b){case"hbar":case"vline":case"varea":p.title&&null===ZC._n_(p.title.visible)&&(p.title.visible=!1),s.title&&(null===ZC._n_(s.title[ZC._[19]])&&(s.title[ZC._[19]]="200%"),null===ZC._n_(s.title.x)&&(s.title.x="-100%"));break;default:s.title&&null===ZC._n_(s.title.visible)&&(s.title.visible=!1)}Z=o}return p&&s&&(a[ZC._[16]].splice(Z,1),a[ZC._[16]].push(p),a[ZC._[16]].push(s)),a});var Z=[];zingchart.bind(null,"gparse",function(C){var p,s,n,c=zingchart.getLoader(C.id);if(-1!==ZC.AV(["bar","vbar","line","area"],r)&&(n=zingchart.getGraph(c,C.graphid),-1!==C.graphid.indexOf("ppside1")&&(e=n.P.iX,i=n.P.I,Z.push(C.graphid)),-1!==C.graphid.indexOf("ppside2")))for(a=n.P.iX,l=n.P.I,Z.push(C.graphid),_=ZC.BQ(e,a),t=ZC.CX(i,l),p=0;p<Z.length;p++)for((n=zingchart.getGraph(c,Z[p])).P.iX=_,n.P.I=t,s=0;s<n.BO.length;s++)n.BO[s].WZ(),n.BO[s].H2()})}();