add functionality to edit the plot title and x- and y-axis labels

This commit is contained in:
Axel Kohlmeyer
2025-04-11 23:25:56 -04:00
parent 3aa3d45a9f
commit ed1f4cc381
5 changed files with 77 additions and 7 deletions

View File

@ -15,6 +15,7 @@
#define CHARTVIEWER_H
#include <QComboBox>
#include <QLineEdit>
#include <QList>
#include <QString>
#include <QTime>
@ -52,6 +53,8 @@ private slots:
void stop_run();
void select_smooth(int selection);
void update_smooth();
void update_labels();
void update_ylabel();
void saveAs();
void exportDat();
@ -73,6 +76,7 @@ private:
QAction *closeAct, *stopAct, *quitAct;
QComboBox *smooth;
QSpinBox *window, *order;
QLineEdit *chartTitle, *chartXlabel, *chartYlabel;
QString filename;
QList<QtCharts::ChartViewer *> charts;
@ -103,6 +107,11 @@ public:
QString get_title() const { return series->name(); }
double get_step(int index) const { return (index < 0) ? 0.0 : series->at(index).x(); }
double get_data(int index) const { return (index < 0) ? 0.0 : series->at(index).y(); }
void set_labels(const QString &tlabel, const QString &xlabel);
void set_ylabel(const QString &ylabel);
QString get_tlabel() const { return chart->title(); }
QString get_xlabel() const { return xaxis->titleText(); }
QString get_ylabel() const { return yaxis->titleText(); }
private:
int last_step, index;