当超过一些数据集(大约 6 个或更多)到折线图时,我们会遇到异常。
这是细节:
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)
我无法理解为什么。
我正在使用 MPAndroidChart 绘制图表。
当输入更多数据集时,我们会遇到该异常。
最佳答案
错误与解释的完全一样。这是视觉上的,以防语言障碍
................................-------------------- ----------
图表 ...............|。 1 ... 2 ... 3 ... 4 ... 5。|
数据集 1 .........|。 a ... b ... c ... d ... e。|
数据集 2 .........|。 a ... b ... c ... d ... e。|
数据集 3 .........|。 a ... b ... c ... d ... e。|
数据集4 .........|。 a ... b ... c ... d ... e。|
数据集5 .........|。 a ... b ... c ... d ... e。|
数据集6 .........|。 a ... b ... c ... d ... e。|
数据集7 .........|。 a ... b ... c ... d ... e .|... f ... g
................................-------------------- ----------
如您所见,最后一个数据集的项目太多,无法放入图表中,因此应用程序不知道如何处理它并抛出错误
关于android - 添加行数据时出现 IllegalArgumentException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31804216/