Kombucha - 2011-09-13

Hi,

I've encountered a "bug", or at least a limitation, with the current implementation of your wrapper : I can't create a Point with the y value set to null. For example, new Point(myDate, null) throws a NullPointerException.
I think I managed to fix it (ie. it now works for me, but I haven't tested it thoroughly).
In BaseChart.java, starting at line 2007 :

~~~~~~~
:::java
static JSONValue convertPointToJSON(Point point) {
final JSONObject options = point.getOptions();
if (options != null) {
return addPointScalarValues(point, options);
} else if (point.getX() != null) {
JSONArray jsonArray = new JSONArray();
jsonArray.set(0, new JSONNumber(point.getX().doubleValue()));
// Oh noes, point.getY == null !
// jsonArray.set(1, new JSONNumber(point.getY().doubleValue()));
if(point.getY() != null) {
jsonArray.set(1, new JSONNumber(point.getY().doubleValue()));
} else {
jsonArray.set(1, JSONNull.getInstance());
}
return jsonArray;
} else if (point.getY() != null) {
return new JSONNumber(point.getY().doubleValue());
} else {
return JSONNull.getInstance();
}
}
~~~~~~

Am I doing it wrong, or is it worth correcting in the next version of gwt-highcharts ?

 

Last edit: Kombucha 2011-09-21