Add plotting directly from array

master
skylarmt 10 years ago
parent 193bf13349
commit c9817662f2

@ -58,7 +58,6 @@ public class Functions {
/*
Math commands
*/
// Derivative of function with respect to idv
public String diff(String function, String idv) {
return util.evaluate("diff(" + function + "," + idv + ")").toString();
@ -87,11 +86,11 @@ public class Functions {
}
public double rad(double degrees) {
return degrees * (PI/180);
return degrees * (PI / 180);
}
public double deg(double radians) {
return radians * (180/PI);
return radians * (180 / PI);
}
public String sym(String input) {
@ -122,7 +121,6 @@ public class Functions {
/*
Graphing interfaces
*/
public void plotrange(double xmin, double xmax) {
graphwin.setRange(xmin, xmax);
}
@ -132,6 +130,14 @@ public class Functions {
graphwin.graphFunction(function);
}
public void plot(double[] x, double[] y) {
graphwin.plotPoints(x, y);
}
public void plot(double[] x, double[] y, String name) {
graphwin.plotPoints(x, y, name);
}
public void plot(String function, double xmin, double xmax) {
graphwin.setRange(xmin, xmax);
plot(function);
@ -199,6 +205,7 @@ public class Functions {
/*
Constructor.
*/
public Functions() {
MainGUI.loadFrame(graphwin, false);
}

@ -321,6 +321,14 @@ public class Graph extends javax.swing.JInternalFrame {
private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
}//GEN-LAST:event_formComponentShown
public void plotPoints(double[] x, double[] y) {
plotPoints(x, y, "Points");
}
public void plotPoints(double[] x, double[] y, String name) {
plot.addLinePlot(name, x, y);
}
/**
* Get the zoom ratio.
*

Loading…
Cancel
Save