Java Code Examples for org.jfree.data.time.Minute#getFirstMillisecond()

The following examples show how to use org.jfree.data.time.Minute#getFirstMillisecond() . 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: MinuteTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Minute m = new Minute(59, 15, 1, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-623289660000L, m.getFirstMillisecond(c));

    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
 
Example 2
Source File: MinuteTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Minute m = new Minute(40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955766400000L, m.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
 
Example 3
Source File: MinuteTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Minute m = new Minute(59, 15, 1, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-623289660000L, m.getFirstMillisecond(c));
    
    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
 
Example 4
Source File: MinuteTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Minute m = new Minute(40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));        
    assertEquals(955766400000L, m.getFirstMillisecond(calendar));
    
    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
 
Example 5
Source File: KafkaFT.java    From flink-perf with Apache License 2.0 5 votes vote down vote up
private static JFreeChart createChart(XYDataset xydataset) {
	JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Flink Exactly-Once on Kafka with YARN Chaos Monkey", "Date", "Value", xydataset, true, true, false);
	XYPlot xyplot = (XYPlot) jfreechart.getPlot();

	XYLineAndShapeRenderer r0 = (XYLineAndShapeRenderer) xyplot.getRenderer(0);

	// draw data points as points
	r0.setSeriesShapesVisible(2, true);
	r0.setSeriesLinesVisible(2, true);
	// order elements as assed
	xyplot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);

	DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();

	Number first = xydataset.getX(0, 0);
	Minute minute = new Minute(new Date((Long)first));
	System.out.println("first = "+first);
	RelativeDateFormat relativedateformat = new RelativeDateFormat(minute.getFirstMillisecond());
	relativedateformat.setSecondFormatter(new DecimalFormat("00"));
	dateaxis.setDateFormatOverride(relativedateformat);


	//dateaxis.setDateFormatOverride(new SimpleDateFormat("mm:ss"));
	ValueAxis valueaxis = xyplot.getRangeAxis();
	valueaxis.setAutoRangeMinimumSize(1.0D);
	valueaxis.setLabel("Elements/Core");

	xyplot.getRenderer().setSeriesPaint(2, ChartColor.DARK_MAGENTA);
	return jfreechart;
}