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


Ignore:
Timestamp:
Aug 24, 2001, 1:08:42 PM (24 years ago)
Author:
cmv
Message:

Correc. bug display Statis si axes inverses cmv 24/08/2001

File:
1 edited

Legend:

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

    r1644 r1645  
    142142  PIGrCoord a, d;
    143143  double cH = (double)g->GetFontHeight(a,d);
    144   double cellHeight = cH * 3.6;
     144  double cellHeight = 3.6 * cH;
    145145
    146146  // 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());
    151151  label = label1;
    152152  if(strlen(label)<strlen(label2)) label = label2;
     
    154154  double cellWidth =  1.1 * (double)g->CalcStringWidth(label);
    155155
    156   double xu, yu;
     156  double xu, yu, cw;
    157157  // Les limites du cadre
    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);
     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);
    162162
    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);
    171176                       
    172177}
    173 
Note: See TracChangeset for help on using the changeset viewer.