2014-12-22 76 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

回答