Kaydet (Commit) 10c14f13 authored tarafından Markus Mohrhard's avatar Markus Mohrhard Kaydeden (comit) Markus Mohrhard

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
üst e41c33b3
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment