Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Java
 QCChart2D for Java
 Legend Resize Off Viewable Area
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rlandfair

3 Posts

Posted - 07 Jul 2008 :  13:53:33  Show Profile  Reply with Quote
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.

quinncurtis

1164 Posts

Posted - 07 Jul 2008 :  14:38:25  Show Profile  Reply with Quote
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.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07