level 11
代码:
GraphView graphView;
// first init data
// sin curve
int num = 150;
GraphViewData[] data = new GraphViewData[num];
double v=0;
for (int i=0; i<num; i++) {
v += 0.2;
data[i] = new GraphViewData(i,v*v);
}
GraphViewSeries seriesSin = new GraphViewSeries("Sinus curve", new GraphViewSeriesStyle(Color.WHITE,1), data);
// cos curve
// random curve
/*
* create graph
*/
graphView = new LineGraphView(
this
, "GraphViewDemo"
);
// add data
graphView.addSeries(seriesSin);
// optional - set view port, start=2, size=10
graphView.setViewPort(2, 10);
graphView.setScalable(true);
// optional - legend
graphView.setShowLegend(true);
graphView.getGraphViewStyle().setGridColor(Color.GREEN);
graphView.getGraphViewStyle().setHorizontalLabelsColor(Color.YELLOW);
graphView.getGraphViewStyle().setVerticalLabelsColor(Color.RED);
graphView.setShowLegend(true);
graphView.setLegendAlign(LegendAlign.BOTTOM);
graphView.setLegendWidth(200);
2014年08月26日 10点08分
