Wt  4.11.1
Public Member Functions | List of all members
Wt::Chart::WAbstractDataSeries3D Class Referenceabstract

Abstract base class for dataseries that can be drawn on a WCartesian3DChart. More...

#include <WAbstractDataSeries3D.h>

Inheritance diagram for Wt::Chart::WAbstractDataSeries3D:
[legend]

Public Member Functions

 WAbstractDataSeries3D (std::shared_ptr< WAbstractItemModel > model)
 Constructor. More...
 
void setTitle (const WString &name)
 Sets the title of this dataseries. More...
 
const WStringtitle () const
 Returns the title of this dataseries. More...
 
void setModel (const std::shared_ptr< WAbstractItemModel > &model)
 Sets a model from which the dataseries gets its data. More...
 
std::shared_ptr< WAbstractItemModelmodel () const
 Returns a pointer to the model used by this dataseries. More...
 
virtual double minimum (Axis axis) const =0
 Returns the computed minimum value of this dataseries along the given axis. More...
 
virtual double maximum (Axis axis) const =0
 Returns the computed maximum value of this dataseries along the given axis. More...
 
const WCartesian3DChartchart () const
 Returns a const pointer to the WCartesian3DChart on which the dataseries is drawn.
 
void setPointSize (double size)
 Sets the pointsize for drawing this dataseries. More...
 
double pointSize () const
 Returns the pointsize for drawing this dataseries. More...
 
void setPointSprite (const std::string &image)
 Set the point sprite used for drawing this dataseries. More...
 
const std::string & pointSprite () const
 Returns the point sprite used for drawing this dataseries. More...
 
void setColorMap (const std::shared_ptr< WAbstractColorMap > &colormap)
 Sets the colormap for this dataseries. More...
 
const WAbstractColorMapcolorMap () const
 Returns the colormap used by this dataseries. More...
 
void setColorMapVisible (bool enabled=true)
 Sets whether the colormap that is used should be shown alongside the chart in the form of a legend. More...
 
bool colorMapVisible () const
 Returns whether the colormap is shown alongside the chart in the form of a legend. More...
 
void setColorMapSide (Side side)
 Sets whether the colormap is shown on the left or right. More...
 
Side colorMapSide () const
 Returns on which side the colormap is shown. More...
 
void setLegendEnabled (bool enabled=true)
 Sets whether this dataseries is included in the chart-legend. More...
 
bool isLegendEnabled () const
 Returns whether this dataseries is included in the chart-legend. More...
 
void setHidden (bool enabled=true)
 Sets if this dataseries is hidden. More...
 
bool isHidden () const
 Returns if this dataseries is hidden. More...
 
virtual void initializeGL ()=0
 Initialize GL resources. More...
 
virtual void paintGL () const =0
 Update the client-side painting function. More...
 
virtual void updateGL ()=0
 Update GL resources. More...
 
virtual void resizeGL ()=0
 Act on resize events. More...
 
virtual void deleteAllGLResources ()=0
 Delete GL resources. More...
 
- Public Member Functions inherited from Wt::WObject
void addChild (std::unique_ptr< WObject > child)
 Add a child WObject whose lifetime is determined by this WObject.
 
template<typename Child >
Child * addChild (std::unique_ptr< Child > child)
 Add a child WObject, returning a raw pointer. More...
 
std::unique_ptr< WObjectremoveChild (WObject *child)
 Remove a child WObject, so its lifetime is no longer determined by this WObject.
 
template<typename Child >
std::unique_ptr< Child > removeChild (Child *child)
 Remove a child WObject, so its lifetime is no longer determined by this WObject. More...
 
virtual const std::string id () const
 Returns the (unique) identifier for this object. More...
 
virtual void setObjectName (const std::string &name)
 Sets an object name. More...
 
virtual std::string objectName () const
 Returns the object name. More...
 
void resetLearnedSlots ()
 Resets learned stateless slot implementations. More...
 
template<class T >
void resetLearnedSlot (void(T::*method)())
 Resets a learned stateless slot implementation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)())
 Declares a slot to be stateless and learn client-side behaviour on first invocation. More...
 
template<class T >
WStatelessSlot * implementStateless (void(T::*method)(), void(T::*undoMethod)())
 Declares a slot to be stateless and learn client-side behaviour in advance. More...
 
void isNotStateless ()
 Marks the current function as not stateless. More...
 
template<class T >
WStatelessSlot * implementJavaScript (void(T::*method)(), const std::string &jsCode)
 Provides a JavaScript implementation for a method. More...
 
- Public Member Functions inherited from Wt::Core::observable
 observable () noexcept
 Default constructor.
 
virtual ~observable ()
 Destructor. More...
 
template<typename... Args, typename C >
auto bindSafe (void(C::*method)(Args...)) noexcept
 Protects a method call against object destruction. More...
 
template<typename... Args, typename C >
auto bindSafe (void(C::*method)(Args...) const) const noexcept
 Protects a const method call against object destruction. More...
 
template<typename Function >
auto bindSafe (const Function &function) noexcept
 Protects a function against object destruction. More...
 

Additional Inherited Members

- Public Types inherited from Wt::WObject
typedef void(WObject::* Method) ()
 Typedef for a WObject method without arguments.
 
- Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * getStateless (Method method)
 On-demand stateless slot implementation. More...
 

Detailed Description

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 ChartType::Scatter, if it holds categorical data it should be added to a chart of type ChartType::Category.

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. ItemDataRole::MarkerBrushColor 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:

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.

Constructor & Destructor Documentation

◆ WAbstractDataSeries3D()

Wt::Chart::WAbstractDataSeries3D::WAbstractDataSeries3D ( std::shared_ptr< WAbstractItemModel model)

Constructor.

This constructor takes a WAbstractItemModel as an argument. The model contains the data of this dataseries. How the model should be structured is dependent on the implementation. Therefore this information is found in the documentation of classes deriving from this one.

Member Function Documentation

◆ colorMap()

const WAbstractColorMap* Wt::Chart::WAbstractDataSeries3D::colorMap ( ) const

Returns the colormap used by this dataseries.

If this dataseries has no colormap set, 0 will be returned.

See also
setColorMap(), setColorMapVisible(), setColorMapSide()

◆ colorMapSide()

Side Wt::Chart::WAbstractDataSeries3D::colorMapSide ( ) const

Returns on which side the colormap is shown.

See also
setColorMap, setColorMapVisible(), setColorMapSide()

◆ colorMapVisible()

bool Wt::Chart::WAbstractDataSeries3D::colorMapVisible ( ) const

Returns whether the colormap is shown alongside the chart in the form of a legend.

See also
setColorMap(), setColorMapVisible(), setColorMapSide()

◆ deleteAllGLResources()

virtual void Wt::Chart::WAbstractDataSeries3D::deleteAllGLResources ( )
pure virtual

Delete GL resources.

This function is called by updateGL() in the chart to which this dataseries was added.

Implemented in Wt::Chart::WScatterData, and Wt::Chart::WAbstractGridData.

◆ initializeGL()

virtual void Wt::Chart::WAbstractDataSeries3D::initializeGL ( )
pure virtual

Initialize GL resources.

This function is called by initializeGL() in the chart to which this dataseries was added.

Implemented in Wt::Chart::WScatterData, and Wt::Chart::WAbstractGridData.

◆ isHidden()

bool Wt::Chart::WAbstractDataSeries3D::isHidden ( ) const

Returns if this dataseries is hidden.

See also
setHidden()

◆ isLegendEnabled()

bool Wt::Chart::WAbstractDataSeries3D::isLegendEnabled ( ) const

Returns whether this dataseries is included in the chart-legend.

See also
setLegendEnabled()

◆ maximum()

virtual double Wt::Chart::WAbstractDataSeries3D::maximum ( Axis  axis) const
pure virtual

Returns the computed maximum value of this dataseries along the given axis.

See also
minimum()

Implemented in Wt::Chart::WAbstractGridData, Wt::Chart::WScatterData, Wt::Chart::WGridData, and Wt::Chart::WEquidistantGridData.

◆ minimum()

virtual double Wt::Chart::WAbstractDataSeries3D::minimum ( Axis  axis) const
pure virtual

Returns the computed minimum value of this dataseries along the given axis.

See also
maximum()

Implemented in Wt::Chart::WAbstractGridData, Wt::Chart::WScatterData, Wt::Chart::WGridData, and Wt::Chart::WEquidistantGridData.

◆ model()

std::shared_ptr<WAbstractItemModel> Wt::Chart::WAbstractDataSeries3D::model ( ) const

Returns a pointer to the model used by this dataseries.

See also
setModel()

◆ paintGL()

virtual void Wt::Chart::WAbstractDataSeries3D::paintGL ( ) const
pure virtual

Update the client-side painting function.

This function is called by paintGL() in the chart to which this dataseries was added.

Implemented in Wt::Chart::WScatterData, and Wt::Chart::WAbstractGridData.

◆ pointSize()

double Wt::Chart::WAbstractDataSeries3D::pointSize ( ) const

Returns the pointsize for drawing this dataseries.

See also
setPointSize()

◆ pointSprite()

const std::string& Wt::Chart::WAbstractDataSeries3D::pointSprite ( ) const

Returns the point sprite used for drawing this dataseries.

See also
setPointSprite()

◆ resizeGL()

virtual void Wt::Chart::WAbstractDataSeries3D::resizeGL ( )
pure virtual

Act on resize events.

This function is called by resizeGL() in the chart to which this dataseries was added.

Implemented in Wt::Chart::WScatterData, and Wt::Chart::WAbstractGridData.

◆ setColorMap()

void Wt::Chart::WAbstractDataSeries3D::setColorMap ( const std::shared_ptr< WAbstractColorMap > &  colormap)

Sets the colormap for this dataseries.

Ownership of the WAbstractColorMap is transferred to this class.

By default there is no colormap set. When a colormap is set on a dataseries, the color of WCartesian3DChart::palette() is no longer used for this series. The colormap associates a color to the data based on the z-value of the data. If the colormap is set to 0, the value of the palette will be used again.

See also
setColorMapVisible(), setColorMapSide()

◆ setColorMapSide()

void Wt::Chart::WAbstractDataSeries3D::setColorMapSide ( Side  side)

Sets whether the colormap is shown on the left or right.

The default side is Side::Right.

Note: only Side::Left and Side::Right are valid values for this function.

See also
setColorMap(), setColorMapVisible()

◆ setColorMapVisible()

void Wt::Chart::WAbstractDataSeries3D::setColorMapVisible ( bool  enabled = true)

Sets whether the colormap that is used should be shown alongside the chart in the form of a legend.

The default value is false.

See also
setColorMap(), setColorMapSide()

◆ setHidden()

void Wt::Chart::WAbstractDataSeries3D::setHidden ( bool  enabled = true)

Sets if this dataseries is hidden.

By default dataseries are visible.

◆ setLegendEnabled()

void Wt::Chart::WAbstractDataSeries3D::setLegendEnabled ( bool  enabled = true)

Sets whether this dataseries is included in the chart-legend.

By default, dataseries are enabled in the legend.

◆ setModel()

void Wt::Chart::WAbstractDataSeries3D::setModel ( const std::shared_ptr< WAbstractItemModel > &  model)

Sets a model from which the dataseries gets its data.

Every dataseries needs a model from which it gets the data. How the data is structured is determined by the type of dataseries. Therefore more info on how to construct a proper model is provided in classes that derive from this one.

See also
model(), WAbstractDataSeries3D()

◆ setPointSize()

void Wt::Chart::WAbstractDataSeries3D::setPointSize ( double  size)

Sets the pointsize for drawing this dataseries.

The default pointsize is 2 pixels.

Note: Setting the point-size is currently not supported in IE.

◆ setPointSprite()

void Wt::Chart::WAbstractDataSeries3D::setPointSprite ( const std::string &  image)

Set the point sprite used for drawing this dataseries.

This should be a local (server side) path to an image, such as a PNG or GIF. Only the alpha channel of this image is used: the sprite only decides if a pixel in the point appears or not. If the alpha value is below 0.5, the pixel is discarded.

For best effect, the point sprite's width and height should be the same as the pointSize(), and the chart's antialiasing should be disabled.

Defaults to the empty string, meaning that every pixel of the point will be drawn, yielding a square.

◆ setTitle()

void Wt::Chart::WAbstractDataSeries3D::setTitle ( const WString name)

Sets the title of this dataseries.

When a dataseries that did not have a title set, is added to a WCartesian3DChart it automatically gets the default title 'dataset i', with i the count of how many dataseries have been added to the chart.

See also
name()

◆ title()

const WString& Wt::Chart::WAbstractDataSeries3D::title ( ) const

Returns the title of this dataseries.

See also
setName()

◆ updateGL()

virtual void Wt::Chart::WAbstractDataSeries3D::updateGL ( )
pure virtual

Update GL resources.

This function is called by updateGL() in the chart to which this dataseries was added. Before this function is called, deleteAllGLResources() is called.

See also
deleteAllGLResources()

Implemented in Wt::Chart::WScatterData, and Wt::Chart::WAbstractGridData.