Interface IGanttPropertySet
The axis scales can be set using the time based class "java.util.Date" and/or its extended classes: "java.sql.Date", "java.sql.Time", and "java.sql.Timestamp". Setting the axis scales when the labels are displayed in the numeric format can be done through the IAxis class. The handle to it can be obtained by calling the gethXAxis method. eg. IAxis xAxis = chart.gethXAxis().
Graphics needs to be initialized before the "get" methods for the axis scaling can be called. Otherwise, the methods would return the perspective default values.
eg.Frame frame = new Frame(); frame.addNotify(); // draw a frame chart of the same size as the chart chart.draw(frame.getGraphics(), frame, 500, 400); frame.removeNotify();
-
Method Summary
Modifier and TypeMethodDescriptionReturns the IFormat object that is used for formatting the value axis labels.longReturns the maximum scale milliseconds value that was defined for this axis.longReturns the minimum scale milliseconds value that was defined for this axis.longReturns the scaleStep milliseconds value that was defined for this axis.booleanReturns the state of the arrows that link Gantt chart data.booleanReturns the state of value axis label display in DateTimeFormat, as opposed to NumericFormat.booleanReturns the state of the x-axis label display in day of the week fashion.booleanThis function is used to check if the origin is calculated automatically or notbooleanThis function is used to check if the scale min, max, and step sizes are calculated automatically or not.booleanReturns if translucent GIF is used.voidsetArrowsDrawn(boolean state) Sets the state of the arrows that link Gantt chart data.voidsetAxisLabelFormat(IFormat format) Specifies the IFormat object to be used for formatting the value axis labels.voidsetDateTimeDisplay(boolean state) Specifies the if the value axis labels are displayed in the DateTimeFormatvoidsetDisplayByWeek(boolean state) Sets the state of the x-axis label display in day of the week fashion.voidsetMaxScale(Date maxScale) Sets the maximum scale value for this axis.voidsetMinScale(Date minScale) Sets the minimum scale value for this axis.voidsetOriginAutomatic(boolean b) This function is used to enable/disable auto calculation of origin.voidsetScaleAutomatic(boolean b) This function is used to enable/disable auto calculation of scales.voidsetScaleStep(int yr, int mo, int dd, int hr, int min) Sets the scalestep value for this axis.voidsetScaleStep(Date scaleStep) Sets the scalestep value for this axis.voidsetTranslucent(boolean state) Specifies if translucent GIF is used.
-
Method Details
-
isTranslucent
boolean isTranslucent()Returns if translucent GIF is used. -
setTranslucent
void setTranslucent(boolean state) Specifies if translucent GIF is used. JDK1.2 or above is required.- Parameters:
state- the new state, default is false.
-
isDateTimeDisplay
boolean isDateTimeDisplay()Returns the state of value axis label display in DateTimeFormat, as opposed to NumericFormat. -
setDateTimeDisplay
void setDateTimeDisplay(boolean state) Specifies the if the value axis labels are displayed in the DateTimeFormat- Parameters:
state- the new state, default is true.
-
getAxisLabelFormat
IFormat getAxisLabelFormat()Returns the IFormat object that is used for formatting the value axis labels. -
setAxisLabelFormat
Specifies the IFormat object to be used for formatting the value axis labels. -
isOriginAutomatic
boolean isOriginAutomatic()This function is used to check if the origin is calculated automatically or not- Returns:
- True if the origin value is automatic.
-
setOriginAutomatic
void setOriginAutomatic(boolean b) This function is used to enable/disable auto calculation of origin.- Parameters:
b- True if auto origin is desired, false otherwise.
-
isScaleAutomatic
boolean isScaleAutomatic()This function is used to check if the scale min, max, and step sizes are calculated automatically or not.- Returns:
- True if the scale min, max, and step values are automatic.
-
setScaleAutomatic
void setScaleAutomatic(boolean b) This function is used to enable/disable auto calculation of scales.- Parameters:
b- True if auto scale is desired, false otherwise.
-
getMinScale
long getMinScale()Returns the minimum scale milliseconds value that was defined for this axis.- Returns:
- The long int representation of the minimum scale.
-
setMinScale
Sets the minimum scale value for this axis. The java.sql Date, Time, Timestamp all extend the java.util.Date class, therefore, can be used as well.- Parameters:
minScale- The minimum scale to use.
-
getMaxScale
long getMaxScale()Returns the maximum scale milliseconds value that was defined for this axis.- Returns:
- The long int representation of the maximum scale.
-
setMaxScale
Sets the maximum scale value for this axis. The java.sql Date, Time, Timestamp classes all extend the java.util.Date class, therefore, can be used as well.- Parameters:
maxScale- The maximum scale to use.
-
getScaleStep
long getScaleStep()Returns the scaleStep milliseconds value that was defined for this axis.- Returns:
- The long int representation of the scale step.
-
setScaleStep
Sets the scalestep value for this axis. The java.sql Date, Time, Timestamp classes all extend the java.util.Date class, therefore, can be used as well.Note on setting scalestep in units of "days":
Use "setScaleStep(new java.util.Date(70, 0, D, 24 + Offset, 0, 0));" to set the scalestep to "D" number of days, where "Offset" is the offset from the GMT. For example, to have a scale step of 1 day when you are in the locale of Pacific Standard Timezone--GMT offset is "-8", the constructor to use is "new java.util.Date(70, 0, 1, 16, 0, 0)".Note on setting scalestep in units of "hours":
Use "setScaleStep(new java.sql.TimeStamp(H + Offset, 0, 0);" to set the scalestep to "H" number of hours, where "Offset" is the offset from the GMT. For example, to have a scalestep of 12 hours when you are in the Pacific Standard Timezone--where GMT offset is "-8", the TimeStamp constructor to use is "new java.sql.TimeStamp(4,0,0)".Alternatively, you may turn the time zone offset off with the following code snippet. You do not need to correct JDK1.2 GMT offset as explained in the previous two paragraphs if you insert the following code in the beginning of your program.
// Turn TimeZone Off SimpleTimeZone timeZone = new SimpleTimeZone(0, //set the RawOffset to 0, TimeZone.getDefault().getID()); TimeZone.setDefault(timeZone);- Parameters:
scaleStep- The scalestep to use.
-
setScaleStep
void setScaleStep(int yr, int mo, int dd, int hr, int min) Sets the scalestep value for this axis.- Parameters:
yr- The scalestep in yearmo- The scalestep in monthdd- The scalestep in dayhr- The scalestep in hourmin- The scalestep in minute
-
isDisplayByWeek
boolean isDisplayByWeek()Returns the state of the x-axis label display in day of the week fashion. -
setDisplayByWeek
void setDisplayByWeek(boolean state) Sets the state of the x-axis label display in day of the week fashion. Known issues: works for dates as early as from the year 1971. Day of week accuracy is compromised by inaccuracy in the java.util.Date class.- Parameters:
state- the new state.
-
isArrowsDrawn
boolean isArrowsDrawn()Returns the state of the arrows that link Gantt chart data. -
setArrowsDrawn
void setArrowsDrawn(boolean state) Sets the state of the arrows that link Gantt chart data.- Parameters:
state- the new state.
-