The Wayback Machine - https://web.archive.org/web/20210111204413/https://github.com/PhilJay/MPAndroidChart/issues/5042
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LineChart doesn't draw label when LineData's datasets count over 100 #5042

Open
WellBeing-Man opened this issue Nov 13, 2020 · 0 comments
Open

LineChart doesn't draw label when LineData's datasets count over 100 #5042

WellBeing-Man opened this issue Nov 13, 2020 · 0 comments

Comments

@WellBeing-Man
Copy link

@WellBeing-Man WellBeing-Man commented Nov 13, 2020

Summary

It doesn't show Y label when dataset Count over 100

Expected Behavior
It draws label

Possible Solution

Device (please complete the following information):

  • Device: LG g6
  • Android Version 8.0
  • Library Version 3.1.0

Additional Context

It draw label when count 99,
but it does not over 100

The count means, All Entries count

Here my code :

        LineData data = mLineChart.getData();
        ILineDataSet set0 = data.getDataSetByIndex(0);
        if (set0 == null) {
            LineDataSet set00 = createSet();
            set00.setDrawCircles(false);
            set00.setDrawCircleHole(false);
            set00.setDrawValues(false);
        } 
        ILineDataSet set1 = data.getDataSetByIndex(1);
        if (set1 == null) {
            LineDataSet set01 = createSet();
            set01.setDrawCircles(true);
            set01.setCircleRadius(3f);
            set01.setCircleColor(Color.parseColor("#cb0d36"));
            set01.setValueTextColor(Color.parseColor("#cb0d36"));
            set01.setDrawCircleHole(false);
            set01.setDrawValues(true);
            data.addDataSet(set01);
        }
        ILineDataSet set2 = data.getDataSetByIndex(2);
        if (set2 == null) {
            LineDataSet set02 = createSet();
            set02.setDrawCircles(true);
            set02.setCircleRadius(3f);
            set02.setCircleColor(Color.parseColor("#cb0d36"));
            set02.setValueTextColor(Color.parseColor("#cb0d36"));
            set02.setDrawCircleHole(false);
            set02.setDrawValues(true);
            data.addDataSet(set02);
        }

        for (int i = 0; i < mModel.getArrayMyChartData().size(); i++) {
            float value = mModel.getArrayMyChartData().get(i).getWeight();
            Entry entry = new Entry(i,  value);
            if (i == 0) {
                data.addEntry(entry, 1);
            } else if (i == mModel.getArrayMyChartData().size() - 1) {
                data.addEntry(entry, 2);
            }
            data.addEntry(entry, 0);
        }
        data.setValueFormatter(new LineChart2ValueFormatter(mModel));
        data.notifyDataChanged();
        mLineChart.notifyDataSetChanged();
        mLineChart.moveViewToX(0f);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.