@@ -38,11 +38,11 int main(int argc, char *argv[]) | |||
|
38 | 38 | |
|
39 | 39 | //![2] |
|
40 | 40 | QDateTime momentInTime; |
|
41 |
for (int i = 0; i < |
|
|
41 | for (int i = 0; i < 200; i++) { | |
|
42 | 42 | momentInTime.setDate(QDate(2012, 1 , (1 + i / 9) % 28)); |
|
43 | 43 | momentInTime.setTime(QTime(9 + i % 9, 0)); |
|
44 | 44 | if (i > 0) |
|
45 |
series->append(momentInTime.toMSecsSinceEpoch(), series->points().at(i - 1).y() * (0.9 |
|
|
45 | series->append(momentInTime.toMSecsSinceEpoch(), series->points().at(i - 1).y() * (0.99 + (qrand() % 3) / 100.0)); | |
|
46 | 46 | else |
|
47 | 47 | series->append(momentInTime.toMSecsSinceEpoch(), 45); |
|
48 | 48 | } |
@@ -54,13 +54,7 int main(int argc, char *argv[]) | |||
|
54 | 54 | chart->addSeries(series); |
|
55 | 55 | chart->createDefaultAxes(); |
|
56 | 56 | QDateTimeAxis *axisX = new QDateTimeAxis; |
|
57 |
axisX->setTicksCount( |
|
|
58 | momentInTime.setDate(QDate(2012,1,1)); | |
|
59 | momentInTime.setTime(QTime(6, 0)); | |
|
60 | axisX->setMin(momentInTime); | |
|
61 | momentInTime.setDate(QDate(2012,1,7)); | |
|
62 | momentInTime.setTime(QTime(18, 0)); | |
|
63 | axisX->setMax(momentInTime); | |
|
57 | // axisX->setTicksCount(10); | |
|
64 | 58 | chart->setAxisX(axisX, series); |
|
65 | 59 | chart->setTitle("Date and Time axis chart example"); |
|
66 | 60 | //![3] |
@@ -132,6 +132,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
132 | 132 | \o 1.0 is the maximum size that can fit the chart. |
|
133 | 133 | \endlist |
|
134 | 134 | |
|
135 | When setting this property the donutInnerSize property is adjusted if necessary, to ensure that the inner size is not greater than the outer size. | |
|
136 | ||
|
135 | 137 | Default value is 0.7. |
|
136 | 138 | */ |
|
137 | 139 | |
@@ -177,7 +179,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
177 | 179 | \o 1.0 is the maximum size that can fit the chart. (donut has no width) |
|
178 | 180 | \endlist |
|
179 | 181 | |
|
180 | The value is never greater then size property. | |
|
182 | When setting this property the size property is adjusted if necessary, to ensure that the inner size is not greater than the outer size. | |
|
183 | ||
|
181 | 184 | Default value is 0.5. |
|
182 | 185 | */ |
|
183 | 186 | |
@@ -582,15 +585,8 bool QPieSeries::donut() const | |||
|
582 | 585 | void QPieSeries::setDonutInnerSize(qreal innerSize) |
|
583 | 586 | { |
|
584 | 587 | Q_D(QPieSeries); |
|
585 | ||
|
586 | if (innerSize < 0.0) | |
|
587 | innerSize = 0.0; | |
|
588 | if (innerSize > d->m_pieRelativeSize) | |
|
589 | innerSize = d->m_pieRelativeSize; | |
|
590 | ||
|
591 | d->m_donutRelativeInnerSize = innerSize; | |
|
592 | d->updateDerivativeData(); | |
|
593 | emit d->pieSizeChanged(); | |
|
588 | innerSize = qBound(0.0, innerSize, 1.0); | |
|
589 | d->setSizes(innerSize, qMax(d->m_pieRelativeSize, innerSize)); | |
|
594 | 590 | } |
|
595 | 591 | |
|
596 | 592 | qreal QPieSeries::donutInnerSize() const |
@@ -644,16 +640,9 qreal QPieSeries::verticalPosition() const | |||
|
644 | 640 | void QPieSeries::setPieSize(qreal relativeSize) |
|
645 | 641 | { |
|
646 | 642 | Q_D(QPieSeries); |
|
643 | relativeSize = qBound(0.0, relativeSize, 1.0); | |
|
644 | d->setSizes(qMin(d->m_donutRelativeInnerSize, relativeSize), relativeSize); | |
|
647 | 645 | |
|
648 | if (relativeSize < 0.0) | |
|
649 | relativeSize = 0.0; | |
|
650 | if (relativeSize > 1.0) | |
|
651 | relativeSize = 1.0; | |
|
652 | ||
|
653 | if (!qFuzzyIsNull(d->m_pieRelativeSize - relativeSize)) { | |
|
654 | d->m_pieRelativeSize = relativeSize; | |
|
655 | emit d->pieSizeChanged(); | |
|
656 | } | |
|
657 | 646 | } |
|
658 | 647 | |
|
659 | 648 | qreal QPieSeries::pieSize() const |
@@ -785,6 +774,24 void QPieSeriesPrivate::updateDerivativeData() | |||
|
785 | 774 | emit calculatedDataChanged(); |
|
786 | 775 | } |
|
787 | 776 | |
|
777 | void QPieSeriesPrivate::setSizes(qreal innerSize, qreal outerSize) | |
|
778 | { | |
|
779 | bool changed = false; | |
|
780 | ||
|
781 | if (!qFuzzyIsNull(m_donutRelativeInnerSize - innerSize)) { | |
|
782 | m_donutRelativeInnerSize = innerSize; | |
|
783 | changed = true; | |
|
784 | } | |
|
785 | ||
|
786 | if (!qFuzzyIsNull(m_pieRelativeSize - outerSize)) { | |
|
787 | m_pieRelativeSize = outerSize; | |
|
788 | changed = true; | |
|
789 | } | |
|
790 | ||
|
791 | if (changed) | |
|
792 | emit pieSizeChanged(); | |
|
793 | } | |
|
794 | ||
|
788 | 795 | QPieSeriesPrivate* QPieSeriesPrivate::fromSeries(QPieSeries *series) |
|
789 | 796 | { |
|
790 | 797 | return series->d_func(); |
General Comments 0
You need to be logged in to leave comments.
Login now