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 BaseLineFolder = ExperimentDirPath + "/base_line";
|
||||||
const QString AnalysisStateFolder = ExperimentDirPath + "/analysis_state";
|
const QString AnalysisStateFolder = ExperimentDirPath + "/analysis_state";
|
||||||
|
|
||||||
|
const QString CurveOfTimeTypeObjectName("curve_time");
|
||||||
|
|
||||||
enum Mode{
|
enum Mode{
|
||||||
Analysis,
|
Analysis,
|
||||||
ConnectedToDev,
|
ConnectedToDev,
|
||||||
@ -69,7 +71,7 @@ struct CurveFileData{
|
|||||||
|
|
||||||
struct CurveExperimentData{
|
struct CurveExperimentData{
|
||||||
QCPCurve * curve;
|
QCPCurve * curve;
|
||||||
QString fileName;
|
QString fileName; // discard
|
||||||
QVector<Global::ExperimentData> dataVtr;
|
QVector<Global::ExperimentData> dataVtr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -7,5 +7,6 @@
|
|||||||
<file>images/real_time_widget.png</file>
|
<file>images/real_time_widget.png</file>
|
||||||
<file>images/logo.png</file>
|
<file>images/logo.png</file>
|
||||||
<file>images/logo.ico</file>
|
<file>images/logo.ico</file>
|
||||||
|
<file>images/axis.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</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();
|
_rightWidget->show();
|
||||||
_centralWidget->setAnalysisMode(CentralWidget::AnalysisMode::EndsetTemperaturePoint);
|
_centralWidget->setAnalysisMode(CentralWidget::AnalysisMode::EndsetTemperaturePoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionYAxis_triggered()
|
||||||
|
{
|
||||||
|
_centralWidget->switchAxisMode();
|
||||||
|
}
|
||||||
|
|||||||
@ -87,6 +87,8 @@ private slots:
|
|||||||
|
|
||||||
void on_actionEndsetTemperaturePoint_triggered();
|
void on_actionEndsetTemperaturePoint_triggered();
|
||||||
|
|
||||||
|
void on_actionYAxis_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void connections();
|
void connections();
|
||||||
void setActionEnable(const bool);
|
void setActionEnable(const bool);
|
||||||
|
|||||||
@ -36,6 +36,7 @@
|
|||||||
<string>视图</string>
|
<string>视图</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionRealTimeWidget"/>
|
<addaction name="actionRealTimeWidget"/>
|
||||||
|
<addaction name="actionYAxis"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_3">
|
<widget class="QMenu" name="menu_3">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -116,6 +117,7 @@
|
|||||||
<addaction name="actionStart"/>
|
<addaction name="actionStart"/>
|
||||||
<addaction name="actionStop"/>
|
<addaction name="actionStop"/>
|
||||||
<addaction name="actionRealTimeWidget"/>
|
<addaction name="actionRealTimeWidget"/>
|
||||||
|
<addaction name="actionYAxis"/>
|
||||||
<addaction name="actionReadOnly"/>
|
<addaction name="actionReadOnly"/>
|
||||||
<addaction name="actionClearAllData"/>
|
<addaction name="actionClearAllData"/>
|
||||||
</widget>
|
</widget>
|
||||||
@ -286,6 +288,15 @@
|
|||||||
<string>打印预览</string>
|
<string>打印预览</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</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>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="images.qrc"/>
|
<include location="images.qrc"/>
|
||||||
|
|||||||
@ -162,7 +162,10 @@ void experimentalStateSwitching(const CommonData &cd)
|
|||||||
Global::_curveExperimentDataVtr.push_back(ced);
|
Global::_curveExperimentDataVtr.push_back(ced);
|
||||||
Global::_currentCurveExperimentDataPtr = &Global::_curveExperimentDataVtr.last();
|
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<<"phase:"<<(int)cd.current_phase;
|
||||||
|
|||||||
@ -17,6 +17,7 @@ CentralWidget::CentralWidget(QWidget *parent)
|
|||||||
// ,_customPlot(new QCustomPlot(this))
|
// ,_customPlot(new QCustomPlot(this))
|
||||||
,_analysisMode(AnalysisMode::Null)
|
,_analysisMode(AnalysisMode::Null)
|
||||||
,_currentCurve(nullptr)
|
,_currentCurve(nullptr)
|
||||||
|
,_axisMode(AxisMode::SingleY)
|
||||||
{
|
{
|
||||||
setMouseTracking(true);
|
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)
|
void CentralWidget::setAnalysisMode(const CentralWidget::AnalysisMode mode)
|
||||||
{
|
{
|
||||||
_analysisMode = mode;
|
_analysisMode = mode;
|
||||||
@ -929,6 +986,7 @@ QPixmap CentralWidget::getPixMap()
|
|||||||
return _customPlot->toPixmap();
|
return _customPlot->toPixmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CentralWidget::slotAxisModify(const float temp)
|
void CentralWidget::slotAxisModify(const float temp)
|
||||||
{
|
{
|
||||||
_customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
_customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||||
|
|||||||
@ -35,6 +35,12 @@ public:
|
|||||||
EventHandler* getEvnetHandler(){return _eventHandler;}
|
EventHandler* getEvnetHandler(){return _eventHandler;}
|
||||||
|
|
||||||
QPixmap getPixMap();
|
QPixmap getPixMap();
|
||||||
|
|
||||||
|
enum AxisMode{
|
||||||
|
SingleY,
|
||||||
|
DoubleY
|
||||||
|
};
|
||||||
|
void switchAxisMode();
|
||||||
signals:
|
signals:
|
||||||
void sigContextMenuShow(const QPoint);
|
void sigContextMenuShow(const QPoint);
|
||||||
void sigSendLineXCoord(const int,const double);
|
void sigSendLineXCoord(const int,const double);
|
||||||
@ -88,6 +94,7 @@ private:
|
|||||||
QCPItemStraightLine *_line1,*_line2;
|
QCPItemStraightLine *_line1,*_line2;
|
||||||
// QVector<Global::ExperimentData> _dataVtr;
|
// QVector<Global::ExperimentData> _dataVtr;
|
||||||
QVector<QCPItemStraightLine*> _lineVtr;
|
QVector<QCPItemStraightLine*> _lineVtr;
|
||||||
|
AxisMode _axisMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CENTRALWIDGET_H
|
#endif // CENTRALWIDGET_H
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user