Example usage for org.jfree.chart.event PlotChangeEvent PlotChangeEvent

List of usage examples for org.jfree.chart.event PlotChangeEvent PlotChangeEvent

Introduction

In this page you can find the example usage for org.jfree.chart.event PlotChangeEvent PlotChangeEvent.

Prototype

public PlotChangeEvent(Plot plot) 

Source Link

Document

Creates a new PlotChangeEvent.

Usage

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Sets the paint for the domain tick bands.
 *
 * @param paint  the paint (<code>null</code> permitted).
 *///from  w  w w. j  av a2 s. c  om
public void setDomainTickBandPaint(Paint paint) {
    this.domainTickBandPaint = paint;
    notifyListeners(new PlotChangeEvent(this));
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Sets the paint for the range tick bands.
 *
 * @param paint  the paint (<code>null</code> permitted).
 *//*from   www.ja  va  2 s.co m*/
public void setRangeTickBandPaint(Paint paint) {
    this.rangeTickBandPaint = paint;
    notifyListeners(new PlotChangeEvent(this));
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Sets the quadrant origin and sends a {@link PlotChangeEvent} to all
 * registered listeners.//from ww w . j  av  a  2 s . c o m
 *
 * @param origin  the origin (<code>null</code> not permitted).
 */
public void setQuadrantOrigin(Point2D origin) {
    if (origin == null) {
        throw new IllegalArgumentException("Null 'origin' argument.");
    }
    this.quadrantOrigin = origin;
    notifyListeners(new PlotChangeEvent(this));
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Sets the paint used for the specified quadrant and sends a
 * {@link PlotChangeEvent} to all registered listeners.
 *
 * @param index  the quadrant index (0-3).
 * @param paint  the paint (<code>null</code> permitted).
 *//*from   w  w  w.  j  a v  a2  s .c  om*/
public void setQuadrantPaint(int index, Paint paint) {
    if ((index < 0) || (index > 3)) {
        throw new IllegalArgumentException("The index should be in the range 0 to 3.");
    }
    this.quadrantPaint[index] = paint;
    notifyListeners(new PlotChangeEvent(this));
}

From source file:jhplot.HChart.java

public void drawToGraphics2D(Graphics2D g, int width, int height) {
    // self.chartCoordsMap = {} #Maps a chart to its raw screen coords, used
    // for converting coords
    g.setColor(Color.white);//  w w  w. j a v  a  2 s  .  c o  m
    g.fillRect(0, 0, width, height);
    //
    // int boxWidth = width / this.chartarray[0].length;
    // int boxHeight = height / this.chartarray.length;

    int cols = N1final;
    int rows = N2final;
    int boxWidth = width / cols;
    int boxHeight = height / rows;

    //
    // # print "boxWidth ", boxWidth
    // # print "boxHeight ", boxHeight

    // for (int row = 0; row < chartarray.length; row++)
    int currentChartIndex = 0;

    for (int i2 = 0; i2 < rows; i2++) {
        for (int i1 = 0; i1 < cols; i1++) {

            currentChartIndex++;
            if (chart[i1][i2] != null) {

                int rowsUsed = 1;
                int colsUsed = 1;
                int chartX = boxWidth * i1;
                int chartY = boxHeight * i2;
                int chartwidth = boxWidth;
                int chartheight = boxHeight;
                // #Get Horizontalspace
                // for (int c = col; c > -1; c--)
                // {
                // // for c in range(col, -1, -1):
                // // if self.chartArray[row][c] == None:
                // if(this.chartarray[row][c] == null)
                // rowsUsed++;
                //
                // // rowsUsed = rowsUsed + 1
                // // #print "adding row"
                // }
                chartwidth = boxWidth * rowsUsed;
                chartheight = boxHeight;
                chartX = chartX - (rowsUsed - 1) * boxWidth;
                //
                // # chart.configureDomainAxes()
                // # chart.configureRangeAxes()
                //
                // #Testing axes ranges not updated
                // from org.jfree.chart.event import PlotChangeEvent
                // chart[i1][i2].plotChanged(new
                // PlotChangeEvent(chart[i1][i2].getXYPlot()));
                chart[i1][i2].plotChanged(new PlotChangeEvent(chart[i1][i2].getPlot()));
                //
                ChartRenderingInfo info = new ChartRenderingInfo();
                //
                chart[i1][i2].draw(g, new java.awt.Rectangle(chartX, chartY, chartwidth, chartheight),
                        new Point(chartX, chartY), info);
                // self.chartToInfoMap[chart] = info
                //
                // self.chartCoordsMap[chart] = [chartX ,chartY,chartwidth,
                // chartheight]

            }
        }
    }

}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Clears all the (foreground and background) domain markers and sends a
 * {@link PlotChangeEvent} to all registered listeners.
 *//*from   w w  w . j a va 2 s  .  c om*/
public void clearDomainMarkers() {
    if (this.foregroundDomainMarkers != null) {
        this.foregroundDomainMarkers.clear();
    }
    if (this.backgroundDomainMarkers != null) {
        this.backgroundDomainMarkers.clear();
    }
    notifyListeners(new PlotChangeEvent(this));
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Clears the (foreground and background) domain markers for a particular
 * renderer./*  ww w .j  a v a2s . c om*/
 *
 * @param index  the renderer index.
 */
public void clearDomainMarkers(int index) {
    Integer key = new Integer(index);
    if (this.backgroundDomainMarkers != null) {
        Collection markers = (Collection) this.backgroundDomainMarkers.get(key);
        if (markers != null) {
            markers.clear();
        }
    }
    if (this.foregroundRangeMarkers != null) {
        Collection markers = (Collection) this.foregroundDomainMarkers.get(key);
        if (markers != null) {
            markers.clear();
        }
    }
    notifyListeners(new PlotChangeEvent(this));
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Adds a marker for a renderer and sends a {@link PlotChangeEvent} to
 * all registered listeners.//from w w  w.j  a va  2 s  .  c  om
 * <P>
 * Typically a marker will be drawn by the renderer as a line perpendicular
 * to the domain axis (that the renderer is mapped to), however this is
 * entirely up to the renderer.
 *
 * @param index  the renderer index.
 * @param marker  the marker.
 * @param layer  the layer (foreground or background).
 */
public void addDomainMarker(int index, Marker marker, Layer layer) {
    Collection markers;
    if (layer == Layer.FOREGROUND) {
        markers = (Collection) this.foregroundDomainMarkers.get(new Integer(index));
        if (markers == null) {
            markers = new java.util.ArrayList();
            this.foregroundDomainMarkers.put(new Integer(index), markers);
        }
        markers.add(marker);
    } else if (layer == Layer.BACKGROUND) {
        markers = (Collection) this.backgroundDomainMarkers.get(new Integer(index));
        if (markers == null) {
            markers = new java.util.ArrayList();
            this.backgroundDomainMarkers.put(new Integer(index), markers);
        }
        markers.add(marker);
    }
    notifyListeners(new PlotChangeEvent(this));
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Clears all the range markers and sends a {@link PlotChangeEvent} to all
 * registered listeners.//from w w w  .  j a  v  a2 s  .c  om
 */
public void clearRangeMarkers() {
    if (this.foregroundRangeMarkers != null) {
        this.foregroundRangeMarkers.clear();
    }
    if (this.backgroundRangeMarkers != null) {
        this.backgroundRangeMarkers.clear();
    }
    notifyListeners(new PlotChangeEvent(this));
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Adds a marker for a renderer and sends a {@link PlotChangeEvent} to
 * all registered listeners.//from w  w  w.  ja v a 2s  .  c  om
 * <P>
 * Typically a marker will be drawn by the renderer as a line perpendicular
 * to the range axis, however this is entirely up to the renderer.
 *
 * @param index  the renderer index.
 * @param marker  the marker.
 * @param layer  the layer (foreground or background).
 */
public void addRangeMarker(int index, Marker marker, Layer layer) {
    Collection markers;
    if (layer == Layer.FOREGROUND) {
        markers = (Collection) this.foregroundRangeMarkers.get(new Integer(index));
        if (markers == null) {
            markers = new java.util.ArrayList();
            this.foregroundRangeMarkers.put(new Integer(index), markers);
        }
        markers.add(marker);
    } else if (layer == Layer.BACKGROUND) {
        markers = (Collection) this.backgroundRangeMarkers.get(new Integer(index));
        if (markers == null) {
            markers = new java.util.ArrayList();
            this.backgroundRangeMarkers.put(new Integer(index), markers);
        }
        markers.add(marker);
    }
    notifyListeners(new PlotChangeEvent(this));
}