Example usage for org.jfree.data Range Range

List of usage examples for org.jfree.data Range Range

Introduction

In this page you can find the example usage for org.jfree.data Range Range.

Prototype

public Range(double lower, double upper) 

Source Link

Document

Creates a new range.

Usage

From source file:org.eumetsat.metop.visat.MhsInfoView.java

@Override
protected void configureSpectrumPlotYAxis(NumberAxis axis) {
    super.configureSpectrumPlotYAxis(axis);
    axis.setRange(new Range(0.0, 50.0), true, false);
}

From source file:org.perfmon4j.visualvm.chart.DynamicTimeSeriesChart.java

public DynamicTimeSeriesChart(int maxAgeInSeconds) {
    super(new BorderLayout());
    this.maxAgeInSeconds = maxAgeInSeconds;

    dataset = new TimeSeriesCollection();
    renderer = new MyXYRenderer();
    renderer.setBaseStroke(NORMAL_STROKE);

    NumberAxis numberAxis = new NumberAxis();
    numberAxis.setAutoRange(false);// w  w w.j a v  a 2  s . c  o m
    numberAxis.setRange(new Range(0d, 100d));

    DateAxis dateAxis = new DateAxis();
    dateAxis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));
    dateAxis.setAutoRange(true);
    dateAxis.setFixedAutoRange(maxAgeInSeconds * 1000);
    dateAxis.setTickUnit(new DateTickUnit(DateTickUnitType.SECOND, 30));

    XYPlot plot = new XYPlot(dataset, dateAxis, numberAxis, renderer);
    JFreeChart chart = new JFreeChart(null, null, plot, false);
    chart.setBackgroundPaint(Color.white);

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setDomainZoomable(false);
    chartPanel.setRangeZoomable(false);
    chartPanel.setPopupMenu(null);

    chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1),
            BorderFactory.createLineBorder(Color.black)));

    add(chartPanel);
}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.link_and_brush.axis.CustomSymbolAxis.java

@Override
public void resizeRange2(double percent, double anchorValue) {
    if (percent > 0.0) {
        double left = anchorValue - getLowerBound();
        double right = getUpperBound() - anchorValue;
        Range adjusted = new Range(anchorValue - left * percent, anchorValue + right * percent);
        setRange(adjusted);/*from  w w w . j  av  a  2s  . co m*/
    } else {
        setRange(new Range(lowerBoundCache, upperBoundCache));
    }
}

From source file:org.adempiere.webui.apps.graph.jfreegraph.PerformanceGraphBuilder.java

public JFreeChart createIndicatorChart(IndicatorModel model) {
    JFreeChart chart = null;/*from   ww w.  j  a  va2s .c  o m*/
    DefaultValueDataset data = new DefaultValueDataset((float) model.goalModel.getPercent());
    MeterPlot plot = new MeterPlot(data);

    MColorSchema colorSchema = model.goalModel.getColorSchema();
    int rangeLo = 0;
    int rangeHi = 0;
    Point2D start = new Point2D.Float(0, 0);
    Point2D end = new Point2D.Float(50, 50);
    float[] dist = { 0.0f, 0.2f, 0.45f, 0.75f, 1.0f };
    for (int i = 1; i <= 4; i++) {
        switch (i) {
        case 1:
            rangeHi = colorSchema.getMark1Percent();
            break;
        case 2:
            rangeHi = colorSchema.getMark2Percent();
            break;
        case 3:
            rangeHi = colorSchema.getMark3Percent();
            break;
        case 4:
            rangeHi = colorSchema.getMark4Percent();
            break;
        }
        if (rangeHi == 9999)
            rangeHi = (int) Math.floor(rangeLo * 1.5);
        if (rangeLo < rangeHi) {
            Color[] colors = { colorSchema.getColor(rangeHi).brighter().brighter(),
                    colorSchema.getColor(rangeHi).brighter(), colorSchema.getColor(rangeHi),
                    colorSchema.getColor(rangeHi).darker(), colorSchema.getColor(rangeHi).darker().darker() };
            LinearGradientPaint p = new LinearGradientPaint(start, end, dist, colors);

            plot.addInterval(new MeterInterval("Normal", //label
                    new Range(rangeLo, rangeHi), //range
                    p, new BasicStroke(7.0f), model.dialBackground));
            rangeLo = rangeHi;
        }
    }
    plot.setRange(new Range(0, rangeLo));
    plot.setDialBackgroundPaint(model.dialBackground);
    plot.setUnits("");
    plot.setDialShape(DialShape.CHORD);
    plot.setNeedlePaint(model.needleColor);
    plot.setTickSize(2000);
    plot.setTickLabelFont(new Font("SansSerif", Font.BOLD, 8));
    plot.setValueFont(new Font("SansSerif", Font.BOLD, 8));
    plot.setNoDataMessageFont(new Font("SansSerif", Font.BOLD, 8));
    plot.setTickLabelPaint(model.tickColor);
    plot.setValuePaint(new Color(0.0f, 0.0f, 0.0f, 0.0f));
    plot.setTickPaint(model.tickColor);
    //
    chart = new JFreeChart("", new Font("SansSerif", Font.BOLD, 9), plot, false);

    return chart;
}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.link_and_brush.axis.CustomDateAxis.java

@Override
public Range restoreAutoRange(boolean zoomOut) {
    if (upperBoundCache < lowerBoundCache) {
        upperBoundCache = lowerBoundCache + 1;
    }/*from   w w w  .  j a va2  s.  co  m*/
    Range autoRange = new Range(lowerBoundCache, upperBoundCache);
    if (zoomOut) {
        setRange(autoRange);
    }
    return new Range(lowerBoundWithoutMargin, upperBoundWithoutMargin);
}

From source file:org.eumetsat.metop.visat.AmsuInfoView.java

@Override
protected void configureSpectrumPlotXAxis(NumberAxis axis) {
    super.configureSpectrumPlotXAxis(axis);
    axis.setRange(new Range(0.5, CHANNEL_FREQUENCIES.length + 0.5), true, false);
}

From source file:org.jfree.data.RangeTest.java

/**
 * Two objects that are equal are required to return the same hashCode.
 *//*  ww  w.j  av a  2 s . com*/
@Test
public void testHashCode() {
    Range a1 = new Range(1.0, 100.0);
    Range a2 = new Range(1.0, 100.0);
    assertEquals(a1.hashCode(), a2.hashCode());

    a1 = new Range(-100.0, 2.0);
    a2 = new Range(-100.0, 2.0);
    assertEquals(a1.hashCode(), a2.hashCode());
}

From source file:com.epiq.bitshark.ui.TimeDomainPanel.java

public TimeDomainPanel() {
    initComponents();//from  ww w.j  a va  2  s.c o  m

    initGraph();

    JPanel holderPanel = new JPanel() {
        @Override
        public void paint(Graphics g) {

            if (plot.getDomainAxis().isAutoRange()) {
                plot.getDomainAxis().setAutoRange(false);
                Range newDomain = new Range(0, FMCUartClient.BLOCK_SIZE - 1);
                plot.getDomainAxis().setRange(newDomain, true, false);
            }

            if (plot.getRangeAxis().isAutoRange()) {
                plot.getRangeAxis().setAutoRange(false);
            }

            // ensureAxisMargin( ) ?

            Range newRange = null;
            Range currentRangeRange = plot.getRangeAxis().getRange();
            double extent = currentRangeRange.getUpperBound() - currentRangeRange.getLowerBound();
            newRange = new Range(-(extent) / 2, (extent) / 2);
            plot.getRangeAxis().setRange(newRange, true, false);

            super.paint(g);
        }
    };
    holderPanel.setLayout(new BorderLayout());
    holderPanel.add(chartPanel, BorderLayout.CENTER);
    mainPanel.add(holderPanel, BorderLayout.CENTER);

    headerPanel.setBackgroundPainter(Common.getHeaderPainter());

    titleLabel.setUI(new BasicLabelUI());

    showICheckBox.setFocusPainted(false);
    showQCheckBox.setFocusPainted(false);
}

From source file:org.gvsig.remotesensing.scatterplot.chart.ScatterPlotChart.java

/**
 *  Metodo que devuelve el Rango de la seleccion en el eje y.
 * *//*from   w  w w.  j a v  a2s . c om*/
public Range getRangeY(double lowerPercent, double upperPercent, PlotRenderingInfo info, Point2D source) {
    double start = super.getRangeAxis().getRange().getLowerBound();
    double length = super.getRangeAxis().getRange().getLength();
    Range adjusted = null;
    if (super.getRangeAxis().isInverted()) {
        adjusted = new Range(start + (length * (1 - upperPercent)), start + (length * (1 - lowerPercent)));
    } else {
        adjusted = new Range(start + length * lowerPercent, start + length * upperPercent);
    }
    return adjusted;
}

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.link_and_brush.axis.CustomDateAxis.java

@Override
public void setLowerBound(double min) {
    if (getRange().getUpperBound() > min) {
        this.lowerBoundCache = min;
        setRange(new Range(min, getRange().getUpperBound()));
    } else {/* ww w  . java 2s  .com*/
        this.lowerBoundCache = min + 1.0;
        setRange(new Range(min, min + 1.0));
    }
}