Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to Edit Legend Position ?
Elkaras
I tried by chart options .. on Edit Chart windows in Report Design.
But do not know how to fix it..
I posted 2 photos ..looked different a little bit at Legends.
it makes your easy to understand what I want ...and can cover my low English skills
Find more posts tagged with
Comments
mwilliams
What is your BIRT version? Is there any way you can create a report with the sample database that shows your issue with the legend, so I can see and test?
Elkaras
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="113842" data-time="1359773909" data-date="01 February 2013 - 07:58 PM"><p>
What is your BIRT version? Is there any way you can create a report with the sample database that shows your issue with the legend, so I can see and test?<br /></p></blockquote>
Hi ~!! <br />
<br />
I'm using Birt version is 3.7.2 in Indigo.<br />
<br />
And Here's a sample report design..<br />
<br />
only use data by scripted ..by ArrayList.<br />
<br />
but you can see the chart on preview tap.<br />
<br />
plz.. help me ^^..
mwilliams
Try this script in your chart. You'll have to test it to make sure it works with different amounts of legend items, though. I just tested in your attached report.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function beforeDrawLegendItem( lerh, bounds, icsc )
{
lerh.getLabel().getInsets().setBottom(5);
lerh.getLabel().getInsets().setLeft(-5);
}
</pre>
Elkaras
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="113909" data-time="1360017285" data-date="04 February 2013 - 03:34 PM"><p>
Try this script in your chart. You'll have to test it to make sure it works with different amounts of legend items, though. I just tested in your attached report.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function beforeDrawLegendItem( lerh, bounds, icsc )
{
lerh.getLabel().getInsets().setBottom(5);
lerh.getLabel().getInsets().setLeft(-5);
}
</pre></p></blockquote>
<br />
OMG! it works perfect ! <br />
<br />
thank you so much ..<br />
<br />
How do you know all about birt ? you're so ...good..<br />
<br />
I see your comments on almost topics ..wow ..<br />
<br />
<br />
ah .. And ..<br />
<br />
..here's one more question ..<br />
<br />
you see in the sample ... the legend items has diffent width, along the legend character length ..<br />
<br />
how to set width value all the same ? <br />
<br />
* ...I'd appreciate to share your knowledge ^^ ...<br />
<br />
** ah.. if you have good web sites for learning Birt ...let me know ..TT...
mwilliams
You're welcome! I've learned most of what I know about BIRT just by working with it. For the legend length issue, are you wanting to limit the legend labels to a certain number of characters? As far as a good site to learn BIRT, hopefully this site helps you out with that.
Here is a link to the getting started guide, on the site:
http://www.birt-exchange.org/org/wiki/index.php?title=Getting_Started_Guides
This will be extensively upgraded within the coming year, as well. The forums are a great place to search for answers to questions you have. If after a quick search, you don't find the solution, ask a question. There is also a searchable devShare that has many examples in it on how to do many different things, with BIRT. You can also find some direct contact information for me, in my signature. If you ask a question and have trouble getting a solution, go ahead and let me know on one of those avenues.
Elkaras
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="114040" data-time="1360285407" data-date="07 February 2013 - 06:03 PM"><p>
You're welcome! I've learned most of what I know about BIRT just by working with it. For the legend length issue, are you wanting to limit the legend labels to a certain number of characters? As far as a good site to learn BIRT, hopefully this site helps you out with that.<br />
<br />
Here is a link to the getting started guide, on the site: <a class='bbc_url' href='
http://www.birt-exchange.org/org/wiki/index.php?title=Getting_Started_Guides'>http://www.birt-exchange.org/org/wiki/index.php?title=Getting_Started_Guides</a><br
/>
<br />
This will be extensively upgraded within the coming year, as well. The forums are a great place to search for answers to questions you have. If after a quick search, you don't find the solution, ask a question. There is also a searchable devShare that has many examples in it on how to do many different things, with BIRT. You can also find some direct contact information for me, in my signature. If you ask a question and have trouble getting a solution, go ahead and let me know on one of those avenues.
<br /></p></blockquote>
<br />
ah .. I just want to set the static size of legend element.<br />
<br />
for example.... all the legend items has width 100px height 20px only ...<br />
<br />
it doesn't matter how many charater legend title has .. ^^;
mwilliams
Ok, so you want all of the entries in the legend to have the same width, regardless of characters? If they don't have the characters to fill the specified width, there is blank space. If they have too many characters, they are cut off? Am I understanding, now?
Elkaras
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="114219" data-time="1360901425" data-date="14 February 2013 - 09:10 PM"><p>
Ok, so you want all of the entries in the legend to have the same width, regardless of characters? If they don't have the characters to fill the specified width, there is blank space. If they have too many characters, they are cut off? Am I understanding, now?<br /></p></blockquote>
Oh,,, I'm so sorry to reply late..<br />
<br />
you're perfectly right ~!
mwilliams
You might be able to achieve what you're wanting by creating a new binding that cuts off the value after a certain number of characters and pads the ones shorter than your desired length, with spaces.
Elkaras
Ah, ha !
you mean.. that when set label title values.. check length of characters and put some spaces ...before drawing legend item ..?!
Am I right ?
I will try
Elkaras
I've tried but ..it dosen't work ..for me ..<br />
<br />
in beforeDrawLegendItem function, I put this.<br />
<br />
lerh.getLabel().getCaption().setValue("123123123");<br />
<br />
texts has changed ...but ..<br />
<br />
the length of label item ...has kept ..like this ..<br />
<br />
I attacted pics
){<br />
item_cd = i;<br />
lerh.getFill().set(graphColor[item_cd][0],graphColor[item_cd][1],graphColor[item_cd][2]);<br />
var cntLength = lerh.getLabel().getCaption().getValue().length();<br />
Packages.java.lang.System.out.println("###getValue's Lenght :::: " + cntLength);<br />
if(cntLength < 12){<br />
var tmpCaption = legendVal
;<br />
for(var j = cntLength; j < 12; j ++){<br />
tmpCaption = '1' + tmpCaption;<br />
}<br />
lerh.getLabel().getCaption().setValue("123123123");<br />
Packages.java.lang.System.out.println("###running Set Value :::: " + tmpCaption);<br />
}<br />
break;<br />
}<br />
}<br />
lerh.getLabel().getInsets().setBottom(5);<br />
lerh.getLabel().getInsets().setLeft(-5);<br />
}<br />
<br />
and I'd like to make like this one <br />
mwilliams
If you change your legend orientation to "Vertical" rather than horizontal, this should fix that. To find this, open the chart editor, go to the legend section, then click on the layout button. There, you'll see the orientation setting.
Elkaras
mwilliams
You probably need to lower the percentage of the chart that you allow to be the legend, so that the entries will wrap. Maybe I'm misunderstanding your issue with this. Let me know.
Elkaras
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="114943" data-time="1362892460" data-date="09 March 2013 - 10:14 PM"><p>
You probably need to lower the percentage of the chart that you allow to be the legend, so that the entries will wrap. Maybe I'm misunderstanding your issue with this. Let me know.<br /></p></blockquote>
<br />
Oops, I think, I made you misuderstood ...^^ ;<br />
<br />
because of my English skills ..:)<br />
<br />
here's one more picture ...for I want to try ^^
mwilliams
This may not be exact, but it's not too far off. There might be a better way to do this, but this is fairly simple. In the dataSet, I create a computed column to find the max length of the category field. In the chart's category expression, I pad an entry not meeting this length with underscores '_'. This helps set each category value to a similar width so the legend has equal spacing. Then, in the chart's script, these underscores are replaced with "". Hope this helps you get what you're wanting.
If I'm still off on what you're trying to do, please attach a sample report or modify the attached report to show your issue. Thanks.