Frequently Asked Questions

Resize the Chart Frame?

The chart frame needs to be resized with the given object. The object can be obtained with the getFrame() method. The following example shows now to resize the chart frame:

setRect (getFrame(), new Rectangle (-10391,-8422, 19800, 17600));
setDisplay (getFrame(), true);
setBorderColor (getFrame(), new Color (255,0,0));
setGraphType (106);

Note that the setBounds() method only works if you are using pure Java with a compiler and are placing the chart inside another element (like a window or a frame). From HTML, it would not have any affect at all. See Chapter 3 for details on the coordinate system that Perspective uses. Chapter 3 also includes examples of other rectangles that can be set.

Size/Position the Legend Area?

Here is an example of setting the legend size and position:

setRect (getLegendArea(), new Rectangle (-14180,-12600,25072,3063));

Note that the setBounds() method only works if you are using pure Java with a compiler and are placing the chart inside another element (like a window or a frame). From HTML, it would not have any affect at all. See Chapter 3 for details on the coordinate system that Perspective uses. Chapter 3 also includes examples of other rectangles that can be set.

Change Font Size?

Here are some examples of setting font size:

setFontSizeVC (getDataText(),1000);
setFontSizeVC (getFootnote(),1100);
setFontSizeVC (getLegendText(),1100);
setFontSizeVC (getO1Label(),1100);

For each of these, you must turn the autofit parameter OFF, by inserting the appropriate autofit command before the size command. Example:

setAutofit (getDataText(),false);
setAutofit (getFootnote(),false);
setAutofit (getLegendText(),false);
setAutofit (getO1Label(),false);

EXAMPLE:

setDataTextDisplay (true);
setAutofit (getDataText(),false);
setAutofit (getFootnote(),false);
setAutofit (getLegendText(),false);
setAutofit (getO1Label(),false);
setFontSizeVC (getDataText(),1000);
setFontSizeVC (getFootnote(),1200);
setFontSizeVC (getLegendText(),1300);
setFontSizeVC (getO1Label(),1400);

Change Font Names?

The following examples show how to set the font name:

setDataTextDisplay (true);
setFontName (getDataText(),"Verdana");
setFontName (getFootnote(),"Times New Roman");
setFontName (getLegendText(),"Arial Black");
setFontName (getO1Label(),"Helvetica");

Get Example HTML Code?

If you want examples of HTML, there is a very easy way! Run the TDGChartEditorApplet, move the chart around, etc. and then select "Save" from the menu item. The file that is saved is a text file; you can cut and paste anything from it into HTML (or, for that matter, into Java code).

Change Color and Thickness of a Curve-Fit Line?

The following example code shows how change the color and thickness of a curve-fit line.

setCurveFitType (1,11);
setFontStyle (getCurveFitEquationText(), 3);
setFillColor (getCurveFitEquationText(), new Color (0,0,255));
setBorderColor (getCurveFitLineRiser (1), new Color (255,0,0));
setLineWidth (getCurveFitLineRiser (1), 5);