1

Alright, so we're trying to incorporate a 3D scatterplot into our project in Netbeans 7.0, and one of the libraries we chose to test was Jzy3D. It looks likes it would do everything we needed it to, but unfortunately, it's not doing anything.

I have JOGL installed properly, and have tested it and found it to be working. Then I have included the same dependencies as in the demo. I have also tried directly including the .jars. And yes, gluegen-rt.jar is in the library folder.

EDIT: To get JOGL working, we had to heavily modify build settings. Honestly, my boss did most of it, so I'm not entirely sure how to replicate it yet. Now, I'm trying to put a chart in a JFrame, and the FrameSwing extension from the Jzy3D library is giving the following error:

Exception in thread "main" java.lang.ClassCastException: org.jzy3d.plot3d.rendering.canvas.CanvasAWT cannot be cast to javax.swing.JComponent
    at org.jzy3d.bridge.swing.FrameSwing.(FrameSwing.java:36)
    at scratchwork.My3DChart.main(My3DChart.java:40)

I'll keep working at it, but if someone knows what's wrong, it would be nice to know.

Update: It appears that CanvasAWT is extended from Canvas which is extended from Component, not JComponent. This seems to be the problem, and I've submitted it to the Jzy3D authors.

Martin Pernollet
  • 2,285
  • 1
  • 28
  • 39
Poik
  • 2,022
  • 27
  • 44
  • Were they/you able to make it work in the end? I have the same problem (want to integrate jzy3d chart in a JPanel) but all I see are broken links... – Matthieu Jun 09 '13 at 12:45
  • Yep. As Martin said below, I had to pass in the string option "swing" in the constructor. I haven't used Jzy3D in years though. I couldn't help you navigating the new [site's](http://www.jzy3d.org/) website to find answers anymore. – Poik Jun 09 '13 at 16:45
  • Yes I saw the question dated two years already, but just in case. I know there are still some commits being made by Martin so I'm guessing there is some work going on. Thank you for the update! – Matthieu Jun 09 '13 at 17:10
  • Good luck! I don't even use Java anymore, so I wouldn't be much help sadly. – Poik Jun 09 '13 at 20:40

1 Answers1

1

Maybe you forgot to create the chart using the "swing" option in the constructor as stated here. It creates the chart with a CanvasSwing which is a JComponent as expected in a Swing app.

Building a Swing chart creates a JOGL lightweight component that can be mixed with other JComponents appearing on top (the default AWT chart is heavyweight and remains on top of any other UI component).

Jzy3d has already been working with success both in Swing and other Windowing toolkits, so it should work for you.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Martin Pernollet
  • 2,285
  • 1
  • 28
  • 39
  • That was indeed my problem. Thanks! I completely missed that, even though I was using that page as a reference already... I'll read more carefully in the future. – Poik Jul 01 '11 at 14:17
  • I finally was able to have something work, but only with "awt". "swing" works fine on first display but disappears (all black) when JPanel is resized. – Matthieu Jun 11 '13 at 04:58
  • Right "swing" is deprecated in Jzy3d since 0.9.1, as JOGL won't maintain the underlying panel. Using "newt" at chart construction is now the prefered way of initializing a chart. Under the scene it uses a Newt canvas from JOGL, that has been recently integrated in jzy3d. – Martin Pernollet Jun 11 '13 at 08:22
  • @Martin Have you got another link for "there" the original seems to have gone – ManInMoon Oct 23 '13 at 13:29
  • This might help to understand the new "factory way" https://github.com/jzy3d/jzy3d-api/blob/master/jzy3d-tutorials/src/main/java/org/jzy3d/demos/surface/SurfaceDemo.java – Martin Pernollet Oct 23 '13 at 22:31