Changeset 1645 in Sophya
- Timestamp:
- Aug 24, 2001, 1:08:42 PM (24 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pihisto.cc
r1644 r1645 142 142 PIGrCoord a, d; 143 143 double cH = (double)g->GetFontHeight(a,d); 144 double cellHeight = cH * 3.6;144 double cellHeight = 3.6 * cH; 145 145 146 146 // Les labels et leurs longueurs -> largeur de la cellule 147 char *label, label1[ 32], label2[32], label3[32];148 sprintf(label1, "N= %- 6g",mHisto->NData());149 sprintf(label2, "m= %- 6g",mHisto->Mean());150 sprintf(label3, "s= %- 6g",mHisto->Sigma());147 char *label, label1[64], label2[64], label3[64]; 148 sprintf(label1, "N= %-g",mHisto->NData()); 149 sprintf(label2, "m= %-g",mHisto->Mean()); 150 sprintf(label3, "s= %-g",mHisto->Sigma()); 151 151 label = label1; 152 152 if(strlen(label)<strlen(label2)) label = label2; … … 154 154 double cellWidth = 1.1 * (double)g->CalcStringWidth(label); 155 155 156 double xu, yu ;156 double xu, yu, cw; 157 157 // Les limites du cadre 158 xu = g->DeltaUCX(XMax(), - 159 yu = g->DeltaUCY(YMax(), - 160 g->DrawLine(xu, YMax(), xu,yu);161 g->DrawLine(xu, yu, XMax(),yu);158 xu = g->DeltaUCX(XMax(), -cellWidth); 159 yu = g->DeltaUCY(YMax(), -cellHeight); 160 g->DrawLine(xu,YMax(),xu,yu); 161 g->DrawLine(xu,yu,XMax(),yu); 162 162 163 // L'ecriture des labels 164 xu = g->DeltaUCX(XMax(), - cellWidth*0.95); 165 yu = g->DeltaUCY(YMax(), - cH*1.15); 166 g->DrawString(xu, yu, label1); 167 yu = g->DeltaUCY(YMax(), - cH*2.3); 168 g->DrawString(xu, yu, label2); 169 yu = g->DeltaUCY(YMax(), - cH*3.45); 170 g->DrawString(xu, yu, label3); 163 // L'ecriture des labels (attention aux inversions possibles des axes!) 164 cw = (g->isAxeXDirRtoL()) ? -0.05*cellWidth : -0.95*cellWidth; 165 xu = g->DeltaUCX(XMax(),cw); 166 167 cw = (g->isAxeYDirUpDown()) ? -0.15*cH : -1.15*cH; 168 yu = g->DeltaUCY(YMax(),cw); 169 g->DrawString(xu, yu,label1); 170 cw += -1.15*cH; 171 yu = g->DeltaUCY(YMax(),cw); 172 g->DrawString(xu, yu,label2); 173 cw += -1.15*cH; 174 yu = g->DeltaUCY(YMax(),cw); 175 g->DrawString(xu, yu,label3); 171 176 172 177 } 173 -
trunk/SophyaPI/PIext/pihisto2d.cc
r1644 r1645 61 61 // en couleur. Cette option est incontournable dans le cas 62 62 // d'un display par des carres de taille fixe. 63 //| -**- gestion dans H2WinArg par menu deroulant Black&White etc... 63 64 //-- 64 65 { … … 84 85 //| f -> lf = log10(1.+f*(logscale-1))/log10(logscale) 85 86 //| 3. codage de lf=[0,1] sur la dynamique du display choisi 87 //| -**- gestion dans H2WinArg par menu deroulant Lineaire/Log10 88 //| et "logscale" par saisie de valeur dans champ LogScal 86 89 //-- 87 90 { … … 105 108 //| (cf detail PIHisto2D::HPrint2) 106 109 //| Type = 3 : carres de taille fixe (couleur). 110 //| -**- gestion dans H2WinArg par menu deroulant Carres_Var etc... 111 //| et "fnpt" par saisie de valeur dans champ PerPt 107 112 //-- 108 113 { … … 122 127 //| [hmin,hmax] -> [0,1] 123 128 //| h -> f = (h-hmin)/(hmax-hmin) 124 //| Par la suite selon ce qui est demande, f va coder le display ou etre125 //| transforme en une autre echelle [0,1].129 //| Par la suite, selon ce qui est demande, f va coder le display 130 //| ou etre transforme en une autre echelle [0,1] (ex: echelle log10). 126 131 //| Si hmax<=hmin, ils sont forces a la dynamique totale de l'histo2D. 132 //| -**- gestion dans H2WinArg par saisie de valeurs dans champ Dyn 127 133 //-- 128 134 { … … 136 142 // 137 143 // Pour definir la fraction de la dynamique a dessiner: 138 //| Certainstype de display (f=[0,1] cf PIHisto2D::UseDyn),144 //| Selon le type de display (f=[0,1] cf PIHisto2D::UseDyn), 139 145 //| - on ne dessine rien si f <= frmin dans les cas de display avec 140 146 //| des nuages de points ou des carres de tailles variables. … … 146 152 //| le + grand qui pourra etre dessine dans un bin 147 153 //| aura une taille egale a 0.8*(taille du bin)). 148 //-- 149 { 150 if(frmax<=0. || frmax>1.) frmax = 1.; 154 //| -**- gestion dans H2WinArg par saisie de valeurs dans champ Frac 155 //-- 156 { 157 if(frmin<0. || frmin>=1.) frmin = 0.; 158 if(frmax<=0. || frmax>1. ) frmax = 1.; 151 159 if(frmin>=frmax) {frmin=0.1; frmax=0.9;} 152 160 mFracMin = frmin; mFracMax = frmax; … … 183 191 // 184 192 // Dessin de l'histogramme. 185 //| Code de dessin selon choix des options:193 //| -**- Code de dessin selon choix des options: 186 194 //| (detail voir UseColors UseScale UseDisplay UseDyn UseFrac) 187 //| [hmin,hmax] -> [0,1] [[ -> re-codage log10 entre [0,1] ]] -> f=[0,1] 188 //| Puis selon display: 189 //| 0 carres variables : if(f>fracmin) taille carre = f*fracmax *taille_du_bin 190 //| 1 nuage de points : if(f>fracmin) npoints = f*PerPt *npoints_ecran_dans_bin 191 //| 2 code hbook2 : if(f>0) map de f=]0,1] dans ".+...Z*" 192 //| 3 carres fixes : couleur = lut[f*nombre_d_entree_dans_la_lut] 195 //| - [hmin,hmax] -> f=[0,1] 196 //| (Choix hmin,hmax champ Dyn de H2WinArg) 197 //| - Eventuellement ech Log -> re-codage log10 entre f=[0,1] 198 //| (Choix menu deroulant et champ LogScal de H2WinArg) 199 //| - Restriction de f=[0,1] -> f=[Frac(min),Frac(max)] 200 //| (Choix champ Frac de H2WinArg) 201 //| -**- Puis selon display: 202 //| 0 carres variables, menu "Carres Var." de H2WinArg: 203 //| if(f>Frac(min)) taille carre = f * Frac(max) * taille_du_bin 204 //| 1 nuage de points, menu "....." et champ PerPt de H2WinArg: 205 //| if(f>Frac(min)) npoints = f * PerPt * npoints_ecran_dans_bin 206 //| 2 code hbook2, menu ".12..Z*" de H2WinArg: 207 //| if(f>0) map de f=]0,1] dans ".+...Z*" 208 //| 3 carres pleins, menu "Carres Pleins" et couleurs de H2WinArg): 209 //| couleur = lut[ f * nombre_d_entree_dans_la_lut ] 193 210 //-- 194 211 { … … 200 217 double dx = mHisto->WBinX(),dy = mHisto->WBinY(); 201 218 double p1dx,p1dy; 202 g->DGrC2UC(1. f,1.f,p1dx,p1dy);219 g->DGrC2UC(1.,1.,p1dx,p1dy); 203 220 204 221 // Gamme a representer entre [0,1] mais >=fracmin et scale fracmax … … 325 342 // La hauteur de la cellule 326 343 PIGrCoord a, d; 327 double cellHeight = 1.2 * (double)g->GetFontHeight(a,d); 344 double cH = (double)g->GetFontHeight(a,d); 345 double cellHeight = 1.2 * cH; 328 346 329 347 // Les labels et leurs longueurs -> largeur de la cellule 330 char label[ 32];331 sprintf(label,"N= %- 6g", mHisto->NData());348 char label[64]; 349 sprintf(label,"N= %-g", mHisto->NData()); 332 350 double cellWidth = 1.1 * (double)g->CalcStringWidth(label); 333 351 352 double xu, yu, cw; 334 353 // Les limites du cadre 335 g->DrawLine(XMax() - cellWidth, YMax(),336 XMax() - cellWidth, YMax() -cellHeight);337 g->DrawLine( XMax() - cellWidth, YMax() - cellHeight,338 XMax() , YMax() - cellHeight);354 xu = g->DeltaUCX(XMax(), -cellWidth); 355 yu = g->DeltaUCY(YMax(), -cellHeight); 356 g->DrawLine(xu,YMax(),xu,yu); 357 g->DrawLine(xu,yu,XMax(),yu); 339 358 340 359 // L'ecriture des labels 341 g->DrawString(XMax() - cellWidth*0.95, YMax() - cellHeight*0.8,label); 360 cw = (g->isAxeXDirRtoL()) ? -0.05*cellWidth : -0.95*cellWidth; 361 xu = g->DeltaUCX(XMax(),cw); 362 cw = (g->isAxeYDirUpDown()) ? -0.1*cH : -1.1*cH; 363 yu = g->DeltaUCY(YMax(),cw); 364 g->DrawString(xu,yu,label); 365 342 366 // printf("H[%d,%d] Dynamique: [%g,%g] Frac [%g,%g]\n" 343 367 // ,mHisto->NBinX(),mHisto->NBinY(),HMin(),HMax(),FMin(),FMax()); … … 577 601 //| - Champ texte Dyn: Pour donner la dynamique, si min>=max 578 602 //| alors prend le min et le max de l'histogramme 603 //| (cf PIHisto2D::UseDyn) 579 604 //| - Champ texte Frac: fraction mini et maxi 580 605 //| (cf PIHisto2D::UseFrac) -
trunk/SophyaPI/PIext/pintuple.cc
r1644 r1645 205 205 206 206 if (stats) { // Trace de stats 207 char label[64];208 sprintf(label, "Nd= %d/ Ntot= %d", nok, mNT->NbLines());209 207 g->SelFontSz((YMax() - YMin())/30, mFAtt); 208 // La hauteur de la cellule 210 209 PIGrCoord a,d; 211 210 double cH = (double)g->GetFontHeight(a,d); 212 double cellHeight = cH * 1.2; 211 double cellHeight = 1.2 * cH; 212 // Les labels et leurs longueurs -> largeur de la cellule 213 char label[64]; 214 sprintf(label, "Nd= %d / Ntot= %d", nok, mNT->NbLines()); 213 215 double cellWidth = 1.1 * (double)g->CalcStringWidth(label); 214 double xu, yu; 216 double xu, yu, cw; 217 // Les limites du cadre 215 218 xu = g->DeltaUCX(XMax(), - cellWidth); 216 219 yu = g->DeltaUCY(YMax(), - cellHeight); 217 220 g->DrawLine(xu, YMax(), xu, yu); 218 221 g->DrawLine(xu, yu, XMax(), yu); 219 xu = g->DeltaUCX(XMax(), - cellWidth*0.95); 220 yu = g->DeltaUCY(YMax(), - cH*1.15); 221 g->DrawString(xu, yu, label); 222 // L'ecriture des labels (attention aux inversions possibles des axes!) 223 cw = (g->isAxeXDirRtoL()) ? -0.05*cellWidth : -0.95*cellWidth; 224 xu = g->DeltaUCX(XMax(),cw); 225 cw = (g->isAxeYDirUpDown()) ? -0.1*cH : -1.1*cH; 226 yu = g->DeltaUCY(YMax(),cw); 227 g->DrawString(xu,yu,label); 222 228 } 223 229
Note:
See TracChangeset
for help on using the changeset viewer.