Both the Graph bean and the thin graph use a GraphTypeConverter
to mediate
between the GraphType
constants in the Graph
class and the graph
types and subtypes that appear in the user interface. The default implementation of the
GraphTypeConverter
is oracle.dss.graph.gui.GraphTypeConverterAdapter
.
The GraphTypeConverterAdapter
has constants for some graph types and subtypes
that are not included in the default user interface. You can easily add these types and
subtypes to the user interface. For example, you can add support for horizontal area graphs.
You can also add subtypes to existing graph types. For example, you can add support for proportional multiple pie graphs.
When you add support for these graph types or subtypes, you must provide images to display in the user interface, as well as descriptions for the graph type and subtypes.
The following example shows how to add horizontal area graphs to your user interface. This
example assumes a graph that is named myGraph
.
// instantiate the GraphTypeConverterAdapter GraphTypeConverterAdapter converter = new GraphTypeConverterAdapter(); // create Subtypes for the type, and specify resources // constructor takes id, name, description, 3D image, and flat image Subtype hAreaStack = new Subtype(GraphTypeConverterAdapter.AREA_HORIZ_STACK, "Stacked area", "Areas are stacked next to each other, showing cumulative totals for each group.", "image_folder/horiz_area_stack3d.gif", "image_folder/horiz_area_stackflat.gif"); Subtype hAreaStack2Y = new Subtype(GraphTypeConverterAdapter.AREA_HORIZ_STACK_SPLIT2Y, "Dual-Y stacked area", "Stacked areas show cumulative values in different scales.", "image_folder/horiz_area_stack2y3d.gif", "image_folder/horiz_area_stack2yflat.gif"); // put the Subtypes in a Vector Vector subtypes = new Vector(2); subtypes.add(hAreaStack); subtypes.add(hAreaStack2Y); // create Type for horizontal area graphs // constructor takes id, name, large image, small image, // vector of subtypes, and booleans for whether the type // supports 3D and flat Type hAreaType = new Type(GraphTypeConverterAdapter.TYPE_HORIZONTAL_AREA, "Horizontal Area", "image_folder/horiz_area_large.gif", "image_folder/horiz_area_small.gif", subtypes, true, true); // add the Type to the converter converter.addType(hAreaType); // set the converter on the graph myGraph.setGraphTypeConverter(converter);
The following example shows how to add proportional multiple pie graphs to the pie graph
type. This example assumes a graph that is named myGraph
.
// instantiate the GraphTypeConverterAdapter GraphTypeConverterAdapter converter = new GraphTypeConverterAdapter(); // create the subtype for multiple proportional pie graph // constructor takes id, name, description, 3D image, and flat image Subtype propMultiPie = new Subtype(GraphTypeConverterAdapter.PIE_MULTI_PROP, "Proportional multiple pie", "Use to show percentages of multiple totals.", & "image_folder/prop_multi_pie3d.gif", "image_folder/prop_multi_pie3d.gif"); // get the Pie Type from the converter Type pieType = converter.getType(TYPE_PIE); // add the subtype pieType.addSubtype(propMultiPie); // set the converter on the graph myGraph.setGraphTypeConverter(converter);
If you want to add support for graph types or subtypes that are not in the list of constants
in the GraphTypeConverterAdapter
, or if you want to move subtypes from one type to
another, you must either implement your own GraphTypeConverter
or extend the
GraphTypeConverterAdapter
.