All Downloads are FREE. Search and download functionalities are using the official Maven repository.

JSci.awt.CategoryGraph2D Maven / Gradle / Ivy

Go to download

JSci is a set of open source Java packages. The aim is to encapsulate scientific methods/principles in the most natural way possible. As such they should greatly aid the development of scientific based software. It offers: abstract math interfaces, linear algebra (support for various matrix and vector types), statistics (including probability distributions), wavelets, newtonian mechanics, chart/graph components (AWT and Swing), MathML DOM implementation, ... Note: some packages, like javax.comm, for the astro and instruments package aren't listed as dependencies (not available).

The newest version!
package JSci.awt;

import java.awt.*;

/**
* The CategoryGraph2D superclass provides an abstract encapsulation
* of 2D category graphs.
* @version 1.2
* @author Mark Hale
*/
public abstract class CategoryGraph2D extends DoubleBufferedCanvas implements GraphDataListener {
        /**
        * Data model.
        */
        protected CategoryGraph2DModel model;
        /**
        * Origin.
        */
        protected Point origin=new Point();
        /**
        * Padding.
        */
        protected final int scalePad=5;
        protected final int axisPad=25;
        protected int leftAxisPad;
        /**
        * Constructs a 2D category graph.
        */
        public CategoryGraph2D(CategoryGraph2DModel cgm) {
                model=cgm;
                model.addGraphDataListener(this);
        }
        /**
        * Sets the data plotted by this graph to the specified data.
        */
        public final void setModel(CategoryGraph2DModel cgm) {
                model.removeGraphDataListener(this);
                model=cgm;
                model.addGraphDataListener(this);
                dataChanged(new GraphDataEvent(model));
        }
        /**
        * Returns the model used by this graph.
        */
        public final CategoryGraph2DModel getModel() {
                return model;
        }
        public abstract void dataChanged(GraphDataEvent e);
        /**
        * Returns the preferred size of this component.
        */
        public Dimension getPreferredSize() {
                return getMinimumSize();
        }
        /**
        * Returns the minimum size of this component.
        */
        public Dimension getMinimumSize() {
                return new Dimension(170, 170);
        }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy