0
我正在使用GraphView
庫,我想使用方法GraphViewData
來顯示LineGraph
。說實話,我不知道如何用這個庫生成LineGraph
。所以我刪除了顯示LineGraph
的示例模擬數據,並用我自己的x數據和y數據替換了它。GraphView庫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);