Versions Compared

Key

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

...

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
import com.xdev.charts.AbstractXdevChart.ValueChangeListener;

chart.addValueChangeListener(new ValueChangeListener() {

	@Override
	public void valueChange(String json) {
		// Fügen Sie hier Ihren eigenen Eventcode hinzu
	}
});

JSON-Inhalt nach Charts

XdevBarChart

Code Block
languagexml
themeEclipse
firstline1
linenumberstrue
{"category":"2017","xvalue":559,"yvalue":"Beverages"}

JSON-INhalt wieder auf ein Chartobjekt mappen

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
final Gson g = new Gson();
final BarChartObject fromJson = g.fromJson(json, BarChartObject.class);

Über ein solches BarChartObject lässt sich jetzt bequem wieder auf die einzelnen Attribute zugreifen

Code Block
languagejava
themeEclipse
firstline1
linenumberstrue
final Gson g = new Gson();
final BarChartObject fromJson = g.fromJson(json, BarChartObject.class);

Integer xvalue = fromJson.getXvalue();
String yvalue = fromJson.getYvalue();
String category = fromJson.getCategory();