|
30 | 30 | #include <Core/Algorithms/Base/AlgorithmVariableNames.h> |
31 | 31 | #include <Core/Logging/Log.h> |
32 | 32 | #include <Dataflow/Network/ModuleStateInterface.h> //TODO: extract into intermediate |
| 33 | +#include <qwt_plot.h> |
| 34 | +#include <qwt_plot_curve.h> |
| 35 | +#include <qwt_legend.h> |
33 | 36 |
|
34 | 37 | using namespace SCIRun::Gui; |
35 | 38 | using namespace SCIRun::Dataflow::Networks; |
36 | 39 | using namespace SCIRun::Core::Algorithms; |
37 | 40 |
|
| 41 | + |
38 | 42 | namespace SCIRun { |
39 | 43 | namespace Gui { |
40 | 44 | class SolveLinearSystemDialogImpl |
@@ -62,6 +66,36 @@ SolveLinearSystemDialog::SolveLinearSystemDialog(const std::string& name, Module |
62 | 66 | addSpinBoxManager(maxIterationsSpinBox_, Variables::MaxIterations); |
63 | 67 | addDoubleSpinBoxManager(targetErrorSpinBox_, Variables::TargetError); |
64 | 68 |
|
| 69 | + QwtPlot *myPlot = this->qwtPlot; |
| 70 | + QwtLegend *myLegend = new QwtLegend; |
| 71 | + QwtPlotCurve *curve1 = new QwtPlotCurve("Current Target"); |
| 72 | + QwtPlotCurve *curve2 = new QwtPlotCurve("Target Error"); |
| 73 | + QwtPlotCurve *curve3 = new QwtPlotCurve("CurrentError"); |
| 74 | + double x[5] = { 0, 10, 15, 20, 25 }; |
| 75 | + double y[5] = { 0, 2, 4, 16, 64 }; |
| 76 | + |
| 77 | + curve1->setSamples(&x[0], &y[0], (size_t)5); |
| 78 | + curve1->setPen(Qt::blue); |
| 79 | + curve1->setLegendAttribute(QwtPlotCurve::LegendShowLine); |
| 80 | + curve1->setItemAttribute(QwtPlotItem::Legend, true); |
| 81 | + |
| 82 | + curve2->setPen(Qt::darkRed); |
| 83 | + curve2->setLegendAttribute(QwtPlotCurve::LegendShowLine); |
| 84 | + curve2->setItemAttribute(QwtPlotItem::Legend, true); |
| 85 | + |
| 86 | + curve3->setPen(Qt::darkGreen); |
| 87 | + curve3->setLegendAttribute(QwtPlotCurve::LegendShowLine); |
| 88 | + curve3->setItemAttribute(QwtPlotItem::Legend, true); |
| 89 | + |
| 90 | + myPlot->setAxisTitle(2, QString("Iteration")); |
| 91 | + myPlot->setAxisTitle(0, QString("Error (RMS)")); |
| 92 | + myPlot->setTitle(QString("Convergence")); |
| 93 | + myPlot->insertLegend(myLegend, QwtPlot::RightLegend); |
| 94 | + |
| 95 | + curve1->attach(myPlot); |
| 96 | + myPlot->replot(); |
| 97 | + myPlot->show(); |
| 98 | + |
65 | 99 | addComboBoxManager(preconditionerComboBox_, Variables::Preconditioner); |
66 | 100 | addComboBoxManager(methodComboBox_, Variables::Method, impl_->solverNameLookup_); |
67 | 101 | } |
|
0 commit comments