Tweaks in both flow view and graphing view to make them show with a time based X axis (this is selectable in flowview). This allows for much better correlation of graphs from different IDs. Updated version number.
This commit is contained in:
+45
-3
@@ -48,6 +48,13 @@ FlowViewWindow::FlowViewWindow(QVector<CANFrame> *frames, QWidget *parent) :
|
|||||||
ui->graphView->legend->setFont(legendFont);
|
ui->graphView->legend->setFont(legendFont);
|
||||||
ui->graphView->legend->setSelectedFont(legendSelectedFont);
|
ui->graphView->legend->setSelectedFont(legendSelectedFont);
|
||||||
ui->graphView->legend->setSelectableParts(QCPLegend::spItems); // legend box shall not be selectable, only legend items
|
ui->graphView->legend->setSelectableParts(QCPLegend::spItems); // legend box shall not be selectable, only legend items
|
||||||
|
//ui->graphView->xAxis->setAutoSubTicks(false);
|
||||||
|
//ui->graphView->xAxis->setAutoTicks(false);
|
||||||
|
ui->graphView->xAxis->setAutoTickStep(false);
|
||||||
|
ui->graphView->xAxis->setAutoSubTicks(false);
|
||||||
|
ui->graphView->xAxis->setNumberFormat("gb");
|
||||||
|
ui->graphView->xAxis->setTickStep(5.0);
|
||||||
|
ui->graphView->xAxis->setSubTickCount(0);
|
||||||
|
|
||||||
connect(ui->btnBackOne, SIGNAL(clicked(bool)), this, SLOT(btnBackOneClick()));
|
connect(ui->btnBackOne, SIGNAL(clicked(bool)), this, SLOT(btnBackOneClick()));
|
||||||
connect(ui->btnPause, SIGNAL(clicked(bool)), this, SLOT(btnPauseClick()));
|
connect(ui->btnPause, SIGNAL(clicked(bool)), this, SLOT(btnPauseClick()));
|
||||||
@@ -130,6 +137,8 @@ void FlowViewWindow::createGraph(int byteNum)
|
|||||||
int tempVal;
|
int tempVal;
|
||||||
float minval=1000000, maxval = -100000;
|
float minval=1000000, maxval = -100000;
|
||||||
|
|
||||||
|
bool graphByTime = ui->cbTimeGraph->isChecked();
|
||||||
|
|
||||||
int numEntries = frameCache.count();
|
int numEntries = frameCache.count();
|
||||||
|
|
||||||
QVector<double> x(numEntries), y(numEntries);
|
QVector<double> x(numEntries), y(numEntries);
|
||||||
@@ -137,7 +146,16 @@ void FlowViewWindow::createGraph(int byteNum)
|
|||||||
for (int j = 0; j < numEntries; j++)
|
for (int j = 0; j < numEntries; j++)
|
||||||
{
|
{
|
||||||
tempVal = frameCache[j].data[byteNum];
|
tempVal = frameCache[j].data[byteNum];
|
||||||
|
|
||||||
|
if (graphByTime)
|
||||||
|
{
|
||||||
|
x[j] = frameCache[j].timestamp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
x[j] = j;
|
x[j] = j;
|
||||||
|
}
|
||||||
|
|
||||||
y[j] = tempVal;
|
y[j] = tempVal;
|
||||||
if (y[j] < minval) minval = y[j];
|
if (y[j] < minval) minval = y[j];
|
||||||
if (y[j] > maxval) maxval = y[j];
|
if (y[j] > maxval) maxval = y[j];
|
||||||
@@ -203,7 +221,8 @@ void FlowViewWindow::changeID(QString newID)
|
|||||||
{
|
{
|
||||||
createGraph(c);
|
createGraph(c);
|
||||||
}
|
}
|
||||||
ui->graphView->replot();
|
|
||||||
|
updateGraphLocation();
|
||||||
|
|
||||||
memcpy(currBytes, frameCache.at(currentPosition).data, 8);
|
memcpy(currBytes, frameCache.at(currentPosition).data, 8);
|
||||||
memcpy(refBytes, currBytes, 8);
|
memcpy(refBytes, currBytes, 8);
|
||||||
@@ -320,8 +339,7 @@ void FlowViewWindow::updateDataView()
|
|||||||
ui->flowView->setReference(refBytes, false);
|
ui->flowView->setReference(refBytes, false);
|
||||||
ui->flowView->updateData(currBytes, true);
|
ui->flowView->updateData(currBytes, true);
|
||||||
|
|
||||||
ui->graphView->xAxis->setRange(currentPosition - 5, currentPosition + 5);
|
updateGraphLocation();
|
||||||
ui->graphView->replot();
|
|
||||||
|
|
||||||
updateFrameLabel();
|
updateFrameLabel();
|
||||||
|
|
||||||
@@ -350,4 +368,28 @@ void FlowViewWindow::updatePosition(bool forward)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FlowViewWindow::updateGraphLocation()
|
||||||
|
{
|
||||||
|
int start = currentPosition - 5;
|
||||||
|
if (start < 0) start = 0;
|
||||||
|
int end = currentPosition + 5;
|
||||||
|
if (end >= frameCache.count()) end = frameCache.count() - 1;
|
||||||
|
if (ui->cbTimeGraph->isChecked())
|
||||||
|
{
|
||||||
|
ui->graphView->xAxis->setRange(frameCache[start].timestamp, frameCache[end].timestamp);
|
||||||
|
ui->graphView->xAxis->setTickStep((frameCache[end].timestamp - frameCache[start].timestamp)/ 3.0);
|
||||||
|
ui->graphView->xAxis->setSubTickCount(0);
|
||||||
|
ui->graphView->xAxis->setNumberFormat("f");
|
||||||
|
ui->graphView->xAxis->setNumberPrecision(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->graphView->xAxis->setRange(start, end);
|
||||||
|
ui->graphView->xAxis->setTickStep(5.0);
|
||||||
|
ui->graphView->xAxis->setSubTickCount(0);
|
||||||
|
ui->graphView->xAxis->setNumberFormat("gb");
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->graphView->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ private:
|
|||||||
void updateDataView();
|
void updateDataView();
|
||||||
void removeAllGraphs();
|
void removeAllGraphs();
|
||||||
void createGraph(int);
|
void createGraph(int);
|
||||||
|
void updateGraphLocation();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLOWVIEWWINDOW_H
|
#endif // FLOWVIEWWINDOW_H
|
||||||
|
|||||||
+9
-2
@@ -52,7 +52,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
<widget class="QGroupBox" name="groupBox_3">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@@ -204,7 +204,14 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Capture Traffic</string>
|
<string>Realtime Capture</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbTimeGraph">
|
||||||
|
<property name="text">
|
||||||
|
<string>Graph by timestamp</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
+22
-12
@@ -24,6 +24,8 @@ GraphingWindow::GraphingWindow(QVector<CANFrame> *frames, QWidget *parent) :
|
|||||||
|
|
||||||
ui->graphingView->xAxis->setLabel("Time Axis");
|
ui->graphingView->xAxis->setLabel("Time Axis");
|
||||||
ui->graphingView->yAxis->setLabel("Value Axis");
|
ui->graphingView->yAxis->setLabel("Value Axis");
|
||||||
|
ui->graphingView->xAxis->setNumberFormat("f");
|
||||||
|
ui->graphingView->xAxis->setNumberPrecision(0);
|
||||||
ui->graphingView->legend->setVisible(true);
|
ui->graphingView->legend->setVisible(true);
|
||||||
QFont legendFont = font();
|
QFont legendFont = font();
|
||||||
legendFont.setPointSize(10);
|
legendFont.setPointSize(10);
|
||||||
@@ -310,7 +312,8 @@ void GraphingWindow::addNewGraph()
|
|||||||
void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
||||||
{
|
{
|
||||||
int tempVal;
|
int tempVal;
|
||||||
float minval=1000000, maxval = -100000;
|
float yminval=10000000, ymaxval = -1000000;
|
||||||
|
float xminval=100000000000, xmaxval = -100000000000;
|
||||||
|
|
||||||
qDebug() << "New Graph ID: " << params.ID;
|
qDebug() << "New Graph ID: " << params.ID;
|
||||||
qDebug() << "Start byte: " << params.startByte;
|
qDebug() << "Start byte: " << params.startByte;
|
||||||
@@ -337,10 +340,13 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
{
|
{
|
||||||
tempVal = tempVal - 256;
|
tempVal = tempVal - 256;
|
||||||
}
|
}
|
||||||
x[j] = j;
|
x[j] = frameCache[j].timestamp;
|
||||||
y[j] = (tempVal + params.bias) * params.scale;
|
y[j] = (tempVal + params.bias) * params.scale;
|
||||||
if (y[j] < minval) minval = y[j];
|
if (y[j] < yminval) yminval = y[j];
|
||||||
if (y[j] > maxval) maxval = y[j];
|
if (y[j] > ymaxval) ymaxval = y[j];
|
||||||
|
if (x[j] < xminval) xminval = x[j];
|
||||||
|
if (x[j] > xmaxval) xmaxval = x[j];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (params.endByte > params.startByte) //big endian
|
else if (params.endByte > params.startByte) //big endian
|
||||||
@@ -367,10 +373,12 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tempValue = (float)tempValInt;
|
tempValue = (float)tempValInt;
|
||||||
x[j] = j;
|
x[j] = frameCache[j].timestamp;
|
||||||
y[j] = (tempValue + params.bias) * params.scale;
|
y[j] = (tempValue + params.bias) * params.scale;
|
||||||
if (y[j] < minval) minval = y[j];
|
if (y[j] < yminval) yminval = y[j];
|
||||||
if (y[j] > maxval) maxval = y[j];
|
if (y[j] > ymaxval) ymaxval = y[j];
|
||||||
|
if (x[j] < xminval) xminval = x[j];
|
||||||
|
if (x[j] > xmaxval) xmaxval = x[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else //little endian
|
else //little endian
|
||||||
@@ -396,10 +404,12 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tempValue = (float)tempValInt;
|
tempValue = (float)tempValInt;
|
||||||
x[j] = j;
|
x[j] = frameCache[j].timestamp;
|
||||||
y[j] = (tempValue + params.bias) * params.scale;
|
y[j] = (tempValue + params.bias) * params.scale;
|
||||||
if (y[j] < minval) minval = y[j];
|
if (y[j] < yminval) yminval = y[j];
|
||||||
if (y[j] > maxval) maxval = y[j];
|
if (y[j] > ymaxval) ymaxval = y[j];
|
||||||
|
if (x[j] < xminval) xminval = x[j];
|
||||||
|
if (x[j] > xmaxval) xmaxval = x[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ui->graphingView->addGraph();
|
ui->graphingView->addGraph();
|
||||||
@@ -415,8 +425,8 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
graphPen.setWidth(1);
|
graphPen.setWidth(1);
|
||||||
ui->graphingView->graph()->setPen(graphPen);
|
ui->graphingView->graph()->setPen(graphPen);
|
||||||
|
|
||||||
ui->graphingView->xAxis->setRange(0, numEntries);
|
ui->graphingView->xAxis->setRange(xminval, xmaxval);
|
||||||
ui->graphingView->yAxis->setRange(minval, maxval);
|
ui->graphingView->yAxis->setRange(yminval, ymaxval);
|
||||||
ui->graphingView->axisRect()->setupFullAxesBox();
|
ui->graphingView->axisRect()->setupFullAxesBox();
|
||||||
|
|
||||||
ui->graphingView->replot();
|
ui->graphingView->replot();
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ fuzzy scope - Try to find potential places where a given value might be stored -
|
|||||||
|
|
||||||
|
|
||||||
Things currently broken or in need of attention:
|
Things currently broken or in need of attention:
|
||||||
1. Each screen should mention which file is loaded so that it's easier to keep track of what you're doing.
|
1. Currently no screen supports dynamic updates when new frames come in.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QString MainWindow::loadedFileName = "";
|
QString MainWindow::loadedFileName = "";
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
#include "dbchandler.h"
|
#include "dbchandler.h"
|
||||||
#include "dbcmaineditor.h"
|
#include "dbcmaineditor.h"
|
||||||
|
|
||||||
#define VERSION 108
|
#define VERSION 109
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|||||||
Reference in New Issue
Block a user