|
Chart Builder API (beta) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--oracle.ord.media.chart.Chart | +--oracle.ord.media.chart.legend.Legend | +--oracle.ord.media.chart.axischart.AxisChart
AxisCharts are charts with axes. They include line, area, bar, and stock charts.
Overview of AxisCharts
Most charts have their graphics oriented vertically, such as vertical bars. Chart Builder supports many vertical charts, and a limited number of horizontal charts (it supports only horizontal bar charts).
When loading data into vertically oriented charts, certain conventions have been established related to the order of loading series into the chart:
The X-axis values, provided as a parameter to setXSeries(), may be either an array of String or an array of java.util.Date. (Note that setXSeries() also accepts arrays of java.sql.Timestamp, because java.sql.Timestamp is a subclass of java.util.Date). When arrays of java.util.Date are provided to setXSeries(), Chart Builder will label the X-axis automatically. If strings are provided, the X-axis will be labeled with those strings.
For vertically oriented charts, the Y-axis values are provided as an array of double to setYSeries().
The following example shows how to define a vertically oriented chart:
//
// Constructor Function.
//
AxisChart AxisCh = new AxisChart();
//
// Load the timestamps
//
java.sql.Date AnnualTimestamps[] =
{
java.sql.Date.valueOf("1990-01-01"),
java.sql.Date.valueOf("1991-01-01"),
java.sql.Date.valueOf("1992-01-01")
};
AxisCh.setXSeries(AnnualTimestamps);
//
// Load the population series associated with the timestamps.
// The series is named "uspopulation"
//
//
// Population (in thousands) associated with timestamps.
//
double Population[] = {246224, 248659, 251373};
AxisCh.setYSeries("seriesname", Population);
Note that setXSeries() expects timestamps ascending and non-null.
Horizontally oriented bar charts are also supported. Invoking the following method will result in a horizontally oriented bar chart:
AxisChart HorizontalAxisCh = new AxisChart();
//
// Set the chart's orientation to be HORIZONTAL
//
AxisCh.setChartOrientation(AxisChart.HORIZONTAL);
//
// Load the x axis with an array of labels
//
String USExportsLabels[] = {"Mexico", "Japan", "France"};
HorizontalAxisCh.setXSeries(USExportsLabels);
//
// Load the population series associated with the timestamps.
// The series is named "usexports"
//
double USExports[] = {8579.0, 5146.0, 1926.0 };
HorizontalAxisCh.setYSeries("usexports", USExports);
//
// Set the chart type to be BAR
//
AxisCh.setSeriesGraphType("seriesName", AxisChart.BAR);
The following description applies to both vertical and horizontal charts, but the examples assume a vertically oriented chart.
Multiple series can be displayed in a single chart. This is accomplished with multiple calls to setYSeries(). For example, if one had two different series sharing the same timestamps but having different Y-axis values, they could be loaded into the chart as follows:
AxisCh.setYSeries("seriesname1", YValueArray);
AxisCh.setYSeries("seriesname2", YValueArray2);
Note that the first series has name seriesname1 while the second has name seriesname2. Also note that the internals of the chart package renders series in the order that they are requested. In this case, seriesname1 will be draw first, and seriesname2 is drawn second.
The series name can be subsequently used as an identifier when modifying series attributes. For example, the color of the series may be altered as follows:
AxisCh.setSeriesColor("seriesname1", Color.green);
AxisCh.setSeriesColor("seriesname2", Color.red);
The line type of each series can be specified independently. For example, one series could be displayed with a line and another with an area. The package provides two different approaches to selecting the line type. With the first approach, setSeriesGraphType() is invoked with the named series as the first parameter and the type of line as the next parameter. For example, to change seriesname1 to an area chart, one could call the following:
setSeriesGraphType("seriesname1", AxisChart.AREA);
This approach is applicable to LINE, AREA, BAR, and BAR_STACKED line types.
The second approach offers more control over the style parameters associated with a particular line type. For example, to change seriesname1 to an area chart, where the area is filled with grey, one could call the following:
AreaDesc AreaD = AreaDesc();
AreaD.setAreaColor(Color.grey);
setSeriesGraphic("seriesname", AreaD)
Stock charts are constructed from three or more series. Specifically, the High-Low-Close chart requires the high, low, and close values for each timestamp, while the Open-High-Low-Close and the Candlestick chart require the open, high, low, and close values for each timestamp. For these reasons, the interfaces for loading stock chart values accept either three or four arrays of Y-axis values.
Displaying Multiple Series having Different Timestamps.
In some situations, users wish to display series that do not all share the same timestamps. Two interfaces are provided, depending on whether or not the time series can be mapped sequentially to the time axis.
For example, suppose one has two monthly series, but the first starts January 1990, and the second starts on March 1990. If the user wishes to see a chart that has all the data for both series, (a) the timestamps loaded for the x axis would start at January 1990, (b) the first series would be loaded with setYSeries(), and (c) the second series would be loaded with setYSeries(), using a startDate parameter of March 1990.
Note that the setYSeries() can be used without any additional
parameters to display second series that map sequentially to the timestamp axis,
but have timestamps missing from the end of the series.
For example, an annual series and a monthly series can be displayed on the same chart. First, the X-axis is loaded with the monthly timestamps. Next, the monthly series is loaded using setYSeries(). Finally, the annual series is loaded using the setYSeriesSparse().
SubCharts
Subcharts enable multiple charts to be stacked vertically. For example, it is possible to display prices in the top subchart, and volume in the bottom subchart. The setSubchart() method adds a new subchart; subsequent calls to setYSeries() will add the series to the new subchart. By default, the height of all vertically stacked charts will be equal. The height of any subchart can be altered with setSubchartHeightFraction().
Loading Annotations
Annotations (text that is associated with a time series) is loaded with the setSeriesAnnotations() method. Typically, only a few annotations are associated with the (x,y) coordinates of a series.
Axis and Grid Attributes
Axis and grid attributes can be modified through the use of the applicable descriptors, such as AxisDesc, NumAxisDesc, and GridDesc. These descriptors are parameters to the setChartAttributes() method.
For example, to change the minimum extent of the Y-axis, modify the attributes as follows:
NumAxisDesc yAxisD = new NumAxisDesc();
yAxisD.setExtentMin(0);
AxisCh.setChartAttributes(yAxisD);
The AxisChart class also provides methods for setting colors of the plot area. The plot area is the rectangular region where the graph types, such as lines or bars, representing the data are drawn. This area does not include the title bar, footnote area, or X-axis or Y-axis labeling area. The methods are:
setXSeries(int frequency, Date startDate, Date endDate)
, Serialized FormInner classes inherited from class oracle.ord.media.chart.legend.Legend |
Legend.LegendElement |
Inner classes inherited from class oracle.ord.media.chart.Chart |
Chart.ChartLabel |
Field Summary | |
static int |
AREA
Area chart identifier. |
static int |
BAR
Bar chart identifier. |
static int |
BAR_HORIZONTAL
Deprecated. As of 11.11.2000. Please use BAR in conjunction with setChartOrientation(AxisChart.HORIZONTAL. |
static int |
BAR_STACKED
Stacked bar chart identifier. |
static int |
CANDLESTICK
Candlestick chart identifier. |
static int |
HILOCLOSE
High-low-close chart identifier. |
static int |
HORIZONTAL
Orientation constant |
static int |
LINE
Line chart identifier. |
static int |
OPENHILOCLOSE
Open-high-low-close chart identifier. |
static int |
VERTICAL
Orientation constant |
static int |
XAXIS
Constant identifying the X-axis. |
static int |
XYAXIS
Constant identifying both the X and Y-axis. |
static int |
YAXIS
Constant identifying the Y-axis. |
Fields inherited from class oracle.ord.media.chart.legend.Legend |
DERIVED, EAST, NORTH, NORTHEAST, NORTHWEST, SOUTH, SOUTHEAST, SOUTHWEST, USERDEFINED, WEST |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
AxisChart()
|
Method Summary | |
void |
drawBuffer(java.awt.Graphics2D g2)
Render the chart into the buffered image associated with g2. |
AnnotationDesc |
getAnnotationDesc()
Return an instance of the AnnotationDesc class. |
java.awt.Color |
getForeground()
Get the foreground color. |
GridDesc |
getGridDesc(int XorYAxis)
Return the grid descriptor for the X-axis or for the Y-axis of the top-level chart. |
GridDesc |
getGridDesc(java.lang.String subchartName)
Return the grid descriptor the Y-axis of the named subchart. |
char[] |
getImageMapCS()
Return the server-side image map for the chart. |
char[] |
getImageMapSS()
Return the server-side image map for the chart. |
java.awt.Color |
getPlotBackground()
Get the color of the plot background. |
java.awt.Color |
getPlotEdgeColor()
Get the color of the inner border of the chart. |
java.awt.RenderingHints |
getRenderingHintsLine()
Return the rendering hints used for chart graphics. |
java.awt.Color |
getSeriesColor(java.lang.String seriesName)
Get the color of the named series. |
java.awt.Color |
getSubChartBoundaryColor()
Get the color of the inner border of the chart. |
void |
paint(java.awt.Graphics g)
|
void |
setBounds(int x,
int y,
int w,
int h)
Move and resize the component. |
void |
setBounds(java.awt.Rectangle rect)
Move and resize the component. |
void |
setCandlestickSeries(java.lang.String seriesName,
double[] yopen,
double[] yhigh,
double[] ylow,
double[] yclose)
Load Y-axis values for a Candlestick chart. |
void |
setCandlestickSeries(java.lang.String seriesName,
double[] yopen,
double[] yhigh,
double[] ylow,
double[] yclose,
java.util.Date startDate)
Load Y-axis values for a Candlestick chart, with an explicit startDate. |
void |
setChartAttributes(int XYAxis,
AxisDesc userAxis)
Set the attributes for the X and/or Y-axis. |
void |
setChartAttributes(int XYAxis,
GridDesc userGrid)
Set the attributes for the X grid and/or Y grid. |
void |
setChartAttributes(NumAxisDesc userNumAxis)
Set the attributes for the Y-axis. |
void |
setChartAttributes(java.lang.String subchartName,
GridDesc userGrid)
Set the attributes of the Y Grid for the named subchart. |
void |
setChartAttributes(java.lang.String subchartName,
NumAxisDesc userNumAxis)
Set the attributes of a numerical Y-axis. |
void |
setChartAttributes(TimeAxisDesc userTimeAxis)
Set the attributes for the Y-axis. |
void |
setChartBottomWhiteSpace(double fract)
Set the amount of white space on the bottom of the chart. |
void |
setChartOrientation(int orientation)
Set the orientation of the chart (to HORIZONTAL or VERTICAL). |
void |
setChartTopWhiteSpace(double fract)
Set the amount of white space on the top of the chart. |
void |
setEnableImageMapCS(ImageMapDesc desc)
Enable the client-side image map. |
void |
setEnableImageMapSS(ImageMapDesc desc)
Enable the server-side image map. |
void |
setEnableSubChartImageMapCS(java.lang.String subchartName,
ImageMapDesc desc)
Enable the client-side image map for the named subchart. |
void |
setEnableSubChartImageMapSS(java.lang.String subchartName,
ImageMapDesc desc)
Enable the server-side image map for the named subchart. |
void |
setForeground(java.awt.Color c)
Set the foreground color. |
void |
setHiLoCloseSeries(java.lang.String seriesName,
double[] yhigh,
double[] ylow,
double[] yclose)
Load Y-axis values for a High/Low/Close chart. |
void |
setHiLoCloseSeries(java.lang.String seriesName,
double[] yhigh,
double[] ylow,
double[] yclose,
java.util.Date startDate)
Load Y-axis values for a High/Low/Close chart, with an explicit startDate. |
void |
setOpenHiLoCloseSeries(java.lang.String seriesName,
double[] yopen,
double[] yhigh,
double[] ylow,
double[] yclose)
Load Y-axis values for a Open/High/Low/Close chart (double). |
void |
setOpenHiLoCloseSeries(java.lang.String seriesName,
double[] yopen,
double[] yhigh,
double[] ylow,
double[] yclose,
java.util.Date startDate)
Load Y-axis values for a Open/High/Low/Close chart (double), with an explicit startDate. |
void |
setPlotBackground(java.awt.Color c)
Set the color of the plot background. |
void |
setPlotEdgeColor(java.awt.Color c)
Set the color of the inner border of the chart. |
void |
setRenderingHintsLine(java.awt.RenderingHints hints)
Set the rendering hints for drawing specific graphic operations -- lines and area charts. |
void |
setSeriesAnnotations(java.util.Date[] tstamps,
java.lang.String[] yannotations)
Load an array of annotations into the chart. |
void |
setSeriesColor(java.lang.String seriesName,
java.awt.Color c)
Set the color of the named series. |
void |
setSeriesDwellLabels(java.lang.String seriesName)
Assign the dwell labels to the associated observations. |
void |
setSeriesDwellLabels(java.lang.String seriesName,
java.lang.String[] dwellLabels)
Set the dwell labels to user-defined strings. |
void |
setSeriesGraphic(java.lang.String seriesName,
AreaDesc desc)
Set the properties of the AREA graphic associated with the named series. |
void |
setSeriesGraphic(java.lang.String seriesName,
BarDesc desc)
Set the properties of the BAR graphic associated with the named series. |
void |
setSeriesGraphic(java.lang.String seriesName,
CandlestickDesc desc)
Set the properties of the CANDLESTICK graphic associated with the named series. |
void |
setSeriesGraphic(java.lang.String seriesName,
HiLoCloseDesc desc)
Set the properties of the HILOCLOSE or OPENHILOCLOSE graphic associated with the named series. |
void |
setSeriesGraphic(java.lang.String seriesName,
LineDesc desc)
Set the properties of the LINE graphic associated with the named series. |
void |
setSeriesGraphType(java.lang.String seriesName,
int lineType)
Set the graph type of the named series. |
void |
setSeriesWidth(java.lang.String seriesName,
int k)
Set thickness (in pixels) of named line. |
void |
setSize(java.awt.Dimension d)
Set the dimensions of the chart. |
void |
setSize(int width,
int height)
Set the dimensions of the chart. |
void |
setSubChart(java.lang.String subchartName)
Add the named subchart if it does not exist, otherwise set the current subchart to the named subchart. |
void |
setSubChartBoundaryColor(java.awt.Color c)
Set the color of the subchart boundary. |
void |
setSubChartHeightFraction(java.lang.String subchartName,
double fract)
Set the height of the named subchart, as a fraction of the entire chart's height. |
void |
setSubChartSeparatorHeight(int height)
Set the height (in pixels) of the space separating all subcharts. |
void |
setUserXLabel(DateString[] dateString)
Define the X-axis labels. |
void |
setXSeries(java.util.Date[] tstamps)
Load an array of timestamps into the chart. |
void |
setXSeries(java.util.Date[] tstamps,
int length)
Load an array of timestamps into the chart. |
void |
setXSeries(int frequency,
java.util.Date startDate,
java.util.Date endDate)
Set the X-axis timestamps to the specified frequency, with timestamps between startDate and endDate. |
void |
setXSeries(int frequency,
java.util.Date startDate,
java.util.Date endDate,
int units)
Set the X-axis timestamps to the specified frequency, with timestamps between startDate and endDate. |
void |
setXSeries(java.lang.String[] labels)
Load an array of X-axis labels into the chart. |
void |
setYAxisLabelsOff()
Disable labeling of the Y-axis. |
void |
setYAxisLabelsOff(java.lang.String subchartName)
Disable labeling of the Y-axis for the named subchart. |
void |
setYSeries(java.lang.String seriesName,
double[] yvalues)
Load an array of Y-axis values into the chart. |
void |
setYSeries(java.lang.String seriesName,
double[] yvalues,
java.util.Date startDate)
Load an array of Y-axis values into the chart. |
void |
setYSeries(java.lang.String seriesName,
double[] yvalues,
java.util.Date startDate,
int length)
Load an array of Y-axis values into the chart. |
void |
setYSeries(java.lang.String seriesName,
double[] yvalues,
int length)
Load an array of Y-axis values into the chart. |
void |
setYSeriesAxis2(java.lang.String seriesName)
Assign the series seriesName to the second axis. |
void |
setYSeriesSparse(java.lang.String seriesName,
java.util.Date[] tstamps,
double[] yvalues)
Load a sparse array of Y-axis values at the specified user-defined timestamps. |
Methods inherited from class oracle.ord.media.chart.legend.Legend |
getLegendAlignment, getLegendBackground, getLegendDisable, getLegendDisplaySingleSeries, getLegendEdgeColor, getLegendEdgeDisable, getLegendForeground, getLegendInside, setLegendAlignment, setLegendBackground, setLegendDisable, setLegendDisplaySingleSeries, setLegendEdgeColor, setLegendEdgeDisable, setLegendFont, setLegendForeground, setLegendInside, setLegendOffsetX, setLegendOffsetY |
Methods inherited from class oracle.ord.media.chart.Chart |
getBackground, getBorderBottom, getBorderLeft, getBorderRight, getBorderTop, getEdgeColor, getFootnote, getHeight, getMinimumSize, getPreferredSize, getRenderingHintsChart, getSize, getSubtitle, getTitle, getVersion, getWidth, isSetRenderingHintsChart, setBackground, setBorderBottom, setBorderLeft, setBorderRight, setBorderTop, setEdgeColor, setRenderingHintsChart, setTitlesForeground |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAccessibleContext, getAlignmentX, getAlignmentY, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getGraphics, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setLocale, setLocation, setLocation, setName, setVisible, show, show, size, toString, transferFocus, update, validate |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int XAXIS
setChartAttributes(int XYAxis, AxisDesc userAxis)
public static final int YAXIS
setChartAttributes(int XYAxis, AxisDesc userAxis)
public static final int XYAXIS
setChartAttributes(int XYAxis, AxisDesc userAxis)
public static final int LINE
public static final int AREA
public static final int BAR
public static final int BAR_STACKED
public static final int BAR_HORIZONTAL
public static final int HILOCLOSE
public static final int OPENHILOCLOSE
public static final int CANDLESTICK
public static final int HORIZONTAL
public static final int VERTICAL
Constructor Detail |
public AxisChart()
Method Detail |
public void setChartOrientation(int orientation) throws ChartException
AxisChart AxisCh = new AxisChart();
AxisCh.setChartOrientation(AxisChart.HORIZONTAL);
AxisCh.setXSeries(...);
AxisCh.setYSeries("seriesName", ...);
AxisCh.setSeriesGraphType("seriesName", AxisChart.BAR);
Note that when orientation is AxisChart.HORIZONTAL,
this method also sets the default legend placement to Legend.SOUTH.ChartException
- on invalid orientation.public void setSeriesDwellLabels(java.lang.String seriesName, java.lang.String[] dwellLabels) throws ChartException
seriesName
- Name of series.dwellLabel[]
- An array containing dwell label for each observation.ChartException
- on invalid seriesName.ChartException
- if setXSeries() was not previously invoked.public void setSeriesDwellLabels(java.lang.String seriesName) throws ChartException
seriesName
- Name of series.ChartException
- on invalid seriesName.public void setXSeries(java.lang.String[] labels) throws ChartException
labels[]
- Array of Strings.ChartException
- if labels[] are null or empty.ChartException
- if setXSeries() was previously invoked.public void setXSeries(int frequency, java.util.Date startDate, java.util.Date endDate) throws ChartException
For example, if the user provides a frequency of Calendar.MONTH, a start date of 2000-JAN-01, and an end date of 2001-JAN-01, the X-axis will be populated with 12 timestamps, 2000-JAN-01, 2000-FEB-01, ... 2000-DEC-01.
frequency
- The frequency of the timestamps. Valid values are:
Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH,
Calendar.HOUR, Calendar.MINUTE, and Calendar.SECOND.startDate
- Date of the first timestamp.endDate
- Date of the last timestamp.ChartException
- on invalid frequency.ChartException
- if endDate is not later than startDate .ChartException
- if setXSeries() was previously invoked.public void setXSeries(int frequency, java.util.Date startDate, java.util.Date endDate, int units) throws ChartException
For example, if the user provides a frequency of Calendar.MONTH, a startDate of 2000-JAN-01, and an endDate of 2001-JAN-01, and units of 3, the X-axis will be populated with 4 timestamps: 2000-JAN-01, 2000-APR-01, 2000-JUL-01 and 2000-OCT-01.
frequency
- The frequency of the timestamps. Valid values are
Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH,
Calendar.HOUR, Calendar.MINUTE, or Calendar.SECOND.startDate
- Date of the first timestamp.endDate
- Date of the last timestamp.units
- Number of units, such as years, or months, between timestamps.ChartException
- on invalid frequency.ChartException
- if units are less than or equal to zero.ChartException
- if endDate is not later than startDate .ChartException
- if setXSeries() was previously invoked.public void setXSeries(java.util.Date[] tstamps) throws ChartException
tstamps[]
- Array of timestamps.ChartException
- if tstamps[] is null or empty.ChartException
- if tstamps[] are non-ascending.ChartException
- if setXSeries() was previously invoked.public void setXSeries(java.util.Date[] tstamps, int length) throws ChartException
tstamps[]
- Array of timestamps.length
- Length of array.
Length is provided to allow the use of the first k elements
in the Array of timestamps.ChartException
- if tstamps[] is null or empty.ChartException
- if tstamps[] are non-ascending.ChartException
- if setXSeries() was previously invoked.public void setUserXLabel(DateString[] dateString) throws ChartException
dateString[]
- Array of DateString.ChartException
- if the supplied dates are non-ascending.ChartException
- if dateString[] is null or empty.DateString
public AnnotationDesc getAnnotationDesc()
setSeriesAnnotations(java.util.Date[], String[])
public void setSeriesAnnotations(java.util.Date[] tstamps, java.lang.String[] yannotations) throws ChartException
Each annotation is associated with a specific timestamp of the series. The annotation text is drawn using the color of the X-axis labels. By default, the background color of the annotation is identical to the chart background color. The font, background color, and foreground color of the annotation can be altered by using getAnnotationDesc().
tstamps[]
- Array of timestamps associated with annotations.yannotations[]
- String array of annotations.ChartException
- if tstamps[] is null or empty.ChartException
- if tstamps[] are non-ascending.ChartException
- if the length of tstamps and yannotations are not equal.getAnnotationDesc()
,
AnnotationDesc
public void setYSeries(java.lang.String seriesName, double[] yvalues) throws ChartException
seriesName
- Name of series.yvalues[]
- Double array of Y-axis values.ChartException
- if yvalues() are null.ChartException
- if seriesName has been previously defined.public void setYSeries(java.lang.String seriesName, double[] yvalues, int length) throws ChartException
setXSeries() must be called before setYSeries().
seriesName
- Name of series.yvalues[]
- Double array of Y-axis values.length
- Length of yvalues.ChartException
- if yvalues() are null.ChartException
- if seriesName has been previously defined.public void setYSeries(java.lang.String seriesName, double[] yvalues, java.util.Date startDate) throws ChartException
setXSeries() must be called before setYSeries().
seriesName
- Name of series.yvalues[]
- Double array of Y-axis values.startDate
- Date to which to align the first Y-axis value.ChartException
- if yvalues() are null.ChartException
- if seriesName has been previously defined.public void setYSeries(java.lang.String seriesName, double[] yvalues, java.util.Date startDate, int length) throws ChartException
setXSeries() must be called before setYSeries().
seriesName
- Name of series.yvalues[]
- Double array of Y-axis values.startDate
- Timestamp corresponding to first yvalue element.length
- Length of yvalues.ChartException
- if yvalues() are null.ChartException
- if seriesName has been previously defined.public void setYSeriesAxis2(java.lang.String seriesName) throws ChartException
seriesName
- Name of the series.ChartException
- on invalid seriesName.ChartException
- if setXSeries() was not previously invoked.public void setYSeriesSparse(java.lang.String seriesName, java.util.Date[] tstamps, double[] yvalues) throws ChartException
Load a sparse array of Y-axis values at the specified user-defined timestamps. This call is used when the Y series has a subset of the timestamps defined with setXSeries(). setYSeriesSparse() is typically used to load series that are subfrequencies of the first series. For example, one could display both monthly and annual data by first loading the monthly timestamps (with setXSeries()), next loading the monthly Y series (with setYSeries()), and finally loading the annual data with setYSeriesSparse().
Note that the sparse array can have timestamps that are between those defined for the x axis. For example, if the time axis is defined monthly, for all months in the year 2000, the sparse array could contain the timestamp 2001-06-15. However, if two or more sparse timestamps map to the same time axis interval, an error will be flagged. E.g., in the above example, sparse timestamps 2001-06-15 and 2001-06-20 would flag an error.
In many cases, mixed-frequency data will have a range of Y-axis values that are significantly different than the base frequency. In these cases, users often choose to use dual axes, by invoking setYSeriesAxis2("sparseSeriesName").
seriesName
- Name of series.tstamps[]
- Array of java.util.Date.yvalues[]
- Double array of Y-axis values.ChartException
- if setXSeries() was not previously invoked.ChartException
- if tstamps[] are non-ascending.ChartException
- if tstamps[].length is greater than the number of timestamps defined for the x axis.ChartException
- if any tstamps[] is earlier then the first timestamp defined in the x axis.ChartException
- if any tstamps[] is later then the last timestamp defined in the x axis.ChartException
- if more than one tstamps[] map to a single a axis interval (adjacent timestamps along the x axis define an x axis interval).setXSeries(java.lang.String[])
,
setYSeries(java.lang.String, double[])
,
setYSeriesAxis2(java.lang.String)
public void setHiLoCloseSeries(java.lang.String seriesName, double[] yhigh, double[] ylow, double[] yclose) throws ChartException
seriesName
- Name of the series.yhigh[]
- Array of values corresponding to the high observation.ylow[]
- Array of values corresponding to the low observation.yclose[]
- Array of values corresponding to the close observation.ChartException
- if the lengths of yhigh[], ylow[], and yclose[] are not equal.ChartException
- if seriesName has been previously defined.public void setOpenHiLoCloseSeries(java.lang.String seriesName, double[] yopen, double[] yhigh, double[] ylow, double[] yclose) throws ChartException
seriesName
- Name of the series.yopen[]
- Array of values corresponding to the open observation.yhigh[]
- Array of values corresponding to the high observation.ylow[]
- Array of values corresponding to the low observation.yclose[]
- Array of values corresponding to the close observation.ChartException
- if ylow[], yhigh[], ylow[], and yclose[] are not equal.ChartException
- if seriesName has been previously defined.public void setCandlestickSeries(java.lang.String seriesName, double[] yopen, double[] yhigh, double[] ylow, double[] yclose) throws ChartException
seriesName
- Name of the series.yopen[]
- Array of values corresponding to the open observation.yhigh[]
- Array of values corresponding to the high observation.ylow[]
- Array of values corresponding to the low observation.yclose[]
- Array of values corresponding to the close observation.ChartException
- if ylow[], yhigh[], ylow[], and yclose[] are not equal.ChartException
- if seriesName has been previously defined.public void setHiLoCloseSeries(java.lang.String seriesName, double[] yhigh, double[] ylow, double[] yclose, java.util.Date startDate) throws ChartException
seriesName
- Name of the series.yhigh[]
- Array of values corresponding to the high observation.ylow[]
- Array of values corresponding to the low observation.yclose[]
- Array of values corresponding to the close observation.startDate
- Timestamp corresponding to first yvalue element.ChartException
- if the lengths of ylow[], yhigh[], ylow[], and yclose[] are not equal.ChartException
- if seriesName has been previously defined.public void setOpenHiLoCloseSeries(java.lang.String seriesName, double[] yopen, double[] yhigh, double[] ylow, double[] yclose, java.util.Date startDate) throws ChartException
seriesName
- Name of the series.yopen[]
- Array of values corresponding to the open observation.yhigh[]
- Array of values corresponding to the high observation.ylow[]
- Array of values corresponding to the low observation.yclose[]
- Array of values corresponding to the close observation.startDate
- Timestamp corresponding to first yvalue element.ChartException
- if ylow[], yhigh[], ylow[], and yclose[] are not equal.ChartException
- if seriesName has been previously defined.public void setCandlestickSeries(java.lang.String seriesName, double[] yopen, double[] yhigh, double[] ylow, double[] yclose, java.util.Date startDate) throws ChartException
seriesName
- Name of the series.yopen[]
- Array of values corresponding to the open observation.yhigh[]
- Array of values corresponding to the high observation.ylow[]
- Array of values corresponding to the low observation.yclose[]
- Array of values corresponding to the close observation.startDate
- Timestamp corresponding to first yvalue element.ChartException
- if ylow[], yhigh[], ylow[], and yclose[] are not equal.ChartException
- if seriesName has been previously defined.public void setSubChartHeightFraction(java.lang.String subchartName, double fract) throws ChartException
subchartName
- Name of the subchart.fract
- Fractional value (between 0 and 1).ChartException
- on invalid subchartName.public void setSubChart(java.lang.String subchartName)
If subchartName has been previously defined the current subchart will be set to subchartName. This allows a user to return to a previously defined subchart in order to subsequently add additional Y-axis series. Note that one can use this method to set the current subchart to the main chart (internally implemented as the top-level subchart) using the subChartName "".
subchartName
- Name of subchart.public void setForeground(java.awt.Color c)
setForeground
in class java.awt.Component
public java.awt.Color getForeground()
getForeground
in class java.awt.Component
public void setPlotBackground(java.awt.Color c)
public java.awt.Color getPlotBackground()
public void setPlotEdgeColor(java.awt.Color c)
public java.awt.Color getPlotEdgeColor()
public void setSubChartBoundaryColor(java.awt.Color c)
public java.awt.Color getSubChartBoundaryColor()
public void setSeriesColor(java.lang.String seriesName, java.awt.Color c) throws ChartException
seriesName
- Name of series.ChartException
- on invalid seriesName.public java.awt.Color getSeriesColor(java.lang.String seriesName) throws ChartException
seriesName
- Name of series.ChartException
- on invalid seriesName.public void setSeriesWidth(java.lang.String seriesName, int k) throws ChartException
seriesName
- Name of series.ChartException
- on invalid seriesName.public void setSeriesGraphType(java.lang.String seriesName, int lineType) throws ChartException
seriesName
- Name of series.lineType
- Type of line. Valid values are AREA, BAR, BAR_STACKED, BAR_HORIZONTAL or LINE.ChartException
- on invalid seriesName.public void setSeriesGraphic(java.lang.String seriesName, BarDesc desc) throws ChartException
seriesName
- Name of series.desc
- A BarDesc object.ChartException
- on invalid seriesName.BarDesc
public void setSeriesGraphic(java.lang.String seriesName, CandlestickDesc desc) throws ChartException
- seriesName Name of series.
- desc A CandlestickDesc object.ChartException
- on invalid seriesName.CandlestickDesc
public void setSeriesGraphic(java.lang.String seriesName, HiLoCloseDesc desc) throws ChartException
seriesName
- Name of series.desc
- A HiLoCloseDesc object.ChartException
- on invalid seriesName.HiLoCloseDesc
public void setSeriesGraphic(java.lang.String seriesName, AreaDesc desc) throws ChartException
seriesName
- Name of series.desc
- An AreaDesc object.ChartException
- on invalid seriesName.AreaDesc
public void setSeriesGraphic(java.lang.String seriesName, LineDesc desc) throws ChartException
seriesName
- Name of series.desc
- A LineDesc object.ChartException
- on invalid seriesName.public void setYAxisLabelsOff() throws ChartException
public void setYAxisLabelsOff(java.lang.String subchartName) throws ChartException
subchartName
- Name of the subchart.ChartException
- on invalid subchartName.public void setChartAttributes(NumAxisDesc userNumAxis) throws ChartException
desc
- A NumAxisDesc object.NumAxisDesc
public void setChartAttributes(java.lang.String subchartName, NumAxisDesc userNumAxis) throws ChartException
desc
- A NumAxisDesc object.subchartName
- Name of the subchart.ChartException
- on invalid subchartName.NumAxisDesc
public void setChartAttributes(TimeAxisDesc userTimeAxis) throws ChartException
desc
- A TimeAxisDesc object.TimeAxisDesc
public void setChartAttributes(int XYAxis, AxisDesc userAxis) throws ChartException
For access to more advanced settings for the Y-axis, see NumAxisDesc. These more advanced settings include the ability to alter additional parameters such as extents and access to subcharts.
userAxis
- An AxisDesc object.XYAxis
- The axis identifier, either AxisChart.XAXIS , AxisChart.YAXIS , or AxisChart.XYAXIS.ChartException
- on invalid XYAxis.AxisDesc
public GridDesc getGridDesc(int XorYAxis) throws ChartException
XorYAxis
- A single axis identifier, either AxisChart.XAXIS or AxisChart.YAXIS.ChartException
- on invalid XorYAxis.setChartAttributes(int, GridDesc)
,
setChartAttributes(String, GridDesc)
,
GridDesc
public GridDesc getGridDesc(java.lang.String subchartName) throws ChartException
ChartException
- on invalid subchartName.public void setChartAttributes(int XYAxis, GridDesc userGrid) throws ChartException
Note that this call will alter the Y grid settings for the top-level chart and all currently defined subcharts.
userGrid
- An GridDesc object.XYAxis
- The axis identifier. Valid values are:
AxisChart.XAXIS , AxisChart.YAXIS , or
AxisChart.XYAXIS.ChartException
- on invalid XYAxis.getGridDesc(int)
,
setChartAttributes(String, GridDesc)
,
GridDesc
public void setChartAttributes(java.lang.String subchartName, GridDesc userGrid) throws ChartException
desc
- A GridDesc object.subchartName
- Name of the subchart.ChartException
- on invalid subchartName.GridDesc
,
setChartAttributes(int, GridDesc)
public void setChartBottomWhiteSpace(double fract)
fract
- Fraction of chart bottom (between 0.0 and 1.0) dedicated to white space.public void setChartTopWhiteSpace(double fract)
fract
- Fraction of chart top (between 0.0 and 1.0) dedicated to white space.public void setBounds(int x, int y, int w, int h)
setBounds
in class java.awt.Component
public void setBounds(java.awt.Rectangle rect)
setBounds
in class java.awt.Component
public void setSize(java.awt.Dimension d)
setSize
in class java.awt.Component
public void setSize(int width, int height)
setSize
in class java.awt.Component
width
- Width of the chart.height
- Height of the chart.public void setRenderingHintsLine(java.awt.RenderingHints hints)
hints
- The rendering hints.Chart.setRenderingHintsChart(RenderingHints hints)
public java.awt.RenderingHints getRenderingHintsLine()
public void drawBuffer(java.awt.Graphics2D g2) throws ChartException
public void setEnableImageMapSS(ImageMapDesc desc) throws ChartException
drawBuffer(Graphics2D)
,
getImageMapSS()
,
ImageMapDesc
public void setEnableImageMapCS(ImageMapDesc desc) throws ChartException
ImageMapDesc,
- which defines attributes of image map.drawBuffer(Graphics2D)
,
getImageMapCS()
,
ImageMapDesc
public void setEnableSubChartImageMapSS(java.lang.String subchartName, ImageMapDesc desc) throws ChartException
subchartName
- Name of subchart (corresponding to image map).ChartException
- on invalid subchartName.drawBuffer(Graphics2D)
,
getImageMapSS()
public void setEnableSubChartImageMapCS(java.lang.String subchartName, ImageMapDesc desc) throws ChartException
subchartName
- Name of subchart (corresponding to image map).ImageMapDesc
- A descriptor that defines attributes of the image map.ChartException
- on invalid subchartName.drawBuffer(Graphics2D)
,
getImageMapCS()
public char[] getImageMapSS() throws ChartException
ChartException
- if drawBuffer() was not previously invoked.setEnableImageMapSS(ImageMapDesc)
public char[] getImageMapCS() throws ChartException
ChartException
- if drawBuffer() was not previously invoked.setEnableImageMapCS(ImageMapDesc)
public void paint(java.awt.Graphics g)
paint
in class java.awt.Component
public void setSubChartSeparatorHeight(int height)
|
Chart Builder API (beta) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |