Example usage for org.jfree.chart.axis ValueAxis setRange

List of usage examples for org.jfree.chart.axis ValueAxis setRange

Introduction

In this page you can find the example usage for org.jfree.chart.axis ValueAxis setRange.

Prototype

public void setRange(double lower, double upper) 

Source Link

Document

Sets the range for the axis and sends a change event to all registered listeners.

Usage

From source file:net.bioclipse.jasper.charCustomizers.DoseResponseChartCustomizer.java

@Override
public void customize(JFreeChart chart, JRChart jasperchart) {
    ValueAxis domainAxis = new LogarithmicAxis("Concentration");
    ValueAxis rangeAxis = new NumberAxis("SI%");
    domainAxis.setTickLabelFont(small);/*w w w.  j ava  2s  .  c om*/
    rangeAxis.setTickLabelFont(small);
    domainAxis.setLabelFont(normalsize);
    rangeAxis.setLabelFont(normalsize);
    rangeAxis.setRange(0, 110);
    chart.getXYPlot().setDomainAxis(domainAxis);
    chart.getXYPlot().setRangeAxis(rangeAxis);
    chart.getXYPlot().setDomainGridlinesVisible(false);
    chart.getXYPlot().getRenderer().setSeriesShape(0, new Ellipse2D.Double(-1, -1, 2, 2));
}

From source file:peakmlviewer.dialog.timeseries.EditableChart.java

public EditableChart(Composite parent, int style) {
    super(parent, SWT.EMBEDDED | style);

    setLayout(new FillLayout());

    // create the components
    linechart = ChartFactory.createLineChart(null, "", "Intensity", dataset, PlotOrientation.VERTICAL, false, // legend
            false, // tooltips
            false // urls
    );/*  www .  ja v  a  2  s .com*/

    CategoryPlot plot = (CategoryPlot) linechart.getPlot();
    ValueAxis yaxis = plot.getRangeAxis();
    yaxis.setRange(0, 1);
    CategoryAxis xaxis = (CategoryAxis) plot.getDomainAxis();
    xaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();

    renderer.setSeriesShapesFilled(0, true);
    renderer.setSeriesShapesVisible(0, true);

    linechart.setBackgroundPaint(Color.WHITE);
    linechart.setBorderVisible(false);
    linechart.setAntiAlias(true);

    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinesVisible(true);

    // add the components
    // --------------------------------------------------------------------------------
    // This uses the SWT-trick for embedding awt-controls in an SWT-Composit.
    try {
        System.setProperty("sun.awt.noerasebackground", "true");
    } catch (NoSuchMethodError error) {
        ;
    }

    java.awt.Frame frame = org.eclipse.swt.awt.SWT_AWT.new_Frame(this);

    // create a few ChartPanel, without the popup-menu (5x false)
    panel = new ChartPanel(linechart, false, false, false, false, false);

    panel.addMouseListener(this);
    panel.addMouseMotionListener(this);
    panel.setRangeZoomable(false);
    panel.setDomainZoomable(false);

    frame.add(panel);
    // --------------------------------------------------------------------------------
}

From source file:jfreeechart.DynamicDataDemo.java

/**
 * Creates a sample chart.// w w  w  . jav 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 w  w  w.  j  av a 2s.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:com.sonyericsson.jenkins.plugins.bfa.graphs.TimeSeriesUnkownFailuresChart.java

@Override
protected JFreeChart createGraph() {
    TimeTableXYDataset dataset = createDataset();

    ValueAxis xAxis = new DateAxis();
    xAxis.setLowerMargin(0.0);/* ww  w . ja v  a2s. c o  m*/
    xAxis.setUpperMargin(0.0);

    Calendar lowerBound = getLowerGraphBound();
    xAxis.setRange(lowerBound.getTimeInMillis(), Calendar.getInstance().getTimeInMillis());

    NumberAxis yAxis = new NumberAxis(Y_AXIS_LABEL);
    yAxis.setRange(0, HUNDRED_PERCENT);

    XYItemRenderer renderer = new XYBarRenderer();

    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);

    JFreeChart chart = new JFreeChart(graphTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    chart.removeLegend();

    return chart;
}

From source file:vincent.DynamicDataDemo.java

/**
 * Creates a sample chart.//from  w  w  w . j  a  v a  2  s  . com
 * 
 * @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:mls.FramePlot.java

private JFreeChart createChartVarianza(final XYDataset datasetVarianza) {
    final JFreeChart result = ChartFactory.createXYLineChart("Varianza campionaria", "n", "vc", datasetVarianza,
            PlotOrientation.VERTICAL, false, true, false);
    final XYPlot plot = result.getXYPlot();
    ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(true);//from w  w  w. jav a 2s.  c o  m
    axis.setFixedAutoRange(1500);

    axis = plot.getRangeAxis();
    axis.setAutoRange(true);
    axis.setRange(10, 100);
    plot.getRenderer().setSeriesPaint(0, Color.MAGENTA);
    return result;
}

From source file:playground.dgrether.analysis.charts.DgModalSplitDiffQuantilesChart.java

public JFreeChart createChart() {
    CategoryAxis categoryAxis = this.axisBuilder.createCategoryAxis(xLabel);
    categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45);
    ValueAxis valueAxis = this.axisBuilder.createValueAxis(yLabel);
    //RANGE//www.jav  a  2 s.co m
    //      valueAxis.setRange(-50.0, 50.0); //test
    valueAxis.setRange(-20.0, 20.0); //zh
    DgColorScheme colorScheme = new DgColorScheme();

    CategoryPlot plot = new CategoryPlot();
    plot.setDomainAxis(categoryAxis);
    //      plot.setDomainAxisLocation(AxisLocation.TOP_OR_RIGHT);
    plot.setRangeAxis(valueAxis);
    plot.setDataset(0, this.dataset);
    //      plot.setDomainGridlinePosition(CategoryAnchor.END);
    //      plot.setDomainGridlinesVisible(true);
    BarRenderer carRenderer = new BarRenderer();
    carRenderer.setSeriesPaint(0, colorScheme.COLOR1A);
    carRenderer.setSeriesPaint(1, colorScheme.COLOR3A);
    carRenderer.setSeriesItemLabelGenerator(0, this.labelgenerator);
    carRenderer.setSeriesItemLabelGenerator(1, this.labelgenerator);
    Font labelFont = new Font("Helvetica", Font.BOLD, 14);
    carRenderer.setSeriesItemLabelFont(0, labelFont);
    carRenderer.setSeriesItemLabelFont(1, labelFont);
    carRenderer.setSeriesItemLabelsVisible(0, true);
    carRenderer.setSeriesItemLabelsVisible(1, true);

    carRenderer.setItemMargin(0.15);
    plot.setRenderer(0, carRenderer);

    JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    chart.setBackgroundPaint(ChartColor.WHITE);
    chart.removeLegend();
    //      chart.getLegend().setItemFont(this.axisBuilder.getAxisFont());
    return chart;
}

From source file:sim.app.sugarscape.Charts.java

JFreeChart createAgeHistoChart() {
    JFreeChart chart = ChartFactory.createHistogram("Age Distribution", "Age", "Count", model.age_hist_dataset,
            PlotOrientation.VERTICAL, true, true, false);
    model.age_histo_chart = chart;/*w ww  .j a va2s  .c o m*/

    //CategoryDataset dataset1 = createDataset1();
    NumberAxis rangeAxis1 = new NumberAxis("Age");
    rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    org.jfree.chart.axis.NumberAxis domainAxis = new NumberAxis("Bins");
    XYPlot plot = chart.getXYPlot();
    ValueAxis xAxis = plot.getDomainAxis();
    xAxis.setRange(0, 100);
    XYItemRenderer renderer1 = plot.getRenderer();
    renderer1.setSeriesPaint(0, Color.MAGENTA);
    return chart;
}

From source file:DynamiskDemo2.java

/**
 * Creates a sample chart.//from ww  w. j  a v a  2 s. co m
 * 
 * @param dataset  the dataset.
 * 
 * @return A sample chart.
 */
private JFreeChart createChart(final XYDataset dataset) {
    final JFreeChart result = ChartFactory.createXYLineChart("Dynamic Data Demo", "Time", "Value", dataset,
            PlotOrientation.VERTICAL, 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.5, 1.5);
    return result;
}