@@ -47,7 +47,7 QVector<QRectF> PercentBarChartItem::calculateLayout() | |||
|
47 | 47 | qreal scaleY = (height / rangeY); |
|
48 | 48 | qreal scaleX = (width / rangeX); |
|
49 | 49 | qreal categoryWidth = width / categoryCount; |
|
50 |
qreal barWidth = categoryWidth |
|
|
50 | qreal barWidth = categoryWidth - categoryWidth * m_series->d_func()->barMargin(); | |
|
51 | 51 | |
|
52 | 52 | int itemIndex(0); |
|
53 | 53 | for (int category = 0; category < categoryCount; category++) { |
@@ -231,7 +231,7 bool QBarSeries::isLabelsVisible() const | |||
|
231 | 231 | |
|
232 | 232 | QBarSeriesPrivate::QBarSeriesPrivate(QBarSeries *q) : |
|
233 | 233 | QAbstractSeriesPrivate(q), |
|
234 |
m_barMargin(0. |
|
|
234 | m_barMargin(0.5), // Default value is 50% of category width | |
|
235 | 235 | m_labelsVisible(false), |
|
236 | 236 | m_visible(true) |
|
237 | 237 | { |
@@ -46,12 +46,12 QVector<QRectF> StackedBarChartItem::calculateLayout() | |||
|
46 | 46 | qreal scaleY = (height / rangeY); |
|
47 | 47 | qreal scaleX = (width / rangeX); |
|
48 | 48 | qreal categoryWidth = width / categoryCount; |
|
49 |
qreal barWidth = categoryWidth |
|
|
49 | qreal barWidth = categoryWidth - categoryWidth * m_series->d_func()->barMargin(); | |
|
50 | 50 | |
|
51 | 51 | int itemIndex(0); |
|
52 | 52 | for (int category = 0; category < categoryCount; category++) { |
|
53 | 53 | qreal yPos = height + rangeY * m_domainMinY + geometry().topLeft().y(); |
|
54 |
for (int set=0; set < |
|
|
54 | for (int set=0; set < setCount; set++) { | |
|
55 | 55 | QBarSet* barSet = m_series->d_func()->barsetAt(set); |
|
56 | 56 | |
|
57 | 57 | qreal xPos = (barSet->at(category).x() - m_domainMinX) * scaleX + m_rect.left() - barWidth/2; |
General Comments 0
You need to be logged in to leave comments.
Login now