• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RelativeDateFormat类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jfree.chart.util.RelativeDateFormat的典型用法代码示例。如果您正苦于以下问题:Java RelativeDateFormat类的具体用法?Java RelativeDateFormat怎么用?Java RelativeDateFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RelativeDateFormat类属于org.jfree.chart.util包,在下文中一共展示了RelativeDateFormat类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: test2033092

import org.jfree.chart.util.RelativeDateFormat; //导入依赖的package包/类
/**
 * Test that we can configure the RelativeDateFormat to show
 * hh:mm:ss.
 */
public void test2033092() {
    RelativeDateFormat rdf = new RelativeDateFormat();
    rdf.setShowZeroDays(false);
    rdf.setShowZeroHours(false);
    rdf.setMinuteSuffix(":");
    rdf.setHourSuffix(":");
    rdf.setSecondSuffix("");
    DecimalFormat hoursFormatter = new DecimalFormat();
    hoursFormatter.setMaximumFractionDigits(0);
    hoursFormatter.setMaximumIntegerDigits(2);
    hoursFormatter.setMinimumIntegerDigits(2);
    rdf.setHourFormatter(hoursFormatter);
    DecimalFormat minsFormatter = new DecimalFormat();
    minsFormatter.setMaximumFractionDigits(0);
    minsFormatter.setMaximumIntegerDigits(2);
    minsFormatter.setMinimumIntegerDigits(2);
    rdf.setMinuteFormatter(minsFormatter);
    DecimalFormat secondsFormatter = new DecimalFormat();
    secondsFormatter.setMaximumFractionDigits(0);
    secondsFormatter.setMaximumIntegerDigits(2);
    secondsFormatter.setMinimumIntegerDigits(2);
    rdf.setSecondFormatter(secondsFormatter);
    String s = rdf.format(new Date(2 * 60L * 60L * 1000L + 122500L));
    assertEquals("02:02:02", s);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:30,代码来源:RelativeDateFormatTests.java


示例2: setRelativeAxis

import org.jfree.chart.util.RelativeDateFormat; //导入依赖的package包/类
/**
 * Sets the X axis to display time relative to the given start time.
 */
// for relative time, format the x axis differently
// the data _does not_ change
public static void setRelativeAxis(JFreeChart chart, long startTime) {
    if (chart != null) {
        RelativeDateFormat format = new RelativeDateFormat(startTime);
        // : separators
        format.setHourSuffix(":");
        format.setMinuteSuffix(":");
        format.setSecondSuffix("");

        // zero pad minutes and seconds
        DecimalFormat padded = new DecimalFormat("00");
        format.setMinuteFormatter(padded);
        format.setSecondFormatter(padded);

        XYPlot plot = chart.getXYPlot();

        ((DateAxis) plot.getDomainAxis()).setDateFormatOverride(format);
    }
}
 
开发者ID:nmonvisualizer,项目名称:nmonvisualizer,代码行数:24,代码来源:LineChartBuilder.java


示例3: testHashCode

import org.jfree.chart.util.RelativeDateFormat; //导入依赖的package包/类
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashCode() {
    RelativeDateFormat df1 = new RelativeDateFormat(123L);
    RelativeDateFormat df2 = new RelativeDateFormat(123L);
    assertTrue(df1.equals(df2));
    int h1 = df1.hashCode();
    int h2 = df2.hashCode();
    assertEquals(h1, h2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:RelativeDateFormatTests.java


示例4: testHashCode

import org.jfree.chart.util.RelativeDateFormat; //导入依赖的package包/类
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashCode() {
    RelativeDateFormat df1 = new RelativeDateFormat(123L);
    RelativeDateFormat df2 = new RelativeDateFormat(123L);
    assertTrue(df1.equals(df2));
    int h1 = df1.hashCode();
    int h2 = df2.hashCode();
    assertEquals(h1, h2);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:RelativeDateFormatTests.java


示例5: testNegative

import org.jfree.chart.util.RelativeDateFormat; //导入依赖的package包/类
/**
 * Some tests for negative dates.
 */
public void testNegative() {
    NumberFormat nf = new DecimalFormat("0");
    RelativeDateFormat df1 = new RelativeDateFormat();
    df1.setSecondFormatter(nf);
    assertEquals("-0h0m1s", df1.format(new Date(-1000L)));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:RelativeDateFormatTests.java


示例6: createYAxisRenderer

import org.jfree.chart.util.RelativeDateFormat; //导入依赖的package包/类
private static ValueAxis createYAxisRenderer(ViewMode vm, String label) {
	switch (vm) {
	case BY_DISTANCE:
		return new NumberAxis(label);
	case BY_DURATION:
		DateAxis domainAxis = new DateAxis(label);
		domainAxis.setDateFormatOverride(new RelativeDateFormat());
		return domainAxis;
	default:
		throw new IllegalStateException("Unknown mode " + vm); //$NON-NLS-1$
	}
}
 
开发者ID:pfichtner,项目名称:jrunalyzer,代码行数:13,代码来源:MapProfilePlugin.java


示例7: createChart

import org.jfree.chart.util.RelativeDateFormat; //导入依赖的package包/类
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;
}
 
开发者ID:project-flink,项目名称:flink-perf,代码行数:31,代码来源:KafkaFT.java


示例8: createChartPanel

import org.jfree.chart.util.RelativeDateFormat; //导入依赖的package包/类
private void createChartPanel(String title, long time) {
	YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
	chart = ChartFactory.createTimeSeriesChart(title, X_AXIS_TITLE, "",
			dataset, true, true, true);
	XYPlot plot = (XYPlot) chart.getPlot();

	DeviationRenderer errorRenderer = new DeviationRenderer();
	errorRenderer.setShapesVisible(false);
	errorRenderer.setLinesVisible(true);
	errorRenderer.setAlpha(0.0f);
	// errorRenderer.setDrawYError(false);
	// errorRenderer.setDrawXError(false);
	plot.setRenderer(errorRenderer);

	plot.setBackgroundPaint(Color.WHITE);
	plot.setRangeGridlinePaint(Color.DARK_GRAY);
	plot.setDomainGridlinePaint(Color.DARK_GRAY);
	upperDomainBound = (time / 1000) + ((interval - 1) * step / 1000);
	DateAxis domain = (DateAxis) plot.getDomainAxis();
	domain.setAutoRange(false);
	domain.setRange((time / 1000), upperDomainBound);
	RelativeDateFormat rdf = new RelativeDateFormat();
	rdf.setHourSuffix(":");
	rdf.setMinuteSuffix(":");
	rdf.setSecondSuffix("");
	rdf.setSecondFormatter(new DecimalFormat("0"));
	domain.setDateFormatOverride(rdf);
	plot.setDomainAxis(domain);
	plotPanel = new ChartPanel(chart, true);
	setSizeOfComponent(plotPanel, new Dimension(plotWidth, plotHeight));
	container.add(plotPanel, BorderLayout.CENTER);
	container.add(createRadioBoxes(visType == VisualizationType.Metric),
			BorderLayout.SOUTH);
	setSizeOfComponent(container, new Dimension(plotWidth, plotHeight
			+ boxOffset));
}
 
开发者ID:flyroom,项目名称:PeerfactSimKOM_Clone,代码行数:37,代码来源:MetricsPlot.java


示例9: testEquals

import org.jfree.chart.util.RelativeDateFormat; //导入依赖的package包/类
/**
 * Check that the equals() method can distinguish all fields.
 */
public void testEquals() {
    RelativeDateFormat df1 = new RelativeDateFormat();
    RelativeDateFormat df2 = new RelativeDateFormat();
    assertEquals(df1, df2);
    
    df1.setBaseMillis(123L);
    assertFalse(df1.equals(df2));
    df2.setBaseMillis(123L);
    assertTrue(df1.equals(df2));
    
    df1.setDaySuffix("D");
    assertFalse(df1.equals(df2));
    df2.setDaySuffix("D");
    assertTrue(df1.equals(df2));
    
    df1.setHourSuffix("H");
    assertFalse(df1.equals(df2));
    df2.setHourSuffix("H");
    assertTrue(df1.equals(df2));
    
    df1.setMinuteSuffix("M");
    assertFalse(df1.equals(df2));
    df2.setMinuteSuffix("M");
    assertTrue(df1.equals(df2));
    
    df1.setSecondSuffix("S");
    assertFalse(df1.equals(df2));
    df2.setSecondSuffix("S");
    assertTrue(df1.equals(df2));
    
    df1.setShowZeroDays(!df1.getShowZeroDays()); 
    assertFalse(df1.equals(df2));
    df2.setShowZeroDays(!df2.getShowZeroDays()); 
    assertTrue(df1.equals(df2));
    
    df1.setSecondFormatter(new DecimalFormat("0.0"));
    assertFalse(df1.equals(df2));
    df2.setSecondFormatter(new DecimalFormat("0.0"));
    assertTrue(df1.equals(df2));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:44,代码来源:RelativeDateFormatTests.java


示例10: testFormat

import org.jfree.chart.util.RelativeDateFormat; //导入依赖的package包/类
/**
 * Some checks for the formatting.
 */
public void testFormat() {
    RelativeDateFormat rdf = new RelativeDateFormat();
    String s = rdf.format(new Date(2 * 60L * 60L * 1000L + 122500L));
    assertEquals("2h2m2.500s", s);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:9,代码来源:RelativeDateFormatTests.java


示例11: testEquals

import org.jfree.chart.util.RelativeDateFormat; //导入依赖的package包/类
/**
 * Check that the equals() method can distinguish all fields.
 */
public void testEquals() {
    RelativeDateFormat df1 = new RelativeDateFormat();
    RelativeDateFormat df2 = new RelativeDateFormat();
    assertEquals(df1, df2);

    df1.setBaseMillis(123L);
    assertFalse(df1.equals(df2));
    df2.setBaseMillis(123L);
    assertTrue(df1.equals(df2));

    df1.setDayFormatter(new DecimalFormat("0%"));
    assertFalse(df1.equals(df2));
    df2.setDayFormatter(new DecimalFormat("0%"));
    assertTrue(df1.equals(df2));

    df1.setDaySuffix("D");
    assertFalse(df1.equals(df2));
    df2.setDaySuffix("D");
    assertTrue(df1.equals(df2));

    df1.setHourFormatter(new DecimalFormat("0%"));
    assertFalse(df1.equals(df2));
    df2.setHourFormatter(new DecimalFormat("0%"));
    assertTrue(df1.equals(df2));

    df1.setHourSuffix("H");
    assertFalse(df1.equals(df2));
    df2.setHourSuffix("H");
    assertTrue(df1.equals(df2));

    df1.setMinuteFormatter(new DecimalFormat("0%"));
    assertFalse(df1.equals(df2));
    df2.setMinuteFormatter(new DecimalFormat("0%"));
    assertTrue(df1.equals(df2));

    df1.setMinuteSuffix("M");
    assertFalse(df1.equals(df2));
    df2.setMinuteSuffix("M");
    assertTrue(df1.equals(df2));

    df1.setSecondSuffix("S");
    assertFalse(df1.equals(df2));
    df2.setSecondSuffix("S");
    assertTrue(df1.equals(df2));

    df1.setShowZeroDays(!df1.getShowZeroDays());
    assertFalse(df1.equals(df2));
    df2.setShowZeroDays(!df2.getShowZeroDays());
    assertTrue(df1.equals(df2));

    df1.setSecondFormatter(new DecimalFormat("0.0"));
    assertFalse(df1.equals(df2));
    df2.setSecondFormatter(new DecimalFormat("0.0"));
    assertTrue(df1.equals(df2));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:59,代码来源:RelativeDateFormatTests.java



注:本文中的org.jfree.chart.util.RelativeDateFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ChildChannelStateEvent类代码示例发布时间:2022-05-23
下一篇:
Java JavaPlatform类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap