Index: /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h	(revision 353)
+++ /Interface_Web/trunk/pspaWT/sources/controler/include/particleBeam.h	(revision 354)
@@ -17,13 +17,28 @@
   bool particleRepresentationOk_;
   bool momentRepresentationOk_;
-  bareParticle referenceParticle_;
   beam2Moments rij_;
   double P0Transport_;
 
+  // la representation du faisceau de particules sera a preciser ulterieurement 
+  // Pour l'instant une particule courante est definie par : 
+  // x
+  // y
+  // deltaz = z - z0 (z0 est le z de la particule de reference)
+  // gamma.betax
+  // gamma.betay
+  // gamma.betaz
   vector<bareParticle> goodPartic_;
+
+  // par ailleurs, la particules de reference est definie par x,y,z,gamma.betax, gamma.betay, gamma.betaz
+  // elle est dupliquee dans le faisceau prorement dit (goodPartic_) avec z = z-z0 et ne doit, par consequent,
+  // pas etre prise en compte dans les calculs de trajectoire.
+  bareParticle referenceParticle_;
+  
+
   vector<double> centroid_;
 
   void impressionDesMoments() const;
   void razDesMoments();
+  void particlesPhaseSpaceComponent(vector<double>& coord, unsigned index);
 
  public:
@@ -51,7 +66,7 @@
   void printAllXYZ() const;
   void Zrange(double& zmin, double& zmax) const;
-  void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor);
+  //  void donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor);
   void donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd);
-
+  void particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd);
   virtual string FileOutputFlow() const;
   virtual bool FileInput(ifstream& ifs);
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc	(revision 353)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/particleBeam.cc	(revision 354)
@@ -333,5 +333,128 @@
 }
 
-void particleBeam::donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor) {
+// void particleBeam::donneesDessinEllipseXxp(vector<double>& xcor, vector<double>& ycor) {
+//   int k;
+//   double x,y;
+
+//   if ( !momentRepresentationOk_ ) return;
+
+//   xcor.clear();
+//   ycor.clear();
+
+//   double xm = ( rij_.getMatrix().at(0) ).at(0);
+//   double ym = ( rij_.getMatrix().at(1) ).at(1);
+//   double r  = ( rij_.getMatrix().at(1) ).at(0);
+
+//   cout <<  " racs11= " << xm << " racs22= " << ym << " r12= " << r << endl;
+
+
+//   int nbintv = 50;
+//   if ( xm == 0.0 ) return;
+//   double pas = 2.0 * xm / nbintv;
+
+//   //  cout << " r= " << r << endl;
+//   double rac = (1 - r*r);
+//   if ( rac > 0.0 ) 
+//     {
+//       cout << " cas rac > " << endl;
+//       rac = sqrt(1 - r*r);
+//       double alpha = -r / rac;
+//       double beta = xm / ( ym * rac);
+//       //  double gamma = ym / ( xm * rac );
+//       double epsil = xm * ym * rac;
+//       double fac1 = -1.0 / ( beta * beta);
+//       double fac2 = epsil/beta;
+//       double fac3 = -alpha/beta;
+//       double aux;
+//       for ( k=0; k < nbintv; k++)
+// 	{
+// 	  x = -xm + k*pas;
+// 	  aux = fac1 * x * x + fac2;
+// 	  //     cout << " aux2= " << aux << endl;
+// 	  if ( aux <= 0.0 )
+// 	    {
+// 	      aux = 0.0;
+// 	    }
+// 	  else aux = sqrt(aux);
+      
+// 	  //        y = fac3*x;
+// 	  y = fac3*x + aux;
+// 	  xcor.push_back(x);
+// 	  ycor.push_back(y);
+// 	}
+
+//       for ( k=0; k <= nbintv; k++)
+// 	{
+// 	  x = xm - k*pas;
+// 	  aux =  fac1 * x * x + fac2;
+// 	  if ( aux <= 0.0 ) 
+// 	    {
+// 	      aux = 0.0;
+// 	    }
+// 	  else aux = sqrt(aux);
+// 	  //   y = fac3*x;
+// 	  y = fac3*x - aux;
+// 	  xcor.push_back(x);
+// 	  ycor.push_back(y);
+// 	}
+//     }
+//   else
+//     // cas degenere
+//     {
+//       cout << " cas degenere " << endl;
+//       double fac = ym/xm;
+//       for ( k=0; k < nbintv; k++)
+// 	{
+// 	  x = -xm + k*pas;
+// 	  y = fac*x;
+// 	  xcor.push_back(x);
+// 	  ycor.push_back(y);
+// 	}
+	
+//     }
+// }
+
+void particleBeam::particlesPhaseSpaceData(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) {
+  particlesPhaseSpaceComponent(xcor, indexAbs);
+  particlesPhaseSpaceComponent(ycor, indexOrd);
+}
+
+void particleBeam::particlesPhaseSpaceComponent(vector<double>& coord, unsigned index) {
+  if ( !particleRepresentationOk_ ) return;
+  coord.clear();
+  coord.resize(goodPartic_.size(), 0.0 );
+  cout << " particleBeam::particlesPhaseSpaceComponent index = " << index << endl;
+  if ( index <= 2 ) {
+    for (unsigned i = 0; i < goodPartic_.size(); ++i) {
+      coord.at(i) =  goodPartic_.at(i).getPosition().getComponent(index);
+    }
+    return;
+  }
+
+  if ( index >  2 && index < 5 ) {
+    for (unsigned i = 0; i < goodPartic_.size(); ++i) {
+      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
+      } else {
+	coord.at(i) = 0.0;
+      }
+    }
+    return;
+  }
+
+  if ( index == 5 ) {
+    double gamma0 = referenceParticle_.getGamma();
+    cout << " gamma0 = " << gamma0 << endl;
+    if ( gamma0 == 0.0 ) return;
+    for (unsigned i = 0; i < goodPartic_.size(); ++i) {
+      coord.at(i) =  100.*(goodPartic_.at(i).getGamma() - gamma0)/gamma0;  // en %
+      cout << " gamma0 = " << gamma0 << " gamma = " << goodPartic_.at(i).getGamma() << endl;
+    }
+    return;
+  }
+}
+
+void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) {
   int k;
   double x,y;
@@ -339,10 +462,30 @@
   if ( !momentRepresentationOk_ ) return;
 
+  if ( indexAbs > 5 || indexOrd > 5 ) return;
+
   xcor.clear();
   ycor.clear();
-
-  double xm = ( rij_.getMatrix().at(0) ).at(0);
-  double ym = ( rij_.getMatrix().at(1) ).at(1);
-  double r  = ( rij_.getMatrix().at(1) ).at(0);
+  // les index sont dans l'ordre x,y,z,xp,yp, de/E
+  // on traduit en TRANSPORT
+  if ( indexAbs == 1 ) indexAbs = 2;  // y
+  if ( indexAbs == 2 ) indexAbs = 4;  // z -> l
+  if ( indexAbs == 3 ) indexAbs = 1;  // xp
+  if ( indexAbs == 4 ) indexAbs = 3;  // yp
+
+  if ( indexOrd == 1 ) indexOrd = 2;  // y
+  if ( indexOrd == 2 ) indexOrd = 4;  // z -> l
+  if ( indexOrd == 3 ) indexOrd = 1;  // xp
+  if ( indexOrd == 4 ) indexOrd = 3;  // yp
+
+  cout << " index x" << indexAbs << " index y " << indexOrd << endl;
+
+  double xm = ( rij_.getMatrix().at(indexAbs) ).at(indexAbs);
+  double ym = ( rij_.getMatrix().at(indexOrd) ).at(indexOrd);
+  double r;
+  if ( indexOrd > indexAbs ) {
+    r  = ( rij_.getMatrix().at(indexOrd) ).at(indexAbs);
+  } else {
+    r  = ( rij_.getMatrix().at(indexAbs) ).at(indexOrd);
+  }
 
   cout <<  " racs11= " << xm << " racs22= " << ym << " r12= " << r << endl;
@@ -415,108 +558,4 @@
 }
 
-
-
-void particleBeam::donneesDessinEllipse(vector<double>& xcor, vector<double>& ycor, unsigned indexAbs, unsigned indexOrd) {
-  int k;
-  double x,y;
-
-  if ( !momentRepresentationOk_ ) return;
-
-  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
-  if ( indexAbs == 1 ) indexAbs = 2;  // y
-  if ( indexAbs == 2 ) indexAbs = 4;  // z -> l
-  if ( indexAbs == 3 ) indexAbs = 1;  // xp
-  if ( indexAbs == 4 ) indexAbs = 3;  // yp
-
-  if ( indexOrd == 1 ) indexOrd = 2;  // y
-  if ( indexOrd == 2 ) indexOrd = 4;  // z -> l
-  if ( indexOrd == 3 ) indexOrd = 1;  // xp
-  if ( indexOrd == 4 ) indexOrd = 3;  // yp
-
-  cout << " index x" << indexAbs << " index y " << indexOrd << endl;
-
-  double xm = ( rij_.getMatrix().at(indexAbs) ).at(indexAbs);
-  double ym = ( rij_.getMatrix().at(indexOrd) ).at(indexOrd);
-  double r;
-  if ( indexOrd > indexAbs ) {
-    r  = ( rij_.getMatrix().at(indexOrd) ).at(indexAbs);
-  } else {
-    r  = ( rij_.getMatrix().at(indexAbs) ).at(indexOrd);
-  }
-
-  cout <<  " racs11= " << xm << " racs22= " << ym << " r12= " << r << endl;
-
-
-  int nbintv = 50;
-  if ( xm == 0.0 ) return;
-  double pas = 2.0 * xm / nbintv;
-
-  //  cout << " r= " << r << endl;
-  double rac = (1 - r*r);
-  if ( rac > 0.0 ) 
-    {
-      cout << " cas rac > " << endl;
-      rac = sqrt(1 - r*r);
-      double alpha = -r / rac;
-      double beta = xm / ( ym * rac);
-      //  double gamma = ym / ( xm * rac );
-      double epsil = xm * ym * rac;
-      double fac1 = -1.0 / ( beta * beta);
-      double fac2 = epsil/beta;
-      double fac3 = -alpha/beta;
-      double aux;
-      for ( k=0; k < nbintv; k++)
-	{
-	  x = -xm + k*pas;
-	  aux = fac1 * x * x + fac2;
-	  //     cout << " aux2= " << aux << endl;
-	  if ( aux <= 0.0 )
-	    {
-	      aux = 0.0;
-	    }
-	  else aux = sqrt(aux);
-      
-	  //        y = fac3*x;
-	  y = fac3*x + aux;
-	  xcor.push_back(x);
-	  ycor.push_back(y);
-	}
-
-      for ( k=0; k <= nbintv; k++)
-	{
-	  x = xm - k*pas;
-	  aux =  fac1 * x * x + fac2;
-	  if ( aux <= 0.0 ) 
-	    {
-	      aux = 0.0;
-	    }
-	  else aux = sqrt(aux);
-	  //   y = fac3*x;
-	  y = fac3*x - aux;
-	  xcor.push_back(x);
-	  ycor.push_back(y);
-	}
-    }
-  else
-    // cas degenere
-    {
-      cout << " cas degenere " << endl;
-      double fac = ym/xm;
-      for ( k=0; k < nbintv; k++)
-	{
-	  x = -xm + k*pas;
-	  y = fac*x;
-	  xcor.push_back(x);
-	  ycor.push_back(y);
-	}
-	
-    }
-}
-
 void particleBeam::histogramme(vector<double>&xcor,vector<int>& hist,int& cnts,double out[3])
 {
Index: /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc	(revision 353)
+++ /Interface_Web/trunk/pspaWT/sources/controler/src/softwareParmela.cc	(revision 354)
@@ -163,4 +163,5 @@
 bool softwareParmela::beamFromParmela(string workingDir,unsigned numeroParmel, double referencefrequency, vector<double>& centroid, bareParticle& refPart,vector<bareParticle>& particles ) 
 {
+
   string nomfilefais = workingDir + "parmdesz";
   cout << " nom fichier desz : " << nomfilefais << endl;
@@ -183,5 +184,4 @@
 
       if ( partic.ne == (int)numeroParmel ) {
-	faisceau.push_back(partic);
 	if ( partic.np == 1 ) {
 	  // en principe on est sur la particule de reference
@@ -191,5 +191,7 @@
 	  }
 	  phaseRef = partic.phi;
-	  TRIDVECTOR  posRef(partic.xx,partic.yy,0.0);
+
+	  // le 'z' est 'absolu' (le long de la trajectoire)
+	  TRIDVECTOR  posRef(partic.xx,partic.yy,partic.z);
 	  TRIDVECTOR betagammaRef(partic.xxp*partic.begamz, partic.yyp*partic.begamz, partic.begamz);
 	  refPart = bareParticle(posRef, betagammaRef);
@@ -200,5 +202,6 @@
 	    return false;
 	  }
-	}
+	} 
+	faisceau.push_back(partic); 
       }
     } //while
Index: /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
===================================================================
--- /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 353)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h	(revision 354)
@@ -78,10 +78,10 @@
   
   void dialogOnGraphics();
-  void setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent); 
+  //  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 faireDessinEnveloppe(WContainerWidget* toto, string type);
-  void scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor);
-    
+  //  void scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor);
+  void chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints);
   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 353)
+++ /Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc	(revision 354)
@@ -248,5 +248,5 @@
   choixAbsPhase_->addItem("x");
   choixAbsPhase_->addItem("y");
-  choixAbsPhase_->addItem("z");
+  choixAbsPhase_->addItem("dz");
   choixAbsPhase_->addItem("xp");
   choixAbsPhase_->addItem("yp");
@@ -257,5 +257,5 @@
   choixOrdPhase_->addItem("x");
   choixOrdPhase_->addItem("y");
-  choixOrdPhase_->addItem("z");
+  choixOrdPhase_->addItem("dz");
   choixOrdPhase_->addItem("xp");
   choixOrdPhase_->addItem("yp");
@@ -547,33 +547,34 @@
   //dtmanage_->donneesRmsEnveloppe(type,1, nbel, xcor,ycor);
   dtmanage_->donneesRmsEnveloppe(type,nbel,xcor,ycor);
-  scatterPlot1D(envDialog->contents(),xcor,ycor);  
-}
-
-void PspaApplication::setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent) {
-  double valeur;
-  if ( indexParticleComponent > 5  ) return;
-
-  if ( indexParticleComponent <= 2 ) {
-    for (unsigned i = 0; i < partic.size(); ++i) {
-      valeur = partic.at(i).getPosition().getComponent(indexParticleComponent);
-      model->setData(i, modelComponent, valeur);
-    }
-  } else {
-    if ( indexParticleComponent == 5 ) {
-      cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl;
-      return;
-    } else {
-      for (unsigned i = 0; i < partic.size(); ++i) {
-	double begamz = partic.at(i).getBetaGamma().getComponent(2);
-	if ( begamz != 0.0) {
-	  valeur = 1.e3*partic.at(i).getBetaGamma().getComponent(indexParticleComponent-3)/begamz;
-	} else {
-	  valeur = 0.0;
-	}
-	model->setData(i, modelComponent, valeur);
-      }
-    }
-  }
-}
+  //    scatterPlot1D(envDialog->contents(),xcor,ycor);  
+chartPlot2vec(envDialog->contents(), xcor, ycor, false);
+}
+
+// void PspaApplication::setModelComponentForPhaseSpace(WStandardItemModel* model, vector<bareParticle>& partic, unsigned indexParticleComponent, unsigned modelComponent) {
+//   double valeur;
+//   if ( indexParticleComponent > 5  ) return;
+
+//   if ( indexParticleComponent <= 2 ) {
+//     for (unsigned i = 0; i < partic.size(); ++i) {
+//       valeur = partic.at(i).getPosition().getComponent(indexParticleComponent);
+//       model->setData(i, modelComponent, valeur);
+//     }
+//   } else {
+//     if ( indexParticleComponent == 5 ) {
+//       cout << " PspaApplication::faireDessinParmela : deltap non programme " << endl;
+//       return;
+//     } else {
+//       for (unsigned i = 0; i < partic.size(); ++i) {
+// 	double begamz = partic.at(i).getBetaGamma().getComponent(2);
+// 	if ( begamz != 0.0) {
+// 	  valeur = 1.e3*partic.at(i).getBetaGamma().getComponent(indexParticleComponent-3)/begamz;
+// 	} else {
+// 	  valeur = 0.0;
+// 	}
+// 	model->setData(i, modelComponent, valeur);
+//       }
+//     }
+//   }
+// }
 
 void PspaApplication::faireDessinParmela(WContainerWidget* toto, particleBeam* beam, unsigned indexAbs, unsigned indexOrd, string namex, string namey )
@@ -586,51 +587,13 @@
   // pointsDialog->show();
       
-  vector<bareParticle>& partic = beam->getParticleVector();
-  new WText(nameOfCase_ + " : phase space " + namex + " ," + namey + " ; particle number : "+ mixedTools::intToString(partic.size()), pointsDialog->contents());
-
-  WStandardItemModel *model = new WStandardItemModel(partic.size(), 2, pointsDialog->contents());
-
-
-  setModelComponentForPhaseSpace(model, partic, indexAbs, 0);
-  setModelComponentForPhaseSpace(model, partic, indexOrd, 1);
-
-  cout << " faireDessinParmela : FAISCEAU VU  " << endl;
-
-  WCartesianChart *chart = new WCartesianChart(pointsDialog->contents());
-  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, PointSeries, Y1Axis);
-  //  s.setShadow(WShadow(3, 3, WColor(0, 0, 0, 127), 3));
-  //    s.setMarker(SquareMarker);
-  //  s.setMarkerSize(600.);
-  //  cout << "le marker est : " << s.marker() << endl;
-  chart->addSeries(s);
-    
-  chart->resize(400, 400); // 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);
-#endif
+  //    vector<bareParticle>& partic = beam->getParticleVector();
+  new WText(nameOfCase_ + " : phase space " + namex + " ," + namey + " ; particle number : "+ mixedTools::intToString(beam->getNbParticles()), pointsDialog->contents());
+
+  vector<double> xcor;
+  vector<double> ycor;
+  beam->particlesPhaseSpaceData(xcor, ycor, indexAbs, indexOrd);
+  chartPlot2vec(pointsDialog->contents(), xcor, ycor, true);
+
+
     
   pointsDialog->show();
@@ -660,18 +623,79 @@
   beam->donneesDessinEllipse(xcor,ycor,indexAbs, indexOrd);
   //  beam->donneesDessinEllipseXxp(xcor,ycor);
-  scatterPlot1D(ellipseDialog->contents(),xcor,ycor);  
-}
-
-
-
-void PspaApplication::scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor)
+  //  scatterPlot1D(ellipseDialog->contents(),xcor,ycor);  
+chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false);
+}
+
+
+
+// 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 nbpts = xcor.size();
-    cout << " PspaApplication::scatterPlot1D nbpts = " << nbpts << endl;
+    cout << " PspaApplication::chartPlot2vec 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;
+        //    cout << " PspaApplication::chartPlot2vec el= " << i+1 << " x= " << xcor.at(i) << " y= " << ycor.at(i) << endl;
     }
     
@@ -693,23 +717,24 @@
     
     // 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
+    if ( drawPoints ) {
+      chart->setPlotAreaPadding(80, Left);
+      chart->setPlotAreaPadding(40, Top | Bottom);
+      WDataSeries s(1, PointSeries, Y1Axis);
+      chart->addSeries(s);
+      chart->resize(400, 400); // WPaintedWidget must be given explicit size
+     } else {
+       WDataSeries s(1, LineSeries, Y1Axis);
+       chart->addSeries(s);    
+       chart->resize(500, 300); // WPaintedWidget must be given explicit size
+     }
     
 #ifdef HAS_IMAGEMAGIC
     Wt::WRasterImage pngImage("png", 600, 600);
-    Wt::WPainter p(&pngImage);
-    
+    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);
-    
+    pngImage.write(f);    
     new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
     
@@ -723,5 +748,4 @@
 #endif
 }
-
 
 
