气泡图未在xAxis上显示日期气泡

时间:2019-08-07 18:03:46

标签: android mpandroidchart bubble-chart

我使用MPAndroidChart库气泡图控件小部件在x轴上显示有关日期的数据。为了进行测试,我为x轴做了用户编号,并且按预期工作得很好。但是当我尝试使用日期时,我得到的空白图表仅在X和Y轴上具有值,而没有任何气泡。

我使用过valueformatter在X轴上显示日期。这是代码。

xAxis.setValueFormatter(new ValueFormatter() {
                @Override
                public String getAxisLabel(float dateInMillisecons, AxisBase axis) {
//                    return super.getAxisLabel(value, axis);
                    try{
                        SimpleDateFormat sdf = new SimpleDateFormat("dd MMM");
                        return sdf.format(new Date((long) dateInMillisecons));
                    }
                    catch (Exception e)
                    {
                        return  "error";
                    }
                }

                @Override
                public String getBubbleLabel(BubbleEntry bubbleEntry) {
                    return super.getBubbleLabel(bubbleEntry);
                }
            });

0 个答案:

没有答案
相关问题