本文整理汇总了Java中de.erichseifert.gral.plots.axes.LinearRenderer2D类的典型用法代码示例。如果您正苦于以下问题:Java LinearRenderer2D类的具体用法?Java LinearRenderer2D怎么用?Java LinearRenderer2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinearRenderer2D类属于de.erichseifert.gral.plots.axes包,在下文中一共展示了LinearRenderer2D类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureScatterAxis
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
private void configureScatterAxis(boolean showLog) {
sanityCheckGuiThread();
XYPlot plot = overviewPlot;
if( showLog ) {
plot.setAxisRenderer(XYPlot.AXIS_X,new LogarithmicRenderer2D());
plot.setAxisRenderer(XYPlot.AXIS_Y,new LogarithmicRenderer2D());
} else {
plot.setAxisRenderer(XYPlot.AXIS_X,new LinearRenderer2D());
plot.setAxisRenderer(XYPlot.AXIS_Y,new LinearRenderer2D());
}
plot.getAxisRenderer(XYPlot.AXIS_X).setTickLabelFormat(new DecimalFormat("0.##E0"));
plot.getAxisRenderer(XYPlot.AXIS_Y).setTickLabelFormat(new DecimalFormat("0.##E0"));
plot.getAxisRenderer(XYPlot.AXIS_X).setTickLabelRotation(60);
plot.getAxisRenderer(XYPlot.AXIS_Y).setTickLabelRotation(60);
plot.getAxisRenderer(XYPlot.AXIS_X).setTickAlignment(1.25);
plot.getAxisRenderer(XYPlot.AXIS_Y).setTickAlignment(1.5);
plot.getAxisRenderer(XYPlot.AXIS_X).getLabel().setText(param0);
plot.getAxisRenderer(XYPlot.AXIS_Y).getLabel().setText(param1);
plot.getAxisRenderer(XYPlot.AXIS_X).setLabelDistance(2);
plot.getAxisRenderer(XYPlot.AXIS_Y).setLabelDistance(2);
}
示例2: setUpBeforeClass
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
@BeforeClass
@SuppressWarnings("unchecked")
public static void setUpBeforeClass() {
table = new DataTable(Integer.class, Integer.class, Integer.class);
table.add(1, 3, 1); // 0
table.add(2, 5, 2); // 1
table.add(3, 2, -1); // 2
table.add(4, 1, 0); // 3
table.add(5, 4, null); // 4
row = new Row(table, 0);
axis = new Axis(-1.0, 1.0);
axisRenderer = new LinearRenderer2D();
axisRenderer.setShape(new Line2D.Double(-5.0, 0.0, 5.0, 0.0));
data = new PointData(
Arrays.asList(null, axis),
Arrays.asList(null, axisRenderer),
row, row.getIndex(), 0);
shape = new Rectangle2D.Double(-5.0, -5.0, 10.0, 10.0);
}
示例3: setUpBeforeClass
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
@BeforeClass
@SuppressWarnings("unchecked")
public static void setUpBeforeClass() {
table = new DataTable(Integer.class, String.class);
table.add(1, "Jan"); // 0
table.add(2, "Feb"); // 1
table.add(3, "Mar"); // 2
table.add(4, "Apr"); // 3
table.add(5, "May"); // 4
table.add(6, "Jun"); // 5
table.add(7, "Jul"); // 6
table.add(8, "Aug"); // 7
row = new Row(table, 4);
axis = new Axis(0.0, 10.0);
axisRenderer = new LinearRenderer2D();
axisRenderer.setShape(new Line2D.Double(-5.0, 0.0, 5.0, 0.0));
data = new PointData(
Arrays.asList(null, axis),
Arrays.asList(null, axisRenderer),
row, row.getIndex(), 0);
}
示例4: setUpBeforeClass
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
@BeforeClass
@SuppressWarnings("unchecked")
public static void setUpBeforeClass() {
table = new DataTable(Integer.class, Integer.class, String.class);
table.add(1, 9, "Jan"); // 0
table.add(2, 8, "Feb"); // 1
table.add(3, 7, "Mar"); // 2
table.add(4, 6, "Apr"); // 3
table.add(5, 5, "May"); // 4
table.add(6, 4, "Jun"); // 5
table.add(7, 3, "Jul"); // 6
table.add(8, 1, "Aug"); // 7
row = new Row(table, 4);
axis = new Axis(0.0, 10.0);
axisRenderer = new LinearRenderer2D();
axisRenderer.setShape(new Line2D.Double(-5.0, 0.0, 5.0, 0.0));
data = new PointData(
Arrays.asList(null, axis),
Arrays.asList(null, axisRenderer),
row, row.getIndex(), 0);
}
示例5: createDefaultAxisRenderers
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
@Override
protected void createDefaultAxisRenderers() {
// Create renderers for x and y axes by default
AxisRenderer axisXRenderer = new LinearRenderer2D();
AxisRenderer axisYRenderer = new LinearRenderer2D();
setAxisRenderer(AXIS_X, axisXRenderer);
setAxisRenderer(AXIS_Y, axisYRenderer);
}
示例6: createDefaultAxisRenderers
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
@Override
protected void createDefaultAxisRenderers() {
// Create a linear renderer for the pie slices by default
AxisRenderer renderer = new LinearRenderer2D();
// Create a circle with radius 1.0 as shape for the axis
Shape shape = new Ellipse2D.Double(-1.0, -1.0, 2.0, 2.0);
renderer.setShape(shape);
// Don't show axis
renderer.setShapeVisible(false);
setAxisRenderer(AXIS_TANGENTIAL, renderer);
}
示例7: setUp
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
@Before
public void setUp() {
Axis axisX = new Axis(-5.0, 5.0);
Axis axisY = new Axis(-5.0, 5.0);
AxisRenderer axisRendererX = new LinearRenderer2D();
AxisRenderer axisRendererY = new LinearRenderer2D();
data = new PointData(
Arrays.asList(axisX, axisY),
Arrays.asList(axisRendererX, axisRendererY),
null, 0, 0);
}
示例8: testDraw
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
@Test
public void testDraw() {
AxisRenderer axisRenderer = new LinearRenderer2D();
// Get point
Drawable point = r.getPoint(data, r.getPointShape(data));
assertNotNull(point);
// Draw point
BufferedImage image = createTestImage();
DrawingContext context = new DrawingContext((Graphics2D) image.getGraphics());
layout(image, axisRenderer);
point.draw(context);
assertNotEmpty(image);
}
示例9: setUpBeforeClass
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
@BeforeClass
@SuppressWarnings("unchecked")
public static void setUpBeforeClass() {
table = new DataTable(Integer.class, Integer.class, Integer.class);
table.add(1, 3, 1); // 0
table.add(2, null, 2); // 1
row = new Row(table, 0);
axis = new Axis(-1.0, 1.0);
axisRenderer = new LinearRenderer2D();
axisRenderer.setShape(new Line2D.Double(-5.0, 0.0, 5.0, 0.0));
data = new PointData(Arrays.asList(axis), Arrays.asList(axisRenderer), row, row.getIndex(), 0);
}
示例10: createDefaultAxisRenderers
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
@Override
protected void createDefaultAxisRenderers() {
// Create a linear renderer for the pie slices by default
AxisRenderer renderer = new LinearRenderer2D();
// Create a circle with radius 1.0 as shape for the axis
Shape shape = new Ellipse2D.Double(-1.0, -1.0, 2.0, 2.0);
renderer.setSetting(AxisRenderer.SHAPE, shape);
// Don't show axis
renderer.setSetting(AxisRenderer.SHAPE_VISIBLE, false);
setAxisRenderer(AXIS_TANGENTIAL, renderer);
}
示例11: getSymbol
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
/**
* Returns a symbol for rendering a legend item.
* @param row Data row.
* @return A drawable object that can be used to display the symbol.
*/
public Drawable getSymbol(final Row row) {
return new AbstractSymbol(this) {
/** Version id for serialization. */
private static final long serialVersionUID = 5744026898590787285L;
public void draw(DrawingContext context) {
DataSource data = row.getSource();
Row symbolRow = new Row(DUMMY_DATA, row.getIndex());
Rectangle2D bounds = getBounds();
Number barWidthRelObj = plot.<Number>getSetting(BarPlot.BAR_WIDTH);
double barWidthRel = 1.0;
if (barWidthRelObj != null) {
barWidthRel = barWidthRelObj.doubleValue();
}
Axis axisX = new Axis(0.5 - barWidthRel/2.0, 0.5 + barWidthRel/2.0);
AxisRenderer axisRendererX = new LinearRenderer2D();
axisRendererX.setSetting(LinearRenderer2D.SHAPE, new Line2D.Double(
bounds.getMinX(), bounds.getMaxY(),
bounds.getMaxX(), bounds.getMaxY()));
Axis axisY = new Axis(0.0, 0.5);
AxisRenderer axisRendererY = new LinearRenderer2D();
axisRendererY.setSetting(LinearRenderer2D.SHAPE, new Line2D.Double(
bounds.getMinX(), bounds.getMaxY(),
bounds.getMinX(), bounds.getMinY()));
PointData pointData = new PointData(
Arrays.asList(axisX, axisY),
Arrays.asList(axisRendererX, axisRendererY),
symbolRow, 0);
PointRenderer pointRenderer = plot.getPointRenderer(data);
Shape shape = null;
Drawable drawable = null;
if (pointRenderer != null) {
shape = pointRenderer.getPointShape(pointData);
drawable = pointRenderer.getPoint(pointData, shape);
}
DataPoint point = new DataPoint(pointData,
new PointND<Double>(bounds.getCenterX(),
bounds.getMinY()), drawable, shape);
Graphics2D graphics = context.getGraphics();
Point2D pos = point.position.getPoint2D();
AffineTransform txOrig = graphics.getTransform();
graphics.translate(pos.getX(), pos.getY());
point.drawable.draw(context);
graphics.setTransform(txOrig);
}
};
}
示例12: getSymbol
import de.erichseifert.gral.plots.axes.LinearRenderer2D; //导入依赖的package包/类
/**
* Returns a symbol for rendering a legend item.
* @param row Data row.
* @return A drawable object that can be used to display the symbol.
*/
public Drawable getSymbol(final Row row) {
return new AbstractSymbol(this) {
/** Version id for serialization. */
private static final long serialVersionUID = 1906894939358065143L;
/**
* Draws the {@code Drawable} with the specified drawing context.
* @param context Environment used for drawing
*/
public void draw(DrawingContext context) {
DataSource data = row.getSource();
PointRenderer pointRenderer = plot.getPointRenderer(data);
if (pointRenderer == null) {
return;
}
Row symbolRow = new Row(DUMMY_DATA, row.getIndex());
Rectangle2D bounds = getBounds();
Number boxWidthRelObj = pointRenderer.<Number>getSetting(
BoxWhiskerRenderer.BOX_WIDTH);
double boxWidthRel = 1.0;
if (boxWidthRelObj != null) {
boxWidthRel = boxWidthRelObj.doubleValue();
}
double posX = ((Number) row.get(0)).doubleValue();
Axis axisX = new Axis(posX - boxWidthRel/2.0, posX + boxWidthRel/2.0);
AxisRenderer axisRendererX = new LinearRenderer2D();
axisRendererX.setSetting(LinearRenderer2D.SHAPE, new Line2D.Double(
bounds.getMinX(), bounds.getMaxY(),
bounds.getMaxX(), bounds.getMaxY()));
Axis axisY = new Axis(1.0, 2.0);
AxisRenderer axisRendererY = new LinearRenderer2D();
axisRendererY.setSetting(LinearRenderer2D.SHAPE, new Line2D.Double(
bounds.getMinX(), bounds.getMaxY(),
bounds.getMinX(), bounds.getMinY()));
PointData pointData = new PointData(
Arrays.asList(axisX, axisY),
Arrays.asList(axisRendererX, axisRendererY),
symbolRow, 0);
Shape shape = pointRenderer.getPointShape(pointData);
Drawable drawable = pointRenderer.getPoint(pointData, shape);
DataPoint point = new DataPoint(pointData,
new PointND<Double>(bounds.getCenterX(),
bounds.getCenterY()), drawable, shape);
Graphics2D graphics = context.getGraphics();
graphics.draw(bounds);
Point2D pos = point.position.getPoint2D();
AffineTransform txOrig = graphics.getTransform();
graphics.translate(pos.getX(), pos.getY());
point.drawable.draw(context);
graphics.setTransform(txOrig);
}
};
}