Distribuzione per età della popolazione in una certa città / Age distribution of the population in a certain city

Puoi aprire il codice e modificare la funzione: vedi l'Help
You can open the Code and modify the function: see the Help
HELP


// I: estremi degli intervalli, P: frequenze
I=[0,  15,  25,  55,  65, 100]
P=[ 18, 16.5,  50, 10, 5.5]; NP=P.length
SUM=0; for(i=0;i<NP;i=i+1)  {SUM=SUM+P[i]}
mean=0; for(i=0;i<NP;i=i+1) {mean=mean+P[i]*(I[i]+I[i+1])/2}; mean=mean/SUM
Tot=0; for(i=0;i<NP;i=i+1) {Tot=Tot+P[i]}; for(i=0;i<NP;i=i+1) {P[i]=P[i]/Tot/(I[i+1]-I[i])}
LLx=[]; j=0; for(i=1;i<=NP;i=i+1) { LLx[j]=I[i-1]; LLx[j+1]=I[i-1]; LLx[j+2]=I[i]; LLx[j+3]=I[i]; j=j+4 }
LLy=[]; j=0; for(i=1;i<=NP;i=i+1) { LLy[j]=0; LLy[j+1]=P[i-1]; LLy[j+2]=P[i-1]; LLy[j+3]=0; j=j+4 }

aX = 0; bX = 100; aY = 0; bY = 2/100
Dx = 0; Dy = 0
...
Cax="white"
C1="black"
L1x=LLx; L1y=LLy
...
AX=BX=AY=BY=""
...
T0=["0",0,-0.001]; T1=["15",15,-0.001]; T2=["25",25,-0.001]; T3=["55",55,-0.001]; T4=["65",65,-0.001]; T5=["100",100,-0.001]
s0=["18%",6.5,0.018]; s1=["16.5%",21,0.018]; s2=["50%",(25+55)/2,0.018]; s3=["10%",60,0.018]; s4=["5.5%",165/2,0.018]
...
Co1="lightgrey"
// Per un'ulteriore griglia (puoi cambiare colore) / to have an additional grid (you can change color)
Cgr2 = Cgr; xx1=[];yy1=[0]
Cgr2="black"