- myDensity = insertCurve( QString() );
- myDistr = insertCurve( QString() );
- myMsg = insertMarker( new QwtPlotMarker( this ) );
- setMarkerPos( myMsg, 0.5, 0.5 );
- setMarkerLabelPen( myMsg, QPen( Qt::red, 1 ) );
- QFont f = markerFont( myMsg );
- f.setPointSize( 14 );
- f.setBold( true );
- setMarkerFont( myMsg, f );
- setCurvePen( myDensity, QPen( Qt::red, 1 ) );
-
- QColor dc = Qt::blue;
- setCurvePen( myDistr, QPen( dc, 1 ) );
- setCurveSymbol( myDistr, QwtSymbol( QwtSymbol::XCross, QBrush( dc ), QPen( dc ), QSize( 5, 5 ) ) );
- setAutoLegend( true );
- enableLegend( true );
- setLegendPos( Qwt::Bottom );
- setCurveTitle( myDensity, tr( "SMESH_DENSITY_FUNC" ) );
- setCurveTitle( myDistr, tr( "SMESH_DISTR" ) );
+
+ QwtAbstractLegend* absLegend = legend();
+ QwtLegend* legend = 0;
+ if ( !absLegend ) {
+ legend = new Plot2d_QwtLegend( this );
+ legend->setFrameStyle( QFrame::Box | QFrame::Sunken );
+ }
+ else
+ legend = dynamic_cast<QwtLegend*>( absLegend );
+ if( legend )
+ insertLegend( legend, QwtPlot::BottomLegend );
+
+ myDensity = new QwtPlotCurve( QString() );
+ myDensity->attach( this );
+ QPen densityPen = QPen( Qt::red, 1 );
+ myDensity->setPen( QPen( Qt::red, 1 ) );
+ if( Plot2d_QwtLegendLabel* anItem = getLegendLabel( myDensity ) ) {
+ anItem->setPen( densityPen );
+ anItem->repaint();
+ }
+
+ myDistr = new QwtPlotCurve( QString() );
+ myDistr->attach( this );
+ QPen distrPen = QPen( Qt::blue, 1 );
+ QwtSymbol* distrSymbol = new QwtSymbol( QwtSymbol::XCross, QBrush( Qt::blue ),
+ QPen( Qt::blue ), QSize( 5, 5 ) );
+ myDistr->setPen( distrPen );
+ myDistr->setSymbol( distrSymbol );
+ if( Plot2d_QwtLegendLabel* anItem = getLegendLabel( myDistr ) ) {
+ anItem->setPen( distrPen );
+ anItem->setSymbol( distrSymbol );
+ anItem->repaint();
+ }
+
+ myMsg = new QwtPlotMarker();
+ myMsg->attach( this );
+ myMsg->setValue( 0.5, 0.5 );
+ QwtText mt = myMsg->label();
+ mt.setBorderPen( QPen( Qt::red, 1 ) );
+ QFont f = mt.font();
+ f.setPointSize( 14 ); //f.setBold( true );
+ mt.setFont( f );
+ myMsg->setLabel( mt );
+
+ enableAxis(QwtPlot::yLeft, false);
+ enableAxis(QwtPlot::yRight, true);
+
+ QFont axisFont;
+ axisFont.setPointSize( 8 );
+ setAxisFont(QwtPlot::yRight, axisFont);
+ setAxisFont(QwtPlot::xBottom, axisFont);
+
+ myDensity->setYAxis(QwtPlot::yRight);
+ myDistr->setYAxis(QwtPlot::yRight);
+ myMsg->setYAxis(QwtPlot::yRight);
+ myDensity->setTitle( tr( "SMESH_DENSITY_FUNC" ) );
+ myDistr->setTitle( tr( "SMESH_DISTR" ) );
+
+ QwtPlotGrid* aGrid = new QwtPlotGrid();
+ QPen aMajPen = aGrid->majorPen();
+ aMajPen.setStyle( Qt::DashLine );
+ aGrid->setPen( aMajPen );
+
+ aGrid->enableX( true );
+ aGrid->enableY( true );
+
+ aGrid->attach( this );