Class AxisTimeStyle
java.lang.Object
com.amalgamasimulation.charts.axes.ticks.AxisTimeStyle
Class that represents parameters for formatting and ranging time-relative
axes. Used to calculate and customize the visual display of ticks and
gridlines.
- Author:
- Aleksey Kirillov
-
Constructor Summary
ConstructorsConstructorDescriptionAxisTimeStyle(int majorTickLength, int minorTickLength, LocalDateTime beginDate, ChronoUnit timeUnit) Constructs aAxisTimeStylewith manually setting of all initialization parameters.AxisTimeStyle(LocalDateTime beginDate, ChronoUnit timeUnit) Constructs aAxisTimeStylewith given begin date and time unit. -
Method Summary
Modifier and TypeMethodDescriptionaddParameters(double minWindowSize, double maxWindowSize, TimeTicksParameters majorTicksParameters, TimeTicksParameters minorTicksParameters, Function<LocalDateTime, String> majorTickLabelsProvider) Used to set different policies for splitting the displayed range into major/minor ticks depending on displayed range size.doubledateToTime(LocalDateTime date) Converts the specified date of calendar to the corresponding time.Returns the starting date from which all ticks are counted.static AxisTimeStylegetDefault(LocalDateTime beginDate, ChronoUnit chronoUnit) Creates a default set of policies for splitting the displayed range into major/minor ticks depending on displayed range size.intReturns the visual length of major ticks, in pixels.intReturns the visual length of minor ticks, in pixels.getTimeLabelsAndTicksDescriptor(double duration) Return splitting the displayed range policy by given duration or null if the policies are not set.Returns the list of splitting the displayed range policies.Returns the axis ticks time units.timeToDate(double time) Converts the specified time to corresponding date of calendar.
-
Constructor Details
-
AxisTimeStyle
Constructs aAxisTimeStylewith given begin date and time unit. Other parameters are set to default: major tick length is equal to 10pcx, minor tick length is equals to 5pcx.- Parameters:
beginDate- the starting date from which all ticks are counted. Cannot be nulltimeUnit- the axis ticks time units. HOURS by default. Cannot be null
-
AxisTimeStyle
public AxisTimeStyle(int majorTickLength, int minorTickLength, LocalDateTime beginDate, ChronoUnit timeUnit) Constructs aAxisTimeStylewith manually setting of all initialization parameters.- Parameters:
majorTickLength- visual length of major ticks, in pixelsminorTickLength- visual length of minor ticks, in pixelsbeginDate- the starting date from which all ticks are counted. Cannot be nulltimeUnit- the axis ticks time units. HOURS by default. Cannot be null
-
-
Method Details
-
addParameters
public AxisTimeStyle addParameters(double minWindowSize, double maxWindowSize, TimeTicksParameters majorTicksParameters, TimeTicksParameters minorTicksParameters, Function<LocalDateTime, String> majorTickLabelsProvider) Used to set different policies for splitting the displayed range into major/minor ticks depending on displayed range size. For example, it makes sense to make a daily displayed range for hourly and minute ticks, a weekly displayed range for daily and hourly ticks, and a yearly displayed range for monthly and weekly ticks. The given set of displayed ranges must not contains self-intersections.- Parameters:
minWindowSize- displayed range minimum sizemaxWindowSize- displayed range maximum sizemajorTicksParameters-TimeTicksParametersfor major ticksminorTicksParameters-TimeTicksParametersfor minor ticksmajorTickLabelsProvider- the formatter to tick labels, i.e. the function that takes a LocalDateTime value and produces a String that should be drawn to represent this value- Returns:
- reference to this object
-
getMajorTickLength
public int getMajorTickLength()Returns the visual length of major ticks, in pixels.- Returns:
- the visual length of major ticks, in pixels
-
getMinorTickLength
public int getMinorTickLength()Returns the visual length of minor ticks, in pixels.- Returns:
- the visual length of minor ticks, in pixels
-
getBeginDate
Returns the starting date from which all ticks are counted.- Returns:
- the starting date from which all ticks are counted
-
getTimeUnit
Returns the axis ticks time units.- Returns:
- the axis ticks time units
-
getTimeLabelsAndTicksDescriptors
Returns the list of splitting the displayed range policies.- Returns:
- the list of splitting the displayed range policies
-
getTimeLabelsAndTicksDescriptor
Return splitting the displayed range policy by given duration or null if the policies are not set.- Parameters:
duration- displayed range duration- Returns:
- splitting the displayed range policy by given duration
-
timeToDate
Converts the specified time to corresponding date of calendar.- Parameters:
time- converting time- Returns:
- the specified time to corresponding date of calendar
-
dateToTime
Converts the specified date of calendar to the corresponding time.- Parameters:
date- converting date- Returns:
- the specified date of calendar to the corresponding time
-
getDefault
Creates a default set of policies for splitting the displayed range into major/minor ticks depending on displayed range size.- Parameters:
beginDate- the starting date from which all ticks are counted. Cannot be nullchronoUnit- the axis ticks time units. HOURS by default. Cannot be null- Returns:
- a default set of policies for splitting the displayed range into major/minor ticks depending on displayed range size
-