本文整理汇总了Java中de.erichseifert.gral.plots.axes.AxisRenderer类的典型用法代码示例。如果您正苦于以下问题:Java AxisRenderer类的具体用法?Java AxisRenderer怎么用?Java AxisRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AxisRenderer类属于de.erichseifert.gral.plots.axes包,在下文中一共展示了AxisRenderer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setDefaultState
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
/**
* Sets the current state as the default state of the object.
* Resetting the navigator will then return to the default state.
*/
public void setDefaultState() {
infos.clear();
for (String axisName : getAxes()) {
Axis axis = getPlot().getAxis(axisName);
if (axis == null) {
continue;
}
double min;
double max;
Number center = 0.0;
AxisRenderer renderer = getPlot().getAxisRenderer(axisName);
if (renderer != null && axis.isValid()) {
min = renderer.worldToView(axis, axis.getMin(), false);
max = renderer.worldToView(axis, axis.getMax(), false);
if (MathUtils.isCalculatable(min) && MathUtils.isCalculatable(max)) {
center = renderer.viewToWorld(axis, (min + max)/2.0, false);
}
}
NavigationInfo info = new NavigationInfo(
axis.getMin(), axis.getMax(), center.doubleValue());
infos.put(axisName, info);
}
}
开发者ID:eseifert,项目名称:gral,代码行数:28,代码来源:PlotNavigator.java
示例2: layoutAxisShape
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
private void layoutAxisShape(String axisName, Orientation orientation) {
Rectangle2D plotBounds = getPlotArea().getBounds();
Drawable comp = getAxisComponent(axisName);
AxisRenderer renderer = getAxisRenderer(axisName);
if (comp == null || renderer == null) {
return;
}
Dimension2D size = comp.getPreferredSize();
Shape shape;
if (orientation == Orientation.HORIZONTAL) {
shape = new Line2D.Double(
0.0, 0.0,
plotBounds.getWidth(), 0.0
);
} else {
shape = new Line2D.Double(
size.getWidth(), plotBounds.getHeight(),
size.getWidth(), 0.0
);
}
renderer.setShape(shape);
}
开发者ID:eseifert,项目名称:gral,代码行数:27,代码来源:XYPlot.java
示例3: draw
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
@Override
public void draw(DrawingContext context) {
Rectangle2D bounds = getBounds();
Shape shape = new Rectangle2D.Double(
0.0, 0.0, bounds.getWidth(), bounds.getHeight());
PointData pointData = new PointData(
asList((Axis) null),
asList((AxisRenderer) null),
row, row.getIndex(), 0);
Drawable drawable = pointRenderer.getPoint(pointData, shape);
Graphics2D graphics = context.getGraphics();
AffineTransform txOrig = graphics.getTransform();
graphics.translate(bounds.getX(), bounds.getY());
drawable.draw(context);
graphics.setTransform(txOrig);
}
开发者ID:eseifert,项目名称:gral,代码行数:21,代码来源:PiePlot.java
示例4: setStart
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
/**
* Sets the starting angle of the first segment. The angle is always
* applied counterclockwise.
* @param start Starting angle of the first segment in degrees.
*/
public void setStart(double start) {
double startOld = this.start;
this.start = start;
AxisRenderer axisRenderer = getAxisRenderer(PiePlot.AXIS_TANGENTIAL);
if (axisRenderer != null) {
Shape shape = axisRenderer.getShape();
if (shape != null) {
double delta = Math.toRadians(startOld - start);
AffineTransform tx = AffineTransform.getRotateInstance(delta);
shape = tx.createTransformedShape(shape);
axisRenderer.setShape(shape);
}
}
}
开发者ID:eseifert,项目名称:gral,代码行数:22,代码来源:PiePlot.java
示例5: testNullRenderer
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
@Test
public void testNullRenderer() {
PointData data2 = new PointData(
data.axes,
Arrays.asList((AxisRenderer) null, null),
null, 0, 0);
// Get area
AreaRenderer r = new DefaultAreaRenderer2D();
List<DataPoint> points = Arrays.asList(
new DataPoint(data2, new PointND<>(0.0, 0.0)),
new DataPoint(data2, new PointND<>(1.0, 1.0))
);
Shape shape = r.getAreaShape(points);
Drawable area = r.getArea(points, shape);
assertNotNull(area);
// Draw area
BufferedImage image = createTestImage();
DrawingContext context = new DrawingContext((Graphics2D) image.getGraphics());
area.draw(context);
assertEmpty(image);
}
开发者ID:eseifert,项目名称:gral,代码行数:24,代码来源:DefaultAreaRendererTest.java
示例6: testPunch
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
@Test
public void testPunch() {
XYPlot plot = new XYPlot();
Axis axisX = plot.getAxis(XYPlot.AXIS_X);
Axis axisY = plot.getAxis(XYPlot.AXIS_Y);
AxisRenderer axisRendererX = plot.getAxisRenderer(XYPlot.AXIS_X);
AxisRenderer axisRendererY = plot.getAxisRenderer(XYPlot.AXIS_Y);
PointData data = new PointData(
Arrays.asList(axisX, axisY),
Arrays.asList(axisRendererX, axisRendererY),
null, 0, 0);
Shape line = new Line2D.Double(-1.0, -1.0, 2.0, 2.0);
List<DataPoint> points = Arrays.asList(
new DataPoint(data, new PointND<>(0.0, 0.0)),
new DataPoint(data, new PointND<>(1.0, 1.0))
);
XYPlotArea2D plotArea = (XYPlotArea2D) plot.getPlotArea();
Shape punchShape = new Ellipse2D.Double(-0.25, -0.25, 0.50, 0.50);
Shape punched = plotArea.punch(line, points, Arrays.asList(punchShape, punchShape), 1.0, false);
assertNotSame(line, punched);
}
开发者ID:eseifert,项目名称:gral,代码行数:25,代码来源:XYPlotTest.java
示例7: initPanel
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
/**
* Initializes the real time
*/
private void initPanel() {
plot.setInsets(new Insets2D.Double(20.0, 60.0, 10.0, 40.0));
plot.setSetting(BarPlot.TITLE, title);
plot.getAxisRenderer(XYPlot.AXIS_X).setSetting(AxisRenderer.LABEL,
xTitle);
plot.getAxisRenderer(XYPlot.AXIS_X).setSetting(
AxisRenderer.TICK_LABELS_ROTATION, 45.0);
plot.getAxisRenderer(XYPlot.AXIS_Y).setSetting(AxisRenderer.LABEL,
yTitle);
plot.getAxisRenderer(XYPlot.AXIS_X).setSetting(AxisRenderer.INTERSECTION,
-Double.MAX_VALUE);
plot.getAxisRenderer(XYPlot.AXIS_Y).setSetting(AxisRenderer.INTERSECTION,
-Double.MAX_VALUE);
plot.getAxisRenderer(XYPlot.AXIS_Y).setSetting(
AxisRenderer.TICKS_SPACING, yGap);
plot.getAxis(XYPlot.AXIS_Y).setRange(0, yMax);
plot.setLineRenderer(data, lines);
this.add(panel, BorderLayout.CENTER);
}
开发者ID:anthonyjchriste,项目名称:knowledge-is-power,代码行数:24,代码来源:RealTimePlot.java
示例8: setDefaultState
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
/**
* Sets the current state as the default state of the object.
* Resetting the navigator will then return to the default state.
*/
public void setDefaultState() {
infos.clear();
for (String axisName : getAxes()) {
Axis axis = getPlot().getAxis(axisName);
if (axis == null) {
continue;
}
double min = 0.0;
double max = 0.0;
Number center = 0.0;
AxisRenderer renderer = getPlot().getAxisRenderer(axisName);
if (renderer != null && axis.isValid()) {
min = renderer.worldToView(axis, axis.getMin(), false);
max = renderer.worldToView(axis, axis.getMax(), false);
if (MathUtils.isCalculatable(min) && MathUtils.isCalculatable(max)) {
center = renderer.viewToWorld(axis, (min + max)/2.0, false);
}
}
NavigationInfo info = new NavigationInfo(
axis.getMin(), axis.getMax(), center.doubleValue());
infos.put(axisName, info);
}
}
开发者ID:charles-cooper,项目名称:idylfin,代码行数:28,代码来源:PlotNavigator.java
示例9: layoutAxisShape
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
private void layoutAxisShape(String axisName, Orientation orientation) {
Rectangle2D plotBounds = getPlotArea().getBounds();
Drawable comp = getAxisComponent(axisName);
AxisRenderer renderer = getAxisRenderer(axisName);
if (comp == null || renderer == null) {
return;
}
Dimension2D size = comp.getPreferredSize();
Shape shape;
if (orientation == Orientation.HORIZONTAL) {
shape = new Line2D.Double(
0.0, 0.0,
plotBounds.getWidth(), 0.0
);
} else {
shape = new Line2D.Double(
size.getWidth(), plotBounds.getHeight(),
size.getWidth(), 0.0
);
}
renderer.setSetting(AxisRenderer.SHAPE, shape);
}
开发者ID:charles-cooper,项目名称:idylfin,代码行数:27,代码来源:XYPlot.java
示例10: settingChanged
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
@Override
public void settingChanged(SettingChangeEvent event) {
super.settingChanged(event);
Key key = event.getKey();
AxisRenderer axisRenderer = getAxisRenderer(PiePlot.AXIS_TANGENTIAL);
if ((START.equals(key) || CLOCKWISE.equals(key)) && axisRenderer != null) {
Shape shape = axisRenderer.<Shape>getSetting(AxisRenderer.SHAPE);
if (shape != null) {
if (START.equals(key) && event.getValOld() != null) {
double startOld = ((Number) event.getValOld()).doubleValue();
double startNew = ((Number) event.getValNew()).doubleValue();
double delta = Math.toRadians(startOld - startNew);
AffineTransform tx = AffineTransform.getRotateInstance(delta);
shape = tx.createTransformedShape(shape);
axisRenderer.setSetting(AxisRenderer.SHAPE, shape);
} else if (CLOCKWISE.equals(key)) {
shape = GeometryUtils.reverse(shape);
axisRenderer.setSetting(AxisRenderer.SHAPE, shape);
}
}
}
}
开发者ID:charles-cooper,项目名称:idylfin,代码行数:25,代码来源:PiePlot.java
示例11: RasterPlot
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
/**
* Initializes a new box-and-whisker plot with the specified data source.
* @param data Data to be displayed.
*/
public RasterPlot(DataSource data) {
setSettingDefault(OFFSET, new Point2D.Double());
setSettingDefault(DISTANCE, new de.erichseifert.gral.util.Dimension2D.Double(1.0, 1.0));
setSettingDefault(COLORS, new Grayscale());
getPlotArea().setSettingDefault(XYPlotArea2D.GRID_MAJOR_X, false);
getPlotArea().setSettingDefault(XYPlotArea2D.GRID_MAJOR_Y, false);
//getAxisRenderer(AXIS_X).setSetting(AxisRenderer.TICKS, false);
//getAxisRenderer(AXIS_Y).setSetting(AxisRenderer.TICKS, false);
getAxisRenderer(AXIS_X).setSetting(AxisRenderer.INTERSECTION,
-Double.MAX_VALUE);
getAxisRenderer(AXIS_Y).setSetting(AxisRenderer.INTERSECTION,
-Double.MAX_VALUE);
// Store data
add(data);
// Adjust axes to the data series
autoscaleAxes();
}
开发者ID:charles-cooper,项目名称:idylfin,代码行数:25,代码来源:RasterPlot.java
示例12: getAreaShape
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
/**
* Returns the shape used for rendering the area of a data points.
* @param points Data points.
* @return Geometric shape for the area of the specified data points.
*/
public Shape getAreaShape(List<DataPoint> points) {
if (points.isEmpty() || points.get(0) == null) {
return null;
}
Axis axisY = points.get(0).data.axes.get(1);
AxisRenderer axisRendererY = points.get(0).data.axisRenderers.get(1);
double axisYMin = axisY.getMin().doubleValue();
double axisYMax = axisY.getMax().doubleValue();
double axisYOrigin = MathUtils.limit(0.0, axisYMin, axisYMax);
double posYOrigin = 0.0;
if (axisRendererY != null) {
posYOrigin = axisRendererY.getPosition(
axisY, axisYOrigin, true, false).get(PointND.Y);
}
Path2D shape = new Path2D.Double();
double x = 0.0;
double y = 0.0;
for (DataPoint p : points) {
Point2D pos = p.position.getPoint2D();
x = pos.getX();
y = pos.getY();
shape.moveTo(x, y);
shape.lineTo(x, posYOrigin);
}
Stroke stroke = getStroke();
return stroke.createStrokedShape(shape);
}
开发者ID:eseifert,项目名称:gral,代码行数:36,代码来源:LineAreaRenderer2D.java
示例13: PointData
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
/**
* Initializes a new instance with the specified data.
* @param axes Axes that are used to project the point.
* @param axisRenderers Renderers for the axes.
* @param row Data row containing that will be projected on the axes.
* @param rowIndex Index of the row.
* @param col Index of the column in the row that contains the data value.
*/
public PointData(List<Axis> axes, List<? extends AxisRenderer> axisRenderers,
Row row, int rowIndex, int col) {
this.axes = Collections.unmodifiableList(axes);
this.axisRenderers = Collections.unmodifiableList(axisRenderers);
this.row = row;
this.index = rowIndex;
this.col = col;
}
开发者ID:eseifert,项目名称:gral,代码行数:17,代码来源:PointData.java
示例14: getPoint
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
@Override
public Drawable getPoint(final PointData data, final Shape shape) {
return new AbstractDrawable() {
/** Version id for serialization. */
private static final long serialVersionUID1 = 1915778739867091906L;
public void draw(DrawingContext context) {
PointRenderer renderer = DefaultPointRenderer2D.this;
Axis axisY = data.axes.get(1);
AxisRenderer axisRendererY = data.axisRenderers.get(1);
Row row = data.row;
int col = data.col;
ColorMapper colors = getColor();
Paint paint = colors.get(data.index);
GraphicsUtils.fillPaintedShape(
context.getGraphics(), shape, paint, null);
if (renderer.isErrorVisible()) {
int colErrorTop = renderer.getErrorColumnTop();
int colErrorBottom = renderer.getErrorColumnBottom();
drawErrorBars(context, shape,
row, data.index, col, colErrorTop, colErrorBottom,
axisY, axisRendererY);
}
}
};
}
开发者ID:eseifert,项目名称:gral,代码行数:31,代码来源:DefaultPointRenderer2D.java
示例15: refresh
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
/**
* Refreshes the values of all axis to reflect navigation actions.
*/
private void refresh() {
for (String axisName : getAxes()) {
NavigationInfo info = getInfo(axisName);
if (info == null) {
continue;
}
AxisRenderer renderer = getPlot().getAxisRenderer(axisName);
if (renderer == null) {
continue;
}
Axis axis = getPlot().getAxis(axisName);
// Original range in screen units
// Most up-to-date view coordinates (axis's layout) must be used
double minOrig = renderer.worldToView(
axis, info.getMinOriginal(), true);
double maxOrig = renderer.worldToView(
axis, info.getMaxOriginal(), true);
double rangeOrig = maxOrig - minOrig;
// New axis scale
double zoom = info.getZoom();
double range = rangeOrig/zoom;
double center = renderer.worldToView(axis, info.getCenter(), true);
Number min = renderer.viewToWorld(axis, center - 0.5*range, true);
Number max = renderer.viewToWorld(axis, center + 0.5*range, true);
// Change axis
axis.setRange(min, max);
}
}
开发者ID:eseifert,项目名称:gral,代码行数:37,代码来源:PlotNavigator.java
示例16: createDefaultAxisRenderers
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的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);
}
开发者ID:eseifert,项目名称:gral,代码行数:9,代码来源:XYPlot.java
示例17: setAxisRenderer
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
@Override
public void setAxisRenderer(String axisName, AxisRenderer renderer) {
if (renderer != null) {
if (AXIS_X2.equals(axisName) || AXIS_Y.equals(axisName)) {
renderer.setShapeNormalOrientationClockwise(true);
}
if (AXIS_Y.equals(axisName)) {
renderer.getLabel().setRotation(90.0);
}
}
super.setAxisRenderer(axisName, renderer);
}
开发者ID:eseifert,项目名称:gral,代码行数:13,代码来源:XYPlot.java
示例18: createDefaultAxisRenderers
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的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);
}
开发者ID:eseifert,项目名称:gral,代码行数:13,代码来源:PiePlot.java
示例19: setClockwise
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
/**
* Sets whether the segments will be in clockwise or counterclockwise order.
* @param clockwise {@code true} if segments should be in clockwise order,
* otherwise {@code false}.
*/
public void setClockwise(boolean clockwise) {
this.clockwise = clockwise;
AxisRenderer axisRenderer = getAxisRenderer(PiePlot.AXIS_TANGENTIAL);
if (axisRenderer != null) {
Shape shape = axisRenderer.getShape();
if (shape != null) {
shape = GeometryUtils.reverse(shape);
axisRenderer.setShape(shape);
}
}
}
开发者ID:eseifert,项目名称:gral,代码行数:18,代码来源:PiePlot.java
示例20: setAxisRenderer
import de.erichseifert.gral.plots.axes.AxisRenderer; //导入依赖的package包/类
/**
* Sets the renderer for the axis with the specified name.
* @param axisName Name of the axis to be rendered.
* @param renderer Instance to render the axis.
*/
public void setAxisRenderer(String axisName, AxisRenderer renderer) {
Drawable comp = null;
if (renderer == null) {
axisRenderers.remove(axisName);
} else {
axisRenderers.put(axisName, renderer);
Axis axis = getAxis(axisName);
comp = renderer.getRendererComponent(axis);
}
setAxisComponent(axisName, comp);
layout();
}
开发者ID:eseifert,项目名称:gral,代码行数:18,代码来源:AbstractPlot.java
注:本文中的de.erichseifert.gral.plots.axes.AxisRenderer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论