MPAndroidChart
MPAndroidChart copied to clipboard
Line Chart is not drawing with large data
LineChart got smaller and even not visible when entries are above 50. It draws normally with 50 size of entries but with 51, 52 ... n it disappeared.
Here is the example with 52 size of entries.

- In the first pic I've given the data with 50 entries and I can scroll till the end and I can see fully drew chart.
- The second pic I just added 1, 2, ... n more data in my list but chart got narrow every added entries.
Here are the example of code how I give the data to LineData:
val dataSet =
LineDataSet(
getChartsEntries(
context = chart.context,
points = getPoints()
),
"label"
).apply {
setDrawCircles(false)
setDrawHorizontalHighlightIndicator(false)
setDrawVerticalHighlightIndicator(false)
setDrawFilled(true)
fillDrawable =
ContextCompat.getDrawable(chart.context, R.drawable.bg_gradient_chart)
color = ContextCompat.getColor(chart.context, R.color.blue)
mode =
LineDataSet.Mode.HORIZONTAL_BEZIER // or LineDataSet.Mode.CUBIC_BEZIER
}
val lineData = LineData(dataSet).apply {
setDrawValues(true)
isHighlightEnabled = true
setValueTextColor(R.color.blue)
setValueTypeface(Typeface.DEFAULT_BOLD)
setValueTextSize(0f)
}
chart.data = lineData
chart.invalidate()