Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Stacked bar graph

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Stacked bar graph
 Login/Join
 
Member
posted
Hi guys,
I am trying to create a stacked bar graph. I have got some fields. The first field is REGION field.Each REGION has some list of PROGRAMS and each PROGRAM has some ratings namely RATING_1, RATING_2, RATING_3, and RATING_4 assosciated with some values.What I need to do is to depict the ratings RATING_1, RATING_2 and RATING_3 as a stacked bar(I have done this) and RATING_4 should come as a single bar just beside the stacked bar which I am having trouble doing.I will post my code here:


GRAPH FILE PROGRAM_RPT
SUM PROGRAM_RPT.PROGRAM_RPT.RATING_1
PROGRAM_RPT.PROGRAM_RPT.RATING_2
PROGRAM_RPT.PROGRAM_RPT.RATING_3
BY PROGRAM_RPT.PROGRAM_RPT.PROGRAM
BY PROGRAM_RPT.PROGRAM_RPT.REGION
WHERE YEAR EQ '&DEF';
WHERE REGION EQ &listbox1;
ON GRAPH PCHOLD AS HOLD FORMAT PNG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH SET HAXIS 5000
ON GRAPH SET VAXIS 1000
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setPlace(true);
setDepthRadius(5);
setTransparentBorderColor(getChartBackground(),true);
setDataTextDisplay (true);
setMarkerDisplay(true);
setStackedDataValueSum(false);
setDataTextPosition(3);
setDisplay(getDataTextStackedTotalOnTop(), true);
ENDSTYLE
ON GRAPH SET STYLE *
TYPE=DATA, COLUMN=N3, FOCEXEC=ratingone (RATING_1 = PROGRAM_RPT.PROGRAM_RPT.RATING_1 ABC='&DEF'), $
TYPE=DATA, COLUMN=N4, FOCEXEC=ratingtwo (RATING_2 = PROGRAM_RPT.PROGRAM_RPT.RATING_2), $
TYPE=DATA, COLUMN=N5, FOCEXEC=ratingthree (RATING_3 = PROGRAM_RPT.PROGRAM_RPT.RATING_3), $
ENDSTYLE
END


Hope somebody will be able to answer this

This message has been edited. Last edited by: Kerry,


Version 765
Windows XP/sp2
 
Posts: 6 | Registered: May 09, 2011Report This Post
<FreSte>
posted
For some reason RATING_4 has to be the second field (?) in the GRAPH section,
don't know why.

-Fred-

TABLE FILE CAR
  SUM
    COMPUTE RATING_1/D9 = DEALER_COST;
    COMPUTE RATING_2/D9 = DEALER_COST * 0.85;
    COMPUTE RATING_3/D9 = RETAIL_COST;
    COMPUTE RATING_4/D9 = RETAIL_COST * 2.10;
  BY COUNTRY AS PROGRAM
  BY CAR     AS REGION
  WHERE COUNTRY NE 'W GERMANY';
  ON TABLE SET HOLDLIST PRINTONLY
  ON TABLE SET ASNAMES ON
  ON TABLE HOLD AS PROGRAM_RPT
END
-RUN

GRAPH FILE PROGRAM_RPT
  SUM
    RATING_1
    RATING_4
    RATING_2
    RATING_3
  BY PROGRAM
  BY REGION

ON GRAPH PCHOLD AS HOLD FORMAT PNG
-*ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH SET HAXIS 1000
ON GRAPH SET VAXIS 500
ON GRAPH SET UNITS PIXELS
-*ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET GRAPHSTYLE *
setGraphType(20);
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setPlace(true);
setDepthRadius(0);
setTransparentBorderColor(getChartBackground(),true);
setDataTextDisplay (true);
-*setMarkerDisplay(true);
setStackedDataValueSum(false);
setDataTextPosition(4);
-*setDisplay(getDataTextStackedTotalOnTop(), true);
ENDSTYLE
END

TABLE FILE PROGRAM_RPT
PRINT *
END

This message has been edited. Last edited by: <FreSte>,
 
Report This Post
Member
posted Hide Post
Hi guys,
Cleared the issue with some help from my mentor.
Actually we had to do some adjustment with the uploaded master table
I will provide a mock up of the table

Year Region Program Rating_1 Rating_2 Rating_3
2010 AR01 PGM1 40 30 20
2011 AL01 PGM2 10 20 30
Rating_4
40
50
Here, we splitted the table into two parts.
The first part where values of Rating_1, Rating_2 and Rating_3 were retained but Rating_4 was computed as zero.
Code looks like:

TABLE FILE PROGRAM_RPT
SUM RATING_1
RATING_2
RATING_3
COMPUTE RATING_4/I4 = 0;
BY YEAR
BY REGION
BY PROGRAM
ON TABLE HOLD AS PROGRAM_RPT1
END

Similarly second table where the three ratings were computed as zero while rating_4 was retained.This table was also put in another file using hold(similar code as shown above by name PROGRAM_RPT2)

Now both these tables were joined using MORE.
Code shown below:

TABLE FILE PROGRAM_RPT1
PRINT RATING_1
RATING_2
RATING_3
RATING_4
BY YEAR
BY REGION
BY PROGRAM
ON TABLE HOLD AS PROGRAM_RPT3
MORE
FILE PROGRAM_RPT2
END

Then the previous graph file code was run to obtain desired output just by changing name to PROGRAM_RPT3

Thanks Fred for your prompt reply.Hope this post will help somebody in future..!!

Thanks


Version 765
Windows XP/sp2
 
Posts: 6 | Registered: May 09, 2011Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Stacked bar graph

Copyright © 1996-2020 Information Builders