For properties that you set on the graph, the constants are in the Graph
class. For properties of the graph components, the constants are in the BaseGraphComponent
class.
The following table lists graph properties that are commonly set.
Property |
Description |
---|---|
|
The data source for the data that the graph displays. See also the topic "Specifying Data for a Graph." |
|
The type of graph to display, such as a stacked bar graph or a single pie graph. See also the topic "Choosing a Graph Type." |
|
Whether markers appear in a line graph. (Do not set both this property
and |
LineDataLineDisplayed |
Whether lines appear in a line graph. (Do not set both this property and
MarkerDisplayed to false .) |
ScatterDataLineDisplayed |
Whether lines appear in a scatter graph. |
FitToContainer |
Whether the graph changes size when its container changes size. |
ImageSize |
The size of the graph, when FitToContainer is false .
Also the printed size of the graph when FitToContainer is true . |
For information about other properties on the Graph
class, see
its javadoc.
The following line of code changes the graph type to a single pie graph.
graph.setGraphType(Graph.PIE);
The following lines of specify the size of a graph.
graph.setFitToContainer(false); graph.setImageSize(new Dimension(300, 200));
Each component has properties of its own. To see the properties for each component, look at the javadoc for each component class.
The following line of code sets the color of the graph background to cyan.
graph.getBackground().setFillColor(Color.cyan);
The following line of code sets the text of the group axis (O1Title
) to
"Product".
graph.getO1Title().setText("Product");
Managing Automatic
Graph Layout
Choosing a Graph Type
Customizing Graph Legends
Customizing Graph Markers
in a Series
Customizing the Display
of Tick Labels in a Graph
Customizing the Scale
of Graph Data Axes
Formatting Numbers in
Graphs
Managing Font Sizes
in Graphs
Using Special Effects
in Graphs