Reputation: 1
I am trying to use magicdraw's built-in opacity language to draw 3d scatterplots, while I don't want to use matlab language. However I am not familiar with java at all. I am trying to place the jmathlib.jar file in the lib folder of magicdraw and introduce a code in the opacity behavior.
import org.math.plot.*
import javax.swing.JFrame
class ScatterPlot3DExample {
static void main(String[] args) {
Plot3DPanel plot = new Plot3DPanel()
double[] x = [1, 2, 3, 4, 5] as double[]
double[] y = [5, 4, 3, 2, 1] as double[]
double[] z = [10, 20, 30, 40, 50] as double[]
plot.addScatterPlot("3D Scatter Plot", x, y, z)
plot.setAxisLabel(0, "X Axis")
plot.setAxisLabel(1, "Y Axis")
plot.setAxisLabel(2, "Z Axis")
JFrame frame = new JFrame("3D Scatter Plot Example")
frame.setContentPane(plot)
frame.setSize(600, 600)
frame.setVisible(true)
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
}
}
An error will then be displayed.I'm not sure exactly what the problem is, because import doesn't show an error.
00:00:00,691 ERROR: Cannot evaluate Opaque Action: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script13.groovy: 6: unable to resolve class Plot3DPanel @ line 6, column 21. Plot3DPanel plot = new Plot3DPanel() ^ Script13.groovy: 6: unable to resolve class Plot3DPanel @ line 6, column 28. Plot3DPanel plot = new Plot3DPanel() ^ 2 errors
This video videodescribes drawing a 2D image in magicdraw. I found some related files in the lib folder, such as jide-charts-3.7.12.jar. So I'm wondering if I'm missing some steps.
I've tried using JavaScript before, but it seems that the built-in nashorn and rhino don't work with projects in github. Anyway, I'm simply trying to plot the results from other behavioral operations in the sysml activity graph into a 3d scatterplot without using matlab as much as possible. I'd appreciate any help you can provide.
Upvotes: 0
Views: 39
Reputation: 55
I believe it is because the ClassPath of MagicDraw does not include jmathlib.jar, so this dependency is not well loaded.
A touch of lib/classpath.jar may help.
Upvotes: 0