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


Java Chart2D.getAxisX方法代码示例

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


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

示例1: main

import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的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

示例2: internalGetNegativeXError

import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的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

示例3: internalGetPositiveXError

import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的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

示例4: createChart

import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
private Chart2D createChart() {
    Chart2D chart = new Chart2D();
    chart.setPaintLabels(true);
    chart.setUseAntialiasing(true);
    chart.setToolTipType(Chart2D.ToolTipType.VALUE_SNAP_TO_TRACEPOINTS);

    x_achse = chart.getAxisX();
    x_achse.getAxisTitle().setTitle("Minuten");
    x_achse.setPaintScale(true);
    x_achse.setVisible(true);
    x_achse.setPaintGrid(false);
    x_achse.setMajorTickSpacing(10);
    x_achse.setMinorTickSpacing(1);

    IAxis<?> y_achse = chart.getAxisY();
    y_achse.getAxisTitle().setTitle("");
    y_achse.setPaintScale(true);
    y_achse.setVisible(true);
    y_achse.setPaintGrid(true);
    y_achse.setMajorTickSpacing(5);
    y_achse.setMinorTickSpacing(1);
    y_achse.setFormatter(new LabelFormatterAutoUnits());
    y_achse.setRangePolicy(new RangePolicyForcedPoint());

    m_trace.setName("");
    m_trace.setColor(Color.RED);
    chart.addTrace(m_trace);

    return chart;
}
 
开发者ID:mediathekview,项目名称:MediathekView,代码行数:31,代码来源:MVBandwidthMonitorOSX.java

示例5: AxisScalePolicyManualTickChart

import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
 * Defcon.
 */
@SuppressWarnings("unchecked")
private AxisScalePolicyManualTickChart() {
  this.setLayout(new BorderLayout());
  Chart2D chart = new Chart2D();
  /*
   * This does the trick to configure the ticks manually:
   * 
   * Note: The dirty cast is needed as we want to reuse the axis of the chart.
   * If we wanted to avoid it we had to create a new instance and set it.
   */
  IAxis<IAxisScalePolicy> xAxis = (IAxis<IAxisScalePolicy>)chart.getAxisX();
  xAxis.setAxisScalePolicy(new AxisScalePolicyManualTicks()); 
  xAxis.setMajorTickSpacing(10);
  xAxis.setMinorTickSpacing(1);
  xAxis.setStartMajorTick(true);
  
  IAxis<IAxisScalePolicy> yAxis = (IAxis<IAxisScalePolicy>)chart.getAxisY();
  yAxis.setAxisScalePolicy(new AxisScalePolicyManualTicks()); 
  yAxis.setMajorTickSpacing(50);
  yAxis.setMinorTickSpacing(10);
  yAxis.setStartMajorTick(true);

  // Note that AxixScalePolicyManualTicks should start with the first label with respect to the range policy:
  IRangePolicy rangePolicyX =  new RangePolicyFixedViewport( new Range( 30,100 )); 
  xAxis.setRangePolicy(rangePolicyX);
  
  IRangePolicy rangePolicyY = new RangePolicyFixedViewport( new Range( 15,100 ));
  yAxis.setRangePolicy(rangePolicyY);
  
  // Create an ITrace:
  // Note that dynamic charts need limited amount of values!!!
  // ITrace2D trace = new Trace2DLtd(200);
  ITrace2D trace = new Trace2DSimple();
  trace.setColor(Color.RED);

  // Add the trace to the chart:
  chart.addTrace(trace);

  // Add all points, as it is static:
  for (int i = 21; i <= 40; i++) {
    trace.addPoint(i, /*100.0/(i+1.0)*/i);
  }

  
  chart.setToolTipType(Chart2D.ToolTipType.VALUE_SNAP_TO_TRACEPOINTS);

  // Make it visible:
  this.add(new ChartPanel(chart), BorderLayout.CENTER);

}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:54,代码来源:AxisScalePolicyManualTickChart.java


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