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     [CLOSED] Dual Axis Chart - Negative Values on One Side
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Dual Axis Chart - Negative Values on One Side
 Login/Join
 
Platinum Member
posted
Hey all,

I'm trying to figure out how to get the 0 values on a dual axis chart scale to be in unison with one and other. with all positive values, this works fine. Not so much with negative values. Here's the car file I'm playing around with.

Does anyone have ideas? It looks like you can be clever with the way the scales calculate. If there's a simpler solution, I'd love to hear what it is Smiler .

 GRAPH FILE car
SUM 
	COMPUTE cost_new/D12.2=IF COUNTRY EQ 'FRANCE' THEN  -2000 ELSE 7400000;
	CAR.CAR.SEATS
BY CAR.CAR.COUNTRY
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VBAR2AX
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setPlace(true);
setCurveFitEquationDisplay(false);
*END
INCLUDE=Warm.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setAxisAssignment( $0, 0);
setAxisAssignment( $1, 1);
*GRAPH_JS_FINAL
"pieProperties": {
    "holeSize": "0%"
},
"agnosticSettings": {
    "dual": true,
    "chartTypeFullName": "Bar_Clustered_Dual_Axis"
}
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH
 


Thanks in advance!!

This message has been edited. Last edited by: Brandon Andrathy,


WebFOCUS 8204
 
Posts: 102 | Registered: July 10, 2018Reply With QuoteReport This Post
Expert
posted Hide Post
My initial thought is for DEFINE cost_new instead of using COMPUTE. Then SUM cost_new and use cost_new as you first sort with a NOPRINT. Let me know if that works. Otherwise, please be more specific in your requirement.

Or, do you really want a dual axis chart in the first place. What you provided is just bar chart with the sum of two differ fields.

Also please use 'closer number' such as '-2000 and 4000', instead of "-2000 and 7400000" just for visual clarity. You may also want to use AUTOSIZE.
 
Posts: 3066 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Platinum Member
posted Hide Post
I'm thinking that the following post is the issue you are trying to solve:
Align both Axis on Dual Axis Graph
Unfortunately, the conclusion is that they don't think it is possible, but there are some suggestions of alternatives.


WF 8.2.06
Win10 / IE11
AHTML EXL2K PDF
 
Posts: 159 | Registered: October 19, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
If the Align both Axis on Dual Axis Graph post explains the issue, then I think that this is possible. I think that both axis of the dual axis chart should use the min and max of the combined values. That is to say, take the max used for each half of the dual/two charts and the same for the min. That way both are using the same min and max, thus they should be the same with the zero lined up equally. You'll need to account for the zeros and missing values...

It sounds like an interesting challenge that I don't really have time ti accept without verification of and elaboration on the initial requirements. Perhaps an image of what is desired as the final result would help. I just can't imagine it now...
 
Posts: 3066 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Dual Axis charts in general are hard to read and are often misleading. https://blog.datawrapper.de/dualaxis/

However, one way to make Y1 and Y2 have the same 0 line, is to force them to have the same minimum and maximum. In severe cases, that might cause one side to be comparatively so small that you'll hardly be able to read them. But if that's the spec you've been given here's an example. Find out the top and bottom range of one chart and set it to be the same on the other.

  

ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
-DEFAULTH &WF_HTMLENCODE=OFF;
SET HTMLENCODE=&WF_HTMLENCODE

SET ARGRAPHENGINE=JSCHART
-DEFAULTH &WF_EMPTYREPORT=ON;
SET EMPTYREPORT=&WF_EMPTYREPORT

SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_ARVERSION=2;
SET ARVERSION=&WF_ARVERSION

-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';

-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE ibisamp/car
-* Created by Info Assist for Graph
SUM COMPUTE TESTVAL/D12.2=IF COUNTRY EQ 'FRANCE' THEN -5000 ELSE SALES;
CAR.BODY.RETAIL_COST
BY CAR.ORIGIN.COUNTRY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO 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 LOOKGRAPH BAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT

setPieDepth(0);
setPieTilt(0);
setDepthRadius(0); 
setCurveFitEquationDisplay(false); 
setPlace(true); 

*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, ORIENTATION=LANDSCAPE, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=y-axis(1), $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis(2), $
*GRAPH_SCRIPT

setReportParsingErrors(false);
setSelectionEnableMove(false);
setScaleMinAuto(getY2Axis(),false);
setScaleMin(getY2Axis(),-20000.0);
setScaleMaxAuto(getY2Axis(),false);
setScaleMax(getY2Axis(),100000.0);
*GRAPH_JS_FINAL
"pieProperties": {
"holeSize": "0%"
},
"agnosticSettings": {
"dual": true,
"chartTypeFullName": "Bar_Clustered_Dual_Axis"
}

*END
ENDSTYLE
END

-RUN



WebFOCUS 8206, Unix, Windows
 
Posts: 1821 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Thank you Babak. Yeah I considered the option you proposed. Unfortunately the numbers are very different between the two axes. Agreed they are hard to read.

Figured I'd ask.

Appreciate it! I'll go ahead and close this out


WebFOCUS 8204
 
Posts: 102 | Registered: July 10, 2018Reply With QuoteReport This Post
Expert
posted Hide Post
BabakNYC, Pulls thru again... Smiler
I lkie the dual use of the axis. Still needed, to accomplish this, is the min and max values to get the zero value to line-up as requested.
TYPE=DATA, COLUMN=N2, BUCKET=y-axis(1), $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis(2), $
. . .
setScaleMinAuto(getY2Axis(),false);
setScaleMin(getY2Axis(),-20000.0);
setScaleMaxAuto(getY2Axis(),false);
setScaleMax(getY2Axis(),100000.0);
 
Posts: 3066 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Dual Axis Chart - Negative Values on One Side

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