Skip to content

Commit

Permalink
Merge pull request #9 from kartikmohta/master
Browse files Browse the repository at this point in the history
Correct maximumRangeY for the case when a curve does not span the full X range
  • Loading branch information
facontidavide authored Nov 21, 2016
2 parents e81aca8 + f3fa5d8 commit 4f5c0bf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plotter_gui/plotwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,11 @@ std::pair<double,double> PlotWidget::maximumRangeY(bool current_canvas)
max_X = range_X.second;
}

int X0 = data->plot()->getIndexFromX( min_X );
int X1 = data->plot()->getIndexFromX( max_X );
const auto range_X = data->plot()->getRangeX();
if( !range_X ) continue;

int X0 = data->plot()->getIndexFromX(std::max(range_X->min, min_X));
int X1 = data->plot()->getIndexFromX(std::min(range_X->max, max_X));

if( X0<0 || X1 <0)
{
Expand Down

0 comments on commit 4f5c0bf

Please sign in to comment.