Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

One Bar Chart with several BY fields

Status
Not open for further replies.

ozi2

Programmer
Sep 1, 2002
40
0
0
IL
Hi,

I would like to have a bar chart that sums
one field (y axis) but for 2 fields in the x axis.
For example:

GRAPH FILE MAN_RES
HEADING
" TEST "
SUM TOTAL_EMPLOYEE
BY DEPARTMENT_CODE
BY YYEAR
WHERE (YYEAR IN (2003,2002))
AND DEPARTMENT_CODE IN (19,20,21,22)
ON GRAPH SET GRAPHSTYLE *
setLegendDisplay(true);
setLegendMarkerPosition(0);
setMarkerDisplay(true);
setConnectLineMarkers(false);
setConnectScatterMarkers(false);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(true);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setY1LabelDisplay(true);
setY1AxisSide(0);
setTextFormatPreset(getY1Label(),1);
setY1MajorGridDisplay(true);
setY1MajorGridStyle(0);
setY1MinorGridDisplay(false);
setPieFeelerTextDisplay(1);
setTextFormatPreset(getPieSliceLabel(),1);
setPieLabelDisplay(0);
ENDSTYLE
ON GRAPH SET STYLE *
ENDSTYLE
END

The result is 4 charts with YYEAR field on Y axis (both 2002 and 2003),
and Total Employee field on X axis.
(a chart for each Department).
How can I display the same result in one chart?
(I'm using WF 5.1 and MS SQL 2000).

Any help is appreciated.

Regards,
OZ

 
Hi offir,

I'm not sure, but I guess you want to have a chart like this:
[tt]
^
|----------
|------
|---------
|
|-------------
|---------------
|-------
|
|-----
|--------
|-----------
|
|------------------------>
[/tt]
Is that right?

Eva
 
Two things that you can do with this.
1. Make a field for each Year eg
SUM TOT_EMP_YEAR_1
TOT_EMP_YEAR_2
TOT_EMP_YEAR_3
BY DEPT

or just add ON GRAPH SET GMERGE ON to your table request.
 
Hi Eva,

Yes, but I need to dice it:
The departments and years should be on the X axis and
the valus on the Y axis.
I saw a thred of yours where u needed to do something
resemblance.

Hi gizzy17,
WF does not seem to recognize the command "SET GMERGE ON" .
It returned: "UNKNOWN KEYWORD IN STYLESHEET FILE AT LINE: 1 ON GRAPH SET GMERGE".
Also, when defining total employee for each year,
I got the result but with a chart for each department.
I need one chart containing all the data.

Did u hear about the APPEND command.
I was told maybe this one can help but I
didn't find any help about it in my books.

Any other ideas?

Thanks a lot,
OZ


 
Hi Oz,

yes, I had something similar. And I solved it like gizzy17. You will have to create the TOT_EMP_YEAR_1, TOT_EMP_YEAR_2, TOT_EMP_YEAR_3 with a DEFINE:
[tt]
DEFINE FILE XYZ
TOT_EMP_YEAR_1/I11 = IF YYEAR EQ '2001' THEN TOTALEMPLOYEE ELSE 0;
TOT_EMP_YEAR_2/I11 = IF YYEAR EQ '2002' THEN TOTALEMPLOYEE ELSE 0;
TOT_EMP_YEAR_3/I11 = IF YYEAR EQ '2003' THEN TOTALEMPLOYEE ELSE 0;
END
[/tt]
And then display the graph with
[tt]
GRAPH FILE XYZ
SUM TOT_EMP_YEAR_1
TOT_EMP_YEAR_2
TOT_EMP_YEAR_3
BY DEPARTMENT_CODE
END
[/tt]
(I didn't use the SET GMERGE ON )

Of course to define the years like that is not good. (EQ '2002') Because it will not always be the years 2001, 2002 and 2003. You'll have to get the years into a variable first so that you don't write them explicitly down.

Eva
 
You could define a field which concatenates your year field and department field into one field.

i.e. if you department field is an A4 and year is an A4 then do

DEFINE FILE filename
DEPT_YR/A8=YEAR || DEPT;
END
GRAPH FILE filename
SUM
TOTAL_EMPLOYEE
BY DEPT_YR

etc

Regards

Tewy
 
Oz,

It looks to me that you put the gmerge command in the stylesheet. This needs to go outside of the stylesheet as follows.

GRAPH FILE MAN_RES
SUM TOTAL_EMPLOYEE
BY DEPARTMENT_CODE
BY YYEAR
WHERE YYEAR EQ 2002 OR 2003
AND DEPPARTMENT_CODE EQ 19 OR 20 OR 21 OR 22
ON GRAPH SET GMERGE ON
ON GRAPH SET GRAPHSTYLE *
....
ENDSTYLE
END

You should also be able to use "SET GMERGE = ON" prior to the "GRAPH FILE".
 
Hi all

It works. (I used the define for the years).
I still get the error for the GMERGE command.

Thanks u very very much!!

OZ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top