Skip to content

Commit

Permalink
Fix rendering issue for lab
Browse files Browse the repository at this point in the history
  • Loading branch information
altavir committed Feb 22, 2024
1 parent fe44a71 commit a080544
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Grid view

### Fixed
- Fixed rendering for Jupyter lab

### Security

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ val plotlyVersion by extra("2.29.0")

allprojects {
group = "space.kscience"
version = "0.7.0"
version = "0.7.1"
}

apiValidation {
Expand Down
11 changes: 11 additions & 0 deletions examples/notebooks/plotlykt-demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
"//%use plotly"
]
},
{
"cell_type": "code",
"outputs": [],
"source": [
"Plotly.jupyter.notebook()"
],
"metadata": {
"collapsed": false
},
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/plotlykt-server-demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
"toc_window_display": false
},
"ktnbPluginMetadata": {
"isBuildProject": true
"projectDependencies": true
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public object PlotlyConnect {
console.warn("Plotly not defined. Loading the script from CDN")
window.asDynamic().promiseOfPlotly = Promise<PlotlyJs> { resolve, reject ->
val plotlyLoaderScript = document.createElement("script") as HTMLScriptElement
plotlyLoaderScript.src = "https://cdn.plot.ly/plotly-2.24.1.min.js"
plotlyLoaderScript.src = "https://cdn.plot.ly/plotly-2.29.0.min.js"
plotlyLoaderScript.type = "text/javascript"
plotlyLoaderScript.onload = {
resolve(PlotlyJs)
Expand Down Expand Up @@ -163,4 +163,5 @@ public object PlotlyConnect {

public fun main() {
window.asDynamic().plotlyConnect = PlotlyConnect
window.asDynamic().Plotly = PlotlyJs
}
2 changes: 1 addition & 1 deletion plotlykt-geo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ kscience{
native()
wasm()
dependencies {
api(project(":plotlykt-core"))
api(projects.plotlyktCore)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public object PlotlyJupyterConfiguration {
return PlotlyHtmlFragment {
div {
style = "color: blue;"
+"Plotly notebook integration switched into the legacy mode."
+"Plotly notebook integration switched into the notebook mode."
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ internal class BuilderTest {
fun testBuilderFromString() {
val string = javaClass.getResource("/customPage.plotly.kts").readText()
val page = Plotly.page(string)
page.render()
println(page.render())
}
}
1 change: 1 addition & 0 deletions plotlykt-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ val ktorVersion = KScienceVersions.ktorVersion

kscience{
jvm()
useCoroutines()
commonMain{
api(projects.plotlyktCore)
api("io.ktor:ktor-server-cio:$ktorVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ public class PlotlyServerIntegration : JupyterIntegration() {
}
}

private fun renderPage(page: PlotlyPage): String = page.copy(renderer = renderer).render()

override fun Builder.onLoaded() {

resources {
Expand All @@ -131,7 +129,8 @@ public class PlotlyServerIntegration : JupyterIntegration() {
"space.kscience.plotly.*",
"space.kscience.plotly.models.*",
"space.kscience.dataforge.meta.*",
"kotlinx.html.*"
"kotlinx.html.*",
"kotlinx.coroutines.*"
)

import("space.kscience.plotly.server.jupyter")
Expand Down

0 comments on commit a080544

Please sign in to comment.