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     [CLOSED] Sorting a bar chart based on the a date but display by month year

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Sorting a bar chart based on the a date but display by month year
 Login/Join
 
Platinum Member
posted
Hi Everyone,

I am trying to create a graph which is similar to the example code below. Here 'Date' will be my primary sort field which will be hidden and my secondary sort field Month_Year will be my display sort field.The challenge I am facing is, let's say I have 3 dates for Jan 2019, I would like to plot bars for 3 dates on x-axis, but on the x-axis label I want to show Jan 2019 only once for all the 3 dates instead of thrice. Please let me know if there is a way to do it or I am missing something.

 
-DEFAULTH &WF_TITLE='WebFOCUS Report';

Define file ggsales
Month_field/A20=EDIT((DATECVT(DATE, 'I8YYMD', 'A8YYMD')),'$$$$99$$');
Month_Name/A20=IF  Month EQ '01' THEN 'Jan' ELSE IF
Month EQ '02' THEN 'Feb' ELSE IF
Month EQ '03' THEN 'Mar' ELSE IF
Month EQ '04' THEN 'Apr' ELSE IF
Month EQ '05' THEN 'May' ELSE IF
Month EQ '06' THEN 'Jun' ELSE IF
Month EQ '07' THEN 'Jul' ELSE IF
Month EQ '08' THEN 'Aug' ELSE IF
Month EQ '09' THEN 'Sep' ELSE IF
Month EQ '10' THEN 'Oct' ELSE IF
Month EQ '11' THEN 'Nov' ELSE 
'Dec';
Month_Year/A25=Month_Name|| (' ' |EDIT((DATECVT(DATE, 'I8YYMD', 'A8YYMD')),'9999'));
END

GRAPH FILE ggsales
SUM GGSALES.SALES01.BUDDOLLARS
BY GGSALES.SALES01.DATE NOPRINT
BY GGSALES.SALES01.Month_Year 
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT

setPieDepth(0);
setPieTilt(0);
setDepthRadius(0); 
setCurveFitEquationDisplay(false); 
setPlace(true); 

*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $
*GRAPH_SCRIPT

setReportParsingErrors(false);
setSelectionEnableMove(false);

*END
ENDSTYLE
END

-RUN
 

This message has been edited. Last edited by: FP Mod Chuck,


Webfocus 8105/8202
Windows
All Outputs
 
Posts: 106 | Registered: June 26, 2018Report This Post
Platinum Member
posted Hide Post
Hello,
According to my understanding.

"Jan 2019 only once for all the 3 dates instead of thrice"

meaning you need to group all the jan month into one unit(grouping) and display the value in the graph ?
If that is the case, change your primary sort to month_year only.
 
Posts: 109 | Registered: February 02, 2016Report This Post
Virtuoso
posted Hide Post
BI Dev

Move your NOPRINT to the GGSALES.SALES01.DATE field...


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 2127 | Location: Customer Support | Registered: April 12, 2005Report This Post
Platinum Member
posted Hide Post
I moved NOPRINT to DATE field, But, still it did not give what I want.I want to plot graph by date, but on x-axis it will show as Jan 2019. For example on x-axis it should show data for 01-01-2019, 01-02-2019 and 01-03-2019 but label should show only Jan 2019 once for the above 3 dates, not for each date.


Webfocus 8105/8202
Windows
All Outputs
 
Posts: 106 | Registered: June 26, 2018Report This Post
Expert
posted Hide Post
quote:
01-01-2019, 01-02-2019 and 01-03-2019

Understand your data, the dates that you quote are for 1st January, 1st Febraury and 1st March and NOT 1st, 2nd and 3rd January (check the synonym, they are format I8YYMD).



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
Hi Tony,

You are right, that is how it is in the GGSALES synonym. I should have given a different example maybe. But, I have my dates from same month like I mentioned above. Please let me know if there is a way to show Month Name and Year(like Jan 2019) only once in the x-axis label despite plotting 3 dates on the x-axis on the graph.


Webfocus 8105/8202
Windows
All Outputs
 
Posts: 106 | Registered: June 26, 2018Report This Post
Platinum Member
posted Hide Post
Hi BI Dev,

I tried a bit.

This is what you looking or something like this.


 TABLE FILE CAR
PRINT
CAR
SEATS
COMPUTE S_NO/I2=LAST S_NO + 1;
COMPUTE FLD_1/A20=DECODE S_NO(1 'JAN' 2 'JAN' 3 'JAN' 4 'FEB' 5 'MAR' 6 'MAR');
COMPUTE FLD_2/A20=DECODE S_NO(1 '01/01/2019' 2 '01/10/2019' 3 '01/15/2019' 4 '02/14/2019' 5 '03/05/2019' 6 '03/25/2019');
WHERE RECORDLIMIT EQ 6
ON TABLE HOLD AS FINAL_SET FORMAT ALPHA
END
-RUN
ENGINE INT CACHE SET ON
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='769.999968';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE FINAL_SET
-* Created by Info Assist for Graph
SUM SEATS
BY FLD_1
BY FLD_2
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
setPieFeelerTextDisplay(1);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setFillColor(getFrameSide(),new Color(32,0,32));
setFillColor(getFrameBottom(),new Color(32,0,32));
setFrameAutoShade(true);
setFillColor(getChartBackground(),new Color(255,255,255,0));
setTransparentBorderColor(getChartBackground(),false);
setBorderColor(getChartBackground(),new Color(255,255,255));
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH
 
 
Posts: 109 | Registered: February 02, 2016Report This Post
Platinum Member
posted Hide Post
Hi Pav,

Thanks for taking time, I have a couple of questions,
1)How do I do it dynamically for all the dates?
2)I would need to plot the FLD_1(field name in your code) in the graph but not display it in the x-axis as a label. FLD_2 is something I will include in the BY which is fine.

Regards
BI Dev


Webfocus 8105/8202
Windows
All Outputs
 
Posts: 106 | Registered: June 26, 2018Report This Post
Platinum Member
posted Hide Post
For Question 1, you need to transform your column by using virtual fields to get the data in order.

For Question 2, If you don't want JAN, FEB, MAR to be printed in the label then Try

BY FLD_1 NOPRINT
BY FLD_2 AS ''

Hope this is helpful.

Can you also provide a sample graph image that you looking for?

Thank You.
 
Posts: 109 | Registered: February 02, 2016Report 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     [CLOSED] Sorting a bar chart based on the a date but display by month year

Copyright © 1996-2020 Information Builders