diff --git a/plugins/declarative/plugin.cpp b/plugins/declarative/plugin.cpp index 202f418..a7627f9 100644 --- a/plugins/declarative/plugin.cpp +++ b/plugins/declarative/plugin.cpp @@ -22,7 +22,7 @@ #include #include "qchart.h" #include "qabstractaxis.h" -#include "qaxiscategories.h" +//#include "qaxiscategories.h" #include "declarativechart.h" #include "declarativexypoint.h" #include "declarativelineseries.h" diff --git a/src/axis/axis.pri b/src/axis/axis.pri index 9b57643..1d79176 100644 --- a/src/axis/axis.pri +++ b/src/axis/axis.pri @@ -5,7 +5,7 @@ SOURCES += \ $$PWD/chartaxis.cpp \ $$PWD/chartaxisx.cpp \ $$PWD/chartaxisy.cpp \ - $$PWD/qaxiscategories.cpp \ +# $$PWD/qaxiscategories.cpp \ $$PWD/qcategoriesaxis.cpp \ $$PWD/qvaluesaxis.cpp \ $$PWD/qabstractaxis.cpp @@ -14,13 +14,13 @@ PRIVATE_HEADERS += \ $$PWD/chartaxis_p.h \ $$PWD/chartaxisx_p.h \ $$PWD/chartaxisy_p.h \ - $$PWD/qaxiscategories_p.h \ +# $$PWD/qaxiscategories_p.h \ $$PWD/qcategoriesaxis_p.h \ $$PWD/qvaluesaxis_p.h \ $$PWD/qabstractaxis_p.h PUBLIC_HEADERS += \ - $$PWD/qaxiscategories.h \ +# $$PWD/qaxiscategories.h \ $$PWD/qcategoriesaxis.h \ $$PWD/qvaluesaxis.h \ - $$PWD/qabstractaxis.h \ No newline at end of file + $$PWD/qabstractaxis.h diff --git a/src/axis/chartaxis.cpp b/src/axis/chartaxis.cpp index 8502f50..15f3f15 100644 --- a/src/axis/chartaxis.cpp +++ b/src/axis/chartaxis.cpp @@ -150,11 +150,11 @@ bool ChartAxis::createLabels(QStringList &labels,qreal min, qreal max,int ticks) Q_ASSERT(ticks>1); //TODO:: QAxisCategories* categories = m_chartAxis->categories(); - QAxisCategories* categories = new QAxisCategories(); +// QAxisCategories* categories = new QAxisCategories(); - bool category = categories->count()>0; +// bool category = categories->count()>0; - if (!category) { +// if (!category) { int n = qMax(int(-floor(log10((max-min)/(ticks-1)))),0); n++; for (int i=0; i< ticks; i++) { @@ -162,22 +162,23 @@ bool ChartAxis::createLabels(QStringList &labels,qreal min, qreal max,int ticks) Q_UNUSED(value); labels << QString::number(value,'f',n); } - } else { - QList values = categories->values(); - for (int i=0; i< ticks; i++) { - qreal value = (min + (i * (max - min)/ (ticks-1))); - int j=0; - for (; j value) break; - } - if (j!=0) value=values.at(j-1); - - QString label = categories->label(value); - labels << label; - } - } +// } else { +// QList values = categories->values(); +// for (int i=0; i< ticks; i++) { +// qreal value = (min + (i * (max - min)/ (ticks-1))); +// int j=0; +// for (; j value) break; +// } +// if (j!=0) value=values.at(j-1); + +// QString label = categories->label(value); +// labels << label; +// } +// } - return category; +// return category; + return true; } void ChartAxis::setAxisOpacity(qreal opacity) @@ -204,6 +205,7 @@ void ChartAxis::setLabelsOpacity(qreal opacity) { m_labels->setOpacity(opacity); } +#include "qaxiscategories.h" qreal ChartAxis::labelsOpacity() const { diff --git a/src/axis/qabstractaxis.cpp b/src/axis/qabstractaxis.cpp index 713cb4f..4d4e685 100644 --- a/src/axis/qabstractaxis.cpp +++ b/src/axis/qabstractaxis.cpp @@ -55,6 +55,20 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! + \enum QAbstractAxis::AxisType + + The type of the series object. + + \value AxisTypeValues + \value AxisTypeCategories +*/ + +/*! + \property QAbstractAxis::type + The type of the axis. +*/ + +/*! \property QAbstractAxis::labelsVisible Defines if axis labels are visible. */ diff --git a/src/axis/qaxiscategories.cpp b/src/axis/qaxiscategories.cpp deleted file mode 100644 index 0788ad3..0000000 --- a/src/axis/qaxiscategories.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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 Commercial Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial 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 "qaxiscategories.h" -#include "qaxiscategories_p.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -/*! - \class QAxisCategories - \brief The QAxisCategoriess class is used for manipulating axis's categories. - \mainclass - - Each axis can have categories instead of numerical representation. The typical use case - is bar chart, where categories are always show on X axis. -*/ - - -QAxisCategories::QAxisCategories(): -d_ptr(new QAxisCategoriesPrivate(this)) -{ - -} - -/*! - Destroys the object. -*/ -QAxisCategories::~QAxisCategories() -{ - -} - -/*! - Inserts \a categories to axis. First item in list is assumed to be at x = 0, next at x = 1 and so on - */ -void QAxisCategories::insert(const QStringList &categories) -{ - int i=0; - foreach (const QString& string , categories) { - d_ptr->m_map.insert(i,string); - i++; - } - emit d_ptr->updated(); -} - - -/*! - Inserts category, instead of \a value on axis a \a label will be shown. - */ -void QAxisCategories::insert(qreal value,QString label) -{ - d_ptr->m_map.insert(value,label); - emit d_ptr->updated(); -} - -/*! - Removes category for \a value. - */ -void QAxisCategories::remove(qreal value) -{ - d_ptr->m_map.remove(value); - emit d_ptr->updated(); -} - -/*! - Removes all categories. - */ -void QAxisCategories::clear() -{ - d_ptr->m_map.clear(); - emit d_ptr->updated(); -} - -/*! - Returns number of categories. - */ -int QAxisCategories::count() -{ - return d_ptr->m_map.count(); -} - -/*! - Returns all values of categories. - */ -QList QAxisCategories::values() const -{ - return d_ptr->m_map.keys(); -} - -/*! - Returns label for given \a value. - */ -QString QAxisCategories::label(qreal value) const -{ - return d_ptr->m_map.value(value); -} - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -QAxisCategoriesPrivate::QAxisCategoriesPrivate(QAxisCategories *q): -q_ptr(q) -{ - -} - -QAxisCategoriesPrivate::~QAxisCategoriesPrivate() -{ - -} - -#include "moc_qaxiscategories.cpp" -#include "moc_qaxiscategories_p.cpp" - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/axis/qaxiscategories.h b/src/axis/qaxiscategories.h deleted file mode 100644 index f78cb83..0000000 --- a/src/axis/qaxiscategories.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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 Commercial Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial 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 QAXISCATEGORIES_H -#define QAXISCATEGORIES_H - -#include -#include - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class QAxisCategoriesPrivate; - -class QTCOMMERCIALCHART_EXPORT QAxisCategories : public QObject -{ - Q_OBJECT -private: - QAxisCategories(); -public: - ~QAxisCategories(); - - void insert(const QStringList &category); - void insert(qreal value,QString label); - void remove(qreal value); - QList values() const; - QString label(qreal value) const; - void clear(); - int count(); - -private: - QScopedPointer d_ptr; - friend class QAxisPrivate; - friend class ChartAxis; -}; - - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif /* QCHARTAXISCATEGORIES_H_ */ diff --git a/src/axis/qaxiscategories_p.h b/src/axis/qaxiscategories_p.h deleted file mode 100644 index 88082c6..0000000 --- a/src/axis/qaxiscategories_p.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 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 Commercial Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial 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 QtCommercial 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 QAXISCATEGORIES_P_H -#define QAXISCATEGORIES_P_H - -#include "qaxiscategories.h" -#include - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class QAxisCategoriesPrivate : public QObject -{ - Q_OBJECT -public: - QAxisCategoriesPrivate(QAxisCategories *q); - ~QAxisCategoriesPrivate(); - -Q_SIGNALS: - void updated(); - -private: - QAxisCategories *q_ptr; - QMap m_map; - friend class QAxisCategories; - -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif