Skip to content

Commit

Permalink
将三种绘图方式完全独立,使三种绘图方式互不相干。
Browse files Browse the repository at this point in the history
  • Loading branch information
SuWeipeng committed Apr 12, 2019
1 parent ea56cc2 commit 5a8d24e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions mainwindow.cpp
Expand Up @@ -37,6 +37,7 @@ MainWindow::MainWindow(QWidget *parent)
, _conf_plot(false)
, _is_constant(false)
, _replot(false)
, _plotConf(false)
{
qmlRegisterType<DataAnalyzeController>("ArduPilotLog.Controllers", 1, 0, "DataAnalyzeController");

Expand Down Expand Up @@ -317,6 +318,7 @@ void MainWindow::_removeGraph(QTreeWidgetItem *item, int column)

void MainWindow::clearGraph()
{
clear_alreadyPloted();
_ui.customPlot->legend->setVisible(false);
_ui.customPlot->clearGraphs();
_ui.customPlot->replot();
Expand Down Expand Up @@ -456,6 +458,15 @@ void MainWindow::setParentCheckState(QTreeWidgetItem *item, int column)
if(!item) return;
int selectedCount=0;
int childCount = item->childCount();

if(_plotConf){
clear_alreadyPloted();
_ui.customPlot->legend->setVisible(false);
_ui.customPlot->clearGraphs();
_ui.customPlot->replot();
_plotConf = false;
}

for (int i=0;i<childCount;i++)
{
QTreeWidgetItem* child= item->child(i);
Expand Down Expand Up @@ -517,6 +528,16 @@ MainWindow::plotGraph(QString tables,
{
bool getXSuccess = false;
bool getYSuccess = false;
static bool from_last = from;

if(!from_last && from){
clear_alreadyPloted();
_ui.customPlot->legend->setVisible(false);
_ui.customPlot->clearGraphs();
_ui.customPlot->replot();
}
from_last = from;

QCustomPlot* customPlot = MainWindow::getMainWindow()->ui().customPlot;

QString plot_target = QString("%1.%2").arg(tables).arg(fields);
Expand Down Expand Up @@ -683,6 +704,7 @@ MainWindow::plotConf(QStringList conf)
QString offsetY("0");

clearGraph();
_plotConf = true;

for(int i=0; i<conf.length(); i++){
QString str(conf.at(i));
Expand Down
1 change: 1 addition & 0 deletions mainwindow.h
Expand Up @@ -89,6 +89,7 @@ private slots:
bool _conf_plot;
bool _is_constant;
bool _replot;
bool _plotConf;
double _constant_value;
int _action_bold;

Expand Down

0 comments on commit 5a8d24e

Please sign in to comment.