Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Multi series for a bar chart
Multi series for a bar chart [message #144434] Thu, 16 March 2006 11:27 Go to next message
Eclipse UserFriend
Originally posted by: rebprotizer_2k3.hotmail.com

I want to create a bar chart which can compare sales turnover between many
years.
I recover my data from a JDBC data source and i don't know the count of
years so the count of series. My Y-axe is the total sales turnover by
month and the X-axe represents the month. In this way i would like to
compare per month the evolution of the sales turnover.

How can i do that ?

In other way, i would like to use the mapping system with my X-serie
(month), because I have the number of the month and not the name. But the
mapping system is not available for chart series. I have replaced the
expresison of my data row["Month"] by a switch case for incating the name
of the month. But the X-Serie of a char need to be a number or a date, so
i can to that.

Can you help for this thing please ?

Luc LABBE
Re: Multi series for a bar chart [message #144587 is a reply to message #144434] Thu, 16 March 2006 17:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vladperl.semanticprogrammer.org

>I want to create a bar chart which can compare sales turnover between many
>years.
> I recover my data from a JDBC data source and i don't know the count of
> years so the count of series. My Y-axe is the total sales turnover by
> month and the X-axe represents the month. In this way i would like to
> compare per month the evolution of the sales turnover.
>
> How can i do that ?
It seems I will need that kind of report myself.
Probably I will start on that even today.
So please keep me posted in case you will have some progress.
I have some ideas how to do that but I have to check it.

> In other way, i would like to use the mapping system with my X-serie
> (month), because I have the number of the month and not the name. But the
> mapping system is not available for chart series. I have replaced the
> expresison of my data row["Month"] by a switch case for incating the name
> of the month. But the X-Serie of a char need to be a number or a date, so
> i can to that.
>
> Can you help for this thing please ?

Inside initialize method of report do that:

var months = new Array(13);
months[1] = "Jan";

months[2] = "Feb";

months[3] = "Mar";

months[4] = "Apr";

months[5] = "May";

months[6] = "Jun";

months[7] = "Jul";

months[8] = "Aug";

months[9] = "Sep";

months[10] = "Oct";

months[11] = "Nov";

months[12] = "Dec";


reportContext.setPersistentGlobalVariable("months", months);

----------------------------------------------------------

After that click in layout mode on chart item and then switch to script tab.
There are plenty comment out chart script methods.

Uncomment function "beforeDrawAxisLabel" and put there code shown below.

function beforeDrawAxisLabel(axis, label, context) {

repCtx = context.getExternalContext();

objRef = repCtx.getObject();

months = objRef.getPersistentGlobalVariable("months");

label.getCaption().setValue(months[parseInt(label.getCaption ().getValue())]);

}
Re: Multi series for a bar chart [message #144952 is a reply to message #144587] Fri, 17 March 2006 09:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rebprotizer_2k3.hotmail.com

Thank you for your help, it's working as well. The script is not very
complicated, but i'm not used to use it yet.

For the multi series, i'm trying to make it working and if you succeed let
me a message please.
Re: Multi series for a bar chart [message #145688 is a reply to message #144952] Fri, 17 March 2006 20:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vladperl.semanticprogrammer.org

> For the multi series, i'm trying to make it working and if you succeed let
> me a message please.

Ok, I got it.

I will explain how I did it for my query:
SELECT Year(Visits.Date) As YearNumber, Month(Visits.Date) As MonthNumber,
Count(*) as VisitCount
FROM canarsie.medbase.dbo.Visits Visits
WHERE
Visits.Date between @FromDate and @ToDate
Group By Year(Visits.Date), Month(Visits.Date)
Order By Year(Visits.Date), Month(Visits.Date)

step1:
Select subtype: Stackedbar

step 2:
Y series: row["VisitCount"]
X Series: row["MonthNumber"]
Optional Y Series Grouping: row["YearNumber"]

step 3:
Y Series Labels:
section Values: Value Data, Value Series Name

"Value Series Name" show year on the label.

If you have additional questions let me know.

Good luck,
Vladimir
Re: Multi series for a bar chart [message #145878 is a reply to message #145688] Mon, 20 March 2006 08:54 Go to previous message
Eclipse UserFriend
Originally posted by: rebprotizer_2k3.hotmail.com

Thank you Vladimir, it's working.

In fact, my error was that i used the grouping system directly in the
chart properties and my query contained no year and month expression and
no groups. I did everything by computed columns.

Now i have integrated all in my query and it's working.

Godd luck for your continuation
Previous Topic:forward report url by servlet
Next Topic:Text Element - <br /> = double carriage return?
Goto Forum:
  


Current Time: Sun Oct 06 08:46:42 GMT 2024

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

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

Back to the top