private JSONObject toJSON(long timestamp, Points.Point point, String unit) throws SerializationException {
final JSONObject object = new JSONObject();
object.put("timestamp", timestamp);
if (!(point.getData() instanceof HistogramRollup)) {
throw new SerializationException("Unsupported type. HistogramRollup expected.");
}
HistogramRollup histogramRollup = (HistogramRollup) point.getData();
final JSONArray hist = new JSONArray();