46
46
public final class ChartUtil {
47
47
48
48
public static final Color TRANSPARENT_COLOR = new Color (0x00 , 0x00 , 0x00 , 0 );
49
+ private static final Color DEF_CHART_ITEM_COLOR = Color .decode ("#F5F5F5" );
49
50
50
51
private ChartUtil () {
51
52
}
@@ -185,20 +186,8 @@ public static JFreeChart createRadialHeatMapLegend(List<EMDataSet> dataSets, Cha
185
186
plot .setLabelShadowPaint (TRANSPARENT_COLOR );
186
187
plot .setToolTipGenerator (new StandardPieToolTipGenerator ("{0}" ));
187
188
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 );
202
191
203
192
return chart ;
204
193
}
@@ -245,21 +234,10 @@ public static JFreeChart createHeatMapLegend(List<EMDataSet> dataSets, ChartOpti
245
234
final NumberAxis rangeAxis = (NumberAxis ) plot .getRangeAxis ();
246
235
rangeAxis .setVisible (false );
247
236
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
-
259
237
final BarRenderer renderer = new BarRenderer () {
260
238
@ Override
261
239
public Paint getItemPaint (int row , int column ) {
262
- return column < itemColors . size () ? itemColors . get ( column ) : Color . LIGHT_GRAY ;
240
+ return DEF_CHART_ITEM_COLOR ;
263
241
}
264
242
};
265
243
plot .setRenderer (renderer );
@@ -277,7 +255,6 @@ public static JFreeChart createHeatStripsLegend(List<EMDataSet> dataSets, ChartO
277
255
final DefaultCategoryDataset dataset = new DefaultCategoryDataset ();
278
256
int total = dataSets .size ();
279
257
int lowerBound = options .getData () == ChartData .NES_VALUE ? -total : 0 ;
280
- int upperBound = lowerBound + (2 * total );
281
258
int v = lowerBound / 2 ;
282
259
283
260
for (int i = 0 ; i < total ; i ++) {
@@ -327,19 +304,10 @@ public static JFreeChart createHeatStripsLegend(List<EMDataSet> dataSets, ChartO
327
304
final NumberAxis rangeAxis = (NumberAxis ) plot .getRangeAxis ();
328
305
rangeAxis .setVisible (false );
329
306
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
-
339
307
final BarRenderer renderer = new BarRenderer () {
340
308
@ Override
341
309
public Paint getItemPaint (int row , int column ) {
342
- return column < itemColors . size () ? itemColors . get ( column ) : Color . LIGHT_GRAY ;
310
+ return DEF_CHART_ITEM_COLOR ;
343
311
}
344
312
};
345
313
plot .setRenderer (renderer );
0 commit comments