Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Long series labels
Long series labels [message #1177319] Fri, 08 November 2013 22:58 Go to next message
Joe Smith is currently offline Joe SmithFriend
Messages: 6
Registered: October 2013
Junior Member
I have a pie chart. When a series label is really long (e.g. 121 characters), I would like to either have the label split into multiple lines OR have a "..." appended to the end with a tooltip that shows the full label string. I tried using:

PieSeries sePie = (PieSeries) PieSeriesImpl.create();
sePie.getLabel().getCaption().getFont().setWordWrap(true);

This did not wrap.

Any ideas?

Thanks!
Re: Long series labels [message #1195151 is a reply to message #1177319] Mon, 18 November 2013 21:50 Go to previous message
Kristopher Clark is currently offline Kristopher ClarkFriend
Messages: 130
Registered: January 2013
Senior Member
Here's one way to split the labels into new lines
function addLines(lbl) {
  var str = "" + lbl,
      words = str.split(/(\s+)/);
  for (var i=0,n=0; i<words.length; ++i) {
      n += words[i].length;
      if (n >= 10) {
          words[i] = "\n" + words[i];
          n = 0;
      }
  }
  str = words.join("");
  
  return str;
}
function beforeDrawDataPointLabel( dph, label, icsc )
{
  var newLabel = addLines(label.getCaption().getValue())
  label.getCaption().setValue(newLabel);
}
Previous Topic:Individual Image DPI
Next Topic:Suppress a Grid
Goto Forum:
  


Current Time: Tue Apr 23 16:40:45 GMT 2024

Powered by FUDForum. Page generated in 0.02693 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top