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     [SOLVED] Graph Y-axis label format

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Graph Y-axis label format
 Login/Join
 
Expert
posted
I would like to set the format of the Y-axis labels in a graph.

I thought I could use setTextFormatPattern(getY1Label(),"###.####%"); to force four decimal places and also show a percentage sign, but it does not work.

I have values like these on the Y-axis: 0.0964, 0.0962, 0.096, 0.0958. I would like to see 0.0964%, 0.0962%, 0.0960%, 0.0958%.

Any ideas?

Thanks,

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
The GRAPH style:

ON GRAPH SET GRAPHSTYLE *

-* Properties for entire graph -----------------------------
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTemplateFile("/images/tdg/template/IBIDefault.txt");

setRect(getFrame(), new Rectangle(-14000,-9000,32000,32000)); // Set the graph display area - (-16000, -16000, 32000, 32000 - entire canvas)

-*setDepthAngle(0);                                         // Turn off 2.5D
setDepthRadius(0);                                          // Turn off 2D

setTransparentBorderColor(getChartBackground(),true);       // apply a transparent border color to an object
setPlace(true);
setFontName(getAllText(),"Calibri");
setGraphType(41);                                           // Vertical Absolute Line Plot

-* X label -------------------------------------------------
setExcludeMinLabel(getO1Label(),false);                     // include the minimum label
setPlaceResize(getO1Label(),0);                             // allow font size resize
setFontSizeAbsolute(getO1Label(),true);                     // assign absolute font sizing
setFontSizeInPoints(getO1Label(),8);                        // set font size
setFillColor(getO1Label(),new Color(17,94,103));            // set font color
setTextRotation(getO1Label(),0);                            // set text rotation: 0 (none), 1 (90 degrees), 2 (270 degrees), 3 (45 degrees)
setAutoSkip(getO1Label(),2);                                // sets or disables label skip for labels
setPlaceSkip(getO1Label(),0);
setSkipBegin(getO1Label(),0);                               // sets the first label to skip
setSkipCount(getO1Label(),3);                               // sets the interval of labels to skip after setSkipBegin()

-* Y label -------------------------------------------------
setExcludeMinLabel(getY1Label(),true);                      // exclude the minimum label
setExcludeMaxLabel(getY1Label(),true);                      // exclude the maximum label
setPlaceResize(getY1Label(),0);                             // allow font size resize
setFontSizeAbsolute(getY1Label(),true);                     // assign absolute font sizing
setFontSizeInPoints(getY1Label(),8);                        // set font size
setFillColor(getY1Label(),new Color(17,94,103));            // set font color
setTextFormatPattern(getY1Label(),"#.##%");                 // assign a standard Java number format pattern (DOES NOT SEEM TO WORK)
-*setTextFormatPreset(getY1Label(),9);                        // assign a number format - 9 = (show M for Millions)
-*setAutoSkip(getY1Label(),20);                             // sets or disables label skip for labels
-*setSkipBegin(getY1Label(),0);                             // when setAutoSkip() selects manual skip mode, this method selects the first label to skip
-*setSkipCount(getY1Label(),20);                            // when setAutoSkip() selects manual skip mode, this method selects the interval of labels to skip after setSkipBegin()


-* Lines and markers ---------------------------------------
-*setMarkerSizeDefault(50);                                 // define the size of markers in a 2D graph
-*setUseSeriesShapes(true);                                 // enable or disable the use of different shapes for each series in the legend
setFillColor(getSeries(0),new Color(0,127,192));            // set series 0 line color
setMarkerDisplay(true);                                     // enable or disable the display of markers
setMarkerShape(getSeries(0),2);                             // set marker shape
setMarkerSize(0,0)                                          // set marker size
-*setSmoothLines(true);
-* These three settings are required to have small markers which allows the tooltip for the last dimension to display
setUseSeriesBorderDefaults(true);
setSeriesDefaultBorderColor(new Color(0,127,192));
setSeriesDefaultTransparentBorderColor(true);
setExtendToFrameEdge(false);                                // enable or disable extension of the risers to the graph frame edge
setLineWidth(getSeries(0),4);                               // define the thickness of a line object

-* For lowest and highest value - use later
-*setFillColor(getSeries(1),new Color(255 0 0));              // Red color for series 1 (MINVAL)
-*setFillColor(getSeries(2),new Color(255 0 0));              // Red color for series 2 (MAXVAL)
-*setBorderColor(getSeries(1),new Color(255 0 0));            // Red color for series 1 (MINVAL)
-*setBorderColor(getSeries(2),new Color(255 0 0));            // Red color for series 2 (MAXVAL)
-*setMarkerShape(getSeries(1),2);                             // Round for series 1
-*setMarkerShape(getSeries(2),2);                             // Round for series 2
-*setMarkerSize(getSeries(1),100);                            // Marker size for series 1
-*setMarkerSize(getSeries(2),100);                            // Marker size for series 2
-*setLineWidth(getSeries(1),0);                               // Smallest line width for series 1
-*setLineWidth(getSeries(2),0);                               // Smallest line width for series 2

-* Title ---------------------------------------------------
setTextString(getTitle(),"Economic Exposure Forecast - &CATEGORYNAME - Investment Portfolio %"); // define a text string to be assigned to the title
setDisplay(getTitle(),true);                                // set the display attribute of the title
setPlaceResize(getTitle(),0);                               // allow font size resize
setFontSizeAbsolute(getTitle(),true);                       // assign absolute font sizing
setFontSizeInPoints(getTitle(),9);                          // set font size
setFillColor(getTitle(),new Color(0,100,106));              // set font color

-* Legend --------------------------------------------------
setLegendDisplay(false);                                    // enable or disable drawing of the legend box

-* Footnote ------------------------------------------------
-*setDisplay(getFootnote(),false);
-*setFontStyle(getFootnote(),0);
-*setPlaceResize(getFootnote(),0);

-* Grid lines ----------------------------------------------
setBorderColor(getFrame(),new Color(79,157,190));
setBorderColor(getY1MajorGrid(),new Color(79,157,190));
setBorderColor(getO1MajorGrid(),new Color(220,220,220));
setBorderColor(getO1AxisLine(),new Color(79,157,190));
setBorderColor(getY1AxisLine(),new Color(79,157,190));
-*setFillColor(getY1MajorGrid(),new Color(0,0,0));
-*setDisplay(getY1MajorGridColorBand1(),true);
-*setFillColor(getY1MajorGridColorBand1(),new Color(242,247,247));
setDisplay(getY1MajorGridColorBand2(),true);
setFillColor(getY1MajorGridColorBand2(),new Color(229,239,240));
-*setGridStyle(getY1MajorGrid(),1);
-*setLineWidth(getY1MajorGrid(),0);
-*setLineBasicStrokeType(getY1MajorGrid(),0);
-*setMajorGridDrawEveryCount(getY1MajorGrid(),1);
-*setGridStepAuto(getY1MajorGrid(),false);

-*setFillColor(getSeries(0),new Color(194,163,3));
-*setFillColor(getSeries(1),new Color(54,59,116));
-*setFillColor(getFrame(),new Color(245,241,229));
-*setDisplay(getY1ZeroLine(),true);
-*setLineWidth(getY1ZeroLine(),1);
-*setBorderColor(getY1ZeroLine(),new Color(0,0,0));
-*setFillColor(getY1ZeroLine(),new Color(0,0,0));
-*setLineWidth(getSeries(0),2);
-*setLineWidth(getSeries(1),2);

-* Custom tooltips are only supported when using the applet (GRAPHEDIT OFF)
-* https://techsupport.informatio...om/sps/51322544.html
-*setUserToolTip("[SL] [GL]: [YV]");
-*setToolTipBackgroundColor(new Color(155,233,127));
-*//setToolTipColor(new Color(255,255,255));
-*//setToolTipBackgroundColor (new Color (122, 22, 22));
-*setToolTipOn();

-*setY1ScaleMinAuto(false);
-*setY1ScaleMin(&SCALE_MIN);
-*setY1ScaleMaxAuto(false);
-*setY1ScaleMax(&SCALE_MAX);

ENDSTYLE


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
You have to set Y1LabelFormat to -1 to use a custom label format

setY1LabelFormat(-1); // Set Y1 Axis Label Format to Custom
setY1LabelFormatPattern("#.####%"); // Set Y1 Axis Label Format to number %


WF 7.6.11
Output: HTML, PDF, Excel
 
Posts: 123 | Location: UK | Registered: October 09, 2003Report This Post
Expert
posted Hide Post
Unfortunately, this is not working as expected. I get the % sign, but whole numbers - no decimal places, and the numbers are multiplied by 100.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
I find the WebFOCUS "Graphics" manual atrocious. Can anyone make any sense of this:

where:
string
Is a pattern string in the following format:
pattern:= subpattern{;subpattern}subpattern:=
{prefix}integer{.fraction}{suffix}prefix:= '\\u0000'..'\\uFFFD' -
specialCharacterssuffix:= '\\u0000'..'\\uFFFD' -
specialCharactersinteger:= '#'* '0'* '0'fraction:= '0'* '#'*


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
I have four links on a dashboard. Each open a new window that display a graph. All I'm trying to do is have some consistency with how the Y-axis labels are displayed.

Currently, the labels look like these:

Graph 1: 9.66, 9.64, 9.62, 9.6, 9.58...
Graph 2: 55.3, 55.2, 55.1, 55, 54.9...
Graph 3: 28.3, 28.2, 28.1, 28...
Graph 4: 7.33, 7.32, 7.31, 7.3...

I'd like to force 2 decimal places and have a % sign? Why is this so difficult?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
Funnily enough I was trying to get this working myself earlier this week. My value was also being multiplied by 100.

As I was using a compute for the graph I removed the *100 in my percentage calculation so when WebFOCUS multipled by 100 the answer was correct. Though this may not be an option for you. I couldn't find a way of displaying the % without it multiplying by 100, hopefully someone else will know.

In my graph I get four decimal places displayed using #.####%.


WF 7.6.11
Output: HTML, PDF, Excel
 
Posts: 123 | Location: UK | Registered: October 09, 2003Report This Post
Platinum Member
posted Hide Post
If you want a standard number of decimal places use 0.00%

The # omits trailing zeros in decimal places whereas the 0 forces them to be shown.


WF 7.6.11
Output: HTML, PDF, Excel
 
Posts: 123 | Location: UK | Registered: October 09, 2003Report This Post
Expert
posted Hide Post
Tewy,

Thanks for that! Following your suggestion, it now works - I removed my * 100 in a COMPUTE and added

setY1LabelFormat(-1);               // Set Y1 Axis Label Format to Custom
setY1LabelFormatPattern("0.00%");   // Set Y1 Axis Label Format to number %


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
The annoying thing about this method is that the labels are multiplied by 100, but the measures are not.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
I found this post on the same subject:

http://forums.informationbuild...431005252#6431005252

will this work for you?


WF 7.6.11
Output: HTML, PDF, Excel
 
Posts: 123 | Location: UK | Registered: October 09, 2003Report This Post
Platinum Member
posted Hide Post
I think I've found it. From this post:

http://forums.informationbuild...187039716#1187039716

Calculate your percentage properly (i.e. include the *100) and use this in the formatting:

setY1LabelFormat(-2); // Set Y1 Axis Label Format to Custom divided by 100
setY1LabelFormatPattern("0.00%"); // Set Y1 Axis Label Format to number %

Tooltips are correctly displayed too.


WF 7.6.11
Output: HTML, PDF, Excel
 
Posts: 123 | Location: UK | Registered: October 09, 2003Report This Post
Expert
posted Hide Post
Yes! This is it. Thanks.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report 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     [SOLVED] Graph Y-axis label format

Copyright © 1996-2020 Information Builders