Changeset 1644 in Sophya for trunk/SophyaPI/PIext/pihisto.cc


Ignore:
Timestamp:
Aug 23, 2001, 7:51:29 PM (24 years ago)
Author:
cmv
Message:

amelioration impress Statistiques histo et histo2d cmv 23/8/2001

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/pihisto.cc

    r1090 r1644  
    137137  //  if (mLAtt == PI_NotDefLineAtt)  g->SelLine(PI_ThinLine);
    138138  g->SelLine(PI_ThinLine);
    139   g->SelFontSz((YMax() - YMin())/25, mFAtt);
    140 //  double cellHeight = (YMax() - YMin()) * 0.05;
     139  g->SelFontSz((YMax() - YMin())/30, mFAtt);
     140
     141  // La hauteur de la cellule
    141142  PIGrCoord a, d;
    142143  double cH = (double)g->GetFontHeight(a,d);
    143144  double cellHeight = cH * 3.6;
    144 //  double cellWidth  = (XMax() - XMin()) * 0.23;
    145   char label[50];
    146   sprintf(label, "N= %8g    ", mHisto->NData());   label[11] ='\0';
    147   double cellWidth =  (double)g->CalcStringWidth(label) * 1.1;
     145
     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());
     151  label = label1;
     152  if(strlen(label)<strlen(label2)) label = label2;
     153  if(strlen(label)<strlen(label3)) label = label3;
     154  double cellWidth =  1.1 * (double)g->CalcStringWidth(label);
     155
    148156  double xu, yu;
     157  // Les limites du cadre
    149158  xu = g->DeltaUCX(XMax(), - cellWidth);
    150159  yu = g->DeltaUCY(YMax(), - cellHeight);
    151160  g->DrawLine(xu, YMax(), xu, yu);
    152161  g->DrawLine(xu, yu, XMax(), yu);
     162
     163  // L'ecriture des labels
    153164  xu = g->DeltaUCX(XMax(), - cellWidth*0.95);
    154165  yu = g->DeltaUCY(YMax(), - cH*1.15);
    155   g->DrawString(xu, yu, label);
    156   sprintf(label, "m= %8g", mHisto->Mean());  label[11] ='\0';
     166  g->DrawString(xu, yu, label1);
    157167  yu = g->DeltaUCY(YMax(), - cH*2.3);
    158   g->DrawString(xu, yu, label);
    159   sprintf(label, "s= %8g", mHisto->Sigma());  label[11] ='\0';
     168  g->DrawString(xu, yu, label2);
    160169  yu = g->DeltaUCY(YMax(), - cH*3.45);
    161   g->DrawString(xu, yu, label);
     170  g->DrawString(xu, yu, label3);
    162171                       
    163172}
Note: See TracChangeset for help on using the changeset viewer.