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