Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Graph Y-axis Increments - Millions vs 1000s
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Graph Y-axis Increments - Millions vs 1000s
 Login/Join
 
Platinum Member
posted
Hello

I am working on a line graph and having issue with Y-axis scale increments.

  • Is it possible to limit the count of numbers on Y-axis scale to 5? (fox example - 0,10,20,30,40). I am able to adjust the scale between numbers but not aware of how to limit the count.
  • I am looking to change scale to millions if maximum value in data is greater than 1 million and keep it in thousands if maximum value is less than 1 million. Is this possible directly? I am thinking to calculate the maximum number and then set up amper variable using IF condition and use that amper variable value to control millions/thousands. Any other efficient method?

Please suggest. Thank you.

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


WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
 
Posts: 123 | Registered: July 21, 2011Reply With QuoteReport This Post
Virtuoso
posted Hide Post
You need to add these lines where you can pass parameters instead of fix value

-* To manage maximum displayed value in Y-axis
setScaleMaxAuto(getY1Axis(),false);
setScaleMax(getY1Axis(),100.0);

-* To manage steps in Y-axis
setGridStepAuto(getY1MajorGrid(),false);
setGridStep(getY1MajorGrid(),10.0);

As you stated yourself, you will have first to determine what is your maximum and if it has to be displayed in M or K. You will then be able to calculate the step value to pass.


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2159 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Thanks Martin.
I calculated the maximum value and then divided it by 5 to control the number of values on Y-axis scale. It is all working fine.
But I am looking to display M and K in scale.

setTextFormatPreset(getY1Label(),15);

When I used above statement, it displays in millions (90,000,000 shows as 90M). I am not able to find an option to show in K (90,000K). It would be OK even if $ symbol shows up prefixing the number.
quote:
Originally posted by MartinY:
You need to add these lines where you can pass parameters instead of fix value

-* To manage maximum displayed value in Y-axis
setScaleMaxAuto(getY1Axis(),false);
setScaleMax(getY1Axis(),100.0);

-* To manage steps in Y-axis
setGridStepAuto(getY1MajorGrid(),false);
setGridStep(getY1MajorGrid(),10.0);

As you stated yourself, you will have first to determine what is your maximum and if it has to be displayed in M or K. You will then be able to calculate the step value to pass.


WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
 
Posts: 123 | Registered: July 21, 2011Reply With QuoteReport This Post
Virtuoso
posted Hide Post
As $999K
setTextFormatPreset(getY1Label(),8);

As 999K
setTextFormatPreset(getY1Label(),7);


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2159 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Platinum Member
posted Hide Post
quote:
Originally posted by MartinY:
As $999K
setTextFormatPreset(getY1Label(),8);

As 999K
setTextFormatPreset(getY1Label(),7);

I tried these before posting here. This is showing 3 decimal places. I am looking for only 1 decimal place in millions or thousands.


WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
 
Posts: 123 | Registered: July 21, 2011Reply With QuoteReport This Post
Virtuoso
posted Hide Post
It's not showing any decimal at all in the Y-axis but it does (2 decimals) in the bar tooltip as per COMPUTE definition

ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE car
SUM COMPUTE SLS/P8.2C=(SALES + 100) * 100 ; AS 'Sales'
BY CAR.ORIGIN.COUNTRY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET AUTOFIT ON
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);
setPlace(true);
setCurveFitEquationDisplay(false);
*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=y-axis, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTextFormatPreset(getY1Label(), 8);
*END
ENDSTYLE
END
-RUN

To have decimal and K separator in Y-axis use below

ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE car
SUM COMPUTE SLS/P8.2C=(SALES + 100) * 100 ; AS 'Sales'
BY CAR.ORIGIN.COUNTRY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET AUTOFIT ON
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);
setPlace(true);
setCurveFitEquationDisplay(false);
*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=y-axis, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
*END
*GRAPH_JS
yaxis: {numberFormat: {"mode": "currency", "decimalPlaces": 2, "grouping": "K"}}
*END
ENDSTYLE
END
-RUN

Refer to this document (search : thousandSep) : Creating HTML5 Charts 8201


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2159 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Graph Y-axis Increments - Millions vs 1000s

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.