rendered paste bodyvoid evolution_pays_globalpop(char* pays){ int pays_int = chercherPays(pays); long unsigned int max,min; char legende [50] =""; char ord [50] = ""; char abs [50] = ""; // initialisation de l'intervalle int i,debut_i=0,fin_i=0; for(i=0;i<11;i++){ if(data[i]!=NULL){ if(debut_i!=0){fin_i = i+2000;} else{debut_i = i+2000;} } } if(fin_i==0){fin_i=debut_i;} char debut[10]; char fin[10]; sprintf(debut,"%d",debut_i); sprintf(fin,"%d",fin_i); MagickWand *mw; DrawingWand *dw; PixelWand *cw; MagickWandGenesis (); mw = NewMagickWand (); dw = NewDrawingWand (); cw = NewPixelWand (); PixelSetColor (cw, "white"); MagickNewImage (mw, 1500, 1500, cw); PixelSetColor(cw,"black"); DrawSetStrokeColor (dw, cw); // LEGENDE strcat(legende,"Evolution de "); strcat(legende,pays); strcat(legende," de "); strcat(legende,debut); strcat(legende," à "); strcat(legende,fin); DrawSetFontSize(dw,20); DrawAnnotation(dw,550,1470,legende); // REPERE DrawSetStrokeOpacity (dw, 1); DrawLine(dw,100,1400,1400,1400); DrawLine(dw,100,0,100,1400); for(i=1;i<13;i++){ DrawLine(dw,i*100,1400-5,i*100,1400+5); } for(i=0;i<11;i++){ sprintf(abs,"%d",2000+i); DrawAnnotation(dw,i*100-15+200,1400+30,abs); } // COURBE int premierpoint=0; for(i=0;i<11;i++){ if(data[i]!=NULL){ if(premierpoint==0){ min=data[i]->listePays[pays_int]->total[0]; max=data[i]->listePays[pays_int]->total[0]; premierpoint = 1; } else{ if(data[i]->listePays[pays_int]->total[0] < min){min = data[i]->listePays[pays_int]->total[0];printf("Annee %d foireuse \n",i);} if(data[i]->listePays[pays_int]->total[0] > max){max = data[i]->listePays[pays_int]->total[0];} } } } PixelSetColor(cw,"red"); DrawSetStrokeColor (dw, cw); DrawSetFontSize(dw,15); long unsigned int difference = max-min; long unsigned int intervalle = difference/10; int x,y; premierpoint=0; for(i=0;i<11;i++){ if(data[i]!=NULL){ int nombreIntervalle = (data[i]->listePays[pays_int]->total[0] - min)/intervalle; if(premierpoint==0){ x = i*100+200; y = 1400-nombreIntervalle*100; premierpoint=1; PixelSetColor(cw,"black"); DrawSetStrokeColor (dw, cw); DrawAnnotation(dw,100-75,1400-nombreIntervalle*100,ord); PixelSetColor(cw,"red"); DrawSetStrokeColor (dw, cw); } else{ DrawLine(dw,x,y,i*100+200,1400-nombreIntervalle*100); PixelSetColor(cw,"black"); DrawSetStrokeColor (dw, cw); DrawLine(dw,100-5,1400-nombreIntervalle*100,100+5,1400-nombreIntervalle*100); sprintf(ord,"%lu",data[i]->listePays[pays_int]->total[0]); DrawAnnotation(dw,100-75,1400-nombreIntervalle*100,ord); PixelSetColor(cw,"red"); DrawSetStrokeColor (dw, cw); x = i*100+200; y = 1400-nombreIntervalle*100; } } } MagickDrawImage (mw,dw); MagickWriteImage (mw, "evolution.png"); system("evince evolution.png"); cw = DestroyPixelWand (cw); mw = DestroyMagickWand (mw); dw = DestroyDrawingWand (dw); MagickWandTerminus();}