##// END OF EJS Templates
QML demo basic area chart to use value axis to make it simpler
QML demo basic area chart to use value axis to make it simpler

File last commit:

r1890:daeb29af4a46
r1934:e8c5b1221524
Show More
chartaxis_p.h
169 lines | 4.4 KiB | text/x-c | CLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
** 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$
**
****************************************************************************/
unknown
Added missing warning about private implementation
r1366 // 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.
Michal Klocek
Refactors axis animation, line animations
r1241 #ifndef CHARTAXIS_H
#define CHARTAXIS_H
Michal Klocek
Add zoom support...
r67
Michal Klocek
Refactor qledgend handling...
r855 #include "qchartglobal.h"
Michal Klocek
Refactors Chart to ChartElement
r1736 #include "chartelement_p.h"
Michal Klocek
Refactors axis animation, line animations
r1241 #include "axisanimation_p.h"
Michal Klocek
Add zoom support...
r67 #include <QGraphicsItem>
Michal Klocek
Refactors layout managment...
r1534 #include <QFont>
Michal Klocek
Add zoom support...
r67
QTCOMMERCIALCHART_BEGIN_NAMESPACE
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 class QAbstractAxis;
Michal Klocek
Animation refactor...
r530 class ChartPresenter;
Michal Klocek
Adds refactored axis to presenter
r140
Michal Klocek
Refactors Chart to ChartElement
r1736 class ChartAxis : public ChartElement
Michal Klocek
Add zoom support...
r67 {
Michal Klocek
Adds refactored axis to presenter
r140 Q_OBJECT
Michal Klocek
Add zoom support...
r67 public:
Michal Klocek
Refactors axis animation, line animations
r1241 enum AxisType{ X_AXIS,Y_AXIS };
Michal Klocek
Add zoom support...
r67
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 ChartAxis(QAbstractAxis *axis, ChartPresenter *presenter);
Michal Klocek
Changes QChartAxis -> QAxis
r1006 ~ChartAxis();
Michal Klocek
Add zoom support...
r67
Michal Klocek
Refactors axis animation, line animations
r1241 virtual AxisType axisType() const = 0;
Michal Klocek
Adds refactored axis to presenter
r140
Michal Klocek
Refactor Visibly methods of axis...
r1729 void setArrowOpacity(qreal opacity);
qreal arrowOpacity() const;
void setArrowVisibility(bool visible);
Michal Klocek
Fixes wrong shades zvalues
r184
Michal Klocek
Adds more axis handling...
r176 void setGridOpacity(qreal opacity);
qreal gridOpacity() const;
Michal Klocek
Refactor Visibly methods of axis...
r1729 void setGridVisibility(bool visible);
Michal Klocek
Adds refactored axis to presenter
r140
Michal Klocek
Adds more axis handling...
r176 void setLabelsOpacity(qreal opacity);
qreal labelsOpacity() const;
Michal Klocek
Refactor Visibly methods of axis...
r1729 void setLabelsVisibility(bool visible);
Michal Klocek
Adds refactored axis to presenter
r140
Michal Klocek
Adds more axis handling...
r176 void setShadesOpacity(qreal opacity);
qreal shadesOpacity() const;
Michal Klocek
Refactor Visibly methods of axis...
r1729 void setShadesVisibility(bool visible);
Michal Klocek
Add zoom support...
r67
Michal Klocek
Adds more axis handling...
r176 void setLabelsAngle(int angle);
int labelsAngle()const { return m_labelsAngle; }
sauimone
more minor code review fixes
r745 void setShadesBrush(const QBrush &brush);
void setShadesPen(const QPen &pen);
Michal Klocek
Adds refactored axis to presenter
r140
Michal Klocek
Refactor Visibly methods of axis...
r1729 void setArrowPen(const QPen &pen);
sauimone
more minor code review fixes
r745 void setGridPen(const QPen &pen);
Michal Klocek
Adds more axis handling...
r176
sauimone
more minor code review fixes
r745 void setLabelsPen(const QPen &pen);
void setLabelsBrush(const QBrush &brush);
void setLabelsFont(const QFont &font);
Michal Klocek
Adds more axis handling...
r176
Michal Klocek
Refactors axis animation, line animations
r1241 void setLayout(QVector<qreal> &layout);
QVector<qreal> layout() const { return m_layoutVector; }
void setAnimation(AxisAnimation* animation);
ChartAnimation* animation() const { return m_animation; };
QRectF geometry() const { return m_rect; }
Michal Klocek
Refactors layout managment...
r1534 qreal minimumWidth();
qreal minimumHeight();
Michal Klocek
Refactor Visibly methods of axis...
r1729 void hide();
Michal Klocek
Refactors axis animation, line animations
r1241 protected:
virtual void updateGeometry() = 0;
virtual QVector<qreal> calculateLayout() const = 0;
Michal Klocek
Refactor QChart API...
r1577 void createNumberLabels(QStringList &labels,qreal min, qreal max,int ticks) const;
Michal Klocek
Adds checkLayout call, when geometry of axis updated
r1890 void checkLayout();
Michal Klocek
Fix grid animation to do not go out of bound
r504
sauimone
Q_SIGNALS and Q_SLOTS
r775 public Q_SLOTS:
Michal Klocek
Fixes missing update barcategory...
r1643 virtual void handleAxisUpdated();
Michal Klocek
Refactors Domain and Axis...
r1698 virtual void handleDomainUpdated();
sauimone
more minor code review fixes
r745 void handleGeometryChanged(const QRectF &size);
Michal Klocek
Refactor domain model...
r439
Michal Klocek
Refactora axis and line chart to use graphics items insted of painter.
r85 private:
Michal Klocek
Refacotr axisitem to handle ticks changes
r452 inline bool isEmpty();
Michal Klocek
Refactors axis handling...
r223 void createItems(int count);
Michal Klocek
Axis refactoring to support better barcharts
r502 void deleteItems(int count);
sauimone
more minor code review fixes
r745 void updateLayout(QVector<qreal> &layout);
Michal Klocek
Refactors chartitem...
r677 void axisSelected();
Michal Klocek
Adds draft of axis bar label support
r497
Michal Klocek
Refactors axis animation, line animations
r1241 protected:
Michal Klocek
Refactors QAxis to QAbstractAxis...
r1541 QAbstractAxis* m_chartAxis;
Michal Klocek
Adds refactored axis to presenter
r140 QRectF m_rect;
Michal Klocek
Adds more axis handling...
r176 int m_labelsAngle;
Michal Klocek
Adds axis scoped pointers (to be checked on windows)
r788 QScopedPointer<QGraphicsItemGroup> m_grid;
QScopedPointer<QGraphicsItemGroup> m_shades;
QScopedPointer<QGraphicsItemGroup> m_labels;
Michal Klocek
Refactor Visibly methods of axis...
r1729 QScopedPointer<QGraphicsItemGroup> m_arrow;
Michal Klocek
Refactors axis layout managment...
r291 QVector<qreal> m_layoutVector;
Michal Klocek
Refacotr axisitem to handle ticks changes
r452 qreal m_min;
qreal m_max;
Michal Klocek
Refactors axis animation, line animations
r1241 AxisAnimation *m_animation;
Michal Klocek
Refactors layout managment...
r1534 qreal m_minWidth;
qreal m_minHeight;
QFont m_font;
Michal Klocek
Adds refactored axis to presenter
r140
Michal Klocek
Animation refactor...
r530 friend class AxisAnimation;
Michal Klocek
Refactors chartitem...
r677 friend class AxisItem;
};
class AxisItem: public QGraphicsLineItem
{
Michal Klocek
Normalizes signal slots connections
r967 public:
Michal Klocek
Changes QChartAxis -> QAxis
r1006 explicit AxisItem(ChartAxis *axis, QGraphicsItem *parent = 0) : QGraphicsLineItem(parent), m_axis(axis) {}
Michal Klocek
Refactors chartitem...
r677
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event)
{
Q_UNUSED(event)
m_axis->axisSelected();
}
QRectF boundingRect() const
{
Michal Klocek
Refactors barchart axis hadnling...
r679 return shape().boundingRect();
Michal Klocek
Refactors chartitem...
r677 }
QPainterPath shape() const
{
Michal Klocek
Refactors barchart axis hadnling...
r679 QPainterPath path = QGraphicsLineItem::shape();
QRectF rect = path.boundingRect();
Michal Klocek
Changes QChartAxis -> QAxis
r1006 path.addRect(rect.adjusted(0,0,m_axis->axisType()!=ChartAxis::X_AXIS?8:0,m_axis->axisType()!=ChartAxis::Y_AXIS?8:0));
Michal Klocek
Refactors chartitem...
r677 return path;
}
Michal Klocek
Refactors barchart axis hadnling...
r679
Michal Klocek
Refactors chartitem...
r677 private:
Michal Klocek
Changes QChartAxis -> QAxis
r1006 ChartAxis* m_axis;
Michal Klocek
Animation refactor...
r530
Michal Klocek
Add zoom support...
r67 };
QTCOMMERCIALCHART_END_NAMESPACE
#endif /* AXISITEM_H_ */