Added support for seconds mode to graphing view.
This commit is contained in:
+32
-4
@@ -27,7 +27,9 @@ GraphingWindow::GraphingWindow(const 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->setNumberFormat("f");
|
||||||
ui->graphingView->xAxis->setNumberPrecision(0);
|
if (secondsMode) ui->graphingView->xAxis->setNumberPrecision(6);
|
||||||
|
else 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);
|
||||||
@@ -89,6 +91,7 @@ void GraphingWindow::readSettings()
|
|||||||
resize(settings.value("Graphing/WindowSize", QSize(800, 600)).toSize());
|
resize(settings.value("Graphing/WindowSize", QSize(800, 600)).toSize());
|
||||||
move(settings.value("Graphing/WindowPos", QPoint(50, 50)).toPoint());
|
move(settings.value("Graphing/WindowPos", QPoint(50, 50)).toPoint());
|
||||||
}
|
}
|
||||||
|
secondsMode = settings.value("Main/TimeSeconds", false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphingWindow::writeSettings()
|
void GraphingWindow::writeSettings()
|
||||||
@@ -401,7 +404,14 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
{
|
{
|
||||||
tempVal = tempVal - 256;
|
tempVal = tempVal - 256;
|
||||||
}
|
}
|
||||||
x[j] = frameCache[j].timestamp;
|
if (secondsMode)
|
||||||
|
{
|
||||||
|
x[j] = (double)(frameCache[j].timestamp) / 1000000.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x[j] = frameCache[j].timestamp;
|
||||||
|
}
|
||||||
y[j] = (tempVal + params.bias) * params.scale;
|
y[j] = (tempVal + params.bias) * params.scale;
|
||||||
if (y[j] < yminval) yminval = y[j];
|
if (y[j] < yminval) yminval = y[j];
|
||||||
if (y[j] > ymaxval) ymaxval = y[j];
|
if (y[j] > ymaxval) ymaxval = y[j];
|
||||||
@@ -434,7 +444,16 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tempValue = (float)tempValInt;
|
tempValue = (float)tempValInt;
|
||||||
x[j] = frameCache[j].timestamp;
|
|
||||||
|
if (secondsMode)
|
||||||
|
{
|
||||||
|
x[j] = (double)(frameCache[j].timestamp) / 1000000.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x[j] = frameCache[j].timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
y[j] = (tempValue + params.bias) * params.scale;
|
y[j] = (tempValue + params.bias) * params.scale;
|
||||||
if (y[j] < yminval) yminval = y[j];
|
if (y[j] < yminval) yminval = y[j];
|
||||||
if (y[j] > ymaxval) ymaxval = y[j];
|
if (y[j] > ymaxval) ymaxval = y[j];
|
||||||
@@ -465,7 +484,16 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
tempValue = (float)tempValInt;
|
tempValue = (float)tempValInt;
|
||||||
x[j] = frameCache[j].timestamp;
|
|
||||||
|
if (secondsMode)
|
||||||
|
{
|
||||||
|
x[j] = (double)(frameCache[j].timestamp) / 1000000.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x[j] = frameCache[j].timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
y[j] = (tempValue + params.bias) * params.scale;
|
y[j] = (tempValue + params.bias) * params.scale;
|
||||||
if (y[j] < yminval) yminval = y[j];
|
if (y[j] < yminval) yminval = y[j];
|
||||||
if (y[j] > ymaxval) ymaxval = y[j];
|
if (y[j] > ymaxval) ymaxval = y[j];
|
||||||
|
|||||||
+2
-1
@@ -56,7 +56,8 @@ private:
|
|||||||
const QVector<CANFrame> *modelFrames;
|
const QVector<CANFrame> *modelFrames;
|
||||||
QList<GraphParams> graphParams;
|
QList<GraphParams> graphParams;
|
||||||
QPen selectedPen;
|
QPen selectedPen;
|
||||||
bool needScaleSetup; //do we need to set x,y graphing extents?s
|
bool needScaleSetup; //do we need to set x,y graphing extents?
|
||||||
|
bool secondsMode;
|
||||||
|
|
||||||
void showParamsDialog(int idx);
|
void showParamsDialog(int idx);
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
|||||||
Reference in New Issue
Block a user