如何在android中使用图形视图演示更改X轴
基本上我想画一张图,其中x轴表示日期,y轴表示计数 我从服务器获取数据,并在我的两个数组中解析它,一个用于计数,另一个用于日期 我得到两个数组中的值,如下所示 SoapObject o=(SoapObject)p2.getProperty(xx); UserCallStatusBean ld=新的UserCallStatusBean() 在得到两个数组中的值后,我使用Graph View Demo创建了一个类似于如何在android中使用图形视图演示更改X轴,android,graph,Android,Graph,基本上我想画一张图,其中x轴表示日期,y轴表示计数 我从服务器获取数据,并在我的两个数组中解析它,一个用于计数,另一个用于日期 我得到两个数组中的值,如下所示 SoapObject o=(SoapObject)p2.getProperty(xx); UserCallStatusBean ld=新的UserCallStatusBean() 在得到两个数组中的值后,我使用Graph View Demo创建了一个类似于 setContentView(R.layout.graph
setContentView(R.layout.graphs);
// init example series data
exampleSeries = new GraphViewSeries(arrData);
// graph with dynamically genereated horizontal and vertical labels
GraphView graphView;
graphView = new BarGraphView(
this,"");
graphView.addSeries(exampleSeries); // data
graphView.setScalable(true);
graphView.setScrollable(true);
graphView.setViewPort(2,6);
graphView.setScrollable(true);
graphView.setHorizontalLabels(arrXaxis);
graphView.setGravity(Gravity.CENTER);
graphView.setBaselineAlignedChildIndex(4);
//graphView.setHorizontalLabels(labels);
LinearLayout layout = (LinearLayout) findViewById(R.id.graph1);
layout.addView(graphView);
现在我关心的问题是,我得到的是y轴上的计数值,但我也得到了x轴上的日期计数,而不是我想在x轴上显示日期
我读过各种文章来获取x轴上的字符串值,找到了一个使用Cutom lavel格式化程序的,但不知道如何使用,所以我能做些什么来获取x轴?(日期值)
我希望你能理解,期待我的回答
提前谢谢嗨,拉格哈夫,你有没有答案?/@Bhupendra Well我有答案,但我没有遵循这个方法。你能在这里发布你的解决方案吗?我已经使用了Steema图表来准备图表,我可以给你它的教程
setContentView(R.layout.graphs);
// init example series data
exampleSeries = new GraphViewSeries(arrData);
// graph with dynamically genereated horizontal and vertical labels
GraphView graphView;
graphView = new BarGraphView(
this,"");
graphView.addSeries(exampleSeries); // data
graphView.setScalable(true);
graphView.setScrollable(true);
graphView.setViewPort(2,6);
graphView.setScrollable(true);
graphView.setHorizontalLabels(arrXaxis);
graphView.setGravity(Gravity.CENTER);
graphView.setBaselineAlignedChildIndex(4);
//graphView.setHorizontalLabels(labels);
LinearLayout layout = (LinearLayout) findViewById(R.id.graph1);
layout.addView(graphView);