public class ChartData extends Container
double[] xAxis = new double[0]; double[] pressureyAxis = new double[0]; Series pressureSeries = new Series("Pression", xAxis, pressureyAxis, Color.BLUE); int cols = 24, rows = 5; XYChart chart = new XYChart(); chart.showHGrids = chart.showVGrids = true; // Shows grids. chart.showTitle = true; // Shows title. chart.showYValues = true; // Shows the Y axis values. chart.yDecimalPlaces = 0; // No decimal places. chart.setXAxis(0, 240, 24); // The X axis is time in minutes. It has an interval of 5 minutes and a maximum of 2 hours. chart.setYAxis(0, 240, 24); // The Y axis is different for each graph. chart.snapToTop = chart.snapToBottom = true; String[][] data = new String[rows][cols]; String[] tit = new String[rows]; for (int r = 0; r < rows; r++) { tit[r] = "row "+(r+1); for (int c = 0; c < cols; c++) data[r][c] = "999"; } ChartData cd1 = new ChartData(chart, tit, data); cd1.lineColor = Color.BLACK; cd1.setFont(font.adjustedBy(-2)); cd1.snapToTop = true; ChartData cd2 = new ChartData(chart, data); cd2.lineColor = Color.BLACK; cd2.setFont(font.adjustedBy(-2)); cd2.snapToBottom = true; add(cd1,LEFT,TOP+25,FILL,PREFERRED); add(cd2,LEFT,BOTTOM-25,FILL,PREFERRED); add(chart,LEFT,AFTER,FILL,FIT,cd1); cd2.bringToFront(); cd1.bringToFront(); chart.showLines = false; chart.yValuesSize = fm.stringWidth("99999"); chart.series.addElement(pressureSeries); // setup the xy chart pressureSeries.xValues = new double[]{10,20,30,40,50}; pressureSeries.yValues = new double[]{10,20,30,40,35}; try { pressureSeries.dot = Resources.radioBkg.getNormalInstance(fmH,fmH,-1); } catch (ImageException e) { MessageBox.showException(e, true); } cd2.reposition();
Modifier and Type | Class and Description |
---|---|
class |
ChartData.ChartDataRow |
Control.TranslucentShape
Modifier and Type | Field and Description |
---|---|
protected Chart |
chart |
int |
fillColor2 |
int |
lineColor |
int |
preferredCellHeight
The height of the cell when using PREFERRED, defined as a % of the control's font height.
|
int |
selectedCol |
int |
selectedRow |
boolean |
snapToBottom |
boolean |
snapToTop |
int |
titleBackColor |
int |
titleForeColor |
int |
use2ndColorEveryXColumns |
alwaysEraseBackground, BACKGROUND_CYLINDRIC_SHADED, BACKGROUND_SHADED, BACKGROUND_SHADED_INV, BACKGROUND_SOLID, backgroundStyle, BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_ROUNDED, BORDER_SIMPLE, BORDER_TOP, borderColor, borderRadius, children, controlFound, finishedStart, ignoreOnAddAgain, ignoreOnRemove, insets, lastH, lastScreenWidth, lastW, lastX, lastY, numChildren, started, tabOrder, tail, TRANSITION_TIME
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, DP, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, floating, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, next, nextTabControl, npParts, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, prev, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, SETX_NOT_SET, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
Constructor and Description |
---|
ChartData(Chart chart)
Constructs an empty ChartData.
|
ChartData(Chart chart,
ChartData.ChartDataRow[] data)
Constructs a ChartData with the given data.
|
Modifier and Type | Method and Description |
---|---|
void |
addLine(int pos,
ChartData.ChartDataRow row)
Adds a new row.
|
Properties.Value |
getCell(int col,
int row) |
int |
getPreferredHeight()
Returns the preferred height of this control.
|
ChartData.ChartDataRow |
getRow(int row) |
Properties.Value |
getSelectedCell() |
ChartData.ChartDataRow |
getSelectedRow() |
void |
onEvent(Event e)
Called to process key, pen, control and other posted events.
|
void |
onPaint(Graphics g)
Draws the border (if any).
|
void |
removeLine(int pos) |
void |
removeLine(java.lang.String title) |
void |
reposition()
Reposition this control, calling again setRect with the original parameters.
|
void |
setCell(Properties.Value value,
int col,
int row) |
add, add, add, add, add, broadcastEvent, clear, fillBackground, findChild, findNearestChild, findNextFocusControl, getBorderRadius, getBorderStyle, getChildren, getChildrenCount, getClientRect, getClientRect, getFirstChild, getFocusableControls, getInsets, incLastX, incLastY, initUI, isPressed, moveFocusToNextControl, moveFocusToNextEditable, onAddAgain, onColorsChanged, onRemove, onSwapFinished, paintChildren, remove, removeAll, resize, resizeHeight, resizeWidth, setBorderRadius, setBorderStyle, setEnabled, setFocusTraversable, setHighlighting, setInsets, setPressColor, setPressed, swapToTopmostWindow
_onEvent, addEnabledStateListener, addFocusListener, addFontChangeHandler, addGridListener, addHandler, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addSizeChangeHandler, addTimer, addTimer, addTimerListener, addValueChangeHandler, addWindowListener, bringToFront, changeHighlighted, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getDoEffect, getEffectH, getEffectW, getEffectX, getEffectY, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPreferredWidth, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, handleGeographicalFocusChangeKeys, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isFloating, isInsideOrNear, isObscured, isTopMost, isVisible, isVisibleAndInside, onBoundsChanged, onFontChanged, onWindowPaintFinished, post, postEvent, postPressedEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHandler, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, repositionChildren, requestFocus, resetSetPositions, resetStyle, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setDoEffect, setFloating, setFocusLess, setFont, setForeColor, setNinePatch, setNinePatch, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
protected Chart chart
public int lineColor
public int fillColor2
public int titleForeColor
public int titleBackColor
public int selectedCol
public int selectedRow
public boolean snapToTop
public boolean snapToBottom
public int use2ndColorEveryXColumns
public int preferredCellHeight
public ChartData(Chart chart)
public ChartData(Chart chart, ChartData.ChartDataRow[] data)
data
- The values to be displayed in the format [rows][cols]public void onPaint(Graphics g)
Container
super.onPaint(g);
, or the border will not be drawn.public void onEvent(Event e)
Control
public void reposition()
Control
reposition
in class Control
public int getPreferredHeight()
Control
getPreferredHeight
in class Control
public Properties.Value getSelectedCell()
public Properties.Value getCell(int col, int row)
public void setCell(Properties.Value value, int col, int row)
public ChartData.ChartDataRow getRow(int row)
public ChartData.ChartDataRow getSelectedRow()
public void addLine(int pos, ChartData.ChartDataRow row)
public void removeLine(int pos)
public void removeLine(java.lang.String title)