예제 #1
0
/*!
   Change the alignment of the scale

   The alignment sets the orientation of the scale and the position of
   the ticks:

   - QwtScaleDraw::BottomScale: horizontal, ticks below
   - QwtScaleDraw::TopScale: horizontal, ticks above
   - QwtScaleDraw::LeftScale: vertical, ticks left
   - QwtScaleDraw::RightScale: vertical, ticks right

   For horizontal scales the position corresponds to QwtPlotItem::yAxis(),
   otherwise to QwtPlotItem::xAxis().

   \sa scaleDraw(), QwtScaleDraw::alignment(), setPosition()
*/
void QwtPlotScaleItem::setAlignment( QwtScaleDraw::Alignment alignment )
{
    QwtScaleDraw *sd = d_data->scaleDraw;
    if ( sd->alignment() != alignment )
    {
        sd->setAlignment( alignment );
        itemChanged();
    }
}
예제 #2
0
/*!
   \brief Constructor

   Enables major and disables minor grid lines.
   The azimuth and right radial axis are visible. all other axes
   are hidden. Autoscaling is enabled.
*/
QwtPolarGrid::QwtPolarGrid():
    QwtPolarItem( QwtText( "Grid" ) )
{
  d_data = new PrivateData;

  for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ )
  {
    AxisData &axis = d_data->axisData[axisId];
    switch ( axisId )
    {
      case QwtPolar::AxisAzimuth:
      {
        axis.scaleDraw = new QwtRoundScaleDraw;
        axis.scaleDraw->setTickLength( QwtScaleDiv::MinorTick, 2 );
        axis.scaleDraw->setTickLength( QwtScaleDiv::MediumTick, 2 );
        axis.scaleDraw->setTickLength( QwtScaleDiv::MajorTick, 4 );
        axis.isVisible = true;
        break;
      }
      case QwtPolar::AxisLeft:
      {
        QwtScaleDraw *scaleDraw = new QwtScaleDraw;
        scaleDraw->setAlignment( QwtScaleDraw::BottomScale );

        axis.scaleDraw = scaleDraw;
        axis.isVisible = false;
        break;
      }
      case QwtPolar::AxisRight:
      {
        QwtScaleDraw *scaleDraw = new QwtScaleDraw;
        scaleDraw->setAlignment( QwtScaleDraw::BottomScale );

        axis.scaleDraw = scaleDraw;
        axis.isVisible = true;
        break;
      }
      case QwtPolar::AxisTop:
      {
        QwtScaleDraw *scaleDraw = new QwtScaleDraw;
        scaleDraw->setAlignment( QwtScaleDraw::LeftScale );

        axis.scaleDraw = scaleDraw;
        axis.isVisible = false;
        break;
      }
      case QwtPolar::AxisBottom:
      {
        QwtScaleDraw *scaleDraw = new QwtScaleDraw;
        scaleDraw->setAlignment( QwtScaleDraw::LeftScale );

        axis.scaleDraw = scaleDraw;
        axis.isVisible = true;
        break;
      }
      default:;
    }
  }

  d_data->attributes = AutoScaling;

  d_data->displayFlags = 0;
  d_data->displayFlags |= SmartOriginLabel;
  d_data->displayFlags |= HideMaxRadiusLabel;
  d_data->displayFlags |= ClipAxisBackground;
  d_data->displayFlags |= SmartScaleDraw;
  d_data->displayFlags |= ClipGridLines;

  setZ( 10.0 );
#if QT_VERSION >= 0x040000
  setRenderHint( RenderAntialiased, true );
#endif
}