Focal Point
[SOLVED] Dynamic axis labels

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

July 25, 2013, 07:32 AM
amywalega
[SOLVED] Dynamic axis labels
I have graphs that can be filtered from a consolidated enterprise level down to an individual dept. For the enterprise level, I'd like the y-axis to be formatted in Millions, however when the graph is filtered to the department level, Millions isn't appropriate, the department may only have $10,000 in revenue. Is there a way to make the y-axis labels conditional or dynamic?
I was thinking of having the format changed based on ranges, but I don't know how to do this or if it's possible.

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8.0.02
Windows, All Outputs
July 26, 2013, 12:29 PM
Doug
You can pre-process your data to find the max value (looking for thousands or millions, etc) and then set a variable accordingly which will be used in the graph style.
July 29, 2013, 07:50 AM
amywalega
Thank you Doug, I'm not familiar with how to do that though. Any suggestions as to where I could learn to do that?


WebFOCUS 8.0.02
Windows, All Outputs
July 29, 2013, 09:08 AM
Doug
The -SET of the variable is really noithing more then an IF/THEN/ELSE based on the values being used. Here's some values you can use for -SETting yopur varliables:
Value   Format                                                Example
0/1=    #                                                     123 = 123
2=      #%                                                    123 = 12,300%
3=      #.#%                                                  123 = 12,300.0%
4=      #.##%                                                 123 = 12,300.00%
5=      $#.##                                                 123 = $123.00
6=      $#                                                    123 = $123
7=      #K (Show K for values over 999)                       1,234 = 1K
8=      $#K (Show K for values over 999)                      1,234 = $1K
9=      #M (Show M for millions)                              1,234,567 = 1M
10=     $#M (Show M for millions)                             1,234,567 = $1M
11=     #B (Show B for billions)                              1,234,567,891 = 1B
12=     $#B (Show B for billions)                             1,234,567,891 = $1B
13=     #T (Show T for trillions)                             1,234,567,891,234 = 1T
14=     $#T (Show T for trillions)                            1,234,567,891,234 = $1T
15=     Number with thousands separators, no decimal places   1,234 = 1K
16=     Number with thousands separators, two decimal places  1,234 = 1.23K
17=     General currency format for current Locale          

Example: "setDataTextFormat (6);" [b]OR, after &MyVariable has been set to a "Value": "setDataTextFormat (&MyVariable.EVAL);"
More information on this at Three D Graphics, scroll down to / Find "Preset Number Formats" for more info.

This message has been edited. Last edited by: Doug,
July 29, 2013, 09:24 AM
Doug
Or, try this and work forward from there(consider: "setDataTextFormat"):
-SET &OFFSET = 1000 ;
-*INTERNAL_PROPERTIES$fieldDisplayMode=label;OBJECTID=GLOBAL
-*INTERNAL_PROPERTIES$enablePreview=true;OBJECTID=GLOBAL
-*INTERNAL_PROPERTIES$prefixDisplayMode=;OBJECTID=GLOBAL
-*INTERNAL_PROPERTIES$GlobalRecordLimit=500;OBJECTID=GLOBAL
-*INTERNAL_PROPERTIES$SampleData=false;OBJECTID=GLOBAL
GRAPH FILE CAR
-* Created by Advanced Graph Assistant
SUM COMPUTE MYDCOST/D12.2=DCOST * &OFFSET ;
COMPUTE MYDCOST/D12.2=DCOST * &OFFSET ;
BY CAR.CARREC.MODEL
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH HBAR
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTransparentBorderColor(getSeries(0),true);
setTransparentBorderColor(getSeries(1),true);
setTransparentBorderColor(getSeries(2),true);
setTransparentBorderColor(getSeries(3),true);
setTransparentBorderColor(getSeries(4),true);
setTransparentBorderColor(getSeries(5),true);
setTransparentBorderColor(getSeries(6),true);
setTransparentBorderColor(getSeries(7),true);
setTransparentBorderColor(getSeries(8),true);
setTransparentBorderColor(getSeries(9),true);
setTransparentBorderColor(getSeries(10),true);
setDepthRadius(5);
setTransparentBorderColor(getChartBackground(),true);
setPlace(true);
setTextFormatPreset(getDataText(0),9);
setDataTextFormat(-1);
ENDSTYLE
END

July 30, 2013, 07:21 AM
amywalega
Thank you very much Doug. I will work with what you have provided today. I really appreciate the detail!!


WebFOCUS 8.0.02
Windows, All Outputs
September 29, 2016, 10:55 AM
Reiter
My problem with all of this is that this is a pretty basic thing. You shouldn't have to hand code this sort of thing for a gui based charting system.

What really upsets me about this, is that there is a selection of "general". Works great if you are talking about a count of something. It will automatically flip from K to M to B when thousands, millions, billions are needed. So you think General Dollars will do the same but put a $ sign in front. WRONG!! it does nothing of the sort other that show your 10 digit dollar amount with a $sign in front.

Who has code to allow the manual addition of a "$" in front of the general code "0"??


WebFOCUS 8.1.0.5 DS, learning AS
Windows, All Outputs