Skip to content

Commit 5fb5cb9

Browse files
committed
fix na for continuous scales
1 parent aa19603 commit 5fb5cb9

File tree

2 files changed

+3
-65
lines changed
  • ggdsl-echarts/src
    • main/kotlin/org/jetbrains/kotlinx/ggdsl/echarts/translator
    • test/kotlin/org/jetbrains/kotlinx/ggdsl/echarts

2 files changed

+3
-65
lines changed

ggdsl-echarts/src/main/kotlin/org/jetbrains/kotlinx/ggdsl/echarts/translator/Parser.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ internal class Parser(plot: Plot) {
145145

146146
private fun ScaledMapping<*>.getId(): String = this.columnScaled.source.name
147147

148-
private fun ScaledMapping<*>.getNA(): Any? = when (/*val scale =*/ this.columnScaled.scale) {
149-
is PositionalScale<*> -> null //scale.nullValue?.value TODO()
150-
is NonPositionalScale<*, *> -> null //scale.nullValue?.value TODO()
148+
private fun ScaledMapping<*>.getNA(): Any? = when (val scale = this.columnScaled.scale) {
149+
is PositionalContinuousScale<*> -> scale.nullValue?.value
150+
is NonPositionalContinuousScale<*, *> -> scale.nullValue?.value
151151
else -> null
152152
}
153153

ggdsl-echarts/src/test/kotlin/org/jetbrains/kotlinx/ggdsl/echarts/nullableData.kt

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -220,68 +220,6 @@ class NullableDataTest {
220220
assertEquals(expected, actual)
221221
}
222222

223-
@Test
224-
fun `bars with nulls and fill nulls for x-axis`() {
225-
val expected = """
226-
{
227-
"xAxis": {
228-
"show": true,
229-
"type": "category"
230-
},
231-
"yAxis": {
232-
"show": true,
233-
"type": "value"
234-
},
235-
"dataset": {
236-
"source": [
237-
[
238-
"days",
239-
"nums"
240-
],
241-
[
242-
"first",
243-
"1"
244-
],
245-
[
246-
"second",
247-
"2"
248-
],
249-
[
250-
"third",
251-
"3"
252-
],
253-
[
254-
"fourth",
255-
null
256-
],
257-
[
258-
"fifth",
259-
"5"
260-
]
261-
]
262-
},
263-
"series": [
264-
{
265-
"type": "bar",
266-
"name": "days nums",
267-
"encode": {
268-
"x": "days",
269-
"y": "nums"
270-
}
271-
}
272-
]
273-
}
274-
""".trimIndent()
275-
276-
val actual = plot(data) {
277-
x(days.scaled(categoricalPos(/*nullValue = "third"*/)))
278-
y(nums)
279-
bars {}
280-
}.toJson()
281-
282-
assertEquals(expected, actual)
283-
}
284-
285223
@Test
286224
fun `points with nulls`() {
287225
val option = plot(data) {

0 commit comments

Comments
 (0)