Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/src/main/kotlin/misc/dynamicBars.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fun main() {
name to Bar {
x.strings = initialValue.map { "Column: $it" }
y.numbers = initialValue
textsList = initialValue.map { "Initial value of this datapoint is: ${it}"}
this.name = name
}
}
Expand Down Expand Up @@ -58,6 +59,7 @@ fun main() {
val yValues = bar.y.doubles
yValues[columnIndex] = Random.nextInt(0,100).toDouble()
bar.y.doubles = yValues
bar.textsList = yValues.map { "Updated value of this datapoint is: ${it}"}
}
}
}
Expand All @@ -68,4 +70,4 @@ fun main() {
readLine()

server.close()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ fun HTMLElement.plot(plot: Plot, plotlyConfig: PlotlyConfig = PlotlyConfig()) {
traceData.z = arrayOf(traceData.z)
}

if (trace.text.value != null) {
traceData.text = arrayOf(traceData.text)
}

PlotlyJs.restyle(this, traceData, arrayOf(index))
}
}
}

fun HTMLElement.plot(plotlyConfig: PlotlyConfig = PlotlyConfig(), plotBuilder: Plot.() -> Unit) {
plot(Plot().apply(plotBuilder), plotlyConfig)
}
}