From 5f7bdc0a20837fb697501632e03ca288492ac1ab 2012-05-31 11:26:52 From: sauimone Date: 2012-05-31 11:26:52 Subject: [PATCH] barchart visible property fix --- diff --git a/src/barchart/groupedbarchartitem.cpp b/src/barchart/groupedbarchartitem.cpp index 53ee352..1c438e9 100644 --- a/src/barchart/groupedbarchartitem.cpp +++ b/src/barchart/groupedbarchartitem.cpp @@ -38,6 +38,7 @@ QVector GroupedBarChartItem::calculateLayout() // Use temporary qreals for accuracy qreal categoryCount = m_series->d_func()->categoryCount(); qreal setCount = m_series->barsetCount(); + bool barsVisible = m_series->isVisible(); // Domain: qreal width = geometry().width(); @@ -65,6 +66,7 @@ QVector GroupedBarChartItem::calculateLayout() layout.append(rect); bar->setPen(barSet->pen()); bar->setBrush(barSet->brush()); + bar->setVisible(barsVisible); QGraphicsSimpleTextItem* label = m_labels.at(itemIndex); diff --git a/src/barchart/percentbarchartitem.cpp b/src/barchart/percentbarchartitem.cpp index 7cb39e2..a416c46 100644 --- a/src/barchart/percentbarchartitem.cpp +++ b/src/barchart/percentbarchartitem.cpp @@ -38,6 +38,7 @@ QVector PercentBarChartItem::calculateLayout() // Use temporary qreals for accuracy qreal categoryCount = m_series->d_func()->categoryCount(); qreal setCount = m_series->barsetCount(); + bool barsVisible = m_series->isVisible(); // Domain: qreal width = geometry().width(); @@ -63,6 +64,8 @@ QVector PercentBarChartItem::calculateLayout() Bar* bar = m_bars.at(itemIndex); bar->setPen(barSet->pen()); bar->setBrush(barSet->brush()); + bar->setVisible(barsVisible); + QRectF rect(xPos, yPos-barHeight, barWidth, barHeight); layout.append(rect); @@ -82,6 +85,7 @@ QVector PercentBarChartItem::calculateLayout() ,yPos - barHeight/2 - label->boundingRect().height()/2); label->setFont(barSet->labelFont()); label->setBrush(barSet->labelBrush()); + itemIndex++; yPos -= barHeight; } diff --git a/src/barchart/stackedbarchartitem.cpp b/src/barchart/stackedbarchartitem.cpp index d82901e..efd5222 100644 --- a/src/barchart/stackedbarchartitem.cpp +++ b/src/barchart/stackedbarchartitem.cpp @@ -37,6 +37,7 @@ QVector StackedBarChartItem::calculateLayout() // Use temporary qreals for accuracy qreal categoryCount = m_series->d_func()->categoryCount(); qreal setCount = m_series->barsetCount(); + bool barsVisible = m_series->isVisible(); // Domain: qreal width = geometry().width(); @@ -60,6 +61,8 @@ QVector StackedBarChartItem::calculateLayout() Bar* bar = m_bars.at(itemIndex); bar->setPen(barSet->pen()); bar->setBrush(barSet->brush()); + bar->setVisible(barsVisible); + QRectF rect(xPos, yPos-barHeight, barWidth, barHeight); layout.append(rect);