PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.67k stars 9.02k forks source link

Entries wrong #2547

Open 13006210190 opened 8 years ago

13006210190 commented 8 years ago

When i refresh the line chart with less mAxis.mEntries ,the Xaxis item index was wrong . a3f5205c-7e3a-44c2-a666-f2c108dd0bfb if (mAxis.mEntries.length > n) ,there not new float[] .

shs8023you commented 1 year ago

Here's how I did it

public class ReuseYAxisRenderer extends YAxisRenderer {

    public ReuseYAxisRenderer(ViewPortHandler viewPortHandler, YAxis yAxis, Transformer trans) {
        super(viewPortHandler, yAxis, trans);
    }

    @Override
    protected void computeAxisValues(float min, float max) {
        mAxis.mEntries = new float[]{};
        super.computeAxisValues(min, max);
    }
}