Android GraphView只在X轴上渲染一个日期
我从数据库中获取股票数据,在数据库中,公司的股票历史记录保存在DB列中。每天的数据以{date,stock_value}格式显示,并用“\n”与其他日期分隔Android GraphView只在X轴上渲染一个日期,android,android-graphview,Android,Android Graphview,我从数据库中获取股票数据,在数据库中,公司的股票历史记录保存在DB列中。每天的数据以{date,stock_value}格式显示,并用“\n”与其他日期分隔 String[]allStocks=history.split(“\n”); 字符串[]单股; ArrayList points=新的ArrayList(); GraphView图形=(GraphView)findViewById(R.id.graph); 对于(int i=0;i我以前没有使用过GraphView,但我发现的日期示例似乎是
String[]allStocks=history.split(“\n”);
字符串[]单股;
ArrayList points=新的ArrayList();
GraphView图形=(GraphView)findViewById(R.id.graph);
对于(int i=0;i我以前没有使用过GraphView,但我发现的日期示例似乎是将水平标签的数量设置为比正在绘制的项目数量多一个,因此我尝试:
graph.getGridLabelRenderer().setNumHorizontalLabels(points.size()+1);
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<com.jjoe64.graphview.GraphView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/graph" />
</LinearLayout>
graph.getGridLabelRenderer().setNumHorizontalLabels(points.size()+1);