Class WCartesianChart


public class WCartesianChart
extends WAbstractChart
A cartesian chart.

A cartesian chart is a chart that uses X and Y axes. It can display one or multiple data series, which each may be rendered using bars, lines, areas, or points.

To use a cartesian chart, the minimum you need to do is set a model using WAbstractChart#setModel(), set the model column that holds the X data using setXSeriesColumn(), and add one or more series using addSeries(). Each series corresponds to one data column that holds Y data.

A cartesian chart is either a ChartType.Category or a ChartType.Scatter.

In a ChartType.Category, the X series represent different categories, which are listed consecutively in model row order. The X axis scale is set to AxisScale.Discrete.

A category chart with bar series

Each series may be rendered differently, and this is configured in the data series (see WDataSeries for more information).

In a ChartType.Scatter, the X series data are interpreted as numbers on a numerical scale. The scale for the X axis defaults to a AxisScale.Linear, but this may be changed to a AxisScale.Date when the X series contains dates (of type WDate) to create a time series chart, or to a AxisScale.Log. A ChartType.Scatter supports the same types of data series as a ChartType.Category, but does not support stacking. In a scatter plot, the X series do not need to be ordered in increasing values, and may be set differently for each dataseries using WDataSeries#setXSeriesColumn().

A time series scatter plot with line series

Missing data in a model series Y values is interpreted as a break. For curve-like series, this breaks the curve (or line).

The cartesian chart has support for dual Y axes. Each data series may be bound to one of the two Y axes. By default, only the first Y axis is displayed. To show the second Y axis you will need to call:

By default a chart has a horizontal X axis and a vertical Y axis, which corresponds to a Orientation.Vertical orientation. The orientation may be changed to Orientation.Horizontal using setOrientation().

The styling of the series data are dictated by a palette which may be set using setPalette(WChartPalette *), but may be overridden by settings in each data series.

CSS

Styling through CSS is not applicable.

Client-side interaction

WCartesianChart has several features that allow interaction with the chart without server roundtrips. These features include zoom, pan, crosshair and follow curve functionality.

Note: Client side interaction is only available if the chart is drawn on an HTML canvas. This is the default rendering method on modern browsers, see WPaintedWidget#setPreferredMethod()

Note: Some features are currently not supported in interactive mode:

  • Axes set at AxisValue.Zero position will not always be drawn correctly. They may be clipped off outside of the chart area, and when zooming, the axis ticks will change size.
  • WAxis#setBreak() is incompatible with interactive mode
See Also:
WDataSeries, WAxis, WPieChart
  • Constructor Details

  • Method Details

    • remove

      public void remove()
      Description copied from class: WAbstractChart
      Destructor.
      Overrides:
      remove in class WAbstractChart
      See Also:
      WWidget.removeWidget(WWidget widget)
    • setType

      public void setType​(ChartType type)
      Sets the chart type.

      The chart type determines how (x,y) data are interpreted. In a ChartType.Category, the X values are categories, and these are plotted consecutively, evenly spaced, and in row order. In a ChartType.Scatter, the X values are interpreted numerically (as for Y values).

      The default chart type is a ChartType.Category.

      See Also:
      getType(), WAxis.setScale(AxisScale scale), getAxis(Axis axis)
    • getType

      public ChartType getType()
      Returns the chart type.

      See Also:
      setType(ChartType type)
    • setOrientation

      public void setOrientation​(Orientation orientation)
      Sets the chart orientation.

      Sets the chart orientation, which corresponds to the orientation of the Y axis: a Orientation.Vertical orientation corresponds to the conventional way of a horizontal X axis and vertical Y axis. A Orientation.Horizontal orientation is the other way around.

      The default orientation is Orientation.Vertical.

      See Also:
      getOrientation()
    • getOrientation

      public Orientation getOrientation()
      Returns the chart orientation.

      See Also:
      setOrientation(Orientation orientation)
    • setXSeriesColumn

      public void setXSeriesColumn​(int modelColumn)
      Sets the the model column for the X series.

      Use this method to specify the default data for the X series. For a ChartType.Scatter this is mandatory if an X series is not specified for every WDataSeries. For a ChartType.Category, if not specified, an increasing series of integer numbers will be used (1, 2, ...).

      Scatterplot dataseries may each individually be given its own X series data using WDataSeries#setXSeriesColumn()

      The default value is -1 (not specified).

      The series column is reset to -1 when the model is set (or changed). Thus you need to set a model before configuring the series.

      See Also:
      XSeriesColumn()
    • setTextPen

      public void setTextPen​(WPen pen)
      set the pen used to render the labels

      This method overwrites the pen for all axes

      See Also:
      WAxis.setTextPen(WPen pen)
    • XSeriesColumn

      public int XSeriesColumn()
      Returns the model column for the X series.

      See Also:
      setXSeriesColumn(int modelColumn)
    • addSeries

      public void addSeries​(WDataSeries series)
      Adds a data series.

      A single chart may display one or more data series. Each data series displays data from a single model column in the chart. Series are plotted in the order that they have been added to the chart.

      The series column is reset to -1 when the model is set (or changed). Thus you need to set a model before configuring the series.

      See Also:
      removeSeries(WDataSeries series), setSeries(List series)
    • removeSeries

      public WDataSeries removeSeries​(WDataSeries series)
      Removes a data series.

      This will disassociate the given series from any WAxisSliderWidgets.

      See Also:
      addSeries(WDataSeries series), setSeries(List series)
    • setSeries

      public void setSeries​(java.util.List<WDataSeries> series)
      Sets all data series.

      Replaces the current list of series with the new list.

      See Also:
      getSeries(int modelColumn), removeSeries(WDataSeries series)
    • getSeries

      public WDataSeries getSeries​(int modelColumn)
      Returns a data series corresponding to a data column.

      Returns a reference to the first data series that plots data from modelColumn.

    • getSeries

      public java.util.List<WDataSeries> getSeries()
      Returns a list with the current data series.

      Returns the complete list of current data series.

    • getAxis

      public WAxis getAxis​(Axis axis)
      Returns a chart axis.

      Returns a reference to the specified axis.

    • setAxis

      public void setAxis​(WAxis waxis, Axis axis)
      Sets an axis.

      See Also:
      getAxis(Axis axis)
    • getXAxes

      public java.util.List<WAxis> getXAxes()
      Returns a vector of all X axes associated with this chart.

      This defaults to a vector of one axis.

    • getYAxes

      public java.util.List<WAxis> getYAxes()
      Returns a vector of all Y axes associated with this chart.

      This defaults to a vector of two axes: the Y1 and Y2 axes. Y1 will be at index 0, and Y2 will be at index 1.

    • getXAxisCount

      public int getXAxisCount()
      Returns the number of X axes associated with this chart.
    • getYAxisCount

      public int getYAxisCount()
      Returns the number of Y axes associated with this chart.
    • getXAxis

      public WAxis getXAxis​(int i)
      Retrieves the X axis at index i.

      The following expression is always true:

      
       getAxis(Axis.XAxis) == getXAxis(0)
      
       

      Note: Precondition: 0 <= i < getXAxisCount()

    • getYAxis

      public WAxis getYAxis​(int i)
      Retrieves the Y axis at index i.

      The following expressions are always true:

      
       axis(Y1) == yAxis(0)
       axis(Y2) == yAxis(1)
      
       

      Note: Precondition: 0 <= i < getYAxisCount()

    • addXAxis

      public int addXAxis​(WAxis waxis)
      Adds a X axis to this chart.

      The first extra axis will have index 1, the next index 2,...

      Returns the index of the added axis.

      Note: This transfers ownership of the given WAxis to this chart.

      Note: Precondition: waxis is not null

    • addYAxis

      public int addYAxis​(WAxis waxis)
      Adds a Y axis to this chart.

      The first extra axis will have index 2, the next index 3,...

      Returns the index of the added axis.

      Note: This transfers ownership of the given WAxis to this chart.

      Note: Precondition: waxis is not null

    • removeXAxis

      public WAxis removeXAxis​(int xAxisId)
      Removes the X axis with the given id.

      The indices of the axes with an id higher than xAxisId will be decremented.

      Any WDataSeries associated with the removed axis are also removed.

      Note: Precondition: 0 <= xAxisId < getXAxisCount()

    • removeYAxis

      public WAxis removeYAxis​(int yAxisId)
      Removes the Y axis with the given id.

      The indices of the axes with an id higher than yAxisId will be decremented.

      Any WDataSeries associated with the removed axis are also removed.

      Note: Precondition: 0 <= yAxisId < getYAxisCount()

    • clearXAxes

      public void clearXAxes()
      Clears all X axes.

      The effect is the same as repeatedly using removeYAxis() until are axes are removed, i.e. any WDataSeries will also be removed.

    • clearYAxes

      public void clearYAxes()
      Clears all Y axes.

      The effect is the same as repeatedly using removeYAxis() until are axes are removed, i.e. any WDataSeries will also be removed.

    • setBarMargin

      public void setBarMargin​(double margin)
      Sets the margin between bars of different series.

      Use this method to change the margin that is set between bars of different series. The margin is specified as a fraction of the width. For example, a value of 0.1 adds a 10% margin between bars of each series. Negative values are also allowed. For example, use a margin of -1 to plot the bars of different series on top of each other.

      The default value is 0.

    • getBarMargin

      public double getBarMargin()
      Returns the margin between bars of different series.

      See Also:
      setBarMargin(double margin)
    • setLegendEnabled

      public void setLegendEnabled​(boolean 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.

      See Also:
      WDataSeries.isLegendEnabled(), setLegendLocation(LegendLocation location, Side side, AlignmentFlag alignment)
    • isLegendEnabled

      public boolean isLegendEnabled()
      Returns whether the legend is enabled.

      See Also:
      setLegendEnabled(boolean enabled)
    • setLegendLocation

      public void setLegendLocation​(LegendLocation location, Side side, AlignmentFlag alignment)
      Configures the legend location.

      The legend can be renderd either inside or outside of the chart area. When location is LegendLocation.Inside, the legend will be rendered inside the chart. When location is LegendLocation.Outside, the legend is rendered outside the chart, in the chart padding area.

      The provided side can either be Side.Left, Side.Right, Side.Top, Side.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 (AlignmentFlag.Left, AlignmentFlag.Center, or AlignmentFlag.Right), when the side is Side.Bottom or Side.Top, or a vertical alignment flag (AlignmentFlag.Top, AlignmentFlag.Middle, or AlignmentFlag.Bottom) when the side is Side.Left or Side.Right.

      The default location is LegendLocation.Outside, Side.Right and AlignmentFlag.Middle.

      To have more control over the legend, you could reimplement the renderLegendItem() method to customize how one item in the legend is rendered, or, alternatively you can disable the legend generated by the chart itself, and reimplement the paint() method in which you use the renderLegendItem() method repeatedly to render a customized legend.

      See Also:
      WDataSeries.setLegendEnabled(boolean enabled)
    • setLegendStyle

      public void setLegendStyle​(WFont font, WPen border, 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 PenStyle.None and the default background is BrushStyle.None.

      See Also:
      setLegendEnabled(boolean enabled)
    • getLegendLocation

      public LegendLocation getLegendLocation()
      Returns the legend location.

      See Also:
      setLegendLocation(LegendLocation location, Side side, AlignmentFlag alignment)
    • getLegendSide

      public Side getLegendSide()
      Returns the legend side.

      See Also:
      setLegendLocation(LegendLocation location, Side side, AlignmentFlag alignment)
    • getLegendAlignment

      public AlignmentFlag getLegendAlignment()
      Returns the legend alignment.

      See Also:
      setLegendLocation(LegendLocation location, Side side, AlignmentFlag alignment)
    • getLegendColumns

      public int getLegendColumns()
      Returns the legend columns.

      See Also:
      setLegendColumns(int columns, WLength columnWidth)
    • getLegendColumnWidth

      public WLength getLegendColumnWidth()
      Returns the legend column width.

      See Also:
      setLegendColumns(int columns, WLength columnWidth)
    • getLegendFont

      public WFont getLegendFont()
      Returns the legend font.

      See Also:
      setLegendStyle(WFont font, WPen border, WBrush background)
    • getLegendBorder

      public WPen getLegendBorder()
      Returns the legend border pen.

      See Also:
      setLegendStyle(WFont font, WPen border, WBrush background)
    • getLegendBackground

      public WBrush getLegendBackground()
      Returns the legend background brush.

      See Also:
      setLegendStyle(WFont font, WPen border, WBrush background)
    • setLegendColumns

      public void setLegendColumns​(int columns, WLength columnWidth)
      Configures multiple legend columns.

      Multiple columns are typically useful when placing the legend at the top or at the bottom of the chart.

      The default value is a single column, 100 pixels wide.

      When automatic chart layout is enabled, then the legend column width is computed automatically, and this setting is ignored.

      See Also:
      WAbstractChart.setAutoLayoutEnabled(boolean enabled)
    • paint

      public void paint​(WPainter painter, WRectF rectangle)
      Description copied from class: WAbstractChart
      Paint the chart in a rectangle of the given painter.

      Paints the chart inside the painter, in the area indicated by rectangle. When rectangle is a null rectangle, the entire painter WPainter.getWindow() is used.

      Specified by:
      paint in class WAbstractChart
    • drawMarker

      public void drawMarker​(WDataSeries series, WPainterPath result)
      Draws the marker for a given data series.

      Draws the marker for the indicated series in the result. This method is called while painting the chart, and you may want to reimplement this method if you wish to provide a custom marker for a particular data series.

      See Also:
      setLegendEnabled(boolean enabled)
    • renderLegendIcon

      public void renderLegendIcon​(WPainter painter, WPointF pos, WDataSeries series)
      Renders the legend icon for a given data series.

      Renders the legend icon for the indicated series in the painter at position pos.

      This method is called while rendering a legend item, and you may want to reimplement this method if you wish to provide a custom legend icon for a particular data series.

      See Also:
      renderLegendItem(WPainter painter, WPointF pos, WDataSeries series)
    • renderLegendItem

      public void renderLegendItem​(WPainter painter, WPointF pos, WDataSeries series)
      Renders the legend item for a given data series.

      Renders the legend item for the indicated series in the painter at position pos. The default implementation draws the marker, and the series description to the right. The series description is taken from the model's header data for that series' data column.

      This method is called while painting the chart, and you may want to reimplement this method if you wish to provide a custom marker for a particular data series.

      See Also:
      setLegendEnabled(boolean enabled)
    • mapFromDevice

      public WPointF mapFromDevice​(WPointF point, Axis ordinateAxis)
      Maps from device coordinates to model coordinates.

      Maps a position in the chart back to model coordinates.

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      If the chart is interactive, mapFromDevice will correctly take the current zoom range into account.

      See Also:
      mapToDevice(Object xValue, Object yValue, Axis axis, int xSegment, int ySegment)
    • mapFromDevice

      public final WPointF mapFromDevice​(WPointF point)
      Maps from device coordinates to model coordinates.

      Returns mapFromDevice(point, Axis.Ordinate)

    • mapFromDevice

      public WPointF mapFromDevice​(WPointF point, int ordinateAxis)
      Maps from device coordinates to model coordinates.

      Maps a position in the chart back to model coordinates.

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      If the chart is interactive, mapFromDevice will correctly take the current zoom range into account.

      See Also:
      mapToDevice(Object xValue, Object yValue, Axis axis, int xSegment, int ySegment)
    • mapFromDeviceWithoutTransform

      public WPointF mapFromDeviceWithoutTransform​(WPointF point, Axis ordinateAxis)
      Maps from device coordinates to model coordinates, ignoring the current zoom range.

      Maps a position in the chart back to model coordinates, as if the chart was not zoomed in (nor panned).

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      This function will not take the current zoom range into account. The mapping will be performed as if zoomRangeTransform() is the identity transform.

      See Also:
      mapToDeviceWithoutTransform(Object xValue, Object yValue, Axis ordinateAxis, int xSegment, int ySegment)
    • mapFromDeviceWithoutTransform

      public final WPointF mapFromDeviceWithoutTransform​(WPointF point)
      Maps from device coordinates to model coordinates, ignoring the current zoom range.

      Returns mapFromDeviceWithoutTransform(point, Axis.Ordinate)

    • mapFromDevice

      public WPointF mapFromDevice​(WPointF point, WAxis xAxis, WAxis yAxis)
      Maps from device coordinates to model coordinates.

      Maps a position in the chart back to model coordinates.

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      If the chart is interactive, mapFromDevice will correctly take the current zoom range into account.

      See Also:
      mapToDevice(Object xValue, Object yValue, Axis axis, int xSegment, int ySegment)
    • mapFromDeviceWithoutTransform

      public WPointF mapFromDeviceWithoutTransform​(WPointF point, int ordinateAxis)
      Maps from device coordinates to model coordinates, ignoring the current zoom range.

      Maps a position in the chart back to model coordinates, as if the chart was not zoomed in (nor panned).

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      This function will not take the current zoom range into account. The mapping will be performed as if zoomRangeTransform() is the identity transform.

      See Also:
      mapToDeviceWithoutTransform(Object xValue, Object yValue, Axis ordinateAxis, int xSegment, int ySegment)
    • mapFromDeviceWithoutTransform

      public WPointF mapFromDeviceWithoutTransform​(WPointF point, WAxis xAxis, WAxis yAxis)
      Maps from device coordinates to model coordinates, ignoring the current zoom range.

      Maps a position in the chart back to model coordinates, as if the chart was not zoomed in (nor panned).

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      This function will not take the current zoom range into account. The mapping will be performed as if zoomRangeTransform() is the identity transform.

      See Also:
      mapToDeviceWithoutTransform(Object xValue, Object yValue, Axis ordinateAxis, int xSegment, int ySegment)
    • mapToDevice

      public WPointF mapToDevice​(java.lang.Object xValue, java.lang.Object yValue, Axis axis, int xSegment, int ySegment)
      Maps model values onto chart coordinates.

      This returns the chart device coordinates for a (x,y) pair of model values.

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      The xSegment and ySegment arguments are relevant only when the corresponding axis is broken using WAxis#setBreak(). Then, its possible values may be 0 (below the break) or 1 (above the break).

      If the chart is interactive, mapToDevice will correctly take the current zoom range into account.

      See Also:
      mapFromDevice(WPointF point, Axis ordinateAxis)
    • mapToDevice

      public final WPointF mapToDevice​(java.lang.Object xValue, java.lang.Object yValue)
      Maps model values onto chart coordinates.

      Returns mapToDevice(xValue, yValue, Axis.Ordinate, 0, 0)

    • mapToDevice

      public final WPointF mapToDevice​(java.lang.Object xValue, java.lang.Object yValue, Axis axis)
      Maps model values onto chart coordinates.

      Returns mapToDevice(xValue, yValue, axis, 0, 0)

    • mapToDevice

      public final WPointF mapToDevice​(java.lang.Object xValue, java.lang.Object yValue, Axis axis, int xSegment)
      Maps model values onto chart coordinates.

      Returns mapToDevice(xValue, yValue, axis, xSegment, 0)

    • mapToDevice

      public WPointF mapToDevice​(java.lang.Object xValue, java.lang.Object yValue, int axis, int xSegment, int ySegment)
      Maps model values onto chart coordinates.

      This returns the chart device coordinates for a (x,y) pair of model values.

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      The xSegment and ySegment arguments are relevant only when the corresponding axis is broken using WAxis#setBreak(). Then, its possible values may be 0 (below the break) or 1 (above the break).

      If the chart is interactive, mapToDevice will correctly take the current zoom range into account.

      See Also:
      mapFromDevice(WPointF point, Axis ordinateAxis)
    • mapToDevice

      public final WPointF mapToDevice​(java.lang.Object xValue, java.lang.Object yValue, int axis)
      Maps model values onto chart coordinates.

      Returns mapToDevice(xValue, yValue, axis, 0, 0)

    • mapToDevice

      public final WPointF mapToDevice​(java.lang.Object xValue, java.lang.Object yValue, int axis, int xSegment)
      Maps model values onto chart coordinates.

      Returns mapToDevice(xValue, yValue, axis, xSegment, 0)

    • mapToDevice

      public WPointF mapToDevice​(java.lang.Object xValue, java.lang.Object yValue, WAxis xAxis, WAxis yAxis, int xSegment, int ySegment)
      Maps model values onto chart coordinates.

      This returns the chart device coordinates for a (x,y) pair of model values.

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      The xSegment and ySegment arguments are relevant only when the corresponding axis is broken using WAxis#setBreak(). Then, its possible values may be 0 (below the break) or 1 (above the break).

      If the chart is interactive, mapToDevice will correctly take the current zoom range into account.

      See Also:
      mapFromDevice(WPointF point, Axis ordinateAxis)
    • mapToDevice

      public final WPointF mapToDevice​(java.lang.Object xValue, java.lang.Object yValue, WAxis xAxis, WAxis yAxis)
      Maps model values onto chart coordinates.

      Returns mapToDevice(xValue, yValue, xAxis, yAxis, 0, 0)

    • mapToDevice

      public final WPointF mapToDevice​(java.lang.Object xValue, java.lang.Object yValue, WAxis xAxis, WAxis yAxis, int xSegment)
      Maps model values onto chart coordinates.

      Returns mapToDevice(xValue, yValue, xAxis, yAxis, xSegment, 0)

    • mapToDeviceWithoutTransform

      public WPointF mapToDeviceWithoutTransform​(java.lang.Object xValue, java.lang.Object yValue, Axis ordinateAxis, int xSegment, int ySegment)
      Maps model values onto chart coordinates, ignoring the current zoom range.

      This returns the chart device coordinates for a (x,y) pair of model values.

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      The xSegment and ySegment arguments are relevant only when the corresponding axis is broken using WAxis#setBreak(). Then, its possible values may be 0 (below the break) or 1 (above the break).

      This function will not take the current zoom range into account.The mapping will be performed as if zoomRangeTransform() is the identity transform.

      See Also:
      mapFromDeviceWithoutTransform(WPointF point, Axis ordinateAxis)
    • mapToDeviceWithoutTransform

      public final WPointF mapToDeviceWithoutTransform​(java.lang.Object xValue, java.lang.Object yValue)
      Maps model values onto chart coordinates, ignoring the current zoom range.

      Returns mapToDeviceWithoutTransform(xValue, yValue, Axis.Ordinate, 0, 0)

    • mapToDeviceWithoutTransform

      public final WPointF mapToDeviceWithoutTransform​(java.lang.Object xValue, java.lang.Object yValue, Axis ordinateAxis)
      Maps model values onto chart coordinates, ignoring the current zoom range.

      Returns mapToDeviceWithoutTransform(xValue, yValue, ordinateAxis, 0, 0)

    • mapToDeviceWithoutTransform

      public final WPointF mapToDeviceWithoutTransform​(java.lang.Object xValue, java.lang.Object yValue, Axis ordinateAxis, int xSegment)
      Maps model values onto chart coordinates, ignoring the current zoom range.

      Returns mapToDeviceWithoutTransform(xValue, yValue, ordinateAxis, xSegment, 0)

    • mapToDeviceWithoutTransform

      public WPointF mapToDeviceWithoutTransform​(java.lang.Object xValue, java.lang.Object yValue, int ordinateAxis, int xSegment, int ySegment)
      Maps model values onto chart coordinates, ignoring the current zoom range.

      This returns the chart device coordinates for a (x,y) pair of model values.

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      The xSegment and ySegment arguments are relevant only when the corresponding axis is broken using WAxis#setBreak(). Then, its possible values may be 0 (below the break) or 1 (above the break).

      This function will not take the current zoom range into account.The mapping will be performed as if zoomRangeTransform() is the identity transform.

      See Also:
      mapFromDeviceWithoutTransform(WPointF point, Axis ordinateAxis)
    • mapToDeviceWithoutTransform

      public final WPointF mapToDeviceWithoutTransform​(java.lang.Object xValue, java.lang.Object yValue, int ordinateAxis)
      Maps model values onto chart coordinates, ignoring the current zoom range.

      Returns mapToDeviceWithoutTransform(xValue, yValue, ordinateAxis, 0, 0)

    • mapToDeviceWithoutTransform

      public final WPointF mapToDeviceWithoutTransform​(java.lang.Object xValue, java.lang.Object yValue, int ordinateAxis, int xSegment)
      Maps model values onto chart coordinates, ignoring the current zoom range.

      Returns mapToDeviceWithoutTransform(xValue, yValue, ordinateAxis, xSegment, 0)

    • mapToDeviceWithoutTransform

      public WPointF mapToDeviceWithoutTransform​(java.lang.Object xValue, java.lang.Object yValue, WAxis xAxis, WAxis yAxis, int xSegment, int ySegment)
      Maps model values onto chart coordinates, ignoring the current zoom range.

      This returns the chart device coordinates for a (x,y) pair of model values.

      This uses the axis dimensions that are based on the latest chart rendering. If you have not yet rendered the chart, or wish that the mapping already reflects model changes since the last rendering, you should call initLayout() first.

      The xSegment and ySegment arguments are relevant only when the corresponding axis is broken using WAxis#setBreak(). Then, its possible values may be 0 (below the break) or 1 (above the break).

      This function will not take the current zoom range into account.The mapping will be performed as if zoomRangeTransform() is the identity transform.

      See Also:
      mapFromDeviceWithoutTransform(WPointF point, Axis ordinateAxis)
    • mapToDeviceWithoutTransform

      public final WPointF mapToDeviceWithoutTransform​(java.lang.Object xValue, java.lang.Object yValue, WAxis xAxis, WAxis yAxis)
      Maps model values onto chart coordinates, ignoring the current zoom range.

      Returns mapToDeviceWithoutTransform(xValue, yValue, xAxis, yAxis, 0, 0)

    • mapToDeviceWithoutTransform

      public final WPointF mapToDeviceWithoutTransform​(java.lang.Object xValue, java.lang.Object yValue, WAxis xAxis, WAxis yAxis, int xSegment)
      Maps model values onto chart coordinates, ignoring the current zoom range.

      Returns mapToDeviceWithoutTransform(xValue, yValue, xAxis, yAxis, xSegment, 0)

    • initLayout

      public boolean initLayout​(WRectF rectangle, WPaintDevice device)
      Initializes the chart layout.

      The mapping between model and device coordinates is only established after a rendering phase, or after calling initLayout manually.

      You need a layout in order to use the mapFromDevice() and mapToDevice() methods.

      Unless a specific chart rectangle is specified, the entire widget area is assumed.

    • initLayout

      public final boolean initLayout()
      Initializes the chart layout.

      Returns initLayout(null, (WPaintDevice)null)

    • initLayout

      public final boolean initLayout​(WRectF rectangle)
      Initializes the chart layout.

      Returns initLayout(rectangle, (WPaintDevice)null)

    • createLegendItemWidget

      public WWidget createLegendItemWidget​(int index)
      Creates a widget which renders the a legend item.

      The legend item widget will contain a text and a WPaintedWidget which draws the series' symbol.

    • addDataPointArea

      public void addDataPointArea​(WDataSeries series, int xRow, int xColumn, WAbstractArea area)
      Adds a data point area (used for displaying e.g. tooltips).

      You may want to specialize this is if you wish to modify (or ignore) the area.

      Note: Currently, an area is only created if the ItemDataRole.ToolTip data at the data point is not empty.

    • setAxisPadding

      public void setAxisPadding​(int padding)
      Sets the padding between the chart area and the axes.

      This calls WAxes::setPadding() on all axes.

      See Also:
      getAxisPadding()
    • getAxisPadding

      public int getAxisPadding()
      Returns the padding between the chart area and the axes.

      This number may not reflect the actual padding of the individual axes, if another padding has been applied on the individual axes.

      See Also:
      setAxisPadding(int padding)
    • setBorderPen

      public void setBorderPen​(WPen pen)
      Sets the pen of the border to be drawn around the chart area.

      See Also:
      getBorderPen()
    • getBorderPen

      public WPen getBorderPen()
      Returns the pen used to draw the border around the chart area.

      Defaults to PenStyle.None.

      See Also:
      setBorderPen(WPen pen)
    • addCurveLabel

      public void addCurveLabel​(CurveLabel label)
      Add a curve label.

      See Also:
      CurveLabel(WDataSeries series, WPointF point, String label)
    • setCurveLabels

      public void setCurveLabels​(java.util.List<CurveLabel> labels)
      Configure all curve labels at once.

      See Also:
      addCurveLabel(CurveLabel label)
    • clearCurveLabels

      public void clearCurveLabels()
      Clear all curve labels.

      See Also:
      addCurveLabel(CurveLabel label)
    • getCurveLabels

      public java.util.List<CurveLabel> getCurveLabels()
      Get all of the registered curve labels.

      See Also:
      setCurveLabels(List labels)
    • setZoomEnabled

      public void setZoomEnabled​(boolean zoomEnabled)
      Enables zoom functionality.

      When using the mouse, press the ctrl key while scrolling to zoom in/out a specific point on the chart. If you press shift+ctrl, it will only zoom vertically. If you press alt+ctrl, it will only zoom horizontally. To change these default mappings, use setWheelActions().

      When using touch, you can use a pinch gesture to zoom in/out. If the pinch gesture is vertical/horizontal, it will zoom only vertically/horizontally, otherwise it will zoom both axes equally.

      The default value is false.

      See Also:
      isZoomEnabled(), setWheelActions(Map wheelActions)
    • setZoomEnabled

      public final void setZoomEnabled()
      Enables zoom functionality.

      Calls setZoomEnabled(true)

    • isZoomEnabled

      public boolean isZoomEnabled()
      Returns whether zoom is enabled.

      See Also:
      setZoomEnabled(boolean zoomEnabled)
    • setPanEnabled

      public void setPanEnabled​(boolean panEnabled)
      Enables pan functionality.

      When using the mouse, you can click and drag to pan the chart (if zoomed in), or use the scrollwheel.

      When using touch, you can drag to pan the chart. If the rubberband effect is enabled, this is intertial (it will keep scrolling after you let go) and there is an overscroll and bounce back effect on the sides.

      The default value is false.

      See Also:
      isPanEnabled()
    • setPanEnabled

      public final void setPanEnabled()
      Enables pan functionality.

      Calls setPanEnabled(true)

    • isPanEnabled

      public boolean isPanEnabled()
      Returns whether pan is enabled.

      See Also:
      setPanEnabled(boolean panEnabled)
    • setCrosshairEnabled

      public void setCrosshairEnabled​(boolean crosshair)
      Enables the crosshair functionality.

      When enabled, the crosshair will follow mouse movement, and show in the top right corner the coordinate (according to X axis and the first Y axis) corresponding to this position.

      When using touch, the crosshair can be moved with a drag. If both panning and the crosshair are enabled, the crosshair will be moved when dragging close to the crosshair. Otherwise, the chart will pan.

    • setCrosshairEnabled

      public final void setCrosshairEnabled()
      Enables the crosshair functionality.

      Calls setCrosshairEnabled(true)

    • isCrosshairEnabled

      public boolean isCrosshairEnabled()
      Returns whether the crosshair is enabled.

      See Also:
      setCrosshairEnabled(boolean crosshair)
    • setCrosshairColor

      public void setCrosshairColor​(WColor color)
      Sets the crosshair color.

      The crosshair color is black by default.

      See Also:
      setCrosshairEnabled(boolean crosshair)
    • getCrosshairColor

      public WColor getCrosshairColor()
      Returns the crosshair color.

      See Also:
      setCrosshairEnabled(boolean crosshair), setCrosshairColor(WColor color)
    • setCrosshairXAxis

      public void setCrosshairXAxis​(int xAxis)
      Sets the X axis to use for the crosshair.

      Defaults to 0 (first X axis)

    • getCrosshairXAxis

      public int getCrosshairXAxis()
      Returns the X axis to use for the crosshair.
    • setCrosshairYAxis

      public void setCrosshairYAxis​(int yAxis)
      Sets the Y axis to use for the crosshair.

      Defaults to 0 (first Y axis)

    • getCrosshairYAxis

      public int getCrosshairYAxis()
      Returns the Y axis to use for the crosshair.
    • setFollowCurve

      public void setFollowCurve​(int followCurve)
      Deprecated.
      Use setFollowCurve() instead
      Enables the follow curve functionality for a data series.

      This enables follow curve functionality for the data series corresponding to the given column.

      If the data series is of type SeriesType.Line or SeriesType.Curve, the crosshair can only be moved in the x direction. The y position of the crosshair will be determined by the value of the data series. The crosshair will snap to the nearest point that is defined in the data series.

      When using the mouse, the x position will change on mouseover. When using touch, the x position can be moved with a drag. The follow curve functionality has priority over the crosshair functionality.

      Use column index -1 or disableFollowCurve() to disable the follow curve feature.

      Note: The follow curve functionality requires that the X axis values of the data series are monotonically increasing or decreasing.

    • setFollowCurve

      public void setFollowCurve​(WDataSeries series)
      Enabled the follow curve funtionality for a data series.

      This enables follow curve functionality for the data series corresponding to the given column.

      If the data series is of type SeriesType.Line or SeriesType.Curve, the crosshair can only be moved in the x direction. The y position of the crosshair will be determined by the value of the data series. The crosshair will snap to the nearest point that is defined in the data series.

      When using the mouse, the x position will change on mouseover. When using touch, the x position can be moved with a drag. The follow curve functionality has priority over the crosshair functionality.

      Set to null to disable the follow curve feature.

      Note: The follow curve functionality requires that the X axis values of the data series are monotonically increasing or decreasing.

    • disableFollowCurve

      public void disableFollowCurve()
      Disable the follow curve functionality.

      See Also:
      setFollowCurve(int followCurve)
    • getFollowCurve

      public WDataSeries getFollowCurve()
      Returns the curve that is to be followed.

      If follow curve functionality is not enabled, returns -1.

      See Also:
      setFollowCurve(int followCurve)
    • setRubberBandEffectEnabled

      public void setRubberBandEffectEnabled​(boolean rubberBandEnabled)
      Enables/disables the inertial scrolling and rubberband effect.

      See Also:
      setPanEnabled(boolean panEnabled)
    • setRubberBandEffectEnabled

      public final void setRubberBandEffectEnabled()
      Enables/disables the inertial scrolling and rubberband effect.

      Calls setRubberBandEffectEnabled(true)

    • isRubberBandEffectEnabled

      public boolean isRubberBandEffectEnabled()
      Checks whether the rubberband effect is enabled.

      See Also:
      setRubberBandEffectEnabled(boolean rubberBandEnabled)
    • setWheelActions

      public void setWheelActions​(java.util.Map<java.util.EnumSet<KeyboardModifier>,​InteractiveAction> wheelActions)
      Sets the mapping of mouse wheel actions for interactive charts.

      See Also:
      getWheelActions()
    • getWheelActions

      public java.util.Map<java.util.EnumSet<KeyboardModifier>,​InteractiveAction> getWheelActions()
      Returns the current mouse wheel actions for interactive charts.

      See Also:
      setWheelActions(Map wheelActions)
    • setSoftLabelClipping

      public void setSoftLabelClipping​(boolean enabled)
      Enables or disables soft label clipping on all axes.

      See Also:
      WAxis.setSoftLabelClipping(boolean enabled)
    • setSeriesSelectionEnabled

      public void setSeriesSelectionEnabled​(boolean enabled)
      Sets whether series selection is enabled.

      If series selection is enabled, series can be selected with a mouse click or long press. If the selected series is a SeriesType.Line or SeriesType.Curve, it can be manipulated if curve manipulation is enabled. The series that are not selected, will be shown in a lighter color.

    • setSeriesSelectionEnabled

      public final void setSeriesSelectionEnabled()
      Sets whether series selection is enabled.

      Calls setSeriesSelectionEnabled(true)

    • isSeriesSelectionEnabled

      public boolean isSeriesSelectionEnabled()
      Returns whether series selection is enabled.

      See Also:
      setSeriesSelectionEnabled(boolean enabled)
    • seriesSelected

      public Signal2<WDataSeries,​WPointF> seriesSelected()
      A signal that notifies the selection of a new curve.

      This signal is emitted if a series is selected using a mouse click or long press. The first argument is the selected series. The second argument is the point that was selected, in model coordinates.

      See Also:
      setSeriesSelectionEnabled(boolean enabled)
    • setSelectedSeries

      public void setSelectedSeries​(WDataSeries series)
      Sets the series that is currently selected.

      The series with the given model column will be selected. The other series will be shown in a lighter color. The series that is currently selected is the one that can be manipulated if curve manipulation is enabled, and it is a SeriesType.Line or SeriesType.Curve.

      The selected series can be changed using a long touch or mouse click.

      If the argument provided is null or series selection is not enabled, no series will be selected.

      See Also:
      setCurveManipulationEnabled(boolean enabled), setSeriesSelectionEnabled(boolean enabled)
    • getSelectedSeries

      public WDataSeries getSelectedSeries()
      Get the currently selected curve.

      -1 means that no curve is currently selected.

      See Also:
      setSelectedSeries(WDataSeries series)
    • setCurveManipulationEnabled

      public void setCurveManipulationEnabled​(boolean enabled)
      Enable curve manipulation.

      If curve manipulation is enabled, the scale and offset of the selected curve can be manipulated interactively using drag, scroll, and pinch.

      See Also:
      WDataSeries.setOffset(double offset), WDataSeries.setScale(double scale)
    • setCurveManipulationEnabled

      public final void setCurveManipulationEnabled()
      Enable curve manipulation.

      Calls setCurveManipulationEnabled(true)

    • isCurveManipulationEnabled

      public boolean isCurveManipulationEnabled()
      Returns whether curve manipulation is enabled.

      See Also:
      setCurveManipulationEnabled(boolean enabled)
    • setOnDemandLoadingEnabled

      public void setOnDemandLoadingEnabled​(boolean enabled)
      Enable on-demand loading.

      By default, when on-demand loading is not enabled, the entire chart area is loaded, regardless of whether it is within the current zoom range of the X axis.

      When on-demand loading is enabled only the currently visible area + some margin is loaded. As the visible area changes, different data is loaded. This improves performance for charts with a lot of data if not all of the data needs to be visible at the same time.

      This feature is especially useful in combination with WAxis#setMaximumZoomRange() or WAxis#setMinZoom(), which makes it impossible for the user to view all of the data at the same time, because that would incur too much overhead.

      Note: On-demand loading requires that the X axis data for all data series is sorted in ascending order. This feature is optimized for equidistant X axis data, but that's not a requirement.

      Note: If no minimum or maximum are set on the Y axis (or axes), then the chart will still have to scan all data of its data series to automatically determine the minimum and maximum Y axis values. If this performance hit is undesirable and the Y axis range is known or guaranteed to be within a certain range, make sure to set a range on the Y axis (or axes).

      See Also:
      isOnDemandLoadingEnabled()
    • isOnDemandLoadingEnabled

      public boolean isOnDemandLoadingEnabled()
      Returns whether on-demand loading is enabled.

      See Also:
      setOnDemandLoadingEnabled(boolean enabled)
    • setLoadingBackground

      public void setLoadingBackground​(WBrush brush)
      Set the background brush for the unloaded area.

      See Also:
      setOnDemandLoadingEnabled(boolean enabled), getLoadingBackground()
    • getLoadingBackground

      public WBrush getLoadingBackground()
      Returns the background brush for the unloaded area.

      See Also:
      setOnDemandLoadingEnabled(boolean enabled), setLoadingBackground(WBrush brush)
    • iterateSeries

      public void iterateSeries​(SeriesIterator iterator, WPainter painter, boolean reverseStacked, boolean extremesOnly)
    • iterateSeries

      public final void iterateSeries​(SeriesIterator iterator, WPainter painter)
    • iterateSeries

      public final void iterateSeries​(SeriesIterator iterator, WPainter painter, boolean reverseStacked)
    • getDomChanges

      protected void getDomChanges​(java.util.List<DomElement> result, WApplication app)
      Description copied from class: WWebWidget
      Get DOM changes for this widget.

      This is an internal function, and should not be called directly, or be overridden!

      Overrides:
      getDomChanges in class WPaintedWidget
    • modelChanged

      protected void modelChanged()
      Overrides:
      modelChanged in class WAbstractChart
    • modelReset

      protected void modelReset()
      Overrides:
      modelReset in class WAbstractChart
    • paintEvent

      protected void paintEvent​(WPaintDevice paintDevice)
      Paints the widget.

      This calls render() to paint on the paint device.

      Specified by:
      paintEvent in class WPaintedWidget
    • render

      protected void render​(WPainter painter, WRectF rectangle)
      Renders the chart.

      Renders the chart within the given rectangle. To accomodate both rendering of horizontal and vertically oriented charts, all rendering logic assumes horizontal. This "chart coordinates" space is transformed to painter coordinates using hv().

    • map

      protected WPointF map​(double xValue, double yValue, Axis yAxis, int currentXSegment, int currentYSegment)
      Map (x, y) value pair to chart coordinates coordinates.

      The result needs further transformation using hv() to painter coordinates.

    • map

      protected final WPointF map​(double xValue, double yValue)
      Map (x, y) value pair to chart coordinates coordinates.

      Returns map(xValue, yValue, Axis.Ordinate, 0, 0)

    • map

      protected final WPointF map​(double xValue, double yValue, Axis yAxis)
      Map (x, y) value pair to chart coordinates coordinates.

      Returns map(xValue, yValue, yAxis, 0, 0)

    • map

      protected final WPointF map​(double xValue, double yValue, Axis yAxis, int currentXSegment)
      Map (x, y) value pair to chart coordinates coordinates.

      Returns map(xValue, yValue, yAxis, currentXSegment, 0)

    • map

      protected WPointF map​(double xValue, double yValue, int yAxis, int currentXSegment, int currentYSegment)
      Map (x, y) value pair to chart coordinates coordinates.

      The result needs further transformation using hv() to painter coordinates.

    • map

      protected final WPointF map​(double xValue, double yValue, int yAxis)
      Map (x, y) value pair to chart coordinates coordinates.

      Returns map(xValue, yValue, yAxis, 0, 0)

    • map

      protected final WPointF map​(double xValue, double yValue, int yAxis, int currentXSegment)
      Map (x, y) value pair to chart coordinates coordinates.

      Returns map(xValue, yValue, yAxis, currentXSegment, 0)

    • map

      protected WPointF map​(double xValue, double yValue, WAxis xAxis, WAxis yAxis, int currentXSegment, int currentYSegment)
      Map (x, y) value pair to chart coordinates coordinates.

      The result needs further transformation using hv() to painter coordinates.

    • map

      protected final WPointF map​(double xValue, double yValue, WAxis xAxis, WAxis yAxis)
      Map (x, y) value pair to chart coordinates coordinates.

      Returns map(xValue, yValue, xAxis, yAxis, 0, 0)

    • map

      protected final WPointF map​(double xValue, double yValue, WAxis xAxis, WAxis yAxis, int currentXSegment)
      Map (x, y) value pair to chart coordinates coordinates.

      Returns map(xValue, yValue, xAxis, yAxis, currentXSegment, 0)

    • renderLabel

      protected void renderLabel​(WPainter painter, java.lang.CharSequence text, WPointF p, java.util.EnumSet<AlignmentFlag> flags, double angle, int margin)
      Utility function for rendering text.

      This method renders text on the chart position pos, with a particular alignment flags. These are both specified in chart coordinates. The position is converted to painter coordinates using hv(), and the alignment flags are changed accordingly. The rotation, indicated by angle is specified in painter coordinates and thus an angle of 0 always indicates horizontal text, regardless of the chart orientation.

    • hv

      protected WPointF hv​(double x, double y)
      Conversion between chart and painter coordinates.

      Converts from chart coordinates to painter coordinates, taking into account the chart orientation.

    • hv

      protected WPointF hv​(WPointF p)
      Conversion between chart and painter coordinates.

      Converts from chart coordinates to painter coordinates, taking into account the chart orientation.

    • hv

      protected WRectF hv​(WRectF r)
      Conversion between chart and painter coordinates.

      Converts from chart coordinates to painter coordinates, taking into account the chart orientation.

    • chartSegmentArea

      protected WRectF chartSegmentArea​(WAxis yAxis, int xSegment, int ySegment)
      Returns the segment area for a combination of X and Y segments.

      This segment area is used for clipping when rendering in a particular segment.

    • chartSegmentArea

      protected WRectF chartSegmentArea​(WAxis xAxis, WAxis yAxis, int xSegment, int ySegment)
      Returns the segment area for a combination of X and Y segments.

      This segment area is used for clipping when rendering in a particular segment.

    • calcChartArea

      protected void calcChartArea()
      Calculates the chart area.

      This calculates the chartArea(), which is the rectangle (in chart coordinates) that bounds the actual chart (thus excluding axes, labels, titles, legend, etc...).

      See Also:
      WAbstractChart.getPlotAreaPadding(Side side)
    • prepareAxes

      protected boolean prepareAxes​(WPaintDevice device)
      Prepares the axes for rendering.

      Computes axis properties such as the range (if not manually specified), label interval (if not manually specified) and axis locations. These properties are stored within the axes.

      See Also:
      initLayout(WRectF rectangle, WPaintDevice device)
    • renderBackground

      protected void renderBackground​(WPainter painter)
      Renders the background.

      See Also:
      render(WPainter painter, WRectF rectangle)
    • renderAxes

      protected void renderAxes​(WPainter painter, java.util.EnumSet<AxisProperty> properties)
      Renders one or more properties of the axes.

      This calls renderAxis() for each axis.

      See Also:
      render(WPainter painter, WRectF rectangle)
    • renderAxes

      protected final void renderAxes​(WPainter painter, AxisProperty propertie, AxisProperty... properties)
      Renders one or more properties of the axes.

      Calls renderAxes(painter, EnumSet.of(propertie, properties))

    • renderBorder

      protected void renderBorder​(WPainter painter)
      Renders the border of the chart area.

      See Also:
      render(WPainter painter, WRectF rectangle), setBorderPen(WPen pen)
    • renderCurveLabels

      protected void renderCurveLabels​(WPainter painter)
      Renders the curve labels.

      See Also:
      render(WPainter painter, WRectF rectangle), addCurveLabel(CurveLabel label)
    • renderSeries

      protected void renderSeries​(WPainter painter)
      Renders all series data, including value labels.

      See Also:
      render(WPainter painter, WRectF rectangle)
    • renderLegend

      protected void renderLegend​(WPainter painter)
      Renders the (default) legend and chart titles.

      See Also:
      render(WPainter painter, WRectF rectangle)
    • renderAxis

      protected void renderAxis​(WPainter painter, WAxis axis, java.util.EnumSet<AxisProperty> properties)
      Renders properties of one axis.

      See Also:
      renderAxes(WPainter painter, EnumSet properties)
    • renderAxis

      protected final void renderAxis​(WPainter painter, WAxis axis, AxisProperty propertie, AxisProperty... properties)
    • renderGrid

      protected void renderGrid​(WPainter painter, WAxis ax)
      Renders grid lines along the ticks of the given axis.

      See Also:
      render(WPainter painter, WRectF rectangle)
    • renderOther

      protected void renderOther​(WPainter painter)
      Renders other, user-defined things.

      The default implementation sets the painter's clip path to the chart area, but does not enable clipping.

      This method can be overridden to draw extra content onto the chart.

      Chart coordinates can be mapped to device coordinates with mapToDeviceWithoutTransform(). If these need to move and scale along with the zoom range, those points can be transformed with zoomRangeTransform().

      This method is called last by default. If you want to render other things at some other moment, you can override render(WPainter&, const WRectF&).

    • getCalcNumBarGroups

      protected int getCalcNumBarGroups()
      Calculates the total number of bar groups.
    • render

      protected void render​(java.util.EnumSet<RenderFlag> flags)
      Description copied from class: WWidget
      Renders the widget.

      This function renders the widget (or an update for the widget), after this has been scheduled using scheduleRender().

      The default implementation will render the widget by serializing changes to JavaScript and HTML. You may want to reimplement this widget if you have been postponing some of the layout / rendering implementation until the latest moment possible. In that case you should make sure you call the base implementation however.

      Overrides:
      render in class WPaintedWidget
    • setFormData

      protected void setFormData​(WObject.FormData formData)
      Overrides:
      setFormData in class WPaintedWidget
    • zoomRangeTransform

      protected WTransform zoomRangeTransform​(int yAxis)
      Returns the current zoom range transform.

      This transform maps device coordinates from the fully zoomed out position to the current zoom range.

      This transform is a JavaScript bound transform if this chart is interactive. Otherwise, this transform is just the identity transform.

      See Also:
      setZoomEnabled(boolean zoomEnabled), setPanEnabled(boolean panEnabled), WAxis.setZoomRange(double minimum, double maximum)
    • zoomRangeTransform

      protected final WTransform zoomRangeTransform()
      Returns the current zoom range transform.

      Returns zoomRangeTransform(0)

    • zoomRangeTransform

      protected WTransform zoomRangeTransform​(WAxis xAxis, WAxis yAxis)
      Returns the current zoom range transform.

      This transform maps device coordinates from the fully zoomed out position to the current zoom range.

      This transform is a JavaScript bound transform if this chart is interactive. Otherwise, this transform is just the identity transform.

      See Also:
      setZoomEnabled(boolean zoomEnabled), setPanEnabled(boolean panEnabled), WAxis.setZoomRange(double minimum, double maximum)