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)
Problem showing label value
cgourves
Hello,
I have a bar chart in which I want to show the label values when the values are greater than a given value.
I do it like this :
function beforeDrawDataPointLabel( dph, label, icsc )
{
importPackage(Packages.java.util.logging);
var caption=label.getCaption();
var form = new Packages.java.text.DecimalFormat("");
chaine = new String("") ;
chaine=caption.getValue();
temp = form.parse(chaine.replaceAll("\\s",""));
if( Math.floor(temp) > 500 ){
label.setVisible(true);
caption.setValue(temp);
caption.getFont().setSize(8.5);
label.setCaption(caption);
}
}
The problem is that for some reason, when the values are greater than 1000, this doesn't work.
I have logged the failing values, and they look like this : 1? 300. Any idea on how to solve this ?
Thanks
Find more posts tagged with
Comments
mwilliams
What is your BIRT version? I'll take a look.
cgourves
Hello,
I use version 4.2.0.v20120611
Thanks for taking a look.
Cyrille
mwilliams
I don't see the same issue, with your code, using the sample database. Can you set up a flat file of sample data, similar to yours and make a report that uses this data, so I can run it and see what you're seeing? Thanks.
cgourves
Hello,
I didn't manage to set up sample data, which makes me think it's more a MySQL problem. The reports are running on 2 servers, it's wrong only on one of them.
Anyway, this was an urgent problem, so I solved it making substrings to remove the faulty characters.
Really not clean, I know :-)
Thanks for your help, should I close this topic ?
Cyrille
cgourves
Hello,
I didn't manage to set up sample data, which makes me think it's more a MySQL problem. The reports are running on 2 servers, it's wrong only on one of them.
Anyway, this was an urgent problem, so I solved it making substrings to remove the faulty characters.
Really not clean, I know :-)
Thanks for your help, should I close this topic ?
Cyrille
mwilliams
What character was the issue? Was there a comma, in the value, if over 1000? If so, you could create your decimal format that you parse your string onto with the format "#,###". Then, create another decimal format with "#" and format the decimal value you get from parsing your string onto the first decimal format.
cgourves
Here's a value example I get : 1? 300. If I use substrings to remove "? " then it's OK. Really strange isn't it ?
mwilliams
It appears to be an encoding issue. What type of dataSet are you using? Also, can you show some sample data, what your data looks like in the preview data section of the dataSet?