Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why I cannot use xchart in notebook? #123

Closed
spkingr opened this issue Feb 1, 2021 · 3 comments
Closed

Why I cannot use xchart in notebook? #123

spkingr opened this issue Feb 1, 2021 · 3 comments

Comments

@spkingr
Copy link

spkingr commented Feb 1, 2021

I try using xchart in the notebook, but it doesn't work:

@file:DependsOn("org.knowm.xchart:xchart:3.8.0")
import org.knowm.xchart.*
val chart = XYChartBuilder().build()

the output error:

  • Line_348.jupyter.kts (8:12 - 17) Unresolved reference: knowm
  • Line_348.jupyter.kts (9:13 - 27) Unresolved reference: XYChartBuilder

I can find the xchart-3.8.0.jar file in the folder: ~/.ivy2/cache/org.knowm.xchart/xchart/jars , help and thanks!

@altavir
Copy link
Contributor

altavir commented Feb 1, 2021

I can't reproduce. Works fine for me on the latest kernel in the Jupyter lab. Try to put @file directive in a separate cell and execute it, maybe there are some connection issues.

image

@spkingr
Copy link
Author

spkingr commented Feb 1, 2021

It works for me now, after restarting Jupyter, thanks very much @altavir !
However, I cannot find how to display the chart in the notebook directly, it always invokes a java application instead, and more, while closing the JFrame window, the notebook kernel appears dead simultaneously:

The kernel appears to have died. It will restart automatically.
Any solution? Thanks again!

@spkingr spkingr closed this as completed Feb 1, 2021
@altavir
Copy link
Contributor

altavir commented Feb 1, 2021

The notebook runs in a browser and you can't run Swing apps inside it. Probably it will be possible to embed JFrame in IDEA notebook support in the future. As for closing the application, it is a quirk of XChart. It seems to forcibly close the application on pannel close. You need to use a custom JFrame factory to avoid that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants