Révision 3172
tmp/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/stats/AFCWithStylesMacro.groovy (revision 3172) | ||
---|---|---|
1 | 1 |
// STANDARD DECLARATIONS |
2 |
// @author mdecorde sjacquot sheiden |
|
2 | 3 |
package org.txm.macro |
3 | 4 |
|
4 | 5 |
import org.kohsuke.args4j.* |
... | ... | |
18 | 19 |
import java.awt.geom.*; |
19 | 20 |
import org.jfree.chart.labels.* |
20 | 21 |
|
22 |
import org.txm.ca.core.functions.CA |
|
21 | 23 |
import org.txm.ca.core.chartsengine.jfreechart.themes.highcharts.renderers.* |
22 | 24 |
import org.txm.ca.rcp.editors.* |
23 | 25 |
import org.txm.libs.office.ReadODS |
... | ... | |
32 | 34 |
} |
33 | 35 |
|
34 | 36 |
@Field @Option(name="patternsODSFile", usage="The starting word", widget="FileOpen", required=true, def='patterns.ods') |
35 |
def patternsODSFile
|
|
37 |
def patternsODSFile |
|
36 | 38 |
@Field @Option(name="debug", usage="Show internal variable content", widget="StringArray", metaVar="OFF ON ALL REALLY ALL", required=true, def="OFF") |
37 |
debug
|
|
39 |
debug |
|
38 | 40 |
|
39 | 41 |
// Open the parameters input dialog box |
40 | 42 |
if (!ParametersDialog.open(this)) return; |
... | ... | |
51 | 53 |
|
52 | 54 |
def data = ReadODS.toTable(patternsODSFile, "rows") |
53 | 55 |
def keys = data[0] |
54 |
def row_styles = [:] // reformat data |
|
55 |
for (int i = 1 ; i < data.size() ; i++) { |
|
56 |
def h = data[i] |
|
57 |
def style = [:] // create style entry |
|
58 |
String s = h[0]; |
|
59 |
row_styles[/$s/] = style // with a regexp pattern as key |
|
60 |
|
|
61 |
// fill the style |
|
62 |
for (int j = 1 ; j < h.size() ; j++) { |
|
63 |
style[keys[j]] = h[j] |
|
64 |
} |
|
65 |
} |
|
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 |
}
|
|
66 | 68 |
if (debug > 0) { |
67 | 69 |
println "ROW STYLES=$row_styles" |
68 | 70 |
} |
... | ... | |
70 | 72 |
data = ReadODS.toTable(patternsODSFile, "cols") |
71 | 73 |
keys = data[0] |
72 | 74 |
def col_styles = [:] // reformat data |
75 |
|
|
73 | 76 |
for (int i = 1 ; i < data.size() ; i++) { |
74 |
def h = data[i] |
|
75 |
def style = [:] // create style entry |
|
76 |
String s = h[0]; |
|
77 |
col_styles[/$s/] = style // with a regexp pattern as key |
|
78 |
|
|
79 |
// fill the style |
|
80 |
for (int j = 1 ; j < h.size() ; j++) { |
|
81 |
style[keys[j]] = h[j] |
|
82 |
} |
|
83 |
} |
|
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 |
}
|
|
84 | 87 |
if (debug > 0) { |
85 | 88 |
println "COL STYLES=$col_styles" |
86 | 89 |
} |
... | ... | |
114 | 117 |
colHiddenStyle = new HashSet<Integer>(); // true false |
115 | 118 |
// set col font size |
116 | 119 |
colFontSizeStyle = new HashMap<Integer, Integer>(); // 0.0 to 10.0 |
117 |
// set row font size
|
|
120 |
// set col font color
|
|
118 | 121 |
colFontColorStyle = new HashMap<Integer, Color>(); // 0.0 to 10.0 |
119 |
// set row font size
|
|
120 |
colFontFamillyStyle = new HashMap<Integer, String>(); // 0.0 to 10.0
|
|
122 |
// set col font family
|
|
123 |
colFontFamilyStyle = new HashMap<Integer, String>(); // 0.0 to 10.0 |
|
121 | 124 |
// set col points size |
122 | 125 |
colPointSizeStyle = new HashMap<Integer, Double>(); // 0.0 to 10.0 |
123 | 126 |
// set col points RGBA color |
124 | 127 |
colPointColorStyle = new HashMap<Integer, Color>(); |
125 | 128 |
// set col points shape (circle, square, triangle, ... + color ? + size ?) -> expert |
126 | 129 |
colPointShapeStyle = new HashMap<Integer, Shape>(); // circle, square, triangle, etc. |
130 |
// set col font style (1 = bold, 2 = italic, 3 = bold + italic) |
|
131 |
colFontStyleStyle = new HashMap<Integer, Integer>(); |
|
127 | 132 |
|
133 |
|
|
128 | 134 |
// set row label |
129 | 135 |
rowLabelStyle = new HashMap<Integer, String>(); |
130 | 136 |
// set row visibility |
... | ... | |
134 | 140 |
// set row font size |
135 | 141 |
rowFontColorStyle = new HashMap<Integer, Color>(); // 0.0 to 10.0 |
136 | 142 |
// set row font size |
137 |
rowFontFamillyStyle = new HashMap<Integer, String>(); // 0.0 to 10.0
|
|
143 |
rowFontFamilyStyle = new HashMap<Integer, String>(); // 0.0 to 10.0 |
|
138 | 144 |
// set row points size |
139 | 145 |
rowPointSizeStyle = new HashMap<Integer, Double>(); // 0.0 to 10.0 |
140 | 146 |
// set row points RGBA color |
141 | 147 |
rowPointColorStyle = new HashMap<Integer, Color>(); |
142 | 148 |
// set row points shape (circle, square, triangle, ... + color ? + size ?) -> expert |
143 | 149 |
rowPointShapeStyle = new HashMap<Integer, Shape>(); // circle, square, triangle, etc. |
150 |
// set row font style (1 = bold, 2 = italic, 3 = bold + italic) |
|
151 |
rowFontStyleStyle = new HashMap<Integer, Integer>(); |
|
144 | 152 |
|
145 | 153 |
// prepare col style data for the dataset |
146 | 154 |
for (int i = 0 ; i < cols.length ; i++) { |
... | ... | |
157 | 165 |
colPointSizeStyle[i] = Double.parseDouble(style["point-size"]) |
158 | 166 |
} |
159 | 167 |
if (style["point-color"] != null && style["point-color"].length() > 0 ) { |
160 |
colPointColorStyle[i] = new Color(Integer.parseInt(style["point-color"]), false)
|
|
168 |
colPointColorStyle[i] = rgbaStringToColor(style["point-color"])
|
|
161 | 169 |
} |
162 | 170 |
if (style["point-shape"] != null && shapes.containsKey(style["point-shape"])) { |
163 | 171 |
colPointShapeStyle[i] = shapes[style["point-shape"]] |
... | ... | |
166 | 174 |
colFontSizeStyle[i] = Integer.parseInt(style["font-size"]) |
167 | 175 |
} |
168 | 176 |
if (style["font-color"] != null && style["font-color"].length() > 0) { |
169 |
colFontColorStyle[i] = Integer.parseInt(style["font-color"])
|
|
177 |
colFontColorStyle[i] = rgbaStringToColor(style["font-color"])
|
|
170 | 178 |
} |
171 |
if (style["font-familly"] != null && style["font-familly"].length() > 0) {
|
|
172 |
colFontFamillyStyle[i] = style["font-familly"]
|
|
179 |
if (style["font-family"] != null && style["font-family"].length() > 0) {
|
|
180 |
colFontFamilyStyle[i] = style["font-family"]
|
|
173 | 181 |
} |
182 |
if (style["font-style"] != null && style["font-style"].length() > 0) { |
|
183 |
colFontStyleStyle[i] = Integer.parseInt(style["font-style"]) |
|
184 |
} |
|
185 |
|
|
174 | 186 |
} |
175 | 187 |
} |
176 | 188 |
} |
... | ... | |
181 | 193 |
println "COL FONT-SIZ=$colFontSizeStyle" |
182 | 194 |
println "COL SIZ=$colPointSizeStyle" |
183 | 195 |
println "COL VIZ=$colHiddenStyle" |
196 |
println "COL STYLE=$colFontStyleStyle" |
|
184 | 197 |
} |
185 | 198 |
|
186 | 199 |
// prepare row style data for the dataset |
... | ... | |
198 | 211 |
rowPointSizeStyle[i] = Double.parseDouble(style["point-size"]) |
199 | 212 |
} |
200 | 213 |
if (style["point-color"] != null && style["point-color"].length() > 0 ) { |
201 |
rowPointColorStyle[i] = new Color(Integer.parseInt(style["point-color"]), false)
|
|
214 |
rowPointColorStyle[i] = rgbaStringToColor(style["point-color"])
|
|
202 | 215 |
} |
203 | 216 |
if (style["point-shape"] != null && shapes.containsKey(style["point-shape"])) { |
204 | 217 |
rowPointShapeStyle[i] = shapes[style["point-shape"]] |
... | ... | |
207 | 220 |
rowFontSizeStyle[i] = Integer.parseInt(style["font-size"]) |
208 | 221 |
} |
209 | 222 |
if (style["font-color"] != null && style["font-color"].length() > 0) { |
210 |
rowFontColorStyle[i] = Integer.parseInt(style["font-color"])
|
|
223 |
rowFontColorStyle[i] = rgbaStringToColor(style["font-color"])
|
|
211 | 224 |
} |
212 |
if (style["font-familly"] != null && style["font-familly"].length() > 0) {
|
|
213 |
rowFontFamillyStyle[i] = style["font-familly"]
|
|
225 |
if (style["font-family"] != null && style["font-family"].length() > 0) {
|
|
226 |
rowFontFamilyStyle[i] = style["font-family"]
|
|
214 | 227 |
} |
228 |
if (style["font-style"] != null && style["font-style"].length() > 0) { |
|
229 |
rowFontStyleStyle[i] = Integer.parseInt(style["font-style"]) |
|
230 |
} |
|
215 | 231 |
} |
216 | 232 |
} |
217 | 233 |
} |
... | ... | |
222 | 238 |
println "ROW FONT-SIZ=$rowFontSizeStyle" |
223 | 239 |
println "ROW SIZ=$rowPointSizeStyle" |
224 | 240 |
println "ROW VIZ=$rowHiddenStyle" |
241 |
println "ROW STYLE=$rowFontStyleStyle" |
|
225 | 242 |
} |
226 | 243 |
|
227 | 244 |
|
228 | 245 |
// UPDATE THE CHART RENDERER |
229 | 246 |
|
230 | 247 |
def chartEditor = editor.getEditors()[0] |
231 |
def chartComposite = chartEditor.getComposite() |
|
232 |
|
|
233 |
ddebug = debug |
|
234 |
monitor.syncExec( new Runnable() { |
|
248 |
def chartComposite = chartEditor.getComposite()
|
|
249 |
|
|
250 |
ddebug = debug
|
|
251 |
monitor.syncExec( new Runnable() {
|
|
235 | 252 |
public void run() { |
236 | 253 |
println chartComposite |
237 |
def chart = chartEditor.getChart(); |
|
238 |
|
|
239 |
//println "chart: "+chart |
|
240 |
//println "Plot: "+chart.getPlot() |
|
241 |
//println "Dataset: "+chart.getPlot().getDataset() |
|
242 |
//println "Renderer: "+chart.getPlot().getRenderer() |
|
243 |
|
|
254 |
def chart = chartEditor.getChart() |
|
255 |
|
|
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 |
|
|
244 | 263 |
def renderer = new CAItemSelectionRenderer(ica, chart) { |
245 |
Area EMPTYAREA = new Area()
|
|
246 |
|
|
264 |
Area EMPTYAREA = new Area() |
|
265 |
|
|
247 | 266 |
@Override |
248 |
public void initItemLabelGenerator() { |
|
249 |
XYItemLabelGenerator generator = new XYItemLabelGenerator() { |
|
250 |
|
|
251 |
@Override |
|
252 |
public String generateLabel(XYDataset dataset, int series, int item) { |
|
253 |
if (series == 0 && rowHiddenStyle.contains(item)) { |
|
254 |
if (ddebug > 1) println "HIDDING ROW LABEL '$item' '${rows[item]}'" |
|
255 |
return "" |
|
256 |
} else if (series == 1 && colHiddenStyle.contains(item)) { |
|
257 |
if (ddebug > 1) println "HIDDING COL LABEL '$item' '${cols[item]}'" |
|
258 |
return "" |
|
259 |
} else if (series == 0 && rowLabelStyle.containsKey(item)) { |
|
260 |
if (ddebug > 1) println "RENAME ROW LABEL '$item' '${rows[item]}' -> '${rowLabelStyle[item]}'" |
|
261 |
return rowLabelStyle[item] |
|
262 |
} else if (series == 1 && colLabelStyle.containsKey(item)) { |
|
263 |
if (ddebug > 1) println "RENAME COL LABEL '$item' '${cols[item]}' -> '${colLabelStyle[item]}'" |
|
264 |
return colLabelStyle[item] |
|
265 |
} else { |
|
266 |
CAXYDataset caDataset = (CAXYDataset) dataset; |
|
267 |
return caDataset.getLabel(series, item); |
|
268 |
} |
|
269 |
} |
|
270 |
}; |
|
271 |
|
|
272 |
this.setBaseItemLabelGenerator(generator); |
|
273 |
this.setBaseItemLabelsVisible(true); |
|
274 |
} |
|
275 |
|
|
267 |
public void initItemLabelGenerator() { |
|
268 |
XYItemLabelGenerator generator = new XYItemLabelGenerator() { |
|
269 |
|
|
276 | 270 |
@Override |
277 |
public Font getItemLabelFont(int series, int item) { |
|
278 |
Font d = super.getItemLabelFont(series, item); |
|
279 |
|
|
280 |
if (series == 0 && rowFontSizeStyle.containsKey(item)) { |
|
281 |
if (ddebug > 1) println "FIX ROW FONT-SIZE $item ${rows[item]} -> ${rowFontSizeStyle[item]}" |
|
282 |
d = new Font(d.getFontName(), d.getStyle(), rowFontSizeStyle[item]); |
|
283 |
} else if (series == 1 && colFontSizeStyle.containsKey(item)) { |
|
284 |
if (ddebug > 1) println "FIX COL FONT-SIZE $item ${cols[item]} -> ${colFontSizeStyle[item]}" |
|
285 |
d = new Font(d.getFontName(), d.getStyle(), colFontSizeStyle[item]); |
|
286 |
} |
|
287 |
|
|
288 |
if (series == 0 && rowFontFamillyStyle.containsKey(item)) { |
|
289 |
if (ddebug > 1) println "FIX ROW FONT-FAMILLY $item ${rows[item]} -> ${rowFontFamillyStyle[item]}" |
|
290 |
d = new Font(rowFontFamillyStyle[item], d.getStyle(), d.getSize()); |
|
291 |
} else if (series == 1 && colFontFamillyStyle.containsKey(item)) { |
|
292 |
if (ddebug > 1) println "FIX COL FONT-FAMILLY $item ${cols[item]} -> ${colFontFamillyStyle[item]}" |
|
293 |
d = new Font(colFontFamillyStyle[item], d.getStyle(), d.getSize()); |
|
294 |
} |
|
295 |
|
|
296 |
return d; |
|
297 |
} |
|
298 |
|
|
299 |
@Override |
|
300 |
public Shape getItemShape(int series, int item) { |
|
301 |
// Rows (series == 0), Cols (series == 1) |
|
271 |
public String generateLabel(XYDataset dataset, int series, int item) { |
|
302 | 272 |
if (series == 0 && rowHiddenStyle.contains(item)) { |
303 |
return EMPTYAREA; |
|
273 |
if (ddebug > 1) println "HIDDING ROW LABEL '$item' '${rows[item]}'" |
|
274 |
return "" |
|
304 | 275 |
} else if (series == 1 && colHiddenStyle.contains(item)) { |
305 |
return EMPTYAREA; |
|
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] |
|
306 | 284 |
} else { |
307 |
AffineTransform t = new AffineTransform(); |
|
308 |
Shape shape = super.getItemShape(series, item); |
|
309 |
if (series == 0 && rowPointSizeStyle.containsKey(item)) { |
|
310 |
if (ddebug > 1) println "FIX ROW POINT SIZE $item ${rows[item]} -> ${rowPointSizeStyle[item]}" |
|
311 |
t.setToScale(rowPointSizeStyle.get(item), rowPointSizeStyle.get(item)); |
|
312 |
shape = t.createTransformedShape(shape); |
|
313 |
} else if (series == 1 && colPointSizeStyle.containsKey(item)) { |
|
314 |
if (ddebug > 1) println "FIX COL POINT SIZE $item ${cols[item]} -> ${colPointSizeStyle[item]}" |
|
315 |
t.setToScale(colPointSizeStyle.get(item), colPointSizeStyle.get(item)); |
|
316 |
shape = t.createTransformedShape(shape); |
|
317 |
} |
|
318 |
return shape; |
|
285 |
CAXYDataset caDataset = (CAXYDataset) dataset; |
|
286 |
return caDataset.getLabel(series, item); |
|
319 | 287 |
} |
320 | 288 |
} |
321 |
|
|
322 |
@Override |
|
323 |
public Paint getItemPaint(int series, int item) { |
|
324 |
if (series == 0 && rowPointColorStyle.containsKey(item)) { |
|
325 |
if (ddebug > 1) println "FIX ROW POINT COLOR $item ${rows[item]} -> ${rowPointColorStyle[item]}" |
|
326 |
return rowPointColorStyle.get(item); |
|
327 |
} else if (series == 1 && colPointColorStyle.containsKey(item)) { |
|
328 |
if (ddebug > 1) println "FIX COL POINT COLOR $item ${cols[item]} -> ${colPointColorStyle[item]}" |
|
329 |
return colPointColorStyle.get(item); |
|
330 |
} else { |
|
331 |
return super.getItemPaint(series, item); |
|
332 |
} |
|
289 |
}; |
|
290 |
|
|
291 |
// don't use setBaseItemLabelGenerator BUT setDefaultItemLabelGenerator |
|
292 |
this.setDefaultItemLabelGenerator(generator); |
|
293 |
this.setDefaultItemLabelsVisible(true); |
|
294 |
} |
|
295 |
|
|
296 |
|
|
297 |
|
|
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(); |
|
304 |
|
|
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 |
} |
|
313 |
|
|
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]; |
|
321 |
} |
|
322 |
|
|
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]; |
|
330 |
} |
|
331 |
|
|
332 |
|
|
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; |
|
333 | 351 |
} |
334 |
}; |
|
335 |
|
|
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; |
|
365 |
} |
|
366 |
} |
|
367 |
|
|
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 |
} |
|
387 |
} |
|
388 |
|
|
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 |
} |
|
401 |
} |
|
402 |
|
|
403 |
|
|
404 |
|
|
405 |
}; |
|
406 |
|
|
407 |
|
|
336 | 408 |
def cp = editor.editors[0].getChart(); |
337 | 409 |
renderer.chart = cp |
338 |
renderer.setSeriesVisible(0, ica.isShowVariables()); // Rows |
|
410 |
renderer.setSeriesVisible(0, ica.isShowVariables()); // Rows
|
|
339 | 411 |
renderer.setSeriesVisible(1, ica.isShowIndividuals()); // Columns |
340 | 412 |
chart.getXYPlot().setRenderer(renderer) |
413 |
|
|
414 |
ica.getChartCreator().updateChart(chartEditor.getResult()) |
|
415 |
|
|
416 |
} |
|
417 |
}); |
|
341 | 418 |
|
342 |
ica.getChartCreator().getChartsEngine().getJFCTheme().apply(chart); // need to be call AFTER setRenderer() cause this method changes some renderering parameters |
|
343 |
} |
|
344 |
}); |
|
419 |
|
|
420 |
|
|
421 |
|
|
422 |
// creates a Color object from the specified RGB or RGBA string representation separated by spaces ("R G B" or "R G B A") from 0 to 255 for each channel |
|
423 |
def rgbaStringToColor(String color) { |
|
424 |
String[] rgbColor = color.split(" "); |
|
425 |
String alpha = "255"; |
|
426 |
if(rgbColor.length > 2) { |
|
427 |
if(rgbColor.length > 3) { |
|
428 |
alpha = rgbColor[3]; |
|
429 |
} |
|
430 |
return new Color(Integer.parseInt(rgbColor[0]), Integer.parseInt(rgbColor[1]), Integer.parseInt(rgbColor[2]), Integer.parseInt(alpha)) |
|
431 |
} |
|
432 |
else { |
|
433 |
println "Error in color format for string: $color" |
|
434 |
} |
|
435 |
|
|
436 |
} |
|
437 |
|
|
438 |
|
Formats disponibles : Unified diff