Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Optimale Datenstruktur (Datenbank)

KategoryWert
Bverages393
Condimants
Condiments507
Confections386

Optimale Objektstruktur (Java)

...

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
final XdevPieChartModel model = new XdevPieChartModel();

model.addItem("Beverages", 393, null);
model.addItem("Condimants", 507, null);
model.addItem("Confections", 386, null);

chart.setModel(model);

oder per Schleife aus Query-Methode:

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
final XdevPieChartModel model = new XdevPieChartModel();

new ProductDAO().getProductsByCategoryForChart().forEach(p -> {
       model.addItem(p.getCategory().getCategoryname(), (int) p.getAmount(), null);
});

chart.setModel(model);