Achart发动机的onclick饼图切片有时不工作的错误? [英] Achart engine Onclick pie chart slice not working sometimes a bug?

查看:187
本文介绍了Achart发动机的onclick饼图切片有时不工作的错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作饼图上,我使用AchartEngine。

i am working on a pie chart and i am using AchartEngine.

我有饼图是这样的:

饼图的图像

我添加的onclick到片,但有时只有绿色的切片点击数将无法工作。

i have added the onclick to the slices but sometimes only the green slice onlick will not work.

这是我的code:

mChartView = ChartFactory.getPieChartView(this, adc.buildCategoryDataset("Project budget", values), renderer);
        mChartView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              SeriesSelection seriesSelection = mChartView.getCurrentSeriesAndPoint();
              if (seriesSelection == null) {
                  Toast
                      .makeText(GeneratedChartDemo.this, "No chart element was clicked", Toast.LENGTH_SHORT)
                      .show();
                } else {
                  Toast.makeText(
                          GeneratedChartDemo.this,
                      "Chart element data point index " + seriesSelection.getPointIndex()
                          + " was clicked" + " point value=" + seriesSelection.getValue(),
                      Toast.LENGTH_SHORT).show();
                }
            }
          });

我要去哪里错了有我错过了什么?

where am i going wrong have i missed something?

修改

感谢Dan谁解决问题帮助了我。

Thanks to Dan who helped me in solving the problem.

推荐答案

你添加一个可选的缓冲区?

Did you add a selectable buffer?

mRenderer.setClickEnabled(true);
mRenderer.setSelectableBuffer(10);

更新:有,我修正了一个错误。您可以下载包括此修订<一个版本href=\"https://repository-achartengine.forge.cloudbees.com/snapshot/org/achartengine/achartengine/1.1.0/\"相对=nofollow>这里。

这篇关于Achart发动机的onclick饼图切片有时不工作的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆