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     Not able to sort in a stacked chart

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Not able to sort in a stacked chart
 Login/Join
 
Silver Member
posted
Hi,

Iam sorting by Y Axis values. Iam not able to implement this feature in stacked bar chart.
Iam creating a stacked bar chart with sum(sales) along the Y Axis. And CAR along the X Axis, Stacked by MODEL.

But Iam getting this error :

Possible Error onRed Facen(,0.0,"B210 2 DOO");

This is the code that Iam using.

-* HTML Tool
-* Created by Graph Assistant
-* FF Line do not change this line! Field Name
-* FF Line do not change this line! Alias
-* FF Line do not change this line! Format
-* FF Line do not change this line! Segment
-* FF Line do not change this line! displayTree=0

TABLE FILE CAR
SUM SALES
CAR
BY HIGHEST TOTAL SALES NOPRINT
BY MODEL
ON TABLE HOLD AS H1
END

TABLE FILEF H1
SUM SALES
CAR
BY HIGHEST TOTAL SALES NOPRINT
BY MODEL
ON TABLE SAVE
END
-RUN

-SET &SER_CNT=&LINES;
-SET &I=0;
-* Put all the countries in unique variables.
-REPEAT GRAPH &SER_CNT TIMES
-READ SAVE NOCLOSE &CNAME.A10.
-IF &RETCODE NE 0 GOTO GRAPH;
-SET &I=&I+1;
-SET &CNAME.&I=&CNAME;

-GRAPH

GRAPH FILE H1
SUM SALES
BY HIGHEST TOTAL SALES NOPRINT
BY CAR
ACROSS MODEL


HEADING
"STACKED CHART
"
""
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET 3D OFF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRWIDTH 1
ON GRAPH SET GRMERGE ON
ON GRAPH SET VZERO ON
ON GRAPH SET GRAPHSTYLE *
setSeriesType(0,1);
setSeriesType(1,1);
setLegendDisplay(true);
setLegendMarkerPosition(0);
setMarkerDisplay(true);
setUseSeriesShapes(false);
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);
setFontSize(getO1Label(),12);
setFontSizeAbsolute(getO1Label(),true);
setPlace(true);
ENDSTYLE
ON GRAPH SET GRAPHSTYLE *
-* This is where we start the loop to populate the setGroupLabel method once
for each series on the graph.
-* Since series numbers are relative to zero, we have to have two counters.
-* &J will count the series.
-* &I will match the index variable name set above.
-SET &I=1;
-SET &J=0;
-REPEAT ENDGROUP &SER_CNT TIMES
setGroupLabel(&J,"&CNAME.&I");
-SET &I=&I+1;
-SET &J=&J+1;
-ENDGROUP

ENDSTYLE
END
-* End Graph Assistant

Please let me know if I need to make any modification in the code.

Thanks
Poongs.


WF8103 -UNIX,HTML,EXCEL,PDF.
 
Posts: 42 | Registered: June 22, 2007Report This Post
<JG>
posted
Your'e not using that code to create a stacked bar chart.

For anything to be stacked you have to have at least 2 numeric verb objects

This message has been edited. Last edited by: <JG>,
 
Report This Post
Silver Member
posted Hide Post
Hi,
Iam able to stack the chart with just one numeric parameter selected along the Y Axis.
In this case,Iam considering the "SALARY" along the Y Axis stacked by "EMPLOYEE NAME" with "HIRE_DATE" along the X Axis. So for each HIRE_DATE all the EMPLOYEE NAME will be stacked based on the SALARY.
The chart here is getting sorted based on the X Axis values (by HIRE_DATE values Eg : 2008/05/01 , 2008/06/01 etc.).I need it based on the Y Axis values.In that case the order should be 2008/05/01 , 2008/07/01 , 2008/06/01..

Here is the code (without sorting):

-* HTML Tool
-* Created by Graph Assistant
-* FF Line do not change this line! Field Name
-* FF Line do not change this line! Alias
-* FF Line do not change this line! Format
-* FF Line do not change this line! Segment
-* FF Line do not change this line! displayTree=0
GRAPH FILE DATE_SORT
SUM DATE_SORT.DATE_SORT.SALARY
BY DATE_SORT.DATE_SORT.EMP_NAME
ACROSS DATE_SORT.DATE_SORT.HIRE_DATE
HEADING
""
""
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET 3D OFF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRWIDTH 1
ON GRAPH SET VZERO ON
ON GRAPH SET GRAPHSTYLE *
setSeriesType(0,1);
setLegendDisplay(true);
setLegendMarkerPosition(0);
setMarkerDisplay(true);
setUseSeriesShapes(false);
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);
setFontSize(getO1Label(),12);
setFontSizeAbsolute(getO1Label(),true);
setPlace(true);
ENDSTYLE
ON GRAPH SET STYLE *
TYPE= HEADING,$
ENDSTYLE
END
-* End Graph Assistant

I have made some changes in the above code to sort by SALARY.But I dont see any change.

-* HTML Tool
-* Created by Graph Assistant
-* FF Line do not change this line! Field Name
-* FF Line do not change this line! Alias
-* FF Line do not change this line! Format
-* FF Line do not change this line! Segment
-* FF Line do not change this line! displayTree=0
TABLE FILE DATE_SORT

SUM
SALARY
HIRE_DATE
BY EMP_NAME
BY HIGHEST TOTAL SALARY NOPRINT
ON TABLE HOLD AS H1
END

GRAPH FILE H1
SUM
SALARY
BY EMP_NAME
BY HIGHEST TOTAL SALARY NOPRINT
ACROSS HIRE_DATE

HEADING
""
""
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET 3D OFF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRWIDTH 1
ON GRAPH SET VZERO ON
ON GRAPH SET GRAPHSTYLE *
setSeriesType(0,1);
setLegendDisplay(true);
setLegendMarkerPosition(0);
setMarkerDisplay(true);
setUseSeriesShapes(false);
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);
setFontSize(getO1Label(),12);
setFontSizeAbsolute(getO1Label(),true);
setPlace(true);
ENDSTYLE
ON GRAPH SET STYLE *
TYPE= HEADING,$
ENDSTYLE
END
-* End Graph Assistant

Please let me know the changes to be made.

Thanks
Poongs.


WF8103 -UNIX,HTML,EXCEL,PDF.
 
Posts: 42 | Registered: June 22, 2007Report This Post
<JG>
posted
Poongs,

A stacked bar chart either horizontal or vertical is when you are showing more than one value
in the axis.

For example Purchase cost + Purchase Tax shows each item seperately and also allows you to see
the Total Cost.

What you are doing is a simple vertical Bar chart not a stacked chart.

However to do what you want you must write both the data values and the labels into the API code.

TABLE FILE CAR
PRINT DEALER_COST
COMPUTE TOT_COST/D12.2=DEALER_COST+RETAIL_COST; NOPRINT
MODEL
BY TOTAL HIGHEST TOT_COST NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS H1 FORMAT ALPHA
END
-RUN
-SET &SER_CNT=&LINES;
-SET &I=0;
-* Put all the DATA into unique variables.
-REPEAT GRAPH &SER_CNT TIMES
-READ H1 &SALESA.A7. &CNAME.A24.
-SET &I=&I+1;
-SET &SALESA.&I =&SALESA;
-SET &CNAME.&I =&CNAME;
-GRAPH
GRAPH FILE H1
SUM DEALER_COST
BY MODEL
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET 3D OFF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRWIDTH 1
ON GRAPH SET GRMERGE ON
ON GRAPH SET VZERO ON
ON GRAPH SET GRAPHSTYLE *
setSeriesType(0,1);
setSeriesType(1,1);
setLegendDisplay(true);
setLegendMarkerPosition(0);
setMarkerDisplay(true);
setUseSeriesShapes(false);
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);
setFontSize(getO1Label(),12);
setFontSizeAbsolute(getO1Label(),true);
setPlace(true);
-* Generate Data Series 0
-SET &I=1;
-SET &J=0;
-REPEAT ENDDATA1 &SER_CNT TIMES
setData(0,&J,&SALESA.&I);
-SET &I=&I+1;
-SET &J=&J+1;
-ENDDATA1
-SET &I=1;
-SET &J=0;
-* Generate Group labels
-SET &I=1;
-SET &J=0;
-REPEAT ENDGROUP &SER_CNT TIMES
setGroupLabel(&J,"&CNAME.&I");
-SET &I=&I+1;
-SET &J=&J+1;
-ENDGROUP
ENDSTYLE
END
 
Report This Post
Silver Member
posted Hide Post
Hi
Thanks for the reply.
But in the example that you have given I don see any ACROSS column.
When I pasted the same code, the output that I got was a normal BAR chart with MODEL along the X Axis and TOT_COST along the Y Axis. But I need a stacked-bar chart that needs both the ACROSS and BY Columns.

Say Iam altering the code like this :

TABLE FILE CAR
PRINT DEALER_COST
COMPUTE TOT_COST/D12.2=DEALER_COST+RETAIL_COST; NOPRINT
MODEL
-* This is the across column
CAR
BY TOTAL HIGHEST TOT_COST NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS H1 FORMAT ALPHA
END
-RUN
-SET &SER_CNT=&LINES;
-SET &I=0;
-* Put all the DATA into unique variables.
-REPEAT GRAPH &SER_CNT TIMES
-READ H1 &SALESA.A7. &CNAME.A24.
-SET &I=&I+1;
-SET &SALESA.&I =&SALESA;
-SET &CNAME.&I =&CNAME;
-GRAPH
GRAPH FILE H1
SUM DEALER_COST
BY MODEL
-* CAR values to be printed along the X Axis stacked by MODEL
ACROSS CAR
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET 3D OFF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRWIDTH 1
ON GRAPH SET GRMERGE ON
ON GRAPH SET VZERO ON
ON GRAPH SET GRAPHSTYLE *
setSeriesType(0,1);
setSeriesType(1,1);
setLegendDisplay(true);
setLegendMarkerPosition(0);
setMarkerDisplay(true);
setUseSeriesShapes(false);
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);
setFontSize(getO1Label(),12);
setFontSizeAbsolute(getO1Label(),true);
setPlace(true);
-* Generate Data Series 0
-SET &I=1;
-SET &J=0;
-REPEAT ENDDATA1 &SER_CNT TIMES
setData(0,&J,&SALESA.&I);
-SET &I=&I+1;
-SET &J=&J+1;
-ENDDATA1
-SET &I=1;
-SET &J=0;
-* Generate Group labels
-SET &I=1;
-SET &J=0;
-REPEAT ENDGROUP &SER_CNT TIMES
setGroupLabel(&J,"&CNAME.&I");
-SET &I=&I+1;
-SET &J=&J+1;
-ENDGROUP
ENDSTYLE
END

Please let me know how this can be sorted,by values of TOT_COST.

Thanks
Poongs.


WF8103 -UNIX,HTML,EXCEL,PDF.
 
Posts: 42 | Registered: June 22, 2007Report This Post
<JG>
posted
I will tell you again.

LISTEN VERY CAREFULLY, BECAUSE I’M SHOUTING AS LOUD AS I CAN.

YOU CAN NOT HAVE A STACKED CHART OF ANY SORT, IF YOU HAVE ONLY ONE MEASURE.

READ THE MANUAL FOR A DEFINITION OF WHAT A STACKED CHART IS.
 
Report This Post
Silver Member
posted Hide Post
Sorry for the confusion.
We have a different set of requirement.

The problem Iam facing is when I have both ACROSS and BY fields in my fex, Iam not able to sort the graph based on the Y Axis values.

But if I have just the ACROSS field or BY column, Iam able to do sorting based on Y Axis.

Please let me know if Iam clear about the requirements.

Thanks
Poongs.


WF8103 -UNIX,HTML,EXCEL,PDF.
 
Posts: 42 | Registered: June 22, 2007Report This Post
<JG>
posted
OK .

This is not a stacked chart it is a merged chart.

Take the following code as the basis, it is based on the EMPLOYEE demo db in IBISAMP
and seems to reflect what you want.
If you want lowest to highest instead of highest to lowest take out HIGHEST .

You may want to use the loop to modify the labels.

TABLE FILE EMPLOYEE
SUM CURR_SAL AS 'TOT_SAL'
BY HIRE_DATE
SUM CURR_SAL
BY HIRE_DATE
BY EMP_ID
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS H1 FORMAT ALPHA
END
-RUN
GRAPH FILE H1
SUM CURR_SAL
BY HIGHEST TOT_SAL NOPRINT
BY HIRE_DATE
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET 3D OFF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRWIDTH 1
ON GRAPH SET GRMERGE ON
ON GRAPH SET VZERO ON
ON GRAPH SET GRAPHSTYLE *
setSeriesType(0,1);
setSeriesType(1,1);
setLegendDisplay(true);
setLegendMarkerPosition(0);
setMarkerDisplay(true);
setUseSeriesShapes(false);
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);
setFontSize(getO1Label(),12);
setFontSizeAbsolute(getO1Label(),true);
setPlace(true);

ENDSTYLE
END
 
Report This Post
Silver Member
posted Hide Post
Thanks. The code that you gave works fine.

I tried to create a sample chart using the CAR DB.
I tried to sort this graph by Y Axis. But is not working.
Can you please modify this code so as to implement the sorting here.

-* HTML Tool
-* Created by Graph Assistant
-* FF Line do not change this line! Field Name
-* FF Line do not change this line! Alias
-* FF Line do not change this line! Format
-* FF Line do not change this line! Segment
-* FF Line do not change this line! displayTree=0
GRAPH FILE CAR
SUM CAR.SPECS.HEIGHT
CAR.SPECS.LENGTH
BY CAR.COMP.CAR
ACROSS CAR.ORIGIN.COUNTRY
HEADING
""
""
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET 3D OFF
ON GRAPH SET BARNUMB OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET GRWIDTH 1
ON GRAPH SET GRMERGE ON
ON GRAPH SET VZERO ON
ON GRAPH SET GRAPHSTYLE *
setSeriesType(0,1);
setSeriesType(1,1);
setLegendDisplay(true);
setLegendMarkerPosition(0);
setMarkerDisplay(true);
setUseSeriesShapes(false);
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);
setFontSize(getO1Label(),12);
setFontSizeAbsolute(getO1Label(),true);
setPlace(true);
ENDSTYLE
ON GRAPH SET STYLE *
TYPE= HEADING,$
ENDSTYLE
END
-* End Graph Assistant

Thanks.


WF8103 -UNIX,HTML,EXCEL,PDF.
 
Posts: 42 | Registered: June 22, 2007Report This Post
<JG>
posted
No. That's what you are getting paid for.

Helping is one thing doing your job is another.
 
Report 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     Not able to sort in a stacked chart

Copyright © 1996-2020 Information Builders