-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Consider the example like this:
barsH {
x(diffScorePercentage) {
axis.name = "Diff %"
}
y(testLabel) {
axis.name = ""
}
fillColor(barColor) {
scale = categorical("neg" to Color.RED, "pos" to Color.GREEN)
legend.type = LegendType.None
}
tooltips {
line(diffScorePercentage, format = ".2f")
}
}
It's kandy, but lets-plot spec is generated under the hood. When used in Kotlin notebook, it fails on the attempt of rendering tooltips with:
java.lang.IllegalArgumentException: Wrong number of arguments in pattern '.2f' to format '...'. Expected 1 argument instead of 0
at org.jetbrains.letsPlot.commons.formatting.string.StringFormat$Companion.create$commons(StringFormat.kt:163)
at org.jetbrains.letsPlot.commons.formatting.string.StringFormat$Companion.forOneArg(StringFormat.kt:133)
at org.jetbrains.letsPlot.commons.formatting.string.StringFormat$Companion.forOneArg$default(StringFormat.kt:127)
at org.jetbrains.letsPlot.core.plot.builder.tooltip.data.DataFrameField.initFormatter(DataFrameField.kt:30)
at org.jetbrains.letsPlot.core.plot.builder.tooltip.data.DataFrameField.getDataPoint(DataFrameField.kt:47)
at org.jetbrains.letsPlot.core.plot.builder.tooltip.LinePattern.getDataPoint(LinePattern.kt:41)
at org.jetbrains.letsPlot.core.plot.base.tooltip.ContextualMapping.getDataPoints(ContextualMapping.kt:22)
at org.jetbrains.letsPlot.core.plot.builder.tooltip.spec.TooltipSpecFactory$Helper.<init>(TooltipSpecFactory.kt:35)
at org.jetbrains.letsPlot.core.plot.builder.tooltip.spec.TooltipSpecFactory.create(TooltipSpecFactory.kt:27)
at org.jetbrains.letsPlot.core.plot.builder.tooltip.TooltipRenderer.createTooltipSpecs(TooltipRenderer.kt:256)
at org.jetbrains.letsPlot.core.plot.builder.tooltip.TooltipRenderer.showTooltips(TooltipRenderer.kt:95)
at org.jetbrains.letsPlot.core.plot.builder.tooltip.TooltipRenderer.access$showTooltips(TooltipRenderer.kt:45)
at org.jetbrains.letsPlot.core.plot.builder.tooltip.TooltipRenderer$6.invoke(TooltipRenderer.kt:77)
at org.jetbrains.letsPlot.core.plot.builder.tooltip.TooltipRenderer$6.invoke(TooltipRenderer.kt:77)
at org.jetbrains.letsPlot.commons.intern.observable.event.EventHandlerExKt$handler$1.onEvent(EventHandlerEx.kt:12)
at org.jetbrains.letsPlot.commons.event.MouseEventPeer$dispatch$1.call(MouseEventPeer.kt:41)
at org.jetbrains.letsPlot.commons.event.MouseEventPeer$dispatch$1.call(MouseEventPeer.kt:39)
at org.jetbrains.letsPlot.commons.intern.observable.event.Listeners.fire(Listeners.kt:72)
at org.jetbrains.letsPlot.commons.event.MouseEventPeer.dispatch(MouseEventPeer.kt:39)
at org.jetbrains.letsPlot.awt.plot.FigureToAwt$Companion$buildSinglePlotComponent$2$mouseMoved$2.invoke(FigureToAwt.kt:185)
at org.jetbrains.letsPlot.awt.plot.FigureToAwt$Companion$buildSinglePlotComponent$2$mouseMoved$2.invoke(FigureToAwt.kt:184)
at com.intellij.kotlin.jupyter.plots.IdeaSwingContextBatik.IDEA_EDT_EXECUTOR$lambda$2$lambda$1(IdeaSwingContextBatik.kt:17)
...
My guess is that it could fail earlier, and the error-containing spec shouldn't be even generated.
What do you think? Can the verification of the format be done at the moment we create the spec?
Metadata
Metadata
Assignees
Labels
No labels