Java Code Examples for org.jfree.chart.axis.ValueAxis#setAutoRange()
The following examples show how to use
org.jfree.chart.axis.ValueAxis#setAutoRange() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolarPlot.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * 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); } } } }
Example 2
Source File: ChartUtils.java From PDV with GNU General Public License v3.0 | 6 votes |
/** * Set XY color * @param plot XY plot */ private static void setYAixs(XYPlot plot) { Color lineColor = new Color(192, 208, 224); ValueAxis axis = plot.getRangeAxis(); axis.setAxisLinePaint(lineColor); axis.setTickMarkPaint(lineColor); axis.setAutoRange(true); axis.setAxisLineVisible(false); axis.setTickMarksVisible(false); plot.setRangeGridlinePaint(new Color(192, 192, 192)); plot.setRangeGridlineStroke(new BasicStroke(1)); plot.getRangeAxis().setUpperMargin(0.1); plot.getRangeAxis().setLowerMargin(0.1); }
Example 3
Source File: PolarPlot.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * 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); } } } }
Example 4
Source File: PolarPlot.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * 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); } } } }
Example 5
Source File: PolarPlot.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * 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); } } } }
Example 6
Source File: PolarPlot.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * 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); } } } }
Example 7
Source File: DefaultValueAxisEditor.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * 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); }
Example 8
Source File: DefaultValueAxisEditor.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * 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); }
Example 9
Source File: MetadataPlotPanel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
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); }
Example 10
Source File: MetadataPlotPanel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
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; }
Example 11
Source File: TimeSeriesGraphModel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
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); }
Example 12
Source File: ExcitationPanel.java From opensim-gui with Apache License 2.0 | 5 votes |
public void axisChanged(AxisChangeEvent event) { Axis axis = event.getAxis(); if (axis instanceof ValueAxis) { ValueAxis va = (ValueAxis)axis; if (va.isAutoRange()) { va.setAutoRange(false); va.setRangeWithMargins(new Range(renderer.getControl().getDefaultParameterMin(), renderer.getControl().getDefaultParameterMax()));; } } }
Example 13
Source File: DefaultValueAxisEditor.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 14
Source File: GraphPanel.java From swift-k with Apache License 2.0 | 5 votes |
private void updateMaxRange() { ValueAxis x = chart.getXYPlot().getDomainAxis(); if (maxRange == 0) { x.setAutoRange(true); } else { Range dr = chart.getXYPlot().getDataRange(x); x.setRange(Math.max(dr.getLowerBound(), dr.getUpperBound() - maxRange * 60 * 1000), dr.getUpperBound()); } }
Example 15
Source File: DefaultValueAxisEditor.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * 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); }
Example 16
Source File: DefaultValueAxisEditor.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * 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); }
Example 17
Source File: DefaultValueAxisEditor.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * 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); }
Example 18
Source File: TileCacheMonitor.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
/** * Creates a new monitor panel. * * @return the monitor panel */ public JPanel createPanel() { JPanel mainPanel = new JPanel(new BorderLayout()); CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time")); this.datasets = new TimeSeriesCollection[4]; this.datasets[0] = addSubPlot(plot, "#Tiles"); this.datasets[1] = addSubPlot(plot, "#Hits"); this.datasets[2] = addSubPlot(plot, "#Misses"); this.datasets[3] = addSubPlot(plot, "Mem (kB)"); JFreeChart chart = new JFreeChart(plot); LegendTitle legend = (LegendTitle) chart.getSubtitle(0); legend.setPosition(RectangleEdge.RIGHT); legend.setMargin(new RectangleInsets(UnitType.ABSOLUTE, 0, 4, 0, 4)); chart.setBorderPaint(Color.black); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4)); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(60000.0); // 60 seconds textarea = new JTextArea(); tableModel = new TileCacheTableModel(); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 470)); chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tabbedPane = new JTabbedPane(); tabbedPane.add(CACHE_INFO_TAB, new JScrollPane(textarea)); tabbedPane.add(CACHE_CHART_TAB, chartPanel); tabbedPane.add(IMAGES_TAB, new JScrollPane(new JTable(tableModel))); tabbedPane.setSelectedIndex(0); mainPanel.add(tabbedPane); return mainPanel; }
Example 19
Source File: GraphView.java From High-Frequency-Data-Order-Book-Analyser with GNU General Public License v2.0 | 4 votes |
private JFreeChart createChart(final XYDataset dataset) { final JFreeChart result = ChartFactory.createTimeSeriesChart( graphTitle, "Time", "Price", dataset, true, true, false ); plot = result.getXYPlot(); plot.setBackgroundPaint(new Color(0xffffe0)); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.lightGray); ValueAxis xaxis = plot.getDomainAxis(); xaxis.setAutoRange(true); xaxis.setVisible(false); xaxis.setFixedAutoRange(16000.0); // 60 seconds xaxis.setVerticalTickLabels(true); ValueAxis yaxis = plot.getRangeAxis(); yaxis.setRange(0, 100.0); xaxis2 = new NumberAxis("Volume"); plot.setDataset(1, dataset2); plot.setRangeAxis(1, xaxis2); plot.mapDatasetToRangeAxis(1, 1); XYBarRenderer renderer2 = new XYBarRenderer(0.20); renderer2.setToolTipGenerator( new StandardXYToolTipGenerator( StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0,000.00") ) ); renderer2.setToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); plot.setRenderer(1, renderer2); plot.setDataset(2, dataset3); plot.mapDatasetToRangeAxis(2, 0); XYErrorRenderer renderer3 = new XYErrorRenderer(); plot.setRenderer(2, renderer3); plot.setDataset(3, dataset4); plot.mapDatasetToRangeAxis(3, 1); XYBarRenderer renderer4 = new XYBarRenderer(0.20); plot.setRenderer(3, renderer4); return result; }
Example 20
Source File: XYBarChartExpression.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
protected void configureChart( final JFreeChart chart ) { super.configureChart( chart ); final XYPlot xypl = chart.getXYPlot(); final XYItemRenderer renderer = xypl.getRenderer(); final XYBarRenderer br = (XYBarRenderer) renderer; br.setDrawBarOutline( isChartSectionOutline() ); if ( margin != null ) { br.setMargin( margin.doubleValue() ); } br.setShadowVisible( shadowVisible ); br.setShadowXOffset( shadowXOffset ); br.setShadowYOffset( shadowYOffset ); if ( ( isStacked() ) && renderPercentages && ( br instanceof StackedXYBarRenderer ) ) { final StackedXYBarRenderer sbr = (StackedXYBarRenderer) br; sbr.setRenderAsPercentages( true ); final ValueAxis rangeAxis = xypl.getRangeAxis(); final int level = getRuntime().getProcessingContext().getCompatibilityLevel(); if ( ClassicEngineBoot.isEnforceCompatibilityFor( level, 3, 8 ) ) { if ( getRangeMinimum() != 0 ) { rangeAxis.setLowerBound( getRangeMinimum() ); } if ( getRangeMaximum() != 1 ) { rangeAxis.setUpperBound( getRangeMaximum() ); } if ( getRangeMinimum() == 0 && getRangeMaximum() == 0 ) { rangeAxis.setLowerBound( 0 ); rangeAxis.setUpperBound( 1 ); rangeAxis.setAutoRange( true ); } } else { rangeAxis.setLowerBound( getRangeMinimum() ); rangeAxis.setUpperBound( getRangeMaximum() ); rangeAxis.setAutoRange( isRangeAxisAutoRange() ); } } }