MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / updateAxes

Method updateAxes

3rdparty/qwt/src/qwt_plot_axis.cpp:670–755  ·  view source on GitHub ↗

! \brief Rebuild the axes scales In case of autoscaling the boundaries of a scale are calculated from the bounding rectangles of all plot items, having the QwtPlotItem::AutoScale flag enabled ( QwtScaleEngine::autoScale() ). Then a scale division is calculated ( QwtScaleEngine::didvideScale() ) and assigned to scale widget. When the scale boundaries have been assigned with s

Source from the content-addressed store, hash-verified

668 QwtPlotItem::boundingRect()
669 */
670void QwtPlot::updateAxes()
671{
672 // Find bounding interval of the item data
673 // for all axes, where autoscaling is enabled
674
675 QwtInterval boundingIntervals[QwtAxis::AxisPositions];
676
677 const QwtPlotItemList& itmList = itemList();
678
679 QwtPlotItemIterator it;
680 for ( it = itmList.begin(); it != itmList.end(); ++it )
681 {
682 const QwtPlotItem* item = *it;
683
684 if ( !item->testItemAttribute( QwtPlotItem::AutoScale ) )
685 continue;
686
687 if ( !item->isVisible() )
688 continue;
689
690 const QwtAxisId xAxis = item->xAxis();
691 const QwtAxisId yAxis = item->yAxis();
692
693 if ( axisAutoScale( xAxis ) || axisAutoScale( yAxis ) )
694 {
695 const QRectF rect = item->boundingRect();
696
697 if ( axisAutoScale( xAxis ) && rect.width() >= 0.0 )
698 boundingIntervals[xAxis] |= QwtInterval( rect.left(), rect.right() );
699
700 if ( axisAutoScale( yAxis ) && rect.height() >= 0.0 )
701 boundingIntervals[yAxis] |= QwtInterval( rect.top(), rect.bottom() );
702 }
703 }
704
705 // Adjust scales
706
707 for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
708 {
709 {
710 const QwtAxisId axisId( axisPos );
711
712 AxisData& d = m_scaleData->axisData( axisId );
713
714 double minValue = d.minValue;
715 double maxValue = d.maxValue;
716 double stepSize = d.stepSize;
717
718 const QwtInterval& interval = boundingIntervals[axisId];
719
720 if ( d.doAutoScale && interval.isValid() )
721 {
722 d.isValid = false;
723
724 minValue = interval.minValue();
725 maxValue = interval.maxValue();
726
727 d.scaleEngine->autoScale( d.maxMajor,

Callers 2

applyRectToAxesMethod · 0.80
setZoomRectangleMethod · 0.80

Calls 15

heightMethod · 0.80
axisDataMethod · 0.80
minValueMethod · 0.80
maxValueMethod · 0.80
setBorderDistMethod · 0.80
testItemInterestMethod · 0.80
QwtIntervalClass · 0.70
beginMethod · 0.45
endMethod · 0.45
testItemAttributeMethod · 0.45
isVisibleMethod · 0.45
xAxisMethod · 0.45

Tested by

no test coverage detected