|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Object
|
+--Component
|
+--Container
|
+--JComponent
|
+--JPanel
|
+--LineChart
A simple chart showing one or more line graphs. As the mouse
moves over the chart, a tooltip displays the coordinates of the
points. To use the chart, call the setXXX methods in
roughly the order they appear here. Only handles y ≥ 0,
and always displays the y-axis. The x-coordinates
in the line graphs are the consecutive integers 0, 1, 2, ....
| Nested Class Summary |
| Nested classes inherited from class JPanel |
JPanel.AccessibleJPanel |
| Nested classes inherited from class JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class Container |
Container.AccessibleAWTContainer |
| Nested classes inherited from class Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
| Fields inherited from class JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
LineChart()
|
|
| Method Summary | |
Dimension |
getMinimumSize()
|
Dimension |
getPreferredSize()
|
static void |
main(String[] args)
Takes arguments u0 v0 u1 v1 u2 v2, etc., all ≥
0, and plots a chart with two line graphs, one for
u and one for v. |
protected void |
paintComponent(Graphics g)
|
void |
setData(float[][] dd,
String[] l,
Color[] c)
Main method to set the chart's data. |
void |
setDataSetVisible(int i,
boolean isVisible)
Set the visibility of the i-th data series
(default true). |
void |
setMaxY(float max)
Sets the maximum y value. |
void |
setSignificantFigures(int sigFig)
Sets the number of significant figures (default 3) in the labels on the y-axis. |
void |
setTitles(String title,
String xaxis,
String yaxis)
Sets the titles. |
protected void |
setToolTip(MouseEvent e)
Sets a tooltip on this LineChart. |
| Methods inherited from class JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public LineChart()
| Method Detail |
public void setMaxY(float max)
public void setTitles(String title,
String xaxis,
String yaxis)
public void setData(float[][] dd,
String[] l,
Color[] c)
dd - Holds the y values. Of size
(number of x-coordinates) × (number of line
graphs).l - Labels for the x values. Of length
(number of x-coordinates). If it's null, no labels are
used.c - Colors for the line graphs. Of length (number of line
graphs).
NullPointerException - If dd is null.
public void setDataSetVisible(int i,
boolean isVisible)
i-th data series
(default true).
public void setSignificantFigures(int sigFig)
Format.roundToSigFig(float, int)
for restrictions.
public Dimension getMinimumSize()
getMinimumSize in class JComponentpublic Dimension getPreferredSize()
getPreferredSize in class JComponentprotected void paintComponent(Graphics g)
paintComponent in class JComponentprotected void setToolTip(MouseEvent e)
public static void main(String[] args)
u0 v0 u1 v1 u2 v2, etc., all ≥
0, and plots a chart with two line graphs, one for
u and one for v. If there is no
data, plots two sine waves.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||