question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Close chart window without quitting repl

See original GitHub issue

I 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:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
imagingbookcommented, Feb 6, 2016

The reason appears to be that SwingWrapper does setDefaultCloseOperation(EXIT_ON_CLOSE) on its JFrame, which is returned by displayChart(). Something like this might work in Java (don’t know about Scala):

swingChart.displayChart().setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE)

–Wilhelm

0reactions
UPocekcommented, Jun 8, 2021

This worked for me: new SwingWrapper(pieChart).displayChart().setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found