|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.jidesoft.chart.event.ChartValueReporter
public class ChartValueReporter
A ChartValueReporter shows the position of the 'focus' point as x and y coordinates. ChartValueReporter supports numeric and time axes. To display a formatted string for a time axis, use something like the following:
chartValueReporter.setFormatString("x = %1$tH:%1$tM; y = %2$.3f");
This displays the hours and minutes of the time on the x axis, along with a numeric value for the y axis, given to 3 decimal places.
Formatter
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.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 java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
ChartValueReporter(Chart newChart)
Constructs a ChartValueReporter that reports the value around the cursor point of the supplied chart. |
|
ChartValueReporter(ChartCrossHair crossHair)
This constructor acknowledges the fact that a ChartValueReporter is often used in conjunction with a CrossHair. |
Method Summary | |
---|---|
protected void |
clearChartValue()
Clears the reported value and resets the last known cursor position. |
Double |
getChartX()
Returns the x coordinate (in user coordinates) of the current chart value |
Double |
getChartY()
Returns the y coordinate (in user coordinates) of the current chart value |
String |
getFormatString()
Returns the format string used for reporting the current value in the chart |
ChartModel |
getModel()
Returns the model of interest, if any |
String |
getNoSelectionText()
Returns the text used when there is no point selected and no chart value to report |
void |
mouseClicked(MouseEvent e)
Not used |
void |
mouseDragged(MouseEvent e)
Not used |
void |
mouseEntered(MouseEvent e)
Not used |
void |
mouseExited(MouseEvent e)
Clears the reported value when the mouse exits the chart |
void |
mouseMoved(MouseEvent e)
Updates the reported value when the mouse moves |
void |
mousePressed(MouseEvent e)
Not used |
void |
mouseReleased(MouseEvent e)
Not used |
void |
setFormatString(String formatString)
Sets the format string used for displaying the current chart value. |
void |
setModel(ChartModel model)
If you set the model of the ChartValueReporter , then only points from that
model will be reported. |
void |
setNoSelectionText(String noSelectionText)
Set the text to use when no point is selected and there is no chart value to report. |
protected void |
setText(String text)
Sets the text of the ChartValueReporter to be the specified value |
void |
update()
Update the reported value using the latest known cursor position. |
protected void |
updateChartValue(double x,
double y)
Updates the reported value with the supplied x and y coordinates |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ChartValueReporter(Chart newChart)
When you use this constructor, you will need to register the instance as a MouseListener and a MouseMotionListener on the chart
newChart
- the Chart instance for which we wish to create a ChartValueReporterpublic ChartValueReporter(ChartCrossHair crossHair)
crossHair
- the crossHair that is being used on the chart of interest.Method Detail |
---|
protected void clearChartValue()
protected void updateChartValue(double x, double y)
x
- the x value in user coordinate spacey
- the y value in user coordinate spaceprotected void setText(String text)
text
- the updated text to displaypublic String getFormatString()
public void setFormatString(String formatString)
formatString
- the format string to usepublic String getNoSelectionText()
public void setNoSelectionText(String noSelectionText)
noSelectionText
- the text to use when no point is selectedpublic Double getChartX()
public Double getChartY()
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public ChartModel getModel()
public void setModel(ChartModel model)
ChartValueReporter
, then only points from that
model will be reported. Otherwise points from the nearest model will be reported.
model
- the model from which points should be reportedpublic void update()
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |