Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
A chart's title label will not resize
AlexAD
Hello.<br />
<br />
I am trying to change a chart's title text by appending another string. It seems that a label won't resize as I see "..." at the end of the title. <br />
Here is my code:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function beforeRendering(gcs, icsc) {
var timeCycleOption = icsc.getExternalContext().getScriptable().getParameterValue("TimeCycleOption").value;
var titleStr = icsc.getChartInstance().getTitle().getLabel().getCaption().getValue();
icsc.getChartInstance().getTitle().getLabel().getCaption().setValue(titleStr + " on " + timeCycleOption);
}
</pre>
<br />
Could you please help?<br />
<br />
Thank you in advance.
Find more posts tagged with
Comments
AlexAD
I tried this approach and now the label resizes<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage(Packages.org.eclipse.birt.chart.model.attribute.impl);
importPackage(Packages.org.eclipse.birt.chart.model.component.impl);
var timeCycleOption = icsc.getExternalContext().getScriptable().getParameterValue("TimeCycleOption");
var titleTextPrev = icsc.getChartInstance().getTitle().getLabel().getCaption();
titleText = TextImpl.createDefault(titleTextPrev.getValue() + " on " + timeCycleOption);
titleText.setColor(titleTextPrev.getColor());
titleText.setFont(titleTextPrev.getFont());
var titleLabel = LabelImpl.create();
titleLabel.setCaption(titleText);
icsc.getChartInstance().getTitle().setLabel(titleLabel);
</pre>
<br />
I just thought that if I changed the text of a label before rendering, the label would resize automatically.
mwilliams
Great! Glad you got it working! Let us know whenever you have issues!