Goodevening,
我正在开发一个 android 应用程序,我正在使用 achartengine 来绘制我在查询到 sqlite 数据库后检索到的值。如果值是从 0 到 1000,那么我会得到一个加载图标,并且在 10 秒后,最多,我会得到我需要的图表。如果值超过 1000 并且如果我有多线图,那么我会得到一个永远不会离开的加载图标。我使用的代码如下所示。我做错什么了吗?我使用来自 achartengine 的示例代码来制作我自己的代码。
代码:
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");
}
谢谢