summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-23 20:51:30 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-05-24 10:48:43 +0200
commitd9b9f50242ece39f9ecbbb24128ae3eff4c3319e (patch)
tree14badb7a25a701128d259f5d72a789f5684b6751
parente1f161e8c23a612172e3a3459e9fbef7fc7b0c89 (diff)
avoid the creation of empty text
Change-Id: If1be3f50ed4ceac40b513b341f411fc2d2533f7f
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx24
1 files changed, 15 insertions, 9 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 5b0c764601bb..cbec5c302a33 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -99,15 +99,18 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
DataSeriesHelper::getDataSeriesLabel(
rDataSeries.getModel(), mxChartType->getRoleOfSequenceForSeriesLabel());
- 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 = calculateTextWidth(aSeriesName) * -1.0;
- aTopLeft.y = nYPos;
- aTopRight.y = nYPos;
- aBottomRight = aTopRight;
- aBottomRight.y += TEXT_HEIGHT;
- p->setPosition(aTopLeft, aTopRight, aBottomRight);
+ if(!aSeriesName.isEmpty())
+ {
+ 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 = calculateTextWidth(aSeriesName) * -1.0;
+ aTopLeft.y = nYPos;
+ aTopRight.y = nYPos;
+ aBottomRight = aTopRight;
+ aBottomRight.y += TEXT_HEIGHT;
+ p->setPosition(aTopLeft, aTopRight, aBottomRight);
+ }
sal_Int32 nColor = aSeriesColor[nSeriesIndex % SAL_N_ELEMENTS(aSeriesColor)].GetColor();
for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex)
@@ -172,6 +175,9 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
uno::Sequence<OUString> aCats = rCatProvider.getSimpleCategories();
for (sal_Int32 i = 0; i < aCats.getLength(); ++i)
{
+ if(aCats[i].isEmpty())
+ continue;
+
float nXPos = i * (nBarSizeX + nBarDistanceX);
maShapes.push_back(new opengl3D::Text(mpRenderer.get(), aCats[i], nId++));