Package com.anylogic.engine.analysis
- Nested Class Summary
- Nested classes/interfaces inherited from class com.anylogic.engine.presentation.ShapeControl
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- NONE
- SOUTH
- WEST
- EAST
- NORTH
- GRID_NONE
- GRID_DEFAULT
- GRID_OPPOSITE
- SCALE_AUTO
- SCALE_AUTO_FROM_0
- SCALE_FIXED
- SCALE_100_PERCENT
- POINT_NONE
- POINT_SQUARE
- POINT_CIRCLE
- POINT_TRIANGLE
- INTERPOLATION_STEP
- INTERPOLATION_LINEAR
- WINDOW_MOVES_WITH_TIME
- WINDOW_MOVES_WITH_DATA
- DEFAULT_TIME_PATTERN
- DEFAULT_DATE_PATTERN
- DEFAULT_DATE_TIME_PATTERN
- SHORT_TIME_PATTERN
- SHORT_DATE_PATTERN
- SHORT_DATE_TIME_PATTERN
- Constructor Details
- Method Details
- java.lang.Object
- com.anylogic.engine.presentation.Shape
- com.anylogic.engine.presentation.ShapeControl
- com.anylogic.engine.analysis.Chart<E>
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,Locatable2D
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,Serializable
,Cloneable
- Direct Known Subclasses:
Chart1D
,Chart2D
,Histogram
,Histogram2D
public abstract class Chart<E extends ChartItem> extends ShapeControl
The base class for all charts. Embeds JPanel with several sub-components.
Is responsible for the chart overall layout, and for the chart legend functionality.
Delegates the drawing of the chart to its subclasses.
The chart area is divided into two parts: the picture area (where the picture, like plot, pie, bar, histogram, etc. is drawn) and the legend area. The legend can be located on either of the four sides of the chart (NORTH, SOUTH, EAST, WEST), or absent (NONE). The picture can be located at arbitrary position within the picture area, i.e. the part of the chart not occupied by the legend.
The chart area is divided into two parts: the picture area (where the picture, like plot, pie, bar, histogram, etc. is drawn) and the legend area. The legend can be located on either of the four sides of the chart (NORTH, SOUTH, EAST, WEST), or absent (NONE). The picture can be located at arbitrary position within the picture area, i.e. the part of the chart not occupied by the legend.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Modifier and Type | Class | Description |
---|---|---|
static enum | Chart.Direction |
multipurpose direction/position constants
|
static enum | Chart.GridPosition |
grid text position constants
|
static enum | Chart.InterpolationType |
interpolation types
|
static enum | Chart.PointStyle |
line point styles
|
static enum | Chart.ScaleType |
scale types
|
static enum | Chart.TimeWindowMovementType |
Constructor | Description |
---|---|
Chart |
Creates a persistent chart.
|
Modifier and Type | Method | Description |
---|---|---|
void | action() |
Does nothing: no actions are associated with charts.
|
final Shape | clone() |
Cloning of charts is not supported
(Other shapes except GIS and controls allow cloning) This method throws UnsupportedOperationException if called |
String | copyToClipboard() |
Deprecated.
will be removed in the future release.
|
void | executeUserAction |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
final E | get |
Returns the chart item (DataItem, DataSet, HistogramData, etc.) with the
given index.
|
abstract Color | getColor |
Returns the color of the chart item with the given index.
|
final int | getCount() |
Returns the number of chart items (data items or data sets) currently
displayed by this chart.
|
JComponent | getJComponent() |
Deprecated.
This function is deprecated and will be removed in the next release
|
int[] | getSelectedItemIndices() |
Returns an array with indices of selected chart items
|
final String | getTitle |
Returns the title of chart item (DataItem, DataSet, HistogramData, etc.) with the
given index.
|
void | onSelectionChanged_xjal |
Executes specific action when user clicks on legend and
selects/deselects chart item(s).
This method does nothing by default and may be overridden for charts they have any on-selection-changed activity. |
void | postSVGShapeSpecificAttributes |
Posts general properties specific to a particular shape class.
|
void | refresh() |
Deprecated.
|
final void | remove |
Removes the item (DataItem, DataSet, HistogramData, etc.) with the given index
from the chart.
|
final int | remove |
Removes the given item (DataItem, DataSet, HistogramData, Histogram2DData) from the chart.
|
void | removeAll() |
Removes all items from the chart.
|
void | selectItem |
Selects/deselects (depending on
selected value)
chart item with given index |
void | setColor |
Sets the new color of the chart item with the given index.
|
void | setSelectedItemIndices |
Selects only chart items with given indices
|
void | update() |
Deprecated.
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | updateData() |
Updates all data items / data sets displayed by this chart.
|
contains, executeAction, getHeight, getPresentable, getWidth, isEnabled, randomPointInside, restoreOwner, setEnabled, setHeight, setValueToDefault, setWidth
canHandleClick, findSVGElement, getDrawMode, getGroup, getLevel, getName, getRotation, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, onClick, randomPointInside, removeSVGFromOwner, removeSVGImage, resetSVGState, setLevel, setPos, setPos, setPublic_xjal, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
public static final Chart.Direction NONE
public static final Chart.Direction SOUTH
public static final Chart.Direction WEST
public static final Chart.Direction EAST
public static final Chart.Direction NORTH
public static final Chart.GridPosition GRID_NONE
public static final Chart.GridPosition GRID_DEFAULT
public static final Chart.GridPosition GRID_OPPOSITE
public static final Chart.ScaleType SCALE_AUTO
public static final Chart.ScaleType SCALE_AUTO_FROM_0
public static final Chart.ScaleType SCALE_FIXED
public static final Chart.ScaleType SCALE_100_PERCENT
public static final Chart.PointStyle POINT_NONE
public static final Chart.PointStyle POINT_SQUARE
public static final Chart.PointStyle POINT_CIRCLE
public static final Chart.PointStyle POINT_TRIANGLE
public static final Chart.InterpolationType INTERPOLATION_STEP
public static final Chart.InterpolationType INTERPOLATION_LINEAR
public static final Chart.TimeWindowMovementType WINDOW_MOVES_WITH_TIME
public static final Chart.TimeWindowMovementType WINDOW_MOVES_WITH_DATA
public static final String DEFAULT_TIME_PATTERN
public static final String DEFAULT_DATE_PATTERN
public static final String DEFAULT_DATE_TIME_PATTERN
public static final String SHORT_TIME_PATTERN
public static final String SHORT_DATE_PATTERN
public static final String SHORT_DATE_TIME_PATTERN
public Chart(Presentable p, boolean ispublic, double x, double y, double width, double height, Color fillColor, Color lineColor, double picOffsetX, double picOffsetY, double picWidth, double picHeight, Color picBackgoundColor, Color picBorderColor, Color legendTextColor, double legendSize, Chart.Direction legendPos, List<String> titles)
Creates a persistent chart.
- Parameters:
p
- the presentable object owning this chartispublic
- iftrue
, the chart is visible on container's presentationx
- the x coordinate of the charty
- the y coordinate of the chartwidth
- the width of the whole chartheight
- the height of the whole chartfillColor
- the background color of the whole chartlineColor
- the line border color of the whole chartpicOffsetX
- the x offset of the picture from the top left corner of the picture areapicOffsetY
- the y offset of the picture from the top left corner of the picture areapicWidth
- the width of the picturepicHeight
- the height of the picturepicBackgoundColor
- the background color of the picture, null for none (transparent)picBorderColor
- the border color of the picture, null for no borderlegendTextColor
- the color of the legend textlegendSize
- the size of the legend area: width if legendPos is EAST or WEST, height if NORTH or SOUTHlegendPos
- the legend position (NONE, SOUTH, NORTH, EAST, WEST)titles
- the collection of chart item titles, or null
@Deprecated public void refresh()
Deprecated.
Causes the chart to refresh its picture and legend based on the
current data values and schedules the component repaint. This method needs
to be extended in subclasses by doing some work before calling super.refresh()
public final int getCount()
Returns the number of chart items (data items or data sets) currently
displayed by this chart.
- Returns:
- the number of chart items
public final E get(int i)
Returns the chart item (DataItem, DataSet, HistogramData, etc.) with the
given index.
- Parameters:
i
- index of the item- Returns:
- the chart item with the given index
public final String getTitle(int i)
Returns the title of chart item (DataItem, DataSet, HistogramData, etc.) with the
given index.
- Parameters:
i
- index of the item- Returns:
- the title of the chart item with the given index
public void setColor(int i, Color c)
Sets the new color of the chart item with the given index. The effect depends on
the chart type.
- Parameters:
i
- index of the itemc
- the new color of the item- Since:
- 8.5
public abstract Color getColor(int i)
Returns the color of the chart item with the given index. it depends on the
chart type, which color exactly is returned.
- Parameters:
i
- index of the item- Returns:
- the color of the item
public final int remove(ChartItem ci)
Removes the given item (DataItem, DataSet, HistogramData, Histogram2DData) from the chart.
If the item is not present, does nothing.
- Parameters:
ci
- the chart item to remove- Returns:
- the index of the item
public final void remove(int i)
Removes the item (DataItem, DataSet, HistogramData, etc.) with the given index
from the chart.
- Parameters:
i
- the index of item to remove
public void removeAll()
Removes all items from the chart.
public void updateData()
Updates all data items / data sets displayed by this chart.
In contrast with update(), this method only updates the data,
but does not update the chart visual appearance.
@Deprecated public String copyToClipboard()
Deprecated.
will be removed in the future release. Please use copy button on model animation or
Utilities.copyToClipboard(String)
.@AnyLogicInternalAPI @Deprecated public void update()
Deprecated.
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
@AnyLogicInternalAPI public void action()
Does nothing: no actions are associated with charts.
- Overrides:
action
in classShapeControl
@Deprecated public JComponent getJComponent()
Deprecated.
This function is deprecated and will be removed in the next release
Returns the embedded JPanel.
public final Shape clone()
Cloning of charts is not supported
(Other shapes except GIS and controls allow cloning)
This method throws
(Other shapes except GIS and controls allow cloning)
This method throws
UnsupportedOperationException
if called- Overrides:
clone
in classShapeControl
public int[] getSelectedItemIndices()
Returns an array with indices of selected chart items
- Returns:
- an array with indices of selected chart items
public void setSelectedItemIndices(int[] selectedIndices)
Selects only chart items with given indices
- Parameters:
selectedIndices
- an array with indices of chart items to be selected (other chart items will be deselected), may benull
- this clears selection
public void selectItem(int itemIndex, boolean selected)
Selects/deselects (depending on
selected
value)
chart item with given index- Parameters:
itemIndex
- the index of chart item shown on the chartselected
- whether select this chart item or deselect it
@AnyLogicInternalCodegenAPI public void onSelectionChanged_xjal(int[] selectedIndices, boolean programmatically)
Executes specific action when user clicks on legend and
selects/deselects chart item(s).
This method does nothing by default and may be overridden for charts they have any on-selection-changed activity.
This method does nothing by default and may be overridden for charts they have any on-selection-changed activity.
- Parameters:
selectedIndices
- the array of currently selected indices (nevernull
; may be empty)programmatically
- defines either selection was changed programmatically (viaselectItem(int, boolean)
andsetSelectedItemIndices(int[])
) or by user mouse-click
public void postSVGShapeSpecificAttributes(List<String> att, List<String> val, boolean publicOnly)
Description copied from class:
Shape
Posts general properties specific to a particular shape class.
Is triggered by SVG_DIRTY_SHAPE flag.
Made public for occasional posting of additional SVG properties from outside engine
(e.g. from libraries)
- Overrides:
postSVGShapeSpecificAttributes
in classShapeControl
- Parameters:
att
- attribute namesval
- attribute valuespublicOnly
- TODO
@AnyLogicInternalAPI public void executeUserAction(String value)
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
executeUserAction
in interfaceSVGElement
- Overrides:
executeUserAction
in classShape