Example usage for org.jfree.chart.plot XYPlot getRangeAxis

List of usage examples for org.jfree.chart.plot XYPlot getRangeAxis

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot getRangeAxis.

Prototype

public ValueAxis getRangeAxis() 

Source Link

Document

Returns the range axis for the plot.

Usage

From source file:jfreeechart.DynamicDataDemo.java

/**
 * Creates a sample chart.//from   w ww . j a  v a  2  s.  c  o  m
 * 
 * @param dataset  the dataset.
 * 
 * @return A sample chart.
 */
private JFreeChart createChart(final XYDataset dataset) {
    final JFreeChart result = ChartFactory.createTimeSeriesChart("Dynamic Data Demo", "Time", "Value", dataset,
            true, true, false);
    final XYPlot plot = result.getXYPlot();
    ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);
    axis.setFixedAutoRange(60000.0); // 60 seconds
    axis = plot.getRangeAxis();
    axis.setRange(0.0, 200.0);
    return result;
}

From source file:old.MonitoringChart.java

private JFreeChart createChart(String title, final XYDataset dataset) {
    final JFreeChart result = ChartFactory.createTimeSeriesChart(title, "Time", "Usage in %", dataset, true,
            true, false);//from  ww  w .  ja va2  s.c  o  m
    final XYPlot plot = result.getXYPlot();
    ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);
    axis.setFixedAutoRange(60000.0); // 60 seconds
    axis = plot.getRangeAxis();
    axis.setRange(0.0, 100.0);
    return result;
}

From source file:org.fhcrc.cpl.toolbox.gui.chart.ChartMouseAndMotionListener.java

public ChartMouseAndMotionListener(PanelWithChart panelWithChart) {
    _chartPanel = panelWithChart.getChartPanel();
    XYPlot p = _chartPanel.getChart().getXYPlot();
    domainAxis = (NumberAxis) p.getDomainAxis();
    rangeAxis = (NumberAxis) p.getRangeAxis();
}

From source file:vincent.DynamicDataDemo.java

/**
 * Creates a sample chart.//from   w  ww.  j a va 2 s. co m
 * 
 * @param dataset the dataset.
 * @return A sample chart.
 */
private JFreeChart createChart(final XYDataset dataset) {
    final JFreeChart result = ChartFactory.createTimeSeriesChart("", "Temps", "Temprature", dataset, true,
            true, false);
    final XYPlot plot = result.getXYPlot();
    ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);
    axis.setFixedAutoRange(60000.0); // 60 seconds
    axis = plot.getRangeAxis();
    axis.setRange(10.0, 50.0);// 50C
    return result;
}

From source file:com.charts.IntradayChart.java

public IntradayChart(YStockQuote currentStock) {

    TimeSeries series = new TimeSeries(currentStock.get_name());
    ArrayList<String> fiveDayData = currentStock.get_one_day_data();
    int length = fiveDayData.size();
    for (int i = 17; i < length; i++) {
        String[] data = fiveDayData.get(i).split(",");
        Date time = new Date((long) Integer.parseInt(data[0]) * 1000);
        DateFormat df = new SimpleDateFormat("MM-dd-yyyy-h-m");
        series.addOrUpdate(new Minute(time), Double.parseDouble(data[1]));
    }//  w w  w .  ja v a  2 s  . c  o m
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series);
    JFreeChart chart = ChartFactory.createTimeSeriesChart(
            currentStock.get_name() + "(" + currentStock.get_symbol() + ")" + " Intraday", "Date", "Price",
            dataset, true, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    ValueAxis yAxis = (ValueAxis) plot.getRangeAxis();
    DateAxis xAxis = (DateAxis) plot.getDomainAxis();
    xAxis.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());
    xAxis.setDateFormatOverride(new SimpleDateFormat("h:m a"));
    xAxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    //xAxis.setVerticalTickLabels(true);
    chartPanel = new ChartPanel(chart);
    chart.setBackgroundPaint(chartPanel.getBackground());
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    chartPanel.setVisible(true);
    chartPanel.revalidate();
    chartPanel.repaint();
}

From source file:com.alcatel_lucent.nz.wnmsreport.chart.TimeSeriesChartCustomiser.java

public void customise(JFreeChart chart, JRChart jasperchart) {

    //LineAndShapeRenderer renderer = (LineAndShapeRenderer) chart.getCategoryPlot().getRenderer(); 
    //renderer.setSeriesPaint(1, Color.green); 
    //renderer.setSeriesPaint(4, Color.orange);        

    //chart.setTitle("Customiser has set a new Title"); 

    try {//  w w  w .  j  a  v  a  2  s  .  co  m

        XYPlot plot = chart.getXYPlot();

        NumberAxis x = (NumberAxis) plot.getDomainAxis();
        //x.setLowerBound(x.getLowerBound()+100);
        x.setUpperBound(x.getUpperBound() + 100);

        NumberAxis y = (NumberAxis) plot.getRangeAxis();
        y.setLowerBound(0);
        y.setUpperBound(100);

    } catch (NullPointerException npe) {
        System.err.println("Error setting chart axis ranges :: " + npe);
    }

}

From source file:it.unibo.alchemist.boundary.gui.asmc.SimplePlot.java

@Override
public void batchDone(final double[][] values, final double lower, final double upper, final int sampleSize) {
    this.removeAll();
    final YIntervalSeries series = new YIntervalSeries("Probability of condition satisfaction vs. time");
    for (final double[] value : values) {
        series.add(value[0], value[1], value[2], value[TRE]);
    }//w ww  . ja v a2 s.c o  m
    final YIntervalSeriesCollection data = new YIntervalSeriesCollection();
    data.addSeries(series);
    final JFreeChart chart = ChartFactory.createXYLineChart("", "X", "Y", data, PlotOrientation.VERTICAL, true,
            true, false);
    XYItemRenderer renderer;
    switch (currentRenderer) {
    case 1:
        renderer = new YIntervalRenderer();
        break;
    case 0:
    default:
        renderer = new DeviationRenderer(true, false);
    }
    final XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(renderer);
    plot.getDomainAxis().setLowerBound(lower);
    plot.getDomainAxis().setUpperBound(upper);
    plot.getRangeAxis().setUpperBound(1.0);
    plot.getRangeAxis().setLowerBound(0.0);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(DIMENSION);
    this.setLayout(new BorderLayout());
    this.add(chartPanel, BorderLayout.NORTH);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            chartPanel.getRootPane().validate();
        }
    });
}

From source file:net.relet.freimap.NodeInfo.java

private void sexupLayout(JFreeChart chart) {
    chart.setAntiAlias(true);/*w  w w. j  ava  2  s.  co  m*/
    chart.setBackgroundPaint(VisorFrame.bgcolor);
    chart.setBorderVisible(false);
    TextTitle title = chart.getTitle();
    title.setFont(VisorFrame.smallerfont);
    title.setPaint(VisorFrame.fgcolor);
    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(VisorFrame.bgcolor);
    plot.setDomainAxis(new DateAxis());
    sexupAxis(plot.getDomainAxis());
    sexupAxis(plot.getRangeAxis());
}

From source file:wattsup.jsdk.ui.LineChartPanelSupport.java

/**
 * Sets the axis range.//from  w ww  .j  av a 2s .  c o m
 * 
 * @param lower
 *            The lower axis limit. (must be <= upper bound).
 * @param upper
 *            The upper axis limit. (must be >= lower bound).
 */
protected void setRangeAxisRange(int lower, int upper) {
    XYPlot localXYPlot = (XYPlot) this.getChart().getPlot();
    NumberAxis localNumberAxis = (NumberAxis) localXYPlot.getRangeAxis();
    localNumberAxis.setRange(lower, upper);
}

From source file:net.sourceforge.processdash.ev.ui.chart.AbstractEVXYChart.java

protected void setPlotAxisLabels(XYPlot plot, String xLabel, String yLabel) {

    if (xLabel != null && xLabel.length() != 0)
        plot.getDomainAxis().setLabel(xLabel);

    if (yLabel != null && yLabel.length() != 0)
        plot.getRangeAxis().setLabel(yLabel);
}