我正在使用achartengine绘制条形图。它在仿真器上正确绘制,但不在实际设备上。有任何想法吗?这是我正在使用的代码。我从数据库中获取的字符串就像是2 4 5 8 9.它在模拟器上绘制得很好但在设备上没有。谢谢
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.graph);
chart_container=(LinearLayout)findViewById(R.id.Chart_layout);
myDatabase myDb = new myDatabase(this);
myDb.open();
String pull = myDb.getData();
String see = pull.replaceAll("\\s+","");
int[] intArray = new int[see.length()];
for(int k=0; k < see.length(); k++){
intArray[k] = Character.digit(see.charAt(k), 10);
}
CategorySeries series = new CategorySeries(&#34; My Graph&#34;); for(int i = 0; i&lt; intArray.length; i ++){
series.add("Bar ", intArray[i]);
}
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); dataset.addSeries(series.toXYSeries());
XYSeriesRenderer renderer = new XYSeriesRenderer(); renderer.setDisplayChartValues(真); renderer.setColor(getResources()的getColor(R.color.fuchsia));
XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer(); mRenderer.addSeriesRenderer(渲染);
LinearLayout chart_container =(LinearLayout)findViewById(R.id.Chart_layout);
mChart=(GraphicalView)ChartFactory.getBarChartView(getBaseContext(), dataset, mRenderer, Type.DEFAULT);
chart_container.addView(mChart);