MPAndroidChart is not update after null value

Viewed 66

I'm using the MPAndroidChart and am really enjoying it. But I have some problem with it

Here is my problem, My Barchart shows the value of October but if I change the parameter into January the barchart does not show because January has no value. And I change the parameter back to October, my barchart didn't show the chart

image October with chart

image January without chart

image October without chart

my code

        barDataSet1 = new BarDataSet(barEntries, "Suplier");
        barData1 = new BarData(barDataSet1);
        barChart1.setData(barData1);

        xAxis1 = barChart1.getXAxis();
        xAxis1.setValueFormatter(new IndexAxisValueFormatter(supp));
        xAxis1.setCenterAxisLabels(false);
        xAxis1.setPosition(XAxis.XAxisPosition.BOTTOM);

        xAxis1.setDrawAxisLine(false);
        xAxis1.setGranularity(1);
        xAxis1.setGranularityEnabled(true);
        xAxis1.setLabelRotationAngle(-60);

        barChart1.setDrawValueAboveBar(false);
        barChart1.getDescription().setText(" ");
        barChart1.animateY(1000);
        barChart1.setExtraOffsets(0, 0, 0, 30);

        barChart1.setDragEnabled(true);
        barChart1.setVisibleXRangeMaximum(6);
        barChart1.getAxisLeft().setAxisMinimum(0);
//        barChart1.getAxisLeft().setAxisMaximum(max + 2000);
        barChart1.getXAxis().setDrawGridLines(false);
        barChart1.getAxisRight().setDrawAxisLine(false);
        barChart1.getAxisRight().setDrawGridLines(false);
        barChart1.getAxisRight().setDrawLabels(false);
        barChart1.getAxisLeft().setDrawGridLines(true);
        barChart1.setFitBars(true);
        barChart1.setTouchEnabled(true);
        barChart1.setPinchZoom(false);
        barChart1.setScaleEnabled(false);
        barChart1.notifyDataSetChanged();
        barChart1.invalidate();
        barChart1.refreshDrawableState();

I've been reading some solution with similar problem, they recommended to use notifyDataSetChanged() and refreshDrawableState() but I already write it in my code and my barchart didn't showing or refreshing

Please help me, what should I do?

0 Answers
Related