Versions Compared

Key

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

Beispiel:

Inhalt:

Anchor
Data
Data

Optimale Datenstruktur (Datenbank):

Y-AchseKategorieX-Achse
Beverages2017

550

Beverages2018550

Optimale Objektstruktur (Java):

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
public class BarChartObject {

	private String Y_Achseyvalue;
	private String kategoriecategory;
	private Integer X_Achsexvalue;
	
	public String getY_AchsegetYvalue() {
		return this.Y_Achseyvalue;
	}

	public void setY_AchsesetYvalue(final String y_Achseyvalue) {
		this.Y_Achseyvalue = y_Achseyvalue;
	}

	public String getKategoriegetCategory() {
		return this.kategoriecategory;
	}

	public void setKategoriesetCategory(final String kategoriecategory) {
		this.kategoriecategory = kategoriecategory;
	}

	public Integer getX_AchsegetXvalue() {
		return this.X_Achsexvalue;
	}

	public void setX_AchsesetXvalue(final Integer x_Achsexvalue) {
		this.X_Achsexvalue = x_Achsexvalue;
	}
}

Anchor
Fill
Fill

Beispiel füllen der Daten:

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
//Erstellen Model und hinzufügen der Kategorien
final XdevBarChartModelChartModel model = new XdevBarChartModel();
model.addCategory("2017");
model.addCategory("2018"ChartModel.New()
	.addColumn(Column.New(Type.STRING, "year", "Jahr"))
	.addColumn(Column.New(Type.NUMBER, "iphone", "iPhone"))
	.addColumn(Column.New(Type.NUMBER, "android", "Android"));

//Füllen der Items
model.addItemaddRow("Beverages2014", "2017"1500, 5601200);
model.addItemaddRow("Beverages2015", "2018"805, 560700);

model.addItemaddRow("Condiments2016", "2017"920, 530600);
model.addItemaddRow("Condiments2017", "2018"1250, 5301500);

//Setzen des Models
barChart.setModel(model);

Anchor
Properties
Properties

API und Methoden:

...

Properties

...

languagejava
themeEclipse
firstline1
titlemodel.addCategory(String value);
linenumberstrue

...


Orientation

The orientation of the chart. When set to'vertical', rotates the axes of the chart so that (for instance) a column chart becomes a bar chart, and an area chart grows rightward instead of up:

Code Block
languagejava
themeEclipse

...

model.addItem("Beverages", "2017", 560);

//Parameter 1 ("Beverages"): Wert, welchen in der X-Achse angezeigt werden soll
//Parameter 2 ("2017"): Zuweisung zur jeweiligen vorher festgelegten Kategorie (Kategoriemapping)
//Parameter 3 (530): Wert für die Y-Achse. Zulässige Datentypen: Integer, Double,

Konfigurieren der Titel

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
//Erstellen einer Konfiguration für das Chart
XdevBarChartConfig config = new XdevBarChartConfig();

//Setzen Untertitel
config.setSubtitle("Subtitle");

//Setzen Charttitel
config.setTitle("Sales Overview");

Beispiel konfigurieren der Achsen

...

languagejava
themeEclipse
firstline1
linenumberstrue

...

this.barChart.setOrientation(Orientation.VERTICAL);


StackMode

The options for isStacked are:

  • false — elements will not stack. This is the default option.
  • true — stacks elements for all series at each domain value.
  • 'percent' — stacks elements for all series at each domain value and rescales them such that they add up to 100%, with each element's value calculated as a percentage of 100%.
  • 'relative' — stacks elements for all series at each domain value and rescales them such that they add up to 1, with each element's value calculated as a fraction of 1.
  • 'absolute' — functions the same as isStacked: true.
Code Block
languagejava
this.barChart.setStackMode(StackMode.TRUE);


Konfiguration von Texten und Legenden siehe API Allgemein