Reputation: 19
I am using a GraphView
library and i want to use the method GraphViewData
to show the LineGraph
. To be honest I don't know how to generate the LineGraph
with this library. So I removed the sample mock data that shows the LineGraph
and replaced it with my own x data and y data.
But I am doing something wrong, it does not shows the line it self, only it fills the x axis and y axis:
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);
Upvotes: 0
Views: 845
Reputation: 131
You only define the coordinates for one point. To draw your line, you need to define the coordonates for 2 different points.
Add another GraphViewData in the array with different X and Y values.
Upvotes: 1