/** Adds a curve or set of points to this plot, where 'type' is * "line", "connected circle", "filled", "bar", "separated bar", "circle", "box", "triangle", "diamond", "cross", * "x" or "dot". Run <i>Help>Examples>JavaScript>Graph Types</i> to see examples. * If 'type' is in the form "code: <macroCode>", the macro given is executed to draw the symbol; * macro variables 'x' and 'y' are the pixel coordinates of the point, 'xval' and 'yval' are the plot data * and 'i' is the index of the data point (starting with 0 for the first point in the array). * The drawing including line thickness, font size, etc. be scaled by scale factor 's' (to make high-resolution plots work). * Example: "code: setFont('sanserif',12*s,'bold anti');drawString(d2s(yval,1),x-14*s,y-4*s);" * writes the y value for each point above the point. */ public void add(String type, double[] xvalues, double[] yvalues) { int iShape = toShape(type); addPoints(Tools.toFloat(xvalues), Tools.toFloat(yvalues), null, iShape, iShape==CUSTOM?type.substring(5, type.length()):null); }
/** Adds a curve or set of points to this plot, where 'type' is * "line", "connected circle", "filled", "bar", "separated bar", "circle", "box", "triangle", "diamond", "cross", * "x" or "dot". Run <i>Help>Examples>JavaScript>Graph Types</i> to see examples. * If 'type' is in the form "code: <macroCode>", the macro given is executed to draw the symbol; * macro variables 'x' and 'y' are the pixel coordinates of the point, 'xval' and 'yval' are the plot data * and 'i' is the index of the data point (starting with 0 for the first point in the array). * The drawing including line thickness, font size, etc. be scaled by scale factor 's' (to make high-resolution plots work). * Example: "code: setFont('sanserif',12*s,'bold anti');drawString(d2s(yval,1),x-14*s,y-4*s);" * writes the y value for each point above the point. */ public void add(String type, double[] xvalues, double[] yvalues) { int iShape = toShape(type); addPoints(Tools.toFloat(xvalues), Tools.toFloat(yvalues), null, iShape, iShape==CUSTOM?type.substring(5, type.length()):null); }
void setPlotObjectStyle(PlotObject plotObject, String styleString) { String[] items = styleString.split(","); int nItems = items.length; if (items[nItems-1].indexOf("hidden") >= 0) { plotObject.setFlag(PlotObject.HIDDEN); nItems = items.length - 1; } else plotObject.unsetFlag(PlotObject.HIDDEN); plotObject.color = Colors.decode(items[0].trim(), plotObject.color); plotObject.color2 = Colors.decode(items[1].trim(), null); float lineWidth = plotObject.lineWidth; if (items.length >= 3) try { plotObject.lineWidth = Float.parseFloat(items[2].trim()); } catch (NumberFormatException e) {}; if (items.length >= 4 && plotObject.shape!=CUSTOM) plotObject.shape = toShape(items[3].trim()); updateImage(); return; }
void setPlotObjectStyle(PlotObject plotObject, String styleString) { String[] items = styleString.split(","); int nItems = items.length; if (items[nItems-1].indexOf("hidden") >= 0) { plotObject.setFlag(PlotObject.HIDDEN); nItems = items.length - 1; } else plotObject.unsetFlag(PlotObject.HIDDEN); plotObject.color = Colors.decode(items[0].trim(), plotObject.color); plotObject.color2 = Colors.decode(items[1].trim(), null); float lineWidth = plotObject.lineWidth; if (items.length >= 3) try { plotObject.lineWidth = Float.parseFloat(items[2].trim()); } catch (NumberFormatException e) {}; if (items.length >= 4 && plotObject.shape!=CUSTOM) plotObject.shape = toShape(items[3].trim()); updateImage(); return; }
/** Adds a curve, set of points or error bars to this plot, where 'type' is * "line", "connected circle", "filled", "bar", "separated bar", "circle", "box", * "triangle", "diamond", "cross", "x", "dot", "error bars" or "xerror bars". */ public void add(String type, double[] yvalues) { int iShape = toShape(type); if (iShape==-1) addErrorBars(yvalues); else if (iShape==-2) addHorizontalErrorBars(yvalues); else addPoints(null, Tools.toFloat(yvalues), null, iShape, iShape==CUSTOM?type.substring(5, type.length()):null); }
/** Adds a curve, set of points or error bars to this plot, where 'type' is * "line", "connected circle", "filled", "bar", "separated bar", "circle", "box", * "triangle", "diamond", "cross", "x", "dot", "error bars" or "xerror bars". */ public void add(String type, double[] yvalues) { int iShape = toShape(type); if (iShape==-1) addErrorBars(yvalues); else if (iShape==-2) addHorizontalErrorBars(yvalues); else addPoints(null, Tools.toFloat(yvalues), null, iShape, iShape==CUSTOM?type.substring(5, type.length()):null); }
double addToPlot(Plot currentPlot) { String shape = getFirstString(); int what = Plot.toShape(shape); boolean errorBars = false; double[] x = getNextArray();
double addToPlot(Plot currentPlot) { String shape = getFirstString(); int what = Plot.toShape(shape); boolean errorBars = false; double[] x = getNextArray();
/** For "Add from Table" and "Add from Arrays" adds item to the plot according to the current Choice settings * and sets the Style fields for it. */ private void addObjectFromTable() { float[][] data = getDataArrays(); if (data[1] == null) return; //no y data? then can't plot String label = columnChoice[1].getSelectedItem(); //take label from y int shape = Plot.toShape(symbolChoice.getSelectedItem()); float lineWidth = (float)(Tools.parseDouble(widthField.getText())); if (lineWidth > 0) plot.setLineWidth(lineWidth); plot.restorePlotObjects(); if (savedLimits != null) plot.setLimits(savedLimits); plot.setColor(colorField.getText(), color2Field.getText()); plot.addPoints(data[0], data[1], data[3], shape, label); if (data[2] != null) plot.addHorizontalErrorBars(data[2]); if (creatingPlot) { plot.setXYLabels(data[0]==null ? "x" : columnChoice[0].getSelectedItem(), columnChoice[1].getSelectedItem()); plot.setLimitsToFit(false); } else plot.fitRangeToLastPlotObject(); currentObjectIndex = plot.getNumPlotObjects()-1; setDialogStyleFields(currentObjectIndex); if (dialogType == ADD_FROM_TABLE) previousTableName = allTableNames[tableChoice.getSelectedIndex()]; }
/** For "Add from Table" and "Add from Arrays" adds item to the plot according to the current Choice settings * and sets the Style fields for it. */ private void addObjectFromTable() { float[][] data = getDataArrays(); if (data[1] == null) return; //no y data? then can't plot String label = columnChoice[1].getSelectedItem(); //take label from y int shape = Plot.toShape(symbolChoice.getSelectedItem()); float lineWidth = (float)(Tools.parseDouble(widthField.getText())); if (lineWidth > 0) plot.setLineWidth(lineWidth); plot.restorePlotObjects(); if (savedLimits != null) plot.setLimits(savedLimits); plot.setColor(colorField.getText(), color2Field.getText()); plot.addPoints(data[0], data[1], data[3], shape, label); if (data[2] != null) plot.addHorizontalErrorBars(data[2]); if (creatingPlot) { plot.setXYLabels(data[0]==null ? "x" : columnChoice[0].getSelectedItem(), columnChoice[1].getSelectedItem()); plot.setLimitsToFit(false); } else plot.fitRangeToLastPlotObject(); currentObjectIndex = plot.getNumPlotObjects()-1; setDialogStyleFields(currentObjectIndex); if (dialogType == ADD_FROM_TABLE) previousTableName = allTableNames[tableChoice.getSelectedIndex()]; }