A 3D Cartesian chart. More...

Classes | |
| class | IntersectionPlane |
| An invisible intersection plane. More... | |
Public Member Functions | |
| WCartesian3DChart (WContainerWidget *parent=0) | |
| Constructor. | |
| WCartesian3DChart (ChartType type, WContainerWidget *parent=0) | |
| Constructor. | |
| ~WCartesian3DChart () | |
| Destructor. | |
| void | addDataSeries (WAbstractDataSeries3D *dataseries) |
| Add a dataseries to the chart. | |
| void | removeDataSeries (WAbstractDataSeries3D *dataseries) |
| Removes a dataseries from a chart. | |
| const std::vector < WAbstractDataSeries3D * > & | dataSeries () const |
| Returns all dataseries that were added to this chart. | |
| WAxis & | axis (Axis axis) |
| Returns the specified axis belonging to the chart. | |
| const WAxis & | axis (Axis axis) const |
| Returns the specified axis belonging to the chart. | |
| void | setGridEnabled (Plane plane, Axis axis, bool enabled=true) |
| Enable/disable gridlines. | |
| bool | isGridEnabled (Plane plane, Axis axis) |
| Returns whether the gridlines are enabled. | |
| void | setIntersectionLinesEnabled (bool enabled=true) |
| Set whether intersection lines are shown between surface charts. | |
| bool | isIntersectionLinesEnabled () const |
| Returns whether intersection lines are shown between surface charts. | |
| void | setIntersectionLinesColor (WColor color) |
| Sets the color of the intersection lines between surface charts. | |
| const WColor & | intersectionLinesColor () const |
| Gets the color of the intersection lines between surface charts. | |
| void | setIntersectionPlanes (const std::vector< IntersectionPlane > &intersectionPlanes) |
| Set the invisible planes with which intersections are drawn. | |
| const std::vector < IntersectionPlane > & | intersectionPlanes () const |
| Get the invisible planes with which intersections are drawn. | |
| void | setGridLinesPen (const WPen &pen) |
| Sets the pen used for drawing the gridlines. | |
| const WPen & | gridLinesPen () const |
| Returns the pen used for drawing the gridlines. | |
| void | setCubeLinesPen (const WPen &pen) |
| Sets the pen used to draw the edges of the plotcube. | |
| const WPen & | cubeLinesPen () const |
| Returns a reference to the pen used for drawing the edges of the plotcube. | |
| void | setType (ChartType type) |
| Sets the type of this chart. | |
| ChartType | type () const |
| Returns the type of this chart. | |
| void | setPalette (WChartPalette *palette) |
| Sets the palette for this chart. | |
| WChartPalette * | palette () const |
| Returns the palette used for this chart. | |
| void | setBackground (const WColor &background) |
| Sets the background color for this chart. | |
| const WColor & | background () const |
| Returns the background color used for this chart. | |
| void | setTitle (const WString &title) |
| Sets the title that is put on the chart. | |
| const WString & | title () const |
| Returns the title that is put at the top of this chart. | |
| void | setTitleFont (const WFont &titleFont) |
| Sets the font that is used to draw the title. | |
| const WFont & | titleFont () const |
| Returns the font used to draw the title. | |
| void | setLegendEnabled (bool enabled) |
| Enables the legend. | |
| bool | isLegendEnabled () const |
| Returns whether the legend is enabled. | |
| void | setLegendLocation (Side side, AlignmentFlag alignment) |
| Configures the location of the legend. | |
| void | setLegendStyle (const WFont &font, const WPen &border, const WBrush &background) |
| Configures the legend decoration. | |
| Side | legendSide () const |
| Returns the legend side. | |
| AlignmentFlag | legendAlignment () const |
| Returns the legend alignment. | |
| int | legendColumns () const |
| Returns the number of legend columns. | |
| WLength | legendColumnWidth () const |
| Returns the legend column width. | |
| WFont | legendFont () const |
| Returns the legend font. | |
| WPen | legendBorder () const |
| Returns the legend border pen. | |
| WBrush | legendBackground () const |
| Returns the legend background brush. | |
| void | setLegendColumns (int columns, const WLength &columnWidth) |
| Configures the number of columns and columnwidth of the legend. | |
| void | initLayout () |
| Initializes the chart layout. | |
| void | setCameraMatrix (const WMatrix4x4 &matrix) |
| Set the camera-matrix. | |
| WMatrix4x4 | cameraMatrix () const |
| Get the current camera-matrix. | |
| JavaScriptMatrix4x4 | jsMatrix () const |
| Get the current camera matrix as a JavaScriptMatrix4x4. | |
| void | updateChart (WFlags< ChartUpdates > flags) |
| Update the chart. | |
| void | resize (const WLength &width, const WLength &height) |
| Resizes the widget. | |
Protected Member Functions | |
| void | initializeGL () |
| Initialize the WebGL state when the widget is first shown. | |
| void | paintGL () |
| Update the client-side painting function. | |
| void | updateGL () |
| Update state set in initializeGL() | |
| void | resizeGL (int width, int height) |
| Act on resize events. | |
A 3D Cartesian chart.
The chart consists of a plotcube, which is always open on the front, and adapts to the data which is shown on the chart. The plotcube has three axes of type WAxis. Each of these can be manually configured as in the 2D case. The chart can be either a ScatterPlot or a CategoryChart. This influences how the data is positioned in relation to the x/y-axis. Gridlines can also be drawn on each of the plotcube-planes. The chart has a mouse-handler which allows rotation of the chart around the center of the plotcube. Zooming in and out is possible by scrolling.
Data that can be shown on the chart derives from WAbstractDataSeries3D. Multiple dataseries can be added to the chart using addDataSeries(). The color of the dataseries is by default determined by the colors of the WChartPalette. This way a separate color is assigned to each new dataseries. All rendering logic of the data is contained in the dataseries-classes and further styling is often possible there. For example, a WAbstractColorMap can be added to a dataseries, which will assign a color to datapoints based on their z-value. More information on this is found in the documentation of WAbstractDataSeries3D.
It is possible to assign a title to the chart. A legend can also be shown that lists the titles of all dataseries (unless disabled in the dataseries itself). The legend position and style can be configured. In addition to title and legend, a colormap-legend is shown for every dataseries which has a colormap enabled and indicates that it should be displayed on the chart.
| Wt::Chart::WCartesian3DChart::WCartesian3DChart | ( | WContainerWidget * | parent = 0 | ) |
Constructor.
Constructs a cartesian 3D chart, with the type set to ScatterPlot, a transparent background, a WStandardPalette::Muted palette and no gridlines.
| Wt::Chart::WCartesian3DChart::WCartesian3DChart | ( | ChartType | type, |
| WContainerWidget * | parent = 0 |
||
| ) |
Constructor.
Construct a cartesian 3D chart with the specified type , a transparent background, a WStandardPalette::Muted palette and no gridlines.
| void Wt::Chart::WCartesian3DChart::addDataSeries | ( | WAbstractDataSeries3D * | dataseries | ) |
Add a dataseries to the chart.
Ownership of the dataseries is transferred to the chart.
If the chart is of type ScatterPlot only numerical dataseries should be added and if it is of type CategoryChart only categorical dataseries should be added. If multiple categorical datasets are added, the axis-labels of the first dataseries will be used on the chart.
Note that a dataseries can only be added once.
| const WColor& Wt::Chart::WCartesian3DChart::background | ( | ) | const |
Returns the background color used for this chart.
Get the current camera-matrix.
The matrix represents the current view on the scene. It corresponds to a coordinate system where the chart's axes run from 0 to 1 in all three directions.
| const WPen& Wt::Chart::WCartesian3DChart::cubeLinesPen | ( | ) | const |
Returns a reference to the pen used for drawing the edges of the plotcube.
The width and color of the pen are used when drawing the edges of the plotcube
| const std::vector<WAbstractDataSeries3D*>& Wt::Chart::WCartesian3DChart::dataSeries | ( | ) | const |
Returns all dataseries that were added to this chart.
| const WPen& Wt::Chart::WCartesian3DChart::gridLinesPen | ( | ) | const |
Returns the pen used for drawing the gridlines.
| void Wt::Chart::WCartesian3DChart::initializeGL | ( | ) | [protected, virtual] |
Initialize the WebGL state when the widget is first shown.
Specialized for chart rendering.
Reimplemented from Wt::WGLWidget.
Initializes the chart layout.
This method must be called before any methods relating to the layout of the chart are called (eg. calling minimum() or maximum() on one of the axes). The method is also automatically called when the chart is rendered.
| const WColor& Wt::Chart::WCartesian3DChart::intersectionLinesColor | ( | ) | const |
Gets the color of the intersection lines between surface charts.
| const std::vector< WCartesian3DChart::IntersectionPlane > & Wt::Chart::WCartesian3DChart::intersectionPlanes | ( | ) | const |
Get the invisible planes with which intersections are drawn.
| bool Wt::Chart::WCartesian3DChart::isGridEnabled | ( | Plane | plane, |
| Axis | axis | ||
| ) |
Returns whether the gridlines are enabled.
| bool Wt::Chart::WCartesian3DChart::isIntersectionLinesEnabled | ( | ) | const |
Returns whether intersection lines are shown between surface charts.
| bool Wt::Chart::WCartesian3DChart::isLegendEnabled | ( | ) | const |
Returns whether the legend is enabled.
Get the current camera matrix as a JavaScriptMatrix4x4.
This JavaScriptMatrix4x4 can be used to implement a custom mouse handler using setClientSideMouseHandler().
Returns the legend alignment.
Returns the legend background brush.
Returns the legend border pen.
| int Wt::Chart::WCartesian3DChart::legendColumns | ( | ) | const |
Returns the number of legend columns.
Returns the legend column width.
Returns the legend font.
| Side Wt::Chart::WCartesian3DChart::legendSide | ( | ) | const |
Returns the legend side.
| void Wt::Chart::WCartesian3DChart::paintGL | ( | ) | [protected, virtual] |
Update the client-side painting function.
Specialized for chart rendering.
Reimplemented from Wt::WGLWidget.
Returns the palette used for this chart.
| void Wt::Chart::WCartesian3DChart::removeDataSeries | ( | WAbstractDataSeries3D * | dataseries | ) |
Removes a dataseries from a chart.
This removes the data from the chart and transfers ownership back. The data can then be added to another chart.
| void Wt::Chart::WCartesian3DChart::resize | ( | const WLength & | width, |
| const WLength & | height | ||
| ) | [virtual] |
Resizes the widget.
Specifies a fixed size for this widget, setting CSS width and height properties. By default a widget has automatic width and height, which sets a size for the widget following CSS rules.
When the widget is not managed by a layout manager, the automatic (natural) size of a widget depends on whether they widget is a block or inline widget:
When inserted in a layout manager, the size set will be used as a widget's preferred size, but the widget may be given a different size by the layout manager based on available space and stretch factors. The actual size given by a layout manager may be retrieved by making the widget "layout size aware", using setLayoutSizeAware(). If you have defined a "wtResize()" JavaScript method for the widget, then this method will also be called.
The default width and height of a widget is WLength::Auto.
Reimplemented from Wt::WGLWidget.
| void Wt::Chart::WCartesian3DChart::resizeGL | ( | int | width, |
| int | height | ||
| ) | [protected, virtual] |
| void Wt::Chart::WCartesian3DChart::setBackground | ( | const WColor & | background | ) |
Sets the background color for this chart.
This sets the GL-clearcolor. The default is transparant, which will cause the background to have the color set in css.
| void Wt::Chart::WCartesian3DChart::setCameraMatrix | ( | const WMatrix4x4 & | matrix | ) |
Set the camera-matrix.
The viewpoint can be set with the camera-matrix. The chart is defined in the world coordinate system as a cube with axes from 0 to 1 in all three directions. Therefore the center of the cube is positioned at (0.5, 0.5, 0.5). The camera can be most easily position with the lookAt method of WMatrix4x4. A common use-case when manipulating the matrix is to translate the center to the origin and then rotate.
For example:
{.cpp}
...
WMatrix4x4 camera;
camera.lookAt(0.5, 0.5, z, // camera position
0.5, 0.5, 0.5, // center of the scene
0, 1, 0); // up direction
camera.translate(0.5, 0.5, 0.5);
... // some rotations
camera.translate(-0.5, -0.5, -0.5);
| void Wt::Chart::WCartesian3DChart::setCubeLinesPen | ( | const WPen & | pen | ) |
Sets the pen used to draw the edges of the plotcube.
The default pen for drawing cubelines is a black pen of width 0.
Note: Only width and color of the pen are used, all other styling is ignored.
| void Wt::Chart::WCartesian3DChart::setGridEnabled | ( | Plane | plane, |
| Axis | axis, | ||
| bool | enabled = true |
||
| ) |
Enable/disable gridlines.
Enables or disables gridlines in the given plane, along the given axis. All gridlines are by default disabled.
| void Wt::Chart::WCartesian3DChart::setGridLinesPen | ( | const WPen & | pen | ) |
Sets the pen used for drawing the gridlines.
The default pen for drawing gridlines is a black pen of width 0.
| void Wt::Chart::WCartesian3DChart::setIntersectionLinesEnabled | ( | bool | enabled = true | ) |
Set whether intersection lines are shown between surface charts.
This is disabled by default.
| void Wt::Chart::WCartesian3DChart::setIntersectionPlanes | ( | const std::vector< IntersectionPlane > & | intersectionPlanes | ) |
Set the invisible planes with which intersections are drawn.
This plane is perpendicular to the given axis, and the intersection is shown in the given color.
Note that render times will take increasingly longer as you add more intersection planes.
| void Wt::Chart::WCartesian3DChart::setLegendColumns | ( | int | columns, |
| const WLength & | columnWidth | ||
| ) |
Configures the number of columns and columnwidth of the legend.
The default value is a single column, 100 pixels wide.
| void Wt::Chart::WCartesian3DChart::setLegendEnabled | ( | bool | enabled | ) |
Enables the legend.
The location of the legend can be configured using setLegendLocation(). Only series for which the legend is enabled are included in this legend.
The default value is false.
| void Wt::Chart::WCartesian3DChart::setLegendLocation | ( | Side | side, |
| AlignmentFlag | alignment | ||
| ) |
Configures the location of the legend.
The provided side can either be Wt::Left, Wt::Right, Wt::Top, Wt::Bottom and configures the side of the chart at which the legend is displayed.
The alignment specifies how the legend is aligned. This can be a horizontal alignment flag (Wt::AlignLeft, Wt::AlignCenter, or Wt::AlignRight), when the side is Bottom or Top, or a vertical alignment flag (Wt::AlignTop, Wt::AlignMiddle, or Wt::AlignBottom) when the side is Left or Right.
The default location is Wt::Right and Wt::AlignMiddle.
| void Wt::Chart::WCartesian3DChart::setLegendStyle | ( | const WFont & | font, |
| const WPen & | border, | ||
| const WBrush & | background | ||
| ) |
Configures the legend decoration.
This configures the font, border and background for the legend.
The default font is a 10pt sans serif font (the same as the default axis label font), the default border is NoPen and the default background is NoBrush.
| void Wt::Chart::WCartesian3DChart::setPalette | ( | WChartPalette * | palette | ) |
Sets the palette for this chart.
Ownership of the WChartPalette is transferred to the chart.
The given palette determines which color subsequent dataseries will have. If a dataseries has a colormap set, then the palette is not used for this data.
| void Wt::Chart::WCartesian3DChart::setTitle | ( | const WString & | title | ) |
Sets the title that is put on the chart.
The title is always put at the top of the chart and in the center.
| void Wt::Chart::WCartesian3DChart::setTitleFont | ( | const WFont & | titleFont | ) |
Sets the font that is used to draw the title.
The default font is the default constructed WFont.
| void Wt::Chart::WCartesian3DChart::setType | ( | ChartType | type | ) |
Sets the type of this chart.
Sets the type of this chart to either ScatterPlot (for drawing numerical data) or to CategoryChart (for drawing categorical data).
| const WString& Wt::Chart::WCartesian3DChart::title | ( | ) | const |
Returns the title that is put at the top of this chart.
| const WFont& Wt::Chart::WCartesian3DChart::titleFont | ( | ) | const |
Returns the font used to draw the title.
| ChartType Wt::Chart::WCartesian3DChart::type | ( | ) | const |
Returns the type of this chart.
| void Wt::Chart::WCartesian3DChart::updateGL | ( | ) | [protected, virtual] |
Update state set in initializeGL()
Specialized for chart rendering.
Reimplemented from Wt::WGLWidget.
1.7.6.1