}
fitAll();
//myPlot->setUpdatesEnabled( true );
-// update legend
+ // update legend
if ( update )
myPlot->replot();
}
{
myLegendPos = pos;
QwtLegend* legend = myPlot->legend();
- switch( pos ) {
- case 0:
- myPlot->insertLegend( legend, QwtPlot::LeftLegend );
- break;
- case 1:
- myPlot->insertLegend( legend, QwtPlot::RightLegend );
- break;
- case 2:
- myPlot->insertLegend( legend, QwtPlot::TopLegend );
- break;
- case 3:
- myPlot->insertLegend( legend, QwtPlot::BottomLegend );
- break;
+ if ( legend ) {
+ switch( pos ) {
+ case 0:
+ myPlot->insertLegend( legend, QwtPlot::LeftLegend );
+ break;
+ case 1:
+ myPlot->insertLegend( legend, QwtPlot::RightLegend );
+ break;
+ case 2:
+ myPlot->insertLegend( legend, QwtPlot::TopLegend );
+ break;
+ case 3:
+ myPlot->insertLegend( legend, QwtPlot::BottomLegend );
+ break;
+ }
}
}
{
QwtPlotCurve::updateLegend( legend );
- QWidget* widget = legend->find( this );
- if( Plot2d_QwtLegendItem* anItem = dynamic_cast<Plot2d_QwtLegendItem*>( widget ) ) {
- int aMode = Plot2d_QwtLegendItem::IM_None;
- if( myYAxisIdentifierEnabled )
- aMode = myYAxis == QwtPlot::yRight ?
- Plot2d_QwtLegendItem::IM_Right :
- Plot2d_QwtLegendItem::IM_Left;
- anItem->setYAxisIdentifierMode( aMode );
+ if ( legend ) {
+ QWidget* widget = legend->find( this );
+ if( Plot2d_QwtLegendItem* anItem = dynamic_cast<Plot2d_QwtLegendItem*>( widget ) ) {
+ int aMode = Plot2d_QwtLegendItem::IM_None;
+ if( myYAxisIdentifierEnabled )
+ aMode = myYAxis == QwtPlot::yRight ?
+ Plot2d_QwtLegendItem::IM_Right :
+ Plot2d_QwtLegendItem::IM_Left;
+ anItem->setYAxisIdentifierMode( aMode );
+ }
}
}