当前位置: 首页>>代码示例>>Java>>正文


Java IAxis类代码示例

本文整理汇总了Java中info.monitorenter.gui.chart.IAxis的典型用法代码示例。如果您正苦于以下问题:Java IAxis类的具体用法?Java IAxis怎么用?Java IAxis使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IAxis类属于info.monitorenter.gui.chart包,在下文中一共展示了IAxis类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setFormatter

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * Sets the formatter to use for labels.
 * <p>
 * 
 * @param formatter
 *          The formatter to set.
 */
public void setFormatter(final IAxisLabelFormatter formatter) {

  if (this.getAccessor() != null) {
    // remove listener for this:
    this.removePropertyChangeListener(IAxis.PROPERTY_LABELFORMATTER, this.getAccessor()
        .getChart());
    // add listener for this:
    this.addPropertyChangeListener(IAxis.PROPERTY_LABELFORMATTER, this.getAccessor().getChart());
    // listener to subsequent format changes:
    if (this.m_formatter != null) {
      // remove listener on old formatter:
      this.m_formatter.removePropertyChangeListener(IAxisLabelFormatter.PROPERTY_FORMATCHANGE,
          this);
    }
    formatter.addPropertyChangeListener(IAxisLabelFormatter.PROPERTY_FORMATCHANGE, this);
  }
  final IAxisLabelFormatter old = this.m_formatter;

  this.m_formatter = formatter;

  this.m_formatter.setAxis(this);
  this.m_propertyChangeSupport.firePropertyChange(IAxis.PROPERTY_LABELFORMATTER, old,
      this.m_formatter);
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:32,代码来源:AAxis.java

示例2: createLabeledValue

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * Just a helper to create a labeled value instance.
 * <p>
 * 
 * @param value
 *          the value use.
 * 
 * @param majorTickSpacing
 *          if value % majorTickSpacing is zero then the resulting <code>
 *          {@link LabeledValue}</code> will be judged as a major tick.
 * 
 * @param axis
 *          needed to re-parse the value into the label string by using the
 *          formatter of it.
 * 
 * @return the value rounded to minor or major ticks.
 */
protected LabeledValue createLabeledValue(final double value, final double majorTickSpacing,
    final IAxis<?> axis) {
  final LabeledValue ret = new LabeledValue();
  ret.setValue(value);
  if (value % majorTickSpacing == 0) {
    ret.setMajorTick(true);
  } else {
    ret.setMajorTick(false);
  }

  // format label string.
  ret.setLabel(axis.getFormatter().format(ret.getValue()));
  // as formatting rounds too, reparse value so that it is exactly at the
  // point the label string describes.
  ret.setValue(axis.getFormatter().parse(ret.getLabel()).doubleValue());
  return ret;
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:35,代码来源:AxisScalePolicyManualTicks.java

示例3: getAxis

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:30,代码来源:AAxisAction.java

示例4: propertyChange

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * @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);
    }
  }
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:19,代码来源:AAxisAction.java

示例5: propertyChange

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
 */
@Override
public void propertyChange(final PropertyChangeEvent evt) {
  // will check for an axis replacement and transfer listening to the new axis
  // if so:
  super.propertyChange(evt);
  String property = evt.getPropertyName();
  if (property.equals(IAxis.PROPERTY_LABELFORMATTER)) {
    // someone else changed the formatter property via API: Inform the outer
    // menu item UI:
    if (this.m_formatter.equals(evt.getOldValue())) {
      if (!this.m_formatter.equals(evt.getNewValue())) {
        this.firePropertyChange(PropertyChangeCheckBoxMenuItem.PROPERTY_SELECTED, Boolean.TRUE, Boolean.FALSE);
      }
    } else {
      if (this.m_formatter.equals(evt.getNewValue())) {
        this.firePropertyChange(PropertyChangeCheckBoxMenuItem.PROPERTY_SELECTED, Boolean.FALSE, Boolean.TRUE);
      }
    }
  }
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:24,代码来源:AxisActionSetFormatter.java

示例6: propertyChange

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
 */
@Override
public void propertyChange(final PropertyChangeEvent evt) {
  // will check for an axis replacement and transfer listening to the new axis if so: 
  super.propertyChange(evt);
  String property = evt.getPropertyName();
  if (property.equals(IAxis.AxisTitle.PROPERTY_TITLEFONT)) {
    Font newFont = (Font) evt.getNewValue();
    if (newFont.equals(this.m_titleFont)) {
      this.firePropertyChange(PropertyChangeCheckBoxMenuItem.PROPERTY_SELECTED,
          new Boolean(false), new Boolean(true));

    } else {
      this.firePropertyChange(PropertyChangeCheckBoxMenuItem.PROPERTY_SELECTED,
          new Boolean(true), new Boolean(false));
    }
  }
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:21,代码来源:AxisActionSetTitleFont.java

示例7: propertyChange

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
 */
@Override
public void propertyChange(final PropertyChangeEvent evt) {
  // will check for an axis replacement and transfer listening to the new axis if so: 
  super.propertyChange(evt);
  
  String property = evt.getPropertyName();
  if (property.equals(IAxis.PROPERTY_RANGEPOLICY)) {
    Class< ? > rangepolicyClass = evt.getNewValue().getClass();
    Boolean oldValue;
    Boolean newValue;
    if (rangepolicyClass == this.m_rangePolicy.getClass()) {
      oldValue = new Boolean(false);
      newValue = new Boolean(true);
    } else {
      oldValue = new Boolean(true);
      newValue = new Boolean(false);
    }
    this.firePropertyChange(PropertyChangeCheckBoxMenuItem.PROPERTY_SELECTED, oldValue, newValue);
  }
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:24,代码来源:AxisActionSetRangePolicy.java

示例8: createChart

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
private static void createChart(Chart2D chart, ITrace2D[] traces,
        String name, String yAxisLabel) {
    // Cleanup - necessary when we switch between calibrated and uncalibrated
    chart.removeAllTraces();
    
    final String[] axesNames = new String[]{"x", "y", "z"};
    for (int i = 0; i < 3; ++i) {
        chart.addTrace(traces[i]);
        traces[i].setName(name + "_" + axesNames[i]);
        traces[i].setColor(colors[i]);
        traces[i].setStroke(strokes[i]);
    }

    IAxis yAxis = chart.getAxisY();
    //yAxis.setAxisTitle(new AxisTitle(yAxisLabel));
    yAxis.setPaintScale(true);
    yAxis.getAxisTitle().setTitle(null);
    yAxis.setRangePolicy(new RangePolicyMaxSeen());
    IAxis xAxis = chart.getAxisX();
    xAxis.setPaintScale(false);
    xAxis.getAxisTitle().setTitle(null);
}
 
开发者ID:heig-iict-ida,项目名称:shimmer_move_analyzer,代码行数:23,代码来源:ChartsDrawer.java

示例9: ChartPanel

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
public ChartPanel(String... params) {
    super(new BorderLayout());

    
    int historySize = 200;
    
    chart = new Chart2D();
    chart.setBorder(new EmptyBorder(0,0,0,0));
    //chart.setSize(200,200);
    chart.setUseAntialiasing(true);
    chart.setBackground(Color.BLACK);
    chart.setForeground(Color.WHITE);
    chart.setGridColor(Color.darkGray);
    for (IAxis left : chart.getAxesYLeft()) {
        left.setAxisTitle(new AxisTitle(""));
        left.setPaintGrid(true);
    }
 
    for (IAxis bottom : chart.getAxesXBottom()) {
        bottom.setVisible(false);
    }        

    for (String p : params) {
        Trace2DLtd t = new Trace2DLtd(historySize, p);
        t.setColor(Color.getHSBColor( ((float)(p.hashCode()%1024))/1024.0f, 0.5f, 1.0f));
        chart.addTrace(t);
        this.params.put(p, t);
    }
    
    
    add(chart, BorderLayout.CENTER);        
}
 
开发者ID:automenta,项目名称:opennars,代码行数:33,代码来源:ChartPanel.java

示例10: main

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * Main entry.
 * <p>
 * 
 * @param args
 *          ignored
 */
public static void main(final String[] args) {
  // Create a chart:
  Chart2D chart = new Chart2D();
  // Create an ITrace:
  // Note that dynamic charts need limited amount of values!!!
  ITrace2D trace = new Trace2DLtd(100);
  trace.setColor(Color.RED);

  // Add the trace to the chart:
  chart.addTrace(trace);
  IAxis<?> axisX = chart.getAxisX();
  axisX.setStartMajorTick(false);
  axisX.setMajorTickSpacing(10);
  // Make it visible:
  // Create a frame.
  JFrame frame = new JFrame("MinimalDynamicChart");
  // add the chart to the frame:
  frame.getContentPane().add(chart);
  frame.setSize(400, 300);
  // Enable the termination button [cross on the upper right edge]:
  frame.addWindowListener(new WindowAdapter() {
    /**
     * @see java.awt.event.WindowAdapter#windowClosing(java.awt.event.WindowEvent)
     */
    @Override
    public void windowClosing(final WindowEvent e) {
      System.exit(0);
    }
  });
  frame.setVisible(true);
  // Every 20 milliseconds a new value is collected.
  ADataCollector collector = new RandomDataCollectorOffset(trace, 100);
  collector.start();
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:42,代码来源:MinimalDynamicChart.java

示例11: internalGetNegativeXError

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * @see info.monitorenter.gui.chart.errorbars.AErrorBarPolicyConfigurable#internalGetNegativeXError(int,
 *      int, info.monitorenter.gui.chart.ITracePoint2D)
 */
@Override
protected int internalGetNegativeXError(final int xPixel, final int yPixel,
    final ITracePoint2D original) {
  final ITrace2D trace = this.getTrace();
  final Chart2D chart = trace.getRenderer();
  final IAxis<?> axisX = chart.getAxisX();
  // We cannot use IAxis.translateRelativeValueToPX because non-linear
  // transformations of axis implementations (e.g. log) will put the distance
  // argument in relation to 0 and return wrong results:
  final int result = axisX.translateValueToPx(original.getX() - this.m_xError);
  return result;
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:17,代码来源:ErrorBarPolicyAbsoluteSummation.java

示例12: internalGetNegativeYError

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * @see info.monitorenter.gui.chart.errorbars.AErrorBarPolicyConfigurable#internalGetNegativeYError(int,
 *      int, info.monitorenter.gui.chart.ITracePoint2D)
 */
@Override
protected int internalGetNegativeYError(final int xPixel, final int yPixel,
    final ITracePoint2D original) {
  final ITrace2D trace = this.getTrace();
  final Chart2D chart = trace.getRenderer();
  final IAxis<?> axisY = chart.getAxisY();
  // We cannot use IAxis.translateRelativeValueToPX because non-linear
  // transformations of axis implementations (e.g. log) will put the distance
  // argument in relation to 0 and return wrong results:
  final int result = axisY.translateValueToPx(original.getY() - this.m_yError);
  return result;
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:17,代码来源:ErrorBarPolicyAbsoluteSummation.java

示例13: internalGetPositiveXError

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * @see info.monitorenter.gui.chart.errorbars.AErrorBarPolicyConfigurable#internalGetPositiveXError(int,
 *      int, info.monitorenter.gui.chart.ITracePoint2D)
 */
@Override
protected int internalGetPositiveXError(final int xPixel, final int yPixel,
    final ITracePoint2D original) {
  final ITrace2D trace = this.getTrace();
  final Chart2D chart = trace.getRenderer();
  final IAxis<?> axisX = chart.getAxisX();
  // We cannot use IAxis.translateRelativeValueToPX with error only and then
  // add / subtract because non-linear
  // transformations of axis implementations (e.g. log) will put the distance
  // argument in relation to 0 and return wrong results:
  final int result = axisX.translateValueToPx(original.getX() + this.m_xError);
  return result;
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:18,代码来源:ErrorBarPolicyAbsoluteSummation.java

示例14: internalGetPositiveYError

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * @see info.monitorenter.gui.chart.errorbars.AErrorBarPolicyConfigurable#internalGetPositiveYError(int,
 *      int, info.monitorenter.gui.chart.ITracePoint2D)
 */
@Override
protected int internalGetPositiveYError(final int xPixel, final int yPixel,
    final ITracePoint2D original) {
  final ITrace2D trace = this.getTrace();
  final Chart2D chart = trace.getRenderer();
  final IAxis<?> axisY = chart.getAxisY();
  // We cannot use IAxis.translateRelativeValueToPX because non-linear
  // transformations of axis implementations (e.g. log) will put the distance
  // argument in relation to 0 and return wrong results:
  final int result = axisY.translateValueToPx(original.getY() + this.m_yError);
  return result;
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:17,代码来源:ErrorBarPolicyAbsoluteSummation.java

示例15: getHeight

import info.monitorenter.gui.chart.IAxis; //导入依赖的package包/类
/**
 * @see info.monitorenter.gui.chart.IAxisTitlePainter#getHeight(info.monitorenter.gui.chart.IAxis,
 *      java.awt.Graphics)
 */
public int getHeight(final IAxis<?> axis, final Graphics g2d) {
  int result = 0;
  IAxis.AxisTitle axisTitle = axis.getAxisTitle();
  String title = axisTitle.getTitle();
  if (!StringUtil.isEmpty(title)) {
    Rectangle2D bounds = g2d.getFontMetrics().getStringBounds(title, g2d);
    int dimension = axis.getDimension();
    switch (dimension) {
      case Chart2D.X:
        result = (int) bounds.getHeight();
        break;
      case Chart2D.Y:
        boolean supportsRotation = g2d instanceof Graphics2D;
        if (supportsRotation) {
          // for y it's rotated by 90 degrees:
          result = (int) bounds.getWidth();
        } else {
          result = (int) bounds.getHeight();
        }
        break;
      default:
        throw new IllegalArgumentException(
            "Given axis.getDimension() is neither Chart2D.X nor Chart2D.Y!");
    }
  }
  return result;
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:32,代码来源:AxisTitlePainterDefault.java


注:本文中的info.monitorenter.gui.chart.IAxis类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。