diff --git a/vico/core/src/main/java/com/patrykandpatrick/vico/core/entry/ChartEntryExtensions.kt b/vico/core/src/main/java/com/patrykandpatrick/vico/core/entry/ChartEntryExtensions.kt index dcc734aee..2c797c02a 100644 --- a/vico/core/src/main/java/com/patrykandpatrick/vico/core/entry/ChartEntryExtensions.kt +++ b/vico/core/src/main/java/com/patrykandpatrick/vico/core/entry/ChartEntryExtensions.kt @@ -104,7 +104,9 @@ internal fun Iterable>.calculateXGcd(): Float { } if (gcd == -1f) gcd = 1f } - return gcd ?: 1f + return gcd?.also { + require(it != 0f) { "The precision of the x values is too large. The maximum precision is two decimal places." } + } ?: 1f } internal fun Iterable>.calculateStackedYRange(): ClosedFloatingPointRange =