Index: /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h	(revision 380)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/dataManager.h	(revision 381)
@@ -53,5 +53,5 @@
   bool executeAll();
  
-   void donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor);
+  void donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor, string& titre, string& legendx, string& legendy);
 
   /**
@@ -63,8 +63,5 @@
     
     bool restoreElements(string inputFileName);
-
-
     
-    private :
     
 
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h	(revision 380)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h	(revision 381)
@@ -49,8 +49,15 @@
 double getUnnormalizedTranspPhaseSpaceArea(unsigned TranspIndexAbs, unsigned TranspIndexOrd);
 
+
+ unsigned pspaCoorIndexFromString(string nameCoor) const;
+ unsigned transportCoorIndexFromString(string nameCoor) const;
+
 inline double dimensionalFactorFromTransportToGraphics(unsigned index) {
-  if ( index == 0 || index == 2 || index == 4 ) return 10.;
-  else return  1.0;
+  if ( index == 0 || index == 2 || index == 4 ) return 10.;   // mm
+  else return  1.0;  // mrad
 }
+
+
+
 
  inline string transportVariableName(unsigned index) {
@@ -68,4 +75,7 @@
   }
  }
+
+
+
 
  inline string graphicTransportUnitName(unsigned index) {
@@ -107,7 +117,6 @@
   void printAllXYZ() const;
   void Zrange(double& zmin, double& zmax) const;
-  //  void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor);
-  void donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, unsigned indexAbs, unsigned indexOrd);
-  void particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd);
+  void donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey);
+  void particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey);
   virtual string FileOutputFlow() const;
   virtual bool FileInput(ifstream& ifs);
Index: /Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h	(revision 380)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/softwareParmela.h	(revision 381)
@@ -12,5 +12,5 @@
   // donc prevoir un offset pour le raccord a pspa
   unsigned offsetNumElem_;
-
+  //  vector<unsigned> relativeParmelaElementNumbers_;
 
   bool beamFromParmela(string workingDir,unsigned numeroElement, double referencefrequency, vector<double>& centroid, bareParticle& refPart,vector<bareParticle>& particles );
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 380)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/dataManager.cc	(revision 381)
@@ -5,5 +5,5 @@
 #include "softwareTransport.h"
 #include "GWt_pspaApplication.h"
-#include "GWt_console.h"
+#include "GWt_console.h"Ã
 #include "softwareGenerator.h"
 #include "softwareTest.h"
@@ -261,5 +261,5 @@
 
 // on ne tient pas compte des elements "snapshot" presents dans la beamLine
-void dataManager::donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor)
+void dataManager::donneesRmsEnveloppe(string type,vector<double>& xcor,vector<double>& ycor, string& titre, string& legendx, string& legendy)
 {
   double longueur = 0.0;
@@ -267,5 +267,8 @@
   xcor.clear();
   ycor.clear();
-
+  titre.clear();
+  titre = " rms enveloppe ";
+  legendx.clear();
+  legendx = " z (m)";
   if ( type == "x" ) {
     unsigned i = 0;
@@ -274,6 +277,6 @@
     for (unsigned k = firstComputedElemNumero_ -1 ; k < lastComputedElemNumero_ ; k++) {
       abstractElement* elPtr = pspa_->getBeamLine()->getAbstractElement(k);
-      if(elPtr->getNomdElement().getElementType() == snapshot) continue;
-      if(elPtr->getNomdElement().getElementType() == fit) continue;
+           if(elPtr->getNomdElement().getElementType() == snapshot) continue;
+      //      if(elPtr->getNomdElement().getElementType() == fit) continue;
 
       if ( !diagnosticBeam_.at(i).momentRepresentationOk() ) {
@@ -284,8 +287,10 @@
       valeur = diagnosticBeam_.at(i).getXmaxRms();
       cout << " dataManager::donneesRmsEnveloppe index = " << k <<  " longueur = " << longueur << " enveloppe : " << valeur << endl;
-      xcor.push_back(longueur);
+      xcor.push_back(0.01*longueur);  // on passe en metres
       ycor.push_back(valeur);
       i++;
     }
+    legendy.clear();
+    legendy = " x (cm) ";
   }
 }
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc	(revision 380)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc	(revision 381)
@@ -345,7 +345,15 @@
 
 
-void particleBeam::particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) {
+void particleBeam::particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey) {
+
+  unsigned indexAbs, indexOrd;
+  indexAbs = pspaCoorIndexFromString(namex);
+  indexOrd = pspaCoorIndexFromString(namey);
+ 
   particlesPhaseSpaceComponent(xcor, indexAbs);
   particlesPhaseSpaceComponent(ycor, indexOrd);
+  legende.clear();
+    legende.push_back( "phase space " + namex + "," + namey);
+    legende.push_back( "particle number : " +   mixedTools::intToString(getNbParticles()));
 }
 
@@ -360,5 +368,5 @@
   if ( index <= 2 ) {
     for (unsigned i = 0; i < goodPartic_.size(); ++i) {
-      coord.at(i) =  goodPartic_.at(i).getPosition().getComponent(index);
+      coord.at(i) =  10.*goodPartic_.at(i).getPosition().getComponent(index);  // en mm
     }
     return;
@@ -369,5 +377,5 @@
       double begamz = goodPartic_.at(i).getBetaGamma().getComponent(2);
       if ( begamz != 0.0) {
-	coord.at(i) =  1000.*goodPartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // mimmiradians
+	coord.at(i) =  1000.*goodPartic_.at(i).getBetaGamma().getComponent(index - 3)/begamz; // milliradians
       } else {
 	coord.at(i) = 0.0;
@@ -403,21 +411,61 @@
 }
 
-
-void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, unsigned indexAbs, unsigned indexOrd) {
+unsigned particleBeam::pspaCoorIndexFromString(string nameCoor) const {
+  if ( nameCoor == "x" ) {
+    return 0;
+  } else if ( nameCoor == "y" ) {
+    return 1;
+  } else if ( nameCoor == "dz" ) {
+    return 2;
+  } else if ( nameCoor == "xp" ) {
+    return 3;
+  } else if ( nameCoor == "yp" ) {
+    return 4;
+  } else if ( nameCoor == "dE/E" ) {
+    return 5;
+  } else {
+    return 99;
+  }
+}
+
+unsigned particleBeam::transportCoorIndexFromString(string nameCoor) const {
+  if ( nameCoor == "x" ) {
+    return 0;
+  } else if ( nameCoor == "y" ) {
+    return 2;
+  } else if ( nameCoor == "dz" ) {
+    return 4;
+  } else if ( nameCoor == "xp" ) {
+    return 1;
+  } else if ( nameCoor == "yp" ) {
+    return 3;
+  } else if ( nameCoor == "dE/E" ) {
+    return 5;
+  } else {
+    return 99;
+  }
+}
+
+//void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, unsigned indexAbs, unsigned indexOrd) {
+
+void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, vector<string>& legende, string namex, string namey) {
   int k;
   double x,y;
-  cout << " particleBeam::donneesDessinEllipse index recus x" << indexAbs << " index y " << indexOrd << endl;
-
-  if ( !momentRepresentationOk_ ) return;
-
-  if ( indexAbs > 5 || indexOrd > 5 ) return;
+  if ( !momentRepresentationOk_ ) buildMomentRepresentation();
+
+  //  if ( !momentRepresentationOk_ ) return;
+
+  unsigned indexAbs, indexOrd;
+
+
+  // index TRANSPORT
+  indexAbs = transportCoorIndexFromString(namex);
+  indexOrd = transportCoorIndexFromString(namey);
+  cout << " namex= " << namex << " indexAbs= " << indexAbs << " namey= " << namey << " indexOrd= " << indexOrd << endl; 
+    if ( indexAbs > 5 || indexOrd > 5 ) return;
 
   xcor.clear();
   ycor.clear();
-  // les index sont dans l'ordre x,y,z,xp,yp, de/E
-  // on traduit en TRANSPORT
-
-  indexAbs = indexFromPspaToTransport(indexAbs);
-  indexOrd = indexFromPspaToTransport(indexOrd);
+
 
 
@@ -427,5 +475,5 @@
 
 
-  // a completer 
+
   legende.clear();
   //  if ( indexAbs == 0 && indexOrd == 1 ) {
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc	(revision 380)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc	(revision 381)
@@ -112,4 +112,6 @@
 }
 
+
+
 bool softwareParmela::buildBeamAfterElements(unsigned int numeroDeb,unsigned int numeroFin, vector<particleBeam>& beams, string workingDir)
 {
@@ -130,7 +132,7 @@
 	string cliche = workingDir + param[2].c_str();
 	if( beamToParmela(cliche,&beams.at(avantDernier)) ) {
-	  cout<<"["<<k<<"] : ecrit sur fichier " << cliche << " le contenu de beam["<<avantDernier<<"]"<<endl;
+	  cout  <<  "["  <<  k  <<  "] : ecrit sur fichier " << cliche << " le contenu de beam["<<avantDernier<<"]"<<endl;
 	}
-	continue;
+	// continue;
       }
       
@@ -144,4 +146,5 @@
       double freq= globParamPtr_->getFrequency();
       
+      cout << " lecture PARMELA el no absolu " << k << " nom " << elem->getNomdElement().getElementName() << endl;
       if(!beamFromParmela(workingDir,id,freq,centroid,refPart,particles))
         {
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc	(revision 380)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareTransport.cc	(revision 381)
@@ -153,5 +153,5 @@
 	string cliche = workingDir + param[2].c_str();
 	 cout<<"["<<k<<"] : ecrit sur fichier " << cliche << " le contenu de beam["<<avantDernier<<"]"<<endl;
-	 continue;
+	 //	 continue;
       }
 
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 380)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 381)
@@ -84,10 +84,12 @@
   
   void dialogOnGraphics();
-  //  void setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent); 
-void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey  );
-  void faireDessinTransport(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey);
+  void faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string namex, string namey, int typeFaisceau);
+
+ //  void setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent); 
+void faireDessinParmela(WContainerWidget* toto, particleBeam* beam, string namex, string namey  );
+  void faireDessinTransport(WContainerWidget* toto, particleBeam* beam, string namex, string namey);
   void faireDessinEnveloppe(WContainerWidget* toto, string type);
   //  void scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor);
-  void chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints, int width, int height, bool makeIcon=false);
+  void chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints, string title, string legendx, string legendy, int width, int height, bool makeIcon=false);
   bool removePathFromConfigName(string& config);
   bool removeExtensionFromConfigName(string& config);
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 380)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 381)
@@ -512,13 +512,11 @@
   int typeFaisceau = choixTypeDessinFaisceau_->currentIndex();
   int index = choixElementDessin_->currentIndex();
-  unsigned xabs = choixAbsPhase_->currentIndex();
-  unsigned yord = choixOrdPhase_->currentIndex();
-  if ( xabs == yord ) {
+  string nameAbs = choixAbsPhase_->currentText().toUTF8();
+  string nameOrd = choixOrdPhase_->currentText().toUTF8();
+  if ( nameAbs == nameOrd ) {
 	GWt_dialog phaseSpaceError(" graphical analysis", "the beam coordinates must be different !", GWt_dialog::Error, false,true);
 	phaseSpaceError.exec();
 	return;
   }
-  string nameAbs = choixAbsPhase_->currentText().toUTF8();
-  string nameOrd = choixOrdPhase_->currentText().toUTF8();
 
   particleBeam* beam = dtmanage_->getDiagnosticBeam(index);
@@ -531,23 +529,23 @@
     
     toto_->clear();
-  
-  if ( typeFaisceau == 0 )
-    {
-      if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();
-      cout << " PspaApplication::dessinerPhaseSpace cood cliquees " << xabs << " " << yord << endl;
-      faireDessinTransport(toto_, beam, xabs, yord, nameAbs, nameOrd );
-    }
-  else if ( typeFaisceau == 1 )
-    {
-      if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, xabs, yord, nameAbs, nameOrd );
-      else {
-	GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
-	warningBeamState.exec();
-      }
-    }
-  else {
-    GWt_dialog warningTypeDrawing(" graphical analysis", "type of  drawing not programmed !", GWt_dialog::Error, false,true);
-    warningTypeDrawing.exec();
-  }
+    faireDessinPhaseSpace(toto_, beam, nameAbs, nameOrd, typeFaisceau);
+
+  // if ( typeFaisceau == 0 )
+  //   {
+  //     if ( !beam->momentRepresentationOk() ) beam->buildMomentRepresentation();
+  //     faireDessinTransport(toto_, beam, nameAbs, nameOrd );
+  //   }
+  // else if ( typeFaisceau == 1 )
+  //   {
+  //     if ( beam->particleRepresentationOk() ) faireDessinParmela(toto_, beam, nameAbs, nameOrd );
+  //     else {
+  // 	GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
+  // 	warningBeamState.exec();
+  //     }
+  //   }
+  // else {
+  //   GWt_dialog warningTypeDrawing(" graphical analysis", "type of  drawing not programmed !", GWt_dialog::Error, false,true);
+  //   warningTypeDrawing.exec();
+  // }
 }
 
@@ -579,11 +577,54 @@
   vector<double> xcor;
   vector<double> ycor;
-  // dtmanage_->donneesRmsEnveloppe(type,1, nbel, xcor,ycor);
-    dtmanage_->donneesRmsEnveloppe(type,xcor,ycor);
-    chartPlot2vec(envDialog->contents(), xcor, ycor, false,500,300);
-
-}
-
-void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey )
+    string titre;
+    string legendx;
+    string legendy;
+    dtmanage_->donneesRmsEnveloppe(type,xcor,ycor, titre, legendx, legendy);
+    chartPlot2vec(envDialog->contents(), xcor, ycor, false,titre, legendx, legendy,500,300);
+
+}
+
+void PspaApplication::faireDessinPhaseSpace(WContainerWidget* toto, particleBeam* beam, string namex, string namey, int typeFaisceau)
+{
+
+  vector<double> xcor;
+  vector<double> ycor;
+  vector<string> legende;
+  string titre;
+  bool pointsDrawing;
+  if ( typeFaisceau == 0 ) {
+    pointsDrawing = false;
+    titre = "phase space rms";
+    beam->donneesDessinEllipse(xcor,ycor,legende, namex, namey);
+  } else if (  typeFaisceau == 1 ) {
+    pointsDrawing = true;
+    titre = " phase space ";
+    beam->particlesPhaseSpaceData(xcor, ycor, legende, namex, namey);
+  } else {
+	GWt_dialog warningBeamState(" graphical analysis", "the beam state does not allow providing a drawing with macroparticles !", GWt_dialog::Error, false,true);
+	warningBeamState.exec();
+	return;
+  }
+
+
+  GWt_dialog* phaseSpaceDialog = new GWt_dialog("phase space",toto,false);
+  eDialog_.push_back(phaseSpaceDialog);
+  phaseSpaceDialog->setMinimumSize(400,400);
+  phaseSpaceDialog->setClosable(true);
+  new WText(nameOfCase_, phaseSpaceDialog->contents());
+  
+
+  for (int k=0 ; k < legende.size(); k++) {
+    new WBreak(phaseSpaceDialog->contents());
+    new WText(legende.at(k), phaseSpaceDialog->contents());
+  }
+  chartPlot2vec(phaseSpaceDialog->contents(), xcor, ycor,pointsDrawing ,titre, namex, namey,500,300);
+  phaseSpaceDialog->show();
+
+}
+
+
+
+void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, string namex, string namey )
 {
   cout << " faireDessinParmela " << endl;
@@ -594,11 +635,17 @@
   // pointsDialog->show();
       
-  //    vector<bareParticle>& partic = beam->getParticleVector();
-  new WText(nameOfCase_ + " : phase space " + namex + " ," + namey + " ; particle number : "+ mixedTools::intToString(beam->getNbParticles()), pointsDialog->contents());
+  new WText(nameOfCase_, pointsDialog->contents());
+
 
   vector<double> xcor;
   vector<double> ycor;
-  beam->particlesPhaseSpaceData(xcor, ycor, indexAbs, indexOrd);
-  chartPlot2vec(pointsDialog->contents(), xcor, ycor, true,400,400);
+  vector<string> legende;
+  beam->particlesPhaseSpaceData(xcor, ycor, legende, namex, namey);
+  for (int k=0 ; k < legende.size(); k++) {
+    new WBreak(pointsDialog->contents());
+    new WText(legende.at(k), pointsDialog->contents());
+  }
+  string titre = " phase space ";
+  chartPlot2vec(pointsDialog->contents(), xcor, ycor, true,titre,namex, namey,400,400);
 
 
@@ -610,5 +657,5 @@
 }
 
-void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey)
+void PspaApplication::faireDessinTransport(WContainerWidget* toto, particleBeam* beam, string namex, string namey)
 {
   GWt_dialog* ellipseDialog = new GWt_dialog("ellipse",toto,false);
@@ -622,5 +669,5 @@
   vector<double> ycor;
   vector<string> legende;
-  beam->donneesDessinEllipse(xcor,ycor,legende, indexAbs, indexOrd);
+  beam->donneesDessinEllipse(xcor,ycor,legende, namex, namey);
 
   for (int k=0 ; k < legende.size(); k++) {
@@ -628,70 +675,11 @@
     new WText(legende.at(k), ellipseDialog->contents());
   }
-  //  beam->donneesDessinEllipseXxp(xcor,ycor);
-  //  scatterPlot1D(ellipseDialog->contents(),xcor,ycor);  
-  chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false,500,300);
-}
-
-// void PspaApplication::scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor)
-// {
-//     int nbpts = xcor.size();
-//     cout << " PspaApplication::scatterPlot1D nbpts = " << nbpts << endl;
-//     WStandardItemModel *model = new WStandardItemModel(nbpts, 2, toto);
-//     for (int i = 0; i < nbpts; ++i) {
-//         model->setData(i, 0, xcor.at(i));
-//         model->setData(i, 1, ycor.at(i));
-//         //    cout << " PspaApplication::scatterPlot1D el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
-//     }
-    
-//     WCartesianChart *chart = new WCartesianChart(toto);
-//     chart->setTitle("titre");
-    
-//     //  chart->initLayout();
-    
-//     chart->setModel(model);        // set the model
-//     chart->setXSeriesColumn(0);    // set the column that holds the X data
-//     chart->setLegendEnabled(true); // enable the legend
-    
-//     chart->setType(ScatterPlot);   // set type to ScatterPlot
-    
-//     // Typically, for mathematical functions, you want the axes to cross
-//     // at the 0 mark:
-//     chart->axis(XAxis).setLocation(ZeroValue);
-//     chart->axis(YAxis).setLocation(ZeroValue);
-    
-//     // Provide space for the X and Y axis and title.
-//     //   chart->setPlotAreaPadding(80, Left);
-//     //   chart->setPlotAreaPadding(40, Top | Bottom);
-//     // Add the curves
-//     WDataSeries s(1, LineSeries, Y1Axis);
-//     chart->addSeries(s);
-    
-//     // chart->setBackground (WBrush(WColor("blue")));
-//     chart->resize(500, 300); // WPaintedWidget must be given explicit size
-    
-// #ifdef HAS_IMAGEMAGIC
-//     Wt::WRasterImage pngImage("png", 600, 600);
-//     Wt::WPainter p(&pngImage);
-    
-//     chart->paint(p);
-//     std::string name;
-//     name = workingDir_ + "/chart-"+sessionId ()+".png";
-//     std::ofstream f(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
-//     pngImage.write(f);
-    
-//     new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
-    
-//     /*
-//      Wt::WPdfImage pdfImage("30cm", "30cm");
-//      Wt::WPainter p1(&pdfImage);
-//      chart->paint(p1);
-//      std::ofstream f1("chart.pdf", std::ios::out | std::ios::binary);
-//      pdfImage.write(f1);
-//      */
-// #endif
-// }
-
-// dernier parametre, drawPoints : true = on trace des points (phase space) ; false = on trace des lignes 'enveloppes...) 
-void PspaApplication::chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints,int width, int height, bool makeIcon)
+  string titre = "phase space rms";
+  chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false,titre, namex, namey,500,300);
+}
+
+
+// parametre drawPoints : true = on trace des points (phase space) ; false = on trace des lignes (enveloppes...) 
+void PspaApplication::chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints,string title,string legendx, string legendy,int width, int height, bool makeIcon)
 {
     int nbpts = xcor.size();
@@ -706,5 +694,5 @@
     WCartesianChart *chart = new WCartesianChart(toto);
     if (!makeIcon) {
-        chart->setTitle("titre");
+        chart->setTitle(title);
     }
     chart->initLayout();
@@ -726,15 +714,28 @@
 
     // Provide space for the X and Y axis and title.
-    if ( drawPoints ) {
-      chart->setPlotAreaPadding(80, Left);
-      chart->setPlotAreaPadding(40, Top | Bottom);
-      WDataSeries s(1, PointSeries, Y1Axis);
-      chart->addSeries(s);
-      chart->resize(width, height); // WPaintedWidget must be given explicit size
-     } else {
+      chart->setPlotAreaPadding(80, Left);  // ?
+      chart->setPlotAreaPadding(40, Bottom);
+      chart->setPlotAreaPadding(60, Top);
+      if ( drawPoints ) {
+       WDataSeries s(1, PointSeries, Y1Axis);
+       chart->addSeries(s);    
+      } else {
        WDataSeries s(1, LineSeries, Y1Axis);
        chart->addSeries(s);    
+      }
        chart->resize(width, height); // WPaintedWidget must be given explicit size
-     }
+
+
+       WAxis& axis = chart->axis(XAxis);
+       axis.setLabelFormat("%.3f");
+       //       axis.setGridLinesEnabled(true);
+       axis.setTitle(legendx);
+
+       WAxis& axey = chart->axis(YAxis);
+       axey.setTitle(legendy);
+       // axis = chart->axis(YAxis);
+       // axis.setLabelFormat("%.3f");
+       // axis.setGridLinesEnabled(true);
+       // axis.setTitle(legendy);
 
     if (makeIcon) {
@@ -903,5 +904,5 @@
   string unites[2];
   if(iabs == 0 || iabs == 1 || iabs == 2) {
-    unites[0]= unites[1]= " cm";
+    unites[0]= unites[1]= " mm";
   }
   if(iabs == 3 || iabs == 4) {
@@ -942,7 +943,7 @@
   axis.setGridLinesEnabled(true);
 
-  if(iabs == 0) axis.setTitle(WString(" x (cm)"));
-  if(iabs == 1) axis.setTitle(WString(" y (cm)"));
-  if(iabs == 2) axis.setTitle(WString(" z (cm)"));
+  if(iabs == 0) axis.setTitle(WString(" x (mm)"));
+  if(iabs == 1) axis.setTitle(WString(" y (mm)"));
+  if(iabs == 2) axis.setTitle(WString(" z (mm)"));
   if(iabs == 3) axis.setTitle(WString(" xp (mrad)"));
   if(iabs == 4) axis.setTitle(WString(" yp (mrad)"));
Index: /Interface_Web/trunk/pspaWT/workingArea/philFit.save
===================================================================
--- /Interface_Web/trunk/pspaWT/workingArea/philFit.save	(revision 380)
+++ /Interface_Web/trunk/pspaWT/workingArea/philFit.save	(revision 381)
@@ -3,5 +3,5 @@
 rfgun
 rfgun01
-1500  5  0.1
+500  5  0.1
 0  0
 1e-06 1e-12
