Wt: Wt::Chart::WAbstractGridData Class Reference

Wt 4.10.4

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

Class representing grid-based data for on a 3D chart. More...

`#include <WAbstractGridData.h>`

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

## Public Member Functions
| WAbstractGridData (std::shared_ptr< WAbstractItemModel > model)
| Constructor.
virtual double | minimum (Axis axis) const override=0
| Returns the computed minimum value of this dataseries along the given axis.
virtual double | maximum (Axis axis) const override=0
| Returns the computed maximum value of this dataseries along the given axis.
void | setType (Series3DType type)
| Sets the type of representation that will be used for the data.
virtual Series3DType | type () const
| Returns the type of representation that will be used for the data.
void | setSurfaceMeshEnabled (bool enabled=true)
| Enables or disables a mesh for when a surface is drawn.
bool | isSurfaceMeshEnabled ()
| Returns whether the surface-mesh is enabled for this dataseries.
void | setBarWidth (double xWidth, double yWidth)
| Sets the bar-width.
double | barWidthX ()
| Returns the bar-width in the X-axis direction.
double | barWidthY ()
| Returns the bar-width in the Y-axis direction.
void | setPen (const WPen &pen)
| Sets the WPen that is used for drawing the mesh.
WPen | pen () const
| Returns the pen that is used for drawing the mesh.
std::vector< WSurfaceSelection > | pickSurface (int x, int y) const
| Find all points on the surface that are projected to the given pixel.
WBarSelection | pickBar (int x, int y) const
| Return the bar that is closest to the look point at the given pixel.
void | setIsoLevels (const std::vector< double > &isoLevels)
| Set isoline levels.
const std::vector< double > & | isoLevels () const
| Get all of the isoline levels.
void | setIsoColorMap (const std::shared_ptr< WAbstractColorMap > &colormap)
| Set the color map for the isolines.
std::shared_ptr< WAbstractColorMap > | isoColorMap () const
| Get the color map for the isolines.
void | setClippingMin (Axis axis, float v)
| Set the value below which the data series will be clipped on the given axis.
float | clippingMin (Axis axis) const
| Gets the value below which the data series will be clipped on the given axis.
JSlot & | changeClippingMin (Axis axis)
| JSlot to change the value below which the data series will be clipped on the given axis.
void | setClippingMax (Axis axis, float v)
| Set the value above which the data series will be clipped on the given axis.
float | clippingMax (Axis axis) const
| Gets the value above which the data series will be clipped on the given axis.
JSlot & | changeClippingMax (Axis axis)
| JSlot to change the value above which the data series will be clipped on the given axis.
void | setClippingLinesEnabled (bool clippingLinesEnabled)
| Sets whether clipping lines should be drawn where a surface is clipped.
bool | clippingLinesEnabled () const
| Returns whether clipping lines are enabled.
void | setClippingLinesColor (WColor color)
| Sets the color of the clipping lines.
WColor | clippingLinesColor () const
| Gets the color of the clipping lines.
virtual void | initializeGL () override
| Initialize GL resources.
virtual void | paintGL () const override
| Update the client-side painting function.
virtual void | updateGL () override
| Update GL resources.
virtual void | resizeGL () override
| Act on resize events.
virtual void | deleteAllGLResources () override
| Delete GL resources.
Public Member Functions inherited from Wt::Chart::WAbstractDataSeries3D
| 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.
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.
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::Chart::WAbstractDataSeries3D
Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * | getStateless (Method method)
| On-demand stateless slot implementation.
Protected Attributes inherited from Wt::Chart::WAbstractDataSeries3D

## Detailed Description

Class representing grid-based data for on a 3D chart.

General information can be found at WAbstractDataSeries3D. Information on how the model is structured is provided in the subclasses. GridData can be represented in three ways. This is indicated by Series3DType and can be either Series3DType::Point, Series3DType::Surface or Series3DType::Bar. Note that points and surfaces can only be added to charts of type ChartType::Scatter, while bars can only be added to charts of type ChartType::Category.

When the data is shown as a surface, a mesh can be added to the surface. This draws lines over the surface at the positions of the x- and y-values. For bar-series data, it is possible to adjust the width of the bars in both directions.

The three types of data-representation are illustrated below.

The three representation types of grid-based data

## Member Function Documentation

## ◆ barWidthX()

double Wt::Chart::WAbstractGridData::barWidthX | ( |  | ) |

Returns the bar-width in the X-axis direction.

See also
  setBarWidth()

## ◆ barWidthY()

double Wt::Chart::WAbstractGridData::barWidthY | ( |  | ) |

Returns the bar-width in the Y-axis direction.

See also
  setBarWidth()

## ◆ changeClippingMax()

JSlot & Wt::Chart::WAbstractGridData::changeClippingMax | ( | Axis | axis | ) |

JSlot to change the value above which the data series will be clipped on the given axis.

The JSlot takes one extra argument: the value to clip below.

The jsRef() of this JSlot is only valid when this WAbstractGridData has been added to a WCartesian3DChart. If this WAbstractGridData moves to another WCartesian3DChart, the jsRef() of the JSlot changes.

See also
  setClippingMax()

## ◆ changeClippingMin()

JSlot & Wt::Chart::WAbstractGridData::changeClippingMin | ( | Axis | axis | ) |

JSlot to change the value below which the data series will be clipped on the given axis.

The JSlot takes one extra argument: the value to clip below.

The jsRef() of this JSlot is only valid when this WAbstractGridData has been added to a WCartesian3DChart. If this WAbstractGridData moves to another WCartesian3DChart, the jsRef() of the JSlot changes.

See also
  setClippingMin()

## ◆ clippingLinesColor()

WColor Wt::Chart::WAbstractGridData::clippingLinesColor | ( |  | ) | const

Gets the color of the clipping lines.

See also
  setClippingLinesColor(), setClippingLinesEnabled()

## ◆ clippingLinesEnabled()

bool Wt::Chart::WAbstractGridData::clippingLinesEnabled | ( |  | ) | const

Returns whether clipping lines are enabled.

See also
  setClippingLinesEnabled()

## ◆ clippingMax()

float Wt::Chart::WAbstractGridData::clippingMax | ( | Axis | axis | ) | const

Gets the value above which the data series will be clipped on the given axis.

See also
  setClippingMax()

## ◆ clippingMin()

float Wt::Chart::WAbstractGridData::clippingMin | ( | Axis | axis | ) | const

Gets the value below which the data series will be clipped on the given axis.

See also
  setClippingMin()

## ◆ deleteAllGLResources()

virtual void Wt::Chart::WAbstractGridData::deleteAllGLResources | ( |  | ) |
| overridevirtual

Delete GL resources.

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

Implements Wt::Chart::WAbstractDataSeries3D.

## ◆ initializeGL()

virtual void Wt::Chart::WAbstractGridData::initializeGL | ( |  | ) |
| overridevirtual

Initialize GL resources.

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

Implements Wt::Chart::WAbstractDataSeries3D.

## ◆ isoColorMap()

std::shared_ptr< WAbstractColorMap > Wt::Chart::WAbstractGridData::isoColorMap | ( |  | ) | const

Get the color map for the isolines.

See also
  setIsoColorMap()

## ◆ isoLevels()

const std::vector< double > & Wt::Chart::WAbstractGridData::isoLevels | ( |  | ) | const

Get all of the isoline levels.

See also
  addIsoLevel()

## ◆ isSurfaceMeshEnabled()

bool Wt::Chart::WAbstractGridData::isSurfaceMeshEnabled | ( |  | ) |

Returns whether the surface-mesh is enabled for this dataseries.

See also
  setSurfaceMeshEnabled()

## ◆ maximum()

virtual double Wt::Chart::WAbstractGridData::maximum | ( | Axis | axis | ) | const
| overridepure virtual

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

See also
  minimum()

Implements Wt::Chart::WAbstractDataSeries3D.

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

## ◆ minimum()

virtual double Wt::Chart::WAbstractGridData::minimum | ( | Axis | axis | ) | const
| overridepure virtual

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

See also
  maximum()

Implements Wt::Chart::WAbstractDataSeries3D.

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

## ◆ paintGL()

virtual void Wt::Chart::WAbstractGridData::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.

## ◆ pen()

WPen Wt::Chart::WAbstractGridData::pen | ( |  | ) | const

Returns the pen that is used for drawing the mesh.

See also
  setPen()

## ◆ pickBar()

WBarSelection Wt::Chart::WAbstractGridData::pickBar | ( | int | x,
|  | int | y ) const

Return the bar that is closest to the look point at the given pixel.

A ray is cast from the given pixel's x,y position (from the top left of the chart, in screen coordinates), and the closest bar on this WAbstractGridData is returned, along with its distance from the look point.

Note that if this WAbstractGridData is hidden, this method still returns the closest bar as if it was visible. Also, if multiple bars are on the same bar chart, the bar that is returned may be behind another data series. Use the distance field of the returned WBarSelection to determine which data series is in front from the given angle.

If there is no bar at the given pixel, then a selection with an invalid WModelIndex is returned. The distance is then set to positive infinity.

## ◆ pickSurface()

std::vector< WSurfaceSelection > Wt::Chart::WAbstractGridData::pickSurface | ( | int | x,
|  | int | y ) const

Find all points on the surface that are projected to the given pixel.

A ray is cast from the given pixel's x,y position (from the top left of the chart, in screen coordinates) and every intersection with the surface is returned, along with its distance from the look point. Note that the coordinates of the intersection points are interpolated between the data points that make up the surface.

## ◆ resizeGL()

virtual void Wt::Chart::WAbstractGridData::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.

## ◆ setBarWidth()

void Wt::Chart::WAbstractGridData::setBarWidth | ( | double | xWidth,
|  | double | yWidth )

Sets the bar-width.

This option only takes effect when the type of this WGridData is Series3DType::Bar. The values provided should be between 0 and 1, where 1 lets the bars each take up 1/(nb of x/y-values) of the axis.

The default bar-width is 0.5 in both directions.

## ◆ setClippingLinesColor()

void Wt::Chart::WAbstractGridData::setClippingLinesColor | ( | WColor | color | ) |

Sets the color of the clipping lines.

See also
  setClippingLinesEnabled()

## ◆ setClippingLinesEnabled()

void Wt::Chart::WAbstractGridData::setClippingLinesEnabled | ( | bool | clippingLinesEnabled | ) |

Sets whether clipping lines should be drawn where a surface is clipped.

Clipping lines are disabled by default. Note that rendering will be significantly slower when enabled.

## ◆ setClippingMax()

void Wt::Chart::WAbstractGridData::setClippingMax | ( | Axis | axis,
|  | float | v )

Set the value above which the data series will be clipped on the given axis.

This only affects data series whose type is Series3DType::Surface.

## ◆ setClippingMin()

void Wt::Chart::WAbstractGridData::setClippingMin | ( | Axis | axis,
|  | float | v )

Set the value below which the data series will be clipped on the given axis.

This only affects data series whose type is Series3DType::Surface.

## ◆ setIsoColorMap()

void Wt::Chart::WAbstractGridData::setIsoColorMap | ( | const std::shared_ptr< WAbstractColorMap > & | colormap | ) |

Set the color map for the isolines.

When no color map is defined for the isolines, i.e. isoColorMap() is set to NULL, the color map of this WAbstractGridData will be used.

The isolines are only drawn if the type is Series3DType::Surface.

See also
  addIsoLevel(), setColorMap()

## ◆ setIsoLevels()

void Wt::Chart::WAbstractGridData::setIsoLevels | ( | const std::vector< double > & | isoLevels | ) |

Set isoline levels.

Isolines are drawn on the top or ground plane of the chart. Only applies if the type is Series3DType::Surface.

The isoline levels are set in the coordinate system of the item model.

## ◆ setPen()

void Wt::Chart::WAbstractGridData::setPen | ( | const WPen & | pen | ) |

Sets the WPen that is used for drawing the mesh.

Used when drawing the mesh on a surface or the lines around bars. The default is a default constructed WPen (black and one pixel wide).

Note: only the width and color of this WPen are used.

See also
  setSurfaceMeshEnabled()

## ◆ setSurfaceMeshEnabled()

void Wt::Chart::WAbstractGridData::setSurfaceMeshEnabled | ( | bool | enabled = true | ) |

Enables or disables a mesh for when a surface is drawn.

The default value is false. This option only takes effect when the type of this WGridData is Series3DType::Surface. The mesh is drawn at the position of the x-axis and y-axis values.

## ◆ setType()

void Wt::Chart::WAbstractGridData::setType | ( | Series3DType | type | ) |

Sets the type of representation that will be used for the data.

All representations in Series3DType are possible for the data. Note that Series3DType::Point and Series3DType::Surface can only be used on a chart that is configured as a ChartType::Scatter and Series3DType::Bar can only be used on a chart that is configured to be a ChartType::Category.

The default value is Series3DType::Point.

## ◆ type()

virtual Series3DType Wt::Chart::WAbstractGridData::type | ( |  | ) | const
| virtual

Returns the type of representation that will be used for the data.

See also
  setType()

## ◆ updateGL()

virtual void Wt::Chart::WAbstractGridData::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.