当前位置: 首页>>代码示例>>Java>>正文


Java DateTickUnitType.MINUTE属性代码示例

本文整理汇总了Java中org.jfree.chart.axis.DateTickUnitType.MINUTE属性的典型用法代码示例。如果您正苦于以下问题:Java DateTickUnitType.MINUTE属性的具体用法?Java DateTickUnitType.MINUTE怎么用?Java DateTickUnitType.MINUTE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.jfree.chart.axis.DateTickUnitType的用法示例。


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

示例1: getTimePeriodUnit

/**
 * Returns the specific org.jfree.chart.axis.DateTickUnit time unit constant
 * related to the String value passed as argument
 * 
 * @param timePeriodUnit - a String represented by one of the following
 * accepted values: ["Year", "Month", "Day", "Hour", "Minute", "Second", "Millisecond"]
 * @return the specific org.jfree.chart.axis.DateTickUnit time unit constant
 */
protected DateTickUnitType getTimePeriodUnit(String timePeriodUnit)
{
	if (timePeriodUnit == null)
		return DateTickUnitType.DAY;
	return timePeriodUnit.equals("Year")
		? DateTickUnitType.YEAR
		: timePeriodUnit.equals("Month")
		? DateTickUnitType.MONTH
		: timePeriodUnit.equals("Hour")
		? DateTickUnitType.HOUR
		: timePeriodUnit.equals("Minute")
		? DateTickUnitType.MINUTE
		: timePeriodUnit.equals("Second")
		? DateTickUnitType.SECOND
		: timePeriodUnit.equals("Millisecond")
		? DateTickUnitType.MILLISECOND
		: DateTickUnitType.DAY;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:26,代码来源:GenericChartTheme.java

示例2: getDateTickUnit

private DateTickUnit getDateTickUnit(final TimeGranularity timeGranularity,
    final long windowMillis) {
  long windowBuckets = timeGranularity.convertToUnit(windowMillis);
  int tickSize = (int) Math.ceil(windowBuckets / (double) NUM_X_TICKS);
  DateTickUnitType unitType;
  switch (timeGranularity.getUnit()) {
  case DAYS:
    unitType = DateTickUnitType.DAY;
    break;
  case HOURS:
    unitType = DateTickUnitType.HOUR;
    break;
  case MILLISECONDS:
    unitType = DateTickUnitType.MILLISECOND;
    break;
  case MINUTES:
    unitType = DateTickUnitType.MINUTE;
    break;
  case SECONDS:
    unitType = DateTickUnitType.SECOND;
    break;
  default:
    throw new IllegalArgumentException(
        "Unsupported time unit granularity: " + timeGranularity.getUnit());
  }
  return new DateTickUnit(unitType, tickSize);
}
 
开发者ID:linkedin,项目名称:pinot,代码行数:27,代码来源:AnomalyGraphGenerator.java

示例3: createChart

private void createChart(UsageDataFrame points, String title) {
    series = new TimeSeries(title);

    for (UsageData d : points.getData()) {
        Date resultdate = d.getDateTime();
        Millisecond msRead = new Millisecond(resultdate);
        int poweredValue = -1;
        if (d.getObjBehavior().equalsIgnoreCase("powered")) {
            poweredValue = d.getObjValue().equalsIgnoreCase("true") ? 1 : 0;
        } else if (d.getObjBehavior().equalsIgnoreCase("brigthness")) {
            try {
                poweredValue = Integer.parseInt(d.getObjValue());
            } catch (NumberFormatException ex) {
                poweredValue = -1;
            }
        }
        series.addOrUpdate(msRead, poweredValue);
    }

    XYDataset xyDataset = new TimeSeriesCollection(series);

    chart = ChartFactory.createTimeSeriesChart("Chart",
            "TIME", "VALUE",
            xyDataset,
            true, // legend
            true, // tooltips
            false // urls
    );
    chart.setAntiAlias(true);
    // Set plot styles
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0));
    // Set series line styles
    plot.setRenderer(new XYStepRenderer());

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setShapesVisible(true);
        renderer.setShapesFilled(true);
    }

    // Set date axis style
    DateAxis axis = (DateAxis) plot.getDomainAxis();

    String formatString = "MM-dd HH";
    DateTickUnitType dtut = DateTickUnitType.HOUR;

    if (jComboGranularity.getSelectedItem().equals("Year")) {
        formatString = "yyyy";
        dtut = DateTickUnitType.YEAR;
    } else if (jComboGranularity.getSelectedItem().equals("Month")) {
        axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM"));
        dtut = DateTickUnitType.MONTH;
    } else if (jComboGranularity.getSelectedItem().equals("Day")) {
        axis.setDateFormatOverride(new SimpleDateFormat("MM-dd"));
        dtut = DateTickUnitType.DAY;
    } else if (jComboGranularity.getSelectedItem().equals("Minute")) {
        formatString = "MM-dd HH:mm";
        dtut = DateTickUnitType.MINUTE;
    } else if (jComboGranularity.getSelectedItem().equals("Second")) {
        formatString = "HH:mm:SS";
        dtut = DateTickUnitType.SECOND;
    }

    DateFormat formatter = new SimpleDateFormat(formatString);
    DateTickUnit unit = new DateTickUnit(dtut, 1, formatter);
    axis.setTickUnit(unit);

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(800, 500));
    graphPanel.removeAll();
    graphPanel.add(chartPanel);

}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:78,代码来源:GraphPanel.java


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