All graphs display numeric data only; do not pass dates or strings as the data that the graph displays. Other requirements of graph data differ, according to the type of the graph. You can set up callbacks and listeners to deal with messages about data problems.
Some graph types need a certain number of data points in order to display data. For example, a line graph requires at least two groups of data, because a line requires at least two points. Likewise, an area graph also requires two groups of data. A three-dimensional surface graph requires at least two series and two groups, so that it can draw a surface.
If the data that you pass to a graph does not have enough rows or columns to display the specified graph type, then the Graph bean does not display a graph. Instead, it displays a message about insufficient data.
Some graph types require more than one data point for each marker. A scatter graph, for example, needs two values for each group, so that it can position the marker along the X-axis and along the Y-axis. A bubble graph needs three values for each group: an X-value, a Y-value, and a Z-value, which determines the size of the marker.
Stock graphs all require multiple data values for each group. An open-close stock graph requires two values for each group, so that it can determine the size and location of the marker. An open-high-low-close stock graph requires four values for each group. Stock graphs that show volume need an added value in the group to show the volume.
If the data that you pass does not have enough data points for each group,
the Graph bean does its best to display a graph. It sends an AlertEvent
to any registered AlertListener
objects, though, to let you know
that not all of the data is displayed.
Some data requirements have to do with logic. For example, you should not pass
negative data to a pie graph or to
a percentage bar, line,
or area graph. If you do, then the
Graph bean sends an AlertEvent
to registered AlertListener
objects. It does not display markers for negative data in percentage graphs.
The graph also does not display markers for null or zero values. It sends an
AlertEvent
instead.
In a dual-Y graph, if you pass only one series of data, then the graph cannot display data on two different axes. It displays the data on a single axis.
Data that you display on a time axis in a vertical bar, line, area, combination, or stock graph must meet the following requirements:
The data must be passed as java.sql.Date
objects.
The data must be passed in ascending order.
The data must be passed in regular intervals. For intervals other than months, the graph allows a 5-percent variance. For month intervals, the graph allows a 10-percent variance. This means, for example, that monthly data can vary by about three days and still be considered monthly. Hourly data must be regular within three minutes.
The data must be complete. No more than 20 percent of the data can be missing. Note that the graph recognizes five- and six-day work weeks, in which Saturday, Sunday, or both skipped. The graph considers such weeks to be 100 percent complete.
For bar, line, area, and combination graphs, the time labels must be the only labels for the group axis. For stock graphs, the time labels must be the slowest-varying values. For example, you must have all of the stock values for January 15 before any values for January 16.
If the data does not meet these requirements, then the graph does not treat the axis as a time axis. Instead, it converts all of the labels to strings.
Guidelines for specific graph types appear in topics that describe the graph type. The following hyperlinks go directly to the data guidelines:
Data guidelines for area graphs
Data guidelines for bar graphs
Data guidelines for line graphs
Data guidelines for radar graphs
Data guidelines for dual-Y graphs
Data guidelines for pareto graphs
Data guidelines for pie graphs
Data guidelines for pie-bar graphs
Data guidelines for three-dimensional graphs
Data guidelines for scatter graphs
Data guidelines for polar graphs
Data guidelines for bubble graphs
Data guidelines for high-low-close stock graphs
Data guidelines for high-low-close stock graphs with volume
Data guidelines for open-high-low-close stock graphs
Data guidelines for open-high-low-close stock graphs with volume
Data guidelines for open-close candle stock graphs
Data guidelines for open-close candle stock graphs with volume
Data guidelines for open-high-low-close candle stock graphs
Data guidelines for open-high-low-close candle stock graphs with volume