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


Ignore:
Timestamp:
Nov 3, 1999, 7:18:23 PM (26 years ago)
Author:
ercodmgr
Message:

Documentation + ameliorations DrawStats + vector->tvector pour Planck - Reza 3/11/99

File:
1 edited

Legend:

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

    r295 r544  
     1// Classe traceur d histogramme                 96-99
     2// CEA-DAPNIA      LAL-IN2P3/CNRS
     3
    14#include <stdio.h>
    25#include <typeinfo>
     
    58#include "hisprof.h"
    69
     10//++
     11// Class        PIHisto
     12// Lib          PIext
     13// include      pihisto.h
     14//
     15//      Classe traceur d'objet histogramme (classe *Histo*)
     16//--
     17//++
     18// Links        Parents
     19// PIDrawer
     20//--
     21//++
     22// Titre        Constructeur, méthodes
     23//--
     24//++
     25// PIHisto(Histo* histo, bool ad=false)
     26//      Constructeur. Si "ad == true", l'objet "histo" est détruit par
     27//      le destructeur de l'objet "PIHisto"
     28//      Note : "histo" doit être créé par new
     29//
     30// void  SetStats(bool fg=true)
     31//      Active/ désactive l'indication des statistiques d'histogramme
     32//--
     33
     34
    735PIHisto::PIHisto(Histo* histo, bool ad)
    836: PIDrawer(), mHisto(histo)
    937{
    1038  mAdDO = ad;     // Flag pour suppression automatique de mHisto
     39  SetStats(true);
    1140}
    1241
     
    96125  }
    97126  // A faire a la fin - DrawStats change l'attribut de ligne
    98   DrawStats(g);
     127  if (stats) DrawStats(g);
    99128}
    100129
     
    105134  //  if (mLAtt == PI_NotDefLineAtt)  g->SelLine(PI_ThinLine);
    106135  g->SelLine(PI_ThinLine);
    107   double cellHeight = (YMax() - YMin()) * 0.05;
    108   double cellWidth  = (XMax() - XMin()) * 0.23;
     136  g->SelFontSz((YMax() - YMin())/25, mFAtt);
     137//  double cellHeight = (YMax() - YMin()) * 0.05;
     138  PIGrCoord a, d;
     139  double cH = (double)g->GetFontHeight(a,d);
     140  double cellHeight = cH * 3.8;
     141//  double cellWidth  = (XMax() - XMin()) * 0.23;
     142  char label[50];
     143  sprintf(label, "N= %.8g    ", mHisto->NData());
     144  label[11] ='\0';
     145  double cellWidth =  (double)g->CalcStringWidth(label) * 1.1;
    109146  g->DrawLine(XMax() - cellWidth, YMax(),
    110147                       XMax() - cellWidth, YMax() - cellHeight);
    111148  g->DrawLine(XMax() - cellWidth, YMax() - cellHeight,
    112149                       XMax()            , YMax() - cellHeight);
    113   char label[50];
    114   sprintf(label, "N = %.6g", mHisto->NData());
    115   g->SelFontSz((YMax() - YMin())/30);
    116   g->DrawString(XMax() - cellWidth*0.9, YMax() - cellHeight*0.8, label);
     150  g->DrawString(XMax() - cellWidth*0.95, YMax() - cH*1.2, label);
     151  sprintf(label, "m= %.8g", mHisto->Mean());
     152  g->DrawString(XMax() - cellWidth*0.95, YMax() - cH*2.4, label);
     153  sprintf(label, "s= %.8g", mHisto->Sigma());
     154  g->DrawString(XMax() - cellWidth*0.95, YMax() - cH*3.6, label);
    117155                       
    118156}
Note: See TracChangeset for help on using the changeset viewer.