Close chart window without quitting repl
See original GitHub issueI am trying to use XChart in the scala repl, and every time I close the chart window, the repl is terminated.
For example:
import org.knowm.xchart.{SwingWrapper, QuickChart}
object UseXchart {
def main(args: Array[String]) {
val xData = Array(0.0, 1, 2)
val yData = Array(2.0, 1, 0)
val chart = QuickChart.getChart("title", "x", "y", "function", xData, yData)
val swingChart: SwingWrapper = new SwingWrapper(chart))
swingChart.displayChart()
}
}
Is there a workaround? Thanks!
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Closing the graphical window - Replit
Hey I'd like to know how to get rid of the graphical window sharing space with the console. I ran a plt.show()once to...
Read more >Destroy chart.js bar graph to redraw other graph in same ...
If the instance of the chart is found, it signifies that the chart must have previously been created. // JS - Destroy exiting...
Read more >Close All Charts - Forex Factory
When you want to clear all charts you go into your profiles and click on that profile you have made of just your...
Read more >How do I stop deleted or closed charts from opening up once I ...
Go into the deleted folder within the main folder and delete them permanently. Don't install on C:\Program_Files on Windows Vista or Windows 7....
Read more >Excel crash when i try to do a chart - Microsoft Community
Hi guys, i was working on a file when excel crashed without reason. After the crash i tryed to open the file i...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The reason appears to be that SwingWrapper does
setDefaultCloseOperation(EXIT_ON_CLOSE)
on its JFrame, which is returned bydisplayChart()
. Something like this might work in Java (don’t know about Scala):swingChart.displayChart().setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE)
–Wilhelm
This worked for me:
new SwingWrapper(pieChart).displayChart().setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);