summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-24 13:05:12 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-05-24 13:07:46 +0200
commit10c14f13a7bc314ccff41c60c7e1d6fdaae19450 (patch)
tree9d32ba34dacc9356e86f5744667958f577218c14
parente41c33b376d8b5776e400979eb8544db596c5bbe (diff)
improve the bar and text positioning
Keep a bit of space to the border and move the text a bit away from the chart area. This makes it look much better in my opinion. Change-Id: I1eee505e8361cbc0e3ca859d74a96af880451198
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index efd27af848c3..6d0b6d780e1c 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -87,7 +87,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
for (boost::ptr_vector<VDataSeries>::const_iterator itr = rDataSeriesContainer.begin(),
itrEnd = rDataSeriesContainer.end(); itr != itrEnd; ++itr)
{
- nYPos = nSeriesIndex * (nBarSizeY + nBarDistanceY);
+ nYPos = nSeriesIndex * (nBarSizeY + nBarDistanceY) + nBarDistanceY;
const VDataSeries& rDataSeries = *itr;
sal_Int32 nPointCount = rDataSeries.getTotalPointCount();
@@ -104,10 +104,10 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
maShapes.push_back(new opengl3D::Text(mpRenderer.get(), aSeriesName, nId++));
opengl3D::Text* p = static_cast<opengl3D::Text*>(&maShapes.back());
glm::vec3 aTopLeft, aTopRight, aBottomRight;
- aTopLeft.x = 0.0f;
- aTopLeft.y = nYPos;
- aTopRight.x = calculateTextWidth(aSeriesName) * -1.0;
- aTopRight.y = nYPos;
+ aTopLeft.x = -nBarDistanceY;
+ aTopLeft.y = nYPos + 0.25 * nBarSizeY;
+ aTopRight.x = calculateTextWidth(aSeriesName) * -1.0 - nBarDistanceY;
+ aTopRight.y = nYPos + 0.25 * nBarSizeY;
aBottomRight = aTopRight;
aBottomRight.y += TEXT_HEIGHT;
p->setPosition(aTopLeft, aTopRight, aBottomRight);
@@ -122,7 +122,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
}
float nVal = rDataSeries.getYValue(nIndex);
- float nXPos = nIndex * (nBarSizeX + nBarDistanceX);
+ float nXPos = nIndex * (nBarSizeX + nBarDistanceX) + nBarDistanceX;
glm::mat4 aScaleMatrix = glm::scale(nBarSizeX, nBarSizeY, nVal);
@@ -165,7 +165,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
opengl3D::Rectangle* pRect = static_cast<opengl3D::Rectangle*>(&maShapes.back());
glm::vec3 aTopLeft;
glm::vec3 aTopRight = aTopLeft;
- aTopRight.x = nXEnd;
+ aTopRight.x = nXEnd + 2 * nBarDistanceX;
glm::vec3 aBottomRight = aTopRight;
aBottomRight.y = nYPos;
pRect->setPosition(aTopLeft, aTopRight, aBottomRight);
@@ -184,11 +184,11 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
maShapes.push_back(new opengl3D::Text(mpRenderer.get(), aCats[i], nId++));
opengl3D::Text* p = static_cast<opengl3D::Text*>(&maShapes.back());
aTopLeft.x = nXPos + TEXT_HEIGHT;
- aTopLeft.y = nYPos + calculateTextWidth(aCats[i]);
+ aTopLeft.y = nYPos + calculateTextWidth(aCats[i]) + 0.5 * nBarDistanceY;
aTopRight = aTopLeft;
- aTopRight.y = nYPos;
+ aTopRight.y = nYPos + 0.5* nBarDistanceY;
aBottomRight.x = nXPos;
- aBottomRight.y = nYPos;
+ aBottomRight.y = nYPos + 0.5 * nBarDistanceY;
p->setPosition(aTopLeft, aTopRight, aBottomRight);
}
}