org.jfree.chart.plot.XYPlot.getRangeAxisEdge()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(51)

本文整理了Java中org.jfree.chart.plot.XYPlot.getRangeAxisEdge()方法的一些代码示例,展示了XYPlot.getRangeAxisEdge()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XYPlot.getRangeAxisEdge()方法的具体详情如下:
包路径:org.jfree.chart.plot.XYPlot
类名称:XYPlot
方法名:getRangeAxisEdge

XYPlot.getRangeAxisEdge介绍

[英]Returns the edge for the primary range axis.
[中]返回主范围轴的边。

代码示例

代码示例来源:origin: stackoverflow.com

Point2D p = chartPanel.translateScreenToJava2D(mouseChartEvent.getTrigger().getPoint());
Rectangle2D plotArea = chartPanel.getScreenDataArea();
XYPlot plot = (XYPlot) chart.getPlot(); // your plot
double chartX = plot.getDomainAxis().java2DToValue(p.getX(), plotArea, plot.getDomainAxisEdge());
double chartY = plot.getRangeAxis().java2DToValue(p.getY(), plotArea, plot.getRangeAxisEdge());

代码示例来源:origin: geotools/geotools

public int currentSegment(float[] coords) {
  int i = delegate.currentSegment(coords);
  coords[0] =
      (float)
          domainAxis.valueToJava2D(
              coords[0], dataArea, plot.getDomainAxisEdge());
  coords[1] =
      (float)
          rangeAxis.valueToJava2D(
              coords[1], dataArea, plot.getRangeAxisEdge());
  return i;
}

代码示例来源:origin: geotools/geotools

public int currentSegment(double[] coords) {
  int i = delegate.currentSegment(coords);
  coords[0] = domainAxis.valueToJava2D(coords[0], dataArea, plot.getDomainAxisEdge());
  coords[1] = rangeAxis.valueToJava2D(coords[1], dataArea, plot.getRangeAxisEdge());
  return i;
}

代码示例来源:origin: geotools/geotools

void drawCoordinate(
    Coordinate c,
    Graphics2D g2,
    int series,
    int item,
    Rectangle2D dataArea,
    XYPlot plot,
    ValueAxis domainAxis,
    ValueAxis rangeAxis) {
  double tx = domainAxis.valueToJava2D(c.x, dataArea, plot.getDomainAxisEdge());
  double ty = rangeAxis.valueToJava2D(c.y, dataArea, plot.getRangeAxisEdge());
  Shape shape = getItemShape(series, item);
  shape = ShapeUtilities.createTranslatedShape(shape, tx, ty);
  if (fillCoordinates) {
    g2.fill(shape);
  } else {
    g2.draw(shape);
  }
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

plot.getRangeAxisEdge());
double y2 = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
Rectangle2D band;
if (plot.getOrientation() == PlotOrientation.VERTICAL) {

代码示例来源:origin: jfree/jfreechart

plot.getRangeAxisEdge());
double y2 = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
Rectangle2D band;
if (plot.getOrientation() == PlotOrientation.VERTICAL) {

代码示例来源:origin: org.geotools/gt-charts

public int currentSegment(double[] coords) {
  int i = delegate.currentSegment(coords);
  coords[0] = domainAxis.valueToJava2D(coords[0], dataArea, plot.getDomainAxisEdge());
  coords[1] = rangeAxis.valueToJava2D(coords[1], dataArea, plot.getRangeAxisEdge());
  return i;
}

代码示例来源:origin: org.geotools/gt-charts

public int currentSegment(float[] coords) {
  int i = delegate.currentSegment(coords);
  coords[0] = (float) domainAxis.valueToJava2D(coords[0], dataArea, plot.getDomainAxisEdge());
  coords[1] = (float) rangeAxis.valueToJava2D(coords[1], dataArea, plot.getRangeAxisEdge());
  return i;
}

代码示例来源:origin: sc.fiji/TrackMate_

@Override
public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
    ValueAxis domainAxis, ValueAxis rangeAxis, int rendererIndex,
    PlotRenderingInfo info) {
  
  Rectangle2D box = chartPanel.getScreenDataArea();
  float sx = (float) plot.getDomainAxis().valueToJava2D(x, box, plot.getDomainAxisEdge());
  float maxXLim = (float) box.getWidth() - g2.getFontMetrics().stringWidth(text); 
  if (sx > maxXLim) {
    sx = maxXLim;
  }
  if (sx < box.getMinX()) {
    sx = (float) box.getMinX();
  }
  
  float sy = (float) plot.getRangeAxis().valueToJava2D(y, chartPanel.getScreenDataArea(), plot.getRangeAxisEdge());
  g2.setTransform(new AffineTransform());
  g2.setColor(color);
  g2.setFont(font);
  g2.drawString(text, sx, sy);
}

代码示例来源:origin: fiji/TrackMate

@Override
public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
    ValueAxis domainAxis, ValueAxis rangeAxis, int rendererIndex,
    PlotRenderingInfo info) {
  
  Rectangle2D box = chartPanel.getScreenDataArea();
  float sx = (float) plot.getDomainAxis().valueToJava2D(x, box, plot.getDomainAxisEdge());
  float maxXLim = (float) box.getWidth() - g2.getFontMetrics().stringWidth(text); 
  if (sx > maxXLim) {
    sx = maxXLim;
  }
  if (sx < box.getMinX()) {
    sx = (float) box.getMinX();
  }
  
  float sy = (float) plot.getRangeAxis().valueToJava2D(y, chartPanel.getScreenDataArea(), plot.getRangeAxisEdge());
  g2.setTransform(new AffineTransform());
  g2.setColor(color);
  g2.setFont(font);
  g2.drawString(text, sx, sy);
}

代码示例来源:origin: stackoverflow.com

JFreeChart chart = functionWhichRetrievesTheChart();
ChartRenderingInfo info = new ChartRenderingInfo();
// PLOT_SIZE is the size if the graph and has to be the same size as the original drawn chart.createBufferedImage(PLOT_SIZE, PLOT_SIZE, info); 
graph, otherwise the pixel position points to somewhere else
PlotRenderingInfo plotInfo = info.getPlotInfo();

XYPlot plot = (XYPlot)chart.getPlot();
Point p = new Point(x,y); // x and y are the pixel positions

// this is the domain value which belongs to the pixel position x
double domain = plot.getDomainAxis().java2DToValue(p.getX(), plotInfo.getDataArea(), plot.getDomainAxisEdge()); 

// this is the range value which belongs to the pixel position y
double range = plot.getRangeAxis().java2DToValue(p.getY(), plotInfo.getDataArea(), plot.getRangeAxisEdge());

代码示例来源:origin: stackoverflow.com

final XYPlot plot = getChart().getXYPlot();
final ValueAxis domainAxis = plot.getDomainAxis();
final ValueAxis rangeAxis = plot.getRangeAxis();
final Rectangle2D plotRectangle = SWTUtils.toAwtRectangle(getScreenDataArea());
final double chartX = domainAxis.java2DToValue(relativeX, plotRectangle, plot.getDomainAxisEdge());
final double chartY = rangeAxis.java2DToValue(relativeY, plotRectangle, plot.getRangeAxisEdge());

代码示例来源:origin: org.geotools/gt-charts

void drawCoordinate(Coordinate c, Graphics2D g2, int series, int item, Rectangle2D dataArea, 
  XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis) {
  
  double tx = domainAxis.valueToJava2D(c.x, dataArea, plot.getDomainAxisEdge());
  double ty = rangeAxis.valueToJava2D(c.y, dataArea, plot.getRangeAxisEdge());
  
  Shape shape = getItemShape(series, item);
  shape = ShapeUtilities.createTranslatedShape(shape, tx, ty);
  
  if (fillCoordinates) {
    g2.fill(shape);
  }
  else {
    g2.draw(shape);
  }
}

代码示例来源:origin: jfree/jfreechart

info.getDataArea(), getRangeAxisEdge());
  yAxis.resizeRange2(factor, anchorY);
} else {

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

/**
 * Returns the edge for a range axis.
 *
 * @param index  the axis index.
 *
 * @return The edge.
 *
 * @see #getRangeAxisLocation(int)
 * @see #getOrientation()
 */
public RectangleEdge getRangeAxisEdge(int index) {
  AxisLocation location = getRangeAxisLocation(index);
  RectangleEdge result = Plot.resolveRangeAxisLocation(location,
      this.orientation);
  if (result == null) {
    result = RectangleEdge.opposite(getRangeAxisEdge());
  }
  return result;
}

代码示例来源:origin: stackoverflow.com

JFreeChart chart = yourChart;
Rectangle2D greyChartArea = chartPanel.getChartRenderingInfo().getPlotInfo().getDataArea();
XYPlot plot = (XYPlot) chart.getPlot();

double valueX = ((NumberAxis) plot.getRangeAxis()).java2DToValue(chartY,plot.getRangeAxisEdge();
double valueY = ((NumberAxis) plot.getDomainAxis()).java2DToValue(chartX,plot.getDomainAxisEdge();

代码示例来源:origin: jfree/jfreechart

/**
 * Initialises the renderer and returns a state object that should be
 * passed to all subsequent calls to the drawItem() method.  Here we
 * calculate the Java2D y-coordinate for zero, since all the bars have
 * their bases fixed at zero.
 *
 * @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 A state object.
 */
@Override
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea,
    XYPlot plot, XYDataset dataset, PlotRenderingInfo info) {
  XYBarRendererState state = new XYBarRendererState(info);
  ValueAxis rangeAxis = plot.getRangeAxisForDataset(plot.indexOf(
      dataset));
  state.setG2Base(rangeAxis.valueToJava2D(this.base, dataArea,
      plot.getRangeAxisEdge()));
  return state;
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

/**
 * Initialises the renderer and returns a state object that should be
 * passed to all subsequent calls to the drawItem() method.  Here we
 * calculate the Java2D y-coordinate for zero, since all the bars have
 * their bases fixed at zero.
 *
 * @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 A state object.
 */
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea,
    XYPlot plot, XYDataset dataset, PlotRenderingInfo info) {
  XYBarRendererState state = new XYBarRendererState(info);
  ValueAxis rangeAxis = plot.getRangeAxisForDataset(plot.indexOf(
      dataset));
  state.setG2Base(rangeAxis.valueToJava2D(this.base, dataArea,
      plot.getRangeAxisEdge()));
  return state;
}

代码示例来源:origin: jfree/jfreechart

/**
 * Handles a 'click' on the plot by updating the anchor values.
 *
 * @param x  the x-coordinate, where the click occurred, in Java2D space.
 * @param y  the y-coordinate, where the click occurred, in Java2D space.
 * @param info  object containing information about the plot dimensions.
 */
@Override
public void handleClick(int x, int y, PlotRenderingInfo info) {
  Rectangle2D dataArea = info.getDataArea();
  if (dataArea.contains(x, y)) {
    // set the anchor value for the horizontal axis...
    ValueAxis xaxis = getDomainAxis();
    if (xaxis != null) {
      double hvalue = xaxis.java2DToValue(x, info.getDataArea(),
          getDomainAxisEdge());
      setDomainCrosshairValue(hvalue);
    }
    // set the anchor value for the vertical axis...
    ValueAxis yaxis = getRangeAxis();
    if (yaxis != null) {
      double vvalue = yaxis.java2DToValue(y, info.getDataArea(),
          getRangeAxisEdge());
      setRangeCrosshairValue(vvalue);
    }
  }
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-chart

/**
 * Handles a 'click' on the plot by updating the anchor values.
 *
 * @param x  the x-coordinate, where the click occurred, in Java2D space.
 * @param y  the y-coordinate, where the click occurred, in Java2D space.
 * @param info  object containing information about the plot dimensions.
 */
public void handleClick(int x, int y, PlotRenderingInfo info) {
  Rectangle2D dataArea = info.getDataArea();
  if (dataArea.contains(x, y)) {
    // set the anchor value for the horizontal axis...
    ValueAxis xaxis = getDomainAxis();
    if (xaxis != null) {
      double hvalue = xaxis.java2DToValue(x, info.getDataArea(),
          getDomainAxisEdge());
      setDomainCrosshairValue(hvalue);
    }
    // set the anchor value for the vertical axis...
    ValueAxis yaxis = getRangeAxis();
    if (yaxis != null) {
      double vvalue = yaxis.java2DToValue(y, info.getDataArea(),
          getRangeAxisEdge());
      setRangeCrosshairValue(vvalue);
    }
  }
}

相关文章

微信公众号

最新文章

更多

XYPlot类方法