From dacdfd6d84abd8a36c5687bbd09727bce7e66675 2012-06-01 08:10:47 From: sauimone Date: 2012-06-01 08:10:47 Subject: [PATCH] barseries bar scaling change --- diff --git a/src/barchart/barchartitem.cpp b/src/barchart/barchartitem.cpp index f12cf02..13e85d5 100644 --- a/src/barchart/barchartitem.cpp +++ b/src/barchart/barchartitem.cpp @@ -111,8 +111,7 @@ QVector BarChartItem::calculateLayout() qreal rangeX = m_domainMaxX - m_domainMinX; qreal scaleY = (height / rangeY); qreal scaleX = (width / rangeX); - qreal categoryWidth = width / categoryCount; - qreal barWidth = categoryWidth - categoryWidth * m_series->d_func()->barMargin(); + qreal barWidth = scaleX - scaleX * m_series->d_func()->barMargin(); int itemIndex(0); for (int category = 0; category < categoryCount; category++) { diff --git a/src/barchart/groupedbarchartitem.cpp b/src/barchart/groupedbarchartitem.cpp index 1c438e9..e636502 100644 --- a/src/barchart/groupedbarchartitem.cpp +++ b/src/barchart/groupedbarchartitem.cpp @@ -47,8 +47,7 @@ QVector GroupedBarChartItem::calculateLayout() qreal rangeX = m_domainMaxX - m_domainMinX; qreal scaleY = (height / rangeY); qreal scaleX = (width / rangeX); - qreal categoryWidth = width / categoryCount; - qreal barWidth = categoryWidth / setCount - (categoryWidth / setCount) * m_series->d_func()->barMargin(); + qreal barWidth = scaleX / setCount - (scaleX / setCount) * m_series->d_func()->barMargin(); int itemIndex(0); for (int category = 0; category < categoryCount; category++) { diff --git a/src/barchart/percentbarchartitem.cpp b/src/barchart/percentbarchartitem.cpp index a416c46..72fc7be 100644 --- a/src/barchart/percentbarchartitem.cpp +++ b/src/barchart/percentbarchartitem.cpp @@ -47,8 +47,7 @@ QVector PercentBarChartItem::calculateLayout() qreal rangeX = m_domainMaxX - m_domainMinX; qreal scaleY = (height / rangeY); qreal scaleX = (width / rangeX); - qreal categoryWidth = width / categoryCount; - qreal barWidth = categoryWidth - categoryWidth * m_series->d_func()->barMargin(); + qreal barWidth = scaleX - scaleX * m_series->d_func()->barMargin(); int itemIndex(0); for (int category = 0; category < categoryCount; category++) { diff --git a/src/barchart/stackedbarchartitem.cpp b/src/barchart/stackedbarchartitem.cpp index efd5222..0fa5023 100644 --- a/src/barchart/stackedbarchartitem.cpp +++ b/src/barchart/stackedbarchartitem.cpp @@ -46,8 +46,7 @@ QVector StackedBarChartItem::calculateLayout() qreal rangeX = m_domainMaxX - m_domainMinX; qreal scaleY = (height / rangeY); qreal scaleX = (width / rangeX); - qreal categoryWidth = width / categoryCount; - qreal barWidth = categoryWidth - categoryWidth * m_series->d_func()->barMargin(); + qreal barWidth = scaleX - scaleX * m_series->d_func()->barMargin(); int itemIndex(0); for (int category = 0; category < categoryCount; category++) {