// See if we have a defained color for this type, otherwise use
// the corresponding color from a linked line grapher, or if
// none, use white.
entry.text.setTextColor(getColorConfig(type, ConfigKeys.TextColor.name(),
_linkedGraph != null ? _linkedGraph.getColorConfig(type, LineGrapher.ConfigKeys.Color.name(),
new ColorRGBA(ColorRGBA.WHITE)) : new ColorRGBA(ColorRGBA.WHITE)));
// Update text placement.
final double labelHeight = entry.text.getHeight();
if (maxY < labelHeight) {
maxY = labelHeight;
}
entry.text.setTranslation(colSize * col, lastY, 0);
// Update line key as needed
if (_linkedGraph != null && _linkedGraph.hasConfig(type) && _linkedGraph instanceof TableLinkable) {
// add line keys
entry.lineKey = ((TableLinkable) _linkedGraph).updateLineKey(type, entry.lineKey);
if (entry.lineKey.getParent() != _graphRoot) {
_graphRoot.attachChild(entry.lineKey);
}
final ReadOnlyVector3 tLoc = entry.text.getTranslation();
entry.lineKey.setTranslation((float) (tLoc.getX() + entry.text.getWidth() + 15), (float) (tLoc
.getY() + (.5 * entry.text.getHeight())), 0);
}
// update column / row variables
col++;
col %= getColumns();
if (col == 0) {
lastY -= maxY;
maxY = 0;
}
}
for (final Iterator<StatType> i = _entries.keySet().iterator(); i.hasNext();) {
final LabelEntry entry = _entries.get(i.next());
// - Go through the entries list and remove any that were not
// visited.
if (!entry.visited) {
entry.text.removeFromParent();
if (entry.lineKey != null) {
entry.lineKey.removeFromParent();
}
i.remove();
}
}
}
_graphRoot.updateGeometricState(0, true);
final ColorRGBA bgColor = ColorRGBA.fetchTempInstance().set(_textureRenderer.getBackgroundColor());
if (_minimalBackground) {
bgColor.setAlpha(0);
_textureRenderer.setBackgroundColor(bgColor);
lastY -= 3;
if (col != 0) {
lastY -= maxY;
}
_bgQuad.resize(texWidth, texHeight - lastY);
_bgQuad.setRenderState(_defBlendState);
_bgQuad.setTranslation(texWidth / 2f, texHeight - (texHeight - lastY) / 2f, 0);
_bgQuad.updateGeometricState(0, true);
// - Draw our bg quad
_textureRenderer.render(_bgQuad, _texture, Renderer.BUFFER_COLOR_AND_DEPTH);
// - Now, draw to texture via a TextureRenderer
_textureRenderer.render(_graphRoot, _texture, Renderer.BUFFER_NONE);
} else {
bgColor.setAlpha(1);
_textureRenderer.setBackgroundColor(bgColor);
// - Now, draw to texture via a TextureRenderer
_textureRenderer.render(_graphRoot, _texture, Renderer.BUFFER_COLOR_AND_DEPTH);
}