Home » Archived » BIRT » After update to 2.0 still problems with color
After update to 2.0 still problems with color [message #89092] |
Wed, 09 November 2005 05:03  |
Eclipse User |
|
|
|
Hello,
I now updated to BIRT version 2.0M2. But I still have this error of
scripting. If I use following code
function beforeDrawDataPoint(dataPointHints, label)
{
clr = label.getCaption().getColor();
clr.set(255, 0, 0);
}
in the scrips area of the report builder and run the report, the labels
above all bars keep black.
It drives me crazy!
Any help?
|
|
| |
Finally I found out, whats the problem Yeah!!! [message #89599 is a reply to message #89092] |
Thu, 10 November 2005 06:26   |
Eclipse User |
|
|
|
Hello,
It took me two days to find out why the function:
function beforeDrawDataPoint(dataPointHints, label)
{
label.getCaption().getColor().set(255, 0, 0);
}
in the Scripts area does not work. The color of the label above each bar
kept black instead of red, what I programmed.
I found out that there is a difference on HOW you create your report.
If you go to File->New->Report
Then you have the options:
1. Click Next (e.g. to choose a template report)
2. Click Finish to create a blank report
If you choose the 1st option (Next) and choose a template (MUST INCLUDE A
CHART!!!) then the script works, so the color of the label above the bars
turns to red.
If you use the 2nd option (Finish) and drag a chart from the Palette to the
blank report, then the script is not executed, even if its was added under
the Scripts area!!!
So now the reason:
If you look under the XML Source of the report, some tags about the label
are missing, it is within the section:
<Axes>
<AssociatedAxes>
<SeriesDefinitions>
<Series xsi:type="type:BarSeries">
<Label>
<Caption>
<Value><undefined></Value> <!-- Here are <Font>...</Font>
and <Color>...</Color> missing !!! Only available using a template chart
</Caption>
To solve this problem one can do following:
I you go into the report builder Attributes->Y-Series->Lables and choose a
color (e.g. blue) of the font (by clicking the ... button) then the
<Font>...</Font> and <Color>...</Color> are added to the XML source, and
then the Script function works!
So hope that helps other who will have this or similar problem in the
future!
Best regards,
Mr. Burns
|
|
|
Re: Finally I found out, whats the problem Yeah!!! [message #89630 is a reply to message #89599] |
Thu, 10 November 2005 09:33   |
Eclipse User |
|
|
|
Hi,
Thanks for the investigation of that issue. I think what happens is that the
generated code for the chart has been simplified in the new version, to
support the styles. So the default colors, font... are not populated in the
chart model. The templates use old chart designs from v1.0.1, it's something
we need to update for 2.0 to be consistent. I believe another way to fix
the problem is to set a color manually with the builder, so the attribute
exists.
So what happened in the script is that the getColor() return null. To make
it work you would have to create the Color instance and attach it to the
label with setColor(). I guess it sums up to a debugging issue, since we
don't have a JavaScript debugger that could have immediately shown the
problem.
Thanks,
David
"Mr. Burns" <Mr._Burns@web.de> wrote in message
news:dkvap2$r85$1@news.eclipse.org...
> Hello,
>
> It took me two days to find out why the function:
>
> function beforeDrawDataPoint(dataPointHints, label)
> {
> label.getCaption().getColor().set(255, 0, 0);
> }
>
> in the Scripts area does not work. The color of the label above each bar
> kept black instead of red, what I programmed.
>
> I found out that there is a difference on HOW you create your report.
>
> If you go to File->New->Report
>
> Then you have the options:
>
> 1. Click Next (e.g. to choose a template report)
> 2. Click Finish to create a blank report
>
> If you choose the 1st option (Next) and choose a template (MUST INCLUDE A
> CHART!!!) then the script works, so the color of the label above the bars
> turns to red.
>
> If you use the 2nd option (Finish) and drag a chart from the Palette to
> the blank report, then the script is not executed, even if its was added
> under the Scripts area!!!
>
> So now the reason:
>
> If you look under the XML Source of the report, some tags about the label
> are missing, it is within the section:
>
> <Axes>
> <AssociatedAxes>
> <SeriesDefinitions>
> <Series xsi:type="type:BarSeries">
> <Label>
> <Caption>
> <Value><undefined></Value> <!-- Here are <Font>...</Font>
> and <Color>...</Color> missing !!! Only available using a template chart
> </Caption>
>
> To solve this problem one can do following:
>
> I you go into the report builder Attributes->Y-Series->Lables and choose a
> color (e.g. blue) of the font (by clicking the ... button) then the
> <Font>...</Font> and <Color>...</Color> are added to the XML source, and
> then the Script function works!
>
> So hope that helps other who will have this or similar problem in the
> future!
>
> Best regards,
>
> Mr. Burns
>
>
>
|
|
|
Re: Finally I found out, whats the problem Yeah!!! [message #89704 is a reply to message #89630] |
Thu, 10 November 2005 10:06  |
Eclipse User |
|
|
|
Hello David,
you're welcome!
Yes indeed, I write this in my last message, if you use the chart builder
and modify the color, than the atribute existst and then the code works.
But really hard to find out if you are an beginner, post into the
newsgroups, and no real help came out.
Ok finally I figured out the problem, and thats it, what a OpenSource tool
lives from, or not?
By the way there is another strange thing, using the scripting functions, I
posted it as bug under:
http://bugs.eclipse.org/bugs/show_bug.cgi?id=115801
May you can have a look, and give me some help on it?
And, some bothering issue, regarding the scripting using the chart builder.
1. Add a simple function inside the Scripts area of the chart builder e.g.:
function beforeDrawDataPoint(dataPointHints, label)
{
// Make Labels unvisible
label.setVisible(false);
}
2. Saves the report
3. Closes Eclipse
4. Restart Eclipse
5. Open same report
6. Look into the chart builders Script area
Then you see that the function has changed, every line of the JavaScript is
followed by an empty line:
function beforeDrawDataPoint(dataPointHints, label)
{
// Make Labels unvisible
label.setVisible(false);
}
really bothering, you have to delete every 2nd, empty line manually,
The function appears also with empty lines in the reports XML file
(*.rptdesign)
Any idea whats wrong?
Thanks,
....Mr. Burns
|
|
|
Goto Forum:
Current Time: Wed Jul 23 09:28:51 EDT 2025
Powered by FUDForum. Page generated in 0.32037 seconds
|