diff --git a/UI/UI_plot.cpp b/UI/UI_plot.cpp index 5cf3115..47f67a4 100644 --- a/UI/UI_plot.cpp +++ b/UI/UI_plot.cpp @@ -1,22 +1,20 @@ #include "UI_plot.hpp" -UI_plot::UI_plot(QObject* parent) - : UI_item{UI_PLOT_TYPE, parent} +UI_plot::UI_plot(QObject *parent) : UI_item{UI_PLOT_TYPE, parent} { } UI_plot::UI_plot(std::string text, std::string x_label, std::string y_label, QObject *parent) - : UI_item(UI_PLOT_TYPE, parent) , m_x_label(x_label), m_y_label(y_label) + : UI_item(UI_PLOT_TYPE, parent), m_x_label(x_label), m_y_label(y_label) { set_text(text); } -UI_plot::UI_plot(const json &j, QObject *parent) - : UI_item{UI_PLOT_TYPE, parent} +UI_plot::UI_plot(const json &j, QObject *parent) : UI_item{UI_PLOT_TYPE, parent} { from_json(j); } -\ + void UI_plot::set_x_label(std::string name) { m_x_label = name; diff --git a/UI/UI_plot.hpp b/UI/UI_plot.hpp index 758400b..a0795b9 100644 --- a/UI/UI_plot.hpp +++ b/UI/UI_plot.hpp @@ -4,13 +4,14 @@ #include "UI_item.hpp" #define UI_PLOT_TYPE std::string("UI_plot") -class UI_plot : public UI_item { +class UI_plot : public UI_item +{ Q_OBJECT public: - explicit UI_plot(QObject* parent = nullptr); + explicit UI_plot(QObject *parent = nullptr); UI_plot(std::string text, std::string x_label, std::string y_label, QObject *parent = nullptr); UI_plot(const json &j, QObject *parent = nullptr); -\ + void set_x_label(std::string name); std::string x_label() const; void set_y_label(std::string name); @@ -26,8 +27,8 @@ class UI_plot : public UI_item { json to_json(size_t id) const override; private: - std::vectorm_x_vals; - std::vectorm_y_vals; + std::vector m_x_vals; + std::vector m_y_vals; std::string m_x_label; std::string m_y_label; bool m_x_label_enabled; diff --git a/client/simulator_base.cpp b/client/simulator_base.cpp index a67dfc5..7cd67cb 100644 --- a/client/simulator_base.cpp +++ b/client/simulator_base.cpp @@ -555,13 +555,8 @@ void Simulator_base::process_ui_plot(json &uiItem) plot->setAxisTitle(QwtAxis::YLeft, y_label); } - plot->curve()->setRawSamples( - x_vals.data(), - y_vals.data(), - x_vals.capacity() - ); - plot->setAxisScale( QwtAxis::XBottom, - x_vals[x_vals.capacity() - 1], x_vals[0] ); + plot->curve()->setRawSamples(x_vals.data(), y_vals.data(), x_vals.capacity()); + plot->setAxisScale(QwtAxis::XBottom, x_vals[x_vals.capacity() - 1], x_vals[0]); // plot_time[0], plot_time[api.get_plot_size() - 1] ); plot->replot(); }