mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-14 17:32:13 -05:00
Added Qwt library and basic classes for well log viewer
This commit is contained in:
1 parent
20c1e609b8
commit
2b87c8c7d6
1744 files changed
+265009
No files matched your search
@@ -0,0 +1,35 @@
|
||||
#include "mainwindow.h"
|
||||
#include "plot.h"
|
||||
#include <qmath.h>
|
||||
|
||||
static double randomValue()
|
||||
{
|
||||
// a number between [ 0.0, 1.0 ]
|
||||
return ( qrand() % 100000 ) / 100000.0;
|
||||
}
|
||||
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
d_plot = new Plot( this );
|
||||
d_plot->setTitle( "Scatter Plot" );
|
||||
setCentralWidget( d_plot );
|
||||
|
||||
// a million points
|
||||
setSamples( 100000 );
|
||||
}
|
||||
|
||||
void MainWindow::setSamples( int numPoints )
|
||||
{
|
||||
QPolygonF samples;
|
||||
|
||||
for ( int i = 0; i < numPoints; i++ )
|
||||
{
|
||||
const double x = randomValue() * 24.0 + 1.0;
|
||||
const double y = ::log( 10.0 * ( x - 1.0 ) + 1.0 )
|
||||
* ( randomValue() * 0.5 + 0.9 );
|
||||
|
||||
samples += QPointF( x, y );
|
||||
}
|
||||
|
||||
d_plot->setSamples( samples );
|
||||
}
|
||||
Reference in new issue
Block a user