##// END OF EJS Templates
Fix QNX build issue...
Titta Heikkala -
r2775:143be951b1fe
parent child
Show More
@@ -48,7 +48,7 QVector<qreal> ChartBarCategoryAxisX::calculateLayout() const
48 return points;
48 return points;
49
49
50 qreal adjustedMin = min() + 0.5;
50 qreal adjustedMin = min() + 0.5;
51 qreal offset = (ceil(adjustedMin) - adjustedMin) * delta;
51 qreal offset = (qCeil(adjustedMin) - adjustedMin) * delta;
52
52
53 int count = qFloor(range);
53 int count = qFloor(range);
54 if (count < 1)
54 if (count < 1)
@@ -48,7 +48,7 QVector<qreal> ChartBarCategoryAxisY::calculateLayout() const
48 return points;
48 return points;
49
49
50 qreal adjustedMin = min() + 0.5;
50 qreal adjustedMin = min() + 0.5;
51 qreal offset = (ceil(adjustedMin) - adjustedMin) * delta;
51 qreal offset = (qCeil(adjustedMin) - adjustedMin) * delta;
52
52
53 int count = qFloor(range);
53 int count = qFloor(range);
54 if (count < 1)
54 if (count < 1)
@@ -23,6 +23,7
23 #include <QtCore/QtMath>
23 #include <QtCore/QtMath>
24 #include <QtCore/QDateTime>
24 #include <QtCore/QDateTime>
25 #include <QtGui/QTextDocument>
25 #include <QtGui/QTextDocument>
26 #include <cmath>
26
27
27 QT_CHARTS_BEGIN_NAMESPACE
28 QT_CHARTS_BEGIN_NAMESPACE
28
29
@@ -271,7 +272,7 QStringList ChartAxisElement::createValueLabels(qreal min, qreal max, int ticks,
271 return labels;
272 return labels;
272
273
273 if (format.isNull()) {
274 if (format.isNull()) {
274 int n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0) + 1;
275 int n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0) + 1;
275 for (int i = 0; i < ticks; i++) {
276 for (int i = 0; i < ticks; i++) {
276 qreal value = min + (i * (max - min) / (ticks - 1));
277 qreal value = min + (i * (max - min) / (ticks - 1));
277 labels << presenter()->numberToString(value, 'f', n);
278 labels << presenter()->numberToString(value, 'f', n);
@@ -318,14 +319,14 QStringList ChartAxisElement::createLogValueLabels(qreal min, qreal max, qreal b
318
319
319 int firstTick;
320 int firstTick;
320 if (base > 1)
321 if (base > 1)
321 firstTick = ceil(log10(min) / log10(base));
322 firstTick = qCeil(std::log10(min) / std::log10(base));
322 else
323 else
323 firstTick = ceil(log10(max) / log10(base));
324 firstTick = qCeil(std::log10(max) / std::log10(base));
324
325
325 if (format.isNull()) {
326 if (format.isNull()) {
326 int n = 0;
327 int n = 0;
327 if (ticks > 1)
328 if (ticks > 1)
328 n = qMax(int(-qFloor(log10((max - min) / (ticks - 1)))), 0);
329 n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0);
329 n++;
330 n++;
330 for (int i = firstTick; i < ticks + firstTick; i++) {
331 for (int i = firstTick; i < ticks + firstTick; i++) {
331 qreal value = qPow(base, i);
332 qreal value = qPow(base, i);
@@ -371,7 +372,7 QStringList ChartAxisElement::createDateTimeLabels(qreal min, qreal max,int tick
371 if (max <= min || ticks < 1)
372 if (max <= min || ticks < 1)
372 return labels;
373 return labels;
373
374
374 int n = qMax(int(-floor(log10((max - min) / (ticks - 1)))), 0);
375 int n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0);
375 n++;
376 n++;
376 for (int i = 0; i < ticks; i++) {
377 for (int i = 0; i < ticks; i++) {
377 qreal value = min + (i * (max - min) / (ticks - 1));
378 qreal value = min + (i * (max - min) / (ticks - 1));
@@ -23,6 +23,7
23 #include <QtWidgets/QGraphicsLayout>
23 #include <QtWidgets/QGraphicsLayout>
24 #include <QtCore/QtMath>
24 #include <QtCore/QtMath>
25 #include <QtCore/QDebug>
25 #include <QtCore/QDebug>
26 #include <cmath>
26
27
27 QT_CHARTS_BEGIN_NAMESPACE
28 QT_CHARTS_BEGIN_NAMESPACE
28
29
@@ -42,11 +43,11 QVector<qreal> ChartLogValueAxisX::calculateLayout() const
42 {
43 {
43 QVector<qreal> points;
44 QVector<qreal> points;
44
45
45 qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
46 qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base());
46 qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
47 qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base());
47 qreal leftEdge = logMin < logMax ? logMin : logMax;
48 qreal leftEdge = logMin < logMax ? logMin : logMax;
48 qreal ceilEdge = ceil(leftEdge);
49 qreal ceilEdge = qCeil(leftEdge);
49 int tickCount = qAbs(ceil(logMax) - ceil(logMin));
50 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
50
51
51 points.resize(tickCount);
52 points.resize(tickCount);
52 const QRectF &gridRect = gridGeometry();
53 const QRectF &gridRect = gridGeometry();
@@ -86,9 +87,9 QSizeF ChartLogValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint
86
87
87 QSizeF base = HorizontalAxis::sizeHint(which, constraint);
88 QSizeF base = HorizontalAxis::sizeHint(which, constraint);
88 QStringList ticksList;
89 QStringList ticksList;
89 qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
90 qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base());
90 qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
91 qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base());
91 int tickCount = qAbs(ceil(logMax) - ceil(logMin));
92 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
92 if (m_axis->max() > m_axis->min() && tickCount > 0)
93 if (m_axis->max() > m_axis->min() && tickCount > 0)
93 ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
94 ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
94 else
95 else
@@ -23,6 +23,7
23 #include <QtWidgets/QGraphicsLayout>
23 #include <QtWidgets/QGraphicsLayout>
24 #include <QtCore/QtMath>
24 #include <QtCore/QtMath>
25 #include <QtCore/QDebug>
25 #include <QtCore/QDebug>
26 #include <cmath>
26
27
27 QT_CHARTS_BEGIN_NAMESPACE
28 QT_CHARTS_BEGIN_NAMESPACE
28
29
@@ -41,11 +42,11 ChartLogValueAxisY::~ChartLogValueAxisY()
41 QVector<qreal> ChartLogValueAxisY::calculateLayout() const
42 QVector<qreal> ChartLogValueAxisY::calculateLayout() const
42 {
43 {
43 QVector<qreal> points;
44 QVector<qreal> points;
44 qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
45 qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base());
45 qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
46 qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base());
46 qreal leftEdge = logMin < logMax ? logMin : logMax;
47 qreal leftEdge = logMin < logMax ? logMin : logMax;
47 qreal ceilEdge = ceil(leftEdge);
48 qreal ceilEdge = qCeil(leftEdge);
48 int tickCount = qAbs(ceil(logMax) - ceil(logMin));
49 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
49
50
50 points.resize(tickCount);
51 points.resize(tickCount);
51 const QRectF &gridRect = gridGeometry();
52 const QRectF &gridRect = gridGeometry();
@@ -86,9 +87,9 QSizeF ChartLogValueAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint
86
87
87 QSizeF base = VerticalAxis::sizeHint(which, constraint);
88 QSizeF base = VerticalAxis::sizeHint(which, constraint);
88 QStringList ticksList;
89 QStringList ticksList;
89 qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
90 qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base());
90 qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
91 qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base());
91 int tickCount = qAbs(ceil(logMax) - ceil(logMin));
92 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
92 if (m_axis->max() > m_axis->min() && tickCount > 0)
93 if (m_axis->max() > m_axis->min() && tickCount > 0)
93 ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
94 ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
94 else
95 else
@@ -22,6 +22,7
22 #include <QtCharts/QLogValueAxis>
22 #include <QtCharts/QLogValueAxis>
23 #include <QtCore/QtMath>
23 #include <QtCore/QtMath>
24 #include <QtCore/QDebug>
24 #include <QtCore/QDebug>
25 #include <cmath>
25
26
26 QT_CHARTS_BEGIN_NAMESPACE
27 QT_CHARTS_BEGIN_NAMESPACE
27
28
@@ -39,12 +40,12 PolarChartLogValueAxisAngular::~PolarChartLogValueAxisAngular()
39 QVector<qreal> PolarChartLogValueAxisAngular::calculateLayout() const
40 QVector<qreal> PolarChartLogValueAxisAngular::calculateLayout() const
40 {
41 {
41 QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
42 QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
42 const qreal logMax = log10(logValueAxis->max()) / log10(logValueAxis->base());
43 const qreal logMax = std::log10(logValueAxis->max()) / std::log10(logValueAxis->base());
43 const qreal logMin = log10(logValueAxis->min()) / log10(logValueAxis->base());
44 const qreal logMin = std::log10(logValueAxis->min()) / std::log10(logValueAxis->base());
44 const qreal startEdge = logMin < logMax ? logMin : logMax;
45 const qreal startEdge = logMin < logMax ? logMin : logMax;
45 const qreal delta = 360.0 / qAbs(logMax - logMin);
46 const qreal delta = 360.0 / qAbs(logMax - logMin);
46 const qreal initialSpan = (ceil(startEdge) - startEdge) * delta;
47 const qreal initialSpan = (qCeil(startEdge) - startEdge) * delta;
47 int tickCount = qAbs(ceil(logMax) - ceil(logMin));
48 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
48
49
49 QVector<qreal> points;
50 QVector<qreal> points;
50 points.resize(tickCount);
51 points.resize(tickCount);
@@ -22,6 +22,7
22 #include <QtCharts/QLogValueAxis>
22 #include <QtCharts/QLogValueAxis>
23 #include <QtCore/QtMath>
23 #include <QtCore/QtMath>
24 #include <QtCore/QDebug>
24 #include <QtCore/QDebug>
25 #include <cmath>
25
26
26 QT_CHARTS_BEGIN_NAMESPACE
27 QT_CHARTS_BEGIN_NAMESPACE
27
28
@@ -39,16 +40,16 PolarChartLogValueAxisRadial::~PolarChartLogValueAxisRadial()
39 QVector<qreal> PolarChartLogValueAxisRadial::calculateLayout() const
40 QVector<qreal> PolarChartLogValueAxisRadial::calculateLayout() const
40 {
41 {
41 QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
42 QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
42 const qreal logMax = log10(logValueAxis->max()) / log10(logValueAxis->base());
43 const qreal logMax = std::log10(logValueAxis->max()) / std::log10(logValueAxis->base());
43 const qreal logMin = log10(logValueAxis->min()) / log10(logValueAxis->base());
44 const qreal logMin = std::log10(logValueAxis->min()) / std::log10(logValueAxis->base());
44 const qreal innerEdge = logMin < logMax ? logMin : logMax;
45 const qreal innerEdge = logMin < logMax ? logMin : logMax;
45 const qreal outerEdge = logMin > logMax ? logMin : logMax;
46 const qreal outerEdge = logMin > logMax ? logMin : logMax;
46 const qreal delta = (axisGeometry().width() / 2.0) / qAbs(logMax - logMin);
47 const qreal delta = (axisGeometry().width() / 2.0) / qAbs(logMax - logMin);
47 const qreal initialSpan = (ceil(innerEdge) - innerEdge) * delta;
48 const qreal initialSpan = (qCeil(innerEdge) - innerEdge) * delta;
48 int tickCount = qAbs(ceil(logMax) - ceil(logMin));
49 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
49
50
50 // Extra tick if outer edge is exactly at the tick
51 // Extra tick if outer edge is exactly at the tick
51 if (outerEdge == ceil(outerEdge))
52 if (outerEdge == qCeil(outerEdge))
52 tickCount++;
53 tickCount++;
53
54
54 QVector<qreal> points;
55 QVector<qreal> points;
@@ -19,6 +19,7
19 #include <private/abstractdomain_p.h>
19 #include <private/abstractdomain_p.h>
20 #include <private/qabstractaxis_p.h>
20 #include <private/qabstractaxis_p.h>
21 #include <QtCore/QtMath>
21 #include <QtCore/QtMath>
22 #include <cmath>
22
23
23 QT_CHARTS_BEGIN_NAMESPACE
24 QT_CHARTS_BEGIN_NAMESPACE
24
25
@@ -173,7 +174,7 void AbstractDomain::looseNiceNumbers(qreal &min, qreal &max, int &ticksCount)
173
174
174 qreal AbstractDomain::niceNumber(qreal x, bool ceiling)
175 qreal AbstractDomain::niceNumber(qreal x, bool ceiling)
175 {
176 {
176 qreal z = qPow(10, qFloor(log10(x))); //find corresponding number of the form of 10^n than is smaller than x
177 qreal z = qPow(10, qFloor(std::log10(x))); //find corresponding number of the form of 10^n than is smaller than x
177 qreal q = x / z; //q<10 && q>=1;
178 qreal q = x / z; //q<10 && q>=1;
178
179
179 if (ceiling) {
180 if (ceiling) {
@@ -20,6 +20,7
20 #include <private/qabstractaxis_p.h>
20 #include <private/qabstractaxis_p.h>
21 #include <QtCharts/QLogValueAxis>
21 #include <QtCharts/QLogValueAxis>
22 #include <QtCore/QtMath>
22 #include <QtCore/QtMath>
23 #include <cmath>
23
24
24 QT_CHARTS_BEGIN_NAMESPACE
25 QT_CHARTS_BEGIN_NAMESPACE
25
26
@@ -50,8 +51,8 void LogXLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
50 m_minX = minX;
51 m_minX = minX;
51 m_maxX = maxX;
52 m_maxX = maxX;
52 axisXChanged = true;
53 axisXChanged = true;
53 qreal logMinX = log10(m_minX) / log10(m_logBaseX);
54 qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX);
54 qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
55 qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX);
55 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
56 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
56 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
57 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
57 if(!m_signalsBlocked)
58 if(!m_signalsBlocked)
@@ -62,8 +63,8 void LogXLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
62 m_minY = minY;
63 m_minY = minY;
63 m_maxY = maxY;
64 m_maxY = maxY;
64 axisYChanged = true;
65 axisYChanged = true;
65 qreal logMinY = log10(m_minY) / log10(m_logBaseY);
66 qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY);
66 qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
67 qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY);
67 m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
68 m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
68 m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
69 m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
69 if (!m_signalsBlocked)
70 if (!m_signalsBlocked)
@@ -141,18 +142,18 QPointF LogXLogYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) c
141 qreal x(0);
142 qreal x(0);
142 qreal y(0);
143 qreal y(0);
143 if (point.x() > 0 && point.y() > 0) {
144 if (point.x() > 0 && point.y() > 0) {
144 x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
145 x = (std::log10(point.x()) / std::log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
145 y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
146 y = (std::log10(point.y()) / std::log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
146 ok = true;
147 ok = true;
147 } else {
148 } else {
148 qWarning() << "Logarithms of zero and negative values are undefined.";
149 qWarning() << "Logarithms of zero and negative values are undefined.";
149 ok = false;
150 ok = false;
150 if (point.x() > 0)
151 if (point.x() > 0)
151 x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
152 x = (std::log10(point.x()) / std::log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
152 else
153 else
153 x = 0;
154 x = 0;
154 if (point.y() > 0) {
155 if (point.y() > 0) {
155 y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY
156 y = (std::log10(point.y()) / std::log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY
156 + m_size.height();
157 + m_size.height();
157 } else {
158 } else {
158 y = m_size.height();
159 y = m_size.height();
@@ -171,8 +172,8 QVector<QPointF> LogXLogYDomain::calculateGeometryPoints(const QList<QPointF> &v
171
172
172 for (int i = 0; i < vector.count(); ++i) {
173 for (int i = 0; i < vector.count(); ++i) {
173 if (vector[i].x() > 0 && vector[i].y() > 0) {
174 if (vector[i].x() > 0 && vector[i].y() > 0) {
174 qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
175 qreal x = (std::log10(vector[i].x()) / std::log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
175 qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
176 qreal y = (std::log10(vector[i].y()) / std::log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
176 result[i].setX(x);
177 result[i].setX(x);
177 result[i].setY(y);
178 result[i].setY(y);
178 } else {
179 } else {
@@ -227,8 +228,8 bool LogXLogYDomain::detachAxis(QAbstractAxis *axis)
227 void LogXLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)
228 void LogXLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)
228 {
229 {
229 m_logBaseY = baseY;
230 m_logBaseY = baseY;
230 qreal logMinY = log10(m_minY) / log10(m_logBaseY);
231 qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY);
231 qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
232 qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY);
232 m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
233 m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
233 m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
234 m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
234 emit updated();
235 emit updated();
@@ -237,8 +238,8 void LogXLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)
237 void LogXLogYDomain::handleHorizontalAxisBaseChanged(qreal baseX)
238 void LogXLogYDomain::handleHorizontalAxisBaseChanged(qreal baseX)
238 {
239 {
239 m_logBaseX = baseX;
240 m_logBaseX = baseX;
240 qreal logMinX = log10(m_minX) / log10(m_logBaseX);
241 qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX);
241 qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
242 qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX);
242 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
243 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
243 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
244 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
244 emit updated();
245 emit updated();
@@ -20,6 +20,7
20 #include <private/qabstractaxis_p.h>
20 #include <private/qabstractaxis_p.h>
21 #include <QtCharts/QLogValueAxis>
21 #include <QtCharts/QLogValueAxis>
22 #include <QtCore/QtMath>
22 #include <QtCore/QtMath>
23 #include <cmath>
23
24
24 QT_CHARTS_BEGIN_NAMESPACE
25 QT_CHARTS_BEGIN_NAMESPACE
25
26
@@ -50,8 +51,8 void LogXLogYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal max
50 m_minX = minX;
51 m_minX = minX;
51 m_maxX = maxX;
52 m_maxX = maxX;
52 axisXChanged = true;
53 axisXChanged = true;
53 qreal logMinX = log10(m_minX) / log10(m_logBaseX);
54 qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX);
54 qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
55 qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX);
55 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
56 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
56 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
57 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
57 if (!m_signalsBlocked)
58 if (!m_signalsBlocked)
@@ -62,8 +63,8 void LogXLogYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal max
62 m_minY = minY;
63 m_minY = minY;
63 m_maxY = maxY;
64 m_maxY = maxY;
64 axisYChanged = true;
65 axisYChanged = true;
65 qreal logMinY = log10(m_minY) / log10(m_logBaseY);
66 qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY);
66 qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
67 qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY);
67 m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
68 m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
68 m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
69 m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
69 if (!m_signalsBlocked)
70 if (!m_signalsBlocked)
@@ -143,7 +144,7 qreal LogXLogYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const
143 } else {
144 } else {
144 ok = true;
145 ok = true;
145 const qreal tickSpan = 360.0 / qAbs(m_logRightX - m_logLeftX);
146 const qreal tickSpan = 360.0 / qAbs(m_logRightX - m_logLeftX);
146 const qreal logValue = log10(value) / log10(m_logBaseX);
147 const qreal logValue = std::log10(value) / std::log10(m_logBaseX);
147 const qreal valueDelta = logValue - m_logLeftX;
148 const qreal valueDelta = logValue - m_logLeftX;
148
149
149 retVal = valueDelta * tickSpan;
150 retVal = valueDelta * tickSpan;
@@ -160,7 +161,7 qreal LogXLogYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const
160 } else {
161 } else {
161 ok = true;
162 ok = true;
162 const qreal tickSpan = m_radius / qAbs(m_logOuterY - m_logInnerY);
163 const qreal tickSpan = m_radius / qAbs(m_logOuterY - m_logInnerY);
163 const qreal logValue = log10(value) / log10(m_logBaseY);
164 const qreal logValue = std::log10(value) / std::log10(m_logBaseY);
164 const qreal valueDelta = logValue - m_logInnerY;
165 const qreal valueDelta = logValue - m_logInnerY;
165
166
166 retVal = valueDelta * tickSpan;
167 retVal = valueDelta * tickSpan;
@@ -222,8 +223,8 bool LogXLogYPolarDomain::detachAxis(QAbstractAxis *axis)
222 void LogXLogYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX)
223 void LogXLogYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX)
223 {
224 {
224 m_logBaseX = baseX;
225 m_logBaseX = baseX;
225 qreal logMinX = log10(m_minX) / log10(m_logBaseX);
226 qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX);
226 qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
227 qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX);
227 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
228 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
228 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
229 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
229 emit updated();
230 emit updated();
@@ -232,8 +233,8 void LogXLogYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX)
232 void LogXLogYPolarDomain::handleVerticalAxisBaseChanged(qreal baseY)
233 void LogXLogYPolarDomain::handleVerticalAxisBaseChanged(qreal baseY)
233 {
234 {
234 m_logBaseY = baseY;
235 m_logBaseY = baseY;
235 qreal logMinY = log10(m_minY) / log10(m_logBaseY);
236 qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY);
236 qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
237 qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY);
237 m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
238 m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
238 m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
239 m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
239 emit updated();
240 emit updated();
@@ -20,6 +20,7
20 #include <private/qabstractaxis_p.h>
20 #include <private/qabstractaxis_p.h>
21 #include <QtCharts/QLogValueAxis>
21 #include <QtCharts/QLogValueAxis>
22 #include <QtCore/QtMath>
22 #include <QtCore/QtMath>
23 #include <cmath>
23
24
24 QT_CHARTS_BEGIN_NAMESPACE
25 QT_CHARTS_BEGIN_NAMESPACE
25
26
@@ -46,8 +47,8 void LogXYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
46 m_minX = minX;
47 m_minX = minX;
47 m_maxX = maxX;
48 m_maxX = maxX;
48 axisXChanged = true;
49 axisXChanged = true;
49 qreal logMinX = log10(m_minX) / log10(m_logBaseX);
50 qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX);
50 qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
51 qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX);
51 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
52 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
52 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
53 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
53 if(!m_signalsBlocked)
54 if(!m_signalsBlocked)
@@ -135,7 +136,7 QPointF LogXYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) cons
135 qreal x(0);
136 qreal x(0);
136 qreal y = (point.y() - m_minY) * -deltaY + m_size.height();
137 qreal y = (point.y() - m_minY) * -deltaY + m_size.height();
137 if (point.x() > 0) {
138 if (point.x() > 0) {
138 x = (log10(point.x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
139 x = (std::log10(point.x()) / std::log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
139 ok = true;
140 ok = true;
140 } else {
141 } else {
141 x = 0;
142 x = 0;
@@ -155,7 +156,7 QVector<QPointF> LogXYDomain::calculateGeometryPoints(const QList<QPointF> &vect
155
156
156 for (int i = 0; i < vector.count(); ++i) {
157 for (int i = 0; i < vector.count(); ++i) {
157 if (vector[i].x() > 0) {
158 if (vector[i].x() > 0) {
158 qreal x = (log10(vector[i].x()) / log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
159 qreal x = (std::log10(vector[i].x()) / std::log10(m_logBaseX)) * deltaX - m_logLeftX * deltaX;
159 qreal y = (vector[i].y() - m_minY) * -deltaY + m_size.height();
160 qreal y = (vector[i].y() - m_minY) * -deltaY + m_size.height();
160 result[i].setX(x);
161 result[i].setX(x);
161 result[i].setY(y);
162 result[i].setY(y);
@@ -204,8 +205,8 bool LogXYDomain::detachAxis(QAbstractAxis *axis)
204 void LogXYDomain::handleHorizontalAxisBaseChanged(qreal baseX)
205 void LogXYDomain::handleHorizontalAxisBaseChanged(qreal baseX)
205 {
206 {
206 m_logBaseX = baseX;
207 m_logBaseX = baseX;
207 qreal logMinX = log10(m_minX) / log10(m_logBaseX);
208 qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX);
208 qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
209 qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX);
209 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
210 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
210 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
211 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
211 emit updated();
212 emit updated();
@@ -20,6 +20,7
20 #include <private/qabstractaxis_p.h>
20 #include <private/qabstractaxis_p.h>
21 #include <QtCharts/QLogValueAxis>
21 #include <QtCharts/QLogValueAxis>
22 #include <QtCore/QtMath>
22 #include <QtCore/QtMath>
23 #include <cmath>
23
24
24 QT_CHARTS_BEGIN_NAMESPACE
25 QT_CHARTS_BEGIN_NAMESPACE
25
26
@@ -46,8 +47,8 void LogXYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
46 m_minX = minX;
47 m_minX = minX;
47 m_maxX = maxX;
48 m_maxX = maxX;
48 axisXChanged = true;
49 axisXChanged = true;
49 qreal logMinX = log10(m_minX) / log10(m_logBaseX);
50 qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX);
50 qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
51 qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX);
51 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
52 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
52 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
53 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
53 if (!m_signalsBlocked)
54 if (!m_signalsBlocked)
@@ -136,7 +137,7 qreal LogXYPolarDomain::toAngularCoordinate(qreal value, bool &ok) const
136 } else {
137 } else {
137 ok = true;
138 ok = true;
138 const qreal tickSpan = 360.0 / qAbs(m_logRightX - m_logLeftX);
139 const qreal tickSpan = 360.0 / qAbs(m_logRightX - m_logLeftX);
139 const qreal logValue = log10(value) / log10(m_logBaseX);
140 const qreal logValue = std::log10(value) / std::log10(m_logBaseX);
140 const qreal valueDelta = logValue - m_logLeftX;
141 const qreal valueDelta = logValue - m_logLeftX;
141
142
142 retVal = valueDelta * tickSpan;
143 retVal = valueDelta * tickSpan;
@@ -201,8 +202,8 bool LogXYPolarDomain::detachAxis(QAbstractAxis *axis)
201 void LogXYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX)
202 void LogXYPolarDomain::handleHorizontalAxisBaseChanged(qreal baseX)
202 {
203 {
203 m_logBaseX = baseX;
204 m_logBaseX = baseX;
204 qreal logMinX = log10(m_minX) / log10(m_logBaseX);
205 qreal logMinX = std::log10(m_minX) / std::log10(m_logBaseX);
205 qreal logMaxX = log10(m_maxX) / log10(m_logBaseX);
206 qreal logMaxX = std::log10(m_maxX) / std::log10(m_logBaseX);
206 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
207 m_logLeftX = logMinX < logMaxX ? logMinX : logMaxX;
207 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
208 m_logRightX = logMinX > logMaxX ? logMinX : logMaxX;
208 emit updated();
209 emit updated();
@@ -20,6 +20,7
20 #include <private/qabstractaxis_p.h>
20 #include <private/qabstractaxis_p.h>
21 #include <QtCharts/QLogValueAxis>
21 #include <QtCharts/QLogValueAxis>
22 #include <QtCore/QtMath>
22 #include <QtCore/QtMath>
23 #include <cmath>
23
24
24 QT_CHARTS_BEGIN_NAMESPACE
25 QT_CHARTS_BEGIN_NAMESPACE
25
26
@@ -54,8 +55,8 void XLogYDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
54 m_minY = minY;
55 m_minY = minY;
55 m_maxY = maxY;
56 m_maxY = maxY;
56 axisYChanged = true;
57 axisYChanged = true;
57 qreal logMinY = log10(m_minY) / log10(m_logBaseY);
58 qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY);
58 qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
59 qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY);
59 m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
60 m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
60 m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
61 m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
61 if (!m_signalsBlocked)
62 if (!m_signalsBlocked)
@@ -135,7 +136,7 QPointF XLogYDomain::calculateGeometryPoint(const QPointF &point, bool &ok) cons
135 qreal x = (point.x() - m_minX) * deltaX;
136 qreal x = (point.x() - m_minX) * deltaX;
136 qreal y(0);
137 qreal y(0);
137 if (point.y() > 0) {
138 if (point.y() > 0) {
138 y = (log10(point.y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
139 y = (std::log10(point.y()) / std::log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
139 ok = true;
140 ok = true;
140 } else {
141 } else {
141 y = m_size.height();
142 y = m_size.height();
@@ -156,7 +157,7 QVector<QPointF> XLogYDomain::calculateGeometryPoints(const QList<QPointF> &vect
156 for (int i = 0; i < vector.count(); ++i) {
157 for (int i = 0; i < vector.count(); ++i) {
157 if (vector[i].y() > 0) {
158 if (vector[i].y() > 0) {
158 qreal x = (vector[i].x() - m_minX) * deltaX;
159 qreal x = (vector[i].x() - m_minX) * deltaX;
159 qreal y = (log10(vector[i].y()) / log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
160 qreal y = (std::log10(vector[i].y()) / std::log10(m_logBaseY)) * -deltaY - m_logLeftY * -deltaY + m_size.height();
160 result[i].setX(x);
161 result[i].setX(x);
161 result[i].setY(y);
162 result[i].setY(y);
162 } else {
163 } else {
@@ -200,8 +201,8 bool XLogYDomain::detachAxis(QAbstractAxis *axis)
200 void XLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)
201 void XLogYDomain::handleVerticalAxisBaseChanged(qreal baseY)
201 {
202 {
202 m_logBaseY = baseY;
203 m_logBaseY = baseY;
203 qreal logMinY = log10(m_minY) / log10(m_logBaseY);
204 qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY);
204 qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
205 qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY);
205 m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
206 m_logLeftY = logMinY < logMaxY ? logMinY : logMaxY;
206 m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
207 m_logRightY = logMinY > logMaxY ? logMinY : logMaxY;
207 emit updated();
208 emit updated();
@@ -20,6 +20,7
20 #include <private/qabstractaxis_p.h>
20 #include <private/qabstractaxis_p.h>
21 #include <QtCharts/QLogValueAxis>
21 #include <QtCharts/QLogValueAxis>
22 #include <QtCore/QtMath>
22 #include <QtCore/QtMath>
23 #include <cmath>
23
24
24 QT_CHARTS_BEGIN_NAMESPACE
25 QT_CHARTS_BEGIN_NAMESPACE
25
26
@@ -54,8 +55,8 void XLogYPolarDomain::setRange(qreal minX, qreal maxX, qreal minY, qreal maxY)
54 m_minY = minY;
55 m_minY = minY;
55 m_maxY = maxY;
56 m_maxY = maxY;
56 axisYChanged = true;
57 axisYChanged = true;
57 qreal logMinY = log10(m_minY) / log10(m_logBaseY);
58 qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY);
58 qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
59 qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY);
59 m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
60 m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
60 m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
61 m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
61 if (!m_signalsBlocked)
62 if (!m_signalsBlocked)
@@ -144,7 +145,7 qreal XLogYPolarDomain::toRadialCoordinate(qreal value, bool &ok) const
144 } else {
145 } else {
145 ok = true;
146 ok = true;
146 const qreal tickSpan = m_radius / qAbs(m_logOuterY - m_logInnerY);
147 const qreal tickSpan = m_radius / qAbs(m_logOuterY - m_logInnerY);
147 const qreal logValue = log10(value) / log10(m_logBaseY);
148 const qreal logValue = std::log10(value) / std::log10(m_logBaseY);
148 const qreal valueDelta = logValue - m_logInnerY;
149 const qreal valueDelta = logValue - m_logInnerY;
149
150
150 retVal = valueDelta * tickSpan;
151 retVal = valueDelta * tickSpan;
@@ -196,8 +197,8 bool XLogYPolarDomain::detachAxis(QAbstractAxis *axis)
196 void XLogYPolarDomain::handleVerticalAxisBaseChanged(qreal baseY)
197 void XLogYPolarDomain::handleVerticalAxisBaseChanged(qreal baseY)
197 {
198 {
198 m_logBaseY = baseY;
199 m_logBaseY = baseY;
199 qreal logMinY = log10(m_minY) / log10(m_logBaseY);
200 qreal logMinY = std::log10(m_minY) / std::log10(m_logBaseY);
200 qreal logMaxY = log10(m_maxY) / log10(m_logBaseY);
201 qreal logMaxY = std::log10(m_maxY) / std::log10(m_logBaseY);
201 m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
202 m_logInnerY = logMinY < logMaxY ? logMinY : logMaxY;
202 m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
203 m_logOuterY = logMinY > logMaxY ? logMinY : logMaxY;
203 emit updated();
204 emit updated();
General Comments 0
You need to be logged in to leave comments. Login now