Example usage for org.jfree.chart.axis NumberTickUnit NumberTickUnit

List of usage examples for org.jfree.chart.axis NumberTickUnit NumberTickUnit

Introduction

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

Prototype

public NumberTickUnit(double size, NumberFormat formatter, int minorTickCount) 

Source Link

Document

Creates a new number tick unit.

Usage

From source file:com.bdb.weather.display.axis.RainTickUnitSource.java

public static RainTickUnitSource create() {
    RainTickUnitSource source = new RainTickUnitSource();
    NumberFormat format = Depth.getDefaultFormatter();

    source.add(new NumberTickUnit(0.01, format, 5));
    source.add(new NumberTickUnit(0.1, format, 5));
    source.add(new NumberTickUnit(1, format, 5));
    source.add(new NumberTickUnit(10, format, 5));
    source.add(new NumberTickUnit(100, format, 5));
    source.add(new NumberTickUnit(1000, format, 5));
    source.add(new NumberTickUnit(10000, format, 2));
    source.add(new NumberTickUnit(100000, format, 2));
    source.add(new NumberTickUnit(1000000, format, 2));
    source.add(new NumberTickUnit(10000000, format, 2));
    source.add(new NumberTickUnit(100000000, format, 2));
    source.add(new NumberTickUnit(1000000000, format, 2));
    source.add(new NumberTickUnit(10000000000.0, format, 2));
    source.add(new NumberTickUnit(100000000000.0, format, 2));

    source.add(new NumberTickUnit(0.02, format, 5));
    source.add(new NumberTickUnit(0.05, format, 5));
    source.add(new NumberTickUnit(0.25, format, 5));
    source.add(new NumberTickUnit(2.5, format, 5));
    source.add(new NumberTickUnit(25, format, 5));
    source.add(new NumberTickUnit(250, format, 5));
    source.add(new NumberTickUnit(2500, format, 5));
    source.add(new NumberTickUnit(25000, format, 5));
    source.add(new NumberTickUnit(250000, format, 5));
    source.add(new NumberTickUnit(2500000, format, 5));
    source.add(new NumberTickUnit(25000000, format, 5));
    source.add(new NumberTickUnit(250000000, format, 5));
    source.add(new NumberTickUnit(2500000000.0, format, 5));
    source.add(new NumberTickUnit(25000000000.0, format, 5));
    source.add(new NumberTickUnit(250000000000.0, format, 5));

    source.add(new NumberTickUnit(0.2, format, 5));
    source.add(new NumberTickUnit(0.4, format, 5));
    source.add(new NumberTickUnit(0.5, format, 5));
    source.add(new NumberTickUnit(5L, format, 5));
    source.add(new NumberTickUnit(50L, format, 5));
    source.add(new NumberTickUnit(500L, format, 5));
    source.add(new NumberTickUnit(5000L, format, 5));
    source.add(new NumberTickUnit(50000L, format, 5));
    source.add(new NumberTickUnit(500000L, format, 5));
    source.add(new NumberTickUnit(5000000L, format, 5));
    source.add(new NumberTickUnit(50000000L, format, 5));
    source.add(new NumberTickUnit(500000000L, format, 5));
    source.add(new NumberTickUnit(5000000000L, format, 5));
    source.add(new NumberTickUnit(50000000000L, format, 5));
    source.add(new NumberTickUnit(500000000000L, format, 5));

    return source;
}

From source file:be.ac.ua.comp.scarletnebula.gui.BareGraph.java

/**
 * Constructor.//from ww  w. ja  v  a2 s.c o  m
 * 
 * @param maximumAge
 *            The age after which data is no longer displayed in the graph
 */
public BareGraph(final long maximumAge) {
    super(maximumAge);
    domain.setVisible(false);
    domain.setAutoRange(true);
    domain.setLowerMargin(0.0);
    domain.setUpperMargin(0.0);
    domain.setTickLabelsVisible(true);
    final int secondsBetweenTicks = 30;
    domain.setTickUnit(new DateTickUnit(DateTickUnitType.SECOND, secondsBetweenTicks));

    range.setTickUnit(new NumberTickUnit(0.2, new DecimalFormat(), 5));
    range.setRange(0, 1);
    range.setVisible(false);
}

From source file:be.ac.ua.comp.scarletnebula.gui.DecoratedGraph.java

/**
 * Constructor//  ww  w  .  ja  v a 2 s  . c o  m
 * 
 * @param maximumAge
 *            The age after which data is no longer displayed in the graph
 */
public DecoratedGraph(final long maximumAge, final Datastream stream) {
    super(maximumAge);
    this.stream = stream;
    domain.setVisible(false);
    domain.setAutoRange(true);
    domain.setLowerMargin(0.0);
    domain.setUpperMargin(0.0);
    domain.setTickLabelsVisible(true);
    domain.setTickUnit(new DateTickUnit(DateTickUnitType.SECOND, 30));

    range.setTickUnit(new NumberTickUnit(0.2, new DecimalFormat(), 5));
    range.setAutoRange(true);
    range.setVisible(true);

}

From source file:be.ac.ua.comp.scarletnebula.gui.DecoratedGraph.java

/**
 * @see Graph//from www .j a  v a 2 s .co  m
 */
@Override
public ChartPanel getChartPanel() {
    final XYPlot plot = new XYPlot(dataset, domain, range, renderer);
    plot.setBackgroundPaint(Color.darkGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    // plot.setInsets(new RectangleInsets(0, 0, 0, 0));
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinesVisible(true);

    if (stream.getMax() != null) {
        log.info("Getting chart panel for stream with maximum.");
        range.setAutoRange(false);

        range.setTickUnit(new NumberTickUnit(stream.getMax() / 10, new DecimalFormat(), 1));
        range.setRange(0, stream.getMax());
    } else if (stream.getType() == Type.RELATIVE) {
        range.setAutoRange(false);

        range.setTickUnit(new NumberTickUnit(0.1, new DecimalFormat(), 1));
        range.setRange(0, 1);
    } else {
        double sum = 0;
        final List<TimedDatapoint> datapoints = stream.getRecentlyProcessedDatapoints();

        range.setTickUnit(
                new NumberTickUnit((int) (Utils.max(datapoints).getValue() / 5) + 1, new DecimalFormat(), 1));
    }

    final JFreeChart chart = new JFreeChart(stream.getStreamname(), new Font("SansSerif", Font.PLAIN, 20), plot,
            true);
    chart.setBackgroundPaint(Color.white);
    chart.removeLegend();
    final ChartPanel chartPanel = new ChartPanel(chart);
    // chartPanel.setBorder(BorderFactory
    // .createBevelBorder(BevelBorder.LOWERED));

    return chartPanel;
}

From source file:com.att.aro.ui.model.diagnostic.GraphPanelHelper.java

public GraphPanelHelper() {

    plotOrder.add(ChartPlotOptions.GPS);
    plotOrder.add(ChartPlotOptions.RADIO);
    plotOrder.add(ChartPlotOptions.BLUETOOTH);
    plotOrder.add(ChartPlotOptions.CAMERA);
    plotOrder.add(ChartPlotOptions.SCREEN);
    plotOrder.add(ChartPlotOptions.BATTERY);
    plotOrder.add(ChartPlotOptions.WAKELOCK);
    plotOrder.add(ChartPlotOptions.WIFI);
    plotOrder.add(ChartPlotOptions.ALARM);
    plotOrder.add(ChartPlotOptions.NETWORK_TYPE);
    plotOrder.add(ChartPlotOptions.ATTENUATION);
    plotOrder.add(ChartPlotOptions.SPEED_THROTTLE);
    plotOrder.add(ChartPlotOptions.THROUGHPUT);
    plotOrder.add(ChartPlotOptions.UL_PACKETS);
    plotOrder.add(ChartPlotOptions.DL_PACKETS);
    plotOrder.add(ChartPlotOptions.BURSTS);
    plotOrder.add(ChartPlotOptions.USER_INPUT);
    plotOrder.add(ChartPlotOptions.RRC);
    plotOrder.add(ChartPlotOptions.CPU);
    plotOrder.add(ChartPlotOptions.BUFFER_TIME_OCCUPANCY);
    plotOrder.add(ChartPlotOptions.BUFFER_OCCUPANCY);
    plotOrder.add(ChartPlotOptions.VIDEO_CHUNKS);
    plotOrder.add(ChartPlotOptions.TEMPERATURE);

    tickUnits.add(new NumberTickUnit(FIVE00000, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(TVENTYFIVE0000, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(ONE00000, FORMAT, MINOR_TICK_COUNT_10));

    tickUnits.add(new NumberTickUnit(FIVE0000, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(TVENTYFIVE000, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(ONE0000, FORMAT, MINOR_TICK_COUNT_10));

    tickUnits.add(new NumberTickUnit(FIVE000, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(TVENTYFIVE00, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(ONE000, FORMAT, MINOR_TICK_COUNT_10));

    tickUnits.add(new NumberTickUnit(FIVE00, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(TVENTYFIVE0, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(ONE00, FORMAT, MINOR_TICK_COUNT_10));

    tickUnits.add(new NumberTickUnit(FIVE0, FORMAT, MINOR_TICK_COUNT_10));
    tickUnits.add(new NumberTickUnit(TVENTYFIVE, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(ONE0, FORMAT, MINOR_TICK_COUNT_10));

    tickUnits.add(new NumberTickUnit(FIVE, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(TWO, FORMAT, MINOR_TICK_COUNT_4));
    tickUnits.add(new NumberTickUnit(ONE, FORMAT, MINOR_TICK_COUNT_10));

    tickUnits.add(new NumberTickUnit(POINT5, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(POINT25, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(POINT1, FORMAT, MINOR_TICK_COUNT_10));
    tickUnits.add(new NumberTickUnit(POINT05, FORMAT, MINOR_TICK_COUNT_5));
    tickUnits.add(new NumberTickUnit(POINT01, FORMAT, MINOR_TICK_COUNT_10));

}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static TickUnitSource createLargeNumberTickUnits() {
    TickUnits units = new TickUnits();
    DecimalFormat df0 = new DecimalFormat("0");
    DecimalFormat df1 = new DecimalFormat("#,##0");
    DecimalFormat df2 = new DecimalFormat("0.##E0");
    units.add(new NumberTickUnit(1, df0, 2));
    units.add(new NumberTickUnit(2, df0, 2));
    units.add(new NumberTickUnit(5, df0, 5));
    units.add(new NumberTickUnit(10, df0, 2));
    units.add(new NumberTickUnit(20, df0, 2));
    units.add(new NumberTickUnit(50, df0, 5));
    units.add(new NumberTickUnit(100, df0, 2));
    units.add(new NumberTickUnit(200, df0, 2));
    units.add(new NumberTickUnit(500, df0, 5));
    units.add(new NumberTickUnit(1000, df1, 2));
    units.add(new NumberTickUnit(2000, df1, 2));
    units.add(new NumberTickUnit(5000, df1, 5));
    units.add(new NumberTickUnit(10000, df1, 2));
    units.add(new NumberTickUnit(20000, df1, 2));
    units.add(new NumberTickUnit(50000, df1, 5));
    units.add(new NumberTickUnit(100000, df1, 2));
    units.add(new NumberTickUnit(200000, df1, 2));
    units.add(new NumberTickUnit(500000, df1, 5));
    units.add(new NumberTickUnit(1000000, df2, 2));
    units.add(new NumberTickUnit(2000000, df2, 2));
    units.add(new NumberTickUnit(5000000, df2, 5));
    units.add(new NumberTickUnit(10000000, df2, 2));
    units.add(new NumberTickUnit(20000000, df2, 2));
    units.add(new NumberTickUnit(50000000, df2, 5));
    units.add(new NumberTickUnit(100000000, df2, 2));
    units.add(new NumberTickUnit(200000000, df2, 2));
    units.add(new NumberTickUnit(500000000, df2, 5));
    units.add(new NumberTickUnit(1000000000, df2, 2));
    units.add(new NumberTickUnit(2000000000, df2, 2));
    units.add(new NumberTickUnit(5000000000.0, df2, 5));
    units.add(new NumberTickUnit(10000000000.0, df2, 2));
    return units;
}