Skip to main content



      Home
Home » Archived » BIRT » Bar Chart on Scripted Datasource pb
Bar Chart on Scripted Datasource pb [message #161665] Wed, 17 May 2006 04:15 Go to next message
Eclipse UserFriend
Hello,

I configured a scripted datasource and the associated datasets. My java
class is returning some series of splitted timestamps (year, month, day,
hour, minute) and sums to display.
As an example, let's say that I have 12 rows for the last hour splitted in
5 minutes parts (14h10/14h15, 14h15/14h20, ..., 15h05/15h10) which serve
as X series (row["HOUR"] + ":" + row["MINUTE"]) ; for each row a number is
given which would serve as Y series.

In the dataset preview, the rows are complete, but in the chart preview
(and data preview of the chart wizard) I only see the rows from
14h10/14h15 to 14h35/14h40 !
Why can't I see the whole dataset ? I have to say too that the Eclipse
preview isn't working. But that's probably because I could not find the
demo's classes repository in the viewer's directory to put my java class
(does anyone know anything about that ?)

More : I want to place a marker on the X axis to sho the beginning of the
hour (between 14h55/15h00 and 15h00/15h05) ; as it can be anywhere in the
chart and that any time lap could be considered, I wonder which value I
must give to position it.
More again : would it be possible to place the X labels between the bars
rather than below and centered on them ?

NB : I'm using BIRT RC1
Thanks for answering, Thomas.
Re: Bar Chart on Scripted Datasource pb [message #161669 is a reply to message #161665] Wed, 17 May 2006 04:27 Go to previous messageGo to next message
Eclipse UserFriend
Once more : can I hide the color legend on right of the bar chart, as I
only use one set of series ?

Thanks,
Re: Bar Chart on Scripted Datasource pb [message #161672 is a reply to message #161665] Wed, 17 May 2006 04:33 Go to previous messageGo to next message
Eclipse UserFriend
Hi Thoma,s

The Chart Preview shows only a limited number of rows for performance
reasons. However you can modify that setting in Eclipse preferences (Report
Design->Chart->Max row number of data preview)

I don't understand your marker question, did you try the Markers dialog in
the chart builder. What's wrong with it?

It's not very clear why you would want the labels between the bars. If so,
one label would me missing on the right or left. You can try adding some
left (or right) inset in the Text Format dialog of the X Axis, but I don't
think it would give you a satisfying result though.

Thanks,

David

"Thomas Escolan" <thomas_escolan@yahoo.fr> wrote in message
news:b9c0894c148f6696f5a9c451584d6cae$1@www.eclipse.org...
> Hello,
>
> I configured a scripted datasource and the associated datasets. My java
> class is returning some series of splitted timestamps (year, month, day,
> hour, minute) and sums to display.
> As an example, let's say that I have 12 rows for the last hour splitted in
> 5 minutes parts (14h10/14h15, 14h15/14h20, ..., 15h05/15h10) which serve
> as X series (row["HOUR"] + ":" + row["MINUTE"]) ; for each row a number is
> given which would serve as Y series.
>
> In the dataset preview, the rows are complete, but in the chart preview
> (and data preview of the chart wizard) I only see the rows from
> 14h10/14h15 to 14h35/14h40 !
> Why can't I see the whole dataset ? I have to say too that the Eclipse
> preview isn't working. But that's probably because I could not find the
> demo's classes repository in the viewer's directory to put my java class
> (does anyone know anything about that ?)
>
> More : I want to place a marker on the X axis to sho the beginning of the
> hour (between 14h55/15h00 and 15h00/15h05) ; as it can be anywhere in the
> chart and that any time lap could be considered, I wonder which value I
> must give to position it.
> More again : would it be possible to place the X labels between the bars
> rather than below and centered on them ?
>
> NB : I'm using BIRT RC1
> Thanks for answering, Thomas.
>
Re: Bar Chart on Scripted Datasource pb [message #161764 is a reply to message #161669] Wed, 17 May 2006 04:38 Go to previous messageGo to next message
Eclipse UserFriend
Hi Thomas,

You can hide the legend altogether. Go to Legend, click on Layout and
uncheck visible. I know it's hard to find, you can file a bug to have the
visible checkbox in the builder itself rather than in the layout popup.

thanks,

David

"Thomas Escolan" <thomas_escolan@yahoo.fr> wrote in message
news:e06bdaa1fb411e5956e21069d09546b3$1@www.eclipse.org...
> Once more : can I hide the color legend on right of the bar chart, as I
> only use one set of series ?
>
> Thanks,
>
Re: Bar Chart on Scripted Datasource pb [message #161771 is a reply to message #161672] Wed, 17 May 2006 04:53 Go to previous messageGo to next message
Eclipse UserFriend
Thank you, David, for your help,

I did try the markers functionality but I guess this specially applies to
numeric values. As I "said", My X series are labelled with texts ("14:10",
"14:15", etc.) And the marker line is always at the beginning of the axis
whjatever I tried on its properties.
My series are supposed to be whatever a "last passed hour" would mean
(from 23:45 to 01:40, from 17:00 to 17:55 and so on). So the perfect
solution would be to set the marker's value to row["MINUTE"] = 0... but I
could'nt succeed in this direction.

Thomas.
Re: Bar Chart on Scripted Datasource pb [message #161803 is a reply to message #161771] Wed, 17 May 2006 06:27 Go to previous messageGo to next message
Eclipse UserFriend
Saying it differently : how to make "string series" markers ??
Re: Bar Chart on Scripted Datasource pb [message #161938 is a reply to message #161803] Wed, 17 May 2006 11:46 Go to previous messageGo to next message
Eclipse UserFriend
Or would it be possible to dynamically add a marker within the chart's
scripts ?
For example : If I get an X label like "??:00", let's put a marker before !
Re: Bar Chart on Scripted Datasource pb [message #161953 is a reply to message #161665] Wed, 17 May 2006 11:49 Go to previous messageGo to next message
Eclipse UserFriend
To anyone interested : the right way to deploy a class for a scripted
datasoyurce is to put it in a JAR file (right click on the file in
Eclipse, and so on) and THEN put this file in the WEB-INF/lib directory of
the viewer directory in Eclipse's plugins directory.

How can it be SO difficult to get the right infos on BIRT's site ? I hope
the coming books will help a bit.

Thomas.
Re: Bar Chart on Scripted Datasource pb [message #161999 is a reply to message #161771] Wed, 17 May 2006 13:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi Thomas,

The X Axis marker will use the index of the category series as the value. So
if you use 3, it should plot it at the 3rd item. There is no String value
support, you can file an enhancement for that.

Hope this helps,

David

"Thomas Escolan" <thomas_escolan@yahoo.fr> wrote in message
news:b206163e7d4afedd27ac5b7aa90ddcbd$1@www.eclipse.org...
> Thank you, David, for your help,
>
> I did try the markers functionality but I guess this specially applies to
> numeric values. As I "said", My X series are labelled with texts ("14:10",
> "14:15", etc.) And the marker line is always at the beginning of the axis
> whjatever I tried on its properties.
> My series are supposed to be whatever a "last passed hour" would mean
> (from 23:45 to 01:40, from 17:00 to 17:55 and so on). So the perfect
> solution would be to set the marker's value to row["MINUTE"] = 0... but I
> could'nt succeed in this direction.
>
> Thomas.
>
Re: Bar Chart on Scripted Datasource pb [message #162014 is a reply to message #161999] Wed, 17 May 2006 13:54 Go to previous messageGo to next message
Eclipse UserFriend
OK,

So, it is possible to get the graph's markers dynamically (found that :
http://marklorenz.blogspot.com/2006/02/birt-tips-for-java-de velopers.html)

BUT (I know : AGAIN ;-) :
1/ is it possible to change the markers index according to my value series
and that this marker then takes ist place in the chart ? How ?
2/ What would be the best place to do that (the afterDataSetFilled
function ?)

Could you give a coding example for the first point, please ?
Thomas.
Re: Bar Chart on Scripted Datasource pb [message #162022 is a reply to message #162014] Wed, 17 May 2006 14:18 Go to previous messageGo to next message
Eclipse UserFriend
I tried the following :

function afterDataSetFilled(series, dataSet, context) {
java.lang.System.out.println("afterDataSetFilled...");
var index;
var values = dataSet.getValues();
for (index = 0; index < values.length; index++) {
var value = java.lang.String.valueOf(values[index]);
if (value.endsWith(":00")) break;
}

var chart = context.getChartInstance();
var marker =
chart.getAxes().get(0).getAssociatedAxes().get(0).getMarkerL ines().get(0);
java.lang.System.out.println("Marker : " + marker.getValue().getValue());
marker.getValue().setValue(index); // correct ?
}

But got this in log file :
17 mai 2006 19:14:47 org.eclipse.birt.chart.datafeed.ResultSetWrapper setup
GRAVE: Unable to determine data types from resultset

Is that why the afterDataSetFilled method is never called ?
What can I do ?

Thanks for kindly helping, Thomas.
Re: Bar Chart on Scripted Datasource pb [message #162107 is a reply to message #161953] Wed, 17 May 2006 21:30 Go to previous messageGo to next message
Eclipse UserFriend
Thomas,

Thanks for the feedback. You can deploy a class the way you describe using
Eclipse. You should also be able to create a classes directory for quick
testing.
We have some videos for a scripted datasource but they need updating. I
will try to get a section added the report scripting page. You can also
write these events in Java, which should be described on the Report
Scripting page under Data Source Events. Note that classes used this way
need to be placed in the scriptlib directory.

Jason


"Thomas Escolan" <thomas_escolan@yahoo.fr> wrote in message
news:9872a31bb951262fb04e4c2e83f85a07$1@www.eclipse.org...
> To anyone interested : the right way to deploy a class for a scripted
> datasoyurce is to put it in a JAR file (right click on the file in
> Eclipse, and so on) and THEN put this file in the WEB-INF/lib directory of
> the viewer directory in Eclipse's plugins directory.
>
> How can it be SO difficult to get the right infos on BIRT's site ? I hope
> the coming books will help a bit.
>
> Thomas.
>
Re: Bar Chart on Scripted Datasource pb [message #162153 is a reply to message #161953] Thu, 18 May 2006 03:37 Go to previous messageGo to next message
Eclipse UserFriend
I just forgot one thing : don't forget to RESTART ECLIPSE in order to get
your library taken into account.
Re: Bar Chart on Scripted Datasource pb [message #162161 is a reply to message #162022] Thu, 18 May 2006 03:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi all,

After a good sleeping night, I wondered if I shouldn't have "rewind" the
dataset or something... As the dataset's getValues method returns the
current line of the differents series (see my beforeDrawDataPoint
example), it sounds a bit strange to roll it over like that...

But nothing seems to match with this needs in the API doc I got. What do I
do, now ?
If only I hadn't that Exception : the first logging line is not showing up
in my console ; I'm not able to scan datas.

Any idea, anyone, please ?
Re: Bar Chart on Scripted Datasource pb [message #162193 is a reply to message #162022] Thu, 18 May 2006 04:24 Go to previous messageGo to next message
Eclipse UserFriend
Hoping that markerlines are drown after the bars, I put my code into the
method, and saw that I could not find the markers anyway :

var chart = context.getChartInstance();
java.lang.System.out.println("Markers : " +
chart.getAxes().get(0).getAssociatedAxes().get(0).getMarkerL ines().size());
=> returns 0

I also found out that I only got one axis which seems to be the value (Y)
axis, and one associated axis ?! How do I get the X axis ??

Thanks in advance, Thomas.
Re: Bar Chart on Scripted Datasource pb [message #162217 is a reply to message #162022] Thu, 18 May 2006 04:45 Go to previous message
Eclipse UserFriend
SO,

This is what finally worked fine :

function beforeDrawDataPoint(dataPointHints, fill, context) {
if (dataPointHints.getBaseValue().endsWith(":00")) {
var chart = context.getChartInstance();
var marker = chart.getAxes().get(0).getMarkerLines().get(0);
marker.getValue().setValue(dataPointHints.getIndex());
}
}

To anyone interested,
Previous Topic:On tomcat4
Next Topic:Streamed XML source
Goto Forum:
  


Current Time: Fri Jul 18 16:44:10 EDT 2025

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

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

Back to the top