Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functions to specify color array for each point - this will allow… #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions src/main/java/org/math/plot/Plot2DPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,26 @@ public int addScatterPlot(String name, Color color, double[][] XY) {
return ((Plot2DCanvas) plotCanvas).addScatterPlot(name, color, XY);
}

public int addScatterPlot(String name, Color[] color, double[][] XY) {
return ((Plot2DCanvas) plotCanvas).addScatterPlot(name, color, XY);
}

public int addScatterPlot(String name, Color color, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addScatterPlot(name, color, Y);
}

public int addScatterPlot(String name, Color[] color, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addScatterPlot(name, color, Y);
}

public int addScatterPlot(String name, Color color, double[] X, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addScatterPlot(name, color, X,Y);
}

public int addScatterPlot(String name, Color[] color, double[] X, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addScatterPlot(name, color, X,Y);
}

public int addScatterPlot(String name, double[][] XY) {
return addScatterPlot(name, getNewColor(), XY);
}
Expand Down Expand Up @@ -121,14 +133,26 @@ public int addLinePlot(String name, Color color, double[][] XY) {
return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, XY);
}

public int addLinePlot(String name, Color[] color, double[][] XY) {
return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, XY);
}

public int addLinePlot(String name, Color color, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, Y);
}

public int addLinePlot(String name, Color[] color, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, Y);
}

public int addLinePlot(String name, Color color, double[] X, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, X,Y);
}

public int addLinePlot(String name, Color[] color, double[] X, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addLinePlot(name, color, X,Y);
}

public int addLinePlot(String name, double[][] XY) {
return addLinePlot(name, getNewColor(), XY);
}
Expand Down Expand Up @@ -168,14 +192,26 @@ public int addBarPlot(String name, Color color, double[][] XY) {
return ((Plot2DCanvas) plotCanvas).addBarPlot(name, color, XY);
}

public int addBarPlot(String name, Color[] color, double[][] XY) {
return ((Plot2DCanvas) plotCanvas).addBarPlot(name, color, XY);
}

public int addBarPlot(String name, Color color, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addBarPlot(name, color, Y);
}

public int addBarPlot(String name, Color[] color, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addBarPlot(name, color, Y);
}

public int addBarPlot(String name, Color color, double[] X, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addBarPlot(name, color, X,Y);
}

public int addBarPlot(String name, Color[] color, double[] X, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addBarPlot(name, color, X,Y);
}

public int addBarPlot(String name, double[][] XY) {
return addBarPlot(name, getNewColor(), XY);
}
Expand Down Expand Up @@ -215,14 +251,26 @@ public int addStaircasePlot(String name, Color color, double[][] XY) {
return ((Plot2DCanvas) plotCanvas).addStaircasePlot(name, color, XY);
}

public int addStaircasePlot(String name, Color[] color, double[][] XY) {
return ((Plot2DCanvas) plotCanvas).addStaircasePlot(name, color, XY);
}

public int addStaircasePlot(String name, Color color, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addStaircasePlot(name, color, Y);
}

public int addStaircasePlot(String name, Color[] color, double[] Y) {
return ((Plot2DCanvas) plotCanvas).addStaircasePlot(name, color, Y);
}

public int addStaircasePlot(String name, Color color, double[] X,double[] Y) {
return ((Plot2DCanvas) plotCanvas).addStaircasePlot(name, color, X,Y);
}

public int addStaircasePlot(String name, Color[] color, double[] X,double[] Y) {
return ((Plot2DCanvas) plotCanvas).addStaircasePlot(name, color, X,Y);
}

public int addStaircasePlot(String name, double[][] XY) {
return addStaircasePlot(name, getNewColor(), XY);
}
Expand Down Expand Up @@ -256,6 +304,10 @@ public int addBoxPlot(String name, Color color, double[][] XY, double[][] dXdY)
return ((Plot2DCanvas) plotCanvas).addBoxPlot(name, color, XY, dXdY);
}

public int addBoxPlot(String name, Color[] color, double[][] XY, double[][] dXdY) {
return ((Plot2DCanvas) plotCanvas).addBoxPlot(name, color, XY, dXdY);
}

public int addBoxPlot(String name, double[][] XY, double[][] dXdY) {
return addBoxPlot(name, getNewColor(), XY, dXdY);
}
Expand All @@ -279,6 +331,10 @@ public int addBoxPlot(String name, Color color, double[][] XYdXdY) {
return ((Plot2DCanvas) plotCanvas).addBoxPlot(name, color, XYdXdY);
}

public int addBoxPlot(String name, Color[] color, double[][] XYdXdY) {
return ((Plot2DCanvas) plotCanvas).addBoxPlot(name, color, XYdXdY);
}

public int addBoxPlot(String name, double[][] XYdXdY) {
return addBoxPlot(name, getNewColor(), XYdXdY);
}
Expand All @@ -303,6 +359,10 @@ public int addHistogramPlot(String name, Color color, double[][] XY, double[] dX
return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, XY, dX);
}

public int addHistogramPlot(String name, Color[] color, double[][] XY, double[] dX) {
return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, XY, dX);
}

public int addHistogramPlot(String name, double[][] XY, double[] dX) {
return addHistogramPlot(name, getNewColor(), XY, dX);
}
Expand All @@ -311,6 +371,10 @@ public int addHistogramPlot(String name, Color color, double[][] XYdX) {
return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, XYdX);
}

public int addHistogramPlot(String name, Color[] color, double[][] XYdX) {
return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, XYdX);
}

/**
* Adds a histogram plot to the current plot panel. Each data point is as
* vertical bar which width can be set.
Expand Down Expand Up @@ -342,6 +406,10 @@ public int addHistogramPlot(String name, Color color, double[] sample, int n) {
return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, sample, n);
}

public int addHistogramPlot(String name, Color[] color, double[] sample, int n) {
return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, sample, n);
}

public int addHistogramPlot(String name, double[] X, int n) {
return addHistogramPlot(name, getNewColor(), X, n);
}
Expand All @@ -360,6 +428,10 @@ public int addHistogramPlot(String name, Color color, double[] sample, double...
return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, sample, bounds);
}

public int addHistogramPlot(String name, Color[] color, double[] sample, double... bounds) {
return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, sample, bounds);
}

public int addHistogramPlot(String name, double[] X, double... bounds) {
return addHistogramPlot(name, getNewColor(), X, bounds);
}
Expand All @@ -368,6 +440,10 @@ public int addHistogramPlot(String name, Color color, double[] X, double min, do
return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, X, min, max, n);
}

public int addHistogramPlot(String name, Color[] color, double[] X, double min, double max, int n) {
return ((Plot2DCanvas) plotCanvas).addHistogramPlot(name, color, X, min, max, n);
}

public int addHistogramPlot(String name, double[] X, double min, double max, int n) {
return addHistogramPlot(name, getNewColor(), X, min, max, n);
}
Expand All @@ -376,6 +452,10 @@ public int addCloudPlot(String name, Color color, double[][] sampleXY, int nX, i
return ((Plot2DCanvas) plotCanvas).addCloudPlot(name, color, sampleXY, nX,nY);
}

public int addCloudPlot(String name, Color[] color, double[][] sampleXY, int nX, int nY) {
return ((Plot2DCanvas) plotCanvas).addCloudPlot(name, color, sampleXY, nX,nY);
}

public int addCloudPlot(String name, double[][] sampleXY, int nX, int nY) {
return addCloudPlot(name, getNewColor(), sampleXY, nX,nY);
}
Expand All @@ -399,4 +479,28 @@ public int addPlot(String type, String name, Color color, double[]... XY) {
}
}

@Override
public int addPlot(String type, String name, Color[] color, double[]... XY) {
if (type.equalsIgnoreCase(SCATTER)) {
return addScatterPlot(name, color, XY);
} else if (type.equalsIgnoreCase(LINE)) {
return addLinePlot(name, color, XY);
} else if (type.equalsIgnoreCase(BAR)) {
return addBarPlot(name, color, XY);
} else if (type.equalsIgnoreCase(STAIRCASE)) {
return addStaircasePlot(name, color, XY);
} else if (type.equalsIgnoreCase(HISTOGRAM)) {
return addHistogramPlot(name, color, XY);
} else if (type.equalsIgnoreCase(BOX)) {
return addBoxPlot(name, color, XY);
} else {
throw new IllegalArgumentException("Plot type is unknown : " + type);
}
}

@Override
public int addPlot(String type, String name, Color[][] color, double[]... XY) {
throw new IllegalArgumentException("Plot type is unknown : " + type);
}

}
Loading