我正在使用一个GraphView
库,我想使用该方法GraphViewData
来显示LineGraph
. 老实说,我不知道如何LineGraph
用这个库生成。因此,我删除了显示 的示例模拟数据,LineGraph
并将其替换为我自己的 x 数据和 y 数据。
但我做错了,它没有显示它自己的线,只有它填充了 x 轴和 y 轴:
Bundle extras = getIntent().getExtras();
if(extras != null) {
valueX = extras.getDouble("xValue");
valueY = extras.getDouble("yValue");
Log.d("X = " + valueX, " Y = " + valueY);
}
GraphViewSeries exampleSeries = new GraphViewSeries(
new GraphViewData[] {
new GraphViewData(valueX, valueY)
});
// graph with dynamically genereated horizontal and vertical labels
GraphView graphView;
graphView = new LineGraphView(
this, // context
"Incomming Bluetooth Data"); // heading
graphView.addSeries(exampleSeries); // data
LinearLayout layout = (LinearLayout) findViewById(R.id.graph1);
layout.addView(graphView);