如何打破graphview数据点以获取Y轴的值?

时间:2018-01-17 15:19:36

标签: android android-graphview linegraph

我想打破dataPoint只获得Y轴的值。 现在,我的代码运行时得到的结果是:

舒张期阅读:[25.0 / 89.0] mmHg

但我希望将其显示为:

舒张期阅读:89.0 mmHg

series_D.setOnDataPointTapListener(new OnDataPointTapListener() {
        @Override
        public void onTap(Series series, DataPointInterface dataPoint) {
            Toast.makeText(Rsults.this, "Diastolic Reading : "+ dataPoint +" mmHg", Toast.LENGTH_SHORT).show();
        }
    });

1 个答案:

答案 0 :(得分:0)

在Selvin的帮助下,代码现在按照我的意愿工作了

series_b.setOnDataPointTapListener(new OnDataPointTapListener() {
        @Override
        public void onTap(Series series, DataPointInterface dataPoint) {
           Double x = dataPoint.getY();
            Toast.makeText(Rsults.this, "Systolic Reading : "+ x +" mmHg", Toast.LENGTH_SHORT).show();
        }
    });