|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.presentation.Shape
com.xj.anylogic.engine.presentation.ShapeControl
com.xj.anylogic.engine.analysis.Chart
public abstract class Chart
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.
| Nested Class Summary | |
|---|---|
static class |
Chart.Properties
A data structure containing all specific chart properties (does not include general shape properties like X, Y, width, height, etc.). |
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_DATE_PATTERN
|
static java.lang.String |
DEFAULT_DATE_TIME_PATTERN
|
static java.lang.String |
DEFAULT_TIME_PATTERN
|
static int |
EAST
|
static int |
GRID_DEFAULT
|
static int |
GRID_NONE
|
static int |
GRID_OPPOSITE
|
static int |
INTERPOLATION_LINEAR
|
static int |
INTERPOLATION_STEP
|
static int |
NONE
|
static int |
NORTH
|
static int |
POINT_CIRCLE
|
static int |
POINT_NONE
|
static int |
POINT_SQUARE
|
static int |
POINT_TRIANGLE
|
static int |
SCALE_100_PERCENT
|
static int |
SCALE_AUTO
|
static int |
SCALE_FIXED
|
static int |
SOUTH
|
static int |
WEST
|
| Fields inherited from class com.xj.anylogic.engine.presentation.ShapeControl |
|---|
TYPE_DOUBLE, TYPE_INT, TYPE_STRING |
| Fields inherited from class com.xj.anylogic.engine.presentation.Shape |
|---|
UNKNOWN_NAME |
| Constructor Summary | |
|---|---|
Chart(Presentable p,
boolean ispublic,
int x,
int y,
int width,
int height,
java.awt.Color fillColor,
java.awt.Color lineColor,
int picOffsetX,
int picOffsetY,
int picWidth,
int picHeight,
java.awt.Color picBackgoundColor,
java.awt.Color picBorderColor,
java.awt.Color legendTextColor,
int legendSize,
int legendPos,
java.util.List<java.lang.String> titles)
Creates a persistent chart. |
|
Chart(Presentable p,
int id,
int index)
Creates a non-persistent chart that will exist only while it is visible. |
|
| Method Summary | |
|---|---|
void |
action()
Does nothing: no actions are associated with charts. |
void |
actionPerformed(java.awt.event.ActionEvent event)
|
Shape |
clone()
Cloning of charts is not supported (Other shapes except GIS and controls allow cloning) This method throws UnsupportedOperationException if called |
java.lang.String |
copyToClipboard()
Copies all chart data to the system clipboard in text form. |
ChartItem |
get(int i)
Returns the chart item (DataItem, DataSet, Histogram, etc.) with the given index. |
int |
getCount()
Returns the number of chart items (data items or data sets) currently displayed by this chart. |
javax.swing.JComponent |
getJComponent()
Returns the embedded JPanel. |
javax.swing.JPopupMenu |
getPopupMenu()
|
int[] |
getSelectedItemIndices()
Returns an array with indices of selected chart items |
java.lang.String |
getTitle(int i)
Returns the title of chart item (DataItem, DataSet, Histogram, etc.) with the given index. |
void |
onItemRemoved(int removedIndex,
boolean programmatically)
Executes specific action when user removes chart item. |
void |
onSelectionChanged(int[] selectedIndices,
boolean programmatically)
Executes specific action when user clicks on legend and selects/deselects chart item(s). |
void |
refresh()
Causes the chart to refresh its picture and legend based on the current data values and schedules the component repaint. |
int |
remove(ChartItem ci)
Removes the given item (DataItem, DataSet, Histogram, Histogram2DData) from the chart. |
void |
remove(int i)
Removes the item (DataItem, DataSet, Histogram, etc.) with the given index from the chart. |
void |
removeAll()
Removes all items from the chart. |
void |
selectItem(int itemIndex,
boolean selected)
Selects/deselects (depending on selected value)
chart item with given index |
void |
setSelectedItemIndices(int[] selectedIndices)
Selects only chart items with given indices |
void |
update()
Refreshes a (non-persistent) chart on each frame. |
void |
updateData()
Updates all data items / data sets displayed by this chart. |
| Methods inherited from class com.xj.anylogic.engine.presentation.ShapeControl |
|---|
contains, draw, getHeight, getPresentable, getWidth, isEnabled, onClickAt, restoreOwner, setEnabled, setHeight, setValueToDefault, setWidth |
| Methods inherited from class com.xj.anylogic.engine.presentation.Shape |
|---|
canHandleClick, getGroup, getName, getRotation, getScaleX, getScaleY, getX, getY, isVisible, onClick, setPos, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NONE
public static final int SOUTH
public static final int WEST
public static final int EAST
public static final int NORTH
public static final int GRID_NONE
public static final int GRID_DEFAULT
public static final int GRID_OPPOSITE
public static final int SCALE_AUTO
public static final int SCALE_FIXED
public static final int SCALE_100_PERCENT
public static final int POINT_NONE
public static final int POINT_SQUARE
public static final int POINT_CIRCLE
public static final int POINT_TRIANGLE
public static final int INTERPOLATION_STEP
public static final int INTERPOLATION_LINEAR
public static final java.lang.String DEFAULT_TIME_PATTERN
public static final java.lang.String DEFAULT_DATE_PATTERN
public static final java.lang.String DEFAULT_DATE_TIME_PATTERN
| Constructor Detail |
|---|
public Chart(Presentable p,
boolean ispublic,
int x,
int y,
int width,
int height,
java.awt.Color fillColor,
java.awt.Color lineColor,
int picOffsetX,
int picOffsetY,
int picWidth,
int picHeight,
java.awt.Color picBackgoundColor,
java.awt.Color picBorderColor,
java.awt.Color legendTextColor,
int legendSize,
int legendPos,
java.util.List<java.lang.String> titles)
p - the presentable object owning this chartispublic - if true, 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
public Chart(Presentable p,
int id,
int index)
p - the Presentable object owning this chartid - the id of the chartindex - the index of the chart (for replicated charts)| Method Detail |
|---|
public void refresh()
public final int getCount()
public final ChartItem get(int i)
i - index of the item
public final java.lang.String getTitle(int i)
i - index of the item
public final int remove(ChartItem ci)
ci - the chart item to remove
public final void remove(int i)
i - the index of item to removepublic void removeAll()
public void updateData()
public java.lang.String copyToClipboard()
public void update()
update in class ShapeControlpublic void action()
action in class ShapeControlpublic javax.swing.JComponent getJComponent()
getJComponent in class ShapeControlpublic final Shape clone()
UnsupportedOperationException if called
clone in class ShapeControlpublic int[] getSelectedItemIndices()
public void setSelectedItemIndices(int[] selectedIndices)
selectedIndices - an array with indices of chart items to be selected (other chart items will be deselected)
public void selectItem(int itemIndex,
boolean selected)
selected value)
chart item with given index
itemIndex - the index of chart item shown on the chartselected - whether select this chart item or deselect it
public void onSelectionChanged(int[] selectedIndices,
boolean programmatically)
selectedIndices - the array of currently selected indices
(never null; may be empty)programmatically - defines either selection was changed programmatically
(via selectItem(int, boolean) and setSelectedItemIndices(int[]))
or by user mouse-click
public void onItemRemoved(int removedIndex,
boolean programmatically)
removedIndex - the index of removed chart itemprogrammatically - defines either chart item was removed programmatically
(via remove(ChartItem), remove(int) or removeAll())
or by user choice in the chart legend context menupublic void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed in interface java.awt.event.ActionListenerpublic javax.swing.JPopupMenu getPopupMenu()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||