public class TickUnitCollection extends Object
This class contains methods that help to control the appearance of the axis and the associated tick marks.
TickUnits
,
DateTickUnit
Modifier and Type | Class and Description |
---|---|
protected class |
TickUnitCollection.MNFormat
java.text.DateFormat class required to satisfy the
formatting requirements of the JFreeChart package.
|
Modifier and Type | Field and Description |
---|---|
protected int |
outerDebugLevel
Controls amount of diagnostic messages
|
Constructor and Description |
---|
TickUnitCollection()
Default constructor.
|
TickUnitCollection(int value)
Constructor allowing extra debugging aids.
|
Modifier and Type | Method and Description |
---|---|
TickUnits |
getDailyUnits()
Creates tick marks at 24 hour (daily) intervals.
|
int |
getDebugLevel()
Getter for outerDebugLevel
|
TickUnits |
getHourlyUnits(int hours)
Set up tick marks at multiple hour intervals.
|
TickUnits |
getNewUnits()
Creates tick marks at twelve hour intervals.
|
TickUnits |
getNumberUnits(double size)
Specify the distance between tick marks.
|
TickUnits |
getNumberUnits(double size,
NumberFormat formatter)
Specify the distance between tick marks and the format
to be used in presenting the values for the tick marks.
|
void |
setDebugLevel(int value)
Setter for outerDebugLevel.
|
void |
setMNTickMarks(JFreeChart chart)
Set up the time tick marks and text items for the charts so that the time
axis has letters indicating noon and midnight as well as the day of week,
day of month and month.
|
void |
setMNTickMarks(JFreeChart chart,
Date startTimeIn,
Date endTime)
Set up the time tick marks and text items for the charts so that the time
axis has letters indicating noon and midnight as well as the day of week,
day of month and month.
|
protected int outerDebugLevel
getDebugLevel()
,
setDebugLevel(int)
public TickUnitCollection(int value)
value
- Value for outerDebugLevelpublic TickUnitCollection()
public int getDebugLevel()
outerDebugLevel
public void setDebugLevel(int value)
value
- Value for outerDebugLevelouterDebugLevel
public void setMNTickMarks(JFreeChart chart)
This version didn't work. The version specifying start and end times worked.
chart
- JFreeChart object to be modified.public void setMNTickMarks(JFreeChart chart, Date startTimeIn, Date endTime)
It is necessary to specify the starting and ending time so that the three time based axis can be lined up correctly. For the three axis (month/day, day of week, noon/midnight), the following actions are carried out.
When I didn't set the upper/lower bounds of each domain axis and turn off autoranging, only the first row appeared.
setAutoRange(false) is used to turn off automatic adjustment of the axis range and the setLowerBound and setUpperBound methods are used to set the time range.
The color of the axis line is set to the background color so that it becomes invisible.
The setDateFormatOverride, setStandardTickUnits, setAutoTickUnitSelection, and setTickMarkPosition methods are used to set the appearance of the axis.
There appears to be a problem with the JFreeChart software. Unless I moved the start to before the start of the first interval, the first interval was reduced in length by an hour. Moving the start time created an initial interval that was two milliseconds in length.
chart
- JFreeChart object to be modified.startTimeIn
- Start of time domain rangeendTime
- End of time domain rangepublic TickUnits getNewUnits()
org.jfree.chart.axis.TickUnits implements the org.jfree.chart.axis.TickUnitSource interface.
org.jfree.chart.axis.DateTickUnit is a subclass of the abstract class org.jfree.chart.axis.TickUnit.
According to section 9.4.8 of the manual, you use the
setStandardTickUnits method of the axis object
to specify the tick mark collection to be used.
DateAxis.setStandardTickUnits(TickUnitSource)
TickUnitSource
,
TickUnits
,
TickUnit
,
DateTickUnit
public TickUnits getHourlyUnits(int hours)
Recommended intervals are 2, 3, 4, 6, and 12 hours. Other intervals may have a strange appearance.
hours
- Number of hours per tick markpublic TickUnits getDailyUnits()
The constructor getDailyUnits() behaves the same as getHourlyUnits(24).
public TickUnits getNumberUnits(double size)
This allows the tick marks on a plot with multiple range axis to be lined up to provide a cleaner appearance.
size
- Distance between tick markspublic TickUnits getNumberUnits(double size, NumberFormat formatter)
This allows the tick marks on a plot with multiple range axis to be lined up to provide a cleaner appearance.
size
- Distance between tick marksformatter
- Formatter to be used for values of tick marks