Java Code Examples for org.jfree.chart.plot.ValueMarker#setStroke()

The following examples show how to use org.jfree.chart.plot.ValueMarker#setStroke() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getStroke() and setStroke() methods.
 */
public void testGetSetStroke() {
    // we use ValueMarker for the tests, because we need a concrete
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(new BasicStroke(0.5f), m.getStroke());
    m.setStroke(new BasicStroke(1.1f));
    assertEquals(new BasicStroke(1.1f), m.getStroke());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setStroke(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 2
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getStroke() and setStroke() methods.
 */
public void testGetSetStroke() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(new BasicStroke(0.5f), m.getStroke());
    m.setStroke(new BasicStroke(1.1f));
    assertEquals(new BasicStroke(1.1f), m.getStroke());
    assertEquals(m, this.lastEvent.getMarker());
    
    // check null argument...
    try {
        m.setStroke(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example 3
Source File: KafkaFT.java    From flink-perf with Apache License 2.0 5 votes vote down vote up
private static void addKillEvent(XYPlot xyplot, long pos) {
	ValueMarker vm = new ValueMarker(pos);
	vm.setPaint(ChartColor.VERY_DARK_GREEN);
	vm.setLabelOffset(new RectangleInsets(10.0D, 1.0D, 1.0D, 1.0D));
	vm.setLabel("Container Kill Event");
	vm.setStroke(new BasicStroke(2));
	xyplot.addDomainMarker(vm);
}
 
Example 4
Source File: KafkaFT.java    From flink-perf with Apache License 2.0 5 votes vote down vote up
private static void addIllegalEvent(XYPlot xyplot, long pos) {
	ValueMarker vm = new ValueMarker(pos);
	vm.setPaint(ChartColor.LIGHT_YELLOW);
	vm.setLabelOffset(new RectangleInsets(10.0D, 1.0D, 1.0D, 1.0D));
	vm.setLabel("Illegal State");
	vm.setStroke(new BasicStroke(2));
	xyplot.addDomainMarker(vm);
}
 
Example 5
Source File: MouseListenerValue.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
protected ValueMarker makeMarker( final double value )
{
	final ValueMarker valueMarker = new ValueMarker( value );
	valueMarker.setStroke( new BasicStroke ( 2f ) );
	valueMarker.setPaint( new Color( 0f/255f, 0f/255f, 255f/255f ) );
	valueMarker.setLabel( " Distance=" + value );
	valueMarker.setLabelPaint( Color.BLUE );
	valueMarker.setLabelAnchor( RectangleAnchor.TOP );
	valueMarker.setLabelTextAnchor( TextAnchor.TOP_LEFT );

	return valueMarker;
}
 
Example 6
Source File: MouseListenerTimelapse.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
protected ValueMarker makeMarker( final int timePoint )
{
	final ValueMarker valueMarker = new ValueMarker( timePoint );
	valueMarker.setStroke( new BasicStroke ( 1.5f ) );
	valueMarker.setPaint( new Color( 0.0f, 93f/255f, 9f/255f ) );
	valueMarker.setLabel( " Reference\n Timepoint " + timePoint );
	valueMarker.setLabelAnchor(RectangleAnchor.BOTTOM );
	valueMarker.setLabelTextAnchor( TextAnchor.BOTTOM_LEFT );
	
	return valueMarker;
}
 
Example 7
Source File: MouseListenerTimelapse.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
protected ValueMarker makeMarker( final int timePoint )
{
	final ValueMarker valueMarker = new ValueMarker( timePoint );
	valueMarker.setStroke( new BasicStroke ( 1.5f ) );
	valueMarker.setPaint( new Color( 0.0f, 93f/255f, 9f/255f ) );
	valueMarker.setLabel( " Reference\n Timepoint " + timePoint );
	valueMarker.setLabelAnchor(RectangleAnchor.BOTTOM );
	valueMarker.setLabelTextAnchor( TextAnchor.BOTTOM_LEFT );
	
	return valueMarker;
}
 
Example 8
Source File: MultiSpectraVisualizerWindow.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
private JPanel addSpectra(int scan) {
  JPanel panel = new JPanel(new BorderLayout());
  // Split pane for eic plot (top) and spectrum (bottom)
  JSplitPane bottomPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

  // Create EIC plot
  // labels for TIC visualizer
  Map<Feature, String> labelsMap = new HashMap<Feature, String>(0);

  Feature peak = row.getPeak(activeRaw);

  // scan selection
  ScanSelection scanSelection = new ScanSelection(activeRaw.getDataRTRange(1), 1);

  // mz range
  Range<Double> mzRange = null;
  mzRange = peak.getRawDataPointsMZRange();
  // optimize output by extending the range
  double upper = mzRange.upperEndpoint();
  double lower = mzRange.lowerEndpoint();
  double fiveppm = (upper * 5E-6);
  mzRange = Range.closed(lower - fiveppm, upper + fiveppm);

  // labels
  labelsMap.put(peak, peak.toString());

  // get EIC window
  TICVisualizerWindow window = new TICVisualizerWindow(new RawDataFile[] {activeRaw}, // raw
      TICPlotType.BASEPEAK, // plot type
      scanSelection, // scan selection
      mzRange, // mz range
      null,
      // new Feature[] {peak}, // selected features
      labelsMap); // labels

  // get EIC Plot
  TICPlot ticPlot = window.getTICPlot();
  // ticPlot.setPreferredSize(new Dimension(600, 200));
  ticPlot.getChart().getLegend().setVisible(false);

  // add a retention time Marker to the EIC
  ValueMarker marker = new ValueMarker(activeRaw.getScan(scan).getRetentionTime());
  marker.setPaint(Color.RED);
  marker.setStroke(new BasicStroke(3.0f));

  XYPlot plot = (XYPlot) ticPlot.getChart().getPlot();
  plot.addDomainMarker(marker);
  // bottomPane.add(ticPlot);
  bottomPane.setResizeWeight(0.5);
  bottomPane.setEnabled(true);
  bottomPane.setDividerSize(5);
  bottomPane.setDividerLocation(200);

  JSplitPane spectrumPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);

  // get MS/MS spectra window
  SpectraVisualizerWindow spectraWindow = new SpectraVisualizerWindow(activeRaw);
  spectraWindow.loadRawData(activeRaw.getScan(scan));

  // get MS/MS spectra plot
  SpectraPlot spectrumPlot = spectraWindow.getSpectrumPlot();
  spectrumPlot.getChart().getLegend().setVisible(false);
  // spectrumPlot.setPreferredSize(new Dimension(600, 400));
  // spectrumPane.add(spectrumPlot);
  // spectrumPane.add(spectraWindow.getToolBar());
  spectrumPane.setResizeWeight(1);
  spectrumPane.setEnabled(false);
  spectrumPane.setDividerSize(0);
  bottomPane.add(spectrumPane);
  panel.add(bottomPane);
  panel.setBorder(BorderFactory.createLineBorder(Color.black));
  return panel;
}
 
Example 9
Source File: MultiSpectraVisualizerWindow.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
private JPanel addSpectra(int scan) {
  JPanel panel = new JPanel(new BorderLayout());
  // Split pane for eic plot (top) and spectrum (bottom)
  JSplitPane bottomPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

  // Create EIC plot
  // labels for TIC visualizer
  Map<Feature, String> labelsMap = new HashMap<Feature, String>(0);

  Feature peak = row.getPeak(activeRaw);

  // scan selection
  ScanSelection scanSelection = new ScanSelection(activeRaw.getDataRTRange(1), 1);

  // mz range
  Range<Double> mzRange = null;
  mzRange = peak.getRawDataPointsMZRange();
  // optimize output by extending the range
  double upper = mzRange.upperEndpoint();
  double lower = mzRange.lowerEndpoint();
  double fiveppm = (upper * 5E-6);
  mzRange = Range.closed(lower - fiveppm, upper + fiveppm);

  // labels
  labelsMap.put(peak, peak.toString());

  // get EIC window
  TICVisualizerWindow window = new TICVisualizerWindow(new RawDataFile[] {activeRaw}, // raw
      TICPlotType.BASEPEAK, // plot type
      scanSelection, // scan selection
      mzRange, // mz range
      new Feature[] {peak}, // selected features
      labelsMap); // labels

  // get EIC Plot
  TICPlot ticPlot = window.getTICPlot();
  ticPlot.setPreferredSize(new Dimension(600, 200));
  ticPlot.getChart().getLegend().setVisible(false);

  // add a retention time Marker to the EIC
  ValueMarker marker = new ValueMarker(activeRaw.getScan(scan).getRetentionTime());
  marker.setPaint(Color.RED);
  marker.setStroke(new BasicStroke(3.0f));

  XYPlot plot = (XYPlot) ticPlot.getChart().getPlot();
  plot.addDomainMarker(marker);
  bottomPane.add(ticPlot);
  bottomPane.setResizeWeight(0.5);
  bottomPane.setEnabled(true);
  bottomPane.setDividerSize(5);
  bottomPane.setDividerLocation(200);

  JSplitPane spectrumPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);

  // get MS/MS spectra window
  SpectraVisualizerWindow spectraWindow = new SpectraVisualizerWindow(activeRaw);
  spectraWindow.loadRawData(activeRaw.getScan(scan));

  // get MS/MS spectra plot
  SpectraPlot spectrumPlot = spectraWindow.getSpectrumPlot();
  spectrumPlot.getChart().getLegend().setVisible(false);
  spectrumPlot.setPreferredSize(new Dimension(600, 400));
  spectrumPane.add(spectrumPlot);
  spectrumPane.add(spectraWindow.getToolBar());
  spectrumPane.setResizeWeight(1);
  spectrumPane.setEnabled(false);
  spectrumPane.setDividerSize(0);
  bottomPane.add(spectrumPane);
  panel.add(bottomPane);
  panel.setBorder(BorderFactory.createLineBorder(Color.black));
  return panel;
}