segmentedtimeline.html

来自「JFreeChart的帮助文档」· HTML 代码 · 共 1,510 行 · 第 1/4 页

HTML
1,510
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Sep 11 11:26:57 BST 2003 --><TITLE>SegmentedTimeline (JFreeChart Class Library (version 0.9.12))</TITLE><META NAME="keywords" CONTENT="org.jfree.chart.axis.SegmentedTimeline,SegmentedTimeline class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"></HEAD><SCRIPT>function asd(){parent.document.title="SegmentedTimeline (JFreeChart Class Library (version 0.9.12))";}</SCRIPT><BODY BGCOLOR="white" onload="asd();"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../../../org/jfree/chart/axis/NumberTickUnit.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.BaseTimelineSegmentRange.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="SegmentedTimeline.html" TARGET="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT>  <!--  if(window==top) {    document.writeln('<A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT><A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;<A HREF="#nested_class_summary">NESTED</A>&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">org.jfree.chart.axis</FONT><BR>Class SegmentedTimeline</H2><PRE>java.lang.Object  |  +--<B>org.jfree.chart.axis.SegmentedTimeline</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD>java.lang.Cloneable, java.io.Serializable, <A HREF="../../../../org/jfree/chart/axis/Timeline.html">Timeline</A></DD></DL><HR><DL><DT>public class <B>SegmentedTimeline</B><DT>extends java.lang.Object<DT>implements <A HREF="../../../../org/jfree/chart/axis/Timeline.html">Timeline</A>, java.lang.Cloneable, java.io.Serializable</DL><P>A <A HREF="../../../../org/jfree/chart/axis/Timeline.html"><CODE>Timeline</CODE></A> that implements a "segmented" timeline with included, excluded and exception segments. <P> A Timeline will present a series of values to be used for an axis. Each Timeline must provide transformation methods between domain values and timeline values. <P> A timeline can be used as parameter to a <A HREF="../../../../org/jfree/chart/axis/DateAxis.html"><CODE>DateAxis</CODE></A> to define the values that this axis supports. This class implements a timeline formed by segments of equal length (ex. days, hours, minutes) where some segments can be included in the timeline and others excluded. Therefore timelines like "working days" or "working hours" can be created where non-working days or non-working hours respectively can be removed from the timeline, and therefore from the axis. This creates a smooth plot with equal separation between all included segments. <P> Because Timelines were created mainly for Date related axis, values are represented as longs instead of doubles. In this case, the domain value is just the number of milliseconds since January 1, 1970, 00:00:00 GMT as defined by the getTime() method of <CODE>Date</CODE>. <P> In this class, a segment is defined as a unit of time of fixed length. Examples of segments are: days, hours, minutes, etc. The size of a segment is defined as the number of milliseconds in the segment. Some useful segment sizes are defined as constants in this class: DAY_SEGMENT_SIZE, HOUR_SEGMENT_SIZE, FIFTEEN_MINUTE_SEGMENT_SIZE and MINUTE_SEGMENT_SIZE. <P> Segments are group together to form a Segment Group. Each Segment Group will contain a number of Segments included and a number of Segments excluded. This Segment Group structure will repeat for the whole timeline. <P> For example, a working days SegmentedTimeline would be formed by a group of 7 daily segments, where there are 5 included (Monday through Friday) and 2 excluded (Saturday and Sunday) segments. <P> Following is a diagram that explains the major attributes that define a segment. Each box is one segment and must be of fixed length (ms, second, hour, day, etc). <p> <pre> start time   |   v   0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 ... +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+... |  |  |  |  |  |EE|EE|  |  |  |  |  |EE|EE|  |  |  |  |  |EE|EE| +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+...  \____________/ \___/            \_/        \/         |               |     included   excluded        segment     segments   segments         size  \_________  _______/            \/       segment group </pre> Legend:<br> &lt;space&gt; = Included segment<br> EE      = Excluded segments in the base timeline<br> <p> In the example, the following segment attributes are presented: <ul> <li>segment size: the size of each segment in ms. <li>start time: the start of the first segment of the first segment group to consider. <li>included segments: the number of segments to include in the group. <li>excluded segments: the number of segments to exclude in the group. </ul> <p> Exception Segments are allowed. These exception segments are defined as segments that would have been in the included segments of the Segment Group, but should be excluded for special reasons. In the previous working days SegmentedTimeline example, holidays would be considered exceptions. <P> Additionally the <code>startTime</code>, or start of the first Segment of the smallest segment group needs to be defined. This startTime could be relative to January 1, 1970, 00:00:00 GMT or any other date. This creates a point of reference to start counting Segment Groups. For example, for the working days SegmentedTimeline, the <code>startTime</code> could be 00:00:00 GMT of the first Monday after January 1, 1970. In this class, the constant FIRST_MONDAY_AFTER_1900 refers to a reference point of the first Monday of the last century. <p> A SegmentedTimeline can include a baseTimeline. This combination of timelines allows the creation of more complex timelines. For example, in order to implement a SegmentedTimeline for an intraday stock trading application, where the trading period is defined as 9:00 AM through 4:00 PM Monday through Friday, two SegmentedTimelines are used. The first one (the baseTimeline) would be a a working day SegmentedTimeline (daily timeline Monday through Friday). On top of this baseTimeline, a second one is defined that maps the 9:00 AM to 4:00 PM period. Because the baseTimeline defines a timeline of Monday through Friday, the resulting (combined) timeline will expose the period 9:00 AM through 4:00 PM only on Monday through Friday, and will remove all other intermediate intervals. <P> Two factory methods newMondayThroughFridayTimeline() and newFifteenMinuteTimeline() are provided as examples to create special SegmentedTimelines.<P><P><DL><DT><B>Author:</B></DT>  <DD>Bill Kelemen</DD><DT><B>See Also:</B><DD><A HREF="../../../../org/jfree/chart/axis/DateAxis.html"><CODE>DateAxis</CODE></A>, <A HREF="../../../../serialized-form.html" TARGET="org.jfree.chart.axis.SegmentedTimeline">Serialized Form</A></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><A NAME="nested_class_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Nested Class Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;class</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.BaseTimelineSegmentRange.html">SegmentedTimeline.BaseTimelineSegmentRange</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Special <code>SegmentRange</code> that came from the BaseTimeline.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;class</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.Segment.html">SegmentedTimeline.Segment</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Internal class to represent a valid segment for this timeline.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;class</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.SegmentRange.html">SegmentedTimeline.SegmentRange</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Private internal class to represent a range of segments.</TD></TR></TABLE>&nbsp;<!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#DAY_SEGMENT_SIZE">DAY_SEGMENT_SIZE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Defines a day segment size in ms.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;java.util.TimeZone</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#DEFAULT_TIME_ZONE">DEFAULT_TIME_ZONE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This is the default time zone where the application is running.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#FIFTEEN_MINUTE_SEGMENT_SIZE">FIFTEEN_MINUTE_SEGMENT_SIZE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Defines a 15-minute segment size in ms.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#FIRST_MONDAY_AFTER_1900">FIRST_MONDAY_AFTER_1900</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility constant that defines the startTime as the first monday after 1/1/1970.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#HOUR_SEGMENT_SIZE">HOUR_SEGMENT_SIZE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Defines a one hour segment size in ms.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#MINUTE_SEGMENT_SIZE">MINUTE_SEGMENT_SIZE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Defines a one-minute segment size in ms.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;java.util.TimeZone</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#NO_DST_TIME_ZONE">NO_DST_TIME_ZONE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Utility TimeZone object that has no DST and an offset equal to the default TimeZone.</TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#SegmentedTimeline(long, int, int)">SegmentedTimeline</A></B>(long&nbsp;segmentSize,                  int&nbsp;segmentsIncluded,                  int&nbsp;segmentsExcluded)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a new segmented timeline, optionaly using another segmented timeline as its base.</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#addBaseTimelineException(java.util.Date)">addBaseTimelineException</A></B>(java.util.Date&nbsp;date)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a segment relative to the baseTimeline as an exception.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#addBaseTimelineException(long)">addBaseTimelineException</A></B>(long&nbsp;domainValue)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a segment relative to the baseTimeline as an exception.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#addBaseTimelineExclusions(long, long)">addBaseTimelineExclusions</A></B>(long&nbsp;fromBaseDomainValue,                          long&nbsp;toBaseDomainValue)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds all excluded segments from the BaseTimeline as exceptions to our timeline.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#addException(java.util.Date)">addException</A></B>(java.util.Date&nbsp;exceptionDate)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a segment as an exception.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#addException(long)">addException</A></B>(long&nbsp;millisecond)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a segment as an exception.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#addException(long, long)">addException</A></B>(long&nbsp;fromDomainValue,             long&nbsp;toDomainValue)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds a segment range as an exception.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jfree/chart/axis/SegmentedTimeline.html#addExceptions(java.util.List)">addExceptions</A></B>(java.util.List&nbsp;exceptionList)</CODE><BR>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?