Interactively plot (JSON) data in tool window plugin

Answered

I'm working on IntelliJ IDEA plugin that will display/plot data from a JSON file or some other similar data source. I have already tried multiple java (3d) plotting libraries (Jzy3D, JFreeChart, XChart...), but I can't get them to work inside IDEA's tool window.

I have next requirements:

  • plots need to be interactive,
  • they need to work on Community edition of IDEA,
  • no 3rd party API calls needed (as Google's charts API). It has to work offline, without sending any of my info to 3rd parties,
  • support for real-time plotting.

Does anyone have any recommendation for a library to use? Has there been anything similar done before (and is it possible to look at the source code)?

Do I have to add tool window event listener for every type of plot interactive action? Is content inside tool window static or does it refresh automatically?

Any other tips regarding this will be greatly appreciated as well!

7 comments
Comment actions Permalink

You should be able to use any library that works with Swing. You can then embed its component into a toolwindow. Please see https://www.jetbrains.org/intellij/sdk/docs/user_interface_components/tool_windows.html and sample plugin code https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/tool_window

The behavior and interactivity of contents shown in a toolwindow completely depends on your implementation.

1
Comment actions Permalink

Thank you for the reply, I'll try to solve the problem.

0
Comment actions Permalink

I've been working on my implementation but I'm still unable to fix the issues. I'm using XChart library, since it's the only one that officially supports real-time plotting. In it's implementation, one of the library's functions uses invokeAndWait(), which throws error if it's called from event dispatcher thread. Is there any workaround for this (without having to change library's source)?

0
Comment actions Permalink

Please give specific details, what exactly is "throws error"? Any stacktrace? See also http://www.jetbrains.org/intellij/sdk/docs/basics/architectural_overview/general_threading_rules.html

0
Comment actions Permalink

Here's the trace (some package info is blurred out). I'll check out the documentation you've provided and try to fix this.

0
Comment actions Permalink

I was able to fix all the threading problems, so I am able to display plots now. However, none of the implementations I've tried for real-time/animated plotting has worked for me. Are there any special handlers for changing tool window content after it was already created?

0
Comment actions Permalink

As I wrote above, "The behavior and interactivity of contents shown in a toolwindow completely depends on your implementation."

I don't know how this library/charting works internally, but the toolwindow contents are plain Swing.

0

Please sign in to leave a comment.