Mpandroidchart: "no chart data available"

Created on 3 Nov 2016  ·  8Comments  ·  Source: PhilJay/MPAndroidChart

I don't want to show this,what am I to do?

image

Most helpful comment

有2个方法,一个是setNoDataText(""),一个是setNoDataTextDescription(“”),没数据的时候你加第一个,就OK了

All 8 comments

Chart.java line 403
`
protected void onDraw(Canvas canvas) {
// super.onDraw(canvas);

    if (mData == null) {

        boolean hasText = !TextUtils.isEmpty(mNoDataText);

        if (hasText) {
            MPPointF c = getCenter();
            canvas.drawText(mNoDataText, c.x, c.y, mInfoPaint);
        }

        return;
    }

    if (!mOffsetsCalculated) {

        calculateOffsets();
        mOffsetsCalculated = true;
    }
}

`

@sharoncn thank you for you reply, through in the terms of .jar, rather than library, so I can not modify the chart file.

@sharoncn solved it.Just add this lineChart.setNoDataTextDescription(null);

2433

@zhangxiaofan918 Thanks

@zhangxiaofan918 我遇到同样的问题 为什么我的去不掉

这个我也发现了,即便加了这行代码,偶尔也会出来的。
我的解决办法是加一个蒙层,没数据的时候显示这个View。
@android-home

@zhangxiaofan918 好吧。。。。

有2个方法,一个是setNoDataText(""),一个是setNoDataTextDescription(“”),没数据的时候你加第一个,就OK了

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tsengvn picture tsengvn  ·  3Comments

botondbutuza picture botondbutuza  ·  3Comments

manucheri picture manucheri  ·  3Comments

thanhcly920 picture thanhcly920  ·  3Comments

SutharRohit picture SutharRohit  ·  3Comments