com.rapidminer.gui.plotter.charts
Class ChartPanelShiftController

java.lang.Object
  extended by com.rapidminer.gui.plotter.charts.ChartPanelShiftController
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener

public class ChartPanelShiftController
extends java.lang.Object
implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener

This class provides ways to shift (aka pan/scroll) a plot. The shift is done through the arrow keys and its step can be configured to be a fixed amount, a percentual of the current axis or a range in pixels.

This class only supports plots of type XYPlot, ContourPlot and FastScatterPlot.

Use ← and → to shift the plot left and right;
Use ↑ and ↓ to shift the plot up and down;
Press the SHIFT key to increase the shift by a factor of 10.

Author:
Gustavo H. Sberze Ribas (CPqD), Ingo Mierswa

Field Summary
static int SHIFT_FIXED
          PAN plot by a fixed amout (eg. 5 range units)
static int SHIFT_PERCENTUAL
          PAN plot by a fixed percentual of the range (eg. 1%)
static int SHIFT_PIXEL
          PAN plot by a fixed number of pixels (eg. 1px)
 
Constructor Summary
ChartPanelShiftController(org.jfree.chart.ChartPanel chartPanel)
          Creates a new controller to handle plot shifts.
 
Method Summary
 double getFixedDomainShiftUnits()
          Returns the fixed shift step for the domain axis.
 double getFixedRangeShiftUnits()
          Returns the fixed shift step for the range axis.
protected  org.jfree.chart.axis.ValueAxis[] getPlotAxis(org.jfree.chart.JFreeChart chart, boolean domain)
          Returns the ValueAxis for the plot or null if the plot doesn't have one.
 int getShiftType()
          Returns the current shift type.
protected  boolean isHorizontalPlot(org.jfree.chart.plot.Plot plot)
          Returns the plot orientation.
 boolean isPlotSupported()
          Returns whether or not the plot supports shifting.
 void keyPressed(java.awt.event.KeyEvent e)
          Pan / Shifts a plot if the arrow keys are pressed.
 void mouseClicked(java.awt.event.MouseEvent mouseEvent)
           
 void mouseDragged(java.awt.event.MouseEvent mouseEvent)
           
 void mouseEntered(java.awt.event.MouseEvent mouseEvent)
           
 void mouseExited(java.awt.event.MouseEvent mouseEvent)
           
 void mouseMoved(java.awt.event.MouseEvent mouseEvent)
           
 void mousePressed(java.awt.event.MouseEvent mouseEvent)
           
 void mouseReleased(java.awt.event.MouseEvent mouseEvent)
           
 void setFixedDomainShiftUnits(double fixedDomainShiftUnits)
          Sets the fixed shift step for the domain axis.
 void setFixedRangeShiftUnits(double fixedRangeShiftUnits)
          Sets the fixed shift step for the range axis.
 void setOnlyXShift(boolean onlyXShift)
           
 void setShiftType(int shiftType)
          Sets the shift type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHIFT_PERCENTUAL

public static final int SHIFT_PERCENTUAL
PAN plot by a fixed percentual of the range (eg. 1%)

See Also:
Constant Field Values

SHIFT_PIXEL

public static final int SHIFT_PIXEL
PAN plot by a fixed number of pixels (eg. 1px)

See Also:
Constant Field Values

SHIFT_FIXED

public static final int SHIFT_FIXED
PAN plot by a fixed amout (eg. 5 range units)

See Also:
Constant Field Values
Constructor Detail

ChartPanelShiftController

public ChartPanelShiftController(org.jfree.chart.ChartPanel chartPanel)
Creates a new controller to handle plot shifts.

Parameters:
chartPanel - The panel displaying the plot.
Method Detail

setOnlyXShift

public void setOnlyXShift(boolean onlyXShift)

isHorizontalPlot

protected boolean isHorizontalPlot(org.jfree.chart.plot.Plot plot)
Returns the plot orientation.

Returns:
True = VERTICAL; False = HORIZONTAL

getPlotAxis

protected org.jfree.chart.axis.ValueAxis[] getPlotAxis(org.jfree.chart.JFreeChart chart,
                                                       boolean domain)
Returns the ValueAxis for the plot or null if the plot doesn't have one.

Parameters:
chart - The chart
domain - True = get Domain axis. False = get Range axis.
Returns:
The selected ValueAxis or null if the plot doesn't have one.

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Pan / Shifts a plot if the arrow keys are pressed.


mouseDragged

public void mouseDragged(java.awt.event.MouseEvent mouseEvent)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent mouseEvent)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent mouseEvent)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent mouseEvent)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent mouseEvent)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent mouseEvent)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent mouseEvent)
Specified by:
mouseExited in interface java.awt.event.MouseListener

getFixedDomainShiftUnits

public double getFixedDomainShiftUnits()
Returns the fixed shift step for the domain axis.

Returns:
the fixed shift step for the domain axis.

setFixedDomainShiftUnits

public void setFixedDomainShiftUnits(double fixedDomainShiftUnits)
Sets the fixed shift step for the domain axis.

Parameters:
fixedDomainShiftUnits - the fixed shift step for the domain axis.

getFixedRangeShiftUnits

public double getFixedRangeShiftUnits()
Returns the fixed shift step for the range axis.

Returns:
the fixed shift step for the range axis.

setFixedRangeShiftUnits

public void setFixedRangeShiftUnits(double fixedRangeShiftUnits)
Sets the fixed shift step for the range axis.

Parameters:
fixedRangeShiftUnits - the fixed shift step for the range axis.

getShiftType

public int getShiftType()
Returns the current shift type.

Returns:
the current shift type.
See Also:
SHIFT_FIXED, SHIFT_PERCENTUAL, SHIFT_PIXEL

setShiftType

public void setShiftType(int shiftType)
Sets the shift type.

Parameters:
shiftType - the new shift type.
See Also:
SHIFT_FIXED, SHIFT_PERCENTUAL, SHIFT_PIXEL

isPlotSupported

public boolean isPlotSupported()
Returns whether or not the plot supports shifting.

Returns:
True if plot can be shifted.


Copyright © 2001-2009 by Rapid-I