com.ijchart.xychart.tickunit
Class DateTickUnit

java.lang.Object
  extended by com.ijchart.xychart.tickunit.DateTickUnit
All Implemented Interfaces:
INumberTickUnit, java.io.Serializable, java.lang.Cloneable

public class DateTickUnit
extends java.lang.Object
implements INumberTickUnit, java.lang.Cloneable, java.io.Serializable

Title: IJChart

Description: a chart library for the Java(tm) platform.

用于计算日期类型的数据的坐标轴刻度值.

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.
See Also:
Serialized Form

Field Summary
static long ONE_HOUR_MILLSECONDS
          1个小时的毫秒值.
 
Constructor Summary
DateTickUnit(DateTickUnitType unitType)
          构造器.
DateTickUnit(DateTickUnitType unitType, java.text.DateFormat formatter)
          构造器.
 
Method Summary
static DateTickUnitType calculateDateTickUnitType(double minMillis, double maxMillis, int maxCount)
          计算日期值的刻度类型,返回值为类DateTickUnitType定义的常量值.
 java.lang.Object clone()
          Returns a clone of the object.
 boolean equals(java.lang.Object obj)
          测试本对象是否和另一个对象相等.
static java.text.DateFormat getDataFormatter(DateTickUnitType unitType)
          根据日期的类型返回相应的DateFormat.
 java.text.DateFormat getDateFormatter()
          返回格式化日期的类.
 java.lang.String[] getTickUnits(double minValue, double maxValue, int maxCount, boolean includeZero)
          根据最小值和最大值及数据的最大个数来确定坐标轴上的刻度值,刻度值都是整数.
 java.util.TimeZone getTimeZone()
          返回时区.
 DateTickUnitType getUnitType()
          返回日期的单位类型.
 int hashCode()
          覆盖hashCode方法.
 void setDateFormatter(java.text.DateFormat dateFormatter)
          设置格式化日期的类.
 void setTimeZone(java.util.TimeZone timeZone)
          设置时区.
 void setUnitType(DateTickUnitType unitType)
          设置日期的单位类型.
 java.lang.String toString()
          覆盖toString方法.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ONE_HOUR_MILLSECONDS

public static final long ONE_HOUR_MILLSECONDS
1个小时的毫秒值.

See Also:
Constant Field Values
Constructor Detail

DateTickUnit

public DateTickUnit(DateTickUnitType unitType)
构造器.

Parameters:
unitType - DateTickUnitType 日期的单位类型,如果为null,则会自动选择.(可为null).

DateTickUnit

public DateTickUnit(DateTickUnitType unitType,
                    java.text.DateFormat formatter)
构造器.

Parameters:
unitType - DateTickUnitType 日期的单位类型,如果为null,则会自动选择.(可为null).
formatter - DateFormat 格式化日期的类,如果为null,则会自动选择.(不可为null).
Method Detail

getUnitType

public DateTickUnitType getUnitType()
返回日期的单位类型.

Returns:
DateTickUnitType 日期的单位类型 (可为null).

setUnitType

public void setUnitType(DateTickUnitType unitType)
设置日期的单位类型.

Parameters:
unitType - DateTickUnitType 日期的单位类型 (可为null).

getDateFormatter

public java.text.DateFormat getDateFormatter()
返回格式化日期的类.

Returns:
DateFormat 格式化日期的类 (不为null).

setDateFormatter

public void setDateFormatter(java.text.DateFormat dateFormatter)
设置格式化日期的类.

Parameters:
dateFormatter - DateFormat 格式化日期的类 (不为null).

getTimeZone

public java.util.TimeZone getTimeZone()
返回时区.

Returns:
TimeZone 时区.

setTimeZone

public void setTimeZone(java.util.TimeZone timeZone)
设置时区.

Parameters:
timeZone - TimeZone 时区.

getTickUnits

public java.lang.String[] getTickUnits(double minValue,
                                       double maxValue,
                                       int maxCount,
                                       boolean includeZero)
根据最小值和最大值及数据的最大个数来确定坐标轴上的刻度值,刻度值都是整数.

Specified by:
getTickUnits in interface INumberTickUnit
Parameters:
minValue - double 最小值.
maxValue - double 最大值.
maxCount - int 刻度值的最大个数,必须大于0.
includeZero - boolean 布尔值,是否包含0值.此参数没有使用.
Returns:
String[] 刻度值非空数组,且值按由小到大的顺序排列,数组的每个元素都是数字,(不可为null).

calculateDateTickUnitType

public static DateTickUnitType calculateDateTickUnitType(double minMillis,
                                                         double maxMillis,
                                                         int maxCount)
计算日期值的刻度类型,返回值为类DateTickUnitType定义的常量值.

Parameters:
minMillis - double 小值.
maxMillis - double 大值.
maxCount - int 刻度值的最大个数,必须大于0.
Returns:
int 刻度值类型.

getDataFormatter

public static java.text.DateFormat getDataFormatter(DateTickUnitType unitType)
根据日期的类型返回相应的DateFormat.

Parameters:
unitType - DateTickUnitType 日期的刻度类型 (不可为null).
Returns:
DateFormat 格式化日期类.

equals

public boolean equals(java.lang.Object obj)
测试本对象是否和另一个对象相等.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object (null permitted).
Returns:
true or false.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the object.

Overrides:
clone in class java.lang.Object
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - if some component of the axis does not support cloning.

hashCode

public int hashCode()
覆盖hashCode方法.

Overrides:
hashCode in class java.lang.Object
Returns:
hashcode值.

toString

public java.lang.String toString()
覆盖toString方法.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the object.