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 -RUNThis message has been edited. Last edited by: FP Mod Chuck,
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.
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
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.
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).
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.
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
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.
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?
|Powered by Social Strata|