Perforce JViews Charts Sample: Combined Data Sets


Description

This sample displays three dynamic data sets whose minimum, maximum, and average values for each category are computed dynamically and indicated by the square scatter renderer, the circle scatter renderer, and the gray polyline renderer respectively.

How to Use the Sample

The chart shows three data sets whose values are updated dynamically according to the specified number of updates per second. For each category on the X-axis, the minimum, maximum, and average values in the three data sets are computed and rendered using either a scatter renderer (for the minimum and maximum values) or as a gray polyline for the average.

How to Run the Sample as an Application

This sample can be run as an application. The installation directory contains an executable JAR file, minmax.jar, that allows you to execute the sample with a double click from a file browser. Note that if you are using Internet Explorer, you can open the installation directory and execute the JAR file from the browser. This technique may not work in other Web browsers.

Alternatively, you can run the sample application from the command line. First check that the Ant utility is properly configured. If not, see the instructions on how to configure Ant for Perforce JViews.

Then, go to the installation directory of the sample and type:

ant run

Topics Covered

Detailed Description

This sample shows how to handle data sets whose values depend on others data sets. The minimum, maximum, and average data sets compute their values from the data contained in three reference data sets. Such data sets are called combined data sets and are instances of the IlvCombinedDataSet class. In this sample, the three combined data sets are instances of an IlvCombinedDataSet subclass, the YOperatorDataSet class, that dynamically computes its values when they are fetched (the operation to perform is actually carried out in specialized subclasses).

To graphically distinguish which of the reference data sets contains the minimum or maximum value for a given category, the corresponding renderers use a rendering hint that uses the same stroke as the reference data set renderers. A rendering hint is an implementation of the IlvDataRenderingHint interface. Each time a data point is about to be drawn by its renderer, its specific rendering hint is used instead of the renderer one, allowing you to locally customize the way a data point is drawn.

Because all the chart renderers displayed by a chart do not always corresponds to real data sets, you might want to ignore some renderers while performing interaction on data points, like data picking. Data picking is usually performed by direct interaction on a chart using a data point interactor (instances of subclasses of IlvChartDataInteractor) and is handled by a dedicated object, an implementation of the IlvChartDataPicker interface. In this sample, a concrete implementation filters the renderers so that interactions on the combined data sets renderer are ignored.

Note that no explicit repaint request is necessary, as the chart is updated automatically when the above operations are performed.

Installation Directory

The Combined Data Sets sample is installed here.

Classes Involved

Source Files

Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All rights reserved. Legal terms.