Skip to content

Commit 3f8c2ca

Browse files
committed
Refs #258: Removes real gradient colours from chart legend--using light grey instead.
1 parent 1a8bc14 commit 3f8c2ca

File tree

1 file changed

+5
-37
lines changed
  • EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util

1 file changed

+5
-37
lines changed

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

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
public final class ChartUtil {
4747

4848
public static final Color TRANSPARENT_COLOR = new Color(0x00, 0x00, 0x00, 0);
49+
private static final Color DEF_CHART_ITEM_COLOR = Color.decode("#F5F5F5");
4950

5051
private ChartUtil() {
5152
}
@@ -185,20 +186,8 @@ public static JFreeChart createRadialHeatMapLegend(List<EMDataSet> dataSets, Cha
185186
plot.setLabelShadowPaint(TRANSPARENT_COLOR);
186187
plot.setToolTipGenerator(new StandardPieToolTipGenerator("{0}"));
187188

188-
List<Color> colors = getChartColors(options);
189-
190-
int total = dataSets.size();
191-
int lowerBound = options.getData() == ChartData.NES_VALUE ? -total : 0;
192-
int upperBound = lowerBound + (2 * total);
193-
int v = lowerBound / 2;
194-
195-
for (EMDataSet ds : dataSets) {
196-
plot.setSectionPaint(
197-
ds.getName(),
198-
ColorUtil.getColor(v, lowerBound, upperBound, colors.get(2), colors.get(1), colors.get(0))
199-
);
200-
v++;
201-
}
189+
for (EMDataSet ds : dataSets)
190+
plot.setSectionPaint(ds.getName(), DEF_CHART_ITEM_COLOR);
202191

203192
return chart;
204193
}
@@ -245,21 +234,10 @@ public static JFreeChart createHeatMapLegend(List<EMDataSet> dataSets, ChartOpti
245234
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
246235
rangeAxis.setVisible(false);
247236

248-
List<Color> colors = getChartColors(options);
249-
250-
List<Color> itemColors = new ArrayList<>();
251-
int total = dataSets.size();
252-
int lowerBound = options.getData() == ChartData.NES_VALUE ? -total : 0;
253-
int upperBound = lowerBound + (2 * total);
254-
int v = lowerBound / 2;
255-
256-
for (int i = 0; i < total; i++)
257-
itemColors.add(ColorUtil.getColor(v++, lowerBound, upperBound, colors.get(2), colors.get(1), colors.get(0)));
258-
259237
final BarRenderer renderer = new BarRenderer() {
260238
@Override
261239
public Paint getItemPaint(int row, int column) {
262-
return column < itemColors.size() ? itemColors.get(column) : Color.LIGHT_GRAY;
240+
return DEF_CHART_ITEM_COLOR;
263241
}
264242
};
265243
plot.setRenderer(renderer);
@@ -277,7 +255,6 @@ public static JFreeChart createHeatStripsLegend(List<EMDataSet> dataSets, ChartO
277255
final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
278256
int total = dataSets.size();
279257
int lowerBound = options.getData() == ChartData.NES_VALUE ? -total : 0;
280-
int upperBound = lowerBound + (2 * total);
281258
int v = lowerBound / 2;
282259

283260
for (int i = 0; i < total; i++) {
@@ -327,19 +304,10 @@ public static JFreeChart createHeatStripsLegend(List<EMDataSet> dataSets, ChartO
327304
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
328305
rangeAxis.setVisible(false);
329306

330-
List<Color> colors = getChartColors(options);
331-
List<Color> itemColors = new ArrayList<>();
332-
333-
for (int i = 0; i < total; i++) {
334-
Number n = dataset.getValue(options.getData().toString(), dataSets.get(i).getName());
335-
itemColors.add(
336-
ColorUtil.getColor(n.doubleValue(), lowerBound, upperBound, colors.get(2), colors.get(1), colors.get(0)));
337-
}
338-
339307
final BarRenderer renderer = new BarRenderer() {
340308
@Override
341309
public Paint getItemPaint(int row, int column) {
342-
return column < itemColors.size() ? itemColors.get(column) : Color.LIGHT_GRAY;
310+
return DEF_CHART_ITEM_COLOR;
343311
}
344312
};
345313
plot.setRenderer(renderer);

0 commit comments

Comments
 (0)