AChartEngine Messed up labels

半城伤御伤魂 提交于 2019-12-12 04:19:34

问题


My chart displays fine but as soon as I scroll to the side, I have random time appearing and it messes up the dates, see this picture: http://img14.imageshack.us/img14/8329/statqs.jpg

I'd like to only display the date and nothing else, I don't know how the renderer comes up with time that I never entered.

Also I'd like to know how I can prevent scrolling to the left (x axis) and down (negative y), I can no longer use SetPanLimits because my x values are dates and not numbers.

Any help would be greatly appreciated!


回答1:


I know this is very old, but for the next user, it may help to have the solution.

You can specify the date format to use

/**
 * Creates a time chart intent that can be used to start the graphical view
 * activity.
 * 
 * @param context the context
 * @param dataset the multiple series dataset (cannot be null)
 * @param renderer the multiple series renderer (cannot be null)
 * @param format the date format pattern to be used for displaying the X axis
 *          date labels. If null, a default appropriate format will be used.
 * @return a time chart intent
 * @throws IllegalArgumentException if dataset is null or renderer is null or
 *           if the dataset and the renderer don't include the same number of
 *           series
 */
  public static final Intent getTimeChartIntent(Context context, XYMultipleSeriesDataset dataset,
  XYMultipleSeriesRenderer renderer, String format) {
        return getTimeChartIntent(context, dataset, renderer, format, "");
  }

To show only day and month, use something like the following:

Intent intent = ChartFactory.getTimeChartIntent(context, dataset, mRenderer, "dd-MMM");


来源:https://stackoverflow.com/questions/7540841/achartengine-messed-up-labels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!