|
32 | 32 | import tools.dynamia.domain.ValidationError; |
33 | 33 | import tools.dynamia.domain.query.QueryCondition; |
34 | 34 | import tools.dynamia.domain.query.QueryParameters; |
| 35 | +import tools.dynamia.modules.dashboard.ChartjsDashboardWidget; |
35 | 36 | import tools.dynamia.modules.reports.api.EnumFilterProvider; |
36 | 37 | import tools.dynamia.modules.reports.core.*; |
37 | 38 | import tools.dynamia.modules.reports.core.domain.Report; |
|
48 | 49 | import tools.dynamia.zk.crud.ui.EntityFiltersPanel; |
49 | 50 | import tools.dynamia.zk.ui.chartjs.CategoryChartjsData; |
50 | 51 | import tools.dynamia.zk.ui.chartjs.Chartjs; |
| 52 | +import tools.dynamia.zk.ui.chartjs.ChartjsOptions; |
51 | 53 |
|
52 | 54 | import java.io.File; |
53 | 55 | import java.io.FileNotFoundException; |
@@ -479,22 +481,23 @@ public void updateDataView() { |
479 | 481 | updateChartView(); |
480 | 482 | } catch (Exception e) { |
481 | 483 | UIMessages.showMessage(messages.get("errorCharting") + ": " + e.getMessage(), MessageType.ERROR); |
482 | | - if (layout.getWest() != null) { |
483 | | - layout.getWest().detach(); |
| 484 | + if (layout.getEast() != null) { |
| 485 | + layout.getEast().detach(); |
484 | 486 | } |
485 | 487 | } |
486 | 488 | } |
487 | 489 |
|
488 | 490 | public void updateChartView() { |
489 | 491 | if (report.isChartable() && report.getCharts() != null && chartsContainer != null) { |
490 | 492 | chartsContainer.getChildren().clear(); |
491 | | - currentCharts.clear(); |
| 493 | + currentCharts = new ArrayList<>(); |
492 | 494 |
|
493 | 495 | Vlayout chartLayout = new Vlayout(); |
494 | 496 | chartsContainer.appendChild(chartLayout); |
495 | 497 |
|
496 | 498 | for (var c : report.getCharts()) { |
497 | 499 | CategoryChartjsData data = new CategoryChartjsData(); |
| 500 | + data.getDataset().setColorPalette(ChartjsDashboardWidget.MATERIAL_COLORS); |
498 | 501 |
|
499 | 502 | if (c.isGrouped()) { |
500 | 503 | Map<String, Number> groups = new HashMap<>(); |
@@ -522,6 +525,8 @@ public void updateChartView() { |
522 | 525 | chart.setType(c.getType()); |
523 | 526 | chart.setData(data); |
524 | 527 | chart.setTitle(c.getTitle()); |
| 528 | + |
| 529 | + |
525 | 530 | currentCharts.add(chart); |
526 | 531 |
|
527 | 532 | chartLayout.appendChild(chart); |
|
0 commit comments