dhale / jtk

The Mines Java Toolkit
http://inside.mines.edu/~dhale/jtk/
Apache License 2.0
83 stars 56 forks source link

Grid view - Simple USER addition to GridView. #19

Closed ericaddison closed 8 years ago

ericaddison commented 8 years ago

This is a simple addition to GridView that allows the user to provide arbitrary locations for the grid lines to draw. This came in handy trying to draw evenly spaced vertical lines that did not line up with major tics. I don't think this functionality was available anywhere else in a simple way, but please let me know if that's incorrect!

Here is the syntax for using this mode:

// set up plot and line locations
PlotPanel plot = ...
float[] hLines = ...
float[] vLines = ...

// add GridView with USER option
GridView gv = plot.addGrid();
gv.setHorizontal(Horizontal.USER);  // these are actually unneccessary
gv.setVertical(Vertical.USER);           // the setLineLocations methods set the mode to USER
gv.setVLineLocations(vLines);
gv.setHLineLocations(hLines);

The GridViewDemo class uses this mode to produce the following graph: image

ericaddison commented 8 years ago

A few more views and modes will be added here, plus the notes from Chris about Apache license and Javadoc tags. Stay tuned...

ericaddison commented 8 years ago

Closing, will reopen when ready.