Java Code Examples for org.jfree.chart.renderer.xy.XYItemRenderer#setDefaultItemLabelPaint()

The following examples show how to use org.jfree.chart.renderer.xy.XYItemRenderer#setDefaultItemLabelPaint() . 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: PseudoSpectrum.java    From mzmine3 with GNU General Public License v2.0 6 votes vote down vote up
public static EChartPanel createChartPanel(PeakListRow[] group, RawDataFile raw, boolean sum,
    String title) {
  PseudoSpectrumDataSet data = createDataSet(group, raw, sum);
  if (data == null)
    return null;
  JFreeChart chart = createChart(data, raw, sum, title);
  if (chart != null) {
    EChartPanel pn = new EChartPanel(chart);
    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    PseudoSpectraItemLabelGenerator labelGenerator = new PseudoSpectraItemLabelGenerator(pn);
    renderer.setDefaultItemLabelsVisible(true);
    renderer.setDefaultItemLabelPaint(Color.BLACK);
    renderer.setSeriesItemLabelGenerator(0, labelGenerator);
    return pn;
  }

  return null;
}
 
Example 2
Source File: SpectraPlot.java    From mzmine3 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This will set either centroid or continuous renderer to the first data set, assuming that
 * dataset with index 0 contains the raw data.
 */
public void setPlotMode(MassSpectrumType plotMode) {

  this.plotMode = plotMode;

  XYDataset dataSet = plot.getDataset(0);
  if (!(dataSet instanceof ScanDataSet))
    return;

  XYItemRenderer newRenderer;
  if (plotMode == MassSpectrumType.CENTROIDED) {
    newRenderer = new PeakRenderer(SpectraVisualizerWindow.scanColor, false);
  } else {
    newRenderer = new ContinuousRenderer(SpectraVisualizerWindow.scanColor, false);
    ((ContinuousRenderer) newRenderer).setDefaultShapesVisible(dataPointsVisible);
  }

  // Add label generator for the dataset
  SpectraItemLabelGenerator labelGenerator = new SpectraItemLabelGenerator(this);
  newRenderer.setDefaultItemLabelGenerator(labelGenerator);
  newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
  newRenderer.setDefaultItemLabelPaint(theme.getItemLabelPaint());

  plot.setRenderer(0, newRenderer);

}
 
Example 3
Source File: PseudoSpectrum.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
public static EChartPanel createChartPanel(PeakListRow[] group, RawDataFile raw, boolean sum,
    String title) {
  PseudoSpectrumDataSet data = createDataSet(group, raw, sum);
  if (data == null)
    return null;
  JFreeChart chart = createChart(data, raw, sum, title);
  if (chart != null) {
    EChartPanel pn = new EChartPanel(chart);
    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    PseudoSpectraItemLabelGenerator labelGenerator = new PseudoSpectraItemLabelGenerator(pn);
    renderer.setDefaultItemLabelsVisible(true);
    renderer.setDefaultItemLabelPaint(Color.BLACK);
    renderer.setSeriesItemLabelGenerator(0, labelGenerator);
    return pn;
  }

  return null;
}
 
Example 4
Source File: SpectraPlot.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This will set either centroid or continuous renderer to the first data set, assuming that
 * dataset with index 0 contains the raw data.
 */
public void setPlotMode(MassSpectrumType plotMode) {

  this.plotMode = plotMode;

  XYDataset dataSet = plot.getDataset(0);
  if (!(dataSet instanceof ScanDataSet))
    return;

  XYItemRenderer newRenderer;
  if (plotMode == MassSpectrumType.CENTROIDED) {
    newRenderer = new PeakRenderer(SpectraVisualizerWindow.scanColor, false);
  } else {
    newRenderer = new ContinuousRenderer(SpectraVisualizerWindow.scanColor, false);
    ((ContinuousRenderer) newRenderer).setDefaultShapesVisible(dataPointsVisible);
  }

  // Add label generator for the dataset
  SpectraItemLabelGenerator labelGenerator = new SpectraItemLabelGenerator(this);
  newRenderer.setDefaultItemLabelGenerator(labelGenerator);
  newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
  newRenderer.setDefaultItemLabelPaint(labelsColor);

  plot.setRenderer(0, newRenderer);

}
 
Example 5
Source File: SpectrumChartFactory.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
public static EChartPanel createChartPanel(JFreeChart chart) {
  if (chart == null)
    return null;
  //
  EChartPanel pn = new EChartPanel(chart);
  XYItemRenderer renderer = chart.getXYPlot().getRenderer();
  PseudoSpectraItemLabelGenerator labelGenerator = new PseudoSpectraItemLabelGenerator(pn);
  renderer.setDefaultItemLabelsVisible(true);
  renderer.setDefaultItemLabelPaint(Color.BLACK);
  renderer.setSeriesItemLabelGenerator(0, labelGenerator);
  return pn;
}
 
Example 6
Source File: SpectraPlot.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
public synchronized void addDataSet(XYDataset dataSet, Color color, boolean transparency) {

    XYItemRenderer newRenderer;

    if (dataSet instanceof ScanDataSet) {
      ScanDataSet scanDataSet = (ScanDataSet) dataSet;
      Scan scan = scanDataSet.getScan();
      if (scan.getSpectrumType() == MassSpectrumType.CENTROIDED)
        newRenderer = new PeakRenderer(color, transparency);
      else {
        newRenderer = new ContinuousRenderer(color, transparency);
        ((ContinuousRenderer) newRenderer).setDefaultShapesVisible(dataPointsVisible);
      }

      // Add label generator for the dataset
      SpectraItemLabelGenerator labelGenerator = new SpectraItemLabelGenerator(this);
      newRenderer.setDefaultItemLabelGenerator(labelGenerator);
      newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
      newRenderer.setDefaultItemLabelPaint(theme.getItemLabelPaint());

    } else {
      newRenderer = new PeakRenderer(color, transparency);
    }

    plot.setDataset(numOfDataSets, dataSet);
    plot.setRenderer(numOfDataSets, newRenderer);
    numOfDataSets++;

    if (dataSet instanceof ScanDataSet)
      checkAndRunController();
  }
 
Example 7
Source File: SpectraPlot.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
public synchronized void addDataSet(XYDataset dataSet, Color color, boolean transparency,
    XYItemLabelGenerator labelGenerator) {

  XYItemRenderer newRenderer;

  if (dataSet instanceof ScanDataSet) {
    ScanDataSet scanDataSet = (ScanDataSet) dataSet;
    Scan scan = scanDataSet.getScan();
    if (scan.getSpectrumType() == MassSpectrumType.CENTROIDED)
      newRenderer = new PeakRenderer(color, transparency);
    else {
      newRenderer = new ContinuousRenderer(color, transparency);
      ((ContinuousRenderer) newRenderer).setDefaultShapesVisible(dataPointsVisible);
    }

    // Add label generator for the dataset
    newRenderer.setDefaultItemLabelGenerator(labelGenerator);
    newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
    newRenderer.setDefaultItemLabelPaint(theme.getItemLabelPaint());

  } else {
    newRenderer = new PeakRenderer(color, transparency);
    // Add label generator for the dataset
    newRenderer.setDefaultItemLabelGenerator(labelGenerator);
    newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
    newRenderer.setDefaultItemLabelPaint(theme.getItemLabelPaint());
  }

  plot.setDataset(numOfDataSets, dataSet);
  plot.setRenderer(numOfDataSets, newRenderer);
  numOfDataSets++;

  if (dataSet instanceof ScanDataSet)
    checkAndRunController();
}
 
Example 8
Source File: SpectrumChartFactory.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
public static EChartPanel createChartPanel(JFreeChart chart) {
  if (chart == null)
    return null;
  //
  EChartPanel pn = new EChartPanel(chart);
  XYItemRenderer renderer = chart.getXYPlot().getRenderer();
  PseudoSpectraItemLabelGenerator labelGenerator = new PseudoSpectraItemLabelGenerator(pn);
  renderer.setDefaultItemLabelsVisible(true);
  renderer.setDefaultItemLabelPaint(Color.BLACK);
  renderer.setSeriesItemLabelGenerator(0, labelGenerator);
  return pn;
}
 
Example 9
Source File: SpectraPlot.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
public synchronized void addDataSet(XYDataset dataSet, Color color, boolean transparency) {

    XYItemRenderer newRenderer;

    if (dataSet instanceof ScanDataSet) {
      ScanDataSet scanDataSet = (ScanDataSet) dataSet;
      Scan scan = scanDataSet.getScan();
      if (scan.getSpectrumType() == MassSpectrumType.CENTROIDED)
        newRenderer = new PeakRenderer(color, transparency);
      else {
        newRenderer = new ContinuousRenderer(color, transparency);
        ((ContinuousRenderer) newRenderer).setDefaultShapesVisible(dataPointsVisible);
      }

      // Add label generator for the dataset
      SpectraItemLabelGenerator labelGenerator = new SpectraItemLabelGenerator(this);
      newRenderer.setDefaultItemLabelGenerator(labelGenerator);
      newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
      newRenderer.setDefaultItemLabelPaint(labelsColor);

    } else {
      newRenderer = new PeakRenderer(color, transparency);
    }

    plot.setDataset(numOfDataSets, dataSet);
    plot.setRenderer(numOfDataSets, newRenderer);
    numOfDataSets++;

    if (dataSet instanceof ScanDataSet)
      checkAndRunController();
  }
 
Example 10
Source File: SpectraPlot.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
public synchronized void addDataSet(XYDataset dataSet, Color color, boolean transparency,
    XYItemLabelGenerator labelGenerator) {

  XYItemRenderer newRenderer;

  if (dataSet instanceof ScanDataSet) {
    ScanDataSet scanDataSet = (ScanDataSet) dataSet;
    Scan scan = scanDataSet.getScan();
    if (scan.getSpectrumType() == MassSpectrumType.CENTROIDED)
      newRenderer = new PeakRenderer(color, transparency);
    else {
      newRenderer = new ContinuousRenderer(color, transparency);
      ((ContinuousRenderer) newRenderer).setDefaultShapesVisible(dataPointsVisible);
    }

    // Add label generator for the dataset
    newRenderer.setDefaultItemLabelGenerator(labelGenerator);
    newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
    newRenderer.setDefaultItemLabelPaint(labelsColor);

  } else {
    newRenderer = new PeakRenderer(color, transparency);
    // Add label generator for the dataset
    newRenderer.setDefaultItemLabelGenerator(labelGenerator);
    newRenderer.setDefaultItemLabelsVisible(itemLabelsVisible);
    newRenderer.setDefaultItemLabelPaint(labelsColor);
  }

  plot.setDataset(numOfDataSets, dataSet);
  plot.setRenderer(numOfDataSets, newRenderer);
  numOfDataSets++;

  if (dataSet instanceof ScanDataSet)
    checkAndRunController();
}