Wt: Wt::Chart::WAbstractDataSeries3D Class Reference

Wt 4.10.4

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Wt::Chart::WAbstractDataSeries3D Class Referenceabstract
Charts (Wt::Chart)

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

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

## 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:

- ItemDataRole::MarkerBrushColor: this determines the color of a datapoint and overrides the default
- ItemDataRole::MarkerScaleFactor: 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.

## 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::WAbstractGridData, and Wt::Chart::WScatterData.

## ◆ 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::WAbstractGridData, and Wt::Chart::WScatterData.

## ◆ 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::WEquidistantGridData, Wt::Chart::WGridData, and Wt::Chart::WScatterData.

## ◆ 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::WEquidistantGridData, Wt::Chart::WGridData, and Wt::Chart::WScatterData.

## ◆ 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::WAbstractGridData, and Wt::Chart::WScatterData.

## ◆ 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::WAbstractGridData, and Wt::Chart::WScatterData.

## ◆ 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::WAbstractGridData, and Wt::Chart::WScatterData.