Closed matpascaud closed 8 months ago
val elem0 = FloatEntry(0f, 0f)
val elem1 = FloatEntry(0f, 32f)
val elem2 = FloatEntry(0f, 0f)
listEntries[0].add(elem0)
listEntries[1].add(elem1)
listEntries[2].add(elem2)
chartEntryModelProducer.setEntries(listEntries)
I made this code for test with static data and leads to crash.
java.lang.IllegalArgumentException: The precision of the x values is too large. The maximum is two decimal places. at com.patrykandpatrick.vico.core.entry.ChartEntryExtensionsKt.calculateXGcd(ChartEntryExtensions.kt:94)
If I add another value, no more crash.
val elem01 = FloatEntry(1f, 20f)//FloatEntry(i.toFloat(), Cn0)
val elem11 = FloatEntry(1f, 0f)//FloatEntry(i.toFloat(), Cn0)
val elem21 = FloatEntry(1f, 0f)//FloatEntry(i.toFloat(), Cn0)
listEntries[0].add(elem01)
listEntries[1].add(elem11)
listEntries[2].add(elem21)
Hello! It looks like you’re assigning three different y values to a single x value in a single series. Such a mapping is invalid. Could you describe what you’re looking to achieve?
I am trying to use different colors depends on Y values. It does work if I have more than 1 value on X.
listEntries is a list of MutableList
private var listEntries = List(
NB_COLORS
) {
mutableListOf<FloatEntry>()
}
Got it. Sorry, I misread the code from your previous reply—you do have separate series. This is a bug. It no longer occurs in Vico 2.0.0 Alpha 5. It’ll be fixed in Vico 1 too.
Thank you @patrickmichalik. I may switch to Vico 2.xx
Sounds good. If you need any help migrating, feel free to let me know.
Vico 1.14.0 Beta 1 addresses this.
Vico 1.14.0 is rolling out. Cheers!
How to reproduce
I have a loop, for which I get data from the Android device. If i'am adding a break in the loop after the first iteration, there is no data visible on the chart. If I switch screen and come back to the screen, I am getting a crash
java.lang.IllegalArgumentException: The precision of the x values is too large. The maximum is two decimal places. at com.patrykandpatrick.vico.core.entry.ChartEntryExtensionsKt.calculateXGcd(ChartEntryExtensions.kt:94) at com.patrykandpatrick.vico.core.entry.ChartEntryModelProducer.getInternalModel(ChartEntryModelProducer.kt:151) at com.patrykandpatrick.vico.core.entry.ChartEntryModelProducer.getInternalModel$default(ChartEntryModelProducer.kt:133) at com.patrykandpatrick.vico.core.entry.ChartEntryModelProducer.getModel(ChartEntryModelProducer.kt:158) at com.patrykandpatrick.vico.core.entry.ChartEntryModelProducer$UpdateReceiver.handleUpdate(ChartEntryModelProducer.kt:213) at com.patrykandpatrick.vico.core.entry.ChartEntryModelProducer.registerForUpdates(ChartEntryModelProducer.kt:190) at com.patrykandpatrick.vico.views.chart.BaseChartView$registerForUpdates$1.invokeSuspend(BaseChartView.kt:282)
I have 3 different colors so 3 different data sets to update color according to the Y value. I can give more details if needed. PS: the lib is really cool and no other lib can compete with.
Observed behavior
The chart is empty and crashing if switching screens. If I accept more than one value on X, no problem occurs.
Expected behavior
Chart should be visible if only 1 value and no crash if switching screen on tab bar.
Vico version(s)
Latest unstable version
Android version(s)
13
Additional information
No response