【问题标题】:Getting an IllegalArgumentException while adding line data添加行数据时获取 IllegalArgumentException
【发布时间】:2015-08-04 08:23:17
【问题描述】:

当超过一些数据集(大约 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 绘制图表。
当输入更多数据集时,我们会遇到该异常。

【问题讨论】:

  • 错误很明显:DataSet 中的元素比 x 值中的元素多。如果您希望其他人能够帮助您,请发布您的代码。

标签: android mpandroidchart illegalargumentexception


【解决方案1】:

错误与解释完全相同。以防语言障碍

.................................................. --------
图表 ....................|。 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
.................................................. --------

如您所见,最后一个数据集的项目太多,无法放入图表中,因此应用不知道如何处理并引发错误

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-05
    • 2020-11-10
    • 2016-07-18
    • 2021-09-07
    • 2018-04-24
    • 2011-04-10
    • 1970-01-01
    相关资源
    最近更新 更多