##// END OF EJS Templates
Fix to domain initialization
Marek Rosa -
r1740:29786dde6bc4
parent child
Show More
@@ -397,30 +397,29 QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q) :
397 397
398 398 void QXYSeriesPrivate::scaleDomain(Domain& domain)
399 399 {
400 qreal minX(domain.minX());
401 qreal minY(domain.minY());
402 qreal maxX(domain.maxX());
403 qreal maxY(domain.maxY());
400 qreal minX(0);
401 qreal minY(0);
402 qreal maxX(1);
403 qreal maxY(1);
404 404
405 405 Q_Q(QXYSeries);
406 406
407 407 const QList<QPointF>& points = q->points();
408 408
409
410 if (points.isEmpty()){
411 minX = qMin(minX, (qreal)0.0);
412 minY = qMin(minY, (qreal)0.0);
413 maxX = qMax(maxX, (qreal)1.0);
414 maxY = qMax(maxY, (qreal)1.0);
415 }
416
417 for (int i = 0; i < points.count(); i++) {
418 qreal x = points[i].x();
419 qreal y = points[i].y();
420 minX = qMin(minX, x);
421 minY = qMin(minY, y);
422 maxX = qMax(maxX, x);
423 maxY = qMax(maxY, y);
409 if (!points.isEmpty()){
410 minX = points[0].x();
411 minY = points[0].y();
412 maxX = minX;
413 maxY = minY;
414
415 for (int i = 0; i < points.count(); i++) {
416 qreal x = points[i].x();
417 qreal y = points[i].y();
418 minX = qMin(minX, x);
419 minY = qMin(minY, y);
420 maxX = qMax(maxX, x);
421 maxY = qMax(maxY, y);
422 }
424 423 }
425 424
426 425 domain.setRange(minX,maxX,minY,maxY);
General Comments 0
You need to be logged in to leave comments. Login now