/** Enlarges the current minimum and maximum ranges to include the data range of the last plotObject added, * if it is an XY_DATA or ARROWS plotObject. * Does not set the new limits as default, does not redraw the plot. */ void fitRangeToLastPlotObject() { if (allPlotObjects.size() < 1) return; PlotObject plotObject = allPlotObjects.lastElement(); if (Double.isNaN(currentMinMax[0]) || Double.isNaN(currentMinMax[2])) { // no range determined yet? setLimitsToFit(false); } else { //we have min&max already, just extend the range if necessary enlargeRange = new int[currentMinMax.length]; getMinAndMax(currentMinMax, enlargeRange, plotObject, ALL_AXES_RANGE); enlargeRange(currentMinMax); } }
/** Enlarges the current minimum and maximum ranges to include the data range of the last plotObject added, * if it is an XY_DATA or ARROWS plotObject. * Does not set the new limits as default, does not redraw the plot. */ void fitRangeToLastPlotObject() { if (allPlotObjects.size() < 1) return; PlotObject plotObject = allPlotObjects.lastElement(); if (Double.isNaN(currentMinMax[0]) || Double.isNaN(currentMinMax[2])) { // no range determined yet? setLimitsToFit(false); } else { //we have min&max already, just extend the range if necessary enlargeRange = new int[currentMinMax.length]; getMinAndMax(currentMinMax, enlargeRange, plotObject, ALL_AXES_RANGE); enlargeRange(currentMinMax); } }
win.maximize(); } else if (arg.equals("scale")) plot.setLimitsToFit(true);
setLimitsToDefaults(false); else if (arrowIndex == 9) setLimitsToFit(false); else if (arrowIndex <= 13) { int arrPair = arrowIndex - 10;
setLimitsToDefaults(false); else if (arrowIndex == 9) setLimitsToFit(false); else if (arrowIndex <= 13) { int arrPair = arrowIndex - 10;
win.maximize(); } else if (arg.equals("scale")) plot.setLimitsToFit(true);
} else if (name.equals("setLimitsToFit")) { interp.getParens(); currentPlot.setLimitsToFit(true); return Double.NaN; } else if (name.equals("setLogScaleX")) {
} else if (name.equals("setLimitsToFit")) { interp.getParens(); currentPlot.setLimitsToFit(true); return Double.NaN; } else if (name.equals("setLogScaleX")) {
/** 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()]; }
plot.setLimitsToDefaults(true); else if (b==menuItems[FIT_RANGE]) plot.setLimitsToFit(true); else if (b==menuItems[AXIS_OPTIONS]) new PlotDialog(plot, PlotDialog.AXIS_OPTIONS).showDialog(this);
plot.setLimitsToDefaults(true); else if (b==menuItems[FIT_RANGE]) plot.setLimitsToFit(true); else if (b==menuItems[AXIS_OPTIONS]) new PlotDialog(plot, PlotDialog.AXIS_OPTIONS).showDialog(this);