00001 package org.math.plot; 00002 00003 import java.awt.*; 00004 00005 import org.math.plot.canvas.*; 00006 00021 public class Plot2DPanel extends PlotPanel { 00022 00023 private static final long serialVersionUID = 1L; 00024 00030 public Plot2DPanel() { 00031 super(new Plot2DCanvas()); 00032 } 00033 00034 public Plot2DPanel(double[] min, double[] max, String[] axesScales, String[] axesLabels) { 00035 super(new Plot2DCanvas(min, max, axesScales, axesLabels)); 00036 } 00037 00038 public Plot2DPanel(PlotCanvas _canvas, String legendOrientation) { 00039 super(_canvas, legendOrientation); 00040 } 00041 00042 public Plot2DPanel(PlotCanvas _canvas) { 00043 super(_canvas); 00044 } 00045 00046 public Plot2DPanel(String legendOrientation) { 00047 super(new Plot2DCanvas(), legendOrientation); 00048 } 00049 00073 public int addScatterPlot(String name, Color color, double[][] XY) { 00074 return ((Plot2DCanvas) plotCanvas).addScatterPlot(name, color, XY); 00075 } 00076 00077 public int addScatterPlot(String name, Color color, double[] Y) { 00078 return ((Plot2DCanvas) plotCanvas).addScatterPlot(name, color, Y); 00079 } 00080 00081 public int addScatterPlot(String name, Color color, double[] X, double[] Y) { 00082 return ((Plot2DCanvas) plotCanvas).addScatterPlot(name, color, X,Y); 00083 } 00084 00085 public int addScatterPlot(String name, double[][] XY) { 00086 return addScatterPlot(name, getNewColor(), XY); 00087 } 00088 00089 public int addScatterPlot(String name, double[] Y) { 00090 return addScatterPlot(name, getNewColor(), Y); 00091 } 00092 00093 public int addScatterPlot(String name, double[] X, double[] Y) { 00094 return addScatterPlot(name, getNewColor(), X,Y); 00095 } 00096 00120 public int addLinePlot(String name, Color color, double[][] XY) { 00121 return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, XY); 00122 } 00123 00124 public int addLinePlot(String name, Color color, double[] Y) { 00125 return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, Y); 00126 } 00127 00128 public int addLinePlot(String name, Color color, double[] X, double[] Y) { 00129 return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, X,Y); 00130 } 00131 00132 public int addLinePlot(String name, double[][] XY) { 00133 return addLinePlot(name, getNewColor(), XY); 00134 } 00135 00136 public int addLinePlot(String name, double[] Y) { 00137 return addLinePlot(name, getNewColor(), Y); 00138 } 00139 00140 public int addLinePlot(String name, double[] X, double[] Y) { 00141 return addLinePlot(name, getNewColor(), X,Y); 00142 } 00143 00167 public int addBarPlot(String name, Color color, double[][] XY) { 00168 return ((Plot2DCanvas) plotCanvas).addBarPlot(name, color, XY); 00169 } 00170 00171 public int addBarPlot(String name, Color color, double[] Y) { 00172 return ((Plot2DCanvas) plotCanvas).addBarPlot(name, color, Y); 00173 } 00174 00175 public int addBarPlot(String name, Color color, double[] X, double[] Y) { 00176 return ((Plot2DCanvas) plotCanvas).addBarPlot(name, color, X,Y); 00177 } 00178 00179 public int addBarPlot(String name, double[][] XY) { 00180 return addBarPlot(name, getNewColor(), XY); 00181 } 00182 00183 public int addBarPlot(String name, double[] Y) { 00184 return addBarPlot(name, getNewColor(), Y); 00185 } 00186 00187 public int addBarPlot(String name, double[] X, double[] Y) { 00188 return addBarPlot(name, getNewColor(), X,Y); 00189 } 00190 00214 public int addStaircasePlot(String name, Color color, double[][] XY) { 00215 return ((Plot2DCanvas) plotCanvas).addStaircasePlot(name, color, XY); 00216 } 00217 00218 public int addStaircasePlot(String name, Color color, double[] Y) { 00219 return ((Plot2DCanvas) plotCanvas).addStaircasePlot(name, color, Y); 00220 } 00221 00222 public int addStaircasePlot(String name, Color color, double[] X,double[] Y) { 00223 return ((Plot2DCanvas) plotCanvas).addStaircasePlot(name, color, X,Y); 00224 } 00225 00226 public int addStaircasePlot(String name, double[][] XY) { 00227 return addStaircasePlot(name, getNewColor(), XY); 00228 } 00229 00230 public int addStaircasePlot(String name, double[] Y) { 00231 return addStaircasePlot(name, getNewColor(), Y); 00232 } 00233 00234 public int addStaircasePlot(String name, double[] X,double[] Y) { 00235 return addStaircasePlot(name, getNewColor(), X,Y); 00236 } 00237 00255 public int addBoxPlot(String name, Color color, double[][] XY, double[][] dXdY) { 00256 return ((Plot2DCanvas) plotCanvas).addBoxPlot(name, color, XY, dXdY); 00257 } 00258 00259 public int addBoxPlot(String name, double[][] XY, double[][] dXdY) { 00260 return addBoxPlot(name, getNewColor(), XY, dXdY); 00261 } 00262 00278 public int addBoxPlot(String name, Color color, double[][] XYdXdY) { 00279 return ((Plot2DCanvas) plotCanvas).addBoxPlot(name, color, XYdXdY); 00280 } 00281 00282 public int addBoxPlot(String name, double[][] XYdXdY) { 00283 return addBoxPlot(name, getNewColor(), XYdXdY); 00284 } 00285 00302 public int addHistogramPlot(String name, Color color, double[][] XY, double[] dX) { 00303 return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, XY, dX); 00304 } 00305 00306 public int addHistogramPlot(String name, double[][] XY, double[] dX) { 00307 return addHistogramPlot(name, getNewColor(), XY, dX); 00308 } 00309 00310 public int addHistogramPlot(String name, Color color, double[][] XYdX) { 00311 return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, XYdX); 00312 } 00313 00328 public int addHistogramPlot(String name, double[][] XYdX) { 00329 return addHistogramPlot(name, getNewColor(), XYdX); 00330 } 00331 00341 public int addHistogramPlot(String name, Color color, double[] sample, int n) { 00342 return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, sample, n); 00343 } 00344 00345 public int addHistogramPlot(String name, double[] X, int n) { 00346 return addHistogramPlot(name, getNewColor(), X, n); 00347 } 00348 00359 public int addHistogramPlot(String name, Color color, double[] sample, double... bounds) { 00360 return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, sample, bounds); 00361 } 00362 00363 public int addHistogramPlot(String name, double[] X, double... bounds) { 00364 return addHistogramPlot(name, getNewColor(), X, bounds); 00365 } 00366 00367 public int addHistogramPlot(String name, Color color, double[] X, double min, double max, int n) { 00368 return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, X, min, max, n); 00369 } 00370 00371 public int addHistogramPlot(String name, double[] X, double min, double max, int n) { 00372 return addHistogramPlot(name, getNewColor(), X, min, max, n); 00373 } 00374 00375 public int addCloudPlot(String name, Color color, double[][] sampleXY, int nX, int nY) { 00376 return ((Plot2DCanvas) plotCanvas).addCloudPlot(name, color, sampleXY, nX,nY); 00377 } 00378 00379 public int addCloudPlot(String name, double[][] sampleXY, int nX, int nY) { 00380 return addCloudPlot(name, getNewColor(), sampleXY, nX,nY); 00381 } 00382 00383 @Override 00384 public int addPlot(String type, String name, Color color, double[]... XY) { 00385 if (type.equalsIgnoreCase(SCATTER)) { 00386 return addScatterPlot(name, color, XY); 00387 } else if (type.equalsIgnoreCase(LINE)) { 00388 return addLinePlot(name, color, XY); 00389 } else if (type.equalsIgnoreCase(BAR)) { 00390 return addBarPlot(name, color, XY); 00391 } else if (type.equalsIgnoreCase(STAIRCASE)) { 00392 return addStaircasePlot(name, color, XY); 00393 } else if (type.equalsIgnoreCase(HISTOGRAM)) { 00394 return addHistogramPlot(name, color, XY); 00395 } else if (type.equalsIgnoreCase(BOX)) { 00396 return addBoxPlot(name, color, XY); 00397 } else { 00398 throw new IllegalArgumentException("Plot type is unknown : " + type); 00399 } 00400 } 00401 00402 }