##// 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 void QXYSeriesPrivate::scaleDomain(Domain& domain)
398 void QXYSeriesPrivate::scaleDomain(Domain& domain)
399 {
399 {
400 qreal minX(domain.minX());
400 qreal minX(0);
401 qreal minY(domain.minY());
401 qreal minY(0);
402 qreal maxX(domain.maxX());
402 qreal maxX(1);
403 qreal maxY(domain.maxY());
403 qreal maxY(1);
404
404
405 Q_Q(QXYSeries);
405 Q_Q(QXYSeries);
406
406
407 const QList<QPointF>& points = q->points();
407 const QList<QPointF>& points = q->points();
408
408
409
409 if (!points.isEmpty()){
410 if (points.isEmpty()){
410 minX = points[0].x();
411 minX = qMin(minX, (qreal)0.0);
411 minY = points[0].y();
412 minY = qMin(minY, (qreal)0.0);
412 maxX = minX;
413 maxX = qMax(maxX, (qreal)1.0);
413 maxY = minY;
414 maxY = qMax(maxY, (qreal)1.0);
414
415 }
415 for (int i = 0; i < points.count(); i++) {
416
416 qreal x = points[i].x();
417 for (int i = 0; i < points.count(); i++) {
417 qreal y = points[i].y();
418 qreal x = points[i].x();
418 minX = qMin(minX, x);
419 qreal y = points[i].y();
419 minY = qMin(minY, y);
420 minX = qMin(minX, x);
420 maxX = qMax(maxX, x);
421 minY = qMin(minY, y);
421 maxY = qMax(maxY, y);
422 maxX = qMax(maxX, x);
422 }
423 maxY = qMax(maxY, y);
424 }
423 }
425
424
426 domain.setRange(minX,maxX,minY,maxY);
425 domain.setRange(minX,maxX,minY,maxY);
General Comments 0
You need to be logged in to leave comments. Login now