1.fixed aspect ratios for plot scales

It's used for plotting geometry

QwtPlotRescaler takes care of fixed aspect ratios for plot scales.

QwtPlotRescaler auto adjusts the axes of a QwtPlot according to fixed aspect ratios.

ExpandingDirection

ExpandUp 

The upper limit of the scale is adjusted.

ExpandDown 

The lower limit of the scale is adjusted.

ExpandBoth 

Both limits of the scale are adjusted.

 

 

RescalePolicy

Fixed 

The interval of the reference axis remains unchanged, when the geometry of the canvas changes. All other axes will be adjusted according to their aspect ratio.

Expanding 

The interval of the reference axis will be shrunk/expanded, when the geometry of the canvas changes. All other axes will be adjusted according to their aspect ratio.

The interval, that is represented by one pixel is fixed.

Fitting 

The intervals of the axes are calculated, so that all axes include their interval hint.

Usage:

      d_rescaler->setEnabled(true);
      d_rescaler->setReferenceAxis(QwtPlot::xBottom);
      d_rescaler->setAspectRatio(QwtPlot::yLeft, 1.0);

      d_rescaler->setAspectRatio(QwtPlot::yRight, 0.0);
      d_rescaler->setAspectRatio(QwtPlot::xTop, 0.0);
	  // used fitting method but changed Expanding option to 
	  // zoom and pan the plot for fixed aspect ratio plots
      d_rescaler->setRescalePolicy(QwtPlotRescaler::Fitting); 

      QwtPlotRescaler::ExpandingDirection direction = QwtPlotRescaler::ExpandBoth;
      for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
        d_rescaler->setExpandingDirection(direction);

      d_rescaler->setIntervalHint(QwtPlot::xBottom, QwtDoubleInterval(x[0] - dx*margin, x[1] + dx*margin));
      d_rescaler->setIntervalHint(QwtPlot::yLeft, QwtDoubleInterval(x[2] - dy*margin, x[3] + dy*margin));
      d_rescaler->rescale();

2.variable aspect ratios for plot scales

It's used for single curves.

Usage:

if(d_rescaler)
  d_rescaler->setEnabled(false);
setNiceAxisScale(QwtPlot::xBottom, x[0] - dx*margin, x[1] + dx*margin);
setNiceAxisScale(QwtPlot::yLeft, x[2] - dy*margin, x[3] + dy*margin);

Revision: 12207
Date: Saturday, January 9, 2021 12:10:56 PM
Message:
replace plt_xxx series with draw_xxx series in 3D module
 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐