Class WAbstractChart
- Direct Known Subclasses:
WCartesianChart
,WPieChart
This is an abstract class and should not be used directly.
As an abstract base for MVC-based charts, this class manages the model setModel()
and provides virtual methods that
listen to model changes. In addition, it gives access to generic chart properties such as the
title setTitle()
and title font setTitleFont()
, the chart palette setPalette()
, plot area padding setPlotAreaPadding()
, and the
background fill color setBackground()
.
CSS
Styling through CSS is not applicable.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Field Summary
Fields inherited from class eu.webtoolkit.jwt.WInteractWidget
dragTouchEndSlot_, dragTouchSlot_, noDefault
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
protected
WAbstractChart
(WContainerWidget parentContainer) -
Method Summary
Modifier and TypeMethodDescriptionReturns the background of the chart.Returns the model.getModel()
Returns the model.Returns the palette for the chart.int
getPlotAreaPadding
(Side side) Returns the internal margin for the main plot area.getTitle()
Return the chart title.Returns the font for the chart title.boolean
Returns whether chart layout is computed automatically.protected void
protected void
final void
Paint the chart in a rectangle of the given painter.abstract void
Paint the chart in a rectangle of the given painter.void
remove()
Destructor.final void
Configures the chart layout to be automatic.void
setAutoLayoutEnabled
(boolean enabled) Configures the chart layout to be automatic.void
setBackground
(WBrush background) Sets a background for the chart.void
setModel
(WAbstractChartModel model) Sets the model.void
setModel
(WAbstractItemModel model) Sets the model.void
setPalette
(WChartPalette palette) Set a palette for the chart.final void
setPlotAreaPadding
(int padding) Set an internal margin for the main plot area.final void
setPlotAreaPadding
(int padding, Side side, Side... sides) Set an internal margin for the main plot area.void
setPlotAreaPadding
(int padding, EnumSet<Side> sides) Set an internal margin for the main plot area.void
setTitle
(CharSequence title) Set a chart title.void
setTitleFont
(WFont titleFont) Set the font for the chart title.Methods inherited from class eu.webtoolkit.jwt.WPaintedWidget
addArea, createDomElement, createJSBrush, createJSPainterPath, createJSPen, createJSPoint, createJSRect, createJSTransform, enableAjax, getArea, getAreas, getCreatePaintDevice, getDomChanges, getMethod, getObjJsRef, getPreferredMethod, getRepaintSlot, insertArea, layoutSizeChanged, paintEvent, refresh, removeArea, render, resize, setFormData, setPreferredMethod, update, update, update
Methods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, getMouseOverDelay, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, propagateSetEnabled, setDraggable, setDraggable, setDraggable, setDraggable, setMouseOverDelay, setPopup, touchEnded, touchMoved, touchStarted, unsetDraggable
Methods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, beingDeleted, blurred, callJavaScriptMember, childrenChanged, doJavaScript, escapeText, escapeText, escapeText, escapeText, find, findById, focussed, getAttributeValue, getBaseZIndex, getChildren, getClearSides, getDecorationStyle, getFloatSide, getHeight, getHtmlTagName, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getTabIndex, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, isCanReceiveFocus, isDisabled, isHidden, isHiddenKeepsGeometry, isInline, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, iterateChildren, jsStringLiteral, jsStringLiteral, manageWidget, parentResized, parentResized, propagateSetVisible, removeScript, removeStyleClass, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFlexBox, setFloatSide, setFocus, setHidden, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setParentWidget, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setToolTip, setVerticalAlignment, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemoved
Methods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, needsRerender, positionAt, positionAt, positionAt, positionAt, removeFromParent, removeStyleClass, removeWidget, render, resize, scheduleRender, scheduleRender, scheduleRender, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr
Methods inherited from class eu.webtoolkit.jwt.WObject
getObjectName
-
Constructor Details
-
WAbstractChart
-
WAbstractChart
protected WAbstractChart()
-
-
Method Details
-
remove
public void remove()Destructor.- Overrides:
remove
in classWPaintedWidget
- See Also:
-
setModel
Sets the model.The model is used by the chart to get its data.
The default model is
null
.This creates an internal proxy model that presents the
WAbstractItemModel
as aWAbstractChartModel
. UsesetModel()
directly for highest performance (avoiding the overhead of any for numeric data).Note: Setting a new model on a
WCartesianChart
causes theWCartesianChart.XSeriesColumn()
and all series to be cleared- See Also:
-
setModel
Sets the model.The model is used by the chart to get its data.
The default model is a
null
.Note: Setting a new model on a
WCartesianChart
causes theWCartesianChart.XSeriesColumn()
and all series to be cleared- See Also:
-
getModel
Returns the model.- See Also:
-
getItemModel
Returns the model.If a model was set using
setModel()
, then this model will be returned by this call.- See Also:
-
setBackground
Sets a background for the chart.Set the background color for the main plot area.
The default is a completely transparent background.
- See Also:
-
getBackground
Returns the background of the chart.- See Also:
-
setPalette
Set a palette for the chart.A palette is used to provide the style information to render the chart series.
The default palette is dependent on the chart type.
- See Also:
-
getPalette
Returns the palette for the chart. -
setPlotAreaPadding
Set an internal margin for the main plot area.This configures the area (in pixels) around the plot area that is available for axes, labels, and titles.
The default is dependent on the chart type.
Alternatively, you can configure the chart layout to be computed automatically using
setAutoLayoutEnabled()
.- See Also:
-
setPlotAreaPadding
Set an internal margin for the main plot area. -
setPlotAreaPadding
public final void setPlotAreaPadding(int padding) Set an internal margin for the main plot area. -
getPlotAreaPadding
Returns the internal margin for the main plot area.This is either the paddings set through
setPlotAreaPadding()
or computed usingsetAutoLayoutEnabled()
-
setAutoLayoutEnabled
public void setAutoLayoutEnabled(boolean enabled) Configures the chart layout to be automatic.This configures the plot area so that the space around it is suited for the text that is rendered (axis labels and text, the title, and legend).
The default value is
false
, and the chart layout is set manually using values set insetPlotAreaPadding()
. -
setAutoLayoutEnabled
public final void setAutoLayoutEnabled()Configures the chart layout to be automatic. -
isAutoLayoutEnabled
public boolean isAutoLayoutEnabled()Returns whether chart layout is computed automatically.- See Also:
-
setTitle
Set a chart title.The title is displayed on top of the chart, using the
getTitleFont()
.The default title is an empty title ("").
- See Also:
-
getTitle
Return the chart title.- See Also:
-
setTitleFont
Set the font for the chart title.Changes the font for the chart title.
The default title font is a 15 point Sans Serif font.
- See Also:
-
getTitleFont
Returns the font for the chart title.- See Also:
-
paint
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. -
paint
Paint the chart in a rectangle of the given painter.Calls
paint(painter, null)
-
modelChanged
protected void modelChanged() -
modelReset
protected void modelReset()
-