0

基本上我想绘制一个图表,其中 x 轴为您提供日期,y 轴为您提供计数

我正在从服务器获取数据并在我的两个数组中解析它,一个用于计数,另一个用于日期

我正在像这样的两个数组中获取值

SoapObject o=(SoapObject)p2.getProperty(xx); UserCallStatusBean ld=new UserCallStatusBean();

            if(o.getProperty("Month").toString().equals("anyType{}")){
                ld.setDuration("");
            }
            else{
                ld.setDuration(o.getProperty("Month").toString());
            }


            ld.setCount(Integer.parseInt(o.getProperty("Count").toString()));


            CallStatus.add(ld);
            GraphViewData o1=new GraphViewData(_iLoopCounter,Double.parseDouble(o.getProperty("Count").toString()));
            String o2=new String(o.getProperty("Month").toString());
            //String o2=new String(String.valueOf(_iLoopCounter));

            arrData[xx]=o1;
            arrXaxis[xx]=o2;
            _iLoopCounter++;

在两个数组中获取值后,我使用 Graph View Demo 创建一个像

            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 轴?(日期值)

我希望你能理解,期待答案,我会提前谢谢你

4

0 回答 0