0
Goodevening,
我正在開發一個android應用程序,我正在使用achartengine來繪製值,我查詢後,查詢到sqlite數據庫。如果值是從0到1000,那麼我會得到一個加載圖標,在10秒後,最多,我得到我需要的圖形。如果這些值超過1000,如果我有多線圖,那麼我會得到一個永不離開的加載圖標。我使用的代碼列在下面。我做錯了什麼?我使用achartengine的示例代碼來創建自己的代碼。AchartEngine從db加載值需要永久
代碼:
public void createGraph(Context ctx){
// x data
dateList = DateDataReturn(ctx , table, accessPointList_Filtered);
Log.d(TAG,"dateList len:" + String.valueOf(dateList.size()));
// y data
dataList = yDataReturn(ctx, column, table, accessPointList_Filtered);
Log.d(TAG, "dataList len:" + String.valueOf(dataList.size()));
// y axis title
yaxis = yAxisReturn(column);
// lines titles
titles = titleReturn(ctx, column, accessPointList_Filtered);
Log.d(TAG,"titles length:" + String.valueOf(titles.length));
// line colors
colors = retColor(ctx, table, accessPointList_Filtered);
Log.d(TAG,"colors length:" + String.valueOf(colors.length));
// line point styles
styles = retPointStyle(ctx, table, accessPointList_Filtered);
Log.d(TAG,"style length:" + String.valueOf(styles.length));
// x axis min value
xmin = dateList.get(0)[0].getTime();
Log.d(TAG, "1");
// x axis max value
xmax = dateList.get(0)[dateList.get(0).length - 1].getTime();
Log.d(TAG, "2");
// Create the renderer
renderer = buildRenderer(colors, styles);
// Create the dataset
dataset = buildDateDataset(titles, dateList, dataList);
Log.d(TAG, "3");
for (int i = 0; i < renderer.getSeriesRendererCount(); i++) {
((XYSeriesRenderer) renderer.getSeriesRendererAt(i)).setFillPoints(true);
}
setChartSettings(renderer, // POINTS
"Interface Monitoring", // PLOT LABEL
"Time", // X LABEL
yAxisTitleReturn(column), // Y LABEL
xmin,
xmax,
yaxis[0], // Y AXIS START VALUE
yaxis[1], // Y AXIS FINISH VALUE
Color.LTGRAY, // AXIS COLOR
Color.LTGRAY); // LABELS COLOR
renderer.setXLabels(10);
renderer.setYLabels(10);
renderer.setBackgroundColor(Color.BLACK);
renderer.setApplyBackgroundColor(true);
renderer.setXLabelsAlign(Align.CENTER);
renderer.setYLabelsAlign(Align.RIGHT);
renderer.setShowGrid(true);
renderer.setZoomEnabled(true, true);
renderer.setPanEnabled(true, true);
}
/**
*
* @param context
* @return GraphicalView, returns the view
*/
public GraphicalView getView(Context context) {
return (GraphicalView)ChartFactory.getTimeChartView(context, dataset, renderer, "h:mm:ss a");
}
感謝名單