Index: trunk/SophyaPI/PI/pibargraph.cc
===================================================================
--- trunk/SophyaPI/PI/pibargraph.cc	(revision 2547)
+++ trunk/SophyaPI/PI/pibargraph.cc	(revision 2549)
@@ -41,5 +41,7 @@
   fgFill = fill;
   fgHoriz = horiz;
+  fgValLabel = false;
   packFrac = 0.5;
+  SetName("BarGraph");
 } 
 
@@ -80,5 +82,5 @@
 {
   double tmp = a;
-  a = b;  b = a;
+  a = b;  b = tmp;
 }
 
@@ -109,5 +111,5 @@
 {
   PIGrCoord tmp = a;
-  a = b;  b = a;
+  a = b;  b = tmp;
 }
 
@@ -119,4 +121,5 @@
   double larg = packFrac*(idMax-idMin)/mBars.size();
   for(unsigned int k=0; k<mBars.size(); k++) {
+    PIColors dcol = g->GetForeground();
     x = mBars[k].id-0.5*larg; dx = larg;
     y = 0.; dy = mBars[k].val;
@@ -127,17 +130,36 @@
     }  
     if (fgFill) g->DrawFBox(x,y,dx,dy);
-    else { 
-      g->DrawBox(x,y,dx,dy);
-      if ( mBars[k].lab.length() > 0 ) {
-	x = mBars[k].id;
-	y = 0.5*mBars[k].val;
-	if (fgHoriz) 
-	  g->DrawString(y, x, mBars[k].lab.c_str(), 
-			PI_VerticalCenter|PI_HorizontalCenter|PI_TextDirectionHorizontal);
-	else 
-	  g->DrawString(x, y, mBars[k].lab.c_str(), 
-			PI_VerticalCenter|PI_HorizontalCenter|PI_TextDirectionVerticalUp);
-      }
-    }
+    else  g->DrawBox(x,y,dx,dy);
+    if ((mBars[k].lab.length() == 0 ) && !fgValLabel ) continue;
+    string lab = mBars[k].lab;
+    if (fgValLabel) {
+      char buff[32];
+      sprintf(buff, " %g ", mBars[k].val);
+      lab = buff;
+    }
+    x = mBars[k].id;
+    y = mBars[k].val;
+    double fy = y;
+    bool fgneg = false;
+    bool fgin = false;
+    if (fy > 0.) {
+      if (fy > mMax/2.)  { fgin = true;  fy *= 0.95; }
+      else fy *= 1.05;
+    }
+    else {
+      fgneg = true;
+      if (fy < mMin/2.)  { fgin = true;  fy *= 0.95; }
+      else fy *= 1.05;
+    }
+    y  = fy;
+    unsigned long pflg = PI_VerticalCenter|PI_HorizontalLeft;
+    if ( (fgin && !fgneg) || (!fgin && fgneg) ) pflg = PI_VerticalCenter|PI_HorizontalRight;
+    if (fgHoriz)  pflg |= PI_TextDirectionHorizontal;
+    else pflg |= PI_TextDirectionVerticalUp;
+    if (fgHoriz)  swap_ifhoriz_g(x, y);
+     if (fgin) g->DrawOpaqueString(x, y, lab.c_str(), pflg);
+    else g->DrawString(x, y, lab.c_str(), pflg);
+
+    if (mBars[k].col != PI_NotDefColor) g->SelForeground(dcol);
   }
 }
@@ -164,8 +186,10 @@
     else if (opts=="fill")  SetFill(true);
     else if (opts=="nofill")  SetFill(false);
-    else if (opts=="packfrac=") {
+    else if (opts.substr(0,9)=="packfrac=") {
       double frac = atof(opts.substr(9).c_str()); 
       SetPacking(frac);
     }
+    else if (opts=="barvaluelabel")  UseBarValueAsLabel(true);
+    else if (opts=="nobarvaluelabel")  UseBarValueAsLabel(false);
     else {
       // Si option non decode
@@ -187,4 +211,5 @@
  if (fgHoriz) opt.push_back("horizontalbars"); else opt.push_back("verticalbars");
  if (fgFill) opt.push_back("fill");  else opt.push_back("nofill");
+ if (fgValLabel) opt.push_back("barvaluelabel");  else opt.push_back("nobarvaluelabel");
  char buff[64];
  sprintf(buff,"packfrac=%g", packFrac);
@@ -200,4 +225,5 @@
 info += "  horizontalbars/verticalbars: set bar orientation \n";
 info += "  packfrac=value : set bar packing fraction (0..1) \n";
+info += "  barvaluelabel/nobarvaluelabel: Use/Don't use bar value as labels \n";
 info += " --- + Usual colr/line/font  attribute decoding ... \n";
 PIDrawer::GetOptionsHelpInfo(info);
Index: trunk/SophyaPI/PI/pibargraph.h
===================================================================
--- trunk/SophyaPI/PI/pibargraph.h	(revision 2547)
+++ trunk/SophyaPI/PI/pibargraph.h	(revision 2549)
@@ -31,5 +31,8 @@
   // Fraction de remplissage des bars
   inline  void       SetPacking(double frac=0.5) { packFrac=frac; }
+  // Use Bar values as labels
+  inline  void	     UseBarValueAsLabel(bool fg=true) { fgValLabel = fg; }
 
+  // ------------------------------
   virtual void       Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax);
   virtual void       UpdateLimits();
@@ -49,4 +52,5 @@
   double idMin, idMax;
   bool fgFill, fgHoriz;
+  bool fgValLabel;   // Use values as labels
   double packFrac;
  };
Index: trunk/SophyaPI/PI/pitxtdrw.cc
===================================================================
--- trunk/SophyaPI/PI/pitxtdrw.cc	(revision 2547)
+++ trunk/SophyaPI/PI/pitxtdrw.cc	(revision 2549)
@@ -39,4 +39,5 @@
 {
   fgFrame = fgframe;
+  SetName("TextDrw");
 } 
 
Index: trunk/SophyaPI/PI/piversion.h
===================================================================
--- trunk/SophyaPI/PI/piversion.h	(revision 2547)
+++ trunk/SophyaPI/PI/piversion.h	(revision 2549)
@@ -2,5 +2,5 @@
 #define PIVERSION_H_SEEN
 
-#define PI_VERSIONNUMBER  3.97
+#define PI_VERSIONNUMBER  3.98
 
 #endif
