Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Tools for Java
 QCChart2D for Java
 Legend Resize Off Viewable Area

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
rlandfair Posted - 07 Jul 2008 : 13:53:33
I am having an issue with the legend going off the viewable area when the font size is large. Currently, the font is set to 32 and the legend will go off the viewable area most of the time when the component is being resized. There is no issue when the font size is 14. paintComponent is being overridden with the code below:

public void paintComponent (Graphics g) {
super.paintComponent(g);
// If the height is greater than the width, put pie on top of legend
// Otherwise put pie and legend side by side
if (pTransform1 != null) {
if (getHeight() > getWidth()) {
pTransform1.setGraphBorderDiagonal(0.05, .05, .95, 0.5);
getLegend().setLocation(.1, .52);
getLegend().setLegendWidth(.38);
} else {

pTransform1.setGraphBorderDiagonal(0.05, .05, .5, 0.95);
getLegend().setLocation(.52, .1);
getLegend().setLegendWidth(.90);
}
}
}

Here is how the legend gets setup:

private StandardLegend getLegend()
{
if (m_oLegend == null)
{
ChartAttribute legendAttributes = new ChartAttribute(Color.black, 1,
ChartConstants.LS_SOLID, Color.white);
legendAttributes.setLineFlag(true);
m_oLegend = new StandardLegend(0.52, 0.1, 0.38, 0.5, legendAttributes,
StandardLegend.VERT_DIR);
}
return m_oLegend;
}

And here is how items are added (the nullsymbol is to trick the legend into looking like multiple lines):
for (i = 0; i < data.length; i++)
{
getLegend().addLegendItem(sPieStringsLineOne[i], ChartConstants.SQUARE, attribs[i], font32);
getLegend().getLegendItem(getLegend().getNumLegendItems()-1).getLegendItemSymbol().setSymbolSize(20);
getLegend().addLegendItem(sPieStringsLineTwo[i], ChartConstants.HBAR, nullsymbol, font32);
}

Is there anything that can be done to get this to work or something to try? I have tried as much as I can and nothing seems to help.
1   L A T E S T    R E P L I E S    (Newest First)
quinncurtis Posted - 07 Jul 2008 : 14:38:25
There isn't anything we can suggest based on this information. We will need a complete example to explore your problem further. If you are permitting the resize of the chart to change the aspect ratio of the plot area, that is very problematic. You should try and maintain the same aspect ratio. That will guarantee that everything is resized proportionally. Is your manipulation of the plot area in the paintComponent method an attempt to solve the problem, or the cause?

Modify our LinePlotSalesVolume example program (or whatever is closest) to reproduce your problem and send that as an attachment to support@quinn-curtis.com. If we can reproduce the problem we may be able to offer other suggestions.

Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07