Focal Point
WF Graph - X-axis label getting cropped in graph
November 20, 2013, 01:08 PM
Francis MarianiWF Graph - X-axis label getting cropped in graph
The x-axis labels get cropped, particularly when rotated 90 degrees.
I get this problem very often and other than changing the font-size, I haven't found a definitive solution.
Setting the graph frame size makes no difference.
I always thought this sets the graph frame to the max:
setRect(getFrame(), new Rectangle(-16000,-16000,32000,32000)); // Set the graph display area to be the entire canvas
Why does this problem occur? And how do I definitively solve it? Is there no way to specify space for the x-axis labels, something using setRect?
Thanks,
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 20, 2013, 01:45 PM
Francis MarianiWell, it looks like this works - reducing the margin:
// Define the margin to draw around the entire chart. The default value is (-15500, -15500, 31000, 31000)
// this solves the problem with x-axis label cropping
setPlaceMargin(new Rectangle (-15500, -14500, 32000, 30000));
For some annoying reason, disabling the Legend requires increasing/reducing??? the margin even further:
// Define the margin to draw around the entire chart. The default value is (-15500, -15500, 31000, 31000)
// this solves the problem with x-axis label cropping
setPlaceMargin(new Rectangle (-15500, -13700, 32000, 30000));
I have never understood the Cartesian Coordinate System:
quote:
To plot a point in the Cartesian Coordinate System, you must provide at least two coordinates
(X,Y). In WebFOCUS Graphics, four coordinates are required to plot a rectangle such as the
Frame Rectangle or Legend Rectangle—X, Y, Width, and Height. The first two coordinates
(X,Y) control the point location of the bottom left corner of the rectangle, while the last two
coordinates control the width and height of the rectangle.
How this works with the graph margin I don't know, I also don't know what the graph margin is and including/excluding the graph legend affects the x-axis labels.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 21, 2013, 04:38 AM
Wep5622I don't suppose you're unclear that Rectangles are defined as this?:
new Rectangle(X, Y, WIDTH, HEIGHT);
I have no idea where you found that scrap of documentation, but if that's all of it it's omitting to mention
anything about the units used in that coordinate system, where the origin is located relative to the GRAPH drawing area or in what directions those coordinates go.
I suspect that the origin is actually located at the top-left corner of the GRAPH, with the X-axis pointing to the right (as usual) and the Y-axis pointing down (not so usual). This is a common axis definition on computer screens and in printing.
As for the scale - I have no idea. Points would make some sense, but I don't think that's what we're looking at here:
Computer screens are generally defined as 72 dpi, meaning 1 inch would cover 72 points. With a width and height of 32000 and 30000 respectively, that would make a rather large GRAPH. I don't think I'd like a display capable of displaying that.
But even if you'd consider measuring the GRAPH as if it were to be printed on paper, in printing, resolution on paper is generally defined as 300 dpi - that would still measure a GRAPH of over 100" wide. I'm sure management would love to see there graphs as billboards, but that does seem a bit over the top...
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
November 21, 2013, 04:56 AM
Tony AFrancis,
Check out the documentation
here and click on the link for "How Does WebFOCUS Graphics Use the Virtual Coordinate System?"
T
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | | |
WebFOCUS App Studio 8.2.06 standalone on Windows 10 | |
November 21, 2013, 08:22 AM
Wep5622To summarize that lengthy document:
- GRAPHs use a virtual coordinate system
- The dimensions of the GRAPH in this virtual coordinate system are ALWAYS 32000x32000 "units", regardless of the dimensions of the actual GRAPH area or the specified unit for those dimensions.
- The direction of the X-axis is from left to right.
- The direction of the Y-axis is from bottom to top.
- The origin O (0,0) is at the CENTER of the virtual coordinate system.
Hence, the corners of the GRAPH are at coordinates:
(-16000, -16000) for top-left,
(16000, -16000) for top-right,
(16000, 16000) for bottom-right and
(-16000, 16000) for bottom-left.
A consequence of this virtual coordinate system is that the size of GRAPH elements, expressed in "virtual units", scales with the size of the GRAPH area.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
November 21, 2013, 10:56 AM
Francis MarianiI'm too old for this virtual world. I like concrete.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 21, 2013, 10:58 AM
Francis MarianiSo, there is a great explanation regarding the virtual coordinate system. That doesn't explain why excluding the legend from a graph causes the rotated x-axis labels to get cut off, and why reducing (or increasing - I don't know which I'm actually doing) the margin solves the problem.
Cheers, thanks a lot.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server