2025-04-28T17:31:28
This commit is contained in:
parent
18e29319df
commit
c3aa0df987
BIN
experiment_data/sample_data/~$锡.xlsx
Normal file
BIN
experiment_data/sample_data/~$锡.xlsx
Normal file
Binary file not shown.
@ -16,6 +16,8 @@ const QString SampleDataFloder = ExperimentDirPath + "/sample_data";
|
||||
const QString BaseLineFolder = ExperimentDirPath + "/base_line";
|
||||
const QString AnalysisStateFolder = ExperimentDirPath + "/analysis_state";
|
||||
|
||||
const QString CurveOfTimeTypeObjectName("curve_time");
|
||||
|
||||
enum Mode{
|
||||
Analysis,
|
||||
ConnectedToDev,
|
||||
@ -69,7 +71,7 @@ struct CurveFileData{
|
||||
|
||||
struct CurveExperimentData{
|
||||
QCPCurve * curve;
|
||||
QString fileName;
|
||||
QString fileName; // discard
|
||||
QVector<Global::ExperimentData> dataVtr;
|
||||
};
|
||||
|
||||
|
@ -7,5 +7,6 @@
|
||||
<file>images/real_time_widget.png</file>
|
||||
<file>images/logo.png</file>
|
||||
<file>images/logo.ico</file>
|
||||
<file>images/axis.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
src/images/axis.png
Normal file
BIN
src/images/axis.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
@ -389,3 +389,8 @@ void MainWindow::on_actionEndsetTemperaturePoint_triggered()
|
||||
_rightWidget->show();
|
||||
_centralWidget->setAnalysisMode(CentralWidget::AnalysisMode::EndsetTemperaturePoint);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionYAxis_triggered()
|
||||
{
|
||||
_centralWidget->switchAxisMode();
|
||||
}
|
||||
|
@ -87,6 +87,8 @@ private slots:
|
||||
|
||||
void on_actionEndsetTemperaturePoint_triggered();
|
||||
|
||||
void on_actionYAxis_triggered();
|
||||
|
||||
private:
|
||||
void connections();
|
||||
void setActionEnable(const bool);
|
||||
|
@ -36,6 +36,7 @@
|
||||
<string>视图</string>
|
||||
</property>
|
||||
<addaction name="actionRealTimeWidget"/>
|
||||
<addaction name="actionYAxis"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_3">
|
||||
<property name="title">
|
||||
@ -116,6 +117,7 @@
|
||||
<addaction name="actionStart"/>
|
||||
<addaction name="actionStop"/>
|
||||
<addaction name="actionRealTimeWidget"/>
|
||||
<addaction name="actionYAxis"/>
|
||||
<addaction name="actionReadOnly"/>
|
||||
<addaction name="actionClearAllData"/>
|
||||
</widget>
|
||||
@ -286,6 +288,15 @@
|
||||
<string>打印预览</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionYAxis">
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<normaloff>:/images/axis.png</normaloff>:/images/axis.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Y轴</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc"/>
|
||||
|
@ -41,7 +41,7 @@ bool commonDataParser(const QByteArray &ba, CommonData &cd)
|
||||
|
||||
QByteArray connectToDevice(const QVector<Phase> &vtr)
|
||||
{
|
||||
// const int phaseLength = sizeof(Phase);
|
||||
// const int phaseLength = sizeof(Phase);
|
||||
const int phaseLength = PHASE_BYTE_SIZE;
|
||||
|
||||
const int phaseArrayLength = vtr.size() * phaseLength;
|
||||
@ -162,12 +162,15 @@ void experimentalStateSwitching(const CommonData &cd)
|
||||
Global::_curveExperimentDataVtr.push_back(ced);
|
||||
Global::_currentCurveExperimentDataPtr = &Global::_curveExperimentDataVtr.last();
|
||||
|
||||
Global::_currentCurveExperimentDataPtr->fileName = Global::_experimentInfo.sampleName;
|
||||
#if 1
|
||||
Global::_currentCurveExperimentDataPtr->fileName =
|
||||
Global::_experimentInfo.sampleName;
|
||||
#endif
|
||||
}
|
||||
|
||||
// logde<<"phase:"<<(int)cd.current_phase;
|
||||
// logde<<"run type:"<<(int)cd.run_type;
|
||||
// logde<<"software mode:"<<Global::_mode;
|
||||
// logde<<"phase:"<<(int)cd.current_phase;
|
||||
// logde<<"run type:"<<(int)cd.run_type;
|
||||
// logde<<"software mode:"<<Global::_mode;
|
||||
}
|
||||
|
||||
unsigned short modbusCRC16(unsigned char *data, unsigned short length)
|
||||
|
@ -13,10 +13,11 @@
|
||||
|
||||
CentralWidget::CentralWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
,_customPlot(new LocalCustomPlot(this))
|
||||
// ,_customPlot(new QCustomPlot(this))
|
||||
,_customPlot(new LocalCustomPlot(this))
|
||||
// ,_customPlot(new QCustomPlot(this))
|
||||
,_analysisMode(AnalysisMode::Null)
|
||||
,_currentCurve(nullptr)
|
||||
,_axisMode(AxisMode::SingleY)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
|
||||
@ -90,6 +91,62 @@ CentralWidget::~CentralWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void CentralWidget::switchAxisMode()
|
||||
{
|
||||
if(Global::_mode != Global::Mode::Analysis){
|
||||
return;
|
||||
}
|
||||
|
||||
if(_axisMode == AxisMode::SingleY){
|
||||
_axisMode = AxisMode::DoubleY;
|
||||
|
||||
_customPlot->yAxis2->setVisible(true);
|
||||
_customPlot->yAxis2->setLabel("Time/min");
|
||||
|
||||
for(Global::CurveFileData& cfd:Global::_curveFileDataVtr){
|
||||
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
||||
|
||||
QVector<Global::ExperimentData> dataVtr;
|
||||
QVector<double> tVtr,xVtr, yVtr;
|
||||
int index = 0;
|
||||
for (Global::ExperimentData &ed : pti.dataVtr)
|
||||
{
|
||||
tVtr.push_back(index++);
|
||||
xVtr.push_back(ed.sampleTemp);
|
||||
yVtr.push_back(ed.runTime);
|
||||
}
|
||||
|
||||
double yMin = yVtr.first();
|
||||
double yMax = yVtr.last();
|
||||
double tick = (yMax - yMin) / 4;
|
||||
|
||||
double axisMin = yMin - tick;
|
||||
double axisMax = yMax + tick;
|
||||
_customPlot->yAxis2->setRange(axisMin,axisMax);
|
||||
|
||||
QCPCurve* curve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis2);
|
||||
curve->setData(tVtr, xVtr, yVtr);
|
||||
|
||||
curve->setObjectName(Global::CurveOfTimeTypeObjectName);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
_axisMode = AxisMode::SingleY;
|
||||
|
||||
_customPlot->yAxis2->setVisible(false);
|
||||
|
||||
for (int i = _customPlot->graphCount() - 1; i >= 0; --i) {
|
||||
QCPGraph *graph = _customPlot->graph(i);
|
||||
if(graph && graph->objectName() == Global::CurveOfTimeTypeObjectName){
|
||||
_customPlot->removeGraph(graph);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_customPlot->replot();
|
||||
}
|
||||
|
||||
void CentralWidget::setAnalysisMode(const CentralWidget::AnalysisMode mode)
|
||||
{
|
||||
_analysisMode = mode;
|
||||
@ -929,6 +986,7 @@ QPixmap CentralWidget::getPixMap()
|
||||
return _customPlot->toPixmap();
|
||||
}
|
||||
|
||||
|
||||
void CentralWidget::slotAxisModify(const float temp)
|
||||
{
|
||||
_customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||
|
@ -35,6 +35,12 @@ public:
|
||||
EventHandler* getEvnetHandler(){return _eventHandler;}
|
||||
|
||||
QPixmap getPixMap();
|
||||
|
||||
enum AxisMode{
|
||||
SingleY,
|
||||
DoubleY
|
||||
};
|
||||
void switchAxisMode();
|
||||
signals:
|
||||
void sigContextMenuShow(const QPoint);
|
||||
void sigSendLineXCoord(const int,const double);
|
||||
@ -88,6 +94,7 @@ private:
|
||||
QCPItemStraightLine *_line1,*_line2;
|
||||
// QVector<Global::ExperimentData> _dataVtr;
|
||||
QVector<QCPItemStraightLine*> _lineVtr;
|
||||
AxisMode _axisMode;
|
||||
};
|
||||
|
||||
#endif // CENTRALWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user