00001 package org.math.plot; 00002 00003 import java.awt.*; 00004 00005 import org.math.plot.canvas.*; 00006 import org.math.plot.utils.*; 00007 00015 public class Plot3DPanel extends PlotPanel { 00016 00017 private static final long serialVersionUID = 1L; 00018 00019 public Plot3DPanel() { 00020 super(new Plot3DCanvas()); 00021 } 00022 00023 public Plot3DPanel(double[] min, double[] max, String[] axesScales, String[] axesLabels) { 00024 super(new Plot3DCanvas(min, max, axesScales, axesLabels)); 00025 } 00026 00027 public Plot3DPanel(PlotCanvas _canvas, String legendOrientation) { 00028 super(_canvas, legendOrientation); 00029 } 00030 00031 public Plot3DPanel(PlotCanvas _canvas) { 00032 super(_canvas); 00033 } 00034 00035 public Plot3DPanel(String legendOrientation) { 00036 super(new Plot3DCanvas(), legendOrientation); 00037 } 00038 00039 00063 public int addScatterPlot(String name, Color color, double[][] XY) { 00064 return ((Plot3DCanvas) plotCanvas).addScatterPlot(name, color, XY); 00065 } 00066 00067 public int addScatterPlot(String name, Color color, double[] X, double[] Y, double[] Z) { 00068 return ((Plot3DCanvas) plotCanvas).addScatterPlot(name, color, X,Y,Z); 00069 } 00070 00071 public int addScatterPlot(String name, double[][] XY) { 00072 return addScatterPlot(name, getNewColor(), XY); 00073 } 00074 00075 public int addScatterPlot(String name, double[] X, double[] Y, double[] Z) { 00076 return addScatterPlot(name, getNewColor(), X,Y,Z); 00077 } 00078 00102 public int addLinePlot(String name, Color color, double[][] XY) { 00103 return ((Plot3DCanvas) plotCanvas).addLinePlot(name, color, XY); 00104 } 00105 00106 public int addLinePlot(String name, Color color, double[] X, double[] Y, double[] Z) { 00107 return ((Plot3DCanvas) plotCanvas).addLinePlot(name, color, X,Y,Z); 00108 } 00109 00110 public int addLinePlot(String name, double[][] XY) { 00111 return addLinePlot(name, getNewColor(), XY); 00112 } 00113 00114 public int addLinePlot(String name, double[] X, double[] Y, double[] Z) { 00115 return addLinePlot(name, getNewColor(), X,Y,Z); 00116 } 00117 00141 public int addBarPlot(String name, Color color, double[][] XY) { 00142 return ((Plot3DCanvas) plotCanvas).addBarPlot(name, color, XY); 00143 } 00144 00145 public int addBarPlot(String name, Color color, double[] X, double[] Y, double[] Z) { 00146 return ((Plot3DCanvas) plotCanvas).addBarPlot(name, color, X,Y,Z); 00147 } 00148 00149 public int addBarPlot(String name, double[][] XY) { 00150 return addBarPlot(name, getNewColor(), XY); 00151 } 00152 00153 public int addBarPlot(String name, double[] X, double[] Y, double[] Z) { 00154 return addBarPlot(name, getNewColor(), X,Y,Z); 00155 } 00156 00157 public int addBoxPlot(String name, Color c, double[][] XY, double[][] dX) { 00158 return ((Plot3DCanvas) plotCanvas).addBoxPlot(name, c, XY, dX); 00159 } 00160 00161 public int addBoxPlot(String name, double[][] XY, double[][] dX) { 00162 return addBoxPlot(name, getNewColor(), XY, dX); 00163 } 00164 00165 public int addBoxPlot(String name, Color c, double[][] XYdX) { 00166 return ((Plot3DCanvas) plotCanvas).addBoxPlot(name, c, Array.getColumnsRangeCopy(XYdX, 0, 2), Array.getColumnsRangeCopy(XYdX, 3, 5)); 00167 } 00168 00169 public int addBoxPlot(String name, double[][] XYdX) { 00170 return addBoxPlot(name, getNewColor(), XYdX); 00171 } 00172 00173 public int addHistogramPlot(String name, Color c, double[][] XY, double[][] dX) { 00174 return ((Plot3DCanvas) plotCanvas).addHistogramPlot(name, c, XY, dX); 00175 } 00176 00177 public int addHistogramPlot(String name, double[][] XY, double[][] dX) { 00178 return addHistogramPlot(name, getNewColor(), XY, dX); 00179 } 00180 00181 public int addHistogramPlot(String name, Color c, double[][] XYdX) { 00182 return ((Plot3DCanvas) plotCanvas).addHistogramPlot(name, c, Array.getColumnsRangeCopy(XYdX, 0, 2), Array.getColumnsRangeCopy(XYdX, 3, 4)); 00183 } 00184 00185 public int addHistogramPlot(String name, double[][] XYdX) { 00186 return addHistogramPlot(name, getNewColor(), XYdX); 00187 } 00188 00189 public int addHistogramPlot(String name, Color c, double[][] XY, int nX, int nY) { 00190 return ((Plot3DCanvas) plotCanvas).addHistogramPlot(name, c, XY, nX, nY); 00191 } 00192 00193 public int addHistogramPlot(String name, double[][] XY, int nX, int nY) { 00194 return addHistogramPlot(name, getNewColor(), XY, nX, nY); 00195 } 00196 00197 public int addHistogramPlot(String name, Color c, double[][] XY, double[] boundsX, double[] boundsY) { 00198 return ((Plot3DCanvas) plotCanvas).addHistogramPlot(name, c, XY, boundsX, boundsY); 00199 } 00200 00201 public int addHistogramPlot(String name, double[][] XY, double[] boundsX, double[] boundsY) { 00202 return addHistogramPlot(name, getNewColor(), XY, boundsX, boundsY); 00203 } 00204 00205 public int addHistogramPlot(String name, Color c, double[][] XY, double minX, double maxX, int nX, double minY, double maxY, int nY) { 00206 return ((Plot3DCanvas) plotCanvas).addHistogramPlot(name, c, XY, minX, maxX, nX, minY, maxY, nY); 00207 } 00208 00209 public int addHistogramPlot(String name, double[][] XY, double minX, double maxX, int nX, double minY, double maxY, int nY) { 00210 return addHistogramPlot(name, getNewColor(), XY, minX, maxX, nX, minY, maxY, nY); 00211 } 00212 00213 public int addGridPlot(String name, Color c, double[] X, double[] Y, double[][] Z) { 00214 return ((Plot3DCanvas) plotCanvas).addGridPlot(name, c, X, Y, Z); 00215 } 00216 00217 public int addGridPlot(String name, double[] X, double[] Y, double[][] Z) { 00218 return addGridPlot(name, getNewColor(), X, Y, Z); 00219 } 00220 00221 public int addGridPlot(String name, Color c, double[][] XYZMatrix) { 00222 return ((Plot3DCanvas) plotCanvas).addGridPlot(name, c, XYZMatrix); 00223 } 00224 00225 public int addGridPlot(String name, double[][] XYZMatrix) { 00226 return addGridPlot(name, getNewColor(), XYZMatrix); 00227 } 00228 00229 public int addCloudPlot(String name, Color color, double[][] sampleXYZ, int nX, int nY, int nZ) { 00230 return ((Plot3DCanvas) plotCanvas).addCloudPlot(name, color, sampleXYZ, nX,nY,nZ); 00231 } 00232 00233 public int addCloudPlot(String name, double[][] sampleXYZ, int nX, int nY, int nZ) { 00234 return addCloudPlot(name, getNewColor(), sampleXYZ, nX,nY,nZ); 00235 } 00236 00237 @Override 00238 public int addPlot(String type, String name, Color c, double[]... XY) { 00239 if (type.equalsIgnoreCase(SCATTER)) { 00240 return addScatterPlot(name, c, XY); 00241 } else if (type.equalsIgnoreCase(LINE)) { 00242 return addLinePlot(name, c, XY); 00243 } else if (type.equalsIgnoreCase(BAR)) { 00244 return addBarPlot(name, c, XY); 00245 } else if (type.equalsIgnoreCase(HISTOGRAM)) { 00246 return addHistogramPlot(name, c, XY); 00247 } else if (type.equalsIgnoreCase(BOX)) { 00248 return addBoxPlot(name, c, XY); 00249 } else if (type.equalsIgnoreCase(GRID)) { 00250 return addGridPlot(name, c, XY); 00251 } else { 00252 throw new IllegalArgumentException("Plot type is unknown : " + type); 00253 } 00254 } 00255 00256 }