// create data
Date d = dtf.parse("2012-08-23");
int n = 200; // number of datapoints
for (int i = 0; i < n; i++) {
JSONObject pointA = new JSONObject();
pointA.put("date", new JSONNumber(d.getTime()));
pointA.put("value", new JSONNumber(customFunctionA(i)));
dataA.set(i, pointA);
JSONObject pointB = new JSONObject();
pointB.put("date", new JSONNumber(d.getTime()));
pointB.put("value", new JSONNumber(customFunctionB(i)));
dataB.set(i, pointB);
d.setTime(d.getTime() + 1000 * 60); // steps of one minute
}
JSONObject dataSetA = new JSONObject();
dataSetA.put("label", new JSONString("Function A"));
dataSetA.put("data", dataA);
JSONObject dataSetB = new JSONObject();
dataSetB.put("label", new JSONString("Function B"));
dataSetB.put("data", dataB);
Graph.Options options = Graph.Options.create();
options.setHeight("400px");
options.setLineStyle(Graph.Options.LINESTYLE.DOT, 1);
options.setLineColor("blue", 1);