Skip to content

Commit 3a4147c

Browse files
committed
Makes labels of Heat Map legend readable when chart has too many items.
1 parent a18004b commit 3a4147c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/legend/LegendPanel.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,12 @@ private JPanel getNodeChartPanel() {
510510

511511
int h = 200;
512512

513-
if (options.getChartOptions() != null
514-
&& options.getChartOptions().getType() == ChartType.HEAT_STRIPS
515-
&& options.getDataSets().size() > 4)
516-
h = 300;
513+
if (options.getChartOptions() != null) {
514+
if (options.getChartOptions().getType() == ChartType.HEAT_STRIPS && options.getDataSets().size() > 4)
515+
h = 300;
516+
else if (options.getChartOptions().getType() == ChartType.HEAT_MAP)
517+
h = Math.max(180, 62 + options.getDataSets().size() * 24);
518+
}
517519

518520
GroupLayout layout = (GroupLayout) nodeChartPanel.getLayout();
519521

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/ChartUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ public static JFreeChart createHeatMapLegend(List<EMDataSet> dataSets, ChartOpti
224224
domainAxis.setAxisLineVisible(false);
225225
domainAxis.setTickMarksVisible(false);
226226
domainAxis.setTickLabelFont(UIManager.getFont("Label.font").deriveFont(LookAndFeelUtil.getSmallFontSize()));
227-
domainAxis.setLabelPaint(UIManager.getColor("Label.foreground"));
227+
domainAxis.setTickLabelPaint(UIManager.getColor("Label.foreground"));
228+
domainAxis.setTickLabelInsets(new RectangleInsets(0.0, 0.0, 0.0, 15.0));
228229
domainAxis.setCategoryMargin(0.0);
229230

230231
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();

0 commit comments

Comments
 (0)