Achart Engine Line chart - Display pop up on click of point

点点圈 提交于 2019-12-11 11:39:48

问题


I am using Achart Engine Line chart to display values, i am using point style CIRCLE.

I am trying to implementing the below :

1) Increase the point style width - i mean the circle should be bit bigger.

2) On click of each point i want a popup to be displayed on top of that which will display the values of X and Y.

I have done some research on this but was not able to find the solution.

I found this code but how to display the small popup with values ?

final LineChart chart = new LineChart(buildDataset(mTitles, data), mRenderer);
final GraphicalView view = new GraphicalView(mContext, chart);
view.setOnClickListener(new View.OnClickListener() {
  public void onClick(View v) {
     double[] xy = chart.toScreenPoint(view.toRealPoint(0));
     int[] location = new int[] {(int) xy[0], (int) xy[1]};
     SeriesSelection seriesSelection = view.getCurrentSeriesAndPoint();
     if (seriesSelection != null) {
         final Data d = mModel.getDiaryAt(seriesSelection.getSeriesIndex(), 
         seriesSelection.getPointIndex());
         //show popup at xy[0] xy[1]
     }
  }
});

It might have been not given in the SDK but still if anyone has tried this as was successful.

** EDIT **

Link 1 : achartengine toScreenPoint(double) always returns nullPointerException

In the image you can see a popup i want to implement like that.


回答1:


You can see an example here on how to display the clicked point in your chart, using AChartEngine.



来源:https://stackoverflow.com/questions/25989547/achart-engine-line-chart-display-pop-up-on-click-of-point

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