Révision 648
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/JFCChartCreator.java (revision 648) | ||
---|---|---|
45 | 45 |
chart.setNotify(false); |
46 | 46 |
|
47 | 47 |
|
48 |
// applying full theme |
|
49 |
if(applyTheme) { |
|
50 |
this.getChartsEngine().getJFCTheme().applyThemeToChart(result); |
|
51 |
} |
|
52 |
|
|
53 |
|
|
54 |
// rendering color mode |
|
55 |
this.getChartsEngine().getJFCTheme().applySeriesPaint(result); |
|
56 |
|
|
57 |
// multiple line strokes |
|
58 |
this.getChartsEngine().getJFCTheme().applySeriesStrokes(result); |
|
59 |
|
|
48 | 60 |
// title visibility |
49 | 61 |
if(chart.getTitle() != null && result.hasParameterChanged(ChartsEnginePreferences.SHOW_TITLE)) { |
50 | 62 |
chart.getTitle().setVisible(result.isTitleVisible()); |
... | ... | |
53 | 65 |
if(chart.getLegend() != null && result.hasParameterChanged(ChartsEnginePreferences.SHOW_LEGEND)) { |
54 | 66 |
chart.getLegend().setVisible(result.isLegendVisible()); |
55 | 67 |
} |
56 |
|
|
57 | 68 |
// grid visibility |
58 |
if(result.hasParameterChanged(ChartsEnginePreferences.SHOW_GRID)) { |
|
59 |
// CategoryPlot |
|
60 |
if(chart.getPlot() instanceof CategoryPlot) { |
|
61 |
CategoryPlot plot = (CategoryPlot) chart.getPlot(); |
|
62 |
plot.setDomainGridlinesVisible(result.isGridVisible()); |
|
63 |
plot.setRangeGridlinesVisible(result.isGridVisible()); |
|
64 |
} |
|
65 |
// XYPlot |
|
66 |
else if(chart.getPlot() instanceof XYPlot) { |
|
67 |
XYPlot plot = (XYPlot) chart.getPlot(); |
|
68 |
plot.setRangeGridlinesVisible(result.isGridVisible()); |
|
69 |
plot.setDomainGridlinesVisible(result.isGridVisible()); |
|
70 |
} |
|
69 |
// CategoryPlot |
|
70 |
if(chart.getPlot() instanceof CategoryPlot) { |
|
71 |
CategoryPlot plot = (CategoryPlot) chart.getPlot(); |
|
72 |
plot.setDomainGridlinesVisible(result.isGridVisible()); |
|
73 |
plot.setRangeGridlinesVisible(result.isGridVisible()); |
|
71 | 74 |
} |
75 |
// XYPlot |
|
76 |
else if(chart.getPlot() instanceof XYPlot) { |
|
77 |
XYPlot plot = (XYPlot) chart.getPlot(); |
|
78 |
plot.setRangeGridlinesVisible(result.isGridVisible()); |
|
79 |
plot.setDomainGridlinesVisible(result.isGridVisible()); |
|
80 |
} |
|
72 | 81 |
|
73 |
|
|
74 |
if(applyTheme) { |
|
75 |
this.getChartsEngine().getJFCTheme().applyThemeToChart(result); |
|
76 |
} |
|
77 |
|
|
78 | 82 |
chart.setNotify(true); |
79 | 83 |
} |
80 | 84 |
// File |
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/themes/highcharts/defaulttheme/HighchartsDefaultTheme.java (revision 648) | ||
---|---|---|
152 | 152 |
|
153 | 153 |
|
154 | 154 |
|
155 |
int itemsColorsRenderingMode = result.getRenderingColorsMode(); |
|
155 |
//int itemsColorsRenderingMode = result.getRenderingColorsMode();
|
|
156 | 156 |
|
157 | 157 |
// FIXME : UI settings |
158 | 158 |
// UIManager.put("ToolTip.background", Color.gray); |
... | ... | |
203 | 203 |
|
204 | 204 |
|
205 | 205 |
// Series lines width and style |
206 |
if(result.isMultipleLineStrokes()) { |
|
207 |
this.applySeriesStrokes(plot);
|
|
208 |
} |
|
209 |
else { |
|
206 |
// if(result.isMultipleLineStrokes()) {
|
|
207 |
// this.applySeriesStrokes(result);
|
|
208 |
// }
|
|
209 |
// else {
|
|
210 | 210 |
for(int i = 0; i < plot.getSeriesCount(); i++) { |
211 | 211 |
renderer.setSeriesStroke(i, new BasicStroke(seriesLineWidth)); |
212 | 212 |
} |
213 |
} |
|
213 |
// }
|
|
214 | 214 |
|
215 | 215 |
|
216 | 216 |
// Used for item selection mouse over |
... | ... | |
220 | 220 |
|
221 | 221 |
|
222 | 222 |
// Items colors |
223 |
ArrayList<Color> palette = this.applySeriesPaint(plot, itemsColorsRenderingMode);
|
|
223 |
//ArrayList<Color> palette = this.applySeriesPaint(result);
|
|
224 | 224 |
|
225 | 225 |
renderer.setBaseOutlinePaint(Color.WHITE); |
226 | 226 |
|
... | ... | |
356 | 356 |
|
357 | 357 |
|
358 | 358 |
// Items colors |
359 |
ArrayList<Color> palette = this.applySeriesPaint(plot, itemsColorsRenderingMode); |
|
359 |
//ArrayList<Color> palette = this.applySeriesPaint(plot, itemsColorsRenderingMode);
|
|
360 | 360 |
|
361 | 361 |
|
362 | 362 |
// Category bar chart |
... | ... | |
416 | 416 |
else { |
417 | 417 |
|
418 | 418 |
// Series lines width and style |
419 |
if(result.isMultipleLineStrokes()) { |
|
420 |
this.applySeriesStrokes(plot);
|
|
421 |
} |
|
422 |
else { |
|
419 |
// if(result.isMultipleLineStrokes()) {
|
|
420 |
// this.applySeriesStrokes(result);
|
|
421 |
// }
|
|
422 |
// else {
|
|
423 | 423 |
for(int i = 0; i < ((CategoryPlot)plot).getDataset().getRowCount(); i++) { |
424 | 424 |
renderer.setSeriesStroke(i, new BasicStroke(seriesLineWidth)); |
425 | 425 |
} |
426 |
} |
|
426 |
// }
|
|
427 | 427 |
|
428 | 428 |
|
429 | 429 |
plot.setRangeZeroBaselineVisible(true); |
... | ... | |
499 | 499 |
Plot plot = chart.getPlot(); |
500 | 500 |
|
501 | 501 |
// Items colors |
502 |
ArrayList<Color> palette = this.applySeriesPaint(plot, itemsColorsRenderingMode); |
|
502 |
//ArrayList<Color> palette = this.applySeriesPaint(plot, itemsColorsRenderingMode);
|
|
503 | 503 |
|
504 | 504 |
|
505 | 505 |
// Series lines width and style |
506 | 506 |
if(result.isMultipleLineStrokes()) { |
507 |
this.applySeriesStrokes(plot);
|
|
507 |
this.applySeriesStrokes(result);
|
|
508 | 508 |
} |
509 | 509 |
|
510 | 510 |
this.applySeriesShapes(plot); |
tmp/org.txm.chartsengine.jfreechart.core/src/org/txm/chartsengine/jfreechart/core/themes/base/JFCTheme.java (revision 648) | ||
---|---|---|
1 | 1 |
package org.txm.chartsengine.jfreechart.core.themes.base; |
2 | 2 |
|
3 |
import java.awt.BasicStroke; |
|
3 | 4 |
import java.awt.Color; |
4 | 5 |
import java.awt.Font; |
5 | 6 |
import java.awt.Paint; |
... | ... | |
355 | 356 |
* @param plot |
356 | 357 |
* @param itemsColorsRenderingMode |
357 | 358 |
*/ |
358 |
public ArrayList<Color> applySeriesPaint(Plot plot, int itemsColorsRenderingMode) {
|
|
359 |
public ArrayList<Color> applySeriesPaint(ChartResult result) {
|
|
359 | 360 |
|
360 | 361 |
ArrayList<Color> palette = null; |
361 | 362 |
|
363 |
Plot plot = ((JFreeChart) result.getChart()).getPlot(); |
|
364 |
|
|
362 | 365 |
// XYPlot |
363 | 366 |
if(plot instanceof XYPlot) { |
364 | 367 |
|
365 | 368 |
XYPlot typedPlot = (XYPlot)plot; |
366 | 369 |
XYItemRenderer renderer = typedPlot.getRenderer(); |
367 | 370 |
|
368 |
palette = this.chartsEngine.getTheme().getPaletteFor(itemsColorsRenderingMode, typedPlot.getSeriesCount());
|
|
371 |
palette = this.chartsEngine.getTheme().getPaletteFor(result.getRenderingColorsMode(), typedPlot.getSeriesCount());
|
|
369 | 372 |
for(int i = 0; i < palette.size(); i++) { |
370 | 373 |
renderer.setSeriesPaint(i, palette.get(i)); |
371 | 374 |
} |
... | ... | |
376 | 379 |
CategoryPlot typedPlot = (CategoryPlot)plot; |
377 | 380 |
CategoryItemRenderer renderer = (CategoryItemRenderer)typedPlot.getRenderer(); |
378 | 381 |
|
379 |
palette = this.chartsEngine.getTheme().getPaletteFor(itemsColorsRenderingMode, typedPlot.getDataset().getRowCount());
|
|
382 |
palette = this.chartsEngine.getTheme().getPaletteFor(result.getRenderingColorsMode(), typedPlot.getDataset().getRowCount());
|
|
380 | 383 |
for(int i = 0; i < palette.size(); i++) { |
381 | 384 |
renderer.setSeriesPaint(i, palette.get(i)); |
382 | 385 |
} |
... | ... | |
384 | 387 |
// SpiderPlot |
385 | 388 |
else if(plot instanceof SpiderWebPlot) { |
386 | 389 |
SpiderWebPlot typedPlot = (SpiderWebPlot)plot; |
387 |
palette = this.chartsEngine.getTheme().getPaletteFor(itemsColorsRenderingMode, typedPlot.getDataset().getRowCount());
|
|
390 |
palette = this.chartsEngine.getTheme().getPaletteFor(result.getRenderingColorsMode(), typedPlot.getDataset().getRowCount());
|
|
388 | 391 |
for(int i = 0; i < palette.size(); i++) { |
389 | 392 |
typedPlot.setSeriesPaint(i, palette.get(i)); |
390 | 393 |
} |
... | ... | |
392 | 395 |
// PiePlot |
393 | 396 |
else if(plot instanceof PiePlot) { |
394 | 397 |
PiePlot typedPlot = (PiePlot)plot; |
395 |
palette = this.chartsEngine.getTheme().getPaletteFor(itemsColorsRenderingMode, typedPlot.getDataset().getItemCount());
|
|
398 |
palette = this.chartsEngine.getTheme().getPaletteFor(result.getRenderingColorsMode(), typedPlot.getDataset().getItemCount());
|
|
396 | 399 |
for(int i = 0; i < palette.size(); i++) { |
397 | 400 |
typedPlot.setSectionPaint(i, palette.get(i)); |
398 | 401 |
} |
... | ... | |
446 | 449 |
* Sets the series strokes in the plot renderer according to user defined strokes in a cyclic way. |
447 | 450 |
* @param plot |
448 | 451 |
*/ |
449 |
public void applySeriesStrokes(Plot plot) {
|
|
450 |
this.applySeriesStrokes(plot, true);
|
|
452 |
public void applySeriesStrokes(ChartResult result) {
|
|
453 |
this.applySeriesStrokes(result, true);
|
|
451 | 454 |
} |
452 | 455 |
|
453 | 456 |
|
... | ... | |
455 | 458 |
* Sets the series strokes in the plot renderer according to user defined strokes. |
456 | 459 |
* @param plot |
457 | 460 |
*/ |
458 |
public void applySeriesStrokes(Plot plot, boolean cyclic) {
|
|
461 |
public void applySeriesStrokes(ChartResult result, boolean cyclic) {
|
|
459 | 462 |
|
460 |
if(plot instanceof XYPlot) {
|
|
463 |
Plot plot = ((JFreeChart) result.getChart()).getPlot();
|
|
461 | 464 |
|
462 |
XYPlot typedPlot = (XYPlot)plot;
|
|
463 |
AbstractRenderer renderer = (AbstractRenderer) typedPlot.getRenderer();
|
|
465 |
// XYPlot
|
|
466 |
if (plot instanceof XYPlot) {
|
|
464 | 467 |
|
465 |
for(int i = 0, j = 0; i < typedPlot.getSeriesCount(); i++, j++) { |
|
466 |
if(j == this.seriesStrokes.size()) { |
|
467 |
if(cyclic) { |
|
468 |
j = 0; |
|
469 |
} |
|
470 |
else { |
|
471 |
break; |
|
472 |
} |
|
473 |
} |
|
474 |
renderer.setSeriesStroke(i, this.seriesStrokes.get(j)); |
|
475 |
} |
|
468 |
XYPlot typedPlot = (XYPlot) plot; |
|
469 |
AbstractRenderer renderer = (AbstractRenderer) typedPlot.getRenderer(); |
|
476 | 470 |
|
477 |
} |
|
478 |
else if(plot instanceof CategoryPlot) { |
|
471 |
for (int i = 0, j = 0; i < typedPlot.getSeriesCount(); i++, j++) { |
|
479 | 472 |
|
480 |
CategoryPlot typedPlot = (CategoryPlot)plot; |
|
481 |
CategoryItemRenderer renderer = (CategoryItemRenderer)typedPlot.getRenderer(); |
|
473 |
// Multiple styles |
|
474 |
if(result.isMultipleLineStrokes()) { |
|
475 |
if (j == this.seriesStrokes.size()) { |
|
476 |
if (cyclic) { |
|
477 |
j = 0; |
|
478 |
} |
|
479 |
else { |
|
480 |
break; |
|
481 |
} |
|
482 |
} |
|
483 |
renderer.setSeriesStroke(i, this.seriesStrokes.get(j)); |
|
484 |
} |
|
485 |
// Unique style |
|
486 |
else { |
|
487 |
renderer.setSeriesStroke(i, new BasicStroke(seriesLineWidth)); |
|
488 |
} |
|
489 |
} |
|
482 | 490 |
|
483 |
// Series line width |
|
484 |
for(int i = 0, j = 0; i < typedPlot.getDataset().getRowCount(); i++, j++) { |
|
491 |
} |
|
492 |
// CategoryPlot |
|
493 |
else if (plot instanceof CategoryPlot) { |
|
485 | 494 |
|
486 |
if(j == this.seriesStrokes.size()) { |
|
487 |
if(cyclic) { |
|
488 |
j = 0; |
|
489 |
} |
|
490 |
else { |
|
491 |
break; |
|
492 |
} |
|
493 |
} |
|
494 |
renderer.setSeriesStroke(i, this.seriesStrokes.get(j)); |
|
495 |
CategoryPlot typedPlot = (CategoryPlot) plot; |
|
496 |
CategoryItemRenderer renderer = (CategoryItemRenderer) typedPlot.getRenderer(); |
|
497 |
|
|
498 |
for (int i = 0, j = 0; i < typedPlot.getDataset().getRowCount(); i++, j++) { |
|
499 |
|
|
500 |
// Multiple styles |
|
501 |
if(result.isMultipleLineStrokes()) { |
|
502 |
if (j == this.seriesStrokes.size()) { |
|
503 |
if (cyclic) { |
|
504 |
j = 0; |
|
505 |
} |
|
506 |
else { |
|
507 |
break; |
|
508 |
} |
|
509 |
} |
|
510 |
renderer.setSeriesStroke(i, this.seriesStrokes.get(j)); |
|
511 |
} |
|
512 |
// Unique style |
|
513 |
else { |
|
514 |
renderer.setSeriesStroke(i, new BasicStroke(seriesLineWidth)); |
|
515 |
} |
|
495 | 516 |
} |
496 | 517 |
|
497 |
}
|
|
518 |
}
|
|
498 | 519 |
} |
499 | 520 |
|
500 | 521 |
|
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 648) | ||
---|---|---|
209 | 209 |
// check that the charts engine used for the result matches the SWT components provider otherwise fin a suitable components provider |
210 | 210 |
if(this.getResult().getChartsEngine() != this.getSWTChartsComponentsProvider().getChartsEngine()) { |
211 | 211 |
this.getEditorInput().setSWTChartsComponentsProvider(SWTChartsComponentsProvider.getComponentsProvider(this.getResult().getChartsEngine())); |
212 |
//this.getSWTChartsComponentsProvider().setChartsEngine(this.getResult().getChartsEngine());
|
|
212 |
this.getSWTChartsComponentsProvider().setChartsEngine(this.getResult().getChartsEngine()); |
|
213 | 213 |
System.err.println("ChartEditor.__updateEditorFromResult(): charts engine used to create the chart is not the current one. The SWT components provider has been changed to match it: " + this.getSWTChartsComponentsProvider() + "."); |
214 | 214 |
|
215 | 215 |
// recreating the chart composite |
Formats disponibles : Unified diff