本文整理汇总了Java中info.monitorenter.gui.chart.Chart2D.X属性的典型用法代码示例。如果您正苦于以下问题:Java Chart2D.X属性的具体用法?Java Chart2D.X怎么用?Java Chart2D.X使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类info.monitorenter.gui.chart.Chart2D
的用法示例。
在下文中一共展示了Chart2D.X属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: propertyChangeSynced
/**
* @see info.monitorenter.gui.chart.axis.AAxis.APropertyChangeReactorSynced#propertyChangeSynced(java.beans.PropertyChangeEvent,
* info.monitorenter.gui.chart.axis.AAxis)
*/
@Override
protected boolean propertyChangeSynced(final PropertyChangeEvent changeEvent,
final AAxis<?> receiver) {
boolean result = false;
if (Chart2D.DEBUG_SCALING) {
System.out.println("pc-Xmin");
}
if (receiver.getAccessor().getDimension() == Chart2D.X) {
final double value = ((Double) changeEvent.getNewValue()).doubleValue();
if (value < receiver.m_min) {
final ITrace2D trace = (ITrace2D) changeEvent.getSource();
if (trace.isVisible()) {
receiver.m_min = value;
receiver.m_needsFullRescale = true;
result = true;
}
} else if (value > receiver.m_min) {
receiver.m_min = receiver.findMin();
receiver.m_needsFullRescale = true;
result = true;
}
}
return result;
}
示例2: scalePoint
/**
* Internally rescales the given <code>{@link ITracePoint2D}</code> in the
* dimension this axis works in.
* <p>
*
* @param point
* the point to scale (between 0.0 and 1.0) according to the internal
* bounds.
*/
protected final void scalePoint(final ITracePoint2D point) {
final int axis = this.getAccessor().getDimension();
if (axis == Chart2D.X) {
point.setScaledX(this.getScaledValue(point.getX()));
} else if (axis == Chart2D.Y) {
point.setScaledY(this.getScaledValue(point.getY()));
}
if (Chart2D.DEBUG_SCALING) {
// This is ok for fixed viewports that zoom!
if ((point.getScaledX() > 1.0) || (point.getScaledX() < 0.0) || (point.getScaledY() > 1.0)
|| (point.getScaledY() < 0.0)) {
System.out.println("Scaled Point " + point + " to [" + point.getScaledX() + ","
+ point.getScaledY() + "]");
}
}
}
示例3: unlisten2Trace
/**
* Removes this axis as a listener for all property change events of the given
* trace that are needed here.
* <p>
* TODO: stick to <code>{@link AAxis#listen2Trace(ITrace2D)}</code>.
* <p>
*
* @param trace
* the trace to not listen to any more.
*/
private void unlisten2Trace(final ITrace2D trace) {
if (this.getAccessor().getDimension() == Chart2D.X) {
trace.removePropertyChangeListener(ITrace2D.PROPERTY_MAX_X, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_MIN_X, this);
} else {
trace.removePropertyChangeListener(ITrace2D.PROPERTY_MAX_Y, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_MIN_Y, this);
}
trace.removePropertyChangeListener(ITrace2D.PROPERTY_COLOR, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_STROKE, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_VISIBLE, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_ZINDEX, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_PAINTERS, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_ERRORBARPOLICY, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_ERRORBARPOLICY_CONFIGURATION, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_ZINDEX, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_NAME, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_TRACEPOINT, this);
trace.removePropertyChangeListener(ITrace2D.PROPERTY_POINT_CHANGED, this);
}
示例4: createAccessor
/**
* @see info.monitorenter.gui.chart.axis.AAxis#createAccessor(info.monitorenter.gui.chart.Chart2D,
* int, int)
*/
@Override
protected AChart2DDataAccessor createAccessor(final Chart2D chart, final int dimension,
final int position) {
AChart2DDataAccessor result;
if (dimension == Chart2D.X) {
// Don't allow a combination of dimension and position that is not usable:
if ((position & (Chart2D.CHART_POSITION_BOTTOM | Chart2D.CHART_POSITION_TOP)) == 0) {
throw new IllegalArgumentException("X axis only valid with top or bottom position.");
}
this.setAxisPosition(position);
result = new XDataAccessor(chart);
} else if (dimension == Chart2D.Y) {
// Don't allow a combination of dimension and position that is not usable:
if ((position & (Chart2D.CHART_POSITION_LEFT | Chart2D.CHART_POSITION_RIGHT)) == 0) {
throw new IllegalArgumentException("Y axis only valid with left or right position.");
}
this.setAxisPosition(position);
result = new YDataAccessor(chart);
} else {
throw new IllegalArgumentException("Dimension has to be Chart2D.X or Chart2D.Y!");
}
return result;
}
示例5: createAccessor
/**
* @see info.monitorenter.gui.chart.axis.AAxis#createAccessor(info.monitorenter.gui.chart.Chart2D,
* int, int)
*/
@Override
protected AAxis<T>.AChart2DDataAccessor createAccessor(final Chart2D chart, final int dimension,
final int position) {
AAxis<T>.AChart2DDataAccessor result;
if (dimension == Chart2D.X) {
// Don't allow a combination of dimension and position that is not usable:
if ((position & (Chart2D.CHART_POSITION_BOTTOM | Chart2D.CHART_POSITION_TOP)) == 0) {
throw new IllegalArgumentException("X axis only valid with top or bottom position.");
}
this.setAxisPosition(position);
result = new XDataAccessor(chart);
} else if (dimension == Chart2D.Y) {
// Don't allow a combination of dimension and position that is not usable:
if ((position & (Chart2D.CHART_POSITION_LEFT | Chart2D.CHART_POSITION_RIGHT)) == 0) {
throw new IllegalArgumentException("Y axis only valid with left or right position.");
}
this.setAxisPosition(position);
result = new YDataAccessor(chart);
} else {
throw new IllegalArgumentException("Dimension has to be Chart2D.X or Chart2D.Y!");
}
return result;
}
示例6: createAccessor
/**
* @see info.monitorenter.gui.chart.axis.AAxis#createAccessor(info.monitorenter.gui.chart.Chart2D,
* int, int)
*/
@Override
protected AChart2DDataAccessor createAccessor(final Chart2D chart, final int dimension,
final int position) {
AChart2DDataAccessor result;
if (dimension == Chart2D.X) {
// Don't allow a combination of dimension and position that is not usable:
if ((position & (Chart2D.CHART_POSITION_BOTTOM | Chart2D.CHART_POSITION_TOP)) == 0) {
throw new IllegalArgumentException("X axis only valid with top or bottom position.");
}
this.setAxisPosition(position);
result = new XDataInverseAccessor(chart);
} else if (dimension == Chart2D.Y) {
// Don't allow a combination of dimension and position that is not usable:
if ((position & (Chart2D.CHART_POSITION_LEFT | Chart2D.CHART_POSITION_RIGHT)) == 0) {
throw new IllegalArgumentException("Y axis only valid with left or right position.");
}
this.setAxisPosition(position);
result = new YDataInverseAccessor(chart);
} else {
throw new IllegalArgumentException("Dimension has to be Chart2D.X or Chart2D.Y!");
}
return result;
}
示例7: getAxis
/**
* Returns the axis that is controlled.
* <p>
* Note that several calls may return different instances (
* <code>a.getAxis() == a.getAxis()</code> may be false) in case the
* corresponding chart of the former axis gets a new axis assigned.
* <p>
* Note that this action only works for the first x axis / first y axis:
* Additional axes cannot be handled by now.
* <p>
*
* @return the axis that is controlled.
*/
protected IAxis<?> getAxis() {
// update in case the corresponding chart has a new axis:
IAxis<?> axis = null;
switch (this.m_axis) {
case Chart2D.X:
axis = this.m_chart.getAxisX();
break;
case Chart2D.Y:
axis = this.m_chart.getAxisY();
break;
default:
break;
}
return axis;
}
示例8: propertyChange
/**
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent evt) {
String property = evt.getPropertyName();
if (((property.equals(Chart2D.PROPERTY_AXIS_X_BOTTOM_REPLACE)) && (this.m_axis == Chart2D.X))
|| (property.equals(Chart2D.PROPERTY_AXIS_Y_LEFT_REPLACE) && this.m_axis == Chart2D.Y)) {
IAxis<?> oldAxis = (IAxis<?>) evt.getOldValue();
IAxis<?> newAxis = (IAxis<?>) evt.getNewValue();
if (property.equals(Chart2D.PROPERTY_AXIS_X_BOTTOM_REPLACE)) {
oldAxis.removePropertyChangeListener(Chart2D.PROPERTY_AXIS_X_BOTTOM_REPLACE, this);
newAxis.addPropertyChangeListener(Chart2D.PROPERTY_AXIS_X_BOTTOM_REPLACE, this);
} else if (property.equals(Chart2D.PROPERTY_AXIS_Y_LEFT_REPLACE)) {
oldAxis.removePropertyChangeListener(Chart2D.PROPERTY_AXIS_Y_LEFT_REPLACE, this);
newAxis.addPropertyChangeListener(Chart2D.PROPERTY_AXIS_Y_LEFT_REPLACE, this);
}
}
}
示例9: actionPerformed
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(final ActionEvent e) {
switch (this.m_axisTarget) {
case Chart2D.X:
this.m_chart.setAxisXBottom(this.m_axis,0);
break;
case Chart2D.Y:
this.m_chart.setAxisYLeft(this.m_axis,0);
break;
default:
// nop
break;
}
}
示例10: getWidth
/**
* @see info.monitorenter.gui.chart.IAxisTitlePainter#getWidth(info.monitorenter.gui.chart.IAxis,
* java.awt.Graphics)
*/
public int getWidth(final IAxis<?> axis, final Graphics g2d) {
int result = 0;
IAxis.AxisTitle axisTitle = axis.getAxisTitle();
String title = axisTitle.getTitle();
if (!StringUtil.isEmpty(title)) {
// incorporation of our font if there:
Font backUpFont = g2d.getFont();
Font titleFont = axisTitle.getTitleFont();
if (titleFont != null) {
g2d.setFont(titleFont);
}
Rectangle2D bounds = g2d.getFontMetrics().getStringBounds(title, g2d);
int dimension = axis.getDimension();
switch (dimension) {
case Chart2D.X:
result = (int) bounds.getWidth();
break;
case Chart2D.Y:
boolean supportsRotation = g2d instanceof Graphics2D;
if (supportsRotation) {
// for y it's rotated by 90 degrees:
result = (int) bounds.getHeight();
} else {
result = (int) bounds.getWidth();
}
break;
default:
throw new IllegalArgumentException(
"Given axis.getDimension() is neither Chart2D.X nor Chart2D.Y!");
}
// resetting original font if it was changed:
if (titleFont != null) {
g2d.setFont(backUpFont);
}
}
return result;
}
示例11: listen2Trace
/**
* Adds this axis as a listener to all property change events of the given
* trace that are needed here.
* <p>
*
* @param trace
* the trace to listen to.
*/
private void listen2Trace(final ITrace2D trace) {
// listen to bound changes and more
if (this.getAccessor().getDimension() == Chart2D.X) {
trace.addPropertyChangeListener(ITrace2D.PROPERTY_MAX_X, this);
trace.addPropertyChangeListener(ITrace2D.PROPERTY_MIN_X, this);
} else {
trace.addPropertyChangeListener(ITrace2D.PROPERTY_MAX_Y, this);
trace.addPropertyChangeListener(ITrace2D.PROPERTY_MIN_Y, this);
}
// These are repaint candidates:
trace.addPropertyChangeListener(ITrace2D.PROPERTY_COLOR, this);
trace.addPropertyChangeListener(ITrace2D.PROPERTY_STROKE, this);
trace.addPropertyChangeListener(ITrace2D.PROPERTY_VISIBLE, this);
trace.addPropertyChangeListener(ITrace2D.PROPERTY_ZINDEX, this);
trace.addPropertyChangeListener(ITrace2D.PROPERTY_PAINTERS, this);
trace.addPropertyChangeListener(ITrace2D.PROPERTY_ERRORBARPOLICY, this);
trace.addPropertyChangeListener(ITrace2D.PROPERTY_ERRORBARPOLICY_CONFIGURATION, this);
trace.addPropertyChangeListener(ITrace2D.PROPERTY_ZINDEX, this);
trace.addPropertyChangeListener(ITrace2D.PROPERTY_NAME, this);
// listen to newly added points
// this is needed for scaling at point level.
// else every bound change would force to rescale all traces!
trace.addPropertyChangeListener(ITrace2D.PROPERTY_TRACEPOINT, this);
// listen to changed points whose location was changed:
trace.addPropertyChangeListener(ITrace2D.PROPERTY_POINT_CHANGED, this);
}
示例12: paint
/**
* @see info.monitorenter.gui.chart.IAxis#paint(java.awt.Graphics)
*/
public void paint(final Graphics g2d) {
if (!this.m_visible) {
return;
}
switch (this.getDimension() | this.getAxisPosition()) {
case (Chart2D.X | Chart2D.CHART_POSITION_BOTTOM): {
this.paintAxisXBottom(g2d);
break;
}
case (Chart2D.X | Chart2D.CHART_POSITION_TOP): {
this.paintAxisXTop(g2d);
break;
}
case (Chart2D.Y | Chart2D.CHART_POSITION_LEFT): {
this.paintAxisYLeft(g2d);
break;
}
case (Chart2D.Y | Chart2D.CHART_POSITION_RIGHT): {
this.paintAxisYRight(g2d);
break;
}
default: {
throw new IllegalStateException("No valid Chart position found for this axis: " + this);
}
}
}
示例13: paintTitle
/**
* @see info.monitorenter.gui.chart.IAxis#paintTitle(java.awt.Graphics)
*/
public int paintTitle(final Graphics g2d) {
int result = 0;
// TODO: Add support for different axis locations: top, bottom, left,right!
// drawing the title :
final IAxis.AxisTitle axisTitle = this.getAxisTitle();
final String title = axisTitle.getTitle();
if (!StringUtil.isEmpty(title)) {
IAxisTitlePainter titlePainter;
titlePainter = axisTitle.getTitlePainter();
titlePainter.paintTitle(this, g2d);
final int dimension = this.getDimension();
switch (dimension) {
case Chart2D.X:
result = titlePainter.getHeight(this, g2d);
break;
case Chart2D.Y:
result = titlePainter.getWidth(this, g2d);
break;
default:
throw new IllegalArgumentException(
"Given axis.getDimension() is neither Chart2D.X nor Chart2D.Y!");
}
}
return result;
}
示例14: createAxisMenuItem
/**
* Creates a {@link JMenuItem} that allows to trigger the features related to
* {@link info.monitorenter.gui.chart.axis.AAxis} features.
* <p>
*
* @param axis
* the axis to control.
* @param axisDimension
* Identifies which dimension the axis controls in the chart: either
* {@link Chart2D#X} or {@link Chart2D#Y}
* @param adaptUI2Chart
* if true the menu will adapt it's basic UI properies (font,
* foreground and background color) to the given chart.
* @return a {@link JMenuItem} that allows to trigger the features related to
* {@link info.monitorenter.gui.chart.axis.AAxis} features.
*/
public JMenuItem createAxisMenuItem(final IAxis<?> axis, final int axisDimension,
final boolean adaptUI2Chart) {
final Chart2D chart = axis.getAccessor().getChart();
JMenuItem item;
// axis submenu
JMenuItem axisMenuItem;
if (adaptUI2Chart) {
axisMenuItem = new PropertyChangeMenu(chart, "Axis" + axis.getAccessor().toString(),
BasicPropertyAdaptSupport.RemoveAsListenerFromComponentNever.getInstance());
} else {
axisMenuItem = new JMenu("Axis" + axis.getAccessor().toString());
}
if ((this.m_showAxisXTypeMenu && axisDimension == Chart2D.X)
|| (this.m_showAxisYTypeMenu && axisDimension == Chart2D.Y)) {
axisMenuItem.add(this.createAxisTypeMenu(chart, axis, axisDimension, adaptUI2Chart));
}
if (this.m_showAxisFormatterMenu) {
axisMenuItem.add(this.createAxisFormatterMenu(chart, axis, axisDimension, adaptUI2Chart));
}
if ((this.m_showAxisXRangePolicyMenu && axisDimension == Chart2D.X)
|| this.m_showAxisYRangePolicyMenu && axisDimension == Chart2D.Y) {
axisMenuItem.add(this.createAxisRangePolicyMenu(chart, axis, adaptUI2Chart));
// Axis -> Range menu
if (adaptUI2Chart) {
item = new PropertyChangeMenuItem(chart, new AxisActionSetRange(chart, "Range",
axisDimension), BasicPropertyAdaptSupport.RemoveAsListenerFromComponentNever
.getInstance());
} else {
item = new JMenuItem(new AxisActionSetRange(chart, "Range", axisDimension));
}
if (!AxisActionSetRange.RANGE_CHOOSER_SUPPORTED) {
item.setToolTipText("This is disabled as bislider.jar is missing on the class path.");
}
axisMenuItem.add(item);
}
if ((this.m_showAxisXTitleMenu && axisDimension == Chart2D.X)
|| (this.m_showAxisYTitleMenu && axisDimension == Chart2D.Y)) {
axisMenuItem.add(this.createAxisTitleMenu(chart, axis, axisDimension, adaptUI2Chart));
}
return axisMenuItem;
}
示例15: getDimension
/**
* @see info.monitorenter.gui.chart.axis.AAxis.AChart2DDataAccessor#getDimension()
*/
@Override
public int getDimension() {
return Chart2D.X;
}