@@ -57,6 +57,12 void PolarChartAxis::updateLayout(QVector<qreal> &layout) | |||||
57 |
|
57 | |||
58 | if (animation()) { |
|
58 | if (animation()) { | |
59 | switch (presenter()->state()) { |
|
59 | switch (presenter()->state()) { | |
|
60 | case ChartPresenter::ZoomInState: | |||
|
61 | case ChartPresenter::ZoomOutState: | |||
|
62 | case ChartPresenter::ScrollUpState: | |||
|
63 | case ChartPresenter::ScrollLeftState: | |||
|
64 | case ChartPresenter::ScrollDownState: | |||
|
65 | case ChartPresenter::ScrollRightState: | |||
60 | case ChartPresenter::ShowState: |
|
66 | case ChartPresenter::ShowState: | |
61 | animation()->setAnimationType(AxisAnimation::DefaultAnimation); |
|
67 | animation()->setAnimationType(AxisAnimation::DefaultAnimation); | |
62 | break; |
|
68 | break; |
@@ -99,11 +99,11 void PolarChartAxisAngular::updateGeometry() | |||||
99 | if (i == (layout.size() - 1)) |
|
99 | if (i == (layout.size() - 1)) | |
100 | farEdge = 360.0; |
|
100 | farEdge = 360.0; | |
101 | else |
|
101 | else | |
102 | farEdge = qMin(360.0, layout.at(i + 1)); |
|
102 | farEdge = qMin(qreal(360.0), layout.at(i + 1)); | |
103 |
|
103 | |||
104 | // Adjust the labelCoordinate to show it if next tick is visible |
|
104 | // Adjust the labelCoordinate to show it if next tick is visible | |
105 | if (nextTickVisible) |
|
105 | if (nextTickVisible) | |
106 | labelCoordinate = qMax(0.0, labelCoordinate); |
|
106 | labelCoordinate = qMax(qreal(0.0), labelCoordinate); | |
107 |
|
107 | |||
108 | labelCoordinate = (labelCoordinate + farEdge) / 2.0; |
|
108 | labelCoordinate = (labelCoordinate + farEdge) / 2.0; | |
109 | // Don't display label once the category gets too small near the axis |
|
109 | // Don't display label once the category gets too small near the axis | |
@@ -316,8 +316,6 qreal PolarChartAxisAngular::preferredAxisRadius(const QSizeF &maxSize) | |||||
316 | if (maxSize.width() < maxSize.height()) |
|
316 | if (maxSize.width() < maxSize.height()) | |
317 | radius = maxSize.width() / 2.0; |
|
317 | radius = maxSize.width() / 2.0; | |
318 |
|
318 | |||
319 | int labelHeight = 0; |
|
|||
320 |
|
||||
321 | if (axis()->labelsVisible()) { |
|
319 | if (axis()->labelsVisible()) { | |
322 | QVector<qreal> layout = calculateLayout(); |
|
320 | QVector<qreal> layout = calculateLayout(); | |
323 | if (layout.isEmpty()) |
|
321 | if (layout.isEmpty()) | |
@@ -353,11 +351,11 qreal PolarChartAxisAngular::preferredAxisRadius(const QSizeF &maxSize) | |||||
353 | if (i == (layout.size() - 1)) |
|
351 | if (i == (layout.size() - 1)) | |
354 | farEdge = 360.0; |
|
352 | farEdge = 360.0; | |
355 | else |
|
353 | else | |
356 | farEdge = qMin(360.0, layout.at(i + 1)); |
|
354 | farEdge = qMin(qreal(360.0), layout.at(i + 1)); | |
357 |
|
355 | |||
358 | // Adjust the labelCoordinate to show it if next tick is visible |
|
356 | // Adjust the labelCoordinate to show it if next tick is visible | |
359 | if (nextTickVisible) |
|
357 | if (nextTickVisible) | |
360 | labelCoordinate = qMax(0.0, labelCoordinate); |
|
358 | labelCoordinate = qMax(qreal(0.0), labelCoordinate); | |
361 |
|
359 | |||
362 | labelCoordinate = (labelCoordinate + farEdge) / 2.0; |
|
360 | labelCoordinate = (labelCoordinate + farEdge) / 2.0; | |
363 | } |
|
361 | } | |
@@ -373,7 +371,6 qreal PolarChartAxisAngular::preferredAxisRadius(const QSizeF &maxSize) | |||||
373 | } |
|
371 | } | |
374 |
|
372 | |||
375 | QRectF boundingRect = labelBoundingRect(fm, labelList.at(i)); |
|
373 | QRectF boundingRect = labelBoundingRect(fm, labelList.at(i)); | |
376 | labelHeight = boundingRect.height(); |
|
|||
377 | QPointF labelPoint = QLineF::fromPolar(radius + tickWidth(), 90.0 - labelCoordinate).p2(); |
|
374 | QPointF labelPoint = QLineF::fromPolar(radius + tickWidth(), 90.0 - labelCoordinate).p2(); | |
378 |
|
375 | |||
379 | boundingRect = moveLabelToPosition(labelCoordinate, labelPoint, boundingRect); |
|
376 | boundingRect = moveLabelToPosition(labelCoordinate, labelPoint, boundingRect); |
@@ -97,7 +97,7 void PolarChartAxisRadial::updateGeometry() | |||||
97 |
|
97 | |||
98 | // Adjust the labelCoordinate to show it if next tick is visible |
|
98 | // Adjust the labelCoordinate to show it if next tick is visible | |
99 | if (nextTickVisible) |
|
99 | if (nextTickVisible) | |
100 | labelCoordinate = qMax(0.0, labelCoordinate); |
|
100 | labelCoordinate = qMax(qreal(0.0), labelCoordinate); | |
101 |
|
101 | |||
102 | labelCoordinate = (labelCoordinate + farEdge) / 2.0; |
|
102 | labelCoordinate = (labelCoordinate + farEdge) / 2.0; | |
103 | if (labelCoordinate > 0.0 && labelCoordinate < radius) |
|
103 | if (labelCoordinate > 0.0 && labelCoordinate < radius) |
@@ -67,11 +67,11 public: | |||||
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | QString compilationTime() { |
|
69 | QString compilationTime() { | |
70 | return buildTime; |
|
70 | return QString(buildTime); | |
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | QString compilationHead() { |
|
73 | QString compilationHead() { | |
74 | return gitHead; |
|
74 | return QString(gitHead); | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | private: |
|
77 | private: |
@@ -667,11 +667,11 QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series) | |||||
667 |
|
667 | |||
668 | QChartPrivate::QChartPrivate(QChart *q, QChart::ChartType type): |
|
668 | QChartPrivate::QChartPrivate(QChart *q, QChart::ChartType type): | |
669 | q_ptr(q), |
|
669 | q_ptr(q), | |
670 | m_type(type), |
|
|||
671 | m_legend(0), |
|
670 | m_legend(0), | |
672 | m_dataset(new ChartDataSet(q)), |
|
671 | m_dataset(new ChartDataSet(q)), | |
673 | m_presenter(new ChartPresenter(q, type)), |
|
672 | m_presenter(new ChartPresenter(q, type)), | |
674 | m_themeManager(new ChartThemeManager(q)) |
|
673 | m_themeManager(new ChartThemeManager(q)), | |
|
674 | m_type(type) | |||
675 | { |
|
675 | { | |
676 | QObject::connect(m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), m_presenter, SLOT(handleSeriesAdded(QAbstractSeries*))); |
|
676 | QObject::connect(m_dataset, SIGNAL(seriesAdded(QAbstractSeries*)), m_presenter, SLOT(handleSeriesAdded(QAbstractSeries*))); | |
677 | QObject::connect(m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), m_presenter, SLOT(handleSeriesRemoved(QAbstractSeries*))); |
|
677 | QObject::connect(m_dataset, SIGNAL(seriesRemoved(QAbstractSeries*)), m_presenter, SLOT(handleSeriesRemoved(QAbstractSeries*))); |
@@ -23,6 +23,7 | |||||
23 | #include "qchart_p.h" |
|
23 | #include "qchart_p.h" | |
24 | #include <QGraphicsScene> |
|
24 | #include <QGraphicsScene> | |
25 | #include <QRubberBand> |
|
25 | #include <QRubberBand> | |
|
26 | #include <qmath.h> | |||
26 |
|
27 | |||
27 | /*! |
|
28 | /*! | |
28 | \enum QChartView::RubberBand |
|
29 | \enum QChartView::RubberBand | |
@@ -263,7 +264,7 void QChartViewPrivate::resize() | |||||
263 | { |
|
264 | { | |
264 | // Flip chart width and height if the view has been rotated |
|
265 | // Flip chart width and height if the view has been rotated | |
265 | // more than 45 degrees from the horizontal so it fits better into the view. |
|
266 | // more than 45 degrees from the horizontal so it fits better into the view. | |
266 |
qreal angle = |
|
267 | qreal angle = qAcos(q_ptr->transform().m11()) * rad2deg; | |
267 | QSize chartSize = q_ptr->size(); |
|
268 | QSize chartSize = q_ptr->size(); | |
268 |
|
269 | |||
269 | if (angle > 45.0 && angle < 135.0) { |
|
270 | if (angle > 45.0 && angle < 135.0) { |
General Comments 0
You need to be logged in to leave comments.
Login now