JClass Chart 3D

PreviousNextIndex

Appendix  C

Additional Common JClass Chart 3D 3D Methods

Chart3D  Chart3d.Event

This appendix summarizes the JClass Chart 3D 3D extra methods for all commonly used classes, in alphabetical order.

C.1 Chart3D

C.1.1 Chart3dDataView

Name

Description

coordToDataCoord

Same as map(). Converts pixel coordinates to data space coordinates.

Parameters:

x - x value in screen pixels.

y - y value in screen pixels.

Returns:

Point3d instance.

dataCoordToCoord

Same as unmap(). Converts data coordinates to pixel coordinates.

Parameter:

point - The point in 3d data space to be transformed.

Returns:

AWT Point object representing the location in screen pixels (relative to the Chart 3D component).

dataIndexToCoord

Similar to unpick() for a specific this specific data view. Converts a JCData3dIndex instance (containing a data view and a point index for either grid data or point data) to pixel values relative to the Chart 3D component.

Parameter:

index - Object representing the index of the point to unpick. This is either a JCData3dGridIndex representing the (x, y) index of grid data point or a JCData3dPointIndex representing the (series, point) index of a point in a point data set.

Returns:

AWT Point object representing the location is screen pixels relative to the Chart 3D component.

coordToDataIndex

Similar to pick() for a specific data view. Converts pixel values relative to the Chart 3D component to a JCData3dIndex instance representing the index of the picked point. This is either a JCData3dGridIndex representing the (x, y) index of grid data point or a JCData3dPointIndex representing the (series, point) index of a point in a point data set.

Parameters:

x -The X value of screen position.

y - The Y value of screen position.

Returns:

The JCData3dIndex object representing the index of the picked point.

dragZValue

Finds a new z value for a given point based on a given pixel position. Given a start point A (for grid data a point on the grid; for point data one of the points in the list of series) and a point P on the screen, project the line AP (in 3D-space) onto the line through A parallel to the z axis and find the z value that corresponds to P on the projected line.

Parameters:

data - The data for which this operation is to take place. It is either an instance of Chart3dGridData or Chart3dPointData.

index - The data index of the point. For grid data, this must be an instance of JCData3dGridIndex, which corresponds to an X- and Y-grid position specification. For point data, this must be an instance of JCData3dPoint index which corresponds to the series and point number of the point.

x - The X- value of screen position.

y - The Y-value of screen position.

Returns:

The new computed z value.

gridValue

Given grid data and an (x,y) point on the visible xy plane within the grid, do bilinear interpolation using the four closest grid points and return the corresponding z value.

Parameters:

data - The internal grid data object. This can be retrieved from a Chart3dDataView object via getElevationData() or getZoneData().

x - The X- data-space value

y - The Y-data-space value

Returns:

The interpolated z value. Returns the data's hole value if an error occurs.

C.1.2 Chart3dGridData

Name

Description

getX

Returns the X- value at the specified index.

getXClosest

Returns the index that contains the X- value closest to the specified value.

Parameter:

x - The value for which the closest index should be found.

getY

Returns the Y-value at the specified index.

getYClosest

Returns the index that contains the Y-value closest to the specified value.

Parameter:

y - The value for which the closest index should be found.

C.1.3 Chart3dPointData

Name

Description

getPoint

Returns the point indexed by pointNum in the series indexed by seriesNum.

Parameters:

seriesNum - The series index of the point wanted.

pointNum - The point index of the point wanted.

Returns:

The point indexed by series and point.

C.1.4 Chart3dPointSeries

Name

Description

getPoint

Returns the point in the points array indexed by point.

Parameter:

point - The index of the point to be returned.

Returns:

The point indexed by point.

C.1.5 JCAxis

Name

Description

getValueLabel

Retrieves the value label for the specified value from the list of user-specified value labels.

Parameter:

value - Data value corresponding to the value label.

Returns:

JCValueLabel instance.

C.1.6 JCChart3d

Name

Description

addChart3dListener

Adds listener to changes in JClass Chart 3D. Called after zoom, translate, scale, rotate, or edit (interactive only).

Parameter:

l - The listener to be added.

getDrawingArea

Gets the drawing area represented by this chart.

Returns:

Rectangle object containing drawing area.

getDrawingArea
Height

Gets the height of the drawing area represented by this chart.

Specified by:

getDrawingAreaHeight in interface com.klg.jclass.util.legend.LegendComponentLayoutUser.

Returns:

The height of the drawing area.

getDrawingArea
Width

Gets the width of the drawing area represented by this chart.

Specified by:

getDrawingAreaWidth in interface

com.klg.jclass.util.legend.LegendComponentLayoutUser.

Returns:

The width of the drawing area.

getLayoutHints

Sets and gets layout hints for chart children. Hints are rectangle objects.

A value of Integer.MAX_VALUE in the rectangle's members indicates to calculate default values during layout. Other values indicate to the layout to use that value. For example, a rectangle with members x=5, y=10, width=MAX_VALUE, and height=200, would indicate to the layout mechanism that the chart child should be placed at (5,10), have a height of 200, and use the default width. Layout hints are only used by the DefaultChartLayout layout manager.

Parameter:

child - Chart child - either the chart3dArea, legend, header, or footer.

layoutHints - Rectangle object containing the desired layout hints.

getUI

Returns and sets the UI for JCChart3d.

Overrides:

setUI in class javax.swing.JComponent.

Parameter:

newUI - The new user interface object.

getUIClassId

Returns the UIClass ID for JCChart3d.

Overrides:

getUIClassID in class javax.swing.JComponent.

isProjection

Is the surface represented by the first dataView a 3d view or a 2d projection?

Returns:

A Boolean indicating whether the first dataView is a 2D projection or not.

pick

Given a screen position in pixels, returns a JCData3dIndex object that represents the index of the closest point in the elevation data set of the specified ChartData3dView instance. If no data view is supplied, all data views are considered when finding the closest point (only one dataView is currently supported). If the data in a data view is being updated when pick() is called, the result may be incorrect.

Parameters:

p - Pick point in pixels relative to the JCChart3d object

dataView - Data view on which to perform pick; if null, all data views are used (only one dataView is currently supported).

Returns:

The JCData3dIndex object representing the index of the picked point. This is either a JCData3dGridIndex representing the (x, y) index of grid data point, a JCData3dPointIndex representing the (series, point) index of a point in a point data set, or a JCData3dContourIndex representing a contour range.

printAll

Prints this component and all of its subcomponents. Overridden from java.awt.Component, but should be used in the same way.

Overrides:

printAll in class javax.swing.JComponent.

Parameter:

g - The graphics object used to paint.

recalc

Recalculates the entire chart if it has been marked for recalculation.

removeChart3d
Listener

Removes listener to changes in JClass Chart 3D from list of listeners.

Parameter:

l - The listener to be removed.

reset

Performs a reset on the chart. Returns to the chart3d its default dataport.

snapshot

Takes a snapshot of the current chart and places it in an image of the specified type. The image types are as specified in the BufferedImage class. BufferedImage.TYPE_INT_ARGB is a good default for representing many possible colors. If using fewer than 256 colors, BufferedImage.TYPE_BYTE_INDEXED may prove to generate faster and smaller images.

Parameter:

imagetype - The type of image to write to, as defined in the java.awt.image.BufferedImage class.

Returns:

Image object containing snapshot of chart.

unpick

Returns the position in screen pixels of a particular point in a particular data set (grid data or point data).

Parameters:

dataView - The data view containing the specified series.

index - The data index of the point. This is either a JCData3dGridIndex representing the (x, y) index of grid data point or a JCData3dPointIndex representing the (series, point) index of a point in a point data set.

Returns:

AWT Point object representing position in screen pixels relative to the JCChart3d object or null if the point does not exist.

update

Forces the chart to re-layout and recalculate.

updateUI

Updates the UI for JCChart3d.

Overrides:

updateUI in class javax.swing.JComponent.

C.1.7 JCChart3dArea

Name

Description

getAxis

Sets and returns the axis based on the given axisId.

Parameter:

axisId - The axis ID (either AXIS_X, AXIS_Y, or AXIS_Z).

getDrawingArea

Gets the bounding rectangle of the component's drawing area (its area minus the shadows and insets).

See Also:

JComponent.setBorder(javax.swing.border.Border).

getMinimumSize

Returns the minimum size for the chart area.

Overrides:

getMinimumSize in class javax.swing.JComponent.

Returns:

A Dimension object containing the minimum size.

recalc

If necessary, forces recalculation of the chart area.

reset

Returns the chart back to the default viewport settings.

C.1.8 JCContour

Name

Description

contourIndex

Returns the contour style index that corresponds to this level. This mapping is based on an even distribution of contour styles through the number of levels.

Specified by:

contourIndex in interface JCContourMapping.

C.1.9 JCContourLevels

Name

Description

getLevelFromValue

Calculates the contour level for this value.

Note that we return a value between 0 and numLevels (inclusive - there should be one more contourStyle than contour level).

Parameter:

value - The data value from which a contour level is calculated.

C.1.10 JCPlotCube

Name

Description

hasCeilingProjection

Does this PlotCube have a ceiling projection?

hasFloorProjection

Does this PlotCube have a floor projection?

hasProjections

Does this PlotCube have any projections?

C.2 Chart3d.Event

C.2.1 Chart3dGridDataEvent

Name

Description

getX

Method which returns the X-index of the affected data. Returns -100, if all X- values are affected.

Returns:

index the X-index affected.

getY

Method which returns the Y-index of the affected data. Returns -100, if all Y-values are affected.

Returns:

index the Y-index affected.

C.2.2 Chart3dPointDataEvent

Name

Description

getPoint

Retrieves the point index associated with the event.

Returns:

int the index of the point affected. Returns -100 if all points are affected.

getSeries

Retrieves the series index associated with the event.

Returns:

int the index of the series affected. Returns -100 if all series are affected.


PreviousNextIndex