Skip to content

Commit 002edb0

Browse files
committed
- Added a new command plot3 that uses OMPlot
- plot3(x, true/false(externalWindow), filename, title, legend.....) - added spawnCall function in system.mo since system method blocks the execution so using spawn instead. - small update in plotwindow git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8511 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent e44a358 commit 002edb0

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

OMPlot/OMPlotGUI/PlotWindow.cpp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -263,20 +263,15 @@ void PlotWindow::plot()
263263
pPlotCurve->setTitle(currentVariable);
264264
pPlotCurve->setRawData(pPlotCurve->getXAxisVector(), pPlotCurve->getYAxisVector(),
265265
pPlotCurve->getSize());
266+
pPlotCurve->attach(mpPlot);
267+
mpPlot->replot();
266268
}
267269
// if plottype is PLOT and we have read all the variable we need to plot then simply break the loop
268270
if (getPlotType() == PlotWindow::PLOT)
269271
if (mVariablesList.size() == variablesPlotted.size())
270272
break;
271273
}
272274
}
273-
// set the colors of the curves
274-
int counter = 0;
275-
foreach (PlotCurve *pPlotCurve, mpPlot->getPlotCurvesList())
276-
{
277-
pPlotCurve->attach(mpPlot);
278-
counter++;
279-
}
280275
// if plottype is PLOT then check which requested variables are not found in the file
281276
if (getPlotType() == PlotWindow::PLOT)
282277
checkForErrors(mVariablesList, variablesPlotted);
@@ -332,6 +327,7 @@ void PlotWindow::plot()
332327
pPlotCurve[i]->setRawData(pPlotCurve[i]->getXAxisVector(), pPlotCurve[i]->getYAxisVector(),
333328
pPlotCurve[i]->getSize());
334329
pPlotCurve[i]->attach(mpPlot);
330+
mpPlot->replot();
335331
}
336332

337333
// if plottype is PLOT then check which requested variables are not found in the file
@@ -379,6 +375,7 @@ void PlotWindow::plot()
379375
// set plot curve data and attach it to plot
380376
pPlotCurve->setRawData(timeVals, vals, reader.nrows);
381377
pPlotCurve->attach(mpPlot);
378+
mpPlot->replot();
382379
}
383380
// if variable is a parameter then
384381
else
@@ -394,6 +391,7 @@ void PlotWindow::plot()
394391
pPlotCurve->setRawData(pPlotCurve->getXAxisVector(), pPlotCurve->getYAxisVector(),
395392
pPlotCurve->getSize());
396393
pPlotCurve->attach(mpPlot);
394+
mpPlot->replot();
397395
}
398396
}
399397
}
@@ -472,20 +470,15 @@ void PlotWindow::plotParametric()
472470
pPlotCurve->setTitle(yVariable + "(" + xVariable + ")");
473471
pPlotCurve->setRawData(pPlotCurve->getXAxisVector(), pPlotCurve->getYAxisVector(),
474472
pPlotCurve->getSize());
473+
pPlotCurve->attach(mpPlot);
474+
mpPlot->replot();
475475
}
476476
}
477477
// if we have read all the variable we need to plot then simply break the loop
478478
if (mVariablesList.size() == variablesPlotted.size())
479479
break;
480480
}
481481
}
482-
// set the colors of the curves
483-
int counter = 0;
484-
foreach (PlotCurve *pPlotCurve, mpPlot->getPlotCurvesList())
485-
{
486-
pPlotCurve->attach(mpPlot);
487-
counter++;
488-
}
489482
// check which requested variables are not found in the file
490483
checkForErrors(mVariablesList, variablesPlotted);
491484
}
@@ -537,6 +530,7 @@ void PlotWindow::plotParametric()
537530
pPlotCurve->setRawData(pPlotCurve->getXAxisVector(), pPlotCurve->getYAxisVector(),
538531
pPlotCurve->getSize());
539532
pPlotCurve->attach(mpPlot);
533+
mpPlot->replot();
540534
// check which requested variables are not found in the file
541535
checkForErrors(mVariablesList, variablesPlotted);
542536
}
@@ -570,6 +564,7 @@ void PlotWindow::plotParametric()
570564
pPlotCurve->setRawData(xVals, yVals, reader.nrows);
571565
pPlotCurve->setTitle(yVariable + "(" + xVariable + ")");
572566
pPlotCurve->attach(mpPlot);
567+
mpPlot->replot();
573568
}
574569
// close the file
575570
mFile.close();
@@ -753,9 +748,9 @@ void PlotWindow::setGrid(bool on)
753748

754749
void PlotWindow::setOriginal()
755750
{
756-
// mpPlot->setAxisAutoScale(QwtPlot::yLeft);
757-
// mpPlot->setAxisAutoScale(QwtPlot::xBottom);
758-
mpPlot->getPlotZoomer()->zoom(0);
751+
mpPlot->setAxisAutoScale(QwtPlot::yLeft);
752+
mpPlot->setAxisAutoScale(QwtPlot::xBottom);
753+
// mpPlot->getPlotZoomer()->zoom(0);
759754
mpPlot->replot();
760755
}
761756

0 commit comments

Comments
 (0)