Added ability to save an image of the graph, fixed graphing so that timing is relative to the start of the capture (this makes viewing one capture after another with the same graphs much easier). Fixed rescale when importing a new file (no longer rescales).
The bottom line is that it'll be a lot easier to work with graphing of multiple files now.
This commit is contained in:
+39
-6
@@ -84,7 +84,7 @@ void GraphingWindow::updatedFrames(int numFrames)
|
|||||||
//there shouldn't be any need to actually remove the graphs.
|
//there shouldn't be any need to actually remove the graphs.
|
||||||
//regenerate them instead
|
//regenerate them instead
|
||||||
ui->graphingView->clearGraphs(); //temporarily remove the graphs from the graph view
|
ui->graphingView->clearGraphs(); //temporarily remove the graphs from the graph view
|
||||||
needScaleSetup = true;
|
//needScaleSetup = true;
|
||||||
for (int i = 0; i < graphParams.count(); i++)
|
for (int i = 0; i < graphParams.count(); i++)
|
||||||
{
|
{
|
||||||
createGraph(graphParams[i], false); //regenerate each one
|
createGraph(graphParams[i], false); //regenerate each one
|
||||||
@@ -96,8 +96,6 @@ void GraphingWindow::updatedFrames(int numFrames)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GraphingWindow::titleDoubleClick(QMouseEvent* event, QCPPlotTitle* title)
|
void GraphingWindow::titleDoubleClick(QMouseEvent* event, QCPPlotTitle* title)
|
||||||
{
|
{
|
||||||
Q_UNUSED(event)
|
Q_UNUSED(event)
|
||||||
@@ -277,21 +275,48 @@ void GraphingWindow::contextMenuRequest(QPoint pos)
|
|||||||
menu->addAction(tr("Move to top right"), this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignRight));
|
menu->addAction(tr("Move to top right"), this, SLOT(moveLegend()))->setData((int)(Qt::AlignTop|Qt::AlignRight));
|
||||||
menu->addAction(tr("Move to bottom right"), this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignRight));
|
menu->addAction(tr("Move to bottom right"), this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignRight));
|
||||||
menu->addAction(tr("Move to bottom left"), this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignLeft));
|
menu->addAction(tr("Move to bottom left"), this, SLOT(moveLegend()))->setData((int)(Qt::AlignBottom|Qt::AlignLeft));
|
||||||
} else // general context menu on graphs requested
|
}
|
||||||
|
else // general context menu on graphs requested
|
||||||
{
|
{
|
||||||
|
menu->addAction(tr("Save Graphs to File"), this, SLOT(saveGraphs()));
|
||||||
menu->addAction(tr("Add new graph"), this, SLOT(addNewGraph()));
|
menu->addAction(tr("Add new graph"), this, SLOT(addNewGraph()));
|
||||||
if (ui->graphingView->selectedGraphs().size() > 0)
|
if (ui->graphingView->selectedGraphs().size() > 0)
|
||||||
{
|
{
|
||||||
menu->addAction(tr("Edit selected graph"), this, SLOT(editSelectedGraph()));
|
menu->addAction(tr("Edit selected graph"), this, SLOT(editSelectedGraph()));
|
||||||
menu->addAction(tr("Remove selected graph"), this, SLOT(removeSelectedGraph()));
|
menu->addAction(tr("Remove selected graph"), this, SLOT(removeSelectedGraph()));
|
||||||
}
|
}
|
||||||
if (ui->graphingView->graphCount() > 0)
|
if (ui->graphingView->graphCount() > 0)
|
||||||
menu->addAction(tr("Remove all graphs"), this, SLOT(removeAllGraphs()));
|
menu->addAction(tr("Remove all graphs"), this, SLOT(removeAllGraphs()));
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->popup(ui->graphingView->mapToGlobal(pos));
|
menu->popup(ui->graphingView->mapToGlobal(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphingWindow::saveGraphs()
|
||||||
|
{
|
||||||
|
QString filename;
|
||||||
|
QFileDialog dialog(this);
|
||||||
|
|
||||||
|
QStringList filters;
|
||||||
|
filters.append(QString(tr("PDF Files (*.pdf)")));
|
||||||
|
filters.append(QString(tr("PNG Files (*.png)")));
|
||||||
|
filters.append(QString(tr("JPEG Files (*.jpg)")));
|
||||||
|
|
||||||
|
dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
|
dialog.setNameFilters(filters);
|
||||||
|
dialog.setViewMode(QFileDialog::Detail);
|
||||||
|
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
|
|
||||||
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
filename = dialog.selectedFiles()[0];
|
||||||
|
|
||||||
|
if (dialog.selectedNameFilter() == filters[0]) ui->graphingView->savePdf(filename, true, 0, 0);
|
||||||
|
if (dialog.selectedNameFilter() == filters[1]) ui->graphingView->savePng(filename, 0, 0);
|
||||||
|
if (dialog.selectedNameFilter() == filters[2]) ui->graphingView->saveJpg(filename, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GraphingWindow::showParamsDialog(int idx = -1)
|
void GraphingWindow::showParamsDialog(int idx = -1)
|
||||||
{
|
{
|
||||||
NewGraphDialog *thisDialog = new NewGraphDialog();
|
NewGraphDialog *thisDialog = new NewGraphDialog();
|
||||||
@@ -419,6 +444,14 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
if (x[j] > xmaxval) xmaxval = x[j];
|
if (x[j] > xmaxval) xmaxval = x[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int ct = 0; ct < x.count(); ct++)
|
||||||
|
{
|
||||||
|
x[ct] -= xminval;
|
||||||
|
}
|
||||||
|
xmaxval -= xminval;
|
||||||
|
xminval = 0;
|
||||||
|
|
||||||
ui->graphingView->addGraph();
|
ui->graphingView->addGraph();
|
||||||
params.ref = ui->graphingView->graph();
|
params.ref = ui->graphingView->graph();
|
||||||
if (createGraphParam) graphParams.append(params);
|
if (createGraphParam) graphParams.append(params);
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ private slots:
|
|||||||
void removeAllGraphs();
|
void removeAllGraphs();
|
||||||
void contextMenuRequest(QPoint pos);
|
void contextMenuRequest(QPoint pos);
|
||||||
void moveLegend();
|
void moveLegend();
|
||||||
|
void saveGraphs();
|
||||||
void addNewGraph();
|
void addNewGraph();
|
||||||
void createGraph(GraphParams ¶ms, bool createGraphParam = true);
|
void createGraph(GraphParams ¶ms, bool createGraphParam = true);
|
||||||
void editSelectedGraph();
|
void editSelectedGraph();
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
#include "dbchandler.h"
|
#include "dbchandler.h"
|
||||||
#include "dbcmaineditor.h"
|
#include "dbcmaineditor.h"
|
||||||
|
|
||||||
#define VERSION 110
|
#define VERSION 111
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|||||||
Reference in New Issue
Block a user