%%% % Statistiques %%% \newcommand\NbDonnees{}% \newcommand\SommeDonnees{}% \newcommand\EffectifTotal{}% \newcommand\Moyenne{}% \newcommand\Etendue{}% \newcommand\Mediane{}% \newcommand\DonneeMax{}% \newcommand\DonneeMin{}% \newcommand\EffectifMax{}% \setKVdefault[ClesStat]{ColVide=0,CaseVide=false,EffVide=false,% FreqVide=false,AngVide=false,ECCVide=false,TotalVide=false,Sondage=false,Liste=false,% Tableau=false,Stretch=1,Frequence=false,EffectifTotal=false,% Etendue=false,Moyenne=false,SET=false,ValeurExacte=false,Mediane=false,QuartileUn=false,QuartileTrois=false,Total=false,Concret=false,% Unite={},Largeur=1cm,Precision=2,PrecisionF=0,Donnee=Valeurs,Effectif=Effectif,Grille=false,Origine=0,Angle=false,SemiAngle=false,Qualitatif=false,TableauVide=false,ECC=false,Coupure=10,CouleurTab=gray!15,Graphique=false,Batons=true,% % Pour les diags batons EpaisseurBatons=1,ListeCouleursB={a},Lecture=false,LectureFine=false,AideLecture=false,Reponses=false,DonneesSup=false,AbscisseRotation=false,Tiret=false,AngleRotationAbscisse=0,Pasx=1,Pasy=1,Unitex=0.5,Unitey=0.5,Depart=0,CouleurDefaut=black,% % Pour les diags circulaires Rayon=3cm,AffichageAngle=false,AffichageDonnee=false,ListeCouleurs={white},Hachures=false,LectureInverse=false,EcartHachures=0.25,EpaisseurHachures=1,Legende,LegendeVide=false,ACompleter=false,% %Pour les représentations Representation=false,% %Pour les barres horizontales Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dispo }% %compl\'ements \defKV[ClesStat]{AngleRotationAbscisse=\setKV[ClesStat]{AbscisseRotation}}% \defKV[ClesStat]{AffichageDonnees=\setKV[ClesStat]{AffichageAngle=false}\setKV[ClesStat]{AffichageDonnee}}% \defKV[ClesStat]{CasesVides=\setKV[ClesStat]{CaseVide}}% \defKV[ClesStat]{LegendesVides=\setKV[ClesStat]{LegendeVide}}% % La construction du tableau \def\addtotok#1#2{#1\expandafter{\the#1#2}}% \newtoks\tabtoksa\newtoks\tabtoksb\newtoks\tabtoksc% \def\updatetoks#1/#2\nil{\addtotok\tabtoksa{\ifboolKV[ClesStat]{Qualitatif}{}{&\num{#1}}}\addtotok\tabtoksb{&\num{#2}}}% % \newcounter{PfCCompteLignes}% % \def\BuildtabStat{% %%Tableau sans total \setcounter{PfCCompteLignes}{0}% \tabtoksa{\useKV[ClesStat]{Donnee}}\tabtoksb{\useKV[ClesStat]{Effectif}}% \foreachitem\compteur\in\ListeComplete{\expandafter\updatetoks\compteur\nil}% \ifboolKV[ClesStat]{Total}{% \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen+1}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% \CodeBefore% \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% \Body% \the\tabtoksa&Total\\% \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb&\num{\EffectifTotal}}\\% \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{100}}\\}{}% \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{360}}\\}{}% \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{180}}\\}{}% \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\num{\EffectifTotal}}}\\}{}% \CodeAfter% % On crée la liste des colonnes à vider \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% \xdef\FooStat{\useKV[ClesStat]{ColVide}}% \setsepchar{,}% \readlist*\ListeColonnesAVider{\FooStat}% \foreachitem\compteur\in\ListeColonnesAVider{% \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% }% }{}% % On crée la liste des cases à vider \ifboolKV[ClesStat]{CaseVide}{% \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% \setsepchar[*]{,*/}% \readlist*\ListeCasesAVider{\FooStatCases}% \foreachitem\compteur\in\ListeCasesAVider{% \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% }% }{}% % On retrace le tableau %Les colonnes \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+3}}}\do{% \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% }% % Les lignes \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% }% \end{NiceTabular}% }{% \renewcommand{\arraystretch}{\useKV[ClesStat]{Stretch}}% \begin{NiceTabular}{c*{\fpeval{\ListeCompletelen}}{>{\centering\arraybackslash}p{\useKV[ClesStat]{Largeur}}}}% \CodeBefore% \rowcolor{\useKV[ClesStat]{CouleurTab}}{1}% \columncolor{\useKV[ClesStat]{CouleurTab}}{1}% \Body% \the\tabtoksa\\% \ifboolKV[ClesStat]{EffVide}{\useKV[ClesStat]{Effectif}\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&}}{\the\tabtoksb}\\% \ifboolKV[ClesStat]{Frequence}{\stepcounter{PfCCompteLignes}Fr\'equence (\%)\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{FreqVide}{}{\num{\CalculFrequence{##1}}}}}\\}{}% \ifboolKV[ClesStat]{Angle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculAngle{##1}}}}\\}{}% \ifboolKV[ClesStat]{SemiAngle}{\stepcounter{PfCCompteLignes}Angle (\si{\degree})\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{AngVide}{}{\CalculSemiAngle{##1}}}}\\}{}% \ifboolKV[ClesStat]{ECC}{\stepcounter{PfCCompteLignes}E.C.C.\xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{&\ifboolKV[ClesStat]{TableauVide}{}{\ifboolKV[ClesStat]{ECCVide}{}{\CalculECC{##1}}}}\\}{}% \CodeAfter% % On crée la liste des colonnes à vider \xintifboolexpr{\useKV[ClesStat]{ColVide}>0}{% \xdef\FooStat{\useKV[ClesStat]{ColVide}}% \setsepchar{,}% \readlist*\ListeColonnesAVider{\FooStat}% \foreachitem\compteur\in\ListeColonnesAVider{% \tikz\fill[white] (row-2-|col-\fpeval{\compteur+1}) rectangle (last-|col-\fpeval{\compteur+2});% }% }{}% % On crée la liste des cases à vider \ifboolKV[ClesStat]{CaseVide}{% \xdef\FooStatCases{\useKV[ClesStat]{CasesVides}}% \setsepchar[*]{,*/}% \readlist*\ListeCasesAVider{\FooStatCases}% \foreachitem\compteur\in\ListeCasesAVider{% \tikz\fill[white] (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+1}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+1}) rectangle (row-\fpeval{\ListeCasesAVider[\compteurcnt,1]+2}-|col-\fpeval{\ListeCasesAVider[\compteurcnt,2]+2});% }% }{}% % On retrace le tableau %Les colonnes \xintFor* ##1 in {\xintSeq{1}{\fpeval{\ListeCompletelen+2}}}\do{% \tikz\draw (row-1-|col-##1) -- (last-|col-##1);% }% % Les lignes \xintFor* ##1 in {\xintSeq{1}{\fpeval{\thePfCCompteLignes+3}}}\do{% \tikz\draw (row-##1-|col-1) -- (row-##1-|last);% }% \end{NiceTabular}% }% }% % Pour construire le diagramme en barres horizontales \def\UpdatetoksHor#1/#2/#3\nil{\addtotok\toklistenomhor{"#1",}\addtotok\toklistedonhor{#3,}\addtotok\toklisteaffhor{"#2",}}% \newcommand\buildgraphbarhor{% \newtoks\toklistenomhor% \newtoks\toklistedonhor% \newtoks\toklisteaffhor% \newtoks\toklistecouleur% \xdef\PfCfooStat{}% \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,2],}% }% \xdef\DivMax{\fpeval{max(\PfCfooStat)}}% \xdef\ExposantDivMax{\fpeval{round(ln(\DivMax)/ln(10))}}% \xdef\DivMax{\fpeval{10**\ExposantDivMax}}% \xdef\PfCfooStat{}% \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% \xdef\PfCfooStat{\PfCfooStat \ListeComplete[##1,1]/\ListeComplete[##1,2]/\fpeval{\ListeComplete[##1,2]/\DivMax},}% }% \readlist*\ListeCompleteDiagHor{\PfCfooStat}% \foreachitem\compteur\in\ListeCompleteDiagHor{\expandafter\UpdatetoksHor\compteur\nil}% \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% \readlist*\ListeCouleur{\ListeAvantCouleurs}% \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% \NewMPDiagBarreHor{\the\toklistenomhor}{\the\toklistedonhor}{\the\toklisteaffhor}{\the\toklistecouleur}% }% % Pour construire le diagramme en bâtons \def\Updatetoks#1/#2\nil{\addtotok\toklistepoint{(#1,#2),}}% \newcommand\buildgraph[1][]{% \newtoks\toklistepoint% \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoks\compteur\nil}% \newtoks\toklistecouleur% \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}% \readlist*\ListeCouleur{\ListeAvantCouleurs}% \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% \MPStatNew{\the\toklistepoint}{\the\toklistecouleur}% }% % Pour construire le diagramme en bâtons qualitatif \def\Updatetoksq#1/#2\nil{\addtotok\toklistepointq{"#1",#2,}}% \newcommand\buildgraphq[1][]{% \newtoks\toklistepointq% \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}% \newtoks\toklistecouleur% \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleursB}}% \readlist*\ListeCouleur{\ListeAvantCouleurs}% \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% \MPStatNew{\the\toklistepointq}{\the\toklistecouleur}% }% \def\UpdateCoul#1\nil{\addtotok\toklistecouleur{#1,}}% \def\UpdateLegende#1\nil{\addtotok\toklistelegende{#1,}}% % Pour construire le diagramme circulaire qualitatif \def\buildgraphcq#1{% \newtoks\toklistepointq\toklistepointq{}% \newtoks\toklistecouleur\toklistecouleur{}% \newtoks\toklistelegende\toklistelegende{}% \ifboolKV[ClesStat]{LegendeVide}{% \xdef\foo{\useKV[ClesStat]{LegendesVides}}% \readlist*\ListeLegendesAEffacer{\foo}% }{\xdef\foo{0}\readlist*\ListeLegendesAEffacer{\foo}% }% \foreachitem\compteur\in\ListeLegendesAEffacer{\expandafter\UpdateLegende\compteur\nil}% % \foreachitem\compteur\in\ListeComplete{\expandafter\Updatetoksq\compteur\nil}% \xdef\ListeAvantCouleurs{\useKV[ClesStat]{ListeCouleurs}}% \readlist*\ListeCouleur{\ListeAvantCouleurs}% \foreachitem\couleur\in\ListeCouleur{\expandafter\UpdateCoul\couleur\nil}% \NewMPStatCirculaireQ{\the\toklistepointq}{#1}{\the\toklistecouleur}{\the\toklistelegende}% }% %% calcul des fr\'equences \newcommand\CalculFrequence[1]{% \fpeval{round(\ListeComplete[#1,2]*100/\EffectifTotal,\useKV[ClesStat]{PrecisionF})} } %% calcul des angles \newcommand\CalculAngle[1]{% \fpeval{round(\ListeComplete[#1,2]*360/\EffectifTotal,0)} } \newcommand\CalculSemiAngle[1]{% \fpeval{round(\ListeComplete[#1,2]*180/\EffectifTotal,0)} } %% calcul des ECC \newcount\CompteurECC% \newcount\CompteurECCTotal% \newcommand\CalculECC[1]{% \xdef\TotalECC{0}% \CompteurECC=1% \CompteurECCTotal=\numexpr#1+1% \whiledo{\CompteurECC < \CompteurECCTotal}{% \xdef\TotalECC{\fpeval{\TotalECC+\ListeComplete[\the\CompteurECC,2]}}% \CompteurECC=\numexpr\CompteurECC+1% }% \num{\TotalECC}% } % Construction d'un diagramme en barres horizontal \newcommand\NewMPDiagBarreHor[4]{% % #1 Liste des noms % #2 Liste des valeurs associées % #3 Liste des valeurs à afficher (si pb calcul MP) % #4 Liste des couleurs \ifluatex% \mplibforcehmode% \begin{mplibcode}% Longueur:=\useKV[ClesStat]{Longueur}; Hauteur:=\useKV[ClesStat]{Hauteur}; Ecart:=\useKV[ClesStat]{EcartBarre}; ExposantDivMax:=\ExposantDivMax; ecarthachures=\useKV[ClesStat]{EcartHachures}; epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; boolean Hachures; Hachures=\useKV[ClesStat]{Hachures}; boolean Bicolore; Bicolore=\useKV[ClesStat]{Bicolore}; boolean Grille; Grille=\useKV[ClesStat]{Grille}; boolean AffichageDonnee; AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; boolean LegendeVide; LegendeVide=\useKV[ClesStat]{LegendeVide}; vardef CalculNombreDonneesEtDonneeMax(text t)= nbdon:=0;%nombre de données DonneeMax:=0;%donnée DonneeMaximale for p_=t: nbdon:=nbdon+1; if p_>DonneeMax: DonneeMax:=p_; fi; endfor; enddef; vardef ListeDonnees(text t)= n:=0; for p_=t: n:=n+1; Donnees[n]:=p_; endfor; enddef; vardef RecuperationCouleurs(text t)= color Col[]; n:=0; for p_=t: n:=n+1; Col[n]=p_; endfor; enddef; vardef TraceDiag= if Grille: pair Zz[];%Pour déterminer "le dernier point" Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart); Zz2=(0,(Hauteur+Ecart)); Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart); Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi; if ExposantDivMax=0: for k=1 upto DonneeMax+1: trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white; endfor; else: for k=1 upto (floor(DonneeMax*10+2)): trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white; endfor; fi; if ExposantDivMax=0: for k=1 upto (DonneeMax+1): label.bot(TEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0)); endfor; else: if ExposantDivMax<5: for k=1 upto (floor(DonneeMax*10+2)): label.bot(TEX("\num{\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0)); endfor; else: dotlabel.bot(TEX("\num{\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1); fi; fi; fi; for k=0 upto nbdon-1: path RectangleDonnee; RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart)); if Hachures: fill RectangleDonnee withcolor white; trace Hachurage(RectangleDonnee,60 if (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi) withpen pencircle scaled epaisseurhachures; else: remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi; fi; trace RectangleDonnee; endfor; if Grille: drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5; drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5; fi; enddef; vardef AffichageNom(text t)= k:=0; for p_=t: label.lft(TEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart))); k:=k+1; endfor; enddef; vardef AffichageDonnees(text t)= k:=0; for p_=t: label.rt(TEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart))); k:=k+1; endfor; enddef; CalculNombreDonneesEtDonneeMax(#2); ListeDonnees(#2); RecuperationCouleurs(#4); TraceDiag; if LegendeVide=false: AffichageNom(#1); fi; if AffichageDonnee: AffichageDonnees(#3); fi; \end{mplibcode} \else% \begin{mpost}[mpsettings={% Longueur:=\useKV[ClesStat]{Longueur}; Hauteur:=\useKV[ClesStat]{Hauteur}; Ecart:=\useKV[ClesStat]{EcartBarre}; ExposantDivMax:=\ExposantDivMax; ecarthachures=\useKV[ClesStat]{EcartHachures}; epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; boolean Hachures; Hachures=\useKV[ClesStat]{Hachures}; boolean Bicolore; Bicolore=\useKV[ClesStat]{Bicolore}; boolean Grille; Grille=\useKV[ClesStat]{Grille}; boolean AffichageDonnee; AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; boolean LegendeVide; LegendeVide=\useKV[ClesStat]{LegendeVide}; }] vardef CalculNombreDonneesEtDonneeMax(text t)= nbdon:=0;%nombre de données DonneeMax:=0;%donnée DonneeMaximale for p_=t: nbdon:=nbdon+1; if p_>DonneeMax: DonneeMax:=p_; fi; endfor; enddef; vardef ListeDonnees(text t)= n:=0; for p_=t: n:=n+1; Donnees[n]:=p_; endfor; enddef; vardef RecuperationCouleurs(text t)= color Col[]; n:=0; for p_=t: n:=n+1; Col[n]=p_; endfor; enddef; vardef TraceDiag= if Grille: pair Zz[];%Pour déterminer "le dernier point" Zz0=(0,-(nbdon-1)*(Hauteur+Ecart)-Ecart); Zz2=(0,(Hauteur+Ecart)); Zz1=((1/DonneeMax)*Longueur,-(nbdon-1)*(Hauteur+Ecart)-Ecart); Zz3=if ExposantDivMax=0 : (DonneeMax+1)[Zz0,Zz1] else: ((floor(DonneeMax*10+2))/10)[Zz0,Zz1];fi; if ExposantDivMax=0: for k=1 upto DonneeMax+1: trace (Zz0--Zz2) shifted (k*(Zz1-Zz0)) dashed evenly withcolor 0.5white; endfor; else: for k=1 upto (floor(DonneeMax*10+2)): trace (Zz0--Zz2) shifted ((k/10)*(Zz1-Zz0)) dashed evenly withcolor 0.5white; endfor; fi; if ExposantDivMax=0: for k=1 upto (DonneeMax+1): label.bot(LATEX("\num{"&decimal(k)&"}"),Zz0+k*(Zz1-Zz0)); endfor; else: if ExposantDivMax<5: for k=1 upto (floor(DonneeMax*10+2)): label.bot(LATEX("\num{\noexpand\fpeval{"&decimal(k)&"*(10**"&decimal(ExposantDivMax-1)&")}}"),Zz0+(k/10)*(Zz1-Zz0)); endfor; else: dotlabel.bot(LATEX("\num{\noexpand\fpeval{10**"&decimal(ExposantDivMax)&"}}"),Zz1); fi; fi; fi; for k=0 upto nbdon-1: path RectangleDonnee; RectangleDonnee=(unitsquare xscaled ((Donnees[k+1]/DonneeMax)*Longueur) yscaled Hauteur) shifted(0,-k*(Hauteur+Ecart)); if Hachures: fill RectangleDonnee withcolor white; trace Hachurage(RectangleDonnee,60 if (k mod 2)=0: +90 fi,ecarthachures,if (k mod 2)=0 : 0 else: 1 fi) withpen pencircle scaled epaisseurhachures; else: remplis RectangleDonnee withcolor if unknown Col[k+1]: if Bicolore:Col[(k mod 2)+1] else: white fi; else:if Bicolore:Col[(k mod 2)+1] else: Col[k+1] fi; fi; fi; trace RectangleDonnee; endfor; if Grille: drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(0,(Hauteur+Ecart)) withpen pencircle scaled 1.5; drawarrow (0,-(nbdon-1)*(Hauteur+Ecart)-Ecart)--(Zz3+u*(0.25,0)) withpen pencircle scaled 1.5; fi; enddef; vardef AffichageNom(text t)= k:=0; for p_=t: label.lft(LATEX(p_),0.5[(0,0),(0,Hauteur)] shifted (0,-k*(Hauteur+Ecart))); k:=k+1; endfor; enddef; vardef AffichageDonnees(text t)= k:=0; for p_=t: label.rt(LATEX("\num{"&p_&"}"),0.5[(0,0),(0,Hauteur)] shifted (((Donnees[k+1]/DonneeMax)*Longueur),-k*(Hauteur+Ecart))); k:=k+1; endfor; enddef; CalculNombreDonneesEtDonneeMax(#2); ListeDonnees(#2); RecuperationCouleurs(#4); TraceDiag; if LegendeVide=false: AffichageNom(#1); fi; if AffichageDonnee: AffichageDonnees(#3); fi; \end{mpost} \fi% }% % Construction du graphique en bâtons \newcommand\MPStatNew[2]{% \ifluatex \mplibforcehmode \begin{mplibcode} maxx:=0; maxy:=0; unitex:=\useKV[ClesStat]{Unitex}*cm; unitey:=\useKV[ClesStat]{Unitey}*cm; xpartorigine:=\useKV[ClesStat]{Origine}; AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse}; boolean Rotation; Rotation=\useKV[ClesStat]{AbscisseRotation}; boolean Lecture; Lecture:=\useKV[ClesStat]{Lecture}; boolean LectureFine; LectureFine:=\useKV[ClesStat]{LectureFine}; boolean AideLecture; AideLecture:=\useKV[ClesStat]{AideLecture}; boolean DonneesSup; DonneesSup:=\useKV[ClesStat]{DonneesSup}; boolean Reponses; Reponses:=\useKV[ClesStat]{Reponses}; epaisseurbatons=\useKV[ClesStat]{EpaisseurBatons}; boolean Qualitatif; Qualitatif=\useKV[ClesStat]{Qualitatif}; boolean Tiret; Tiret=\useKV[ClesStat]{Tiret}; color CoulDefaut; CoulDefaut=\useKV[ClesStat]{CouleurDefaut}; Depart=\useKV[ClesStat]{Depart}; % on r\'ecup\`ere les couleurs color Col[]; n:=0; for p_=#2: n:=n+1; if color p_: Col[n]=p_; else: Col[n]=CoulDefaut; fi; endfor; % pair A[],B[],P[]; vardef toto(text t)=%points quantitatif n:=0; for p_=t: if pair p_: n:=n+1; P[n]=((xpart(p_)-(xpartorigine))*unitex,ypart(p_)*unitey); if xpart(p_)>maxx: maxx:=xpart(p_)-(xpartorigine); fi; if ypart(p_)>maxy: maxy:=ypart(p_); fi; A[n]=unitex*(xpart(p_)-(xpartorigine),0); B[n]=unitey*(0,ypart(p_)); fi; endfor; enddef; vardef tutu(text t)=%points qualitatif n:=0; for p_=t: if numeric p_: P[n]=((n)*unitex,unitey*(p_-Depart)); B[n]=(0,unitey*(p_-Depart)); if p_>maxy: maxy:=p_; fi; else: n:=n+1; A[n]=unitex*(n,0); fi; endfor; maxy:=maxy-Depart; maxx:=n; enddef; vardef tata(text t)=%affichage quantitatif l=0; for p_=t: if pair p_: l:=l+1; if Rotation: label.bot(TEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]); else : label.bot(TEX("\num{"&decimal(xpart(p_))&"}"),A[l]); fi; if Reponses: if DonneesSup: label.top(TEX("\num{"&decimal(ypart(p_))&"}"),P[l]); else: if Tiret: trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); else: dotlabel.lft(TEX("\num{"&decimal(ypart(p_))&"}"),B[l]); fi; fi; fi; fi; endfor; enddef; vardef titi(text t)=%affichage qualitatif l:=0; for p_=t: if numeric p_: if Reponses: if DonneesSup: label.top(TEX("\num{"&decimal(p_)&"}"),P[l]); else: if Tiret: trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); label.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); else: dotlabel.lft(TEX("\num{"&decimal(p_)&"}"),B[l]); fi; fi; fi; else: l:=l+1; if Rotation: if AngleRotation<>0: picture TEXTELABEL; TEXTELABEL=image( labeloffset:=labeloffset*2; label.lft(TEX(p_),A[l]); labeloffset:=labeloffset/2; ); trace rotation(TEXTELABEL,A[l],AngleRotation); else : label.bot(TEX(p_),A[l]); fi; fi; fi; endfor; enddef; if Qualitatif: tutu(#1); else: toto(#1); fi; boolean Grille; Grille:=\useKV[ClesStat]{Grille}; Pasx:=\useKV[ClesStat]{Pasx}; Pasy:=\useKV[ClesStat]{Pasy}; if Grille: drawoptions(withcolor 0.75white); for k=0 step Pasx until ((maxx+1)): trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy)); endfor; for k=0 step Pasy until ((maxy+2*Pasy)): trace (0,k*unitey)--(unitex*(maxx+1),k*unitey); endfor; drawoptions(); fi; if epaisseurbatons<>0: for k=1 upto n: fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi; if AideLecture: draw B[k]--P[k] dashed evenly; fi; endfor; fi; if LectureFine: for k=0 step Pasy until ((maxy+1*Pasy)): if Tiret: trace (1pt,k*unitey)--(-1pt,k*unitey); label.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); else: dotlabel.lft(TEX("\num{"&decimal(k+Depart)&"}"),(0,k*unitey)); fi; endfor; fi; if Lecture: for k=0 step Pasy until Pasy: if Tiret: trace (1pt,k*unitey)--(-1pt,k*unitey); label.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); else: dotlabel.lft(TEX("\num{"&decimal(k)&"}"),(0,k*unitey)); fi; endfor; fi; drawarrow (0,0)--unitex*(maxx+1,0); drawarrow (0,0)--unitey*(0,maxy+2*Pasy); label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0)); label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy)); if Qualitatif: titi(#1); else:tata(#1); fi; \end{mplibcode} \else \begin{mpost}[mpsettings={% unitex:=\useKV[ClesStat]{Unitex}*cm; unitey:=\useKV[ClesStat]{Unitey}*cm; xpartorigine:=\useKV[ClesStat]{Origine}; AngleRotation=\useKV[ClesStat]{AngleRotationAbscisse}; boolean Rotation; Rotation=\useKV[ClesStat]{AbscisseRotation}; boolean Lecture; Lecture:=\useKV[ClesStat]{Lecture}; boolean LectureFine; LectureFine:=\useKV[ClesStat]{LectureFine}; boolean AideLecture; AideLecture:=\useKV[ClesStat]{AideLecture}; boolean DonneesSup; DonneesSup:=\useKV[ClesStat]{DonneesSup}; boolean Reponses; Reponses:=\useKV[ClesStat]{Reponses}; epaisseurbatons=\useKV[ClesStat]{EpaisseurBatons}; boolean Qualitatif; Qualitatif=\useKV[ClesStat]{Qualitatif}; boolean Tiret; Tiret=\useKV[ClesStat]{Tiret}; color CoulDefaut; CoulDefaut=\useKV[ClesStat]{CouleurDefaut};} Depart=\useKV[ClesStat]{Depart}; ] maxx:=0; maxy:=0; % on r\'ecup\`ere les couleurs color Col[]; n:=0; for p_=#2: n:=n+1; if color p_: Col[n]=p_; else: Col[n]=CoulDefaut; fi; endfor; % pair A[],B[],P[]; vardef toto(text t)=%points quantitatif n:=0; for p_=t: if pair p_: n:=n+1; P[n]=((xpart(p_)-(xpartorigine))*unitex,ypart(p_)*unitey); if xpart(p_)>maxx: maxx:=xpart(p_)-(xpartorigine); fi; if ypart(p_)>maxy: maxy:=ypart(p_); fi; A[n]=unitex*(xpart(p_)-(xpartorigine),0); B[n]=unitey*(0,ypart(p_)); fi; endfor; enddef; vardef tata(text t)=%affichage quantitatif l=0; for p_=t: if pair p_: l:=l+1; if Rotation: label.bot(LATEX("\num{"&decimal(xpart(p_))&"}") rotated AngleRotation,A[l]); else : label.bot(LATEX("\num{"&decimal(xpart(p_))&"}"),A[l]); fi; if Reponses: if DonneesSup: label.top(LATEX("\num{"&decimal(ypart(p_))&"}"),P[l]); else: if Tiret: trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); else: dotlabel.lft(LATEX("\num{"&decimal(ypart(p_))&"}"),B[l]); fi; fi; fi; fi; endfor; enddef; vardef tutu(text t)=%points qualitatif n:=0; for p_=t: if numeric p_: P[n]=((n)*unitex,unitey*p_); B[n]=(0,unitey*p_); if p_>maxy: maxy:=p_; fi; else: n:=n+1; A[n]=unitex*(n,0); fi; endfor; maxx:=n; enddef; vardef titi(text t)=%affichage qualitatif l:=0; for p_=t: if numeric p_: if Reponses: if DonneesSup: label.top(LATEX("\num{"&decimal(p_)&"}"),P[l]); else: if Tiret: trace (B[l]+(-1pt,0))--(B[l]+(1pt,0)); label.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); else: dotlabel.lft(LATEX("\num{"&decimal(p_)&"}"),B[l]); fi; fi; fi; else: l:=l+1; if Rotation: if AngleRotation<>0: picture TEXTELABEL; TEXTELABEL=image( labeloffset:=labeloffset*2; label.lft(LATEX(p_),A[l]); labeloffset:=labeloffset/2; ); trace rotation(TEXTELABEL,A[l],AngleRotation); else : label.bot(LATEX(p_),A[l]); fi; fi; fi; endfor; enddef; if Qualitatif: tutu(#1); else: toto(#1); fi; boolean Grille; Grille:=\useKV[ClesStat]{Grille}; Pasx:=\useKV[ClesStat]{Pasx}; Pasy:=\useKV[ClesStat]{Pasy}; if Grille: drawoptions(withcolor 0.75white); for k=0 step Pasx until ((maxx+1)): trace (k*unitex,0)--(k*unitex,unitey*(maxy+2*Pasy)); endfor; for k=0 step Pasy until ((maxy+2*Pasy)): trace (0,k*unitey)--(unitex*(maxx+1),k*unitey); endfor; drawoptions(); fi; if epaisseurbatons<>0: for k=1 upto n: fill polygone(A[k]-(epaisseurbatons*1pt,0),A[k]+(epaisseurbatons*1pt,0),P[k]+(epaisseurbatons*1pt,0),P[k]-(epaisseurbatons*1pt,0)) withcolor if unknown Col[k]: CoulDefaut else:Col[k] fi; if AideLecture: draw B[k]--P[k] dashed evenly; fi; endfor; fi; if LectureFine: for k=0 step Pasy until ((maxy+1*Pasy)): if Tiret: trace (1pt,k*unitey)--(-1pt,k*unitey); label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); else: dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); fi; endfor; fi; if Lecture: for k=0 step Pasy until Pasy: if Tiret: trace (1pt,k*unitey)--(-1pt,k*unitey); label.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); else: dotlabel.lft(LATEX("\num{"&decimal(k)&"}"),(0,k*unitey)); fi; endfor; fi; drawarrow (0,0)--unitex*(maxx+1,0); drawarrow (0,0)--unitey*(0,maxy+2*Pasy); label.lrt(btex \useKV[ClesStat]{Donnee} etex,unitex*(maxx+1,0)); label.urt(btex \useKV[ClesStat]{Effectif} etex,unitey*(0,maxy+2*Pasy)); if Qualitatif: titi(#1); else:tata(#1); fi; \end{mpost} \fi } % la construction du graphique qualitatif \def\NewMPStatCirculaireQ#1#2#3#4{% %#1 : la liste des données %#2 : 360 ou 180 %#3 : liste des couleurs %#4 : liste des légendes à effacer. \ifluatex \mplibforcehmode \begin{mplibcode} Rayon:=\useKV[ClesStat]{Rayon}; ecarthachures=\useKV[ClesStat]{EcartHachures}; epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; boolean AffichageAngle; AffichageAngle=\useKV[ClesStat]{AffichageAngle}; boolean AffichageDonnee; AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; boolean Hachures; Hachures=\useKV[ClesStat]{Hachures}; boolean Inverse; Inverse=\useKV[ClesStat]{LectureInverse}; boolean Legende; Legende=\useKV[ClesStat]{Legende}; boolean LegendeVide; LegendeVide=\useKV[ClesStat]{LegendeVide}; boolean Retour; Retour=false; boolean ACompleter; ACompleter=\useKV[ClesStat]{ACompleter}; pair A[],O,B[],C[],D[]; O=(0,0); n:=0; numeric total[],ang[]; total[0]=0; ang[0]:=0; path cc; cc=(fullcircle scaled (2*Rayon)); % on r\'ecup\`ere les couleurs color Col[]; n:=0; for p_=#3: n:=n+1; Col[n]=p_; endfor; if Inverse=false: A[0]=point(0) of cc; else: A[0]=point(180) of cc; fi; vardef toto(text t)= n:=0; for p_=t: if numeric p_: n:=n+1; total[n]:=total[n-1]+p_; fi; endfor; N=n; for k=1 upto N: ang[k]=(#2/total[N])*total[k]; endfor; n:=0; for p_=t: if numeric p_: n:=n+1; if Inverse=false: A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N])); else: A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N])); fi; %hachure ou pas ? if Hachures=false: fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else: arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi; else: draw Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O) else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi; fi; if ACompleter=false: draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi; fi; % Affichage des angles associ\'es if AffichageAngle: if round(p_*(#2/total[N]))>15: if (n mod 2)=0: marque_a:=20*0.75*Rayon/cm; else: marque_a:=20*0.5*Rayon/cm; fi; if Hachures: if Inverse=false: undraw Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); else: undraw Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); fi; fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor blanc; fi; if Inverse=false: draw Codeangle(A[n-1],O,A[n],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); else: draw Codeangle(A[n],O,A[n-1],0,(((TEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); fi; fi; elseif AffichageDonnee: if round(p_*(#2/total[N]))>15: if (n mod 2)=0: marque_a:=20*0.75*Rayon/cm; else: marque_a:=20*0.5*Rayon/cm; fi; if Hachures: if Inverse=false: undraw Codeangle(A[n-1],O,A[n],0,TEX(""&decimal(p_)&"")); else: undraw Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&""))))); fi; fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor blanc; fi; if Inverse=false: draw Codeangle(A[n-1],O,A[n],0,(((TEX(""&decimal(p_)&""))))); else: draw Codeangle(A[n],O,A[n-1],0,(((TEX(""&decimal(p_)&""))))); fi; fi; fi; % fi; endfor; if #2=360: draw cc if Hachures: withpen pencircle scaled2 fi; else: draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;; fi; n:=0; if Legende: for p_=t: if string p_: n:=n+1; C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2); draw 0.95[O,C[n]]--1.05[O,C[n]]; C[n]:=1.05[O,C[n]]; Test(n); if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)): D[n]=C[n]+(0.5cm,0); draw C[n]--D[n]; if Retour=false:label.urt(TEX(p_),D[n]);fi; fi; if (xpart(C[n])ypart(O)): D[n]=C[n]-(0.5cm,0); draw C[n]--D[n]; if Retour=false:label.ulft(TEX(p_),D[n]);fi; fi; if (xpart(C[n])xpart(O)) and (ypart(C[n])0: Retour:=true; fi; enddef; Figure(-10u,-10u,10u,10u); toto(#1); \end{mplibcode} \else \begin{mpost}[mpsettings={% Rayon:=\useKV[ClesStat]{Rayon}; ecarthachures=\useKV[ClesStat]{EcartHachures}; epaisseurhachures=\useKV[ClesStat]{EpaisseurHachures}; boolean AffichageAngle; AffichageAngle=\useKV[ClesStat]{AffichageAngle}; boolean AffichageDonnee; AffichageDonnee=\useKV[ClesStat]{AffichageDonnee}; boolean Hachures; Hachures=\useKV[ClesStat]{Hachures}; boolean Inverse; Inverse=\useKV[ClesStat]{LectureInverse}; boolean Legende; Legende=\useKV[ClesStat]{Legende}; boolean LegendeVide; LegendeVide=\useKV[ClesStat]{LegendeVide}; boolean ACompleter; ACompleter=\useKV[ClesStat]{ACompleter}; }] boolean Retour; Retour=false; pair A[],O,B[],C[],D[]; O=(0,0); n:=0; numeric total[],ang[]; total[0]=0; ang[0]:=0; path cc; cc=(fullcircle scaled (2*Rayon)); % on r\'ecup\`ere les couleurs color Col[]; n:=0; for p_=#3: n:=n+1; Col[n]=p_; endfor; if Inverse=false: A[0]=point(0) of cc; else: A[0]=point(180) of cc; fi; vardef toto(text t)= n:=0; for p_=t: if numeric p_: n:=n+1; total[n]:=total[n-1]+p_; fi; endfor; N=n; for k=1 upto N: ang[k]=(#2/total[N])*total[k]; endfor; n:=0; for p_=t: if numeric p_: n:=n+1; if Inverse=false: A[n]=A[n-1] rotatedabout(O,p_*(#2/total[N])); else: A[n]=A[n-1] rotatedabout(O,-p_*(#2/total[N])); fi; %hachure ou pas ? if Hachures=false: fill (O--if Inverse=false:arccercle(A[n-1],A[n],O) else: arccercle(A[n],A[n-1],O) fi--cycle) withcolor if unknown Col[n]: white else:Col[n] fi; else: draw Hachurage((O--if Inverse=false:arccercle(A[n-1],A[n],O) else:arccercle(A[n],A[n-1],O) fi--cycle),p_*(#2/total[N]) if (n mod 2)=0: +90 else: -90 fi,ecarthachures,if (n mod 2)=0 : 0 else: 1 fi) withpen pencircle scaled epaisseurhachures if AffichageAngle: withcolor 0.5white fi; fi; if ACompleter=false: draw A[n-1]--O--A[n] if Hachures: withpen pencircle scaled2 fi; fi; % Affichage des angles associ\'es if AffichageAngle: if round(p_*(#2/total[N]))>15: if (n mod 2)=0: marque_a:=20*0.75*Rayon/cm; else: marque_a:=20*0.5*Rayon/cm; fi; if Hachures: if Inverse=false: undraw Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); else: undraw Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); fi; fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor blanc; fi; if Inverse=false: draw Codeangle(A[n-1],O,A[n],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); else: draw Codeangle(A[n],O,A[n-1],0,(((LATEX("\ang{"&decimal(round(p_*(#2/total[N])))&"}"))))); fi; fi; elseif AffichageDonnee: if round(p_*(#2/total[N]))>15: if (n mod 2)=0: marque_a:=20*0.75*Rayon/cm; else: marque_a:=20*0.5*Rayon/cm; fi; if Hachures: if Inverse=false: undraw Codeangle(A[n-1],O,A[n],0,LATEX(""&decimal(p_)&"")); else: undraw Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&""))))); fi; fill cercles(w shifted(marque_ang*unitvector(w-O)),3mm) withcolor blanc; fi; if Inverse=false: draw Codeangle(A[n-1],O,A[n],0,(((LATEX(""&decimal(p_)&""))))); else: draw Codeangle(A[n],O,A[n-1],0,(((LATEX(""&decimal(p_)&""))))); fi; fi; fi; % fi; endfor; if #2=360: draw cc if Hachures: withpen pencircle scaled2 fi; else: draw (subpath(0,length cc/2) of cc)--cycle if Hachures: withpen pencircle scaled2 fi;; fi; n:=0; if Legende: for p_=t: if string p_: n:=n+1; C[n]=A[n-1] rotatedabout(O,if Inverse:-1* fi(ang[n]-ang[n-1])/2); draw 0.95[O,C[n]]--1.05[O,C[n]]; C[n]:=1.05[O,C[n]]; Test(n); if Retour=false: if (xpart(C[n])>xpart(O)) and (ypart(C[n])>ypart(O)): D[n]=C[n]+(0.5cm,0); draw C[n]--D[n]; label.urt(LATEX(p_),D[n]); fi; if (xpart(C[n])ypart(O)): D[n]=C[n]-(0.5cm,0); draw C[n]--D[n]; label.ulft(LATEX(p_),D[n]); fi; if (xpart(C[n])xpart(O)) and (ypart(C[n])0: Retour:=true; fi; enddef; Figure(-10u,-10u,10u,10u); toto(#1); \end{mpost} \fi }% %Pour la m\'ediane. \DTLgnewdb{mtdb}% \dtlexpandnewvalue% \newcount\nbdonnees% % \def\AjoutListEEaa#1\nil{\addtotok\tabtoksEEa{#1,}}% \def\AjoutListEEab#1\nil{\addtotok\tabtoksEEa{#1/}}% \def\AjoutListEEb#1\nil{\addtotok\tabtoksEEb{#1,}}% \def\AjoutListEEx#1\nil{\addtotok\tabtoksEE{#1,}}% \def\AjoutListEEy#1\nil{\addtotok\tabtoksEE{#1/}}% \DTLgnewdb{mtdbEE}% \DTLgnewdb{mtdbEEqual}% % \newcommand\Stat[2][]{% \useKVdefault[ClesStat]% \setKV[ClesStat]{#1}% \ifboolKV[ClesStat]{Representation}{% \setKV[TraceG]{Xmin=0,Ymin=0}% \setKV[TraceG]{#1}% \readlist*\ListePointsPlaces{#2}% \newtoks\toklistepoint% \foreachitem\compteur\in\ListePointsPlaces{\expandafter\Updatetoks\compteur\nil}% \MPPlacePoint[#1]{\the\toklistepoint}% }{% \ifboolKV[ClesStat]{Liste}{% \setsepchar{,}\ignoreemptyitems% \readlist*\Liste{#2}% \xdef\foo{}% \setsepchar[*]{,*/}\ignoreemptyitems% \xintFor* ##1 in {\xintSeq {1}{\Listelen}}\do{% \xdef\foo{\foo 1/\Liste[##1],}% }% \readlist*\ListeComplete{\foo}% \setKV[ClesStat]{Qualitatif}% }{% \ifboolKV[ClesStat]{Sondage}{% \setsepchar{,}\ignoreemptyitems% \readlist*\Liste{#2}% % "liste vide" \newtoks\tabtoksEEa% \tabtoksEEa{}% % % "liste vide" \newtoks\tabtoksEEb% \tabtoksEEb{}% % \readlist*\ListeSansDoublonsEE{999}% %% Pour ne pas avoir une liste vide % \newcount\cmptEE% \newcount\PasNumEE% %% Permettra de savoir si ce sondage est qualitatif ou quantitatif \PasNumEE=0\relax% \DTLcleardb{mtdbEE}% % on range les resultats du sondage par ordre croissant. \foreachitem\x\in\Liste{% \DTLnewrow{mtdbEE}% \DTLnewdbentry{mtdbEE}{Numeric}{\x}% }% \dtlsort{Numeric}{mtdbEE}{\dtlicompare}% \DTLforeach{mtdbEE}{\nba=Numeric}{% \IfDecimal{\nba}{}{\PasNumEE=\numexpr\PasNumEE+1\relax}% \cmptEE=0\relax% \foreachitem\nbb\in\ListeSansDoublonsEE{% \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% }% \ifthenelse{\equal{\the\cmptEE}{0}}{% \expandafter\AjoutListEEb\nba\nil% \xdef\listEEa{\the\tabtoksEEb}% \ignoreemptyitems% \setsepchar{,}% \readlist*\ListeSansDoublonsEE\listEEa% %%% Enl\`eve tous les \'elements %%% identiques de Liste }{}% }% \foreachitem\nba\in\ListeSansDoublonsEE{% \cmptEE=0\relax% \DTLforeach{mtdbEE}{\nbb=Numeric}{% \ifthenelse{\equal{\nba}{\nbb}}{\cmptEE=\numexpr\cmptEE+1\relax}{}% }% \expandafter\AjoutListEEab\nba\nil% \expandafter\AjoutListEEaa\the\cmptEE\nil% %%% Compte tous les \'elements %%% identiques de Liste }% \xdef\listEEb{\the\tabtoksEEa} \ignoreemptyitems% \setsepchar[*]{,*/}% \readlist*\ListeComplete\listEEb% % \ifthenelse{\equal{\the\PasNumEE}{0}}{\setKV[ClesStat]{Quantitatif}}{\setKV[ClesStat]{Qualitatif}}% }{% \ifboolKV[ClesStat]{Qualitatif}{% % % on lit la liste \'ecrite sous la forme valeur/effectif \setsepchar[*]{,*/}\ignoreemptyitems% \readlist*\ListeInitiale{#2}% % "liste vide" \newtoks\tabtoksEE% \tabtoksEE{}% \DTLcleardb{mtdbEEqual}% \foreachitem\x\in\ListeInitiale{% \DTLnewrow{mtdbEEqual}% \itemtomacro\ListeInitiale[\xcnt,1]\x% \DTLnewdbentry{mtdbEEqual}{Val}{\x}% \itemtomacro\ListeInitiale[\xcnt,2]\y% \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% }% \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% \expandafter\AjoutListEEy\Val\nil% \expandafter\AjoutListEEx\Eff\nil% }% \xdef\listEE{\the\tabtoksEE} \ignoreemptyitems% \setsepchar[*]{,*/}% \readlist*\ListeComplete\listEE% }{% Dans le qualitatif, on trie d'abord les valeurs. \setsepchar[*]{,*/}\ignoreemptyitems% \readlist*\ListeInitiale{#2}% % "liste vide" \newtoks\tabtoksEE% \tabtoksEE{}% \DTLcleardb{mtdbEEqual}% \foreachitem\x\in\ListeInitiale{% \DTLnewrow{mtdbEEqual}% \itemtomacro\ListeInitiale[\xcnt,1]\x% \DTLnewdbentry{mtdbEEqual}{Val}{\x}% \itemtomacro\ListeInitiale[\xcnt,2]\y% \DTLnewdbentry{mtdbEEqual}{Eff}{\y}% }% \dtlsort{Val}{mtdbEEqual}{\dtlicompare}% \DTLforeach{mtdbEEqual}{\Val=Val,\Eff=Eff}{% \expandafter\AjoutListEEy\Val\nil% \expandafter\AjoutListEEx\Eff\nil% }% \xdef\listEE{\the\tabtoksEE} \ignoreemptyitems% \setsepchar[*]{,*/}% \readlist*\ListeComplete\listEE% }}}% % on cr\'ee la base de donn\'ees des valeurs dans le cas qualitatif \DTLcleardb{mtdb}% % on les trie pour la m\'ediane dans le cas qualitatif % Touhami / Texnique.fr \foreachitem\x\in\ListeComplete{% \DTLnewrow{mtdb}% \itemtomacro\ListeComplete[\xcnt,2]\y% \DTLnewdbentry{mtdb}{Numeric}{\y}% }% \dtlsort{Numeric}{mtdb}{\dtlicompare}% % % on r\'einitialise les valeurs des crit\`eres de position et de % dispersion \renewcommand\NbDonnees{}% \renewcommand\SommeDonnees{}% \renewcommand\EffectifTotal{}% \renewcommand\Moyenne{}% \renewcommand\Etendue{}% \renewcommand\Mediane{}% \renewcommand\DonneeMax{0}% \renewcommand\EffectifMax{0}% \renewcommand\DonneeMin{999999999}% \ifboolKV[ClesStat]{Qualitatif}{%D\'ebut qualitatif % Calculs % %% celui de la somme des donn\'ees \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,2]}}}% % %% celui de l'effectif total \ifboolKV[ClesStat]{EffectifTotal}{% \ifboolKV[ClesStat]{Liste}{L'effectif total de la s\'erie est \num{\ListeCompletelen}.\par}{% \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% +\ListeComplete[##1,2]}=\num{\EffectifTotal}\]} }{}% \ifboolKV[ClesStat]{Liste}{\xdef\EffectifTotal{\ListeCompletelen}}{\xdef\EffectifTotal{\SommeDonnees}}% % %% celui de la moyenne \xdef\Moyenne{\fpeval{\SommeDonnees/\ListeCompletelen}}% \ifboolKV[ClesStat]{Moyenne}{% \ifboolKV[ClesStat]{Liste}{% La somme des donn\'ees de la s\'erie est :% \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% \[ \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% \]}{% \[ \num{\ListeComplete[1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{3}}\do{% +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% +\num{\ListeComplete[##1,2]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% \]% }% \ifboolKV[ClesStat]{SET}{}{Le nombre de donn\'ees de la s\'erie est \num{\ListeCompletelen}.\\}% Donc la moyenne de la s\'erie est \'egale \`a :% \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\ListeCompletelen}}%\IfInteger{\fpeval{round(\fpeval{\SommeDonnees/\ListeCompletelen},\useKV[ClesStat]{Precision})}}{=}{\approx} \ifboolKV[ClesStat]{ValeurExacte}{}{% \opdiv*{\SommeDonnees}{\ListeCompletelen}{resultatmoy}{restemoy}% \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% \num{\fpeval{round(\SommeDonnees/\ListeCompletelen,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% }% \]% }{Pas de moyenne possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% % % %% celui de l'\'etendue \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% \xintifboolexpr{\ListeComplete[##1,2]>\DonneeMax}{% \xdef\DonneeMax{\ListeComplete[##1,2]}% }{}% \xintifboolexpr{\ListeComplete[##1,2]<\DonneeMin}{% \xdef\DonneeMin{\ListeComplete[##1,2]}% }{}% }% \xdef\EffectifMax{\DonneeMax}% \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}% \ifboolKV[ClesStat]{Etendue}{% \ifboolKV[ClesStat]{Liste}{% L'\'etendue de la s\'erie est \'egale \`a $\num{\DonneeMax}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\DonneeMin}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% }{Pas d'\'etendue possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{}% % celui de la mediane %%% Recuperation de la mediane %%%%%%%%%%%%%%%%%%%%% \newcount\Recapmed% \newcount\Recapmeda% \ifodd\number\ListeCompletelen%odd impair \Recapmed=\fpeval{(\ListeCompletelen+1)/2}\relax% \else% \Recapmed=\fpeval{\ListeCompletelen/2}\relax% \Recapmeda=\numexpr\Recapmed+1\relax% \fi% \newcount\Recapk% \Recapk=0% \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\Recapk=\numexpr\Recapk+1\relax% \ifnum\Recapk=\Recapmed% \ifodd\number\ListeCompletelen% \xdef\Mediane{\numeroDonnee}% \else% \xdef\Mediane{\numeroDonnee}% \fi% \fi% \ifnum\Recapk=\Recapmeda% \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}% \fi% }% %%% \ifboolKV[ClesStat]{Mediane}{% \ifboolKV[ClesStat]{Liste}{% On range les donn\'ees par ordre croissant :% \nbdonnees=0% \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% \[\DTLforeach{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{;}}\]% }{% \medskip% \begin{center} \begin{minipage}{0.9\linewidth} \DTLforeach*{mtdb}{\numeroDonnee=Numeric}{\num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\DTLiflastrow{.}{; }\nbdonnees=\fpeval{\nbdonnees+1}\modulo{\nbdonnees}{\useKV[ClesStat]{Coupure}}\xintifboolexpr{\remainder==0}{\\}{}} \end{minipage} \end{center}% \medskip% }% \newcount\med% \newcount\meda% \ifodd\number\ListeCompletelen%odd impair \med=\fpeval{(\ListeCompletelen+1)/2}\relax% L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$.\\ \else% pair \med=\fpeval{\ListeCompletelen/2}\relax% \meda=\numexpr\med+1\relax% L'effectif total de la s\'erie est \num{\ListeCompletelen}. Or, $\num{\ListeCompletelen}=\num{\the\med}+\num{\the\med}$.\\ \fi% \newcount\k% \k=0% \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\k=\numexpr\k+1\relax% \ifnum\k=\med %La m\'ediane vaut \numeroDonnee\fi \ifodd\number\ListeCompletelen% La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee.\\Donc la m\'ediane de la s\'erie est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% \xdef\Mediane{\numeroDonnee}% \else% La \the\med\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\numeroDonnee}% \fi% \fi% \ifnum\k=\meda La \the\meda\ieme{} donn\'ee est \num{\numeroDonnee}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.} Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\numeroDonnee)/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% \fi% }% %%%%%%% }{Pas de m\'ediane possible pour une s\'erie de donn\'ees \`a caract\`ere qualitatif.}}{} %%% Quartile un \newcount\PfCQuartileUn% \modulo{\ListeCompletelen}{4}\relax% \ifnum\remainder=0% \PfCQuartileUn=\fpeval{\ListeCompletelen/4}% \else% \PfCQuartileUn=\fpeval{ceil(\ListeCompletelen/4)}% \fi% \newcount\PfCQunk% \PfCQunk=0% \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQunk=\numexpr\PfCQunk+1\relax% \ifnum\PfCQunk=\PfCQuartileUn% \xdef\QuartileUn{\numeroDonnee}% \fi% }% %%% Quartile trois \newcount\PfCQuartileTrois% \modulo{\ListeCompletelen}{4}\relax% \ifnum\remainder=0% \PfCQuartileTrois=\fpeval{3*\ListeCompletelen/4}% \else% \PfCQuartileTrois=\fpeval{ceil(3*\ListeCompletelen/4)}% \fi% \newcount\PfCQtroisk% \PfCQtroisk=0% \DTLforeach{mtdb}{\numeroDonnee=Numeric}{\PfCQtroisk=\numexpr\PfCQtroisk+1\relax% \ifnum\PfCQtroisk=\PfCQuartileTrois%La m\'ediane vaut \numeroDonnee\fi \xdef\QuartileTrois{\numeroDonnee}% \fi% }% % Construction du tableau \ifboolKV[ClesStat]{Tableau}{% \ifboolKV[ClesStat]{Liste}{Pas de tableau possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un tableau avec cette liste.}{\BuildtabStat}}{}% % Construction du graphique \ifboolKV[ClesStat]{Graphique}{% \ifboolKV[ClesStat]{Liste}{Pas de graphique possible avec la cl\'e Liste.\\Utilisez plut\^ot la cl\'e Sondage si vous voulez un graphique avec cette liste.}{% \ifboolKV[ClesStat]{Barre}{% \buildgraphbarhor% }{\ifboolKV[ClesStat]{Angle}{\buildgraphcq{360}}{\ifboolKV[ClesStat]{SemiAngle}{\buildgraphcq{180}}{\buildgraphq[#1]}}}% }}{}% }{%%%%%%%%%%%%%%%%%%%%%D\'ebut quantitatif % % on effectue les calculs % %% celui de la somme des donn\'ees \foreachitem\don\in\ListeComplete{\xdef\SommeDonnees{\fpeval{\SommeDonnees+\ListeComplete[\doncnt,1]*\ListeComplete[\doncnt,2]}}}% % %% celui de l'effectif total \foreachitem\don\in\ListeComplete{\xdef\EffectifTotal{\fpeval{\EffectifTotal+\ListeComplete[\doncnt,2]}}}% % %% celui de l'\'etendue \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% \xintifboolexpr{\ListeComplete[##1,1]>\DonneeMax}{% \xdef\DonneeMax{\ListeComplete[##1,1]}% }{}% \xintifboolexpr{\ListeComplete[##1,1]<\DonneeMin}{% \xdef\DonneeMin{\ListeComplete[##1,1]}% }{}% }% % \xdef\EffectifMax{\DonneeMax}% \xdef\Etendue{\fpeval{\DonneeMax-\DonneeMin}}%% % %% celui de la moyenne \xdef\Moyenne{\fpeval{\SommeDonnees/\EffectifTotal}}% \ifboolKV[ClesStat]{EffectifTotal}{% L'effectif total de la s\'erie est : \[\ListeComplete[1,2]\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% +\ListeComplete[##1,2]}=\num{\EffectifTotal}\] }{}% \ifboolKV[ClesStat]{Moyenne}{% La somme des donn\'ees de la s\'erie est :% \xintifboolexpr{\ListeCompletelen<\useKV[ClesStat]{Coupure}}{% \[ \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} \] }{% \[ \ifnum\ListeComplete[1,2]=1\else\num{\ListeComplete[1,2]}\times\fi\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}\xintFor* ##1 in {\xintSeq {2}{2}}\do{% +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} }+\dots\xintFor* ##1 in {\xintSeq {\ListeCompletelen-1}{\ListeCompletelen}}\do{% +\ifnum\ListeComplete[##1,2]=1\else\num{\ListeComplete[##1,2]}\times\fi\num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} }=\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{} \] }% \ifboolKV[ClesStat]{SET}{}{L'effectif total de la s\'erie est :% \ifboolKV[ClesStat]{Liste}{ \num{\EffectifTotal}\\}{% \[\num{\ListeComplete[1,2]}\xintFor* ##1 in {\xintSeq {2}{\ListeCompletelen}}\do{% +\num{\ListeComplete[##1,2]} }=\num{\EffectifTotal} \]% }% }% Donc la moyenne de la s\'erie est \'egale \`a :% \[\frac{\num{\SommeDonnees}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}}{\num{\EffectifTotal}}% \ifboolKV[ClesStat]{ValeurExacte}{}{% \opdiv*{\SommeDonnees}{\EffectifTotal}{resultatmoy}{restemoy}% \opround{resultatmoy}{\useKV[ClesStat]{Precision}}{resultatmoy1}% \opcmp{resultatmoy}{resultatmoy1}\ifopeq=\else\approx\fi% \num{\fpeval{round(\SommeDonnees/\EffectifTotal,\useKV[ClesStat]{Precision})}}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}% }% \]% }{}% % % Affichage des r\'eponses. % %% pour l'\'etendue \ifboolKV[ClesStat]{Etendue}{L'\'etendue de la s\'erie est \'egale \`a $\num{\ListeComplete[\ListeCompletelen,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}-\num{\ListeComplete[1,1]}\ifboolKV[ClesStat]{Concret}{~\text{\useKV[ClesStat]{Unite}}}{}=\num{\Etendue}$\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}}{}% % pour la m\'ediane %%% Recuperation Mediane \newcount\Recupmed% \newcount\Recupmeda% \ifodd\number\EffectifTotal%odd impair \Recupmed=\fpeval{(\EffectifTotal+1)/2}\relax% \else% pair \Recupmed=\fpeval{\EffectifTotal/2}\relax% \Recupmeda=\numexpr\Recupmed+1\relax% \fi% \newcount\Recupk% \Recupk=0% \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% \Recupk=\numexpr\Recupk+1\relax% \ifnum\Recupk=\Recupmed% \ifodd\number\EffectifTotal% \xdef\Mediane{\ListeComplete[##1,1]}% \else% \xdef\Mediane{\ListeComplete[##1,1]}% \fi% \fi% \ifnum\Recupk=\Recupmeda% \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}% \fi% }% }% %%% \ifboolKV[ClesStat]{Mediane}{% \newcount\med% \newcount\meda% \ifodd\number\EffectifTotal%odd impair \med=\fpeval{(\EffectifTotal+1)/2}\relax% L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med-1}}+1+\num{\fpeval{\med-1}}$. % \else% pair \med=\fpeval{\EffectifTotal/2}\relax% \meda=\numexpr\med+1\relax% L'effectif total de la s\'erie est \num{\EffectifTotal}. Or, $\num{\EffectifTotal}=\num{\fpeval{\med}}+\num{\fpeval{\med}}$. % \fi% \newcount\k% \k=0% \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% \k=\numexpr\k+1\relax% \ifnum\k=\med% \ifodd\number\EffectifTotal% La m\'ediane de la s\'erie est la \the\med\ieme{} donn\'ee. Donc la m\'ediane de la s\'erie est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% \else% La \the\med\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}. }{. }\xdef\Mediane{\ListeComplete[##1,1]}% \fi% \fi% \ifnum\k=\meda% La \the\meda\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% \fi% }% }% }{}% %%% Quartile un \newcount\PfCQuartileUn% \modulo{\EffectifTotal}{4}\relax% \ifnum\remainder=0% \PfCQuartileUn=\fpeval{\EffectifTotal/4}% \else% \PfCQuartileUn=\fpeval{ceil(\EffectifTotal/4)}% \fi% \newcount\PfCQunk% \PfCQunk=0% \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% \PfCQunk=\numexpr\PfCQunk+1\relax% \ifnum\PfCQunk=\PfCQuartileUn% \xdef\QuartileUn{\ListeComplete[##1,1]}% \fi% }% }% %%% Quartile trois \newcount\PfCQuartileTrois% \modulo{\EffectifTotal}{4}\relax% \ifnum\remainder=0% \PfCQuartileTrois=\fpeval{3*\EffectifTotal/4}% \else% \PfCQuartileTrois=\fpeval{ceil(3*\EffectifTotal/4)}% \fi% \newcount\PfCQtroisk% \PfCQtroisk=0% \xintFor* ##1 in {\xintSeq {1}{\ListeCompletelen}}\do{% \xintFor* ##2 in {\xintSeq {1}{\ListeComplete[##1,2]}}\do{% \PfCQtroisk=\numexpr\PfCQtroisk+1\relax% \ifnum\PfCQtroisk=\PfCQuartileTrois% \xdef\QuartileTrois{\ListeComplete[##1,1]}% \fi% }% }% % Construction de tableau \ifboolKV[ClesStat]{Tableau}{\BuildtabStat}{}% % Construction du graphique ?? \ifboolKV[ClesStat]{Graphique}{% \ifboolKV[ClesStat]{Angle}{\buildgraphcq{360}}{\ifboolKV[ClesStat]{SemiAngle}{\buildgraphcq{180}}{\buildgraph[#1]}} }{}% }% }% }%