• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Chart2D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MultiTracing

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/** Defcon. */
public MultiTracing() {
  super("MultiTracing");
  this.m_chart = new Chart2D();
  this.m_chart.getAxisX().setPaintGrid(true);
  this.m_chart.getAxisY().setPaintGrid(true);
  this.m_chart.setBackground(Color.lightGray);
  this.m_chart.setGridColor(new Color(0xDD, 0xDD, 0xDD));
  // add WindowListener
  this.addWindowListener(new WindowAdapter() {
    /**
     * @see java.awt.event.WindowAdapter#windowClosing(java.awt.event.WindowEvent)
     */
    @Override
    public void windowClosing(final WindowEvent e) {
      System.exit(0);
    }
  });
  Container contentPane = this.getContentPane();
  contentPane.setLayout(new BorderLayout());
  contentPane.add(new ChartPanel(this.m_chart), BorderLayout.CENTER);
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:23,代码来源:MultiTracing.java


示例2: testLabelSpacing

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * Creates a a chart with three traces and different labels and displays it.
 * <p>
 * 
 * @throws InterruptedException
 */
public void testLabelSpacing() throws InterruptedException {
  JFrame frame = new JFrame(this.getName());
  Chart2D chart = new Chart2D();
  ITrace2D trace1 = new Trace2DLtd();
  trace1.setName("lottolotto");
  trace1.setColor(Color.RED);
  chart.addTrace(trace1);

  ITrace2D trace2 = new Trace2DLtd();
  trace2.setName("bbb");
  trace2.setColor(Color.BLUE);
  chart.addTrace(trace2);

  ITrace2D trace3 = new Trace2DLtd();
  trace3.setColor(Color.BLACK);
  trace3.setName("ffollejolle");
  chart.addTrace(trace3);
  frame.getContentPane().add(chart);
  frame.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
  frame.setSize(new Dimension(400, 300));
  frame.setVisible(true);
  while (frame.isVisible()) {
    Thread.sleep(1000);
  }
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:32,代码来源:LabelSpacingTestChart.java


示例3: InitChart

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * Initialize a chart.  This should happen before you want to use
 * the chart, either for storing data or displaying data.  It's best
 * to delay the inits until you need them, because making a lot of charts
 * seems to slow down chart interactions.
 *
 * @param name Name of the trace you want to init
 * @return the created chart object
 */
public Chart2D InitChart(String name)
{
    Chart2D chart = new Chart2D();

    ITrace2D trace = new Trace2DLtd(chartData.sparklineChartSize, name);

    chart.addTrace(trace);

    // add marker lines to the trace
    TracePainterDisc markerPainter = new TracePainterDisc();
    markerPainter.setDiscSize(2);
    trace.addTracePainter(markerPainter);

    return chart;
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:25,代码来源:ObjectPanel.java


示例4: propertyChangeSynced

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * @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;
  // now points added or removed -> rescale!
  if (Chart2D.DEBUG_SCALING) {
    System.out.println("pc-tp");
  }
  final ITracePoint2D oldPt = (ITracePoint2D) changeEvent.getOldValue();
  final ITracePoint2D newPt = (ITracePoint2D) changeEvent.getNewValue();
  // added or removed?
  // we only care about added points (rescaling is our task)
  if (oldPt == null) {
    receiver.scalePoint(newPt);
    result = true;
  }
  return result;
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:23,代码来源:AAxis.java


示例5: scalePoint

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


示例6: unlisten2Trace

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


示例7: createAccessor

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


示例8: expandMaxYErrorBarBounds

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * Internally takes into account that in case of error bars to render the
 * maximum y value will be different.
 * <p>
 * Returns true if a change to <code>{@link #getMaxY()}</code> was done.
 * <p>
 * 
 * @return true if a change to <code>{@link #getMaxY()}</code> was done.
 */
private boolean expandMaxYErrorBarBounds() {
  final Chart2D chart = this.getRenderer();
  boolean change = false;
  double errorBarMaxYCollect = -Double.MAX_VALUE;
  if (chart != null) {
    double errorBarMaxY = -Double.MAX_VALUE;
    for (final IErrorBarPolicy< ? > errorBarPolicy : this.m_errorBarPolicies) {
      if (errorBarPolicy.isShowPositiveYErrors()) {
        errorBarMaxY = errorBarPolicy.getYError(this.m_maxY);
        if (errorBarMaxY > errorBarMaxYCollect) {
          errorBarMaxYCollect = errorBarMaxY;
        }
      }
    }
  }
  final double absoluteMax = errorBarMaxYCollect + this.m_maxY;
  if (!MathUtil.assertEqual(this.m_maxYErrorBar, absoluteMax, 0.00000001)) {
    this.m_maxYErrorBar = absoluteMax;
    change = true;
  }
  return change;

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


示例9: maxXSearch

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * Internal search for the maximum x value that is only invoked if no cached
 * value is at hand or bounds have changed by adding new points.
 * <p>
 * The result is assigned to the property maxX.
 * <p>
 * 
 * @see #getMaxX()
 */
protected void maxXSearch() {
  if (Chart2D.DEBUG_THREADING) {
    System.out.println("trace.maxXSearch, 0 locks");
  }

  synchronized (this) {
    if (Chart2D.DEBUG_THREADING) {
      System.out.println("trace.maxXSearch, 1 locks");
    }
    double ret = -Double.MAX_VALUE;
    ITracePoint2D tmpoint = null;
    double tmp;
    final Iterator<ITracePoint2D> it = this.iterator();
    while (it.hasNext()) {
      tmpoint = it.next();
      tmp = tmpoint.getX();
      if (tmp > ret) {
        ret = tmp;
      }
    }
    this.m_maxX = ret;
  }
  // compute the extra amount in case of error bar painters:
  this.expandMaxXErrorBarBounds();
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:35,代码来源:ATrace2D.java


示例10: createTraceStrokesMenu

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * Creates a menu for choosing the {@link Stroke} of the given trace.
 * <p>
 * 
 * @param chart
 *          needed to adapt the basic ui properties to (font, foreground
 *          color, background color).
 * @param trace
 *          the trace to set the stroke of.
 * @param adaptUI2Chart
 *          if true the menu will adapt it's basic UI properies (font,
 *          foreground and background color) to the given chart.
 * @return a menu for choosing the stroke of the given trace.
 */
public JMenu createTraceStrokesMenu(final Chart2D chart, final ITrace2D trace,
    final boolean adaptUI2Chart) {
  JMenuItem item;
  // strokes
  JMenu strokesMenu;
  if (adaptUI2Chart) {
    strokesMenu = new PropertyChangeMenu(chart, "Stroke",
        new BasicPropertyAdaptSupport.RemoveAsListenerFromComponentIfTraceIsDropped(trace));
  } else {
    strokesMenu = new JMenu("Stroke");
  }
  for (int i = 0; i < this.m_strokes.length; i++) {
    if (adaptUI2Chart) {
      item = new PropertyChangeMenuItem(chart, new Trace2DActionSetStroke(trace,
          this.m_strokeNames[i], this.m_strokes[i]),
          new BasicPropertyAdaptSupport.RemoveAsListenerFromComponentIfTraceIsDropped(trace));
    } else {
      item = new JMenuItem(new Trace2DActionSetStroke(trace, this.m_strokeNames[i],
          this.m_strokes[i]));
    }
    strokesMenu.add(item);
  }
  return strokesMenu;
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:39,代码来源:LayoutFactory.java


示例11: getAxis

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


示例12: plot

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
public static void plot (String title, String xlabel, String ylabel, double[] data) {

	//////////////////////////////////
	// Create a chart:		
	//////////////////////////////////
	Chart2D chart = new Chart2D();
	
	// Create an ITrace:
	ITrace2D trace = new Trace2DSimple();

	// Add the trace to the chart. This has to be done before adding points
	chart.addTrace(trace);
	// Add all points, as it is static:
	for (int i = 0; i < data.length; i++) {
		trace.addPoint(i, data[i]);
	}
	chart.getAxisX().setAxisTitle(new AxisTitle(xlabel));
	chart.getAxisY().setAxisTitle(new AxisTitle(ylabel));
	
	// Make it visible:
	// Create a frame.
	JFrame frame = new JFrame(title);
	// add the chart to the frame:
	frame.getContentPane().add(chart);		
	frame.setSize(Toolkit.getDefaultToolkit().getScreenSize().width, 400);
	
	// Enable the termination button [cross on the upper right edge]:
	frame.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}
	});
	frame.setVisible(true);
}
 
开发者ID:siemens,项目名称:industrialbenchmark,代码行数:35,代码来源:PlotCurve.java


示例13: ChartPanel

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


示例14: MinimalStaticChartWithNanValues

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * Defcon.
 */
private MinimalStaticChartWithNanValues() {
  this.setLayout(new BorderLayout());
  Chart2D chart = new Chart2D();

  // 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:
  trace.addPoint(0, 0);
  trace.addPoint(1, 10);
  trace.addPoint(2, Double.NaN);
  trace.addPoint(3, 10);
  trace.addPoint(4, 15);
  trace.addPoint(5, Double.NaN);
  trace.addPoint(6, 16);
  trace.addPoint(7, 14);
  trace.addPoint(8, 13);
 
  chart.setToolTipType(Chart2D.ToolTipType.VALUE_SNAP_TO_TRACEPOINTS);

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

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


示例15: paintComponent

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * Finalized to enforce using
 * <code>{@link #paintAnnotation(Graphics, Chart2D, ITrace2D, ITracePoint2D)}</code>.
 * 
 * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
 */
@Override
protected final synchronized void paintComponent(final Graphics g) {
  super.paintComponent(g);
  // NPE candidate, but must never be null by contract. So exceptions are
  // welcome to fix programming errors.
  ITrace2D trace = this.m_annotatedPoint.getListener();
  Chart2D chart = trace.getRenderer();
  this.paintAnnotation(g, chart, trace, this.m_annotatedPoint);
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:16,代码来源:AAnnotationContentComponent.java


示例16: init

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * @see java.applet.Applet#init()
 */
@Override
public void init() {
  super.init();
  Chart2D chart = new Chart2D();
  this.setChart(chart);
  this.setSize(new Dimension(600, 500));
  this.m_chart.getAxisX().setPaintGrid(true);
  this.m_chart.getAxisY().setPaintGrid(true);
  chart.getAxisY().setRangePolicy(new RangePolicyMinimumViewport(new Range(-20, +20)));
  chart.setGridColor(Color.LIGHT_GRAY);
  this.setTrace(new Trace2DLtd(100));
  this.getTrace().setName("random");
  this.getTrace().setPhysicalUnits("Milliseconds", "random value");
  this.getTrace().setColor(Color.RED);
  chart.addTrace(this.getTrace());
  Container content = this.getContentPane();
  content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
  LayoutFactory factory = LayoutFactory.getInstance();
  ChartPanel chartpanel = new ChartPanel(chart);

  this.setJMenuBar(factory.createChartMenuBar(chartpanel, false));

  content.add(chartpanel);
  content.addPropertyChangeListener(chartpanel);
  this.setCollector(new RandomDataCollectorOffset(this.getTrace(), 50));
  content.add(new ControlPanel());
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:31,代码来源:Showcase.java


示例17: main

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * Main entry.
 * <p>
 * 
 * @param args
 *          ignored.
 */
public static void main(final String[] args) {

  Chart2D chart = new Chart2D();
  chart.setUseAntialiasing(true);
  chart.setMinPaintLatency(20);
  ITrace2D data = new Trace2DLtd(300);
  data.setStroke(new BasicStroke(3));
  data.setColor(new Color(255, 0, 0, 255));
  data.setName("random");
  data.setPhysicalUnits("hertz", "ms");

  ITracePainter<?> dotPainter = new TracePainterPolyline();
  data.setTracePainter(dotPainter);
  chart.addTrace(data);

  AntialiasingChart wnd = new AntialiasingChart(chart, "AntialiasingChart");
  chart.getAxisX().setPaintGrid(true);
  chart.getAxisX().setStartMajorTick(false);
  chart.getAxisY().setPaintGrid(true);

  chart.getAxisX().setPaintScale(true);
  chart.getAxisX().setPaintScale(true);

  // force ranges:
  chart.getAxisY().setRangePolicy(new RangePolicyMinimumViewport(new Range(-1e4, +1e4)));
  // chart.setFont(new Font(null,0,12));
  wnd.setLocation(200, 300);
  wnd.setSize(700, 210);
  wnd.setResizable(true);
  wnd.setVisible(true);
  new ObjRecorder2Trace2DAdapter(data, new RandomBumper(0.5, 1000), "m_number", 1000);
}
 
开发者ID:lcm-proj,项目名称:lcm,代码行数:40,代码来源:AntialiasingChart.java


示例18: propertyChange

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
 */
public void propertyChange(final PropertyChangeEvent evt) {
  String property = evt.getPropertyName();
  if (property.equals(Chart2D.PROPERTY_BACKGROUND_COLOR)) {
    Color newColor = (Color) evt.getNewValue();
    if (newColor.equals(this.m_lastChosenColor)) {
      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,代码行数:18,代码来源:JComponentActionSetCustomBackground.java


示例19: StaticChartWithBoxAndTitle

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * Defcon.
 */
private StaticChartWithBoxAndTitle() {
  this.setLayout(new BorderLayout());
  Chart2D chart = new Chart2D();

  // Create an ITrace:
  // Note that dynamic charts need limited amount of values!!!
  // ITrace2D trace = new Trace2DLtd(200);
  ITrace2D trace = new Trace2DSimple();
  // Add the trace to the chart:
  chart.addTrace(trace);
  trace.setColor(Color.RED);

  // Add all points, as it is static:
  double time = System.currentTimeMillis();
  for (int i = 0; i < 120; i++) {
    trace.addPoint(time + i, i);
  }

  ChartPanel chartPanel = new ChartPanel(chart);
  // add a titlede border:

  chartPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory
      .createLineBorder(Color.BLACK), "My Title", TitledBorder.CENTER, TitledBorder.CENTER));

  // Make it visible:
  this.add(chartPanel, BorderLayout.CENTER);

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


示例20: StaticChartErrorBarLineDisc

import info.monitorenter.gui.chart.Chart2D; //导入依赖的package包/类
/**
 * Defcon.
 */
private StaticChartErrorBarLineDisc() {
  this.setLayout(new BorderLayout());
  Chart2D chart = new Chart2D();

  // Create an ITrace:
  // Note that dynamic charts need limited amount of values!!!
  ITrace2D trace = new Trace2DSimple();
  // Add the trace to the chart:
  chart.addTrace(trace);
  trace.setColor(Color.RED);
  // create an error bar policy and configure it
  IErrorBarPolicy< ? > errorBarPolicy = new ErrorBarPolicyAbsoluteSummation(10, 10);
  errorBarPolicy.setShowNegativeYErrors(true);
  errorBarPolicy.setShowPositiveYErrors(true);
  // errorBarPolicy.setShowNegativeXErrors(true);
  // errorBarPolicy.setShowPositiveXErrors(true);
  trace.setErrorBarPolicy(errorBarPolicy);
  // configure how error bars are rendered with an error bar painter:
  IErrorBarPainter errorBarPainter = new ErrorBarPainter();
  errorBarPainter.setEndPointPainter(new PointPainterDisc());
  errorBarPainter.setEndPointColor(Color.GRAY);
  errorBarPainter.setConnectionPainter(new PointPainterLine());
  errorBarPainter.setConnectionColor(Color.LIGHT_GRAY);
  // add the painter to the policy
  errorBarPolicy.setErrorBarPainter(errorBarPainter);

  // Fini: now we have configured how error bars look,
  // which parts they render (end point, start point, segment), in which
  // direction they should extend and what kind of error is calculated.

  // Add all points, as it is static:
  for (double i = 2; i < 40; i++) {
    trace.addPoint(i * 100, Math.random() * i + i * 10);
  }

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

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ContextNotEmptyException类代码示例发布时间:2022-05-22
下一篇:
Java RegistrationInformation类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap