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

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

Introduction

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

Prototype

public abstract void configure();

Source Link

Document

Configures the axis to work with the current plot.

Usage

From source file:ChartUsingJava.CombinedCategoryPlot.java

/**
 * Adds a new subplot with the specified weight.
 *
 * @param subplot  the subplot./*from  w  w  w.  j a  v  a2 s.c  o  m*/
 * @param weight  the weight for the subplot.
 */
public void add(CategoryPlot subplot, int weight) {
    super.add(subplot, weight);

    ValueAxis l_range = super.getRangeAxis();
    subplot.setRangeAxis(0, l_range, false);

    super.setRangeAxis(l_range);
    if (null == l_range) {
        return;
    }

    l_range.configure();
}

From source file:ChartUsingJava.CombinedXYPlot.java

/**
 * Adds a new subplot with the specified weight.
 *
 * @param subplot  the subplot./*from   ww w . j a  v  a  2s .  c o  m*/
 * @param weight  the weight for the subplot.
 */
public void add(XYPlot subplot, int weight) {
    super.add(subplot, weight);

    ValueAxis l_range = super.getRangeAxis();
    subplot.setRangeAxis(0, l_range, false);

    super.setRangeAxis(l_range);
    if (null == l_range) {
        return;
    }

    l_range.configure();
}

From source file:ChartUsingJava.CombinedXYPlot.java

/**
 * Sets the range axis that is shared by all the subplots.
 *
 * @param axis  the axis./*from w  w w. j a v a  2s  .  c om*/
 */
public void setRangeAxis(ValueAxis axis) {
    Iterator l_itr = getSubplots().iterator();
    while (l_itr.hasNext()) {
        XYPlot l_subplot = (XYPlot) l_itr.next();
        l_subplot.setRangeAxis(0, axis, false);
    }

    super.setRangeAxis(axis);
    if (null == axis) {
        return;
    }

    axis.configure();
}

From source file:ChartUsingJava.CombinedCategoryPlot.java

/**
 * Sets the range axis that is shared by all the subplots.
 *
 * @param axis  the axis.//from www  .  j  a  v a2s  . c o  m
 */
public void setRangeAxis(ValueAxis axis) {
    Iterator l_itr = getSubplots().iterator();
    while (l_itr.hasNext()) {
        CategoryPlot l_subplot = (CategoryPlot) l_itr.next();
        l_subplot.setRangeAxis(0, axis, false);
    }

    super.setRangeAxis(axis);
    if (null == axis) {
        return;
    }

    axis.configure();
}

From source file:org.esa.beam.timeseries.ui.graph.TimeSeriesGraphModel.java

@Override
public void addTimeSeries(List<TimeSeries> timeSeriesList, TimeSeriesType type) {
    final int timeSeriesCount;
    final int collectionOffset;
    if (TimeSeriesType.INSITU.equals(type)) {
        timeSeriesCount = displayAxisMapping.getInsituCount();
        collectionOffset = INSITU_COLLECTION_INDEX_OFFSET;
    } else {// w ww.  ja  va2 s  .  c om
        timeSeriesCount = displayAxisMapping.getRasterCount();
        if (TimeSeriesType.CURSOR.equals(type)) {
            collectionOffset = CURSOR_COLLECTION_INDEX_OFFSET;
        } else {
            collectionOffset = PIN_COLLECTION_INDEX_OFFSET;
        }
    }
    final String[] aliasNames = getAliasNames();

    for (int aliasIdx = 0; aliasIdx < aliasNames.length; aliasIdx++) {
        final int targetCollectionIndex = collectionOffset + aliasIdx * 3;
        final TimeSeriesCollection targetTimeSeriesCollection = (TimeSeriesCollection) timeSeriesPlot
                .getDataset(targetCollectionIndex);
        if (targetTimeSeriesCollection != null) {
            targetTimeSeriesCollection.removeAllSeries();
        }
    }
    if (timeSeriesCount == 0) {
        return;
    }
    final int numPositions = timeSeriesList.size() / timeSeriesCount;
    int timeSeriesIndexOffset = 0;
    for (int posIdx = 0; posIdx < numPositions; posIdx++) {
        final Shape posShape = getShapeForPosition(type, posIdx);
        for (int aliasIdx = 0; aliasIdx < aliasNames.length; aliasIdx++) {
            final int targetCollectionIndex = collectionOffset + aliasIdx * 3;
            final TimeSeriesCollection targetTimeSeriesCollection = (TimeSeriesCollection) timeSeriesPlot
                    .getDataset(targetCollectionIndex);
            if (targetTimeSeriesCollection == null) {
                continue;
            }
            final XYItemRenderer renderer = timeSeriesPlot.getRenderer(targetCollectionIndex);
            final int dataSourceCount = getDataSourceCount(type, aliasNames[aliasIdx]);
            for (int ignoredIndex = 0; ignoredIndex < dataSourceCount; ignoredIndex++) {
                final TimeSeries currentTimeSeries = timeSeriesList.get(timeSeriesIndexOffset);
                targetTimeSeriesCollection.addSeries(currentTimeSeries);
                final int timeSeriesTargetIdx = targetTimeSeriesCollection.getSeriesCount() - 1;
                renderer.setSeriesShape(timeSeriesTargetIdx, posShape);
                renderer.setSeriesPaint(timeSeriesTargetIdx,
                        renderer.getSeriesPaint(timeSeriesTargetIdx % dataSourceCount));
                renderer.setSeriesVisibleInLegend(timeSeriesTargetIdx, !currentTimeSeries.isEmpty());
                timeSeriesIndexOffset++;
            }
            final ValueAxis axisForDataset = timeSeriesPlot.getDomainAxisForDataset(targetCollectionIndex);
            axisForDataset.configure();
        }
    }
    updateAnnotation(getCurrentView().getRaster());
}

From source file:org.lmn.fc.frameworks.starbase.plugins.observatory.ui.tabs.charts.ChartHelper.java

/***********************************************************************************************
 * Handle Autorange for Linear mode.// w  w w. ja va2 s .  c o  m
 * When not autoranging, use the specified limits for the Y axis.
 *
 * @param jfreechart
 * @param channelselector
 * @param canautorange
 * @param fixedrangelowery
 * @param fixedrangeuppery
 * @param debug
 */

public static void handleAutorangeForLinearMode(final JFreeChart jfreechart,
        final ChannelSelectorUIComponentInterface channelselector, final boolean canautorange,
        final double fixedrangelowery, final double fixedrangeuppery, final boolean debug) {
    final String SOURCE = "ChartHelper.handleAutorangeForLinearMode() ";

    if ((jfreechart != null) && (channelselector != null)) {
        final XYPlot plot;
        final ValueAxis axisLinear;

        channelselector.debugSelector(debug, SOURCE);

        plot = jfreechart.getXYPlot();

        axisLinear = plot.getRangeAxis();

        if ((canautorange) && (channelselector.isAutoranging())) {
            LOGGER.debug(debug, SOURCE + "Linear Mode: Set up Autoranging");

            axisLinear.setAutoRange(true);
            axisLinear.configure();
        } else {
            LOGGER.debug(debug, SOURCE + "Linear Mode: Set up Fixed Range [y.lower=" + fixedrangelowery
                    + "] [y.upper=" + fixedrangeuppery + "]");

            axisLinear.setRange(fixedrangelowery, fixedrangeuppery);
        }
    }
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Configures the range axes./* www .j  av a2s .c o  m*/
 */
public void configureRangeAxes() {
    for (int i = 0; i < this.rangeAxes.size(); i++) {
        ValueAxis axis = (ValueAxis) this.rangeAxes.get(i);
        if (axis != null) {
            axis.configure();
        }
    }
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Configures the domain axes./*from   ww w. ja  v a2 s  .  c  o m*/
 */
public void configureDomainAxes() {
    for (int i = 0; i < this.domainAxes.size(); i++) {
        ValueAxis axis = (ValueAxis) this.domainAxes.get(i);
        if (axis != null) {
            axis.configure();
        }
    }
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Sets a range axis and, if requested, sends a {@link PlotChangeEvent} to
 * all registered listeners./*from  w  w  w  . j  ava  2  s  .  c  om*/
 *
 * @param index  the axis index.
 * @param axis  the axis (<code>null</code> permitted).
 * @param notify and notify the listeners
 */
public void setRangeAxis(int index, ValueAxis axis, boolean notify) {
    ValueAxis existing = getRangeAxis(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    if (axis != null) {
        axis.setPlot(this);
    }
    this.rangeAxes.set(index, axis);
    if (axis != null) {
        axis.configure();
        axis.addChangeListener(this);
    }
    if (notify) {
        notifyListeners(new PlotChangeEvent(this));
    }
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Sets a domain axis and, if requested, sends a {@link PlotChangeEvent} to
 * all registered listeners.//from   www. j a  va  2  s. co m
 *
 * @param index  the axis index.
 * @param axis  the axis.
 * @param notify  notify listeners?
 */
public void setDomainAxis(int index, ValueAxis axis, boolean notify) {
    ValueAxis existing = getDomainAxis(index);
    if (existing != null) {
        existing.removeChangeListener(this);
    }
    if (axis != null) {
        axis.setPlot(this);
    }
    this.domainAxes.set(index, axis);
    if (axis != null) {
        axis.configure();
        axis.addChangeListener(this);
    }
    if (notify) {
        notifyListeners(new PlotChangeEvent(this));
    }
}