Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/218.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android GraphView只在X轴上渲染一个日期_Android_Android Graphview - Fatal编程技术网

Android GraphView只在X轴上渲染一个日期

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,但我发现的日期示例似乎是

我从数据库中获取股票数据,在数据库中,公司的股票历史记录保存在DB列中。每天的数据以{date,stock_value}格式显示,并用“\n”与其他日期分隔

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);