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     [WORKAROUND] Displaying bar graph with negative values

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[WORKAROUND] Displaying bar graph with negative values
 Login/Join
 
Member
posted
I have a bar graph which shows % change values. For example the difference in sales in the month of Jan for 2 consecutive years. Therefore the graph can have negative values. There are three adjacent bars, two showing the values for the years compared and the other showing the % change. This repeats as a series for other months.

If the % change is negative the bar displays in the negative direction. I want the bar to be displayed in the positive direction along side the other two bars.

Is this possible ?

Above problem was partially solved when i used the API setScaleFromZero(false). This displays the bars in the positive direction but the bars do not originate from the zero line instead from a level below, for example -80 as the case may be according to the % change value.

Is there a better approach ?

The next problem is with the display of the data text corresponding to the bars when setScaleFromZero(false) is used. I need them displayed at the top of the bars and so used setDataTextPosition(1) which should ideally position the data text values above the bars. But in this case if the value is negative it is displayed inside the bar, just below the top as in the case when setDataTextPosition(3) is used.

How can this be solved ?

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


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 7 | Registered: March 17, 2011Report This Post
Virtuoso
posted Hide Post
Beats me why you would want negative values to be displayed as positive, but it is not my place to question your motives.
What I would do in this specific case is to solve this programmatically. By that I mean to compute the percentage as an absolute value. That way it is always prositive, starts from the zero line and displays the values above the bar.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
<JG>
posted
I can see the logic when data text is displayed, however it does take away from the principle purpose of a graph which is instant visualization.

Using the ABS value means the data text value will also display as +ve.

As a work around plot the ABS value but color it conditionally.

GRAPH FILE CAR
-* Created by Advanced Graph Assistant
SUM  DEALER_COST
     RETAIL_COST
COMPUTE DIFF/D20=IF COUNTRY EQ 'JAPAN' THEN ( DCOST - RCOST ) ELSE RCOST - DCOST ; NOPRINT
COMPUTE DIFFA/D20= ABS(DIFF);
BY COUNTRY
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VBAR
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);
setDepthRadius(5);
setTransparentBorderColor(getChartBackground(),true);
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);
setPlace(true);
setDisplay(getDataText(),true);
setDataTextPosition(1);
setUseNegativeDataTextColor(true);
ENDSTYLE
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=N5, COLOR=RED, WHEN=N4 LT 0, $
ENDSTYLE
END  
 
Report This Post
Member
posted Hide Post
I have to bring in a small clarification here.

The negative values should not be displayed as positive, instead their corresponding bars should be in positive direction i.e rising upwards from the zero line x-axis instead of the general behaviour of downward display. The negative values should be displayed as negative values as associated data texts. Well.. um.. uh.. this is the requirement.


Infact i have used the ABS function with conditional styling and have actually reached the stage illustrated above. But since its the ABS-ed value that is being displayed all are displayed as positive. What i see as a possible solution is to append a minus sign to the actual negative values for display purpose alone.

Can this be done?


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 7 | Registered: March 17, 2011Report This Post
Virtuoso
posted Hide Post
You may be able to get something done by playing around withthe text-pattern for the displayable values. I've been sort of partly successful doing this for a client, their requirement was to show a certain number of characters at a certain position in the vlaue when a certain condition applied. I achieved this for just one extra character at some position in the displayed value.
Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
maybe the annotation function could help you with this




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
<JG>
posted
Appears to be a bug on datatext positioning for -ve values

 
GRAPH FILE CAR
-* Created by Advanced Graph Assistant
SUM  DEALER_COST
     RETAIL_COST
COMPUTE DIFF/D20=IF COUNTRY EQ 'JAPAN' THEN ( DCOST - RCOST ) ELSE RCOST - DCOST ; 
BY COUNTRY
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
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);
setGraphType(19);
setDepthRadius(0);
setTransparentBorderColor(getChartBackground(),true);
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);
setPlace(true);

setAxisAssignment(getSeries(2), 1);
setGraphType(19);
setScaleFromZero(false);
setY1ScaleMax(60000);
setY2ScaleMax(60000);
setY1ScaleMaxAuto(false);
setY2ScaleMaxAuto(false);
setDisplay(getDataText(),true);
setDataTextPosition(1);
setDisplay(getY2AxisLine(),false);
setDisplay(getY2Label(),false);
ENDSTYLE

END  
 
 
Report This Post
Member
posted Hide Post
Hi GamP,

Can you post a sample code for a better understanding of how exactly conditional styling was employed on data text.

Was the styling done in the 'ON GRAPH SET GRAPHSTYLE *' section or 'ON GRAPH SET STYLE *'.

Does 'data text' have an equivalent keyword that can be used in the latter section ?


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 7 | Registered: March 17, 2011Report This Post
Virtuoso
posted Hide Post
I did that on the GRAPHSTYLE part, using the advanced graph editor. Don't have the actual code available at this moment, I'll try to find it for you. Won't be today though...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
It was something like this:
setTextFormatPattern(getDataText(1),"###,##0-");
setPlaceResize(getDataText(1),0);
setCustomDataText(getDataText(1),true);
It's how I managed to add a minus sign to the value displayed for the second series. I'm not exactly sure how to do this for only those values that are actually negative ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report 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     [WORKAROUND] Displaying bar graph with negative values

Copyright © 1996-2020 Information Builders