1
안녕하세요, 저는 안드로이드 GraphView를 사용하여 막대 그래프가 있습니다. 이안드로이드 GraphView 가로 막 대형 차트
를 보여줍니다 그래서
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);
}
SOFAR가 heres는 무엇 막대의 폭을 변경하는 방법이 내가 서로에 그것을하지만 현재 그리기 3 시리즈에 전달해야 3 시리즈를
예, GraphView 4.0의 – appsthatmatter