Focal Point
[Solved] Bar Graph -- I want to sort bars, but not show sort field

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9867013716

March 01, 2012, 12:17 PM
John_Edwards
[Solved] Bar Graph -- I want to sort bars, but not show sort field
I have a graph that looks like this --

DEFINE FILE TWO_YEAR_COMP
  DATE_AND_DAY/A20 = DATE_OF_MONTH | ' - ' | DAY_OF_WEEK_TEXT;
END

GRAPH FILE TWO_YEAR_COMP
SUM INTERACTION_COUNT_LAST_YEAR AS '&YEAR_1'
    INTERACTION_COUNT_THIS_YEAR AS '&YEAR_2'
ACROSS DATE_AND_DAY
BY MONTH_TEXT
END


This shows the date of the month and day of the week (example: 01 - Su) along the X axis. The date of the month sets the columns in the right order on the graph. But! I don't want to show the date of the month. I just want to show the day of the week. But if I just show the day of the week the sort order is wrong. In HTML I can hide information in the sort order by dropping it into an HTML tag but this is a graph and all that stuff shows up when it paints.

Can anyone think of a creative way to keep the date of the month in the sort order but out of the display?

J.

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



March 01, 2012, 12:41 PM
JohnB
I have a similar situation with the x axis -- I have a graph where the date values are month - year such as "Jun-11" and "Jul-11". This obviously is causing the wrong sort order.


WF 7.7.03, Windows 7, HTML, Excel, PDF
March 01, 2012, 10:49 PM
Mika Keranen
Gentlemen,

Depending on the WebFOCUS version you're using, the following functionality might be available. You use two sort fields with the graph and simply NOPRINT the other.

DEFINE FILE EMPDATA
HIRE_YYM/YYM = HIREDATE ;
HIRE_YEAR/YY = HIREDATE ;
HIRE_MONTH/M = HIREDATE ;
HIRE_DAY/D   = HIREDATE ;
END

GRAPH FILE EMPDATA
SUM SALARY
BY HIRE_YYM NOPRINT
BY HIRE_DAY AS ''
ON GRAPH SET 3D OFF
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
END


And we do have the good old COLUMNS command available, but this might not work with JohnE's problem, as there are columns with the same value, but this should work with JohnB's sorting problem.

GRAPH FILE CAR
SUM SALES
ACROSS COUNTRY
   COLUMNS 'W GERMANY' AND 'ENGLAND' AND 'FRANCE' AND 'ITALY' AND 'JAPAN'
END


Hope this helps.

Cheers,
Mika


WebFOCUS 7.6.x
PMF 5.2.x
March 02, 2012, 09:22 AM
John_Edwards
I'm confused by your answer, because the BY field in my example is producing multiple graphs. It's the ACROSS field that places the bars on each graph being shown. The issue I'm having is with the ACROSS field.

But it's an academic issue because, as best I can tell, placing a NOPRINT on an ACROSS field or a BY field is the equivalent of removing the line from the command. At that point the line makes no change to the output whatsoever. This is 7.7.03. Are you able to produce graphs where the NOPRINT is having the effect you're talking about? And if so, what version are you on?

Are the settings you're showing (GRMERGE, GRMULTIGRAPH, and GRXAXIS) part of the solution?

J.



-- Update: Those options absolutely ARE part of the solution, and they only work on BY fields, not ACROSS. I am able to put my graph into a loop to remove the ACROSS, convert to using a BY field and then include the GRAPH options

ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2

. . . in order to get the result I'm looking for.

Thank you for posting!

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



March 02, 2012, 10:01 AM
Wep5622
You can control which BY fields go where by using the values in the section you italicized above.

GRMULTIGRAPH 0 means none of the BY fields are used for splitting the results over multiple graphs.
GRLEGEND 0 tells no BY fields will be used for the legend.
GRXAXIS 2 tells that two of the BY fields make up the ordinal axis.

The total, 0 + 0 + 2, tells that there are two BY fields in the report. That must match up with the actual situation, or you will get an error.

I don't know in what order these options are applied, but some experimenting can clear that up Wink


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :