I tried to change MPAndroid Chart text of "No Chart Data available" into "Loading Data..." while the data is retrieving.I had done this.But when there is no data the chart layout should shows ," NO DATA".
I am getting the Same Text(Loading Data...) eventhough there is no data.
protected void onDraw(Canvas canvas) {
if (!mDataNotSet && mData==null) {
canvas.drawText("NO DATA", getWidth() / 2, getHeight() / 3, mInfoPaint);
return;
}
if (mDataNotSet && mData == null || mData.getYValCount() <= 0) {
canvas.drawText"Laoding Data...",getWidth() / 2, getHeight() / 2, mInfoPaint);
if (!TextUtils.isEmpty(mNoDataTextDescription))
{
float textOffset = -mInfoPaint.ascent() + mInfoPaint.descent();
canvas.drawText(mNoDataTextDescription, getWidth()/2,(getHeight() / 2)
+ textOffset, mInfoPaint);
}
return;
}
if (!mOffsetsCalculated) {
calculateOffsets();
mOffsetsCalculated = true;
}
}
you can change it as below ,
Use the
setNoDataText
method to set the message back to whatever text you want once data loading is done.So when data load is started, run
After data load is done