summaryrefslogtreecommitdiffstats
path: root/src/axis/logvalueaxis
diff options
context:
space:
mode:
Diffstat (limited to 'src/axis/logvalueaxis')
-rw-r--r--src/axis/logvalueaxis/chartlogvalueaxisx.cpp137
-rw-r--r--src/axis/logvalueaxis/chartlogvalueaxisx_p.h63
-rw-r--r--src/axis/logvalueaxis/chartlogvalueaxisy.cpp137
-rw-r--r--src/axis/logvalueaxis/chartlogvalueaxisy_p.h63
-rw-r--r--src/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp90
-rw-r--r--src/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h57
-rw-r--r--src/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp95
-rw-r--r--src/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h57
-rw-r--r--src/axis/logvalueaxis/qlogvalueaxis.cpp402
-rw-r--r--src/axis/logvalueaxis/qlogvalueaxis.h77
-rw-r--r--src/axis/logvalueaxis/qlogvalueaxis_p.h69
11 files changed, 0 insertions, 1247 deletions
diff --git a/src/axis/logvalueaxis/chartlogvalueaxisx.cpp b/src/axis/logvalueaxis/chartlogvalueaxisx.cpp
deleted file mode 100644
index 8b365e19..00000000
--- a/src/axis/logvalueaxis/chartlogvalueaxisx.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartlogvalueaxisx_p.h"
-#include "chartpresenter_p.h"
-#include "qlogvalueaxis.h"
-#include "abstractchartlayout_p.h"
-#include <QGraphicsLayout>
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartLogValueAxisX::ChartLogValueAxisX(QLogValueAxis *axis, QGraphicsItem *item)
- : HorizontalAxis(axis, item),
- m_axis(axis)
-{
- QObject::connect(m_axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
- QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-ChartLogValueAxisX::~ChartLogValueAxisX()
-{
-}
-
-QVector<qreal> ChartLogValueAxisX::calculateLayout() const
-{
- QVector<qreal> points;
-
- qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
- qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
- qreal leftEdge = logMin < logMax ? logMin : logMax;
- qreal ceilEdge = ceil(leftEdge);
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
-
- points.resize(tickCount);
- const QRectF &gridRect = gridGeometry();
- const qreal deltaX = gridRect.width() / qAbs(logMax - logMin);
- for (int i = 0; i < tickCount; ++i)
- points[i] = (ceilEdge + qreal(i)) * deltaX - leftEdge * deltaX + gridRect.left();
-
- return points;
-}
-
-void ChartLogValueAxisX::updateGeometry()
-{
- const QVector<qreal>& layout = ChartAxisElement::layout();
- if (layout.isEmpty())
- return;
- setLabels(createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), layout.size(), m_axis->labelFormat()));
- HorizontalAxis::updateGeometry();
-}
-
-void ChartLogValueAxisX::handleBaseChanged(qreal base)
-{
- Q_UNUSED(base);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-void ChartLogValueAxisX::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-QSizeF ChartLogValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
-
- QSizeF base = HorizontalAxis::sizeHint(which, constraint);
- QStringList ticksList;
- qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
- qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
- if (m_axis->max() > m_axis->min() && tickCount > 0)
- ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
- else
- ticksList.append(QString(" "));
- // Width of horizontal axis sizeHint indicates the maximum distance labels can extend past
- // first and last ticks. Base width is irrelevant.
- qreal width = 0;
- qreal height = 0;
-
- switch (which) {
- case Qt::MinimumSize:{
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- width = boundingRect.width() / 2.0;
- height = boundingRect.height() + labelPadding() + base.height() + 1.0;
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize: {
- qreal labelHeight = 0.0;
- qreal firstWidth = -1.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelHeight = qMax(rect.height(), labelHeight);
- width = rect.width();
- if (firstWidth < 0.0)
- firstWidth = width;
- }
- height = labelHeight + labelPadding() + base.height() + 1.0;
- width = qMax(width, firstWidth) / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
-
- return sh;
-}
-
-#include "moc_chartlogvalueaxisx_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/logvalueaxis/chartlogvalueaxisx_p.h b/src/axis/logvalueaxis/chartlogvalueaxisx_p.h
deleted file mode 100644
index 318d8780..00000000
--- a/src/axis/logvalueaxis/chartlogvalueaxisx_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTLOGVALUEAXISX_H
-#define CHARTLOGVALUEAXISX_H
-
-#include "horizontalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxis;
-
-class ChartLogValueAxisX : public HorizontalAxis
-{
- Q_OBJECT
-
-public:
- ChartLogValueAxisX(QLogValueAxis *axis, QGraphicsItem *item);
- ~ChartLogValueAxisX();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-
-private Q_SLOTS:
- void handleBaseChanged(qreal base);
- void handleLabelFormatChanged(const QString &format);
-
-private:
- QLogValueAxis *m_axis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTLOGVALUEAXISX_H */
diff --git a/src/axis/logvalueaxis/chartlogvalueaxisy.cpp b/src/axis/logvalueaxis/chartlogvalueaxisy.cpp
deleted file mode 100644
index 556ddfe4..00000000
--- a/src/axis/logvalueaxis/chartlogvalueaxisy.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "chartlogvalueaxisy_p.h"
-#include "chartpresenter_p.h"
-#include "qlogvalueaxis.h"
-#include "abstractchartlayout_p.h"
-#include <QGraphicsLayout>
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-ChartLogValueAxisY::ChartLogValueAxisY(QLogValueAxis *axis, QGraphicsItem *item)
- : VerticalAxis(axis, item),
- m_axis(axis)
-{
- QObject::connect(m_axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
- QObject::connect(m_axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-ChartLogValueAxisY::~ChartLogValueAxisY()
-{
-}
-
-QVector<qreal> ChartLogValueAxisY::calculateLayout() const
-{
- QVector<qreal> points;
- qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
- qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
- qreal leftEdge = logMin < logMax ? logMin : logMax;
- qreal ceilEdge = ceil(leftEdge);
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
-
- points.resize(tickCount);
- const QRectF &gridRect = gridGeometry();
- const qreal deltaY = gridRect.height() / qAbs(logMax - logMin);
- for (int i = 0; i < tickCount; ++i)
- points[i] = (ceilEdge + qreal(i)) * -deltaY - leftEdge * -deltaY + gridRect.bottom();
-
- return points;
-}
-
-
-void ChartLogValueAxisY::updateGeometry()
-{
- const QVector<qreal> &layout = ChartAxisElement::layout();
- if (layout.isEmpty())
- return;
- setLabels(createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), layout.size(), m_axis->labelFormat()));
- VerticalAxis::updateGeometry();
-}
-
-void ChartLogValueAxisY::handleBaseChanged(qreal base)
-{
- Q_UNUSED(base);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-void ChartLogValueAxisY::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if(presenter()) presenter()->layout()->invalidate();
-}
-
-QSizeF ChartLogValueAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
-{
- Q_UNUSED(constraint)
-
- QSizeF sh;
-
- QSizeF base = VerticalAxis::sizeHint(which, constraint);
- QStringList ticksList;
- qreal logMax = log10(m_axis->max()) / log10(m_axis->base());
- qreal logMin = log10(m_axis->min()) / log10(m_axis->base());
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
- if (m_axis->max() > m_axis->min() && tickCount > 0)
- ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
- else
- ticksList.append(QString(" "));
- qreal width = 0;
- // Height of vertical axis sizeHint indicates the maximum distance labels can extend past
- // first and last ticks. Base height is irrelevant.
- qreal height = 0;
-
- switch (which) {
- case Qt::MinimumSize: {
- QRectF boundingRect = ChartPresenter::textBoundingRect(axis()->labelsFont(), "...", axis()->labelsAngle());
- width = boundingRect.width() + labelPadding() + base.width() + 1.0;
- height = boundingRect.height() / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- case Qt::PreferredSize: {
- qreal labelWidth = 0.0;
- qreal firstHeight = -1.0;
- foreach (const QString& s, ticksList) {
- QRectF rect = ChartPresenter::textBoundingRect(axis()->labelsFont(), s, axis()->labelsAngle());
- labelWidth = qMax(rect.width(), labelWidth);
- height = rect.height();
- if (firstHeight < 0.0)
- firstHeight = height;
- }
- width = labelWidth + labelPadding() + base.width() + 2.0; //two pixels of tolerance
- height = qMax(height, firstHeight) / 2.0;
- sh = QSizeF(width, height);
- break;
- }
- default:
- break;
- }
-
- return sh;
-}
-
-#include "moc_chartlogvalueaxisy_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/logvalueaxis/chartlogvalueaxisy_p.h b/src/axis/logvalueaxis/chartlogvalueaxisy_p.h
deleted file mode 100644
index 8c42024c..00000000
--- a/src/axis/logvalueaxis/chartlogvalueaxisy_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef CHARTLOGVALUEAXISY_H
-#define CHARTLOGVALUEAXISY_H
-
-#include "verticalaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxis;
-
-class ChartLogValueAxisY : public VerticalAxis
-{
- Q_OBJECT
-
-public:
- ChartLogValueAxisY(QLogValueAxis *axis, QGraphicsItem *item);
- ~ChartLogValueAxisY();
-
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
-
-protected:
- QVector<qreal> calculateLayout() const;
- void updateGeometry();
-
-private Q_SLOTS:
- void handleBaseChanged(qreal base);
- void handleLabelFormatChanged(const QString &format);
-
-private:
- QLogValueAxis *m_axis;
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif /* CHARTLOGVALUEAXISY_H */
diff --git a/src/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp b/src/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp
deleted file mode 100644
index 97bdf532..00000000
--- a/src/axis/logvalueaxis/polarchartlogvalueaxisangular.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartlogvalueaxisangular_p.h"
-#include "abstractchartlayout_p.h"
-#include "chartpresenter_p.h"
-#include "qlogvalueaxis.h"
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartLogValueAxisAngular::PolarChartLogValueAxisAngular(QLogValueAxis *axis, QGraphicsItem *item)
- : PolarChartAxisAngular(axis, item)
-{
- QObject::connect(axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
- QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-PolarChartLogValueAxisAngular::~PolarChartLogValueAxisAngular()
-{
-}
-
-QVector<qreal> PolarChartLogValueAxisAngular::calculateLayout() const
-{
- QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
- const qreal logMax = log10(logValueAxis->max()) / log10(logValueAxis->base());
- const qreal logMin = log10(logValueAxis->min()) / log10(logValueAxis->base());
- const qreal startEdge = logMin < logMax ? logMin : logMax;
- const qreal delta = 360.0 / qAbs(logMax - logMin);
- const qreal initialSpan = (ceil(startEdge) - startEdge) * delta;
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
-
- QVector<qreal> points;
- points.resize(tickCount);
-
- for (int i = 0; i < tickCount; ++i) {
- qreal angularCoordinate = initialSpan + (delta * qreal(i));
- points[i] = angularCoordinate;
- }
-
- return points;
-}
-
-void PolarChartLogValueAxisAngular::createAxisLabels(const QVector<qreal> &layout)
-{
- QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
- setLabels(createLogValueLabels(logValueAxis->min(),
- logValueAxis->max(),
- logValueAxis->base(),
- layout.size(),
- logValueAxis->labelFormat()));
-}
-
-void PolarChartLogValueAxisAngular::handleBaseChanged(qreal base)
-{
- Q_UNUSED(base);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-void PolarChartLogValueAxisAngular::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-#include "moc_polarchartlogvalueaxisangular_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h b/src/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h
deleted file mode 100644
index 5ba36aef..00000000
--- a/src/axis/logvalueaxis/polarchartlogvalueaxisangular_p.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTLOGVALUEAXISANGULAR_P_H
-#define POLARCHARTLOGVALUEAXISANGULAR_P_H
-
-#include "polarchartaxisangular_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxis;
-
-class PolarChartLogValueAxisAngular : public PolarChartAxisAngular
-{
- Q_OBJECT
-public:
- PolarChartLogValueAxisAngular(QLogValueAxis *axis, QGraphicsItem *item);
- ~PolarChartLogValueAxisAngular();
-
-protected:
- virtual QVector<qreal> calculateLayout() const;
- virtual void createAxisLabels(const QVector<qreal> &layout);
-
-private Q_SLOTS:
- void handleBaseChanged(qreal base);
- void handleLabelFormatChanged(const QString &format);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTLOGVALUEAXISANGULAR_P_H
diff --git a/src/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp b/src/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp
deleted file mode 100644
index 72b9bd33..00000000
--- a/src/axis/logvalueaxis/polarchartlogvalueaxisradial.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "polarchartlogvalueaxisradial_p.h"
-#include "abstractchartlayout_p.h"
-#include "chartpresenter_p.h"
-#include "qlogvalueaxis.h"
-#include <qmath.h>
-#include <QDebug>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-PolarChartLogValueAxisRadial::PolarChartLogValueAxisRadial(QLogValueAxis *axis, QGraphicsItem *item)
- : PolarChartAxisRadial(axis, item)
-{
- QObject::connect(axis, SIGNAL(baseChanged(qreal)), this, SLOT(handleBaseChanged(qreal)));
- QObject::connect(axis, SIGNAL(labelFormatChanged(QString)), this, SLOT(handleLabelFormatChanged(QString)));
-}
-
-PolarChartLogValueAxisRadial::~PolarChartLogValueAxisRadial()
-{
-}
-
-QVector<qreal> PolarChartLogValueAxisRadial::calculateLayout() const
-{
- QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
- const qreal logMax = log10(logValueAxis->max()) / log10(logValueAxis->base());
- const qreal logMin = log10(logValueAxis->min()) / log10(logValueAxis->base());
- const qreal innerEdge = logMin < logMax ? logMin : logMax;
- const qreal outerEdge = logMin > logMax ? logMin : logMax;
- const qreal delta = (axisGeometry().width() / 2.0) / qAbs(logMax - logMin);
- const qreal initialSpan = (ceil(innerEdge) - innerEdge) * delta;
- int tickCount = qAbs(ceil(logMax) - ceil(logMin));
-
- // Extra tick if outer edge is exactly at the tick
- if (outerEdge == ceil(outerEdge))
- tickCount++;
-
- QVector<qreal> points;
- points.resize(tickCount);
-
- for (int i = 0; i < tickCount; ++i) {
- qreal radialCoordinate = initialSpan + (delta * qreal(i));
- points[i] = radialCoordinate;
- }
-
- return points;
-}
-
-void PolarChartLogValueAxisRadial::createAxisLabels(const QVector<qreal> &layout)
-{
- QLogValueAxis *logValueAxis = static_cast<QLogValueAxis *>(axis());
- setLabels(createLogValueLabels(logValueAxis->min(),
- logValueAxis->max(),
- logValueAxis->base(),
- layout.size(),
- logValueAxis->labelFormat()));
-}
-
-void PolarChartLogValueAxisRadial::handleBaseChanged(qreal base)
-{
- Q_UNUSED(base);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-void PolarChartLogValueAxisRadial::handleLabelFormatChanged(const QString &format)
-{
- Q_UNUSED(format);
- QGraphicsLayoutItem::updateGeometry();
- if (presenter())
- presenter()->layout()->invalidate();
-}
-
-#include "moc_polarchartlogvalueaxisradial_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h b/src/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h
deleted file mode 100644
index fcba0aa2..00000000
--- a/src/axis/logvalueaxis/polarchartlogvalueaxisradial_p.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef POLARCHARTLOGVALUEAXISRADIAL_P_H
-#define POLARCHARTLOGVALUEAXISRADIAL_P_H
-
-#include "polarchartaxisradial_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxis;
-
-class PolarChartLogValueAxisRadial : public PolarChartAxisRadial
-{
- Q_OBJECT
-public:
- PolarChartLogValueAxisRadial(QLogValueAxis *axis, QGraphicsItem *item);
- ~PolarChartLogValueAxisRadial();
-
-protected:
- virtual QVector<qreal> calculateLayout() const;
- virtual void createAxisLabels(const QVector<qreal> &layout);
-
-private Q_SLOTS:
- void handleBaseChanged(qreal base);
- void handleLabelFormatChanged(const QString &format);
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // POLARCHARTLOGVALUEAXISRADIAL_P_H
diff --git a/src/axis/logvalueaxis/qlogvalueaxis.cpp b/src/axis/logvalueaxis/qlogvalueaxis.cpp
deleted file mode 100644
index 3a76b896..00000000
--- a/src/axis/logvalueaxis/qlogvalueaxis.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlogvalueaxis.h"
-#include "qlogvalueaxis_p.h"
-#include "chartlogvalueaxisx_p.h"
-#include "chartlogvalueaxisy_p.h"
-#include "polarchartlogvalueaxisangular_p.h"
-#include "polarchartlogvalueaxisradial_p.h"
-#include "abstractdomain_p.h"
-#include <float.h>
-#include <cmath>
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-/*!
- \class QLogValueAxis
- \inmodule Qt Charts
- \brief The QLogValueAxis class is used for manipulating chart's axis.
- \mainclass
-
- \note If a QLogValueAxis is attached to a series with one or more points with
- negative or zero values on the associated dimension, the series will not be
- plotted at all. This is particularly relevant when XYModelMappers are used,
- since empty cells in models typically contain zero values.
-*/
-
-#ifdef QDOC_QT5
-/*!
- \qmltype LogValueAxis
- \instantiates QLogValueAxis
- \inqmlmodule QtCommercial.Chart
-
- \include doc/src/logvalueaxis.qdocinc
-*/
-#else
-/*!
- \qmlclass LogValueAxis QLogValueAxis
-
- \include ../doc/src/logvalueaxis.qdocinc
-*/
-#endif
-
-/*!
- \property QLogValueAxis::min
- Defines the minimum value on the axis.
- When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
- Value has to be greater than 0.
-*/
-/*!
- \qmlproperty real LogValueAxis::min
- Defines the minimum value on the axis.
- When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
- Value has to be greater than 0.
-*/
-
-/*!
- \property QLogValueAxis::max
- Defines the maximum value on the axis.
- When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
- Value has to be greater than 0.
-*/
-/*!
- \qmlproperty real LogValueAxis::max
- Defines the maximum value on the axis.
- When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
- Value has to be greater than 0.
-*/
-
-/*!
- \property QLogValueAxis::base
- Defines the base of the logarithm.
- Value has to be greater than 0 and not equal 1
-*/
-/*!
- \qmlproperty real LogValueAxis::base
- Defines the maximum value on the axis.
- Defines the base of the logarithm.
- Value has to be greater than 0 and not equal 1
-*/
-
-/*!
- \property QLogValueAxis::labelFormat
- Defines the label format of the axis.
- Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
- See QString::sprintf() for additional details.
-*/
-/*!
- \qmlproperty real LogValueAxis::labelFormat
- Defines the label format of the axis.
- Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c
- See QString::sprintf() for additional details.
-*/
-
-/*!
- \fn void QLogValueAxis::minChanged(qreal min)
- Axis emits signal when \a min of axis has changed.
-*/
-/*!
- \qmlsignal LogValueAxis::onMinChanged(qreal min)
- Axis emits signal when \a min of axis has changed.
-*/
-
-/*!
- \fn void QLogValueAxis::maxChanged(qreal max)
- Axis emits signal when \a max of axis has changed.
-*/
-/*!
- \qmlsignal LogValueAxis::onMaxChanged(qreal max)
- Axis emits signal when \a max of axis has changed.
-*/
-
-/*!
- \fn void QLogValueAxis::rangeChanged(qreal min, qreal max)
- Axis emits signal when \a min or \a max of axis has changed.
-*/
-
-/*!
- \fn void QLogValueAxis::labelFormatChanged(const QString &format)
- Axis emits signal when \a format of axis labels has changed.
-*/
-/*!
- \qmlsignal LogValueAxis::labelFormatChanged(const QString &format)
- Axis emits signal when \a format of axis labels has changed.
-*/
-
-/*!
- \fn void QLogValueAxis::baseChanged(qreal base)
- Axis emits signal when \a base of logarithm of the axis has changed.
-*/
-/*!
- \qmlsignal LogValueAxis::baseChanged(qreal base)
- Axis emits signal when \a base of logarithm of the axis has changed.
-*/
-
-/*!
- Constructs an axis object which is a child of \a parent.
-*/
-QLogValueAxis::QLogValueAxis(QObject *parent) :
- QAbstractAxis(*new QLogValueAxisPrivate(this), parent)
-{
-
-}
-
-/*!
- \internal
-*/
-QLogValueAxis::QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent)
-{
-
-}
-
-/*!
- Destroys the object
-*/
-QLogValueAxis::~QLogValueAxis()
-{
- Q_D(QLogValueAxis);
- if (d->m_chart)
- d->m_chart->removeAxis(this);
-}
-
-void QLogValueAxis::setMin(qreal min)
-{
- Q_D(QLogValueAxis);
- setRange(min, qMax(d->m_max, min));
-}
-
-qreal QLogValueAxis::min() const
-{
- Q_D(const QLogValueAxis);
- return d->m_min;
-}
-
-void QLogValueAxis::setMax(qreal max)
-{
- Q_D(QLogValueAxis);
- setRange(qMin(d->m_min, max), max);
-}
-
-qreal QLogValueAxis::max() const
-{
- Q_D(const QLogValueAxis);
- return d->m_max;
-}
-
-/*!
- Sets range from \a min to \a max on the axis.
- If min is greater than max then this function returns without making any changes.
-*/
-void QLogValueAxis::setRange(qreal min, qreal max)
-{
- Q_D(QLogValueAxis);
- bool changed = false;
-
- if (min > max)
- return;
-
- if (min > 0) {
- if (!qFuzzyCompare(d->m_min, min)) {
- d->m_min = min;
- changed = true;
- emit minChanged(min);
- }
-
- if (!qFuzzyCompare(d->m_max, max)) {
- d->m_max = max;
- changed = true;
- emit maxChanged(max);
- }
-
- if (changed) {
- emit rangeChanged(min, max);
- emit d->rangeChanged(min,max);
- }
- }
-}
-
-void QLogValueAxis::setLabelFormat(const QString &format)
-{
- Q_D(QLogValueAxis);
- d->m_format = format;
- emit labelFormatChanged(format);
-}
-
-QString QLogValueAxis::labelFormat() const
-{
- Q_D(const QLogValueAxis);
- return d->m_format;
-}
-
-void QLogValueAxis::setBase(qreal base)
-{
- // check if base is correct
- if (qFuzzyCompare(base, 1))
- return;
-
- if (base > 0) {
- Q_D(QLogValueAxis);
- d->m_base = base;
- emit baseChanged(base);
- }
-}
-
-qreal QLogValueAxis::base() const
-{
- Q_D(const QLogValueAxis);
- return d->m_base;
-}
-
-/*!
- Returns the type of the axis
-*/
-QAbstractAxis::AxisType QLogValueAxis::type() const
-{
- return AxisTypeLogValue;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-QLogValueAxisPrivate::QLogValueAxisPrivate(QLogValueAxis *q)
- : QAbstractAxisPrivate(q),
- m_min(1),
- m_max(1),
- m_base(10),
- m_format(QString::null)
-{
-}
-
-QLogValueAxisPrivate::~QLogValueAxisPrivate()
-{
-
-}
-
-void QLogValueAxisPrivate::setMin(const QVariant &min)
-{
- Q_Q(QLogValueAxis);
- bool ok;
- qreal value = min.toReal(&ok);
- if (ok)
- q->setMin(value);
-}
-
-void QLogValueAxisPrivate::setMax(const QVariant &max)
-{
-
- Q_Q(QLogValueAxis);
- bool ok;
- qreal value = max.toReal(&ok);
- if (ok)
- q->setMax(value);
-}
-
-void QLogValueAxisPrivate::setRange(const QVariant &min, const QVariant &max)
-{
- Q_Q(QLogValueAxis);
- bool ok1;
- bool ok2;
- qreal value1 = min.toReal(&ok1);
- qreal value2 = max.toReal(&ok2);
- if (ok1 && ok2)
- q->setRange(value1, value2);
-}
-
-void QLogValueAxisPrivate::setRange(qreal min, qreal max)
-{
- Q_Q(QLogValueAxis);
- bool changed = false;
-
- if (min > max)
- return;
-
- if (min > 0) {
- if (!qFuzzyCompare(m_min, min)) {
- m_min = min;
- changed = true;
- emit q->minChanged(min);
- }
-
- if (!qFuzzyCompare(m_max, max)) {
- m_max = max;
- changed = true;
- emit q->maxChanged(max);
- }
-
- if (changed) {
- emit rangeChanged(min,max);
- emit q->rangeChanged(min, max);
- }
- }
-}
-
-void QLogValueAxisPrivate::initializeGraphics(QGraphicsItem *parent)
-{
- Q_Q(QLogValueAxis);
- ChartAxisElement *axis(0);
-
- if (m_chart->chartType() == QChart::ChartTypeCartesian) {
- if (orientation() == Qt::Vertical)
- axis = new ChartLogValueAxisY(q,parent);
- if (orientation() == Qt::Horizontal)
- axis = new ChartLogValueAxisX(q,parent);
- }
-
- if (m_chart->chartType() == QChart::ChartTypePolar) {
- if (orientation() == Qt::Vertical)
- axis = new PolarChartLogValueAxisRadial(q, parent);
- if (orientation() == Qt::Horizontal)
- axis = new PolarChartLogValueAxisAngular(q, parent);
- }
-
- m_item.reset(axis);
- QAbstractAxisPrivate::initializeGraphics(parent);
-}
-
-
-void QLogValueAxisPrivate::initializeDomain(AbstractDomain *domain)
-{
- if (orientation() == Qt::Vertical) {
- if (!qFuzzyCompare(m_max, m_min)) {
- domain->setRangeY(m_min, m_max);
- } else if ( domain->minY() > 0) {
- setRange(domain->minY(), domain->maxY());
- } else if (domain->maxY() > 0) {
- domain->setRangeY(m_min, domain->maxY());
- } else {
- domain->setRangeY(1, 10);
- }
- }
- if (orientation() == Qt::Horizontal) {
- if (!qFuzzyCompare(m_max, m_min)) {
- domain->setRangeX(m_min, m_max);
- } else if (domain->minX() > 0){
- setRange(domain->minX(), domain->maxX());
- } else if (domain->maxX() > 0) {
- domain->setRangeX(m_min, domain->maxX());
- } else {
- domain->setRangeX(1, 10);
- }
- }
-}
-
-#include "moc_qlogvalueaxis.cpp"
-#include "moc_qlogvalueaxis_p.cpp"
-
-QTCOMMERCIALCHART_END_NAMESPACE
diff --git a/src/axis/logvalueaxis/qlogvalueaxis.h b/src/axis/logvalueaxis/qlogvalueaxis.h
deleted file mode 100644
index 51de0ba7..00000000
--- a/src/axis/logvalueaxis/qlogvalueaxis.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOGVALUEAXIS_H
-#define QLOGVALUEAXIS_H
-
-#include "qabstractaxis.h"
-
-class QDateTime;
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxisPrivate;
-
-class QTCOMMERCIALCHART_EXPORT QLogValueAxis : public QAbstractAxis
-{
- Q_OBJECT
- Q_PROPERTY(qreal min READ min WRITE setMin NOTIFY minChanged)
- Q_PROPERTY(qreal max READ max WRITE setMax NOTIFY maxChanged)
- Q_PROPERTY(QString labelFormat READ labelFormat WRITE setLabelFormat NOTIFY labelFormatChanged)
- Q_PROPERTY(qreal base READ base WRITE setBase NOTIFY baseChanged)
-
-public:
- explicit QLogValueAxis(QObject *parent = 0);
- ~QLogValueAxis();
-
-protected:
- QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent = 0);
-
-public:
- AxisType type() const;
-
- //range handling
- void setMin(qreal min);
- qreal min() const;
- void setMax(qreal max);
- qreal max() const;
- void setRange(qreal min, qreal max);
-
- void setLabelFormat(const QString &format);
- QString labelFormat() const;
-
- void setBase(qreal base);
- qreal base() const;
-
-Q_SIGNALS:
- void minChanged(qreal min);
- void maxChanged(qreal max);
- void rangeChanged(qreal min, qreal max);
- void labelFormatChanged(const QString &format);
- void baseChanged(qreal base);
-
-private:
- Q_DECLARE_PRIVATE(QLogValueAxis)
- Q_DISABLE_COPY(QLogValueAxis)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QLOGVALUEAXIS_H
diff --git a/src/axis/logvalueaxis/qlogvalueaxis_p.h b/src/axis/logvalueaxis/qlogvalueaxis_p.h
deleted file mode 100644
index a82af5b2..00000000
--- a/src/axis/logvalueaxis/qlogvalueaxis_p.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Enterprise Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt Enterprise Chart API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#ifndef QLOGVALUEAXIS_P_H
-#define QLOGVALUEAXIS_P_H
-
-#include "qlogvalueaxis.h"
-#include "qabstractaxis_p.h"
-
-QTCOMMERCIALCHART_BEGIN_NAMESPACE
-
-class QLogValueAxisPrivate : public QAbstractAxisPrivate
-{
- Q_OBJECT
- public:
- QLogValueAxisPrivate(QLogValueAxis *q);
- ~QLogValueAxisPrivate();
-
- public:
- void initializeGraphics(QGraphicsItem* parent);
- void initializeDomain(AbstractDomain *domain);
-
- qreal min() { return m_min; }
- qreal max() { return m_max; }
- void setRange(qreal min,qreal max);
-
- protected:
- void setMin(const QVariant &min);
- void setMax(const QVariant &max);
- void setRange(const QVariant &min, const QVariant &max);
- int tickCount() const;
-
- protected:
- qreal m_min;
- qreal m_max;
- qreal m_base;
- QString m_format;
- Q_DECLARE_PUBLIC(QLogValueAxis)
-};
-
-QTCOMMERCIALCHART_END_NAMESPACE
-
-#endif // QLOGVALUEAXIS_P_H