Révision 3177

tmp/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/stats/CAStyleMacro.groovy (revision 3177)
1 1
// STANDARD DECLARATIONS
2
// @author mdecorde sjacquot sheiden
2
// @author mdecorde sheiden sjacquot
3 3
package org.txm.macro
4 4

  
5 5
import org.kohsuke.args4j.*
......
25 25
import org.txm.libs.office.ReadODS
26 26
import org.txm.ca.core.chartsengine.jfreechart.datasets.*
27 27
import org.jfree.chart.renderer.AbstractRenderer
28
import java.awt.geom.Ellipse2D
29
import org.jfree.chart.util.ShapeUtils
28 30

  
31

  
29 32
println "editor: "+editor
30 33

  
31 34
if (!(editor instanceof CAEditor)) {
......
53 56

  
54 57
def data = ReadODS.toTable(patternsODSFile, "rows")
55 58
def keys = data[0]
56
		def row_styles = [:] // reformat data
57
				for (int i = 1 ; i < data.size() ; i++) {
58
					def h = data[i]
59
							def style = [:] // create style entry
60
									String s = h[0];
61
					row_styles[/$s/] = style // with a regexp pattern as key
62
							
63
							// fill the style
64
							for (int j = 1 ; j < h.size() ; j++) {
65
								style[keys[j]] = h[j]
66
							}
67
				}
59
def row_styles = [:] // reformat data
60
	for (int i = 1 ; i < data.size() ; i++) {
61
		def h = data[i]
62
		def style = [:] // create style entry
63
		String s = h[0];
64
		row_styles[/$s/] = style // with a regexp pattern as key
65
				
66
		// fill the style
67
		for (int j = 1 ; j < h.size() ; j++) {
68
			style[keys[j]] = h[j]
69
		}
70
	}
68 71
if (debug > 0) {
69 72
	println "ROW STYLES=$row_styles"
70 73
}
......
74 77
def col_styles = [:] // reformat data
75 78

  
76 79
for (int i = 1 ; i < data.size() ; i++) {
77
		def h = data[i]
78
							def style = [:] // create style entry
79
									String s = h[0];
80
					col_styles[/$s/] = style // with a regexp pattern as key
81
							
82
							// fill the style
83
							for (int j = 1 ; j < h.size() ; j++) {
84
								style[keys[j]] = h[j]
85
							}
86
				}
80
	def h = data[i]
81
	def style = [:] // create style entry
82
	String s = h[0];
83
	col_styles[/$s/] = style // with a regexp pattern as key
84
					
85
	// fill the style
86
	for (int j = 1 ; j < h.size() ; j++) {
87
		style[keys[j]] = h[j]
88
	}
89
}
87 90
if (debug > 0) {
88 91
	println "COL STYLES=$col_styles"
89 92
}
......
103 106
D1 = ica.getFirstDimension() -1;
104 107
D2 = ica.getSecondDimension() -1;
105 108

  
106
shapes = [:]
109
// create some AWT shapes for replacement
110
shapes = new HashMap<String, Shape>();
111
// dimensions scaling factor (the same used in default theme for the replaced shapes have same dimension than non-replaced)
112
float itemShapesScalingFactor = 1.2f
113
shapes["diamond"] = ShapeUtils.createDiamond((float)(itemShapesScalingFactor * 3.4f));
107 114
shapes["square"] = AbstractRenderer.DEFAULT_SHAPE;
108
shapes["circle"] = AbstractRenderer.DEFAULT_SHAPE;
109
shapes["triangle"] = AbstractRenderer.DEFAULT_SHAPE;
110
shapes["star"] = AbstractRenderer.DEFAULT_SHAPE;
111
shapes["disk"] = AbstractRenderer.DEFAULT_SHAPE;
112 115

  
116
float circleSize = 6.4f * itemShapesScalingFactor;
117
shapes["disk"] = new Ellipse2D.Float((float)(-circleSize / 2), (float)(-circleSize / 2), circleSize, circleSize);
118

  
119
shapes["triangle"] = ShapeUtils.createUpTriangle((float)(itemShapesScalingFactor * 3.2f));
120

  
121
//shapes["star"] = AbstractRenderer.DEFAULT_SHAPE;
122
//shapes["circle"] = AbstractRenderer.DEFAULT_SHAPE;
123

  
124

  
125
println "SHAPES=$shapes"
126

  
127

  
113 128
// styles per col index in dataset
114 129
// set col label
115 130
colLabelStyle = new HashMap<Integer, String>();
116 131
// set col visibility
117 132
colHiddenStyle = new HashSet<Integer>(); // true false
118 133
// set col font size
119
colFontSizeStyle = new HashMap<Integer, Integer>(); // 0.0 to 10.0
134
colFontSizeStyle = new HashMap<Integer, Float>();
120 135
// set col font color
121
colFontColorStyle = new HashMap<Integer, Color>(); // 0.0 to 10.0
136
colFontColorStyle = new HashMap<Integer, Color>();
122 137
// set col font family
123
colFontFamilyStyle = new HashMap<Integer, String>(); // 0.0 to 10.0
138
colFontFamilyStyle = new HashMap<Integer, String>();
124 139
// set col points size
125
colPointSizeStyle = new HashMap<Integer, Double>(); // 0.0 to 10.0
140
colPointSizeStyle = new HashMap<Integer, Double>();
126 141
// set col points RGBA color
127 142
colPointColorStyle = new HashMap<Integer, Color>();
128 143
// set col points shape (circle, square, triangle, ... + color ? + size ?) -> expert
......
136 151
// set row visibility
137 152
rowHiddenStyle = new HashSet<Integer>(); // true false
138 153
// set row font size
139
rowFontSizeStyle = new HashMap<Integer, Integer>(); // 0.0 to 10.0
154
rowFontSizeStyle = new HashMap<Integer, Float>();
140 155
// set row font size
141
rowFontColorStyle = new HashMap<Integer, Color>(); // 0.0 to 10.0
156
rowFontColorStyle = new HashMap<Integer, Color>();
142 157
// set row font size
143
rowFontFamilyStyle = new HashMap<Integer, String>(); // 0.0 to 10.0
158
rowFontFamilyStyle = new HashMap<Integer, String>();
144 159
// set row points size
145
rowPointSizeStyle = new HashMap<Integer, Double>(); // 0.0 to 10.0
160
rowPointSizeStyle = new HashMap<Integer, Double>();
146 161
// set row points RGBA color
147 162
rowPointColorStyle = new HashMap<Integer, Color>();
148 163
// set row points shape (circle, square, triangle, ... + color ? + size ?) -> expert
......
155 170
	for (def p : col_styles.keySet()) {
156 171
		if (cols[i] ==~ p) {
157 172
			def style = col_styles[p]
158
			if (style["label"] != null && style["label"].length() > 0) {
159
				colLabelStyle[i] = style["label"]
173
			if (style["label-replacement"] != null && style["label-replacement"].length() > 0) {
174
				colLabelStyle[i] = style["label-replacement"]
160 175
			}
161 176
			if (style["hidden"] != null && style["hidden"].toUpperCase() == "T") {
162 177
				colHiddenStyle << i
163 178
			}
164
			if (style["point-size"] != null && style["point-size"].length() > 0) {
165
				colPointSizeStyle[i] = Double.parseDouble(style["point-size"])
179
			if (style["shape-size"] != null && style["shape-size"].length() > 0) {
180
				colPointSizeStyle[i] = Double.parseDouble(style["shape-size"])
166 181
			}
167
			if (style["point-color"] != null && style["point-color"].length() > 0 ) {
168
				colPointColorStyle[i] = rgbaStringToColor(style["point-color"])
182
			if (style["shape-color"] != null && style["shape-color"].length() > 0 ) {
183
				colPointColorStyle[i] = rgbaStringToColor(style["shape-color"])
169 184
			}
170
			if (style["point-shape"] != null && shapes.containsKey(style["point-shape"])) {
171
				colPointShapeStyle[i] = shapes[style["point-shape"]]
185
			if (style["shape-replacement"] != null && shapes.containsKey(style["shape-replacement"])) {
186
				colPointShapeStyle[i] = shapes[style["shape-replacement"]]
172 187
			}
173
			if (style["font-size"] != null && style["font-size"].length() > 0) {
174
				colFontSizeStyle[i] = Integer.parseInt(style["font-size"])
188
			if (style["label-size"] != null && style["label-size"].length() > 0) {
189
				colFontSizeStyle[i] = Float.parseFloat(style["label-size"])
175 190
			}
176
			if (style["font-color"] != null && style["font-color"].length() > 0) {
177
				colFontColorStyle[i] = rgbaStringToColor(style["font-color"])
191
			if (style["label-color"] != null && style["label-color"].length() > 0) {
192
				colFontColorStyle[i] = rgbaStringToColor(style["label-color"])
178 193
			}
179
			if (style["font-family"] != null && style["font-family"].length() > 0) {
180
				colFontFamilyStyle[i] = style["font-family"]
194
			if (style["label-font-family"] != null && style["label-font-family"].length() > 0) {
195
				colFontFamilyStyle[i] = style["label-font-family"]
181 196
			}
182
			if (style["font-style"] != null && style["font-style"].length() > 0) {
183
				colFontStyleStyle[i] = Integer.parseInt(style["font-style"])
197
			if (style["label-style"] != null && style["label-style"].length() > 0) {
198
				colFontStyleStyle[i] = Integer.parseInt(style["label-style"])
184 199
			}
185 200
			
186 201
		}
......
204 219
			if (style["hidden"] != null && style["hidden"].toUpperCase() == "T") {
205 220
				rowHiddenStyle << i
206 221
			}
207
			if (style["label"] != null && style["label"].length() > 0) {
208
				rowLabelStyle[i] = style["label"]
222
			if (style["label-replacement"] != null && style["label-replacement"].length() > 0) {
223
				rowLabelStyle[i] = style["label-replacement"]
209 224
			}
210
			if (style["point-size"] != null && style["point-size"].length() > 0) {
211
				rowPointSizeStyle[i] = Double.parseDouble(style["point-size"])
225
			if (style["shape-size"] != null && style["shape-size"].length() > 0) {
226
				rowPointSizeStyle[i] = Double.parseDouble(style["shape-size"])
212 227
			}
213
			if (style["point-color"] != null && style["point-color"].length() > 0 ) {
214
				rowPointColorStyle[i] = rgbaStringToColor(style["point-color"])
228
			if (style["shape-color"] != null && style["shape-color"].length() > 0 ) {
229
				rowPointColorStyle[i] = rgbaStringToColor(style["shape-color"])
215 230
			}
216
			if (style["point-shape"] != null && shapes.containsKey(style["point-shape"])) {
217
				rowPointShapeStyle[i] = shapes[style["point-shape"]]
231
			if (style["shape-replacement"] != null && shapes.containsKey(style["shape-replacement"])) {
232
				rowPointShapeStyle[i] = shapes[style["shape-replacement"]]
218 233
			}
219
			if (style["font-size"] != null && style["font-size"].length() > 0) {
220
				rowFontSizeStyle[i] = Integer.parseInt(style["font-size"])
234
			if (style["label-size"] != null && style["label-size"].length() > 0) {
235
				rowFontSizeStyle[i] = Float.parseFloat(style["label-size"])
221 236
			}
222
			if (style["font-color"] != null && style["font-color"].length() > 0) {
223
				rowFontColorStyle[i] = rgbaStringToColor(style["font-color"])
237
			if (style["label-color"] != null && style["label-color"].length() > 0) {
238
				rowFontColorStyle[i] = rgbaStringToColor(style["label-color"])
224 239
			}
225
			if (style["font-family"] != null && style["font-family"].length() > 0) {
226
				rowFontFamilyStyle[i] = style["font-family"]
240
			if (style["label-font-family"] != null && style["label-font-family"].length() > 0) {
241
				rowFontFamilyStyle[i] = style["label-font-family"]
227 242
			}
228
			if (style["font-style"] != null && style["font-style"].length() > 0) {
229
				rowFontStyleStyle[i] = Integer.parseInt(style["font-style"])
243
			if (style["label-style"] != null && style["label-style"].length() > 0) {
244
				rowFontStyleStyle[i] = Integer.parseInt(style["label-style"])
230 245
			}
231 246
		}
232 247
	}
......
242 257
}
243 258

  
244 259

  
260

  
245 261
// UPDATE THE CHART RENDERER
246 262

  
247 263
def chartEditor = editor.getEditors()[0]
248
		def chartComposite = chartEditor.getComposite()
249
		
250
		ddebug = debug
251
		monitor.syncExec( new Runnable() {
252
			public void run() {
253
				println chartComposite
254
				def chart = chartEditor.getChart()
264
	def chartComposite = chartEditor.getComposite()
265
	
266
	ddebug = debug
267
	monitor.syncExec( new Runnable() {
268
	
269
		public void run() {
270
			println chartComposite
271
			def chart = chartEditor.getChart()
272
			
273
			/*
274
			println "chart: "+chart
275
			println "Plot: "+chart.getPlot()
276
			println "Dataset: "+chart.getPlot().getDataset()
277
			println "Renderer 1: "+chart.getPlot().getRenderer()
278
			 */
279
			
280
			def renderer = new CAItemSelectionRenderer(ica, chart) {
281
				Area EMPTYAREA = new Area()
282
						
283
						@Override
284
						public void initItemLabelGenerator() {
285
						XYItemLabelGenerator generator = new XYItemLabelGenerator() {
286
						
287
						@Override
288
						public String generateLabel(XYDataset dataset, int series, int item) {
289
							if (series == 0 && rowHiddenStyle.contains(item)) {
290
								if (ddebug > 1) println "HIDDING ROW LABEL '$item' '${rows[item]}'"
291
								return ""
292
							} else if (series == 1 && colHiddenStyle.contains(item)) {
293
								if (ddebug > 1) println "HIDDING COL LABEL '$item' '${cols[item]}'"
294
								return ""
295
							} else if (series == 0 && rowLabelStyle.containsKey(item)) {
296
								if (ddebug > 1) println "RENAME ROW LABEL '$item' '${rows[item]}' -> '${rowLabelStyle[item]}'"
297
								return rowLabelStyle[item]
298
							} else if (series == 1 && colLabelStyle.containsKey(item)) {
299
								if (ddebug > 1) println "RENAME COL LABEL '$item' '${cols[item]}' -> '${colLabelStyle[item]}'"
300
								return colLabelStyle[item]
301
							} else {
302
								CAXYDataset caDataset = (CAXYDataset) dataset;
303
								return caDataset.getLabel(series, item);
304
							}
305
						}
306
					};
307
					
308
					// don't use setBaseItemLabelGenerator BUT setDefaultItemLabelGenerator
309
					this.setDefaultItemLabelGenerator(generator);
310
					this.setDefaultItemLabelsVisible(true);
311
				}
255 312
				
256
				/*
257
				println "chart: "+chart
258
				println "Plot: "+chart.getPlot()
259
				println "Dataset: "+chart.getPlot().getDataset()
260
				println "Renderer 1: "+chart.getPlot().getRenderer()
261
				 */
262 313
				
263
				def renderer = new CAItemSelectionRenderer(ica, chart) {
264
					Area EMPTYAREA = new Area()
265
							
266
							@Override
267
							public void initItemLabelGenerator() {
268
							XYItemLabelGenerator generator = new XYItemLabelGenerator() {
269
							
270
							@Override
271
							public String generateLabel(XYDataset dataset, int series, int item) {
272
								if (series == 0 && rowHiddenStyle.contains(item)) {
273
									if (ddebug > 1) println "HIDDING ROW LABEL '$item' '${rows[item]}'"
274
									return ""
275
								} else if (series == 1 && colHiddenStyle.contains(item)) {
276
									if (ddebug > 1) println "HIDDING COL LABEL '$item' '${cols[item]}'"
277
									return ""
278
								} else if (series == 0 && rowLabelStyle.containsKey(item)) {
279
									if (ddebug > 1) println "RENAME ROW LABEL '$item' '${rows[item]}' -> '${rowLabelStyle[item]}'"
280
									return rowLabelStyle[item]
281
								} else if (series == 1 && colLabelStyle.containsKey(item)) {
282
									if (ddebug > 1) println "RENAME COL LABEL '$item' '${cols[item]}' -> '${colLabelStyle[item]}'"
283
									return colLabelStyle[item]
284
								} else {
285
									CAXYDataset caDataset = (CAXYDataset) dataset;
286
									return caDataset.getLabel(series, item);
287
								}
288
							}
289
						};
290
						
291
						// don't use setBaseItemLabelGenerator BUT setDefaultItemLabelGenerator
292
						this.setDefaultItemLabelGenerator(generator);
293
						this.setDefaultItemLabelsVisible(true);
314
				
315
				@Override
316
				public Font getItemLabelFont(int series, int item) {
317
					Font d = super.getItemLabelFont(series, item);
318
					Integer style = d.getStyle();
319
					Integer size = d.getSize();
320
					String family = d.getFontName();
321
					
322
					// size
323
					if (series == 0 && rowFontSizeStyle.containsKey(item)) {
324
						if (ddebug > 1) println "FIX ROW FONT-SIZE $item ${rows[item]} -> ${rowFontSizeStyle[item]}"
325
						size *= rowFontSizeStyle[item];
326
					} else if (series == 1 && colFontSizeStyle.containsKey(item)) {
327
						if (ddebug > 1) println "FIX COL FONT-SIZE $item ${cols[item]} -> ${colFontSizeStyle[item]}"
328
						size *= colFontSizeStyle[item];
294 329
					}
295 330
					
331
					// family
332
					if (series == 0 && rowFontFamilyStyle.containsKey(item)) {
333
						if (ddebug > 1) println "FIX ROW FONT-Family $item ${rows[item]} -> ${rowFontFamilyStyle[item]}"
334
						family = rowFontFamilyStyle[item];
335
					} else if (series == 1 && colFontFamilyStyle.containsKey(item)) {
336
						if (ddebug > 1) println "FIX COL FONT-Family $item ${cols[item]} -> ${colFontFamilyStyle[item]}"
337
						family = colFontFamilyStyle[item];
338
					}
296 339
					
340
					// style
341
					if (series == 0 && rowFontStyleStyle.containsKey(item)) {
342
						if (ddebug > 1) println "FIX ROW FONT-Style $item ${rows[item]} -> ${rowFontStyleStyle[item]}"
343
						style = rowFontStyleStyle[item];
344
					} else if (series == 1 && colFontFamilyStyle.containsKey(item)) {
345
						if (ddebug > 1) println "FIX COL FONT-Style $item ${cols[item]} -> ${colFontStyleStyle[item]}"
346
						style = colFontStyleStyle[item];
347
					}
297 348
					
298
					@Override
299
					public Font getItemLabelFont(int series, int item) {
300
						Font d = super.getItemLabelFont(series, item);
301
						Integer style = d.getStyle();
302
						Integer size = d.getSize();
303
						String family = d.getFontName();
349
					
350
					return new Font(family, style, size);
351
				}
352
				
353
				
354
				@Override
355
				public Shape getItemShape(int series, int item) {
356
					// Rows (series == 0), Cols (series == 1)
357
					if (series == 0 && rowHiddenStyle.contains(item)) {
358
						return EMPTYAREA;
359
					} else if (series == 1 && colHiddenStyle.contains(item)) {
360
						return EMPTYAREA;
361
					} else {
304 362
						
305
						// size
306
						if (series == 0 && rowFontSizeStyle.containsKey(item)) {
307
							if (ddebug > 1) println "FIX ROW FONT-SIZE $item ${rows[item]} -> ${rowFontSizeStyle[item]}"
308
							size = rowFontSizeStyle[item];
309
						} else if (series == 1 && colFontSizeStyle.containsKey(item)) {
310
							if (ddebug > 1) println "FIX COL FONT-SIZE $item ${cols[item]} -> ${colFontSizeStyle[item]}"
311
							size = colFontSizeStyle[item];
312
						}
363
						Shape shape =  super.getItemShape(series, item);
313 364
						
314
						// family
315
						if (series == 0 && rowFontFamilyStyle.containsKey(item)) {
316
							if (ddebug > 1) println "FIX ROW FONT-Family $item ${rows[item]} -> ${rowFontFamilyStyle[item]}"
317
							family = rowFontFamilyStyle[item];
318
						} else if (series == 1 && colFontFamilyStyle.containsKey(item)) {
319
							if (ddebug > 1) println "FIX COL FONT-Family $item ${cols[item]} -> ${colFontFamilyStyle[item]}"
320
							family = colFontFamilyStyle[item];
365
						// not-visible shapes mode
366
						if(!((CA) this.multipleItemsSelector.getResult()).isShowPointShapes())        {
367
							return shape;
321 368
						}
322 369
						
323
						// style
324
						if (series == 0 && rowFontStyleStyle.containsKey(item)) {
325
							if (ddebug > 1) println "FIX ROW FONT-Style $item ${rows[item]} -> ${rowFontStyleStyle[item]}"
326
							style = rowFontStyleStyle[item];
327
						} else if (series == 1 && colFontFamilyStyle.containsKey(item)) {
328
							if (ddebug > 1) println "FIX COL FONT-Style $item ${cols[item]} -> ${colFontStyleStyle[item]}"
329
							style = colFontStyleStyle[item];
370
						// shape replacement
371
						if (series == 0 && rowPointShapeStyle.containsKey(item)) {
372
							if (ddebug > 1) println "FIX ROW SHAPE $item ${rows[item]} -> ${rowPointShapeStyle[item]}"
373
							shape = rowPointShapeStyle.get(item);
374
						} else if (series == 1 && colPointShapeStyle.containsKey(item)) {
375
							if (ddebug > 1) println "FIX COL SHAPE $item ${cols[item]} -> ${colPointShapeStyle[item]}"
376
							shape = colPointShapeStyle.get(item);
330 377
						}
331 378
						
332 379
						
333
						return new Font(family, style, size);
334
					}
335
					
336
					
337
					@Override
338
					public Shape getItemShape(int series, int item) {
339
						// Rows (series == 0), Cols (series == 1)
340
						if (series == 0 && rowHiddenStyle.contains(item)) {
341
							return EMPTYAREA;
342
						} else if (series == 1 && colHiddenStyle.contains(item)) {
343
							return EMPTYAREA;
344
						} else {
345
							
346
							Shape shape =  super.getItemShape(series, item);
347
							
348
							// not-visible shapes mode
349
							if(!((CA) this.multipleItemsSelector.getResult()).isShowPointShapes())        {
350
								return shape;
351
							}
352
							
353
							AffineTransform t = new AffineTransform();
354
							if (series == 0 && rowPointSizeStyle.containsKey(item)) {
355
								if (ddebug > 1) println "FIX ROW POINT SIZE $item ${rows[item]} -> ${rowPointSizeStyle[item]}"
356
								t.setToScale(rowPointSizeStyle.get(item), rowPointSizeStyle.get(item));
357
								shape = t.createTransformedShape(shape);
358
							} else if (series == 1 && colPointSizeStyle.containsKey(item)) {
359
								if (ddebug > 1) println "FIX COL POINT SIZE $item ${cols[item]} -> ${colPointSizeStyle[item]}"
360
								t.setToScale(colPointSizeStyle.get(item), colPointSizeStyle.get(item));
361
								shape = t.createTransformedShape(shape);
362
							}
363
							
364
							return shape;
380
						// shape scaling
381
						AffineTransform t = new AffineTransform();
382
						if (series == 0 && rowPointSizeStyle.containsKey(item)) {
383
							if (ddebug > 1) println "FIX ROW POINT SIZE $item ${rows[item]} -> ${rowPointSizeStyle[item]}"
384
							t.setToScale(rowPointSizeStyle.get(item), rowPointSizeStyle.get(item));
385
							shape = t.createTransformedShape(shape);
386
						} else if (series == 1 && colPointSizeStyle.containsKey(item)) {
387
							if (ddebug > 1) println "FIX COL POINT SIZE $item ${cols[item]} -> ${colPointSizeStyle[item]}"
388
							t.setToScale(colPointSizeStyle.get(item), colPointSizeStyle.get(item));
389
							shape = t.createTransformedShape(shape);
365 390
						}
391
						
392
						return shape;
366 393
					}
394
				}
395
				
396
				
397
				@Override
398
				public Paint getItemPaint(int series, int item) {
367 399
					
368
					
369
					@Override
370
					public Paint getItemPaint(int series, int item) {
371
						
372
						// visible shapes mode
373
						if (!((CA) this.multipleItemsSelector.getResult()).isShowPointShapes()) {
374
							return super.getItemPaint(series, item);
375
						}
376
						
377
						if (series == 0 && rowPointColorStyle.containsKey(item)) {
378
							if (ddebug > 1) println "FIX ROW POINT COLOR $item ${rows[item]} -> ${rowPointColorStyle[item]}"
379
							return rowPointColorStyle.get(item);
380
						} else if (series == 1 && colPointColorStyle.containsKey(item)) {
381
							if (ddebug > 1) println "FIX COL POINT COLOR $item ${cols[item]} -> ${colPointColorStyle[item]}"
382
							return colPointColorStyle.get(item);
383
						}
384
						else {
385
							return super.getItemPaint(series, item);
386
						}
400
					// visible shapes mode
401
					if (!((CA) this.multipleItemsSelector.getResult()).isShowPointShapes()) {
402
						return super.getItemPaint(series, item);
387 403
					}
388 404
					
389
					
390
					@Override
391
					public Paint getItemLabelPaint(int series, int item) {
392
						if (series == 0 && rowFontColorStyle.containsKey(item)) {
393
							if (ddebug > 1) println "FIX ROW LABEL COLOR $item ${rows[item]} -> ${rowFontColorStyle[item]}"
394
							return rowFontColorStyle.get(item);
395
						} else if (series == 1 && colFontColorStyle.containsKey(item)) {
396
							if (ddebug > 1) println "FIX COL LABEL COLOR $item ${cols[item]} -> ${colFontColorStyle[item]}"
397
							return colFontColorStyle.get(item);
398
						} else {
399
							return super.getItemLabelPaint(series, item);
400
						}
405
					if (series == 0 && rowPointColorStyle.containsKey(item)) {
406
						if (ddebug > 1) println "FIX ROW POINT COLOR $item ${rows[item]} -> ${rowPointColorStyle[item]}"
407
						return rowPointColorStyle.get(item);
408
					} else if (series == 1 && colPointColorStyle.containsKey(item)) {
409
						if (ddebug > 1) println "FIX COL POINT COLOR $item ${cols[item]} -> ${colPointColorStyle[item]}"
410
						return colPointColorStyle.get(item);
401 411
					}
402
					
403
					
404
					
405
				};
412
					else {
413
						return super.getItemPaint(series, item);
414
					}
415
				}
406 416
				
407 417
				
408
				def cp = editor.editors[0].getChart();
409
				renderer.chart = cp
410
						renderer.setSeriesVisible(0, ica.isShowVariables()); // Rows
411
				renderer.setSeriesVisible(1, ica.isShowIndividuals()); // Columns
412
				chart.getXYPlot().setRenderer(renderer)
418
				@Override
419
				public Paint getItemLabelPaint(int series, int item) {
420
					if (series == 0 && rowFontColorStyle.containsKey(item)) {
421
						if (ddebug > 1) println "FIX ROW LABEL COLOR $item ${rows[item]} -> ${rowFontColorStyle[item]}"
422
						return rowFontColorStyle.get(item);
423
					} else if (series == 1 && colFontColorStyle.containsKey(item)) {
424
						if (ddebug > 1) println "FIX COL LABEL COLOR $item ${cols[item]} -> ${colFontColorStyle[item]}"
425
						return colFontColorStyle.get(item);
426
					} else {
427
						return super.getItemLabelPaint(series, item);
428
					}
429
				}
413 430
				
414
				ica.getChartCreator().updateChart(chartEditor.getResult())
415 431
				
416
			}
417
		});
432
				
433
			};
434
			
435
			
436
			def cp = editor.editors[0].getChart();
437
			renderer.chart = cp
438
			renderer.setSeriesVisible(0, ica.isShowVariables()); // Rows
439
			renderer.setSeriesVisible(1, ica.isShowIndividuals()); // Columns
440
			chart.getXYPlot().setRenderer(renderer)
441
			
442
			ica.getChartCreator().updateChart(chartEditor.getResult())
443
			
444
		}
445
	});
418 446

  
419 447

  
420 448

  
......
430 458
		return new Color(Integer.parseInt(rgbColor[0]), Integer.parseInt(rgbColor[1]), Integer.parseInt(rgbColor[2]), Integer.parseInt(alpha))
431 459
	}
432 460
	else {
433
		println "Error in color format for string: $color"
461
		println "Error in color format for RGB or RGBA string: $color"
434 462
	}
435
	
436 463
}
437 464

  
438 465

  
466

  

Formats disponibles : Unified diff