Changeset 370 in PSPA
- Timestamp:
- Mar 6, 2013, 2:19:58 PM (12 years ago)
- Location:
- Interface_Web/trunk/pspaWT
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/History
r365 r370 5 5 PSPA - Plateforme de simulation en physique des accélérateurs 6 6 ========================================================= 7 8 6 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... 7 13 8 14 5 Mars : Laurent Garnier -
Interface_Web/trunk/pspaWT/htdocs/pspa.css
r365 r370 88 88 } 89 89 90 .Button.WhiteButton.ContrastButton.Graph { 91 display: inline; 92 padding-top: 0px; 93 padding-left: 0px; 94 } 90 95 .Button.WhiteButton.HiddenButton { 91 96 visibility: hidden; … … 145 150 } 146 151 152 147 153 .Button { 148 154 border: 1px solid transparent; -
Interface_Web/trunk/pspaWT/sources/userInterface/include/GWt_pspaApplication.h
r362 r370 56 56 57 57 WContainerWidget* toto_; 58 58 59 GWt_softwarePanel* executeWidget_; 59 60 WFileUpload* uploadFileSelectorWidget_; … … 84 85 void faireDessinEnveloppe(WContainerWidget* toto, string type); 85 86 // 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); 87 88 bool removePathFromConfigName(string& config); 88 89 bool removeExtensionFromConfigName(string& config); -
Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_pspaApplication.cc
r367 r370 558 558 // dtmanage_->donneesRmsEnveloppe(type,1, nbel, xcor,ycor); 559 559 dtmanage_->donneesRmsEnveloppe(type,xcor,ycor); 560 chartPlot2vec(envDialog->contents(), xcor, ycor, false); 560 chartPlot2vec(envDialog->contents(), xcor, ycor, false,500,300); 561 561 562 } 562 563 … … 576 577 vector<double> ycor; 577 578 beam->particlesPhaseSpaceData(xcor, ycor, indexAbs, indexOrd); 578 chartPlot2vec(pointsDialog->contents(), xcor, ycor, true );579 chartPlot2vec(pointsDialog->contents(), xcor, ycor, true,400,400); 579 580 580 581 … … 606 607 // beam->donneesDessinEllipseXxp(xcor,ycor); 607 608 // scatterPlot1D(ellipseDialog->contents(),xcor,ycor); 608 chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false); 609 chartPlot2vec(ellipseDialog->contents(), xcor, ycor, false,500,300); 610 609 611 } 610 612 … … 671 673 672 674 // 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 )675 void PspaApplication::chartPlot2vec(WContainerWidget* toto, vector<double>& xcor, vector<double>& ycor, bool drawPoints,int width, int height, bool makeIcon) 674 676 { 675 677 int nbpts = xcor.size(); … … 683 685 684 686 WCartesianChart *chart = new WCartesianChart(toto); 685 chart->setTitle("titre"); 686 687 // chart->initLayout(); 687 if (!makeIcon) { 688 chart->setTitle("titre"); 689 } 690 chart->initLayout(); 688 691 689 692 chart->setModel(model); // set the model 690 693 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 } 692 699 693 700 chart->setType(ScatterPlot); // set type to ScatterPlot … … 697 704 chart->axis(XAxis).setLocation(ZeroValue); 698 705 chart->axis(YAxis).setLocation(ZeroValue); 699 706 700 707 // Provide space for the X and Y axis and title. 701 708 if ( drawPoints ) { … … 704 711 WDataSeries s(1, PointSeries, Y1Axis); 705 712 chart->addSeries(s); 706 chart->resize( 400, 400); // WPaintedWidget must be given explicit size713 chart->resize(width, height); // WPaintedWidget must be given explicit size 707 714 } else { 708 715 WDataSeries s(1, LineSeries, Y1Axis); 709 716 chart->addSeries(s); 710 chart->resize( 500, 300); // WPaintedWidget must be given explicit size717 chart->resize(width, height); // WPaintedWidget must be given explicit size 711 718 } 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 713 731 #ifdef HAS_IMAGEMAGIC 714 732 Wt::WRasterImage pngImage("png", 600, 600); 715 Wt::WPainter p(&pngImage); 733 Wt::WPainter p(&pngImage); 716 734 chart->paint(p); 717 735 std::string name; … … 721 739 new WText("<a href='workingArea/chart-"+sessionId ()+".png' target='_blank'>Afficher l'image</a>",toto); 722 740 723 /*724 741 Wt::WPdfImage pdfImage("30cm", "30cm"); 725 742 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); 728 747 pdfImage.write(f1); 729 */730 748 #endif 731 749 }
Note: See TracChangeset
for help on using the changeset viewer.