Inhalt:
- Daten- / Objektstruktur
- Füllen von Daten
- Chartkonfiguration
Optimale Datenstruktur (Datenbank):
Kategorie / Beschriftung | Eltern Kategorie | Tooltip |
---|---|---|
"Company" | "" | "Company" |
"QA" | "Company" | "QA" |
"Marketing" | "Company" | "Marketing" |
"Employee 1" | "Marketing" | "Employee 1" |
"Employee 2" | "Marketing" | "Employee 2" |
Optimale Objektstruktur (Java)
public class BubbleChartObject { private String name; private String root; private String tooltip; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getRoot() { return root; } public void setRoot(String root) { this.root = root; } public String getTooltip() { return tooltip; } public void setTooltip(String tooltip) { this.tooltip = tooltip; } }
Beispiel: Füllen der Daten
XdevOrgChartModel model = new XdevOrgChartModel(); model.addItem("Company", "", ""); model.addItem("QA", "Company", "QA"); model.addItem("Sales", "Company", "Sales"); model.addItem("Marketing", "Company", "Marketing"); model.addItem("Developement", "Company", "Developement"); model.addItem("Production", "Company", "Production"); model.addItem("Employee 1", "QA", "Employee"); model.addItem("Employee 2", "QA", "Employee"); model.addItem("Employee 3", "QA", "Employee"); model.addItem("Employee 4", "Sales", "Employee"); model.addItem("Employee 5", "Sales", "Employee"); model.addItem("Employee 6", "Sales", "Employee"); model.addItem("Employee 7", "Sales", "Employee"); model.addItem("Employee 8", "Marketing", "Employee"); model.addItem("Employee 9", "Developement", "Employee"); model.addItem("Employee 10", "Developement", "Employee"); model.addItem("Employee 11", "Production", "Employee"); model.addItem("Employee 12", "Production", "Employee"); orgChart.setModel(model);
API und Methoden:
Füllen der Daten
model.addItem(String value, String value2, Integer value3)
model.addItem("QA", "Company", "QA"); //Parameter 1 ("QA"): Name und Beschriftung des Elements //Parameter 2 ("Company"): Eltern Element //Parameter 3 ("QA"): Tooltip des Elements
Konfiguration des OrgCharts
XdevOrgChartConfig config = new XdevOrgChartConfig(); config.setAllowCollapse(true); //Erlaubt das Zusammenklappen einzelner Notes config.setAllowHtml(true); //Erlaubt die Verwendung vom HTML Formatierten Inhalten config.setSize("medium"); //Definiert die Gesamtgröße des Charts und dessen Elemente. Verfügbare Werte: "Small", "medium", "large" orgChart.setConfig(config);