Java Code Examples for org.jfree.chart.axis.DateAxis#setMinimumDate()

The following examples show how to use org.jfree.chart.axis.DateAxis#setMinimumDate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DateAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test that the setMaximumDate() method works.
 */
public void testSetMaximumDate() {
    DateAxis axis = new DateAxis("Test Axis");
    Date date = new Date();
    axis.setMaximumDate(date);
    assertEquals(date, axis.getMaximumDate());

    // check that setting the max date to something on or before the
    // current min date works...
    Date d1 = new Date();
    Date d2 = new Date(d1.getTime() + 1);
    Date d0 = new Date(d1.getTime() - 1);
    axis.setMaximumDate(d2);
    axis.setMinimumDate(d1);
    axis.setMaximumDate(d1);
    assertEquals(d0, axis.getMinimumDate());
}
 
Example 2
Source File: DateAxisTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Test that the setMaximumDate() method works.
 */
public void testSetMaximumDate() {
    DateAxis axis = new DateAxis("Test Axis");
    Date date = new Date();
    axis.setMaximumDate(date);
    assertEquals(date, axis.getMaximumDate());

    // check that setting the max date to something on or before the 
    // current min date works...
    Date d1 = new Date();
    Date d2 = new Date(d1.getTime() + 1);
    Date d0 = new Date(d1.getTime() - 1);
    axis.setMaximumDate(d2);
    axis.setMinimumDate(d1);
    axis.setMaximumDate(d1);
    assertEquals(d0, axis.getMinimumDate());
}
 
Example 3
Source File: DateAxisTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test that the setMinimumDate() method works.
 */
public void testSetMinimumDate() {
    DateAxis axis = new DateAxis("Test Axis");
    Date d1 = new Date();
    Date d2 = new Date(d1.getTime() + 1);
    axis.setMaximumDate(d2);
    axis.setMinimumDate(d1);
    assertEquals(d1, axis.getMinimumDate());

    // check that setting the min date to something on or after the
    // current min date works...
    Date d3 = new Date(d2.getTime() + 1);
    axis.setMinimumDate(d2);
    assertEquals(d3, axis.getMaximumDate());
}
 
Example 4
Source File: DateAxisTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test that the setMinimumDate() method works.
 */
public void testSetMinimumDate() {
    DateAxis axis = new DateAxis("Test Axis");
    Date d1 = new Date();
    Date d2 = new Date(d1.getTime() + 1);
    axis.setMaximumDate(d2);
    axis.setMinimumDate(d1);
    assertEquals(d1, axis.getMinimumDate());
    
    // check that setting the min date to something on or after the 
    // current min date works...
    Date d3 = new Date(d2.getTime() + 1);
    axis.setMinimumDate(d2);
    assertEquals(d3, axis.getMaximumDate());
}
 
Example 5
Source File: PannableTimeChartPanel.java    From jsonde with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public PannableTimeChartPanel(long startTime, long endTime, TimeSeriesCollection dataset) {

        double interval = ((endTime - startTime) / (30000.));

        JFreeChart chart = ChartFactory.createXYLineChart(
                "Memory Telemtry View", "Time",
                "Memory (Mb)", dataset, PlotOrientation.VERTICAL,
                true, true, false
        );

        plot = (XYPlot) chart.getPlot();

        DateAxis domainAxis = new DateAxis();
        plot.setDomainAxis(domainAxis);
        domainAxis.setLabelAngle(Math.PI / 2);
        domainAxis.setAutoRange(true);
        domainAxis.setMinimumDate(new Date(startTime));
        domainAxis.setMaximumDate(new Date(startTime + 30L * 1000L));

        plot.setDomainPannable(true);

        setLayout(new BorderLayout());

        add(new ChartPanel(chart), BorderLayout.CENTER);
        JScrollBar panScrollBar = new JScrollBar(JScrollBar.HORIZONTAL);

        rangeModel = new DefaultBoundedRangeModel();
        rangeModel.setMinimum(0);
        rangeModel.setMaximum((int)((interval - 1) * 100));
        rangeModel.addChangeListener(this);

        panScrollBar.setModel(rangeModel);

        add(panScrollBar, BorderLayout.SOUTH);

    }