File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ public CyCustomGraphics2<?> createChart() {
188
188
List <CyColumnIdentifier > columns = ChartUtil .getSortedColumnIdentifiers (prefix ,
189
189
dataSets , columnDescriptor , columnIdFactory );
190
190
191
- List <Color > colors = ChartUtil .getChartColors (chartOptions );
191
+ List <Color > colors = ChartUtil .getChartColors (chartOptions , true );
192
192
List <Double > range = ChartUtil .calculateGlobalRange (options .getNetworkView ().getModel (), columns );
193
193
194
194
props .put ("cy_dataColumns" , columns );
Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ private void updateNodeChartColorPanel(Collection<EMDataSet> dataSets) {
319
319
List <CyColumnIdentifier > columns = ChartUtil .getSortedColumnIdentifiers (options .getAttributePrefix (),
320
320
dataSets , columnDescriptor , columnIdFactory );
321
321
322
- List <Color > colors = ChartUtil .getChartColors (chartOptions );
322
+ List <Color > colors = ChartUtil .getChartColors (chartOptions , false );
323
323
List <Double > range = ChartUtil .calculateGlobalRange (options .getNetworkView ().getModel (), columns );
324
324
double min = range .get (0 ) ;
325
325
double max = range .get (1 );
Original file line number Diff line number Diff line change @@ -135,18 +135,21 @@ else if (row.isSet(column.getName()))
135
135
return range ;
136
136
}
137
137
138
- public static List <Color > getChartColors (ChartOptions options ) {
138
+ public static List <Color > getChartColors (ChartOptions options , boolean forStyle ) {
139
139
ColorScheme colorScheme = options != null ? options .getColorScheme () : null ;
140
140
List <Color > colors = colorScheme != null ? colorScheme .getColors () : null ;
141
141
ChartData data = options != null ? options .getData () : null ;
142
142
143
- // Swap UP and ZERO colors if q or p-value (it should not have negative values!)
144
- if ((data == ChartData .FDR_VALUE || data == ChartData .P_VALUE ) && colors .size () == 3 )
145
- colors = Arrays .asList (new Color [] { colors .get (1 ), colors .get (0 ), colors .get (1 ) });
146
-
147
143
if (colors == null || colors .size () < 3 ) // UP, ZERO, DOWN:
148
144
colors = Arrays .asList (new Color [] { Color .LIGHT_GRAY , Color .WHITE , Color .DARK_GRAY });
149
145
146
+ if (forStyle ) {
147
+ // The 3-color schemes need to be swapped when the chart only includes positive numbers.
148
+ // Swap UP and ZERO colors if q or p-value (it should not have negative values!)
149
+ if ((data == ChartData .FDR_VALUE || data == ChartData .P_VALUE ) && colors .size () == 3 )
150
+ colors = Arrays .asList (new Color [] { colors .get (1 ), colors .get (0 ), colors .get (1 ) });
151
+ }
152
+
150
153
return colors ;
151
154
}
152
155
You can’t perform that action at this time.
0 commit comments