Changeset - be1c704d9dcc
[Not reviewed]
plot-manager
0 1 0
Hasan Yavuz Ă–ZDERYA - 9 years ago 2016-08-25 01:47:06
hy@ozderya.net
simplify code
1 file changed with 0 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/plotmanager.cpp
Show inline comments
 
@@ -162,60 +162,53 @@ void PlotManager::addCurve(QString title
 
    unsigned index = curves.size()-1;
 
    curve->setPen(Plot::makeColor(index));
 

	
 
    curve->attach(plot);
 
    plot->replot();
 
}
 

	
 
void PlotManager::removeCurves(unsigned number)
 
{
 
    for (unsigned i = 0; i < number; i++)
 
    {
 
        if (!curves.isEmpty())
 
        {
 
            delete curves.takeLast();
 
            if (isMulti) // delete corresponding widget as well
 
            {
 
                delete plotWidgets.takeLast();
 
            }
 
        }
 
    }
 
}
 

	
 
unsigned PlotManager::numOfCurves()
 
{
 
    return curves.size();
 
}
 

	
 
void PlotManager::setTitle(unsigned index, QString title)
 
{
 
    curves[index]->setTitle(title);
 

	
 
    plotWidget(index)->replot();
 
}
 

	
 
Plot* PlotManager::plotWidget(unsigned curveIndex)
 
{
 
    if (isMulti)
 
    {
 
        return plotWidgets[curveIndex];
 
    }
 
    else
 
    {
 
        return plotWidgets[0];
 
    }
 
}
 

	
 
void PlotManager::replot()
 
{
 
    if (isMulti)
 
    {
 
        for (auto plot : plotWidgets)
 
        {
 
            plot->replot();
 
        }
 
    }
 
    else
 
    {
 
        plotWidgets[0]->replot();
 
    }
 
}
0 comments (0 inline, 0 general)