## Chart Object Methods

Print

This is a method without arguments. It causes the chart to be printed on the currently-selected printer. The chart will fill as much of the page size set using the APLX Page Setup dialog as it can, within the margins set in the Preferences dialog and any extra margins set using the chart's margin property, whilst keeping the same aspect ratio as the chart has on screen.

Copy

This is a method without arguments. It causes the chart to be copied to the clipboard as a picture. Under Windows, it is copied as a Windows metafile, so for example you can paste it into Microsoft Word as a resizable image. Under MacOS, it is copied as a PICT object. Under Linux it is copied as a bitmap.

Save filename [type]

This method causes the chart to be saved to a graphics file. The `filename` parameter is the full path of the file to be written. Alternatively, it can be an empty vector, in which case a standard file dialog is displayed to allow the user to choose the name. The optional `type` parameter can be one of the following:

0 : Write the file using the native vector graphics format of the host (not supported under Linux):

Under Windows the vector format used is the Windows Enhanced Metafile (`.emf`). Under Macintosh OS X the vector format used is a PICT file.

1 : Write the file in a bitmap format (not supported under MacOS).

The format used is a Windows-style bitmap file (`.bmp`).

2 : Write the file in Scalable Vector Graphics (SVG) format.

The default is 0 for Windows and Macintosh, 1 for Linux.

Note: If you want to save the chart in a different format, for example as a GIF, you can do this using an Image object. To do this, you need to read the `bitmap` property of the Chart, write this to the `bitmap` property of the Image, set the Image `format`, and then call the `Save` method of the Image.

Draw keyword param1 param2..

The Draw method is fully implemented for Chart objects, allowing you to customize the chart by adding your own graphic elements and annotations. These are displayed after the main chart has been drawn. You can also draw in the X and Y coordinate system of the chart. See the section on Customising Charts below.

Pointtochart Y X
Pointtochartalt Y X

These two methods convert a point (Vertical and Horizontal values in the current scale of the control), to the coordinates of the chart (either the equivalent Y and X value of the main axis, or the Alternate Y and X axis). The argument is a two-element numeric vector of Y, X, and a two-element numeric vector is returned.

These two methods are particularly useful for responding the mouse-down events on the chart. For example, you might want to display an information panel if a point on the chart is clicked. If you set the scale property to 5 (pixels), these methods directly convert the pixel position on the control to the coordinates of the chart.

Chartalttopoint Y X
Charttopoint Y X

These methods carry out the inverse transformation, from chart coordinates to a point on the control, expressed in the current scale of the control (you will probably want to set the scale property to 5 for pixels). They can be useful if you are adding your own annotations or other graphic elements using the `Draw` method.

Topic: APLX Help : System Classes : The Chart and Series Objects : Chart Object Methods

[ Previous | Next | Contents | Index ]