Class WAbstractDataSeries3D

java.lang.Object
eu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.chart.WAbstractDataSeries3D
Direct Known Subclasses:
WAbstractGridData, WScatterData

public abstract class WAbstractDataSeries3D
extends WObject
Abstract base class for dataseries that can be drawn on a WCartesian3DChart.

General

The model that is provided at construction or with setModel() contains the data of a dataseries. Implementations of this class format the data for representation on the chart and perform all necessary drawing operations. Note that if a dataseries holds numerical data it should be added to a chart of type ScatterPlot, if it holds categorical data it should be added to a chart of type CategoryChart.

Color

The color used to draw data on a chart can be specified in a number of ways. The priority of this is as follows (1 being the highest):

  1. MarkerBrushColorRole set on a value in the model
  2. WAbstractColorMap set on the dataseries
  3. WChartPalette present in the chart

A chart-palette will specify one color for the entire dataseries. Each new dataseries on a chart will receive another color.
A colormap assigns different colors to the data within one dataseries, based on the z-value of the data. WStandardColorMap provides an easy way to create a colormap that is either smooth or consists of a number of bands.

Data-roles

The roles on the model which are taken into account are:

  • MarkerBrushColorRole: this determines the color of a datapoint and overrides the default
  • MarkerScaleFactorRole: this determines the size of a datapoint and overrides the default

Some representations of the data ignore these roles. For example, when a surface is drawn, the roles are ignored.

Implementing a new dataseries class

When the existing implementations of WAbstractDataSeries3D don't meet your needs, you might want to make your own. When doing this there are some details of the chart that you should know. The chart is made so that when a property of the chart changes, which affect any of the GL resources, all GL resources are destroyed and re-initialized. This eliminates the need to determine which chart-setting affect which GL-resources, which can be a complicated problem.

Therefore only unchanging GL resources are initialized in initializeGL(). The initializeGL function in the chart is implemented to immediately request a call to updateGL(), which then initializes the rest of the GL resources. Every call to updateGL in the chart, will first call deleteAllGLResources() on all dataseries and will then call updateGL() on all dataseries. So, when implementing a dataseries: initialize unchanging GL resources in initializeGL(), initialize the rest of your GL resources in updateGL() and make GL-delete calls to all resources initialized in updateGL() in the function deleteAllGLResources(). It is also best to check isNull() on each of your GL-resources when deleting them.