1
Chart Basics
Chart Terminology
·
Using the Property Editor
Interacting with the Chart
·
Choosing the Chart Type
Understanding Data Layout
Successful charting requires that you become familiar with basic chart processes
and vocabulary. The following topics cover basic information that anyone who
intends to create 2D charts should be familiar with.
Chart Terminology
The following illustration depicts the terms used to describe chart
elements.
The elements comprising a typical 2D chart
Unlike the other 2D chart types, pie charts contain the same elements but do
not have axes.
Using the Property Editor
The JClass Chart Property Editor enables you to customize the properties of
any chart.
A JClass Chart Property Editor and the chart it is associated with
Immediate Feedback Model
As you edit properties, the changes are immediately displayed. This enables you
to quickly see how a change affects the chart so that you can make further
changes without leaving the Property Editor.
Displaying the Property Editor At Run-Time
Position the mouse button over that part of the chart to modify. Click the
right mouse button if you running Windows 95/NT, click the middle button if you
are using a Unix OS, or click the button associated with launching a popup menu
on your OS. A property editor that corresponding to the part of the chart to be
edited appears, as shown in the previous illustration. Property editors are
available for the Header, Legend, Footer, ChartArea and the Chart itself.
Note: The property editor is only available if you are running the Java
Development Kit (JDK) 1.1 or later.
Editing Chart Properties
The following illustrates the steps required to edit the properties
contained within a property editor at run time:
- Select the tab that corresponds to the element of the chart that you want
to edit.
Tabs contain one or more inner tabs that group related properties
together. Some tabs also contain a list that selects a specific object to edit.
- If the tab contains an tree control on the left side, select the specific
object to edit from the tree.
- Select the inner tab that corresponds to the kind of property you want to
edit.
- Click on a control and change the value of that property.
The change
is immediately applied to the chart and displayed.
- Make further changes to the same property or change other properties on
this tab or other tabs.
Close-up of a sample property editor
Closing the Property Editor
- Click the Close button to close the Property Editor.
Displaying the Editor at Design Time
Displaying the property editor at design-time depends on the Integrated
Development Environment in use. Consult the IDE documentation for details. Note
that the property pages may appear slightly differently in the IDE.
Sample property manager as seen within Borland's JBuilder IDE
Interacting with the Chart
You can interact with the chart as it is running to examine data more
closely or visually isolate a part of the chart. Note that you can alter the
settings, you cannot set them in place (i.e. you cannot write them to file). It
is a good way to preview a Chart and alter its working parameters to achieve
a more visually-appealing look. The following actions are possible:
- moving the chart
- zooming into or out of the chart
- rotation (only for bar or pie charts that use the 3D display effect)
- adding depth cues to the chart
- use the pick feature to change the settings of data points.
It is also possible in most cases for the user to reset the chart to its
original display parameters. The interactions described here effect the chart
displayed inside the ChartArea; other chart elements like the header
are not affected.
Note: The keyboard/mouse combinations that perform the different
interactions can be changed or removed by a programmer. The interactions
described here may not be enabled for your chart.
Choosing the Chart Type
JClass Chart can display data as one of five basic chart types: Plot,
Scatter Plot, Bar, Stacking Bar and Pie. More specialized chart types, such as
Hi-Lo or Gantt charts, can also be created using one of the basic five types.
Many more Chart types are under development. Contact KL Group for more
details.
Plot Charts
Sample plot chart
A plot draws each series as connected points of data. By customizing the ChartStyle,
you can remove the connecting lines to emphasize the data values themselves, or
remove the points to emphasize the relationship between points. You can also
customize the line and symbol properties of each series.
Scatter Plot Charts
Sample scatter plot chart
A scatter plot draws each series as points of data. Unlike plot charts, the
data points are not connected.
Bar Charts
Sample bar chart
A bar chart draws each series as a bar in a cluster. The number of clusters is
the number of points in the data series. Each cluster displays the nth data
point in each series. Using
ChartStyles, you customize the fill properties of each series. You can also
customize bar cluster properties, set it so that it can be charted versus an axis representing
a percentage between 0 and 100, and add 3D display properties using BarChartFormat.
Stacking Bar Charts
Sample stacking bar chart
A stacking bar chart draws each series as a portion of a stacked bar
cluster, the number of clusters being the number of points in the data. Each
bar displays the nth data point in each series. Using ChartStyles,
you customize the fill properties of each series. You can also customize bar
cluster properties and 3D display properties using BarChartFormat.
Pie Charts
Sample pie chart
A pie chart draws each datapoint as a slice in a pie. The number of pies is
the number of points in the data series. Each pie displays the nth data
point in each series. Using the ChartStyles property, you can customize
the fill properties of each series. You can also customize special pie
properties and 3D display properties using PieChartFormat.
Changing the chart type
In JClass Chart, the chart type is controlled by the data itself. Use the ChartType property
to set the chart type for one ChartDataView.
Understanding Data Layout
JClass Chart employs a flexible data model that allows arbitrary data sources to
be connected. Not every user wants to write an entire data source. To this end,
several data sources are provided with JClass Chart:
- InputStreamDataSource - accepts data from a stream
- FileDataSource - reads data from a file
- URLDataSource - reads data from a URL
These three data sources accept data in one of two basic layouts, Array
and
General.
Array Layout
Use Array layout with bar, stacking bar, and pie charts. Plot
charts can also use Array data when the Y-values in their series
share common X-values.
Sample array layout chart
The important Array layout characteristics illustrated above are:
- The X-values of the points in each series are common to all series.
- Each series contains the same number of points (although by using a data
hole, a series can appear to have fewer points).
General Layout
Use General layout with plot charts. Bar, stacking bar, and pie charts
cannot display General data.
Sample general layout chart
The important General layout characteristics illustrated above are:
-
The points in each series have their own X- and Y-values.
-
Each series can contain a different number of points.