List of usage examples for org.jfree.chart.plot XYPlot getRangeAxis
public ValueAxis getRangeAxis()
From source file:neuronspike.NetPlot.java
public void plotSpikes(List<GenericNeuron> spikeList) { XYPlot xyPlot = chart.getXYPlot(); ValueAxis domain = xyPlot.getDomainAxis(); domain.setRange(Math.max(cursor - cutoffInterval, 0), Math.max(cursor, cutoffInterval)); domain = xyPlot.getRangeAxis(); domain.setRange(-1, limit_y);//w w w .jav a 2s. c om for (int i = 0; i < spikeList.size(); i++) { addPoint(cursor, spikeList.get(i).getLocation()[1]); } cursor++; // Remove too old points while (!spikes.isEmpty() && spikes.getDataItem(0).getX().doubleValue() < cursor - cutoffInterval) spikes.remove(0); }
From source file:com.android.ddmuilib.log.event.DisplaySyncPerf.java
/** * Resets the display./*from w w w .j a va 2 s . c o m*/ */ @Override void resetUI() { super.resetUI(); XYPlot xyPlot = mChart.getXYPlot(); xyPlot.getRangeAxis().setVisible(false); mTooltipGenerator = new CustomXYToolTipGenerator(); @SuppressWarnings("unchecked") List<String>[] mTooltipsTmp = new List[NUM_SERIES]; mTooltips = mTooltipsTmp; XYBarRenderer br = new XYBarRenderer(); br.setUseYInterval(true); mDatasets = new TimePeriodValues[NUM_SERIES]; TimePeriodValuesCollection tpvc = new YIntervalTimePeriodValuesCollection(1); xyPlot.setDataset(tpvc); xyPlot.setRenderer(br); for (int i = 0; i < NUM_SERIES; i++) { br.setSeriesPaint(i, SERIES_COLORS[i]); mDatasets[i] = new TimePeriodValues(SERIES_NAMES[i]); tpvc.addSeries(mDatasets[i]); mTooltips[i] = new ArrayList<String>(); mTooltipGenerator.addToolTipSeries(mTooltips[i]); br.setSeriesToolTipGenerator(i, mTooltipGenerator); } }
From source file:com.att.aro.ui.view.diagnostictab.CreateBarPlot.java
/** * Returns a XYPlot /*from w w w .j a v a2s .c om*/ * * @return XYPlot. */ //createWakelockStatePlot color is yellow, other is gray, createAlarmPlot need to set numberAxis, create usereventplot //createBurstPlot(),createRrcPlot() public XYPlot drawXYBarPlot(Color color, boolean setAxis) { // Create renderer XYBarRenderer barRenderer = new XYBarRenderer(); barRenderer.setDrawBarOutline(false); barRenderer.setUseYInterval(true); barRenderer.setBasePaint(color); barRenderer.setAutoPopulateSeriesPaint(false); barRenderer.setShadowVisible(false); barRenderer.setGradientPaintTransformer(null); barRenderer.setBarPainter(new StandardXYBarPainter()); NumberAxis axis = new NumberAxis(); if (setAxis) { axis.setVisible(false); axis.setAutoRange(false); axis.setRange(0, 1); } // Create result plot XYPlot barPlot = new XYPlot(null, null, axis, barRenderer); barPlot.getRangeAxis().setVisible(false); return barPlot; }
From source file:org.squale.squaleweb.util.graph.AreaMaker.java
/** * @return le diagramme JFreeChart/*ww w. j a v a2s .co m*/ */ protected JFreeChart getChart() { JFreeChart retChart = super.getChart(); if (null == retChart) { retChart = ChartFactory.createXYAreaChart(mTitle, mXLabel, mYLabel, mDataSet, PlotOrientation.VERTICAL, false, false, false); final XYPlot plot = retChart.getXYPlot(); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setNumberFormatOverride(new DecimalFormat("########0.0")); // rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); // Format de l'axe des dates final ValueAxis domainAxis = new DateAxis(mXLabel); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); ((DateAxis) domainAxis).setDateFormatOverride(mDateFormat); plot.setDomainAxis(domainAxis); super.setChart(retChart); } return retChart; }
From source file:edu.gmu.cs.sim.util.media.chart.XYChartGenerator.java
public void setYAxisRange(double lower, double upper) { XYPlot xyplot = (XYPlot) (chart.getPlot()); xyplot.getRangeAxis().setRange(lower, upper); }
From source file:org.jgrasstools.gears.utils.chart.Scatter.java
public void setYRange(double min, double max) { XYPlot plot = (XYPlot) getChart().getPlot(); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setRange(min, max);//from ww w .j a v a 2 s. com }
From source file:edu.gmu.cs.sim.util.media.chart.XYChartGenerator.java
/** Sets the name of the Y Axis label. */ public void setYAxisLabel(String val) { XYPlot xyplot = (XYPlot) (chart.getPlot()); xyplot.getRangeAxis().setLabel(val); xyplot.axisChanged(new AxisChangeEvent(xyplot.getRangeAxis())); yLabel.setValue(val); }
From source file:org.encog.workbench.dialogs.training.ChartPane.java
/** * Create the initial chart.// ww w. j av a 2 s . c o m * @return The chart. */ private JFreeChart createChart() { this.chart = ChartFactory.createXYLineChart(null, "Iteration", "Current Error", this.dataset1, PlotOrientation.VERTICAL, true, true, false); final XYPlot plot = (XYPlot) this.chart.getPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.getRangeAxis().setFixedDimension(15.0); // AXIS 2 final NumberAxis axis2 = new NumberAxis("Error Improvement"); axis2.setFixedDimension(10.0); axis2.setAutoRangeIncludesZero(false); axis2.setLabelPaint(Color.red); axis2.setTickLabelPaint(Color.red); plot.setRangeAxis(1, axis2); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(1, this.dataset2); plot.mapDatasetToRangeAxis(1, 1); final XYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setSeriesPaint(0, Color.red); plot.setRenderer(1, renderer2); ChartUtilities.applyCurrentTheme(this.chart); return this.chart; }
From source file:D1WaveletTransform.java
@Test public void test() throws InterruptedException, JWaveException { CategoryTableXYDataset serie = new CategoryTableXYDataset(); serie.setNotify(false);//w w w . j av a 2 s. com double step = 1.0 / discretization; double startPosition = step * framePosition; //100 ? - 100 , 50 ? - 50 , 25 ?- 25 WaveletTransform t = new FastWaveletTransform((new Haar1())); double[] data = t.forward(testData.get1DSimpleSignal(1, 3, frameWidth, discretization), 128); // double[] data = math.convolve(testData.get1DSignal(100, 200, frameWidth, discretization), math.lpf(70, step, 128)); // double[] data = math.convolve(testData.get1DSignal(100, 200, 32768, 10000), math.lpf(70, 1./10000, 32)); // double[] data = testData.get1DSignal(100, 200, frameWidth, discretization); // double[] data = math.lpf(70, step,128); for (int i = 0; i < data.length; i++) { serie.add(startPosition, data[i], ""); startPosition += step; } JFreeChart chart = ChartFactory.createXYLineChart("", "t,c", "wave", serie); chart.removeLegend(); chart.setAntiAlias(false); XYPlot plot = chart.getXYPlot(); //plot.setRangeGridlinePaint(Color.BLACK); org.jfree.chart.axis.ValueAxis yAxis = plot.getRangeAxis(); org.jfree.chart.axis.ValueAxis xAxis = plot.getDomainAxis(); double start = framePosition * 1.0 / discretization; double max = start + frameWidth * 1.0 / discretization; xAxis.setRange(start, max); ChartPanel chartPanel = new ChartPanel(chart); JPanel p = new JPanel(new BorderLayout()); p.removeAll(); p.add(chartPanel); p.validate(); //1. Create the frame. JFrame frame = new JFrame("FrameDemo"); //2. Optional: What happens when the frame closes? frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //3. Create components and put them in the frame. //...create emptyLabel... frame.getContentPane().add(new Label("olol"), BorderLayout.CENTER); frame.getContentPane().add(p, BorderLayout.CENTER); //4. Size the frame. frame.pack(); //5. Show it. frame.setVisible(true); }
From source file:com.intel.stl.ui.main.view.HealthHistoryView.java
public void setDataset(final IntervalXYDataset dataset) { JFreeChart chart = ComponentFactory.createStepAreaChart(dataset, new XYItemLabelGenerator() { @Override/*from www . ja v a 2 s . c o m*/ public String generateLabel(XYDataset dataset, int series, int item) { Number val = dataset.getY(series, item); return UIConstants.INTEGER.format(val.intValue()); } }); chart.addProgressListener(new ChartProgressListener() { @Override public void chartProgress(ChartProgressEvent event) { if (event.getType() == ChartProgressEvent.DRAWING_STARTED && currentValue != null) { currentValue.setText(scoreString); currentValue.setPaint(scoreColor); currentValue.setToolTipText(scoreTip); } } }); XYPlot plot = chart.getXYPlot(); plot.getRangeAxis().setRange(0, 105); plot.getRenderer().setSeriesPaint(0, UIConstants.INTEL_BLUE); currentValue = new TextTitle(scoreString, scoreFont); currentValue.setPaint(scoreColor); currentValue.setToolTipText(scoreTip); // currentValue.setBackgroundPaint(new Color(255, 255, 255, 128)); currentValue.setPosition(RectangleEdge.BOTTOM); XYTitleAnnotation xytitleannotation = new XYTitleAnnotation(0.49999999999999998D, 0.49999999999999998D, currentValue, RectangleAnchor.CENTER); // xytitleannotation.setMaxWidth(0.47999999999999998D); plot.addAnnotation(xytitleannotation); chartPanel.setChart(chart); }