@@ -164,20 +164,10 Rectangle { | |||
|
164 | 164 | //![3] |
|
165 | 165 | |
|
166 | 166 | Component.onCompleted: { |
|
167 | setAxisX(categoryAxis,myBarSeries) | |
|
168 |
setAxisX(categoryAxis, |
|
|
169 |
|
|
|
170 | setAxisX(categoryAxis,lineSeries3) | |
|
171 | setAxisX(categoryAxis,lineSeries4) | |
|
172 | setAxisX(categoryAxis,lineSeries5) | |
|
173 | setAxisY(yAxis,myBarSeries) | |
|
174 | setAxisY(yAxis,lineSeries1) | |
|
175 | setAxisY(yAxis,lineSeries2) | |
|
176 | setAxisY(yAxis,lineSeries3) | |
|
177 | setAxisY(yAxis,lineSeries4) | |
|
178 | setAxisY(yAxis,lineSeries5) | |
|
179 | categoryAxis.min = "2007" | |
|
180 | categoryAxis.max = "2014" | |
|
167 | createDefaultAxes(); | |
|
168 | setAxisX(categoryAxis,myBarSeries) | |
|
169 | categoryAxis.min = "2007" | |
|
170 | categoryAxis.max = "2014" | |
|
181 | 171 | } |
|
182 | 172 | } |
|
183 | 173 | } |
@@ -98,8 +98,7 void ChartPresenter::handleAxisAdded(QAbstractAxis* axis,Domain* domain) | |||
|
98 | 98 | if(m_rect.isValid()) item->handleGeometryChanged(m_rect); |
|
99 | 99 | //reload visiblity |
|
100 | 100 | m_axisItems.insert(axis, item); |
|
101 | if(axis->isVisible()) axis->hide(); | |
|
102 | axis->show(); | |
|
101 | selectVisibleAxis(); | |
|
103 | 102 | |
|
104 | 103 | } |
|
105 | 104 | |
@@ -107,6 +106,7 void ChartPresenter::handleAxisRemoved(QAbstractAxis* axis) | |||
|
107 | 106 | { |
|
108 | 107 | ChartAxis* item = m_axisItems.take(axis); |
|
109 | 108 | Q_ASSERT(item); |
|
109 | selectVisibleAxis(); | |
|
110 | 110 | if(m_animator) m_animator->removeAnimation(item); |
|
111 | 111 | item->deleteLater(); |
|
112 | 112 | } |
@@ -143,6 +143,34 void ChartPresenter::handleSeriesRemoved(QAbstractSeries* series) | |||
|
143 | 143 | item->deleteLater(); |
|
144 | 144 | } |
|
145 | 145 | |
|
146 | void ChartPresenter::selectVisibleAxis() | |
|
147 | { | |
|
148 | QMapIterator<QAbstractAxis*, ChartAxis*> i(m_axisItems); | |
|
149 | ||
|
150 | while (i.hasNext()) { | |
|
151 | i.next(); | |
|
152 | i.key()->hide(); | |
|
153 | } | |
|
154 | ||
|
155 | i.toFront(); | |
|
156 | ||
|
157 | bool axisX=false; | |
|
158 | bool axisY=false; | |
|
159 | ||
|
160 | while (i.hasNext()) { | |
|
161 | i.next(); | |
|
162 | if(i.key()->d_ptr->m_orientation==Qt::Vertical && !axisY) { | |
|
163 | axisY=true; | |
|
164 | i.key()->show(); | |
|
165 | } | |
|
166 | if(i.key()->d_ptr->m_orientation==Qt::Horizontal && !axisX) { | |
|
167 | axisX=true; | |
|
168 | i.key()->show(); | |
|
169 | } | |
|
170 | ||
|
171 | } | |
|
172 | } | |
|
173 | ||
|
146 | 174 | |
|
147 | 175 | void ChartPresenter::handleAxisVisibleChanged(bool visible) |
|
148 | 176 | { |
General Comments 0
You need to be logged in to leave comments.
Login now