本文整理了Java中org.jfree.chart.plot.XYPlot.getDomainAxisEdge()
方法的一些代码示例,展示了XYPlot.getDomainAxisEdge()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XYPlot.getDomainAxisEdge()
方法的具体详情如下:
包路径:org.jfree.chart.plot.XYPlot
类名称:XYPlot
方法名:getDomainAxisEdge
[英]Returns the edge for the primary domain axis (taking into account the plot's orientation).
[中]返回主域轴的边(考虑绘图的方向)。
代码示例来源: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: sc.fiji/TrackMate_
private double getXFromChartEvent( final MouseEvent mouseEvent )
{
final Rectangle2D plotArea = chartPanel.getScreenDataArea();
return plot.getDomainAxis().java2DToValue( mouseEvent.getX(), plotArea, plot.getDomainAxisEdge() );
}
代码示例来源: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: fiji/TrackMate
private double getXFromChartEvent( final MouseEvent mouseEvent )
{
final Rectangle2D plotArea = chartPanel.getScreenDataArea();
return plot.getDomainAxis().java2DToValue( mouseEvent.getX(), plotArea, plot.getDomainAxisEdge() );
}
代码示例来源: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: GrammarViz2/grammarviz2_src
private Double getPosition(MouseEvent e) {
// System.err.println("Event position " + e.getX() + ", " + e.getY());
Point2D p = panel.translateScreenToJava2D(e.getPoint());
Rectangle2D plotArea = panel.getScreenDataArea();
XYPlot plot = (XYPlot) chart.getPlot();
return plot.getDomainAxis().java2DToValue(p.getX(), plotArea, plot.getDomainAxisEdge());
}
代码示例来源: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: net.preibisch/multiview-reconstruction
public static int getChartXLocation( final Point point, final ChartPanel panel )
{
final Point2D p = panel.translateScreenToJava2D( point );
final Rectangle2D plotArea = panel.getScreenDataArea();
final XYPlot plot = (XYPlot) panel.getChart().getPlot();
final double chartX = plot.getDomainAxis().java2DToValue( p.getX(), plotArea, plot.getDomainAxisEdge() );
//final double chartY = plot.getRangeAxis().java2DToValue( p.getY(), plotArea, plot.getRangeAxisEdge() );
return (int)Math.round( chartX );
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
public static int getChartXLocation( final Point point, final ChartPanel panel )
{
final Point2D p = panel.translateScreenToJava2D( point );
final Rectangle2D plotArea = panel.getScreenDataArea();
final XYPlot plot = (XYPlot) panel.getChart().getPlot();
final double chartX = plot.getDomainAxis().java2DToValue( p.getX(), plotArea, plot.getDomainAxisEdge() );
//final double chartY = plot.getRangeAxis().java2DToValue( p.getY(), plotArea, plot.getRangeAxisEdge() );
return (int)Math.round( chartX );
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Returns the edge for a domain axis.
*
* @param index the axis index.
*
* @return The edge.
*
* @see #getRangeAxisEdge(int)
*/
public RectangleEdge getDomainAxisEdge(int index) {
AxisLocation location = getDomainAxisLocation(index);
RectangleEdge result = Plot.resolveDomainAxisLocation(location,
this.orientation);
if (result == null) {
result = RectangleEdge.opposite(getDomainAxisEdge());
}
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
/**
* 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);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!