diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index 939827d94caadc3a9b2bc7f1bc93275792099b72..dbd44dac049f353c160b015c413f9dfdc3f27bc2 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -36,7 +36,6 @@ #include "../workerthread.h" #include "../../core/labeling/labelingmethod.h" #include "../../../utils/utils.h" -#include <qcustomplot.h> @@ -78,14 +77,7 @@ ProjectWindow::ProjectWindow(MainWindow *parent): //setLocale(QLocale(QLocale::English, QLocale::UnitedKingdom)); setFocusPolicy(Qt::ClickFocus); - QCPGraph * p_graph = ui->mass_histogram_widget->addGraph(); - //p_graph->setName("raw xic"); - //QPen pen; - //pen.setColor(getNewColors()); - //graph()->setPen(pen); - //graph()->setName(lineNames.at(i-QCPGraph::lsNone)); - p_graph->setLineStyle(QCPGraph::LineStyle::lsStepCenter); - //p_graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, 2.0)); + _p_bars = new QCPBars(ui->mass_histogram_widget->xAxis, ui->mass_histogram_widget->yAxis); #if QT_VERSION >= 0x050000 @@ -310,10 +302,17 @@ void ProjectWindow::computeMassPrecision() { y.push_back(mass_pair.second); } - QCPGraph * p_graph = ui->mass_histogram_widget->graph(); - p_graph->setData(x,y); - p_graph->rescaleAxes(true); - ui->mass_histogram_widget->rescaleAxes(); + //delete _p_bars; + //_p_bars = new QCPBars(ui->mass_histogram_widget->xAxis, ui->mass_histogram_widget->yAxis); + _p_bars->clearData(); + _p_bars->setWidth((x[0] - x[x.size()-1])/x.size()); + _p_bars->setData(x, y); + _p_bars->rescaleAxes(true); + ui->mass_histogram_widget->yAxis->setRange(0, *std::max(y.begin(), y.end())); + ui->mass_histogram_widget->xAxis->setRange(x[0], x[x.size()-1]); + //QCPGraph * p_graph = ui->mass_histogram_widget->graph(); + //p_graph->setData(x,y); + //ui->mass_histogram_widget->rescaleAxes(); ui->mass_histogram_widget->replot(); } catch (pappso::PappsoException exception_pappso) { diff --git a/src/gui/project_view/projectwindow.h b/src/gui/project_view/projectwindow.h index 713be30e4f1cb9b480a8069b4f2ad05c47b5f571..6ec84b58a504ad6976c45a4b683fc8747885d26f 100644 --- a/src/gui/project_view/projectwindow.h +++ b/src/gui/project_view/projectwindow.h @@ -37,6 +37,7 @@ #include "../peptide_detail_view/peptidewindow.h" #include "gui/project_view/automatic_filter_widget/automaticfilterwidget.h" #include "../waiting_message_dialog/waitingmessagedialog.h" +#include <qcustomplot.h> class MainWindow; @@ -131,6 +132,7 @@ private: QStandardItemModel * _p_fasta_str_li; std::vector<FastaFileSp> _fastafile_list; WaitingMessageDialog * _p_waiting_message_dialog; + QCPBars *_p_bars; };