Changeset 370 in PSPA


Ignore:
Timestamp:
Mar 6, 2013, 2:19:58 PM (11 years ago)
Author:
garnier
Message:

Ajout des paramètres width et height à la méthode chartPlot2vec + ... (see History)

Location:
Interface_Web/trunk/pspaWT
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Interface_Web/trunk/pspaWT/History

    r365 r370  
    55     PSPA - Plateforme de simulation en physique des accélérateurs
    66     =========================================================
     7
     86 Mars : Laurent Garnier
     9- pspa.css : Ajout de style pour les futurs graphiques
     10- GWt_pspaApplication : Ajout des paramètres width et height à la méthode chartPlot2vec()
     11  afin de pouvoir la changer facilement. AJout également d'un paramètre "makeIcon" pour faire
     12  des graphiques sans légende, sans bordures...
    713
    8145 Mars : Laurent Garnier
  • Interface_Web/trunk/pspaWT/htdocs/pspa.css

    r365 r370  
    8888}
    8989
     90.Button.WhiteButton.ContrastButton.Graph {
     91    display: inline;
     92    padding-top: 0px;
     93    padding-left: 0px;
     94}
    9095.Button.WhiteButton.HiddenButton {
    9196    visibility: hidden;
     
    145150}
    146151
     152
    147153.Button {
    148154    border: 1px solid transparent;
  • Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h

    r362 r370  
    5656
    5757  WContainerWidget* toto_;
     58
    5859  GWt_softwarePanel* executeWidget_;
    5960  WFileUpload* uploadFileSelectorWidget_;
     
    8485  void faireDessinEnveloppe(WContainerWidget* toto, string type);
    8586  //  void scatterPlot1D(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor);
    86   void chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints);
     87  void chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints, int width, int height, bool makeIcon=false);
    8788  bool removePathFromConfigName(string& config);
    8889  bool removeExtensionFromConfigName(string& config);
  • Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc

    r367 r370  
    558558  // dtmanage_->donneesRmsEnveloppe(type,1, nbel, xcor,ycor);
    559559    dtmanage_->donneesRmsEnveloppe(type,xcor,ycor);
    560 chartPlot2vec(envDialog->contents(), xcor, ycor, false);
     560    chartPlot2vec(envDialog->contents(), xcor, ycor, false,500,300);
     561
    561562}
    562563
     
    576577  vector<double> ycor;
    577578  beam->particlesPhaseSpaceData(xcor, ycor, indexAbs, indexOrd);
    578   chartPlot2vec(pointsDialog->contents(), xcor, ycor, true);
     579  chartPlot2vec(pointsDialog->contents(), xcor, ycor, true,400,400);
    579580
    580581
     
    606607  //  beam->donneesDessinEllipseXxp(xcor,ycor);
    607608  //  scatterPlot1D(ellipseDialog->contents(),xcor,ycor); 
    608 chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false);
     609chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false,500,300);
     610
    609611}
    610612
     
    671673
    672674// dernier parametre, drawPoints : true = on trace des points (phase space) ; false = on trace des lignes 'enveloppes...)
    673 void PspaApplication::chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints)
     675void PspaApplication::chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints,int width, int height, bool makeIcon)
    674676{
    675677    int nbpts = xcor.size();
     
    683685   
    684686    WCartesianChart *chart = new WCartesianChart(toto);
    685     chart->setTitle("titre");
    686    
    687     //  chart->initLayout();
     687    if (!makeIcon) {
     688        chart->setTitle("titre");
     689    }
     690    chart->initLayout();
    688691   
    689692    chart->setModel(model);        // set the model
    690693    chart->setXSeriesColumn(0);    // set the column that holds the X data
    691     chart->setLegendEnabled(true); // enable the legend
     694    if (!makeIcon) {
     695        chart->setLegendEnabled(true); // enable the legend
     696    } else {
     697        chart->setLegendEnabled(false); // enable the legend
     698    }
    692699   
    693700    chart->setType(ScatterPlot);   // set type to ScatterPlot
     
    697704    chart->axis(XAxis).setLocation(ZeroValue);
    698705    chart->axis(YAxis).setLocation(ZeroValue);
    699    
     706
    700707    // Provide space for the X and Y axis and title.
    701708    if ( drawPoints ) {
     
    704711      WDataSeries s(1, PointSeries, Y1Axis);
    705712      chart->addSeries(s);
    706       chart->resize(400, 400); // WPaintedWidget must be given explicit size
     713      chart->resize(width, height); // WPaintedWidget must be given explicit size
    707714     } else {
    708715       WDataSeries s(1, LineSeries, Y1Axis);
    709716       chart->addSeries(s);   
    710        chart->resize(500, 300); // WPaintedWidget must be given explicit size
     717       chart->resize(width, height); // WPaintedWidget must be given explicit size
    711718     }
    712    
     719
     720    if (makeIcon) {
     721        chart->setPlotAreaPadding(0);
     722        chart->setAxisPadding(0);
     723        WFont xAxisFont = chart->axis(XAxis).labelFont();
     724        xAxisFont.setSize(8);
     725        WFont yAxisFont = chart->axis(YAxis).labelFont();
     726        yAxisFont.setSize(8);
     727        chart->axis(XAxis).setLabelFont(xAxisFont);
     728        chart->axis(YAxis).setLabelFont(yAxisFont);
     729    }
     730
    713731#ifdef HAS_IMAGEMAGIC
    714732    Wt::WRasterImage pngImage("png", 600, 600);
    715     Wt::WPainter p(&pngImage);   
     733    Wt::WPainter p(&pngImage);
    716734    chart->paint(p);
    717735    std::string name;
     
    721739    new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto);
    722740   
    723     /*
    724741     Wt::WPdfImage pdfImage("30cm", "30cm");
    725742     Wt::WPainter p1(&pdfImage);
    726      chart->paint(p1);
    727      std::ofstream f1("chart.pdf", std::ios::out | std::ios::binary);
     743    pdfImage.init();
     744    chart->paint(p1);
     745     name = workingDir_ + "/chart-"+sessionId ()+".pdf";
     746     std::ofstream f1(name.c_str(), std::ios::out |std::ios::trunc | std::ios::binary);
    728747     pdfImage.write(f1);
    729      */
    730748#endif
    731749}
Note: See TracChangeset for help on using the changeset viewer.