View Full Version : JMSL 4.0 Chart3D Graphing

07-18-2006, 12:15 PM
I'm trying to print a 3-D graph using JMSL 4.0.
When I select File, Print from the drop-down menu. I get a gray box on the paper that prints. Please let me know if I can fix this somehow?

Here is my code:

public class SimpleSurface extends JFrameChart3D
double[] x;
double[] y;
double[][] z;
int length;

public void graphing()
Font font = new Font("Serif", Font.PLAIN, 16);
Chart3D chart = getChart3D();

AxisXYZ axis = new AxisXYZ(chart);
axis.setTitle("Total Objective Value vs Epochs");
axis.setAxisTitlePosition(axis.AXIS_TITLE_PARALLEL );
axis.getAxisX().getAxisTitle().setTitle("P ID");
axis.getAxisY().getAxisTitle().setTitle("E ID");
axis.getAxisZ().getAxisTitle().setTitle("Total Objective Value");
axis.getAxisX().getAxisLine().setLineColor(Color.b lue);
axis.getAxisY().getAxisLine().setLineColor(Color.r ed);
axis.getAxisZ().getAxisLine().setLineColor(Color.b lue);
Surface surface = new Surface(axis, x, y, z);
surface.setSurfaceType(Surface.SURFACE_TYPE_NICEST | Surface.SURFACE_TYPE_MESH);
setSize(800, 800);


07-19-2006, 04:37 AM

I don't manage to reproduce your issue. I use the the small piece of code below on my Windows XP SP2 machine with JDK 1.5.0_07-b03 and the output goes OK on my B&W printer (greyscale picture with the expected surface).

import com.imsl.chart3d.*;
public class SimpleSurface extends JFrameChart3D {
double[] x = {1., 2., 3.};
double[] y = {3., 0., 2.};;
double[][] z = {{2., 1., 0.},
{2., -1., 2.},
{1., 0, 6.}};

public SimpleSurface() {
Chart3D chart = getChart3D();
AxisXYZ axis = new AxisXYZ(chart);
Surface surface = new Surface(axis, x, y, z);

public static void main(String args[]) {
new SimpleSurface().setVisible(true);

I would suggest you to go for another try on another printer to verify if the issue does not come from the printer itself.
If it is still not satisfactory then please tell us more about the environment you're working on (operating system, jdk version etc...) so that someone with a similar configuration can try to reproduce this issue.

Don't hesitate to keep us posted!

07-19-2006, 06:06 AM

I also have a Windows XP SP2. I'm using JRE 1.50_07.
I don't have the luxury to try another printer. My printer is an HP LaserJet 5.
I noticed that when I select Edit, Copy and try to paste the image into Paint the image is also a gray box, the same when I try to print it the 3-D graph using JMSL 4.0.


07-19-2006, 06:08 AM
In addition, I'm not able to save the image properly using File, Save As test.png

I also get a gray box instead of the 3D image.


07-19-2006, 06:42 AM
And do you obtain the same kind of behavior with the following one?

import com.imsl.chart.*;
public class Intro1 extends JFrameChart {
public Intro1() {
Chart chart = getChart();
AxisXY axis = new AxisXY(chart);
double y[] = { 4, 2, 3, 9 };
new Data(axis, y);

public static void main(String argv[]) {
new Intro1().setVisible(true);

07-19-2006, 07:16 AM
During testing, we experienced varing results on different machines when using the D3D and OpenGL implementations while printing 3D graphs in JMSL 4.0. Some computers had problems with D3D while others performed better with OpenGL. We believe this to be a driver issue on the various machines that we tried it on. You should look at the main JMSL readme.html file, which contains some information on this topic.


07-19-2006, 07:37 AM
I encounter the same issues with 2D printing and editing and pasting the graph to MS paint. The screen is blank except for a dotted box.

07-19-2006, 07:43 AM
Okay, I got it working after reading the Readme file for 3D graphs.

"To use D3D set the Java system property j3d.rend to d3d. This can be done on the command line using the option -Dj3d.rend=d3d."

However, I still cannot cut, paste, and print 2-d charts?


07-19-2006, 07:50 AM
Never mind, 2-D charts now starts to cut-paste, and print.