Reputation: 830
How to add values to DataPoint
which to be plotted in case I do not know number of possible entries?
DataPoint[] db = new DataPoint[]{
new DataPoint(5,4),
new DataPoint(2,4),
new DataPoint(4,4),
new DataPoint(9,0),
new DataPoint(0,3)} ;
PointsGraphSeries<DataPoint> series = new PointsGraphSeries<DataPoint>(db) ;
Upvotes: 1
Views: 3009
Reputation: 11
Make a call to this method before you add DataPoint array to LineGraphSeries.
private void generateDataForGraph() {
int size = Amount.size();
values = new DataPoint[size];
for (int i=0; i<size; i++) {
Integer xi = Integer.parseInt(Dates.get(i));
Integer yi = Integer.parseInt(Amount.get(i));
DataPoint v = new DataPoint(xi, yi);
values[i] = v;
}
series = new LineGraphSeries<DataPoint>(values);
graph2.addSeries(series);
}
Upvotes: 1