Author |
Topic  |
|
javaman
22 Posts |
Posted - 10 Feb 2009 : 19:08:10
|
Can someone show me how to place a legend to the left of the plot without running into the plot. I am able to place the legend all the way to the left, but the legend paints over the plot itself (which is placed to the right of the legend). Is there anyway to ensure that the legend does not bleed into the plot?
If you need source code, please let me know...
Thanx - Joe! |
|
quinncurtis
1164 Posts |
Posted - 10 Feb 2009 : 23:50:54
|
It is not clear what you want. Is it that you don't have enough room to the left of the plot for the legend ? Positioning the plotting area within the overall graph area is the function of the coordinate systems setGraphBorderDiagonal method, used in every example program and discussed in the manual. The first parameter, x1, controls the placement of the left edge of the plotting area with respect to the overall graph area. Increase this value if you want more room on the left.
double x1 = 0.3, y1 = 0.1, x2 = 0.7, y2 = 0.85; pTransform1.setGraphBorderDiagonal(x1, y1, x2, y2);
|
 |
|
javaman
22 Posts |
Posted - 11 Feb 2009 : 18:18:19
|
Hmmmm... I thought what I wrote was abundantly clear. I have the legend which is X wide. I have the plot which is Y wide. The legend is placed to the left of the plot. Unfortunately, the legend overwrites onto the plot when the result is drawn. How do I enforce a rule between the two entities to not overwrite each other? In Swing I could do this quite easily by putting the legend in a panel to the west and the plot in a panel in the center. The two would not overwrite each other and the window would adjust itself to fit both items adequately. Since the legend is a component of the plot - I don't have the ability to place them like this.
Since there is no documentation in your code and no javadocs, I don't like to just fiddle with the coordinates to find a combination - not that I haven't tried.
Please show me some code where the legend is place to the left (directly left) of the plot w/o running into the plot.
Thanx... JOe... ps -> try not to be so snarky in your comments - it's your company's fault for not providing adequate javadocs and comments that cause these seemingly "simple" questions to come up.
Thanx - Joe! |
 |
|
quinncurtis
1164 Posts |
Posted - 11 Feb 2009 : 19:19:50
|
We are sorry you are offended by our customer support. It happens very seldom.
There are javadocs on every class in the software. The documentation describes how to access them in the Compiling and Running the Demo progams chapter, page 260 of the QCChart2D for Java manual.
There is no way to automatically position the graph to take into account legends of arbitrary width placed to the left of the graph, like the Swing panels you describe. You might try and place a graph in one JPanel, and a legend in another, and use Swing to position them next to one another. I don't know how that would look.
If it is an absolute requirement that you place the legend to the left of the graph, the best we can suggest is place the starting edge of the plotting area far enough to the right to allow for the legend of maximum width. As we said earlier, that is done by make the x1 parameter of the setGraphBorderDiagonal large enough to leave enough room for the legend.
double x1 = 0.4, y1 = 0.1, x2 = 0.7, y2 = 0.85; pTransform1.setGraphBorderDiagonal(x1, y1, x2, y2);
You can easily do this in your own program.
|
 |
|
|
Topic  |
|
|
|