Java Code Examples for org.jfree.chart.axis.ValueAxis#getLowerBound()

The following examples show how to use org.jfree.chart.axis.ValueAxis#getLowerBound() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XYPlot.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Draws the domain tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #setDomainTickBandPaint(Paint)
 */
public void drawDomainTickBands(Graphics2D g2, Rectangle2D dataArea,
                                List ticks) {
    Paint bandPaint = getDomainTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis xAxis = getDomainAxis();
        double previous = xAxis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = xAxis.getUpperBound();
        if (fillBand) {
            getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                    previous, end);
        }
    }
}
 
Example 2
Source File: XYPlot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the range tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #setRangeTickBandPaint(Paint)
 */
public void drawRangeTickBands(Graphics2D g2, Rectangle2D dataArea,
                               List ticks) {
    Paint bandPaint = getRangeTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis axis = getRangeAxis();
        double previous = axis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillRangeGridBand(g2, this, axis, dataArea,
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = axis.getUpperBound();
        if (fillBand) {
            getRenderer().fillRangeGridBand(g2, this, axis, dataArea,
                    previous, end);
        }
    }
}
 
Example 3
Source File: AbstractChartPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
private void shrinkSelectionXAxis(double x, double y, Selection selectionObject, ValueAxis axis, int axisIndex,
		double zoomFactor) {
	Rectangle2D scaledDataArea = getScreenDataArea((int) x, (int) y);

	double minX = scaledDataArea.getMinX();
	double maxX = scaledDataArea.getMaxX();
	double partToLeft = (x - minX) / (maxX - minX);

	double lowerDomain = axis.getLowerBound();
	double upperDomain = axis.getUpperBound();
	double middlePointLeft = lowerDomain + (upperDomain - lowerDomain) * partToLeft;
	double width = (upperDomain - lowerDomain) * zoomFactor;
	Range domainRange = new Range(middlePointLeft - width / 2d, middlePointLeft + width / 2d);
	for (String axisName : axisNameResolver.resolveXAxis(axisIndex)) {
		selectionObject.addDelimiter(axisName, domainRange);
	}
}
 
Example 4
Source File: PolarPlot.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Translates a (theta, radius) pair into Java2D coordinates.  If
 * <code>radius</code> is less than the lower bound of the axis, then
 * this method returns the centre point.
 *
 * @param angleDegrees  the angle in degrees.
 * @param radius  the radius.
 * @param axis  the axis.
 * @param dataArea  the data area.
 *
 * @return A point in Java2D space.
 *
 * @since 1.0.14
 */
public Point translateToJava2D(double angleDegrees, double radius,
        ValueAxis axis, Rectangle2D dataArea) {

    if (counterClockwise) {
        angleDegrees = -angleDegrees;
    }
    double radians = Math.toRadians(angleDegrees + this.angleOffset);

    double minx = dataArea.getMinX() + this.margin;
    double maxx = dataArea.getMaxX() - this.margin;
    double miny = dataArea.getMinY() + this.margin;
    double maxy = dataArea.getMaxY() - this.margin;

    double halfWidth = (maxx - minx) / 2.0;
    double halfHeight = (maxy - miny) / 2.0;

    double midX = minx + halfWidth;
    double midY = miny + halfHeight;

    double l = Math.min(halfWidth, halfHeight);
    Rectangle2D quadrant = new Rectangle2D.Double(midX, midY, l, l);

    double axisMin = axis.getLowerBound();
    double adjustedRadius = Math.max(radius, axisMin);

    double length = axis.valueToJava2D(adjustedRadius, quadrant, RectangleEdge.BOTTOM) - midX;
    float x = (float) (midX + Math.cos(radians) * length);
    float y = (float) (midY + Math.sin(radians) * length);

    int ix = Math.round(x);
    int iy = Math.round(y);

    Point p = new Point(ix, iy);
    return p;

}
 
Example 5
Source File: ChartLogics.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Zoom in (negative zoom) or zoom out of axis.
 * 
 * @param myChart
 * @param zoom percentage zoom factor
 * @param start point on this range (first click/pressed event), used as center
 */
public static void zoomAxis(ValueAxis axis, double zoom, double start) {
  double lower = axis.getLowerBound();
  double upper = axis.getUpperBound();
  double dist = upper - lower;
  double f = (start - lower) / dist;

  lower -= dist * zoom * f;
  upper += dist * zoom * (1 - f);

  if (lower < upper) {
    Range range = new Range(lower, upper);
    setZoomAxis(axis, keepRangeWithinAutoBounds(axis, range));
  }
}
 
Example 6
Source File: CandlestickRenderer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initialises the renderer then returns the number of 'passes' through the
 * data that the renderer will require (usually just one).  This method
 * will be called before the first item is rendered, giving the renderer
 * an opportunity to initialise any state information it wants to maintain.
 * The renderer can do nothing if it chooses.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * @param plot  the plot.
 * @param dataset  the data.
 * @param info  an optional info collection object to return data back to
 *              the caller.
 *
 * @return The number of passes the renderer requires.
 */
@Override
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea,
        XYPlot plot, XYDataset dataset, PlotRenderingInfo info) {

    // calculate the maximum allowed candle width from the axis...
    ValueAxis axis = plot.getDomainAxis();
    double x1 = axis.getLowerBound();
    double x2 = x1 + this.maxCandleWidthInMilliseconds;
    RectangleEdge edge = plot.getDomainAxisEdge();
    double xx1 = axis.valueToJava2D(x1, dataArea, edge);
    double xx2 = axis.valueToJava2D(x2, dataArea, edge);
    this.maxCandleWidth = Math.abs(xx2 - xx1);
        // Absolute value, since the relative x
        // positions are reversed for horizontal orientation

    // calculate the highest volume in the dataset...
    if (this.drawVolume) {
        OHLCDataset highLowDataset = (OHLCDataset) dataset;
        this.maxVolume = 0.0;
        for (int series = 0; series < highLowDataset.getSeriesCount();
             series++) {
            for (int item = 0; item < highLowDataset.getItemCount(series);
                 item++) {
                double volume = highLowDataset.getVolumeValue(series, item);
                if (volume > this.maxVolume) {
                    this.maxVolume = volume;
                }

            }
        }
    }

    return new XYItemRendererState(info);
}
 
Example 7
Source File: CandlestickRenderer.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Initialises the renderer then returns the number of 'passes' through the
 * data that the renderer will require (usually just one).  This method 
 * will be called before the first item is rendered, giving the renderer 
 * an opportunity to initialise any state information it wants to maintain.
 * The renderer can do nothing if it chooses.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area inside the axes.
 * @param plot  the plot.
 * @param dataset  the data.
 * @param info  an optional info collection object to return data back to 
 *              the caller.
 *
 * @return The number of passes the renderer requires.
 */
public XYItemRendererState initialise(Graphics2D g2,
                                      Rectangle2D dataArea,
                                      XYPlot plot,
                                      XYDataset dataset,
                                      PlotRenderingInfo info) {
      
    // calculate the maximum allowed candle width from the axis...
    ValueAxis axis = plot.getDomainAxis();
    double x1 = axis.getLowerBound();
    double x2 = x1 + this.maxCandleWidthInMilliseconds;
    RectangleEdge edge = plot.getDomainAxisEdge();
    double xx1 = axis.valueToJava2D(x1, dataArea, edge);
    double xx2 = axis.valueToJava2D(x2, dataArea, edge);
    this.maxCandleWidth = Math.abs(xx2 - xx1); 
        // Absolute value, since the relative x 
        // positions are reversed for horizontal orientation
    
    // calculate the highest volume in the dataset... 
    if (this.drawVolume) {
        OHLCDataset highLowDataset = (OHLCDataset) dataset;
        this.maxVolume = 0.0;
        for (int series = 0; series < highLowDataset.getSeriesCount(); 
             series++) {
            for (int item = 0; item < highLowDataset.getItemCount(series); 
                 item++) {
                double volume = highLowDataset.getVolumeValue(series, item);
                if (volume > this.maxVolume) {
                    this.maxVolume = volume;
                }
                
            }    
        }
    }
    
    return new XYItemRendererState(info);
}
 
Example 8
Source File: XYPlot.java    From opensim-gui with Apache License 2.0 5 votes vote down vote up
/**
 * Draws the domain tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 * 
 * @see #setDomainTickBandPaint(Paint)
 */
public void drawDomainTickBands(Graphics2D g2, Rectangle2D dataArea,
                                List ticks) {
    // draw the domain tick bands, if any...
    Paint bandPaint = getDomainTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis xAxis = getDomainAxis();
        double previous = xAxis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = xAxis.getUpperBound();
        if (fillBand) {
            getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea, 
                    previous, end);
        }
    }
}
 
Example 9
Source File: DefaultPolarItemRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Draw the radial gridlines - the rings.
 *
 * @param g2  the drawing surface.
 * @param plot  the plot.
 * @param radialAxis  the radial axis.
 * @param ticks  the ticks.
 * @param dataArea  the data area.
 */
public void drawRadialGridLines(Graphics2D g2,
                                PolarPlot plot,
                                ValueAxis radialAxis,
                                List ticks,
                                Rectangle2D dataArea) {

    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double axisMin = radialAxis.getLowerBound();
    Point center = plot.translateValueThetaRadiusToJava2D(axisMin, axisMin,
            dataArea);

    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        Point p = plot.translateValueThetaRadiusToJava2D(90.0,
                tick.getNumber().doubleValue(), dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
Example 10
Source File: PolarPlot.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Translates a (theta, radius) pair into Java2D coordinates.  If
 * <code>radius</code> is less than the lower bound of the axis, then
 * this method returns the centre point.
 *
 * @param angleDegrees  the angle in degrees.
 * @param radius  the radius.
 * @param axis  the axis.
 * @param dataArea  the data area.
 *
 * @return A point in Java2D space.
 *
 * @since 1.0.14
 */
public Point translateToJava2D(double angleDegrees, double radius,
        ValueAxis axis, Rectangle2D dataArea) {

    if (counterClockwise) {
        angleDegrees = -angleDegrees;
    }
    double radians = Math.toRadians(angleDegrees + this.angleOffset);

    double minx = dataArea.getMinX() + this.margin;
    double maxx = dataArea.getMaxX() - this.margin;
    double miny = dataArea.getMinY() + this.margin;
    double maxy = dataArea.getMaxY() - this.margin;

    double halfWidth = (maxx - minx) / 2.0;
    double halfHeight = (maxy - miny) / 2.0;

    double midX = minx + halfWidth;
    double midY = miny + halfHeight;

    double l = Math.min(halfWidth, halfHeight);
    Rectangle2D quadrant = new Rectangle2D.Double(midX, midY, l, l);

    double axisMin = axis.getLowerBound();
    double adjustedRadius = Math.max(radius, axisMin);

    double length = axis.valueToJava2D(adjustedRadius, quadrant, RectangleEdge.BOTTOM) - midX;
    float x = (float) (midX + Math.cos(radians) * length);
    float y = (float) (midY + Math.sin(radians) * length);

    int ix = Math.round(x);
    int iy = Math.round(y);

    Point p = new Point(ix, iy);
    return p;

}
 
Example 11
Source File: ChartLogics.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Move a chart by a percentage x-offset if xoffset is <0 the shift will be negativ (xoffset>0
 * results in a positive shift)
 * 
 * @param myChart
 * @param xoffset in percent
 * @param autoRangeY if true the range (Y) axis auto bounds will be restored
 */
public static void offsetDomainAxis(ChartPanel myChart, double xoffset, boolean autoRangeY) {
  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ValueAxis domainAxis = plot.getDomainAxis();
  // apply offset on x
  double distance = (domainAxis.getUpperBound() - domainAxis.getLowerBound()) * xoffset;

  Range range =
      new Range(domainAxis.getLowerBound() + distance, domainAxis.getUpperBound() + distance);
  setZoomDomainAxis(myChart, keepRangeWithinAutoBounds(domainAxis, range), autoRangeY);
}
 
Example 12
Source File: PolarPlot.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Translates a (theta, radius) pair into Java2D coordinates.  If
 * <code>radius</code> is less than the lower bound of the axis, then
 * this method returns the centre point.
 *
 * @param angleDegrees  the angle in degrees.
 * @param radius  the radius.
 * @param axis  the axis.
 * @param dataArea  the data area.
 *
 * @return A point in Java2D space.
 *
 * @since 1.0.14
 */
public Point translateToJava2D(double angleDegrees, double radius,
        ValueAxis axis, Rectangle2D dataArea) {

    if (counterClockwise) {
        angleDegrees = -angleDegrees;
    }
    double radians = Math.toRadians(angleDegrees + this.angleOffset);

    double minx = dataArea.getMinX() + this.margin;
    double maxx = dataArea.getMaxX() - this.margin;
    double miny = dataArea.getMinY() + this.margin;
    double maxy = dataArea.getMaxY() - this.margin;

    double halfWidth = (maxx - minx) / 2.0;
    double halfHeight = (maxy - miny) / 2.0;

    double midX = minx + halfWidth;
    double midY = miny + halfHeight;

    double l = Math.min(halfWidth, halfHeight);
    Rectangle2D quadrant = new Rectangle2D.Double(midX, midY, l, l);

    double axisMin = axis.getLowerBound();
    double adjustedRadius = Math.max(radius, axisMin);

    double length = axis.valueToJava2D(adjustedRadius, quadrant, RectangleEdge.BOTTOM) - midX;
    float x = (float) (midX + Math.cos(radians) * length);
    float y = (float) (midY + Math.sin(radians) * length);

    int ix = Math.round(x);
    int iy = Math.round(y);

    Point p = new Point(ix, iy);
    return p;

}
 
Example 13
Source File: ChartLogicsFX.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Move a chart by a percentage x-offset if xoffset is <0 the shift will be negativ (xoffset>0
 * results in a positive shift)
 * 
 * @param myChart
 * @param xoffset in percent
 * @param autoRangeY if true the range (Y) axis auto bounds will be restored
 */
public static void offsetDomainAxis(ChartViewer myChart, double xoffset, boolean autoRangeY) {
  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ValueAxis domainAxis = plot.getDomainAxis();
  // apply offset on x
  double distance = (domainAxis.getUpperBound() - domainAxis.getLowerBound()) * xoffset;

  Range range =
      new Range(domainAxis.getLowerBound() + distance, domainAxis.getUpperBound() + distance);
  setZoomDomainAxis(myChart, keepRangeWithinAutoBounds(domainAxis, range), autoRangeY);
}
 
Example 14
Source File: ChartLogics.java    From old-mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Move a chart by a percentage x-offset if xoffset is <0 the shift will be negativ (xoffset>0
 * results in a positive shift)
 * 
 * @param myChart
 * @param xoffset in percent
 * @param autoRangeY if true the range (Y) axis auto bounds will be restored
 */
public static void offsetDomainAxis(ChartPanel myChart, double xoffset, boolean autoRangeY) {
  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  ValueAxis domainAxis = plot.getDomainAxis();
  // apply offset on x
  double distance = (domainAxis.getUpperBound() - domainAxis.getLowerBound()) * xoffset;

  Range range =
      new Range(domainAxis.getLowerBound() + distance, domainAxis.getUpperBound() + distance);
  setZoomDomainAxis(myChart, keepRangeWithinAutoBounds(domainAxis, range), autoRangeY);
}
 
Example 15
Source File: EHistogramDialog.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * tries to find the next local maximum to jump to the prev peak
 */
private void jumpToPrevPeak() {
  XYPlot plot = getXYPlot();
  if (plot == null)
    return;

  XYDataset data = plot.getDataset(0);
  // get center of zoom
  ValueAxis x = plot.getDomainAxis();
  double mid = (x.getUpperBound() + x.getLowerBound()) / 2;

  boolean started = false;

  for (int i = data.getItemCount(0) - 1; i >= 1; i--) {
    double mz = data.getXValue(0, i);
    if (mz < mid) {
      // wait for y to be 0 to start the search for a new peak
      if (!started) {
        if (data.getYValue(0, i) == 0)
          started = true;
      } else {
        // intensity drops?
        if (data.getYValue(0, i - 1) != 0 && data.getYValue(0, i) >= 100
            && data.getYValue(0, i - 1) < data.getYValue(0, i)) {
          // peak found with max at i
          setZoomAroundPeakAt(i);
          return;
        }
      }
    }
  }
}
 
Example 16
Source File: DefaultValueAxisEditor.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Standard constructor: builds a property panel for the specified axis.
 *
 * @param axis  the axis, which should be changed.
 */
public DefaultValueAxisEditor(ValueAxis axis) {

    super(axis);

    this.autoRange = axis.isAutoRange();
    this.minimumValue = axis.getLowerBound();
    this.maximumValue = axis.getUpperBound();
    this.autoTickUnitSelection = axis.isAutoTickUnitSelection();

    this.gridPaintSample = new PaintSample(Color.blue);
    this.gridStrokeSample = new StrokeSample(new BasicStroke(1.0f));

    this.availableStrokeSamples = new StrokeSample[3];
    this.availableStrokeSamples[0] = new StrokeSample(
            new BasicStroke(1.0f));
    this.availableStrokeSamples[1] = new StrokeSample(
            new BasicStroke(2.0f));
    this.availableStrokeSamples[2] = new StrokeSample(
            new BasicStroke(3.0f));

    JTabbedPane other = getOtherTabs();

    JPanel range = new JPanel(new LCBLayout(3));
    range.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    range.add(new JPanel());
    this.autoRangeCheckBox = new JCheckBox(localizationResources.getString(
            "Auto-adjust_range"), this.autoRange);
    this.autoRangeCheckBox.setActionCommand("AutoRangeOnOff");
    this.autoRangeCheckBox.addActionListener(this);
    range.add(this.autoRangeCheckBox);
    range.add(new JPanel());

    range.add(new JLabel(localizationResources.getString(
            "Minimum_range_value")));
    this.minimumRangeValue = new JTextField(Double.toString(
            this.minimumValue));
    this.minimumRangeValue.setEnabled(!this.autoRange);
    this.minimumRangeValue.setActionCommand("MinimumRange");
    this.minimumRangeValue.addActionListener(this);
    this.minimumRangeValue.addFocusListener(this);
    range.add(this.minimumRangeValue);
    range.add(new JPanel());

    range.add(new JLabel(localizationResources.getString(
            "Maximum_range_value")));
    this.maximumRangeValue = new JTextField(Double.toString(
            this.maximumValue));
    this.maximumRangeValue.setEnabled(!this.autoRange);
    this.maximumRangeValue.setActionCommand("MaximumRange");
    this.maximumRangeValue.addActionListener(this);
    this.maximumRangeValue.addFocusListener(this);
    range.add(this.maximumRangeValue);
    range.add(new JPanel());

    other.add(localizationResources.getString("Range"), range);

    other.add(localizationResources.getString("TickUnit"),
            createTickUnitPanel());
}
 
Example 17
Source File: DefaultValueAxisEditor.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Standard constructor: builds a property panel for the specified axis.
 *
 * @param axis  the axis, which should be changed.
 */
public DefaultValueAxisEditor(ValueAxis axis) {

    super(axis);

    this.autoRange = axis.isAutoRange();
    this.minimumValue = axis.getLowerBound();
    this.maximumValue = axis.getUpperBound();
    this.autoTickUnitSelection = axis.isAutoTickUnitSelection();

    this.gridPaintSample = new PaintSample(Color.blue);
    this.gridStrokeSample = new StrokeSample(new BasicStroke(1.0f));

    this.availableStrokeSamples = new StrokeSample[3];
    this.availableStrokeSamples[0] = new StrokeSample(
            new BasicStroke(1.0f));
    this.availableStrokeSamples[1] = new StrokeSample(
            new BasicStroke(2.0f));
    this.availableStrokeSamples[2] = new StrokeSample(
            new BasicStroke(3.0f));

    JTabbedPane other = getOtherTabs();

    JPanel range = new JPanel(new LCBLayout(3));
    range.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    range.add(new JPanel());
    this.autoRangeCheckBox = new JCheckBox(localizationResources.getString(
            "Auto-adjust_range"), this.autoRange);
    this.autoRangeCheckBox.setActionCommand("AutoRangeOnOff");
    this.autoRangeCheckBox.addActionListener(this);
    range.add(this.autoRangeCheckBox);
    range.add(new JPanel());

    range.add(new JLabel(localizationResources.getString(
            "Minimum_range_value")));
    this.minimumRangeValue = new JTextField(Double.toString(
            this.minimumValue));
    this.minimumRangeValue.setEnabled(!this.autoRange);
    this.minimumRangeValue.setActionCommand("MinimumRange");
    this.minimumRangeValue.addActionListener(this);
    this.minimumRangeValue.addFocusListener(this);
    range.add(this.minimumRangeValue);
    range.add(new JPanel());

    range.add(new JLabel(localizationResources.getString(
            "Maximum_range_value")));
    this.maximumRangeValue = new JTextField(Double.toString(
            this.maximumValue));
    this.maximumRangeValue.setEnabled(!this.autoRange);
    this.maximumRangeValue.setActionCommand("MaximumRange");
    this.maximumRangeValue.addActionListener(this);
    this.maximumRangeValue.addFocusListener(this);
    range.add(this.maximumRangeValue);
    range.add(new JPanel());

    other.add(localizationResources.getString("Range"), range);

    other.add(localizationResources.getString("TickUnit"),
            createTickUnitPanel());
}
 
Example 18
Source File: ChartLogicsFX.java    From mzmine2 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Apply an relative offset to an axis and move it. LowerBound and UpperBound are defined by
 * {@link ValueAxis#getDefaultAutoRange()}
 * 
 * @param myChart
 * @param offset percentage
 */
public static void offsetAxis(ValueAxis axis, double offset) {
  double distance = (axis.getUpperBound() - axis.getLowerBound()) * offset;
  Range range = new Range(axis.getLowerBound() + distance, axis.getUpperBound() + distance);
  setZoomAxis(axis, keepRangeWithinAutoBounds(axis, range));
}
 
Example 19
Source File: ChartLogics.java    From mzmine2 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Apply an absolute offset to an axis and move it
 * 
 * @param myChart
 * @param offset
 */
public static void offsetAxisAbsolute(ValueAxis axis, double offset) {
  Range range = new Range(axis.getLowerBound() + offset, axis.getUpperBound() + offset);
  setZoomAxis(axis, keepRangeWithinAutoBounds(axis, range));
}
 
Example 20
Source File: ChartLogics.java    From old-mzmine3 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Apply an absolute offset to an axis and move it
 * 
 * @param myChart
 * @param offset
 */
public static void offsetAxisAbsolute(ValueAxis axis, double offset) {
  Range range = new Range(axis.getLowerBound() + offset, axis.getUpperBound() + offset);
  setZoomAxis(axis, keepRangeWithinAutoBounds(axis, range));
}