[英]GraphView library x and y axis
我正在使用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);
您只能定义一个点的坐标。 要画线,您需要为2个不同的点定义坐标。
在数组中添加另一个具有不同X和Y值的GraphViewData。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.