##// END OF EJS Templates
Remove setter for labelinBeetwen flag from axis
Michal Klocek -
r2118:7942a7e7245e
parent child
Show More
@@ -27,10 +27,10
27 27
28 28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 29
30 ChartBarCategoryAxisX::ChartBarCategoryAxisX(QBarCategoryAxis *axis,ChartPresenter *presenter) : HorizontalAxis(axis,presenter),
30 ChartBarCategoryAxisX::ChartBarCategoryAxisX(QBarCategoryAxis *axis,ChartPresenter *presenter) : HorizontalAxis(axis,presenter,true),
31 31 m_categoriesAxis(axis)
32 32 {
33 setLabelBetweenTicks(true);
33
34 34 }
35 35
36 36 ChartBarCategoryAxisX::~ChartBarCategoryAxisX()
@@ -26,10 +26,9
26 26
27 27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 28
29 ChartBarCategoryAxisY::ChartBarCategoryAxisY(QBarCategoryAxis *axis,ChartPresenter *presenter) : VerticalAxis(axis,presenter),
29 ChartBarCategoryAxisY::ChartBarCategoryAxisY(QBarCategoryAxis *axis,ChartPresenter *presenter) : VerticalAxis(axis,presenter,true),
30 30 m_categoriesAxis(axis)
31 31 {
32 setLabelBetweenTicks(true);
33 32 }
34 33
35 34 ChartBarCategoryAxisY::~ChartBarCategoryAxisY()
@@ -28,10 +28,9
28 28
29 29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 30
31 ChartCategoryAxisX::ChartCategoryAxisX(QCategoryAxis *axis,ChartPresenter *presenter) : HorizontalAxis(axis,presenter),
31 ChartCategoryAxisX::ChartCategoryAxisX(QCategoryAxis *axis,ChartPresenter *presenter) : HorizontalAxis(axis,presenter,true),
32 32 m_axis(axis)
33 33 {
34 setLabelBetweenTicks(true);
35 34 }
36 35
37 36 ChartCategoryAxisX::~ChartCategoryAxisX()
@@ -28,10 +28,9
28 28
29 29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 30
31 ChartCategoryAxisY::ChartCategoryAxisY(QCategoryAxis *axis,ChartPresenter *presenter) : VerticalAxis(axis,presenter),
31 ChartCategoryAxisY::ChartCategoryAxisY(QCategoryAxis *axis,ChartPresenter *presenter) : VerticalAxis(axis,presenter,true),
32 32 m_axis(axis)
33 33 {
34 setLabelBetweenTicks(true);
35 34 }
36 35
37 36 ChartCategoryAxisY::~ChartCategoryAxisY()
@@ -32,7 +32,7
32 32
33 33 QTCOMMERCIALCHART_BEGIN_NAMESPACE
34 34
35 ChartAxis::ChartAxis(QAbstractAxis *axis,ChartPresenter *presenter) : ChartElement(presenter),
35 ChartAxis::ChartAxis(QAbstractAxis *axis,ChartPresenter *presenter, bool intervalAxis) : ChartElement(presenter),
36 36 m_chartAxis(axis),
37 37 m_labelsAngle(0),
38 38 m_grid(new QGraphicsItemGroup(presenter->rootItem())),
@@ -44,7 +44,7 ChartAxis::ChartAxis(QAbstractAxis *axis,ChartPresenter *presenter) : ChartEleme
44 44 m_max(0),
45 45 m_animation(0),
46 46 m_labelPadding(5),
47 m_labelBetween(false)
47 m_intervalAxis(intervalAxis)
48 48 {
49 49 //initial initialization
50 50 m_arrow->setZValue(ChartPresenter::AxisZValue);
@@ -78,7 +78,7 void ChartAxis::createItems(int count)
78 78 {
79 79 if (m_arrow->children().size() == 0)
80 80 m_arrow->addToGroup(new AxisItem(this,presenter()->rootItem()));
81 if (m_grid->children().size() == 0){
81 if (m_intervalAxis && m_grid->children().size() == 0){
82 82 for(int i = 0 ; i < 2 ;i ++)
83 83 m_grid->addToGroup(new QGraphicsLineItem(presenter()->rootItem()));
84 84 }
@@ -415,11 +415,6 void ChartAxis::axisSelected()
415 415 //TODO: axis clicked;
416 416 }
417 417
418 void ChartAxis::setLabelBetweenTicks(bool enabled)
419 {
420 m_labelBetween=enabled;
421 }
422
423 418 Qt::Orientation ChartAxis::orientation() const
424 419 {
425 420 return m_chartAxis->orientation();
@@ -48,7 +48,7 class ChartAxis : public ChartElement, public QGraphicsLayoutItem
48 48 Q_INTERFACES(QGraphicsLayoutItem)
49 49 public:
50 50
51 ChartAxis(QAbstractAxis *axis, ChartPresenter *presenter);
51 ChartAxis(QAbstractAxis *axis, ChartPresenter *presenter, bool intervalAxis = false);
52 52 ~ChartAxis();
53 53
54 54 void setArrowOpacity(qreal opacity);
@@ -106,8 +106,8 public:
106 106 void setLabels(const QStringList& labels);
107 107 QStringList labels() const { return m_labelsList; }
108 108
109 void setLabelBetweenTicks(bool enabled);
110 bool labelBetweenTicks() const { return m_labelBetween; }
109 //this flag indicates that axis is used to show intervals it means labels are in between ticks
110 bool intervalAxis() const { return m_intervalAxis; }
111 111
112 112 virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
113 113
@@ -156,7 +156,7 private:
156 156 QString m_titleText;
157 157 int m_labelPadding;
158 158 QStringList m_labelsList;
159 bool m_labelBetween;
159 bool m_intervalAxis;
160 160
161 161 friend class AxisAnimation;
162 162 friend class AxisItem;
@@ -25,7 +25,7
25 25
26 26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 27
28 HorizontalAxis::HorizontalAxis(QAbstractAxis *axis, ChartPresenter *presenter):ChartAxis(axis,presenter)
28 HorizontalAxis::HorizontalAxis(QAbstractAxis *axis, ChartPresenter *presenter,bool intervalAxis):ChartAxis(axis,presenter,intervalAxis)
29 29 {
30 30 }
31 31
@@ -86,7 +86,7 void HorizontalAxis::updateGeometry()
86 86 tickItem->setLine(layout[i],axisRect.top(),layout[i],axisRect.top() + labelPadding());
87 87 }
88 88
89 if(labelBetweenTicks()&& i+1!=layout.size()) {
89 if(intervalAxis()&& i+1!=layout.size()) {
90 90 const qreal delta = (layout[i+1] - layout[i])/2;
91 91 labelItem->setPos(layout[i] + delta - center.x(), labelItem->pos().y());
92 92 }
@@ -117,14 +117,14 void HorizontalAxis::updateGeometry()
117 117 if (x < gridRect.left() || x > gridRect.right()) {
118 118 gridItem->setVisible(false);
119 119 tickItem->setVisible(false);
120 if( labelBetweenTicks() && ( labelItem->pos().x() < gridRect.left() || labelItem->pos().x() + rect.width() > gridRect.right()))
120 if( intervalAxis() && ( labelItem->pos().x() < gridRect.left() || labelItem->pos().x() + rect.width() > gridRect.right()))
121 121 labelItem->setVisible(false);
122 122 }
123 123
124 124 }
125 125
126 126 //begin/end grid line in case labels between
127 if(labelBetweenTicks()) {
127 if(intervalAxis()) {
128 128 QGraphicsLineItem *gridLine;
129 129 gridLine = static_cast<QGraphicsLineItem*>(lines.at(layout.size()));
130 130 gridLine->setLine(gridRect.right(), gridRect.top(), gridRect.right(), gridRect.bottom());
@@ -37,7 +37,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37 37 class HorizontalAxis : public ChartAxis
38 38 {
39 39 public:
40 HorizontalAxis(QAbstractAxis *axis, ChartPresenter *presenter);
40 HorizontalAxis(QAbstractAxis *axis, ChartPresenter *presenter,bool intervalAxis = false);
41 41 ~HorizontalAxis();
42 42 protected:
43 43 void updateGeometry();
@@ -24,7 +24,7
24 24
25 25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 26
27 VerticalAxis::VerticalAxis(QAbstractAxis *axis, ChartPresenter *presenter):ChartAxis(axis,presenter)
27 VerticalAxis::VerticalAxis(QAbstractAxis *axis, ChartPresenter *presenter, bool intervalAxis):ChartAxis(axis,presenter,intervalAxis)
28 28 {
29 29
30 30 }
@@ -98,7 +98,7 void VerticalAxis::updateGeometry()
98 98 labelItem->setPos( axisRect.left() + labelPadding() , layout[i]-center.y());
99 99 tickItem->setLine( axisRect.left(),layout[i], axisRect.left()+ labelPadding(),layout[i]);
100 100 }
101 if(labelBetweenTicks()&& i+1!=layout.size()) {
101 if(intervalAxis()&& i+1!=layout.size()) {
102 102 const qreal delta = (layout[i+1] - layout[i])/2;
103 103 labelItem->setPos(labelItem->pos().x() , layout[i] + delta - center.y());
104 104 }
@@ -128,13 +128,13 void VerticalAxis::updateGeometry()
128 128 if (y < gridRect.top() || y > gridRect.bottom()) {
129 129 gridItem->setVisible(false);
130 130 tickItem->setVisible(false);
131 if( labelBetweenTicks() && ( labelItem->pos().y() < gridRect.top() || labelItem->pos().y() + rect.height() > gridRect.bottom()))
131 if( intervalAxis() && ( labelItem->pos().y() < gridRect.top() || labelItem->pos().y() + rect.height() > gridRect.bottom()))
132 132 labelItem->setVisible(false);
133 133 }
134 134
135 135 }
136 136 //begin/end grid line in case labels between
137 if(labelBetweenTicks()) {
137 if(intervalAxis()) {
138 138 QGraphicsLineItem *gridLine;
139 139 gridLine = static_cast<QGraphicsLineItem*>(lines.at(layout.size()));
140 140 gridLine->setLine(gridRect.left(), gridRect.top(), gridRect.right(), gridRect.top());
@@ -37,7 +37,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37 37 class VerticalAxis : public ChartAxis
38 38 {
39 39 public:
40 VerticalAxis(QAbstractAxis *axis, ChartPresenter *presenter);
40 VerticalAxis(QAbstractAxis *axis, ChartPresenter *presenter, bool intervalAxis = false);
41 41 ~VerticalAxis();
42 42 protected:
43 43 void updateGeometry();
General Comments 0
You need to be logged in to leave comments. Login now