本文整理汇总了Java中org.jfree.chart.entity.AxisEntity类的典型用法代码示例。如果您正苦于以下问题:Java AxisEntity类的具体用法?Java AxisEntity怎么用?Java AxisEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AxisEntity类属于org.jfree.chart.entity包,在下文中一共展示了AxisEntity类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOrientation
import org.jfree.chart.entity.AxisEntity; //导入依赖的package包/类
/**
* use default orientation or orientation of axis
*
* @param event
* @return
*/
public Orientation getOrientation(ChartGestureEvent event) {
ChartEntity ce = event.getEntity();
if (ce instanceof AxisEntity) {
JFreeChart chart = event.getChartPanel().getChart();
PlotOrientation orient = PlotOrientation.HORIZONTAL;
if (chart.getXYPlot() != null)
orient = chart.getXYPlot().getOrientation();
else if (chart.getCategoryPlot() != null)
orient = chart.getCategoryPlot().getOrientation();
Entity entity = event.getGesture().getEntity();
if ((entity.equals(Entity.DOMAIN_AXIS) && orient.equals(PlotOrientation.VERTICAL))
|| (entity.equals(Entity.RANGE_AXIS) && orient.equals(PlotOrientation.HORIZONTAL)))
return Orientation.HORIZONTAL;
else
return Orientation.VERTICAL;
}
return orient;
}
示例2: createAndAddEntity
import org.jfree.chart.entity.AxisEntity; //导入依赖的package包/类
/**
* Created an entity for the axis.
*
* @param cursor the initial cursor value.
* @param state the axis state after completion of the drawing with a
* possibly updated cursor position.
* @param dataArea the data area.
* @param edge the edge.
* @param plotState the PlotRenderingInfo from which a reference to the
* entity collection can be obtained.
*
* @since 1.0.13
*/
protected void createAndAddEntity(double cursor, AxisState state,
Rectangle2D dataArea, RectangleEdge edge,
PlotRenderingInfo plotState) {
if (plotState == null || plotState.getOwner() == null) {
return; // no need to create entity if we can't save it anyways...
}
Rectangle2D hotspot = null;
if (edge.equals(RectangleEdge.TOP)) {
hotspot = new Rectangle2D.Double(dataArea.getX(),
state.getCursor(), dataArea.getWidth(),
cursor - state.getCursor());
}
else if (edge.equals(RectangleEdge.BOTTOM)) {
hotspot = new Rectangle2D.Double(dataArea.getX(), cursor,
dataArea.getWidth(), state.getCursor() - cursor);
}
else if (edge.equals(RectangleEdge.LEFT)) {
hotspot = new Rectangle2D.Double(state.getCursor(),
dataArea.getY(), cursor - state.getCursor(),
dataArea.getHeight());
}
else if (edge.equals(RectangleEdge.RIGHT)) {
hotspot = new Rectangle2D.Double(cursor, dataArea.getY(),
state.getCursor() - cursor, dataArea.getHeight());
}
EntityCollection e = plotState.getOwner().getEntityCollection();
if (e != null) {
e.add(new AxisEntity(hotspot, this));
}
}
示例3: getAxis
import org.jfree.chart.entity.AxisEntity; //导入依赖的package包/类
/**
* The ValueAxis of this event's entity or null if the entity is different to an AxisEntity or if
* the axis is not a ValueAxis
*
* @return
*/
public ValueAxis getAxis() {
if (entity != null && entity instanceof AxisEntity
&& ((AxisEntity) entity).getAxis() instanceof ValueAxis)
return (ValueAxis) ((AxisEntity) entity).getAxis();
else
return null;
}
示例4: getGestureEntity
import org.jfree.chart.entity.AxisEntity; //导入依赖的package包/类
/**
* The gesture entity type
*
* @param entity
* @return
*/
public static Entity getGestureEntity(ChartEntity entity) {
if (entity == null)
return NONE;
if (entity instanceof PlotEntity)
return PLOT;
if (entity instanceof AxisEntity) {
AxisEntity e = (AxisEntity) entity;
if (e.getAxis().getPlot() instanceof XYPlot) {
XYPlot plot = ((XYPlot) e.getAxis().getPlot());
for (int i = 0; i < plot.getDomainAxisCount(); i++)
if (plot.getDomainAxis(i).equals(e.getAxis()))
return DOMAIN_AXIS;
for (int i = 0; i < plot.getRangeAxisCount(); i++)
if (plot.getRangeAxis(i).equals(e.getAxis()))
return RANGE_AXIS;
}
// else return basic axis
return AXIS;
}
if (entity instanceof LegendItemEntity)
return LEGEND_ITEM;
if (entity instanceof XYItemEntity)
return XY_ITEM;
if (entity instanceof XYAnnotationEntity)
return XY_ANNOTATION;
if (entity instanceof TitleEntity) {
if (((TitleEntity) entity).getTitle() instanceof TextTitle)
return TEXT_TITLE;
else
return NON_TEXT_TITLE;
}
if (entity instanceof JFreeChartEntity)
return JFREECHART;
if (entity instanceof CategoryItemEntity)
return CATEGORY_ITEM;
return GENERAL;
}
示例5: createAndAddEntity
import org.jfree.chart.entity.AxisEntity; //导入依赖的package包/类
/**
* Created an entity for the axis.
*
* @param cursor the initial cursor value.
* @param state the axis state after completion of the drawing with a
* possibly updated cursor position.
* @param dataArea the data area.
* @param edge the edge.
* @param plotState the PlotRenderingInfo from which a reference to the
* entity collection can be obtained.
*
* @since 1.0.13
*/
protected void createAndAddEntity(double cursor, AxisState state,
Rectangle2D dataArea, RectangleEdge edge,
PlotRenderingInfo plotState){
if (plotState == null || plotState.getOwner() == null) {
return; // no need to create entity if we can´t save it anyways...
}
Rectangle2D hotspot = null;
if (edge.equals(RectangleEdge.TOP)){
hotspot = new Rectangle2D.Double(dataArea.getX(),
state.getCursor(), dataArea.getWidth(),
cursor - state.getCursor());
}
else if(edge.equals(RectangleEdge.BOTTOM)) {
hotspot = new Rectangle2D.Double(dataArea.getX(), cursor,
dataArea.getWidth(), state.getCursor() - cursor);
}
else if(edge.equals(RectangleEdge.LEFT)) {
hotspot = new Rectangle2D.Double(state.getCursor(),
dataArea.getY(), cursor - state.getCursor(),
dataArea.getHeight());
}
else if(edge.equals(RectangleEdge.RIGHT)){
hotspot = new Rectangle2D.Double(cursor, dataArea.getY(),
state.getCursor() - cursor, dataArea.getHeight());
}
EntityCollection e = plotState.getOwner().getEntityCollection();
if (e != null) {
e.add(new AxisEntity(hotspot, this));
}
}
示例6: createAndAddEntity
import org.jfree.chart.entity.AxisEntity; //导入依赖的package包/类
/**
* Created an entity for the axis.
*
* @param cursor the initial cursor value.
* @param state the axis state after completion of the drawing with a
* possibly updated cursor position.
* @param dataArea the data area.
* @param edge the edge.
* @param plotState the PlotRenderingInfo from which a reference to the
* entity collection can be obtained.
*
* @since 1.0.13
*/
protected void createAndAddEntity(double cursor, AxisState state,
Rectangle2D dataArea, RectangleEdge edge,
PlotRenderingInfo plotState) {
if (plotState == null || plotState.getOwner() == null) {
return; // no need to create entity if we can´t save it anyways...
}
Rectangle2D hotspot = null;
if (edge.equals(RectangleEdge.TOP)) {
hotspot = new Rectangle2D.Double(dataArea.getX(),
state.getCursor(), dataArea.getWidth(),
cursor - state.getCursor());
}
else if (edge.equals(RectangleEdge.BOTTOM)) {
hotspot = new Rectangle2D.Double(dataArea.getX(), cursor,
dataArea.getWidth(), state.getCursor() - cursor);
}
else if (edge.equals(RectangleEdge.LEFT)) {
hotspot = new Rectangle2D.Double(state.getCursor(),
dataArea.getY(), cursor - state.getCursor(),
dataArea.getHeight());
}
else if (edge.equals(RectangleEdge.RIGHT)) {
hotspot = new Rectangle2D.Double(cursor, dataArea.getY(),
state.getCursor() - cursor, dataArea.getHeight());
}
EntityCollection e = plotState.getOwner().getEntityCollection();
if (e != null) {
e.add(new AxisEntity(hotspot, this));
}
}