Focal Point
[closed] Graph Questions

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

December 12, 2016, 05:38 PM
Enigma006
[closed] Graph Questions
Hi

I have sample data like this and I am able to achieve 75% of the graph request.

F1 has 3 unique values and 3 lines are needed. F2 which is year is in X-axis.
F3 and F4 are two Y-axis.
F5 has same value for every record and just one line is needed in the graph and it should match the F4 axis.
F1 F2  F3 F4   F5
A 2004 60 2.37 3 
A 2005 70 1.81 3 
B 2004 40 1.81 3 
B 2005 50 1.81 3 
C 2004 10 1.81 3 
C 2005 20 1.67 3 



GRAPH FILE G1
SUM
F3
F4
BY F1 AS ''
ACROSS F2 AS ''
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HAXIS 1100
ON GRAPH SET VAXIS 600
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VLINE2
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
END


I am not able to achieve F5 goal.
And I want just A, B, C to show up in legend with their line symbols. But I am seeing 6 things in the legend with A,B, C appearing twice.
And in the X-axis, I see year appearing thrice instead of just once so that user can know its all same year. Any way to make it appear once?
Any suggestions?

Thanks

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


8.1.05
HTML,PDF,EXL2K, Active, All
December 13, 2016, 08:42 AM
MartinY
The BY field is your X-axis
The SUM fields are your Y-axis
Then your ACROSS fields "become" a Z-axis or in case of multi-graph, another graph.

What I thing you're trying to do is the something such as the following where your F5 is a threshold.
But I don't know where to put your ACROSS F2-Year except if it's used to become a multi-graph.

COUNTRY = F1
SALES = F3
SEATS = F4
Reference line (threshold) = F5

-SET &TRHOLD = 10;

GRAPH FILE CAR
SUM SALES
   SEATS
BY COUNTRY AS ' '
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 VLINE2
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);
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);
setGridStepAuto(getY1MajorGrid(),false);
setScaleMax(getY1Axis(),100.0);
setGridStep(getY1MajorGrid(),25.0);
setGridStepAuto(getY2MajorGrid(),false);
setGridStep(getY2MajorGrid(),25.0);
setScaleMinAuto(getY2Axis(),false);
setScaleMin(getY2Axis(),0.0);
setDisplay(getY2AxisLine(),true);
setDisplayOffScale(getY2Axis(),true);
setLineWidth(getY1MajorGrid(),0);
setDisplay(getY1MinorGrid(),false);
setDisplay(getY1MajorGrid(),true);
setScaleMinAuto(getY1Axis(),false);
setDisplay(getY2ZeroLine(),false);
setScaleMustIncludeZero(getY2Axis(),false);
setScaleMaxAuto(getY2Axis(),false);
setScaleMax(getY2Axis(),100.0);
setDisplay(getY2Title(),true);
setTextRotation(getY2Title(),1);
setFontSizeAbsolute(getO1Label(),true);
setFontSizeInPoints(getO1Label(),10);
setDisplay(getO1Label(),true);
setDisplay(getY1Label(),true);
setTextString(getY2Title(),"");
setPlace(false);
setScaleMaxAuto(getY1Axis(),true);
setReferenceLineValueY1(0,18000.0);
setTextRotation(getO1Label(),0);
setDisplay(getLegendArea(),true);
setDepthRadius(0);
setDepthAngle(0);
setLegendPosition(0);
setLineBasicStrokeType(getReferenceLineY1(0),14);
setLineWidth(getReferenceLineY1(0),1);
setBorderColor(getReferenceLineY1(0),new Color(255,0,0));
setFillColor(getReferenceLineY1(0),new Color(0,0,0));
setFillColor(getReferenceLineTextY1(0),new Color(255,0,0));
setDisplay(getReferenceLineY1(0),false);
setBorderColor(getReferenceLineY2(0),new Color(255,0,0));
setFillColor(getReferenceLineTextY2(0),new Color(255,0,0));
setDisplay(getReferenceLineY2(0),true);
setLineBasicStrokeType(getReferenceLineY2(0),14);
setReferenceLineValueY2(0,&TRHOLD);
setTextString(getReferenceLineTextY2(0),"Seats threshold");
setDisplay(getReferenceLineTextY2(0),true);
setReferenceTextPosition(getReferenceLineTextY2(0),2);
ENDSTYLE
END



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
December 13, 2016, 02:14 PM
Enigma006
Thanks Martin. I tried this and the reference line helped me. I got to keep the ACROSS.
  
GRAPH FILE G1
SUM
F3
F4
BY F1 AS ''
ACROSS F2 AS ''
setFillColor(getSeries(0),new Color(103,204,306));
END

F3 and F4 are 2 axis (SUM fields) and F1 has 3 unique values as mentioned. So I am having legend like below.
  A:F3   A:F4   B:F3    B:F4   C:F3   C:F4 



It's like repetition but technically correct. Any way to disable legend and provide custom legend?
Also, I am not able to change series color with provided line of code.
Wish the graphing tool was easy.


8.1.05
HTML,PDF,EXL2K, Active, All
December 13, 2016, 03:04 PM
MartinY
Since it seems that you want to have a year comparison why not doing it similar to this where REGION will refer to your F2 = Year ?

Also, since it seems that multi-graph is not an option in your case, I think that a bar graph will look better to compare years (F2)

-SET &TRHOLD = 22000;

DEFINE FILE CAR
REGION /A10 = DECODE COUNTRY ('FRANCE' 'East' 'ITALY' 'East' 'ENGLAND' 'East' 'W GERMANY' 'West' 'JAPAN' 'West');
END
GRAPH FILE CAR
SUM SALES       AS 'Sales'
    DEALER_COST AS 'Dealer Cost'
BY REGION  AS ''
BY COUNTRY AS ''
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HAXIS 870
ON GRAPH SET VAXIS 605
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 2
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
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);
setGridStepAuto(getY1MajorGrid(),false);
setDisplay(getY2AxisLine(),true);
setDisplayOffScale(getY2Axis(),true);
setLineWidth(getY1MajorGrid(),0);
setDisplay(getY1MinorGrid(),false);
setDisplay(getY1MajorGrid(),true);
setFontSizeAbsolute(getO1Label(),true);
setFontSizeInPoints(getO1Label(),10);
setDisplay(getO1Label(),true);
setDisplay(getY1Label(),true);
setPlace(false);
setDepthRadius(0);
setDepthAngle(0);
setLineWidth(getReferenceLineY1(0),1);
setFillColor(getReferenceLineY1(0),new Color(0,0,0));
setBorderColor(getReferenceLineY1(0),new Color(255,0,0));
setFillColor(getReferenceLineTextY1(0),new Color(255,0,0));
setDisplay(getReferenceLineY1(0),true);
setLineBasicStrokeType(getReferenceLineY1(0),14);
setReferenceLineValueY1(0,&TRHOLD);
setTextString(getReferenceLineTextY1(0),"Sales threshold");
setDisplay(getReferenceLineTextY1(0),true);
setReferenceTextPosition(getReferenceLineTextY1(0),2);
setDisplay(getO1Title(),false);
ENDSTYLE
END



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