use of org.jfree.chart.axis.ValueAxis in project mafscaling by vimsh.
the class MafRescale method createGraghPanel.
private void createGraghPanel(JPanel dataPanel) {
JFreeChart chart = ChartFactory.createScatterPlot(null, null, null, null, PlotOrientation.VERTICAL, false, true, false);
chart.setBorderVisible(true);
mafChartPanel = new MafChartPanel(chart, this);
GridBagConstraints gbl_chartPanel = new GridBagConstraints();
gbl_chartPanel.anchor = GridBagConstraints.PAGE_START;
gbl_chartPanel.insets = insets0;
gbl_chartPanel.fill = GridBagConstraints.BOTH;
gbl_chartPanel.weightx = 1.0;
gbl_chartPanel.weighty = 1.0;
gbl_chartPanel.gridx = 0;
gbl_chartPanel.gridy = 2;
dataPanel.add(mafChartPanel.getChartPanel(), gbl_chartPanel);
XYSplineRenderer lineRenderer = new XYSplineRenderer(3);
lineRenderer.setUseFillPaint(true);
lineRenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new DecimalFormat("0.00"), new DecimalFormat("0.00")));
Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, null, 0.0f);
lineRenderer.setSeriesStroke(0, stroke);
lineRenderer.setSeriesStroke(1, stroke);
lineRenderer.setSeriesPaint(0, new Color(201, 0, 0));
lineRenderer.setSeriesPaint(1, new Color(0, 0, 255));
lineRenderer.setSeriesShape(0, ShapeUtilities.createDiamond((float) 2.5));
lineRenderer.setSeriesShape(1, ShapeUtilities.createUpTriangle((float) 2.5));
ValueAxis mafvDomain = new NumberAxis(XAxisName);
ValueAxis mafgsRange = new NumberAxis(YAxisName);
XYSeriesCollection lineDataset = new XYSeriesCollection();
lineDataset.addSeries(currMafData);
lineDataset.addSeries(corrMafData);
XYPlot plot = chart.getXYPlot();
plot.setRangePannable(true);
plot.setDomainPannable(true);
plot.setDomainGridlinePaint(Color.DARK_GRAY);
plot.setRangeGridlinePaint(Color.DARK_GRAY);
plot.setBackgroundPaint(new Color(224, 224, 224));
plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);
plot.setDataset(0, lineDataset);
plot.setRenderer(0, lineRenderer);
plot.setDomainAxis(0, mafvDomain);
plot.setRangeAxis(0, mafgsRange);
plot.mapDatasetToDomainAxis(0, 0);
plot.mapDatasetToRangeAxis(0, 0);
LegendTitle legend = new LegendTitle(plot.getRenderer());
legend.setItemFont(new Font("Arial", 0, 10));
legend.setPosition(RectangleEdge.TOP);
chart.addLegend(legend);
}
use of org.jfree.chart.axis.ValueAxis in project mzmine2 by mzmine.
the class MSMSLibrarySubmissionWindow method setOnlyShowOneAxis.
public void setOnlyShowOneAxis(boolean onlyShowOneAxis) {
int i = 0;
forAllCharts(c -> {
// show only the last domain axes
ValueAxis axis = c.getXYPlot().getDomainAxis();
axis.setVisible(!onlyShowOneAxis || i >= group.size());
});
}
use of org.jfree.chart.axis.ValueAxis in project mzmine2 by mzmine.
the class SpectralMatchPanel method rangeHasChanged.
/**
* Apply changes to all other charts
*
* @param range
*/
private void rangeHasChanged(Range range) {
if (setCoupleZoomY) {
ValueAxis axis = libraryPlot.getRangeAxis();
if (!axis.getRange().equals(range))
axis.setRange(range);
ValueAxis axisQuery = queryPlot.getRangeAxis();
if (!axisQuery.getRange().equals(range))
axisQuery.setRange(range);
}
}
use of org.jfree.chart.axis.ValueAxis in project mzmine2 by mzmine.
the class SpectralMatchPanel method coupleZoomYListener.
private void coupleZoomYListener() {
CombinedDomainXYPlot domainPlot = (CombinedDomainXYPlot) mirrorChart.getChart().getXYPlot();
NumberAxis axis = (NumberAxis) domainPlot.getDomainAxis();
axis.setLabel("m/z");
queryPlot = (XYPlot) domainPlot.getSubplots().get(0);
libraryPlot = (XYPlot) domainPlot.getSubplots().get(1);
queryPlot.getRangeAxis().addChangeListener(new AxisRangeChangedListener(null) {
@Override
public void axisRangeChanged(ChartViewWrapper chart, ValueAxis axis, Range lastR, Range newR) {
rangeHasChanged(newR);
}
});
libraryPlot.getRangeAxis().addChangeListener(new AxisRangeChangedListener(null) {
@Override
public void axisRangeChanged(ChartViewWrapper chart, ValueAxis axis, Range lastR, Range newR) {
rangeHasChanged(newR);
}
});
}
use of org.jfree.chart.axis.ValueAxis in project mzmine2 by mzmine.
the class MultiMSMSWindow method renewCharts.
/**
* @param group
*/
public void renewCharts(ChartGroup group) {
pnCharts.removeAll();
if (group != null && group.size() > 0) {
realCol = autoCol ? (int) Math.floor(Math.sqrt(group.size())) - 1 : col;
if (realCol < 1)
realCol = 1;
GridLayout layout = new GridLayout(0, realCol);
pnCharts.setLayout(layout);
// add to layout
int i = 0;
for (ChartViewWrapper cp : group.getList()) {
// show only the last domain axes
ValueAxis axis = cp.getChart().getXYPlot().getDomainAxis();
axis.setVisible(!onlyShowOneAxis || i >= group.size() - realCol);
pnCharts.add(cp.getChartSwing());
i++;
}
}
pnCharts.revalidate();
pnCharts.repaint();
}
Aggregations