##// END OF EJS Templates
visible property to barseries
sauimone -
r1284:38cef2676df3
parent child
Show More
@@ -103,6 +103,7 QVector<QRectF> BarChartItem::calculateLayout()
103 103 // Use temporary qreals for accurancy
104 104 qreal categoryCount = m_series->categoryCount();
105 105 qreal setCount = m_series->barsetCount();
106 bool barsVisible = m_series->isVisible();
106 107
107 108 // Domain:
108 109 qreal width = geometry().width();
@@ -128,6 +129,7 QVector<QRectF> BarChartItem::calculateLayout()
128 129 layout.append(rect);
129 130 bar->setPen(barSet->pen());
130 131 bar->setBrush(barSet->brush());
132 bar->setVisible(barsVisible);
131 133
132 134 QGraphicsSimpleTextItem* label = m_labels.at(itemIndex);
133 135
@@ -113,6 +113,12 void QBarSeries::setBarMargin(qreal margin)
113 113 d->setBarMargin(margin);
114 114 }
115 115
116 qreal QBarSeries::barMargin() const
117 {
118 Q_D(const QBarSeries);
119 return d->barMargin();
120 }
121
116 122 /*!
117 123 Adds a set of bars to series. Takes ownership of \a set. If the set is null or is already in series, it won't be appended.
118 124 Returns true, if appending succeeded.
@@ -191,6 +197,18 QBarCategories QBarSeries::categories() const
191 197 return d->categories();
192 198 }
193 199
200 void QBarSeries::setVisible(bool visible)
201 {
202 Q_D(QBarSeries);
203 d->setVisible(visible);
204 }
205
206 bool QBarSeries::isVisible() const
207 {
208 Q_D(const QBarSeries);
209 return d->isVisible();
210 }
211
194 212 /*!
195 213 Sets the visibility of labels in series to \a visible
196 214 */
@@ -214,7 +232,8 bool QBarSeries::isLabelsVisible() const
214 232 QBarSeriesPrivate::QBarSeriesPrivate(QBarSeries *q) :
215 233 QAbstractSeriesPrivate(q),
216 234 m_barMargin(0.05), // Default value is 5% of category width
217 m_labelsVisible(false)
235 m_labelsVisible(false),
236 m_visible(true)
218 237 {
219 238 }
220 239
@@ -280,7 +299,7 void QBarSeriesPrivate::setBarMargin(qreal margin)
280 299 emit updatedBars();
281 300 }
282 301
283 qreal QBarSeriesPrivate::barMargin()
302 qreal QBarSeriesPrivate::barMargin() const
284 303 {
285 304 return m_barMargin;
286 305 }
@@ -290,6 +309,19 QBarSet* QBarSeriesPrivate::barsetAt(int index)
290 309 return m_barSets.at(index);
291 310 }
292 311
312 void QBarSeriesPrivate::setVisible(bool visible)
313 {
314 if (m_visible != visible) {
315 m_visible = visible;
316 emit updatedBars();
317 }
318 }
319
320 bool QBarSeriesPrivate::isVisible() const
321 {
322 return m_visible;
323 }
324
293 325 QString QBarSeriesPrivate::categoryName(int category)
294 326 {
295 327 if ((category >= 0) && (category < m_categories.count())) {
@@ -44,6 +44,7 public:
44 44 void setCategories(QBarCategories categories);
45 45
46 46 void setBarMargin(qreal margin);
47 qreal barMargin() const;
47 48
48 49 bool append(QBarSet *set);
49 50 bool remove(QBarSet *set);
@@ -54,6 +55,8 public:
54 55 QList<QBarSet*> barSets() const;
55 56 QBarCategories categories() const;
56 57
58 void setVisible(bool visible = true);
59 bool isVisible() const;
57 60 void setLabelsVisible(bool visible = true);
58 61 bool isLabelsVisible() const;
59 62
@@ -51,7 +51,10 public:
51 51 QBarCategories categories() const;
52 52
53 53 void setBarMargin(qreal margin);
54 qreal barMargin();
54 qreal barMargin() const;
55
56 void setVisible(bool visible);
57 bool isVisible() const;
55 58
56 59 void scaleDomain(Domain& domain);
57 60 Chart* createGraphics(ChartPresenter* presenter);
@@ -87,6 +90,7 protected:
87 90 QBarCategories m_categories;
88 91 qreal m_barMargin;
89 92 bool m_labelsVisible;
93 bool m_visible;
90 94
91 95 private:
92 96 Q_DECLARE_PUBLIC(QBarSeries)
General Comments 0
You need to be logged in to leave comments. Login now