|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Composite | +--com.java4less.rchart.swt.ChartViewer
This class is a SWT control which can be added to any SWT Control or window. The viewer implements the following features: - It displays the chart you set with the setChart() method. - It implements scroll bars and zoom in/out buttons. - It can automatically change the cursor when the pointer moves over a value in the chart. The following is a very simple SWT java program which uses the chart viewer: Display display = new Display(); // set Rchart SWT mode GraphicsProvider.setMode(GraphicsProvider.MODE_SWT); SwtGraphicsProvider.setDefaultDisplay(display); Shell shell = new Shell(display); shell.setSize(300,300); shell.setBounds(100,100,400,400); // create chart ChartLoader cloader=new ChartLoader(); cloader.loadFromFile("areaChart.txt",false); // load chart parameters from file Chart chart=cloader.build(false,false); // create chart viewer and set the chart ChartViewer chartViewer=new ChartViewer(shell,SWT.NONE); chartViewer.setBounds(0,0,400,400); chartViewer.setChart(chart); shell.open(); while(!shell.isDisposed()) if(!display.readAndDispatch()) display.sleep(); display.dispose(); chart.dispose();
Field Summary | |
boolean |
allowZoom
if TRUE the +/- zoom buttons will be made visible. |
boolean |
changePointer
change mouse pointer when we are over a point |
int |
currentZoom
current value of zoom (initial value is 100) |
int |
maxZoom
maximum zoom in %. |
int |
minZoom
minimum zoom in %. |
int |
zoomIncrement
zoom increment in % for the +/- buttons. |
Constructor Summary | |
ChartViewer(Composite parent,
int style)
|
Method Summary | |
void |
dispose()
dispose control |
Chart |
getChart()
get chart to display |
void |
redrawChart()
force the chart to be repainted |
void |
setChart(Chart c)
set chart to display |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public boolean allowZoom
public int maxZoom
public int minZoom
public int currentZoom
public int zoomIncrement
public boolean changePointer
Constructor Detail |
public ChartViewer(Composite parent, int style)
Method Detail |
public Chart getChart()
public void setChart(Chart c)
c
- public void dispose()
public void redrawChart()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |