Re: Is there a simple X-Y plot example?

Hi Charles,

> I want to plot X-Y pairs in a SpreadSheet cell, along with
> the axes and scales. After reviewing the Visad documenation
> and tutorials carefully, I decided that the best way to
> understand how to accomplish things with Visad was to study
> the example programs. Trouble is, all the examples
> produce a drawn object that seems to want to be rotated
> or otherwise manipulated by the mouse in that it 1) doesn't
> fill the container into which it is drawn

You can make the plot fill the container by scaling the
matrix in ProjectionControl. Something like:

  DisplayRenderer dr = display.getDisplayRenderer();
  MouseBehavior mb = dr.getMouseBehavior();
  ProjectionControl pc = display.getProjectionControl()
  double[] matrix = pc.getMatrix();
  double scale = ... // amount to scale by
  double[] t = mb.make_matrix(0.0, 0.0, 0.0, scale, 0.0, 0.0, 0.0);
  t = mb.multiply_matrix(t, matrix);

> and 2) can be moved
> around in that space. Neither of these attributes is
> needed or desirable for an ordinary X-Y plot.

You can disable mouse control over the display by extending
MouseBehaviorJ3D or MouseBehaviorJ2D and overriding the
processStimulus() method to do nothing:

  public void processStimulus(Enumeration criteria) {
    // do nothing


for how to construct a DisplayImpl that uses your extension
of MouseBehaviorJ3D or MouseBehaviorJ2D.

If you want to do this in a SpreadSheet cell, extend
FancySSCell and override the constructDisplay() method
(implemented in BasicSSCell, the parent of FancySSCell).

Good luck,
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738

  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: