When more than some datasets (around 6 or more) to a line graph, we are getting an exception.
This is the detail:
java.lang.IllegalArgumentException: One or more of the DataSet Entry arrays are longer than the x-values array of this ChartData object.
at com.github.mikephil.charting.data.ChartData.isLegal(ChartData.java:173)
at com.github.mikephil.charting.data.ChartData.init(ChartData.java:130)
at com.github.mikephil.charting.data.ChartData.<init>(ChartData.java:96)
at com.github.mikephil.charting.data.BarLineScatterCandleData.<init>(BarLineScatterCandleData.java:27)
at com.github.mikephil.charting.data.LineData.<init>(LineData.java:27)
I am not able to understand the reason why.
I am using MPAndroidChart to plot the graph.
When more data sets are entered, we are getting that exception.
The error is exactly as explained. Heres it visually in case its a language barrier
............................---------------------------
Chart .................|. 1 ... 2 ... 3 ... 4 ... 5 .|
Data Set 1 .........|. a ... b ... c ... d ... e .|
Data Set 2 .........|. a ... b ... c ... d ... e .|
Data Set 3 .........|. a ... b ... c ... d ... e .|
Data Set 4 .........|. a ... b ... c ... d ... e .|
Data Set 5 .........|. a ... b ... c ... d ... e .|
Data Set 6 .........|. a ... b ... c ... d ... e .|
Data Set 7 .........|. a ... b ... c ... d ... e .|... f ... g
............................---------------------------
As you can see the last data set has too many items to fit into the chart so the app does not know how to handle it and throws an error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With