Wt  4.11.1
Public Member Functions | List of all members
Wt::Chart::WScatterData Class Reference

Class representing a collection of points for on a 3D chart. More...

#include <WScatterData.h>

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

Public Member Functions

 WScatterData (std::shared_ptr< WAbstractItemModel > model)
 Constructor.
 
void setDroplinesEnabled (bool enable=true)
 Enables or disables droplines for all points. More...
 
bool droplinesEnabled () const
 Returns whether droplines are enabled. More...
 
void setDroplinesPen (const WPen &pen)
 Sets the pen that is used to draw droplines. More...
 
WPen droplinesPen () const
 Returns the pen that is used to draw droplines. More...
 
void setXSeriesColumn (int columnNumber)
 Sets the column-index from the model that is used for the x-coordinate of all points. More...
 
int XSeriesColumn () const
 Returns the column-index from the model that is used for the x-coordinate of all points. More...
 
void setYSeriesColumn (int columnNumber)
 Sets the column-index from the model that is used for the y-coordinate of all points. More...
 
int YSeriesColumn () const
 Returns the column-index from the model that is used for the y-coordinate of all points. More...
 
void setZSeriesColumn (int columnNumber)
 Sets the column-index from the model that is used for the z-coordinate of all points. More...
 
int ZSeriesColumn () const
 Returns the column-index from the model that is used for the z-coordinate of all points. More...
 
void setColorColumn (int columnNumber, ItemDataRole role=ItemDataRole::Display)
 Configure a column in the model to be used for the color of the points. More...
 
void setSizeColumn (int columnNumber, ItemDataRole role=ItemDataRole::Display)
 Configure a column in the model to be used for the size of the points. More...
 
std::vector< WPointSelectionpickPoints (int x, int y, int radius) const
 Pick points on this WScatterData using a single pixel. More...
 
std::vector< WPointSelectionpickPoints (int x1, int y1, int x2, int y2) const
 Pick points on this WScatterData inside of a rectangle. More...
 
virtual double minimum (Axis axis) const override
 Returns the computed minimum value of this dataseries along the given axis. More...
 
virtual double maximum (Axis axis) const override
 Returns the computed maximum value of this dataseries along the given axis. More...
 
virtual void initializeGL () override
 Initialize GL resources. More...
 
virtual void paintGL () const override
 Update the client-side painting function. More...
 
virtual void updateGL () override
 Update GL resources. More...
 
virtual void resizeGL () override
 Act on resize events. More...
 
virtual void deleteAllGLResources () override
 Delete GL resources. More...
 
- Public Member Functions inherited from Wt::Chart::WAbstractDataSeries3D
 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...
 
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...
 
- 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

Class representing a collection of points for on a 3D chart.

General information can be found at WAbstractDataSeries3D. The model should be structured as a table where every row represents a point. In the simplest case, there are three columns representing the x-, y- and z-values. By default, this is column 0 for X, column 1 for Y and column 2 for Z. It is also possible to provide an additional column containing information on the color for each point. The same is possible for the size. Color-information in the model should be present as a WColor.

If these extra columns are not included, the ItemDataRole::MarkerBrushColor and ItemDataRole::MarkerScaleFactor can still be used to style individual points. These dataroles should be set on the values in the column containing the z-values.

The figure below shows an upward spiral of points, with droplines enabled and a pointsize of 5 pixels.

An example of WScatterData

Member Function Documentation

◆ deleteAllGLResources()

void Wt::Chart::WScatterData::deleteAllGLResources ( )
overridevirtual

Delete GL resources.

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

Implements Wt::Chart::WAbstractDataSeries3D.

◆ droplinesEnabled()

bool Wt::Chart::WScatterData::droplinesEnabled ( ) const

Returns whether droplines are enabled.

See also
setDroplinesEnabled(), setDroplinesPen()

◆ droplinesPen()

WPen Wt::Chart::WScatterData::droplinesPen ( ) const

Returns the pen that is used to draw droplines.

See also
setDroplinesEnabled(), setDroplinesPen()

◆ initializeGL()

virtual void Wt::Chart::WScatterData::initializeGL ( )
overridevirtual

Initialize GL resources.

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

Implements Wt::Chart::WAbstractDataSeries3D.

◆ maximum()

double Wt::Chart::WScatterData::maximum ( Axis  axis) const
overridevirtual

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

See also
minimum()

Implements Wt::Chart::WAbstractDataSeries3D.

◆ minimum()

double Wt::Chart::WScatterData::minimum ( Axis  axis) const
overridevirtual

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

See also
maximum()

Implements Wt::Chart::WAbstractDataSeries3D.

◆ paintGL()

void Wt::Chart::WScatterData::paintGL ( ) const
overridevirtual

Update the client-side painting function.

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

Implements Wt::Chart::WAbstractDataSeries3D.

◆ pickPoints() [1/2]

std::vector< WPointSelection > Wt::Chart::WScatterData::pickPoints ( int  x,
int  y,
int  radius 
) const

Pick points on this WScatterData using a single pixel.

x,y are the screen coordinates of the pixel from the top left of the chart, and radius is the radius in pixels around that pixel. All points around the ray projected through the pixel within the given radius will be returned.

◆ pickPoints() [2/2]

std::vector< WPointSelection > Wt::Chart::WScatterData::pickPoints ( int  x1,
int  y1,
int  x2,
int  y2 
) const

Pick points on this WScatterData inside of a rectangle.

The screen coordinates (x1, y1) and (x2, y2) from the top left of the chart define a rectangle within which the points should be selected.

◆ resizeGL()

void Wt::Chart::WScatterData::resizeGL ( )
overridevirtual

Act on resize events.

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

Implements Wt::Chart::WAbstractDataSeries3D.

◆ setColorColumn()

void Wt::Chart::WScatterData::setColorColumn ( int  columnNumber,
ItemDataRole  role = ItemDataRole::Display 
)

Configure a column in the model to be used for the color of the points.

By default, the color-column is set to -1. This means there is no column which specifies color-values. Also, the basic mechanism of using the ItemDataRole::MarkerBrushColor (if present) is then active. The Z-seriescolumn is checked for the presence of this Role.

See also
setZSeriesColumn()

◆ setDroplinesEnabled()

void Wt::Chart::WScatterData::setDroplinesEnabled ( bool  enable = true)

Enables or disables droplines for all points.

Enabling droplines will cause a line to be drawn from every point to the the ground-plane of the chart's plotcube. By default the droplines are disabled.

See also
setDroplinesPen()

◆ setDroplinesPen()

void Wt::Chart::WScatterData::setDroplinesPen ( const WPen pen)

Sets the pen that is used to draw droplines.

The default pen is a default constructed WPen.

Note: only the width and color of the pen are used.

See also
setDroplinesEnabled()

◆ setSizeColumn()

void Wt::Chart::WScatterData::setSizeColumn ( int  columnNumber,
ItemDataRole  role = ItemDataRole::Display 
)

Configure a column in the model to be used for the size of the points.

By default, the size-column is set to -1. This means there is no column which specifies size-values. Also, the basic mechanism of using the ItemDataRole::MarkerScaleFactor (if present) is then active. The Z-seriescolumn is checked for the presence of this Role.

See also
setZSeriesColumn()

◆ setXSeriesColumn()

void Wt::Chart::WScatterData::setXSeriesColumn ( int  columnNumber)

Sets the column-index from the model that is used for the x-coordinate of all points.

The default X column index is 0.

◆ setYSeriesColumn()

void Wt::Chart::WScatterData::setYSeriesColumn ( int  columnNumber)

Sets the column-index from the model that is used for the y-coordinate of all points.

The default X column index is 1.

◆ setZSeriesColumn()

void Wt::Chart::WScatterData::setZSeriesColumn ( int  columnNumber)

Sets the column-index from the model that is used for the z-coordinate of all points.

The default Z column index is 2.

Note that this column is also used to check for a ItemDataRole::MarkerBrushColor and a ItemDataRole::MarkerScaleFactor is no color-column or size-column are set.

See also
setColorColumn(), setSizeColumn()

◆ updateGL()

void Wt::Chart::WScatterData::updateGL ( )
overridevirtual

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()

Implements Wt::Chart::WAbstractDataSeries3D.

◆ XSeriesColumn()

int Wt::Chart::WScatterData::XSeriesColumn ( ) const

Returns the column-index from the model that is used for the x-coordinate of all points.

See also
setXSeriesColumn()

◆ YSeriesColumn()

int Wt::Chart::WScatterData::YSeriesColumn ( ) const

Returns the column-index from the model that is used for the y-coordinate of all points.

See also
setYSeriesColumn()

◆ ZSeriesColumn()

int Wt::Chart::WScatterData::ZSeriesColumn ( ) const

Returns the column-index from the model that is used for the z-coordinate of all points.

See also
setZSeriesColumn()