renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesPaint(1, peptideShakerGUI.getSparklineColor());
distributionChart.getCategoryPlot().setRenderer(renderer);
// add mouse listener
distributionChartPanel.addChartMouseListener(new ChartMouseListener() {
@Override
public void chartMouseClicked(ChartMouseEvent cme) {
if (cme.getEntity() instanceof CategoryItemEntity) {
CategoryItemEntity categoryItem = (CategoryItemEntity) cme.getEntity();
String columnKey = (String) categoryItem.getColumnKey();
// select and highlight category
boolean categoryFound = false;
for (int i = 0; i < goMappingsTable.getRowCount() && !categoryFound; i++) {
if (((String) goMappingsTable.getValueAt(
i, goMappingsTable.getColumn("GO Term").getModelIndex())).equalsIgnoreCase(columnKey)) {
goMappingsTable.setRowSelectionInterval(i, i);
goMappingsTable.scrollRectToVisible(goMappingsTable.getCellRect(i, 0, false));
goMappingsTableMouseReleased(null);
}
}
}
}
@Override
public void chartMouseMoved(ChartMouseEvent cme) {
// do nothing
}
});
// set background color
distributionChart.getPlot().setBackgroundPaint(Color.WHITE);
distributionChart.setBackgroundPaint(Color.WHITE);
distributionChartPanel.setBackground(Color.WHITE);
// hide the outline
distributionChart.getPlot().setOutlineVisible(false);
goFrequencyPlotPanel.removeAll();
goFrequencyPlotPanel.add(distributionChartPanel);
goFrequencyPlotPanel.revalidate();
goFrequencyPlotPanel.repaint();
JFreeChart significanceChart = ChartFactory.createBarChart(null, "GO Terms", "Log2 Difference", significancePlotDataset, PlotOrientation.VERTICAL, false, true, true);
signChartPanel = new ChartPanel(significanceChart);
((CategoryPlot) signChartPanel.getChart().getPlot()).getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_90);
((CategoryPlot) signChartPanel.getChart().getPlot()).getRangeAxis().setUpperBound(maxLog2Diff);
((CategoryPlot) signChartPanel.getChart().getPlot()).getRangeAxis().setLowerBound(-maxLog2Diff);
BarChartColorRenderer signRenderer = new BarChartColorRenderer(significanceColors);
signRenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
significanceChart.getCategoryPlot().setRenderer(signRenderer);
// add mouse listener
signChartPanel.addChartMouseListener(new ChartMouseListener() {
@Override
public void chartMouseClicked(ChartMouseEvent cme) {
if (cme.getEntity() instanceof CategoryItemEntity) {
CategoryItemEntity categoryItem = (CategoryItemEntity) cme.getEntity();