I'm trying to plot graph using GraphView library. My problem is, the x-axis does not show up but the y-axis can. Besides, the value at the x-axis label also not showing up.
Here is my xml file:
<com.jjoe64.graphview.GraphView
android:id="@+id/graph"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:background="#FAFA82" />
and the java code:
double graph1LastXValue = 5d;
GraphView graph = (GraphView) findViewById(R.id.graph);
graph.getGridLabelRenderer().setVerticalAxisTitle("Match Value");
graph.getGridLabelRenderer().setHorizontalAxisTitle("Time/s");
Series2 = new LineGraphSeries<DataPoint>();
mSeries1.setColor(Color.RED);
mSeries1.setThickness(2);
graph.addSeries(mSeries2);
graph.getViewport().setXAxisBoundsManual(true);
graph.getViewport().setMinX(0);
graph.getViewport().setMaxX(100);
graph.getGridLabelRenderer().setGridStyle(GridStyle.BOTH);
plotter(matchValMean);
protected void plotter(Double matchVal) {
matchValue = matchVal;
// TODO Auto-generated method stub
mTimer1 = new Runnable() {
@Override
public void run() {
graph1LastXValue += 1d;
mSeries1.appendData(new DataPoint(graph1LastXValue, matchValue), true, 100);
mHandler.postDelayed(this, 1000);
}
};
mHandler.postDelayed(mTimer1, 1000);
}
I did not show all the codes because it is very long. Thanks in advance :)