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     [CLOSED] Align both Axis on Dual Axis Graph

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Align both Axis on Dual Axis Graph
 Login/Join
 
Silver Member
posted
We have a dual Axis graph where on one of the Axis, the amounts are very different on each axis (says Sales Dollars versus Sales Quantity).
We have the graph set up and working fine and we need to ensure we leave the axis as Automatic as the actual values can vary greatly.
However, on one of the axis, the amount can occasionally be negative so they want the zero line to be aligned on both sides of the Axis
I created an example below of how they want it to visually look with the zero line aligned, however I need to be able to do this without the use of automatic axis.
It seems so simple, but I can't fathom how to make it do it. If thiis possible?

 
TABLE FILE CAR
SUM
     LST.CAR.SPECS.WIDTH
     COMPUTE RMP1/P5 = IF CAR.ORIGIN.COUNTRY EQ 'ENGLAND' THEN 0 - LST.CAR.SPECS.RPM ELSE LST.CAR.SPECS.RPM;
BY  CAR.ORIGIN.COUNTRY
ON TABLE NOTOTAL
ON TABLE HOLD AS CAR1 FORMAT ALPHA
END
ENGINE INT CACHE SET ON
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE CAR1
SUM CAR1.CAR1.RMP1
CAR1.CAR1.WIDTH
BY CAR1.CAR1.COUNTRY
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D OFF
ON GRAPH SET GRID 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 GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VBRSTK2
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setSeriesType(0,2);
setSeriesType(1,1);
setAxisAssignment( $0, 0);
setAxisAssignment( $1, 1);
setScaleMinAuto(getY2Axis(),false);
setScaleMin(getY1Axis(),-6.0);
setScaleMustIncludeZero(getY1Axis(),true);
setScaleMax(getY1Axis(),50.0);
setScaleMaxAuto(getY1Axis(),true);
setScaleMinAuto(getY1Axis(),true);
setScaleMin(getY2Axis(),-60.0);
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH
 

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


WF 81.5, Windows7
AS/400 Database.
All Outputs

 
Posts: 46 | Registered: November 26, 2008Report This Post
Virtuoso
posted Hide Post
roger,

This is how I would personally do it. The issue with your request is to have that same scaling step on both side of the graph.
With your sample it does, so the MajorGrid are displayed at the same place, but normally it's not the case and you got too many lines.

With below, I let WF decide of the steps but have forced the zero to be always displayed using the reference line.
And with the grid removed, it make the graph lighter.
Also, using different same color for each series, it do a visual association of which value goes with which bar/line.

TABLE FILE CAR
SUM LST.CAR.SPECS.WIDTH
    COMPUTE RPM1/P5 = IF CAR.ORIGIN.COUNTRY EQ 'ENGLAND' THEN 0 - LST.CAR.SPECS.RPM ELSE LST.CAR.SPECS.RPM;
	-*RPM AS 'RPM1'
BY  CAR.ORIGIN.COUNTRY
ON TABLE NOTOTAL
ON TABLE HOLD AS CAR1 FORMAT ALPHA
END
ENGINE INT CACHE SET ON
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE CAR1
SUM CAR1.CAR1.RPM1
    CAR1.CAR1.WIDTH
BY CAR1.CAR1.COUNTRY
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D OFF
ON GRAPH SET GRID 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 GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VBRSTK2
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
-*INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setSeriesType(0,2);
setSeriesType(1,1);
setAxisAssignment( $0, 0);
setAxisAssignment( $1, 1);

setScaleMustIncludeZero(getY1Axis(),true);
setScaleMustIncludeZero(getY2Axis(),true);

setFillColor(getFrame(),new Color(255,255,255));
setGridStyle(getO1MajorGrid(),3);

setDisplay(getY1MajorGrid(),false);
setDisplay(getReferenceLineY1(0),true);
setBorderColor(getReferenceLineY1(0),new Color(0,0,0));
setReferenceLineValueY1(0,0.0);
setLineWidth(getReferenceLineY1(0),1);
setLineBasicStrokeType(getReferenceLineY1(0),0);
setFillColor(getSeries(0),new Color(70,80,150));
setFillColor(getY1Label(),new Color(70,80,150));

setDisplay(getY2MajorGrid(),false);
setDisplay(getReferenceLineY2(0),true);
setBorderColor(getReferenceLineY2(0),new Color(0,0,0));
setReferenceLineValueY2(0,0.0);
setLineWidth(getReferenceLineY2(0),1);
setLineBasicStrokeType(getReferenceLineY2(0),0);
setFillColor(getSeries(1),new Color(10,120,50));
setFillColor(getY2Label(),new Color(10,120,50));

*END
ENDSTYLE
END
-RUN


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
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Silver Member
posted Hide Post
Martin,

It's not so much the scaling step that needs to be the same. They want the zero value on the right hand side of the graph level with the zero on the left hand side of the graph. So in your example, where the zero line goes across, it bisects the right hand side at roughly 35. They want this to be the zero line for that axis as well.
So the right hand axis would be something like 80 to -30 (even though there is no values below zero on that axis).
The logic/reason behind this is not mine.


WF 81.5, Windows7
AS/400 Database.
All Outputs

 
Posts: 46 | Registered: November 26, 2008Report This Post
Virtuoso
posted Hide Post
I understood all that.

But try the following :
TABLE FILE CAR
SUM LST.CAR.SPECS.WIDTH
    COMPUTE RPM1/P5 = IF CAR.ORIGIN.COUNTRY EQ 'ENGLAND' THEN 0 - LST.CAR.SPECS.RPM ELSE LST.CAR.SPECS.RPM;
BY  CAR.ORIGIN.COUNTRY
ON TABLE NOTOTAL
ON TABLE HOLD AS CAR1 FORMAT ALPHA
END
ENGINE INT CACHE SET ON
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE CAR1
SUM CAR1.CAR1.RPM1
    COMPUTE WIDTH/D5 = IF COUNTRY EQ 'ITALY' THEN WIDTH * -1 ELSE WIDTH;
BY CAR1.CAR1.COUNTRY
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D OFF
ON GRAPH SET GRID 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 GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VBRSTK2
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
-*INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setSeriesType(0,2);
setSeriesType(1,1);
setAxisAssignment( $0, 0);
setAxisAssignment( $1, 1);
setScaleMustIncludeZero(getY1Axis(),true);
setScaleMustIncludeZero(getY2Axis(),true);
*END
ENDSTYLE
END
-RUN


You will see several issue/irritant.

There are so many horizontal lines (MajorGrid) that it's unreadable. This is due to the fact that your two measures do not have the same scaling (legend steps) or not have something that can be aligned : 2 with 2K per example.
It also result in 2 different 0 line. And it even occurs with my previous sample code when the two measures have negative value.
So in fact, even my code is not working.
All the issue is due to the legend steps.

Even when trying to control the steps it doesn't work because WF apply its own steps when the "assigned" one are two large for the measure.
TABLE FILE CAR
SUM COMPUTE WIDTH/D5 = IF COUNTRY EQ 'ITALY' THEN WIDTH * -1 ELSE WIDTH;
    COMPUTE RPM1/P5 = IF CAR.ORIGIN.COUNTRY EQ 'ENGLAND' THEN 0 - LST.CAR.SPECS.RPM ELSE LST.CAR.SPECS.RPM;
BY  CAR.ORIGIN.COUNTRY
ON TABLE NOTOTAL
ON TABLE HOLD AS CAR1 FORMAT ALPHA
END
ENGINE INT CACHE SET ON
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE CAR1
SUM CAR1.CAR1.RPM1
    WIDTH
BY CAR1.CAR1.COUNTRY
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D OFF
ON GRAPH SET GRID 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 GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VBRSTK2
-*ON GRAPH SET LOOKGRAPH VLINE2
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
-*INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setSeriesType(0,2);
setSeriesType(1,1);
setAxisAssignment( $0, 0);
setAxisAssignment( $1, 1);

setFillColor(getSeries(0),new Color(70,80,150));
setFillColor(getY1Label(),new Color(70,80,150));
setFillColor(getSeries(1),new Color(10,120,50));
setFillColor(getY2Label(),new Color(10,120,50));

setScaleMustIncludeZero(getY1Axis(),true);
setScaleMustIncludeZero(getY2Axis(),true);

setGridStyle(getO1MajorGrid(),3);

setGridStyle(getY1MajorGrid(),1);
setGridStyle(getY2MajorGrid(),2);

setGridStepAuto(getY1MajorGrid(),false);
setGridStep(getY1MajorGrid(),3000);
setGridStepAuto(getY2MajorGrid(),false);
setGridStep(getY2MajorGrid(),3000);

*END
ENDSTYLE
END
-RUN


You know sometime, what user ask cannot be done...and this is where you need to use your experience/knowledge to make them understand and give an alternative solution.
Sometime, if you ask the reason why, you may be able to better understand the goal behind and gives a proper solution.


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
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Silver Member
posted Hide Post
Martin,

I agree with you that neither option works exactly the way we need and that I don't think what we/they are looking for is possible.

The reason and logic behind the request and that is that the upper management are very visual and the particular graph is operating profit( or loss) against product sales.
When a company has a loss, the bars showing the sales would all be above the zero and the line showing the profit would suddenly drop into white space below the zero line, it would make it highly visual and obvious.
The companies volumes can vary greatly which is why setting a fixed axis value is not feasible.

I just wanted to be sure I did my due diligence to see if it could be done.
That and also because I am a naturally curious person who always wants to find a way.

I think a better way will be to build in functionality so that if the line dips below zero in any month (i.e they have a loss at any time), then draw the line in red else draw it in black

I really appreciate your help.


WF 81.5, Windows7
AS/400 Database.
All Outputs

 
Posts: 46 | Registered: November 26, 2008Report This Post
Virtuoso
posted Hide Post
I do agree with you, but this is where you have to show options to your client such as below 3 options (and may have other) :

1- ON GRAPH SET LOOKGRAPH VLINE2S
2- ON GRAPH SET LOOKGRAPH VBAR2AXS
3- ON GRAPH SET LOOKGRAPH VBAR (when both measures have similar range)

ENGINE INT CACHE SET ON
-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 SEATS
COMPUTE COST/D5=IF COUNTRY EQ 'ITALY' THEN RETAIL_COST *  -1 ELSE RETAIL_COST ;
BY CAR.ORIGIN.COUNTRY
ON GRAPH PCHOLD FORMAT PNG
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 0
ON GRAPH SET GRXAXIS 1
-*********************************
-*GRAPH OPTION TO CONSIDER
ON GRAPH SET LOOKGRAPH VLINE2S
-*ON GRAPH SET LOOKGRAPH VBAR2AXS
-*ON GRAPH SET LOOKGRAPH VBAR
-*********************************
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, $
*GRAPH_SCRIPT
setAxisAssignment( $0, 0);
setAxisAssignment( $1, 1);
setUseSeriesShapes(true);
setMarkerSizeDefault(50);
setReportParsingErrors(false);
setSelectionEnableMove(false);
setSeriesType(0,0);
*END
ENDSTYLE
END
-RUN

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


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
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report 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     [CLOSED] Align both Axis on Dual Axis Graph

Copyright © 1996-2020 Information Builders