Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 27 Current »

Beispiel:

Inhalt:

Optimale Datenstruktur (Datenbank):

Y-AchseKategorieX-Achse
Beverages2017

550

Beverages2018550

Optimale Objektstruktur (Java):

public class BarChartObject {

	private String yvalue;
	private String category;
	private Integer xvalue;

	public String getYvalue() {
		return this.yvalue;
	}

	public void setYvalue(final String yvalue) {
		this.yvalue = yvalue;
	}

	public String getCategory() {
		return this.category;
	}

	public void setCategory(final String category) {
		this.category = category;
	}

	public Integer getXvalue() {
		return this.xvalue;
	}

	public void setXvalue(final Integer xvalue) {
		this.xvalue = xvalue;
	}
}

Beispiel füllen der Daten:

//Erstellen Model und hinzufügen der Kategorien
final ChartModel model = 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.addRow("2014", 1500, 1200);
model.addRow("2015", 805, 700);
model.addRow("2016", 920, 600);
model.addRow("2017", 1250, 1500);

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

API und Methoden:

Properties
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:

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.
this.barChart.setStackMode(StackMode.TRUE);

Konfiguration von Texten und Legenden siehe API Allgemein

  • No labels