##// END OF EJS Templates
refactored baranimations
refactored baranimations

File last commit:

r1654:746d930ea165
r1673:4673b2d6daea
Show More
qintervalaxis.cpp
178 lines | 4.0 KiB | text/x-c | CppLexer
/ src / axis / qintervalaxis.cpp
Michal Klocek
Adds new API classes...
r1540 /****************************************************************************
**
** 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$
**
****************************************************************************/
Michal Klocek
QCategoryAxis to QIntervalAxis part 2 of 2
r1615 #include "qintervalaxis.h"
#include "qintervalaxis_p.h"
Marek Rosa
Removed generic chartaxis
r1561 #include "chartcategoriesaxisx_p.h"
#include "chartcategoriesaxisy_p.h"
sauimone
fixed bug in category range handling in categoryaxis
r1572 #include <qmath.h>
Michal Klocek
Refactor categories implementation...
r1611 #include <QDebug>
Michal Klocek
Adds new API classes...
r1540
QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
barcategoriesaxis documentation. Doc stub to intervalaxis
r1624 /*!
Marek Rosa
Disabled QIntervalAxis and make docs for it internal
r1653 \internal
sauimone
barcategoriesaxis documentation. Doc stub to intervalaxis
r1624 \class QIntervalAxis
\brief The QIntervalAxis class is used for manipulating chart's axis.
\mainclass
Axis can be setup to show axis line with tick marks, grid lines and shades.
*/
/*!
\qmlclass Axis QIntervalAxis
\brief The Axis element is used for manipulating chart's axes.
Axis can be setup to show axis line with tick marks, grid lines and shades.
To access Axes you can use ChartView API. For example:
\code
// TODO :)
\endcode
*/
Marek Rosa
Axes docs update
r1636 /*!
Constructs an axis object which is a child of \a parent.
*/
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 QIntervalAxis::QIntervalAxis(QObject *parent):
QValuesAxis(*new QIntervalAxisPrivate(this),parent)
Michal Klocek
Adds new API classes...
r1540 {
}
Marek Rosa
Various docs fixes
r1638 /*!
Destroys the object
*/
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 QIntervalAxis::~QIntervalAxis()
Michal Klocek
Adds new API classes...
r1540 {
}
Marek Rosa
Various docs fixes
r1638 /*!
\internal
*/
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 QIntervalAxis::QIntervalAxis(QIntervalAxisPrivate &d,QObject *parent):QValuesAxis(d,parent)
Michal Klocek
Adds new API classes...
r1540 {
}
/*!
sauimone
abstract axis qml documentation. bug fix to setArrowVisible
r1654 Appends \a category to axis
Michal Klocek
Adds new API classes...
r1540 */
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 void QIntervalAxis::append(const QString& category, qreal x)
Michal Klocek
Refactor CategoriesAxis to BarCategoriesAxis part 2 of 2
r1613 {
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 Q_D(QIntervalAxis);
Michal Klocek
Refactor CategoriesAxis to BarCategoriesAxis part 2 of 2
r1613 if (!d->m_categories.contains(category))
{
if(d->m_categories.isEmpty()){
Range range(d->m_categoryMinimum,x);
d->m_categoriesMap.insert(category,range);
d->m_categories.append(category);
}else{
Range range = d->m_categoriesMap.value(d->m_categories.last());
d->m_categoriesMap.insert(category,Range(range.first,x));
d->m_categories.append(category);
}
setRange(d->m_min,x);
sauimone
category axis magic
r1605 }
Michal Klocek
Adds new API classes...
r1540 }
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 void QIntervalAxis::setFisrtCategoryMinimum(qreal x)
Michal Klocek
Adds new API classes...
r1540 {
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 Q_D(QIntervalAxis);
Michal Klocek
Refactor CategoriesAxis to BarCategoriesAxis part 2 of 2
r1613 if(d->m_categories.isEmpty()){
d->m_categoryMinimum=x;
}else{
Range range = d->m_categoriesMap.value(d->m_categories.first());
d->m_categoriesMap.insert(d->m_categories.first(),Range(x,range.second));
setRange(x,d->m_min);
}
Michal Klocek
Adds new API classes...
r1540 }
/*!
Removes \a category from axis
*/
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 void QIntervalAxis::remove(const QString &category)
Michal Klocek
Adds new API classes...
r1540 {
Michal Klocek
Refactor CategoriesAxis to BarCategoriesAxis part 2 of 2
r1613 Q_UNUSED(category);
//TODO
Michal Klocek
Adds new API classes...
r1540 }
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 QStringList QIntervalAxis::categories()
Tero Ahola
Added value and category axis to QML api
r1550 {
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 Q_D(QIntervalAxis);
Tero Ahola
Added value and category axis to QML api
r1550 return d->m_categories;
}
Michal Klocek
Adds new API classes...
r1540 /*!
Returns number of categories.
*/
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 int QIntervalAxis::count() const
Michal Klocek
Adds new API classes...
r1540 {
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 Q_D(const QIntervalAxis);
Michal Klocek
Adds new API classes...
r1540 return d->m_categories.count();
}
/*!
Marek Rosa
Few more axes docs updates
r1637 Returns the type of the axis
Michal Klocek
Adds new API classes...
r1540 */
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 QAbstractAxis::AxisType QIntervalAxis::type() const
Michal Klocek
Adds new API classes...
r1540 {
return AxisTypeCategories;
}
Michal Klocek
Refactors setMin setMax setRange to be pure viritual on private implementation
r1544 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 QIntervalAxisPrivate::QIntervalAxisPrivate(QIntervalAxis* q):
Michal Klocek
Refactor CategoriesAxis to BarCategoriesAxis part 2 of 2
r1613 QValuesAxisPrivate(q),
m_categoryMinimum(0)
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 {
Michal Klocek
Refactors setMin setMax setRange to be pure viritual on private implementation
r1544
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 }
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 QIntervalAxisPrivate::~QIntervalAxisPrivate()
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 {
Michal Klocek
Refactors setMin setMax setRange to be pure viritual on private implementation
r1544
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 }
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 int QIntervalAxisPrivate::ticksCount() const
Michal Klocek
Adds new API classes...
r1540 {
Michal Klocek
Refactors setMin setMax setRange to be pure viritual on private implementation
r1544 return m_categories.count()+1;
Michal Klocek
Adds new API classes...
r1540 }
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 void QIntervalAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count)
sauimone
refactoring axises
r1566 {
m_min = min;
m_max = max;
m_ticksCount = count;
}
Michal Klocek
QCategoryAxis to QIntervalAxis part 1 of 2
r1614 ChartAxis* QIntervalAxisPrivate::createGraphics(ChartPresenter* presenter)
Michal Klocek
Refactors core to support mulitpile axis and domains...
r1556 {
Michal Klocek
Refactor CategoriesAxis to BarCategoriesAxis part 2 of 2
r1613 Q_UNUSED(presenter);
// Q_Q( QCategoriesAxis);
Michal Klocek
Refactors core to support mulitpile axis and domains...
r1556 if(m_orientation == Qt::Vertical){
Michal Klocek
Refactor CategoriesAxis to BarCategoriesAxis part 2 of 2
r1613 return 0;
Michal Klocek
Refactors core to support mulitpile axis and domains...
r1556 }else{
Michal Klocek
Refactor CategoriesAxis to BarCategoriesAxis part 2 of 2
r1613 return 0;
Michal Klocek
Refactors core to support mulitpile axis and domains...
r1556 }
}
Michal Klocek
QCategoryAxis to QIntervalAxis part 2 of 2
r1615 #include "moc_qintervalaxis.cpp"
#include "moc_qintervalaxis_p.cpp"
Michal Klocek
Adds new API classes...
r1540
QTCOMMERCIALCHART_END_NAMESPACE