adapt the spline to show nice curves

This commit is contained in:
Peter Hartmann 2021-04-21 09:22:43 +02:00
parent 282dbcb7f0
commit 4621f54f81
1 changed files with 10 additions and 4 deletions

View File

@ -73,9 +73,9 @@ UsageDiagram::UsageDiagram( QQuickItem* parent )
int number = 100;
std::vector< std::vector<qreal> > yValues =
{
{70, 80, 60, 50, 40, 50, 75, 80, 100, 90, 60, 50},
{30, 15, 70, 40, 60, 10, 90, 20, 40, 45, 50, 70},
{10, 70, 40, 60, 10, 70, 20, 50, 20, 30, 40, 80}
{40, 55, 60, 50, 40, 50, 75, 80, 100, 90},
{30, 15, 30, 40, 60, 10, 70, 20, 40, 45},
{60, 45, 60, 70, 10, 70, 20, 50, 20, 30}
};
for( int i = 0; i < 3; ++i )
@ -91,9 +91,15 @@ UsageDiagram::UsageDiagram( QQuickItem* parent )
for( int x = 0; x < number; ++x )
{
const qreal y = spline( x );
dataPoints.append( QPointF( x, qBound( 0.0, y, 100.0 ) ) );
QPointF p( x, qBound( 0.0, y, 100.0 ) );
printf( "%.2f, ", y );
dataPoints.append( p );
}
printf( "\n" );
m_diagram->addDataPoints( dataPoints, Diagram::Area );
}