Focal Point
[SOLVED] Keeping the Y-axis an integer value

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

January 27, 2017, 12:44 PM
David M
[SOLVED] Keeping the Y-axis an integer value
Hello,

I am using app studio 8105 to create a chart that displays a 13 week trend of the count of assets (tractors).
The counts are integer values and can range from 10 to about 5000 depending on the filters applied.
When I apply a filter that reduces the count to something less than 50, the Y axis on the graph changes from integer to decimal values.
As an example; with a count of 17 assets...
My trendline shows 16.8, 17.2, 17.6, 18, 18.4, 18.8, 19.2, with the starting trend between 16.8 and 17.2
I want my Y axis to show 16, 17, 18, 19, 20, with the starting trend at 17.
Formatting the Y axis to an integer will not help because I get 17, 17, 18, 18, 19 (as expected), with the trend starting between 17,17
I can't set the upper and lower limits because the chart can change based on the filters.

I have set include zeros to false.
setScaleMustIncludeZero(getY1Axis(),false);

Any ideas would be appreciated, thanks.

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 1
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
setUseSeriesShapes(true);
setMarkerSizeDefault(50);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=HEADING, JUSTIFY=CENTER, FONT='VERDANA', SIZE=10, COLOR=RGB(66 70 73), STYLE=NORMAL, $
TYPE=DATA, ACROSSCOLUMN=N1, TARGET='_blank', FOCEXEC=IBFS:/WFC/Repository/NFI_Dedicated/Operations/TransMetrics/Rpt_Detail_Asset_TractorTrailer.fex(SVP=&SVP.QUOTEDSTRING RVP=&RVP.QUOTEDSTRING DIRECTOR=&DIRECTOR.QUOTEDSTRING PM=&PM.QUOTEDSTRING COSTCENTER=&COSTCENTER.QUOTEDSTRING PERIODENDING=VWASSETSUMMARY.VWASSETSUMMARY.PERIODENDING TYPEDESC=VWASSETSUMMARY.VWASSETSUMMARY.TYPEDESC), $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setFontName(getO1Title(),"VERDANA");
setFontSizeAbsolute(getO1Title(), true);
setFontSizeInPoints(getO1Title(), 10);
setPlaceResize(getO1Title(), 0);
setFontStyle(getO1Title(),0);
setFontName(getY1Title(),"VERDANA");
setFillColor(getSeries(1),new Color(200,15,46));
setFillColor(getSeries(0),new Color(&TRENDCOLOR));
setTextString(getY1Title(),"Asset Cnt");
setDisplay(getY1Title(),true);
setTextString(getO1Title(),"Asset - Count by Week");
setDisplay(getO1Title(),true);
setScaleMustIncludeZero(getY1Axis(),false);
setAltFmtFrameNumColors(getY1AltFmtFrame(),5);
setCurveFitType(0,1);
setCurveFitType(1,1);
setCurveFitType(2,1);
*GRAPH_JS
"introAnimation": {
"enabled": false
},
"riserBevel": "cylinder"
,
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH
-INCLUDE IBFS:/WFC/Repository/NFI_Dedicated/Public/nodatamsg.fex

This message has been edited. Last edited by: David M,


WebFOCUS 8.1.05M, 8.2.02M
Windows, All Outputs
January 27, 2017, 02:22 PM
MartinY
No sure to have fully understand your need but you can add these to your code to manage the grid steps and min:
setGridStepAuto(getY1MajorGrid(),false);
setGridStep(getY1MajorGrid(),1.0);
setScaleMinAuto(getY1Axis(),false);
setScaleMin(getY1Axis(),17.0);

But since it may vary, as I understand, you can also do the following:
setGridStepAuto(getY1MajorGrid(),false);
setGridStep(getY1MajorGrid(),&STEPGRID);
setScaleMinAuto(getY1Axis(),false);
setScaleMin(getY1Axis(),&MINSCALE);

Where you first need to assign a value to both &STEPGRID and &MINSCALE. The ways to assign them are multiple and depend on how your data is built and your needs.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
January 27, 2017, 03:51 PM
David M
Thanks for your quick response.

I had thought of the solution you suggested, but being fairly new to webfocus, I don't know how to set the variables. My report is very simple as you can see from the select below. There are WHERE clauses which I didn't show. I would need to get the highest and lowest count of tractors anytime during the 13 week period.

So if I used as an example of 4 weeks just to keep it simple.
week 1 total tractors = 15
week 2 total tractors = 25
week 3 total tractors = 29
week 4 total tractors = 30

I would want the Y axis to maybe start at 10 and go to 35

Another example with a different filter applied, I might get
week 1 total tractors = 900
week 2 total tractors = 1200
week 3 total tractors = 1500
week 4 total tractors = 2100

I would want the Y axis to maybe start at 500 and go to 2500

GRAPH FILE vwassetsummary
SUM VWASSETSUMMARY.VWASSETSUMMARY.ASSETCNT
BY VWASSETSUMMARY.VWASSETSUMMARY.TYPEDESC
ACROSS VWASSETSUMMARY.VWASSETSUMMARY.PERIODENDING AS 'Tractor Count by Week'

What can I add to this statement to get those high and low values?


WebFOCUS 8.1.05M, 8.2.02M
Windows, All Outputs
January 27, 2017, 04:22 PM
MartinY
Extract the min and max with something such as
SET ASNAMES = ON
-DEFAULTH &MINVAL = 0
-DEFAULTH &MAXVAL = 0
TABLE FILE vwassetsummary
SUM MIN.VWASSETSUMMARY.VWASSETSUMMARY.ASSETCNT AS 'MINVAL'
MAX.VWASSETSUMMARY.VWASSETSUMMARY.ASSETCNT AS 'MAXVAL'
ON TABLE HOLD AS MINMAX
END
-RUN
-READFILE MINMAX
-RUN
-TYPE &MINVAL, &MAXVAL

.....
Then perform any calculation you want to determine a valid and proper scaling:
-SET &MYSTEP = &MAXVAL / &MINVAL * 10;
.....

-SET &STEPGRID = &MYSTEP;
-SET &MINSCALE = &MINVAL;
-SET &MAXSCALE = &MAXVAL;
.....
setGridStepAuto(getY1MajorGrid(),false);
setGridStep(getY1MajorGrid(),&STEPGRID);
setScaleMinAuto(getY1Axis(),false);
setScaleMin(getY1Axis(),&MINSCALE);
setScaleMaxAuto(getY1Axis(),false);
setScaleMax(getY1Axis(),&MAXSCALE);



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
January 27, 2017, 04:40 PM
David M
Very nice, I'll try that on Monday, thanks


WebFOCUS 8.1.05M, 8.2.02M
Windows, All Outputs
January 30, 2017, 09:59 AM
David M
Martin,

I got it to work with your suggestions. Thank you.


WebFOCUS 8.1.05M, 8.2.02M
Windows, All Outputs
January 30, 2017, 10:14 AM
MartinY
Glad that I've been able to help.

Edit your first post then update the subject and add: [SOLVED} at the beginning if it.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007