显示不正确 GraphView(android)
incorrect display GraphView(android)
对不起我的英语。我不知道为什么我没有正确显示消息 GraphView。现在在下图中不断显示 1,1,1,1 ... 虽然会有 1,2,3,4 ...并且评估都是 1。A 显示图表为 10。为什么会这样,请告诉我.
GraphViewSeriesStyle seriesStyle = new GraphViewSeriesStyle();
BarGraphView graphView = new BarGraphView(this, "test");
//Our vertical graph
graphView.setVerticalLabels(new String[] { "10", "9", "8", "7", "6",
"5", "4", "3", "2", "1" });
//listMarks its ArrayList whith Marks
String[] array = new String[ listMarks.size() ];
//add marks in array
for(int i = 0; i < listMarks.size(); i++) {
array[i] = "1";
}
graphView.setHorizontalLabels(array);
seriesStyle.setValueDependentColor(new ValueDependentColor() {
@Override
public int get(GraphViewDataInterface data) {
return Color.rgb((int)(22+((data.getY()/3))), (int)(160-((data.getY()/3))), (int)(134-((data.getY()/3))));
}
});
GraphViewData[] data = new GraphViewData[array.length];
for (int a = 0; a < array.length; a++) {
data[a] = new GraphView.GraphViewData(a, Double.parseDouble(array[a]));
}
GraphViewSeries series = new GraphViewSeries("aaa", seriesStyle, data);
graphView.setManualYMinBound(0);
graphView.addSeries(series);
LinearLayout layout = (LinearLayout) findViewById(R.id.subLayout);
layout.addView(graphView);
变化:
array[i] = "1";
至:
array[i] = ""+i;
在下面的循环中
//add marks in array
for(int i = 0; i < listMarks.size(); i++) {
array[i] = "1";
}
对不起我的英语。我不知道为什么我没有正确显示消息 GraphView。现在在下图中不断显示 1,1,1,1 ... 虽然会有 1,2,3,4 ...并且评估都是 1。A 显示图表为 10。为什么会这样,请告诉我.
GraphViewSeriesStyle seriesStyle = new GraphViewSeriesStyle();
BarGraphView graphView = new BarGraphView(this, "test");
//Our vertical graph
graphView.setVerticalLabels(new String[] { "10", "9", "8", "7", "6",
"5", "4", "3", "2", "1" });
//listMarks its ArrayList whith Marks
String[] array = new String[ listMarks.size() ];
//add marks in array
for(int i = 0; i < listMarks.size(); i++) {
array[i] = "1";
}
graphView.setHorizontalLabels(array);
seriesStyle.setValueDependentColor(new ValueDependentColor() {
@Override
public int get(GraphViewDataInterface data) {
return Color.rgb((int)(22+((data.getY()/3))), (int)(160-((data.getY()/3))), (int)(134-((data.getY()/3))));
}
});
GraphViewData[] data = new GraphViewData[array.length];
for (int a = 0; a < array.length; a++) {
data[a] = new GraphView.GraphViewData(a, Double.parseDouble(array[a]));
}
GraphViewSeries series = new GraphViewSeries("aaa", seriesStyle, data);
graphView.setManualYMinBound(0);
graphView.addSeries(series);
LinearLayout layout = (LinearLayout) findViewById(R.id.subLayout);
layout.addView(graphView);
变化:
array[i] = "1";
至:
array[i] = ""+i;
在下面的循环中
//add marks in array
for(int i = 0; i < listMarks.size(); i++) {
array[i] = "1";
}