final XYPlot plot = result.getXYPlot(); ValueAxis domain = plot.getDomainAxis(); domain.setAutoRange(true); ValueAxis range = plot.getRangeAxis(); range.setRange(-MINMAX, MINMAX);
private void configureDomainAxis(int index, String nameX, int dataType) { ValueAxis axis = createAxis(dataType); axis.setAutoRange(true); axis.setAutoRangeMinimumSize(2); axis.setLabel(nameX); Font axisFont = axis.getLabelFont().deriveFont(Font.BOLD); axis.setLabelFont(axisFont); xyPlot.setDomainAxis(index, axis); }
/** * Sets a flag that determines whether or not the axis range is * automatically adjusted to fit the data, and notifies registered * listeners that the axis has been modified. * * @param auto the new value of the flag. * * @see #isAutoRange() */ public void setAutoRange(boolean auto) { setAutoRange(auto, true); }
private JFreeChart createChart(final XYDataset dataset) { JFreeChart result = ChartFactory.createTimeSeriesChart( null, // No title - it just takes up space Constant.messages.getString("ascan.progress.chart.time"), Constant.messages.getString("ascan.progress.chart.responses"), dataset, true, true, false ); XYPlot plot = result.getXYPlot(); ValueAxis daxis = plot.getDomainAxis(); daxis.setAutoRange(true); daxis.setAutoRangeMinimumSize(60000.0); plot.getRangeAxis().setAutoRangeMinimumSize(20); return result; }
/** * Sets a flag that determines whether or not the axis range is * automatically adjusted to fit the data, and notifies registered * listeners that the axis has been modified. * * @param auto the new value of the flag. * * @see #isAutoRange() */ public void setAutoRange(boolean auto) { setAutoRange(auto, true); }
/** * Zooms the axis ranges by the specified percentage about the anchor point. * * @param percent The amount of the zoom. */ public void zoom(double percent) { if (percent > 0) { // double range = this.domainAxis.getRange().getLength(); // double scaledRange = range * percent; // domainAxis.setAnchoredRange(scaledRange); // range = this.rangeAxis.getRange().getLength(); // scaledRange = range * percent; // rangeAxis.setAnchoredRange(scaledRange); } else { getRangeAxis().setAutoRange(true); getDomainAxis().setAutoRange(true); } }
/** * Zooms the axis ranges by the specified percentage about the anchor point. * * @param percent the amount of the zoom. */ public void zoom(double percent) { if (percent > 0.0) { double radius = getMaxRadius(); double scaledRadius = radius * percent; this.axis.setUpperBound(scaledRadius); getAxis().setAutoRange(false); } else { getAxis().setAutoRange(true); } }
private void finishScalingUpdate(AxisRangeControl axisRangeControl, ValueAxis newAxis, ValueAxis oldAxis) { if (axisRangeControl.isAutoMinMax()) { newAxis.setAutoRange(false); acceptableDeviationDataset.removeAllSeries(); regressionDataset.removeAllSeries(); getPlot().removeAnnotation(r2Annotation); newAxis.setAutoRange(true); axisRangeControl.adjustComponents(newAxis, 3); newAxis.setAutoRange(false); computeRegressionAndAcceptableDeviationData(); } else { newAxis.setAutoRange(false); newAxis.setRange(oldAxis.getRange()); } }
private void finishScalingUpdate(AxisRangeControl axisRangeControl, ValueAxis newAxis, ValueAxis oldAxis) { if (axisRangeControl.isAutoMinMax()) { newAxis.setAutoRange(false); acceptableDeviationDataset.removeAllSeries(); regressionDataset.removeAllSeries(); getPlot().removeAnnotation(r2Annotation); newAxis.setAutoRange(true); axisRangeControl.adjustComponents(newAxis, 3); newAxis.setAutoRange(false); computeRegressionAndAcceptableDeviationData(); } else { newAxis.setAutoRange(false); newAxis.setRange(oldAxis.getRange()); } }
/** * Zooms the axis ranges by the specified percentage about the anchor point. * * @param percent the amount of the zoom. */ @Override public void zoom(double percent) { for (int axisIdx = 0; axisIdx < getAxisCount(); axisIdx++) { final ValueAxis axis = getAxis(axisIdx); if (axis != null) { if (percent > 0.0) { double radius = axis.getUpperBound(); double scaledRadius = radius * percent; axis.setUpperBound(scaledRadius); axis.setAutoRange(false); } else { axis.setAutoRange(true); } } } }
private void updateDataSet(AggregatedDataSet dataSet) { plot.getDomainAxis().setAutoRange(true); plot.getRangeAxis().setAutoRange(true); plot.setDataset(dataSet); Double horizontalUpperBound = plot.getDomainAxis().getRange().getUpperBound(); mainHorizontalSlider.setMaximum(horizontalUpperBound.intValue()); mainHorizontalSlider.setValue(0); mainHorizontalSlider.setValue((int) dataSet.getAutoScaleValue()); Double verticalUpperBound = plot.getRangeAxis().getRange().getUpperBound(); verticalSlider.setMaximum(verticalUpperBound.intValue()); verticalSlider.setValue(0); verticalSlider.setValue(verticalUpperBound.intValue()); } }
private void updateDataSet(AggregatedDataSet dataSet) { plot.getDomainAxis().setAutoRange(true); plot.getRangeAxis().setAutoRange(true); plot.setDataset(dataSet); Double horizontalUpperBound = plot.getDomainAxis().getRange().getUpperBound(); mainHorizontalSlider.setMaximum(horizontalUpperBound.intValue()); mainHorizontalSlider.setValue(0); mainHorizontalSlider.setValue((int) dataSet.getAutoScaleValue()); Double verticalUpperBound = plot.getRangeAxis().getRange().getUpperBound(); verticalSlider.setMaximum(verticalUpperBound.intValue()); verticalSlider.setValue(0); verticalSlider.setValue(verticalUpperBound.intValue()); } }
/** * Invoke this method when the selection of what to show changes * @param b */ private void setShowingSpecificData(boolean b) { showingSpecificCacheData = b; comboBoxCache.setEnabled(showingSpecificCacheData); cumulativeDataPanel.setVisible(showingSpecificCacheData); if(b) { plot.getRangeAxis().setAutoRange(true); changeChartTitle("title" + comboBoxCache.getSelectedItem().toString()); } else { plot.getRangeAxis().setRange(new Range(0, 1)); plot.getRangeAxis().setAutoRange(false); changeChartTitle("titleHitRatio"); } clearChart(); }
private ValueAxis configureRangeIndex(int index, int dataType) { ValueAxis axis = createAxis(dataType); axis.setAutoRange(true); Font axisFont = axis.getLabelFont().deriveFont(Font.BOLD); axis.setLabelFont(axisFont); axis.setLabel(String.format("Y%d Samples", index + 1)); xyPlot.setRangeAxis(index, axis); xyPlot.setRangeAxisLocation(index, index == 0 ? AxisLocation.BOTTOM_OR_LEFT : AxisLocation.BOTTOM_OR_RIGHT); return axis; }
/** * Sets the properties of the specified axis to match the properties * defined on this panel. * * @param axis the axis. */ @Override public void setAxisProperties(Axis axis) { super.setAxisProperties(axis); ValueAxis valueAxis = (ValueAxis) axis; valueAxis.setAutoRange(this.autoRange); if (!this.autoRange) { valueAxis.setRange(this.minimumValue, this.maximumValue); } valueAxis.setAutoTickUnitSelection(this.autoTickUnitSelection); } }
XYPlot plot = chart.getXYPlot(); final ValueAxis domain = plot.getDomainAxis(); domain.setAutoRange(true); NumberAxis axis = new NumberAxis(); axis.setTickUnit(new NumberTickUnit(100)); ValueAxis range = plot.getRangeAxis(); range.setRange(0, 100);
private void initPlot() { final ValueAxis domainAxis = timeSeriesPlot.getDomainAxis(); domainAxis.setAutoRange(true); XYLineAndShapeRenderer xyRenderer = new XYLineAndShapeRenderer(true, true); xyRenderer.setBaseLegendTextPaint(DEFAULT_FOREGROUND_COLOR); timeSeriesPlot.setRenderer(xyRenderer); timeSeriesPlot.setBackgroundPaint(DEFAULT_BACKGROUND_COLOR); timeSeriesPlot.setNoDataMessage(NO_DATA_MESSAGE); timeSeriesPlot.setDrawingSupplier(null); }
/** * Zooms (in or out) on the plot's value axis. * <p> * If the value 0.0 is passed in as the zoom percent, the auto-range * calculation for the axis is restored (which sets the range to include * the minimum and maximum data values, thus displaying all the data). * * @param percent the zoom amount. */ @Override public void zoom(double percent) { if (percent > 0.0) { double range = getRangeAxis().getRange().getLength(); double scaledRange = range * percent; getRangeAxis().setRange(this.anchorValue - scaledRange / 2.0, this.anchorValue + scaledRange / 2.0); } else { getRangeAxis().setAutoRange(true); } }
private void firstTimeSeries(final XYPlot plot) { final ValueAxis xaxis = plot.getDomainAxis(); xaxis.setAutoRange(true); // Domain axis would show data of 60 seconds for a time xaxis.setFixedAutoRange(60000.0); // 60 seconds xaxis.setVerticalTickLabels(true); final ValueAxis yaxis = plot.getRangeAxis(); yaxis.setRange(0.0, 300.0); final XYItemRenderer renderer = plot.getRenderer(); renderer.setSeriesPaint(0, Color.RED); final NumberAxis yAxis1 = (NumberAxis) plot.getRangeAxis(); yAxis1.setTickLabelPaint(Color.RED); }
@Override public void pixelPosChanged(ImageLayer imageLayer, int pixelX, int pixelY, int currentLevel, boolean pixelPosValid, MouseEvent e) { if (!graphModel.isShowCursorTimeSeries()) { return; } if (pixelPosValid && isVisible() && currentView != null) { final TimeSeriesGraphUpdater.Position position = new TimeSeriesGraphUpdater.Position(pixelX, pixelY, currentLevel); graphModel.updateTimeSeries(position, TimeSeriesType.CURSOR); } final boolean autorange = e.isShiftDown(); final XYPlot xyPlot = chart.getXYPlot(); for (int i = 0; i < xyPlot.getRangeAxisCount(); i++) { xyPlot.getRangeAxis(i).setAutoRange(autorange); } graphModel.updateAnnotation(currentView.getRaster()); }