summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-21 14:36:03 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-05-21 14:50:52 +0200
commitaddc7e821fae471f2228af668791a19ee386fe30 (patch)
tree1a724a6a987a75bd55bac6fb750c4b080d0462a9
parent705c26a6553da5343405062c89a7c3b92aa4abd8 (diff)
we need to set text size in woorld coordinates
Change-Id: If77133080851a3b2d700ac54c9722f560e71f26e
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 5e21945e63dc..c2ec3713a899 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -42,6 +42,17 @@ GL3DBarChart::~GL3DBarChart()
mrWindow.setRenderer(NULL);
}
+namespace {
+
+const float TEXT_HEIGHT = 10.0f;
+
+float calculateTextWidth(const OUString& rText)
+{
+ return rText.getLength() * 5.0;
+}
+
+}
+
void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
ExplicitCategoriesProvider& rCatProvider)
{
@@ -88,13 +99,12 @@ 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());
- Size aTextSize = p->getSize();
glm::vec3 aTopLeft, aTopRight, aBottomRight;
- aTopLeft.x = aTextSize.getWidth() * -1.0;
+ aTopLeft.x = calculateTextWidth(aSeriesName) * -1.0;
aTopLeft.y = nYPos;
aTopRight.y = nYPos;
aBottomRight = aTopRight;
- aBottomRight.y += aTextSize.getHeight();
+ aBottomRight.y += TEXT_HEIGHT;
p->setPosition(aTopLeft, aTopRight, aBottomRight);
sal_Int32 nColor = aSeriesColor[nSeriesIndex % SAL_N_ELEMENTS(aSeriesColor)].GetColor();
@@ -164,13 +174,12 @@ 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());
- Size aTextSize = p->getSize();
aTopLeft.x = nXPos;
aTopLeft.y = nYPos;
aTopRight = aTopLeft;
- aTopRight.x += aTextSize.getWidth();
+ aTopRight.x += calculateTextWidth(aCats[i]);
aBottomRight = aTopRight;
- aBottomRight.y += aTextSize.getHeight();
+ aBottomRight.y += TEXT_HEIGHT;
p->setPosition(aTopLeft, aTopRight, aBottomRight);
}
}