2014-12-22 43 views
1

嗨,我有一个使用android GraphView的条形图。有3个系列,我需要传递到它,但它目前正在起草的所有3系列到对方有没有办法来改变栏的宽度,使其显示Android GraphView条形图多个系列

继承人我有什么SOFAR

try{ 
        JSONArray graphArray = returnGraphyArray(statistics); 
        if(graphArray != null){ 
         int graphLength = graphArray.length(); 
         GraphViewData[] calls = new GraphViewData[graphLength]; 
         GraphViewData[] length = new GraphViewData[graphLength]; 
         GraphViewData[] transfered = new GraphViewData[graphLength]; 

         for(int r = 0; r < graphLength; r++){ 
          JSONObject row = graphArray.getJSONObject(r); 
          calls[r] = new GraphViewData(r,Integer.parseInt(row.getJSONObject("data").getString("total_calls"))); 
          length[r] = new GraphViewData(r,Integer.parseInt(row.getJSONObject("data").getString("avg_call_length"))/60); 
          transfered[r] = new GraphViewData(r,Integer.parseInt(row.getJSONObject("data").getString("calls_transferred"))); 
         } 

         GraphViewSeries totalCallsSeries = new GraphViewSeries("Total Calls", new GraphViewSeriesStyle(getResources().getColor(R.color.pink), 5),calls); 
         GraphViewSeries totalCallLengthSeries = new GraphViewSeries("Total Call Length", new GraphViewSeriesStyle(getResources().getColor(R.color.green), 5),length); 
         GraphViewSeries totalCallsTransSeries = new GraphViewSeries("Calls Transfered", new GraphViewSeriesStyle(getResources().getColor(R.color.blue), 5),transfered); 

         BarGraphView graphView = new BarGraphView(context, ""); 
         graphView.addSeries(totalCallLengthSeries); 
         graphView.addSeries(totalCallsTransSeries); 
         graphView.addSeries(totalCallsSeries); // data 
         graphView.setHorizontalLabels(bottomlabels); 
         graphView.setShowLegend(false); 
         graphView.setLegendAlign(LegendAlign.TOP); 
         graphView.setLegendWidth(SM_Global.pxFromDp(context, 100)); 
         graphView.getGraphViewStyle().setNumHorizontalLabels(6); 
         layout.addView(graphView); 
        }else{ 
         layout.setVisibility(View.GONE); 
         ImageView legend = (ImageView)v.findViewById(R.id.graph_legend); 
         legend.setVisibility(View.GONE); 
        } 
+0

是,GraphView 4.0只能处理一个酒吧系列 – appsthatmatter

回答