test1.JPG, sorry, the problem is still, and the result is wrong! it looks like setAxisScale function is invalid to xTop? please help me.
Quote Originally Posted by Cah View Post
Run the code below... Are the scales drawn as expected?

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication a(argc, argv);
  4.  
  5. QwtPlot plot;
  6.  
  7. plot.setCanvasBackground( Qt::white );
  8.  
  9. plot.enableAxis(QwtPlot::xBottom,false);
  10. plot.enableAxis(QwtPlot::xTop,true);
  11.  
  12. plot.setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
  13. plot.setAxisScale( QwtPlot::xTop, 0.0, 10.0 );
  14.  
  15. QwtPlotCurve *curve= new QwtPlotCurve();
  16.  
  17. curve->setPen( Qt::blue );
  18. curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
  19.  
  20. QPolygonF points;
  21. points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
  22. << QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
  23. << QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
  24. curve->setSamples( points );
  25. curve->attach(&plot);
  26. plot.resize( 600, 400 );
  27.  
  28. plot.show();
  29.  
  30. return a.exec();
  31. }
To copy to clipboard, switch view to plain text mode