##// END OF EJS Templates
Fix to domain initialization
Marek Rosa -
r1740:29786dde6bc4
parent child
Show More
@@ -397,22 +397,20 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);
415 }
416
414
417 for (int i = 0; i < points.count(); i++) {
415 for (int i = 0; i < points.count(); i++) {
418 qreal x = points[i].x();
416 qreal x = points[i].x();
@@ -422,6 +420,7 void QXYSeriesPrivate::scaleDomain(Domain& domain)
422 maxX = qMax(maxX, x);
420 maxX = qMax(maxX, x);
423 maxY = qMax(maxY, y);
421 maxY = qMax(maxY, y);
424 }
422 }
423 }
425
424
426 domain.setRange(minX,maxX,minY,maxY);
425 domain.setRange(minX,maxX,minY,maxY);
427 }
426 }
General Comments 0
You need to be logged in to leave comments. Login now