Focal Point
[SOLVED] Graph assigning field to Y2 axis

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

September 04, 2015, 01:39 PM
SWES
[SOLVED] Graph assigning field to Y2 axis
Hello,

I have a stacked dual chart where I would like to assign FIELDC to the Y2 axis. At this point I have FIELDB assigned to it.
I know it's something to do with setAxisAssignment(getSeries(2),2); but how could I let FIELDA + FIELDB use the Y1 axis and FIELDC use the Y2 axis? Thank you.

 GRAPH FILE HOLD
SUM FIELDA
    FIELDB
    FIELDC
BY YEAR      NOPRINT
BY MONTH_DIG NOPRINT
BY MONTH_TXT AS ''
HEADING
"MULTIGRAPH</1 &DATTIT</1"
ON TABLE HOLD AS H1 FORMAT HTMTABLE
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 VLINSTK2
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 3
ON GRAPH SET GRAPHSTYLE *
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTransparentBorderColor(getChartBackground(),true);
setPlace(true);
setDepthRadius(0);
setDepthAngle(0);
setTextString(getY1Title(),"Number");
setTextString(getY2Title(),"Percentage %");
setDisplay(getY1Title(),true);
setDisplay(getY2Title(),true);
setTextString(getX1Title(),"");
setFillColor(getLegendText(),new Color(0,42,77));
setFillColor(getAllText(),   new Color(0,42,77));
setFillType(getAllText(),1);
setTransparentFillColor(getAllText(),false);
setBorderColor(getY1AxisLine(),new Color(128,128,128));
setBorderColor(getY2AxisLine(),new Color(128,128,128));
setBorderColor(getO1AxisLine(),new Color(128,128,128));
setBorderColor(getFrame(),new Color(128,128,128));
setTransparentBorderColor(getFrame(),true);
setTransparentFillColor(getSeries(0),false);
setFontName(getX1Label(),"Arial");
setFontName(getY1Label(),"Arial");
setFontName(getY2Label(),"Arial");
setGridStyle(getY1MajorGrid(),0);
setDisplay(getY2MajorGrid(),false);
setTransparentFillColor  (getAllSeries(),true);
setTransparentBorderColor(getAllSeries(),true);
setSeriesType(1,2);
setSeriesLooping(3);
setDisplay(getLegendArea(),true);
setMarkerShape(getAllSeries(),0);
setTransparentFillColor(getFrame(),true);
setFontName(getReferenceLineTextY1(0),"Arial");
setAxisSide(getY2Axis(),1);
setTextFormatPattern(getY1Label(),"");
setTextFormatPattern(getY2Label(),"");
setAxisAssignment(getSeries(2),2);
setScaleMaxAuto(getY2Axis(),false);
setBorderColor(getY2MajorGrid(),new Color(128,128,128));
setBorderColor(getY1MajorGrid(),new Color(128,128,128));
setBorderColor(getO1MajorGrid(),new Color(128,128,128));
setBorderColor(getY1ZeroLine() ,new Color(128,128,128));
setBorderColor(getY2ZeroLine() ,new Color(128,128,128));
setFillColor(getX1Title(),new Color(0,42,77));
setFillColor(getY1Title(),new Color(0,42,77));
setFillColor(getY2Title(),new Color(0,42,77));
setFillColor(getX1Label(),new Color(0,42,77));
setFillColor(getY1Label(),new Color(0,42,77));
setFillColor(getY2Label(),new Color(0,42,77));
setFillColor(getSeries(0),new Color(0,35,80));
setFillColor(getSeries(1),new Color(41,109,133));
setFillColor(getSeries(2),new Color(211,184,148));
ENDSTYLE
ON GRAPH SET STYLE * 

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


WebFOCUS 8105m
Windows 7, All Outputs

Member of the Benelux Usergroup
September 04, 2015, 05:18 PM
<nick z>
Hello,
Try the following:
  
setAxisAssignment( $0, 0);
setAxisAssignment( $1, 0);
setAxisAssignment( $2, 1);


And make sure to comment out or delete setAxisAssignment(getSeries(2),2);

Thanks.
Nick.
September 07, 2015, 08:28 AM
SWES
Thank you Nick, I made some changes, but I'm not there yet..

I changed the following as per your suggestion:

setAxisAssignment((0),0);
setAxisAssignment((1),0);
setAxisAssignment((2),2);

and also ON GRAPH SET LOOKGRAPH VLINSTK2 to ON GRAPH SET LOOKGRAPH VLINE2 (not sure which one I should use?)

Now the following I wish for:

FIELDA uses axis Y2 where it should make use of the same axis as FIELDA (Y1)
FIELDC uses axis Y1, where I would like to have it use axis Y2 with automatic scaling: the range is from +/- 94 to 100.

Pfff WebFOCUS and Graphs...


 GRAPH FILE HOLD
SUM FIELDA
    FIELDB
    FIELDC
BY YEAR       NOPRINT
BY MONTH_DIG  NOPRINT
BY MONTH_TXT  AS ''
HEADING
"MULTIGRAPH</1 &DATTIT</1"
ON TABLE HOLD AS H1 FORMAT HTMTABLE
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET HAXIS 950
ON GRAPH SET VAXIS 425
ON GRAPH SET LOOKGRAPH VLINE2
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 3
ON GRAPH SET GRAPHSTYLE *
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTransparentBorderColor(getChartBackground(),true);
setPlace(true);
setDepthRadius(0);
setDepthAngle(0);
setTextString(getY1Title(),"Number");
setTextString(getY2Title(),"Percentaeg");
setDisplay(getY1Title(),true);
setDisplay(getY2Title(),true);
setTextString(getX1Title(),"");
setFillColor(getLegendText(),new Color(0,42,77));
setFillColor(getAllText(),   new Color(0,42,77));
setFillType(getAllText(),1);
setTransparentFillColor(getAllText(),false);
setBorderColor(getY1AxisLine(),new Color(128,128,128));
setBorderColor(getY2AxisLine(),new Color(128,128,128));
setBorderColor(getO1AxisLine(),new Color(128,128,128));
setBorderColor(getFrame(),     new Color(128,128,128));
setTransparentBorderColor(getFrame(),true);
setTransparentFillColor(getSeries(0),false);
setFontName(getX1Label(),"Arial");
setFontName(getY1Label(),"Arial");
setFontName(getY2Label(),"Arial");
setTextFormatPattern(getY1Label(),"");
setTextFormatPattern(getY2Label(),"");
setGridStyle(getY1MajorGrid(),0);
setDisplay(getY2MajorGrid(),false);
setTransparentFillColor  (getAllSeries(),true);
setTransparentBorderColor(getAllSeries(),true);
setAxisAssignment((0),0);
setAxisAssignment((1),0);
setAxisAssignment((2),2);
setDisplay(getLegendArea(),true);
setMarkerShape(getAllSeries(),0);
setBorderColor(getY2MajorGrid(),new Color(128,128,128));
setBorderColor(getY1MajorGrid(),new Color(128,128,128));;
setBorderColor(getO1MajorGrid(),new Color(128,128,128));
setBorderColor(getY1ZeroLine() ,new Color(128,128,128));
setBorderColor(getY2ZeroLine() ,new Color(128,128,128));
setFillColor(getX1Title(),new Color(0,42,77));
setFillColor(getY1Title(),new Color(0,42,77));
setFillColor(getY2Title(),new Color(0,42,77));
setFillColor(getX1Label(),new Color(0,42,77));
setFillColor(getY1Label(),new Color(0,42,77));
setFillColor(getY2Label(),new Color(0,42,77));
setFillColor(getSeries(0),new Color(0,35,80));
setFillColor(getSeries(1),new Color( 41,109,133));
setFillColor(getSeries(2),new Color(211,184,148));
ENDSTYLE
ON GRAPH SET STYLE * 



WebFOCUS 8105m
Windows 7, All Outputs

Member of the Benelux Usergroup
September 09, 2015, 07:47 AM
SWES
Found it:

 setSeriesType(3,2);
setAxisAssignment(0,0);
setAxisAssignment(1,0);
setAxisAssignment(2,1);
setSeriesType(2,2);
setScaleMaxAuto(getY2Axis(),false);
setY2ScaleMax(100); 



WebFOCUS 8105m
Windows 7, All Outputs

Member of the Benelux Usergroup