Package com.jfcbuilder.builders
Class OhlcPlotBuilder
java.lang.Object
com.jfcbuilder.builders.OhlcPlotBuilder
- All Implemented Interfaces:
IXYTimeSeriesPlotBuilder<OhlcPlotBuilder>
- Direct Known Subclasses:
VolumeXYPlotBuilder
Builder for producing stock market Open High Low Close (OHLC) plots using configured builder
properties, series, and datasets.
-
Method Summary
Modifier and TypeMethodDescriptionannotation(IXYAnnotationBuilder<?> annotation) Registers an IXYAnnotationBuilder whosebuild()method will be called to generate its XYAnnotation when this plot builder'sbuild()method is called.Sets the axis color to use when building the plot.axisFontColor(Paint color) Sets the axis font color to use when building the plot.backgroundColor(Paint color) Sets the plot background color to use when building the plot.org.jfree.chart.plot.XYPlotbuild()Builds the DOHLC plot.static OhlcPlotBuilderget()Factory method for obtaining new instances of this class.Deprecated.indexRange(ZeroBasedIndexRange indexRange) Sets the zero-based index range used to index into all source data for building the XYPlot.majorGrid(boolean enabled) Toggles displaying major grid lines ON or OFF.majorGridColor(Paint color) Sets the major grid color to use when building the plot.majorGridStyle(Stroke style) Sets the major grid line style to use when building the plot.marker(MarkerBuilder line) Registers aMarkerBuilderwhosebuild()method will be called to generate its plot line when this plot builder'sbuild()method is called.minorGrid(boolean enabled) Toggles displaying minor grid lines ON or OFF.minorGridColor(Paint color) Sets the minor grid color to use when building the plot.minorGridStyle(Stroke style) Sets the minor grid line style to use when building the plot.Sets displaying all grid lines OFF.intGets the currently configured plot weight.plotWeight(int weight) Sets the plot weight to be attributed to the plot.series(IXYTimeSeriesBuilder<?> series) Registers an IXYTimeSeriesBuilder whosebuild()method will be called to generate its XYTimeSeries when this plot builder'sbuild()method is called.series(IXYTimeSeriesDatasetBuilder<?> dataset) Same as interfaceIXYTimeSeriesPlotBuilder<?>.series(IXYTimeSeriesDatasetBuilder<?>)but also checks that only oneOhlcSeriesBuilderis ever added because only one is allowed per plot.showTimeGaps(boolean showTimeGaps) Toggle whether to show time gaps at x-values where there is no corresponding time instance.timeData(long[] timeData) Sets the date-time values to be used when building the plot.xAxis(org.jfree.chart.axis.ValueAxis xAxis) Sets the x-axis used when building the plot.Sets the plot's y-axis name.yAxisRange(double lower, double upper) Sets an explicit y-axis value range to use instead of having the y-axis auto-calculate it.yAxisTickSize(double size) Sets the plot's y-axis tick size.yTickFormat(NumberFormat format) Sets the plot's y-axis tick format.
-
Method Details
-
get
Factory method for obtaining new instances of this class.- Returns:
- New instance of this class
-
indexRange
Description copied from interface:IXYTimeSeriesPlotBuilderSets the zero-based index range used to index into all source data for building the XYPlot. This is an optimization to allow clients to supply existing data without having to copy and/or crop it to match the desired size axis range in the chart.- Specified by:
indexRangein interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
indexRange- The index range to be set- Returns:
- Reference to this builder instance for method chaining
-
xAxis
Description copied from interface:IXYTimeSeriesPlotBuilderSets the x-axis used when building the plot.- Specified by:
xAxisin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
xAxis- The axis to be set- Returns:
- Reference to this builder instance for method chaining
-
timeData
Description copied from interface:IXYTimeSeriesPlotBuilderSets the date-time values to be used when building the plot.- Specified by:
timeDatain interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
timeData- The date-time values representing the milliseconds since the epoch start- Returns:
- Reference to this builder instance for method chaining
-
showTimeGaps
Description copied from interface:IXYTimeSeriesPlotBuilderToggle whether to show time gaps at x-values where there is no corresponding time instance.- Specified by:
showTimeGapsin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
showTimeGaps- True to show time gaps, false otherwise.- Returns:
- Reference to this builder instance for method chaining
-
series
Description copied from interface:IXYTimeSeriesPlotBuilderRegisters an IXYTimeSeriesBuilder whosebuild()method will be called to generate its XYTimeSeries when this plot builder'sbuild()method is called.- Specified by:
seriesin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
series- The series builder representing the series that it will build- Returns:
- Reference to this builder instance for method chaining
-
series
Same as interfaceIXYTimeSeriesPlotBuilder<?>.series(IXYTimeSeriesDatasetBuilder<?>)but also checks that only oneOhlcSeriesBuilderis ever added because only one is allowed per plot.- Specified by:
seriesin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
dataset- The series builder representing the series that it will build- Returns:
- Reference to this builder instance for method chaining
- Throws:
IllegalArgumentException- If an OhlcSeriesBuilder was already added.
-
marker
Description copied from interface:IXYTimeSeriesPlotBuilderRegisters aMarkerBuilderwhosebuild()method will be called to generate its plot line when this plot builder'sbuild()method is called.- Specified by:
markerin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
line- The marker builder representing the marker that it will build- Returns:
- Reference to this builder instance for method chaining
-
annotation
Description copied from interface:IXYTimeSeriesPlotBuilderRegisters an IXYAnnotationBuilder whosebuild()method will be called to generate its XYAnnotation when this plot builder'sbuild()method is called.- Specified by:
annotationin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
annotation- The annotation builder representing the annotation that it will build- Returns:
- Reference to this builder instance for method chaining
-
plotWeight
Description copied from interface:IXYTimeSeriesPlotBuilderSets the plot weight to be attributed to the plot. A default of 1 will be used if this is not set.- Specified by:
plotWeightin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
weight- The plot weight to be set- Returns:
- Reference to this builder instance for method chaining
-
plotWeight
public int plotWeight()Description copied from interface:IXYTimeSeriesPlotBuilderGets the currently configured plot weight.- Specified by:
plotWeightin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Returns:
- The plot weight
-
yAxisName
Description copied from interface:IXYTimeSeriesPlotBuilderSets the plot's y-axis name.- Specified by:
yAxisNamein interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
name- The axis name to be set- Returns:
- Reference to this builder instance for method chaining
-
yAxisRange
Description copied from interface:IXYTimeSeriesPlotBuilderSets an explicit y-axis value range to use instead of having the y-axis auto-calculate it.- Specified by:
yAxisRangein interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
lower- The lower bound to be setupper- The upper bound to be set- Returns:
- Reference to this builder instance for method chaining
- Throws:
IllegalArgumentException- If the lower bound is greater than the upper one
-
yAxisTickSize
Description copied from interface:IXYTimeSeriesPlotBuilderSets the plot's y-axis tick size.- Specified by:
yAxisTickSizein interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
size- The tick size to be set- Returns:
- Reference to this builder instance for method chaining
-
yTickFormat
Description copied from interface:IXYTimeSeriesPlotBuilderSets the plot's y-axis tick format.- Specified by:
yTickFormatin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
format- The tick format to be set- Returns:
- Reference to this builder instance for method chaining
-
backgroundColor
Description copied from interface:IXYTimeSeriesPlotBuilderSets the plot background color to use when building the plot.- Specified by:
backgroundColorin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
color- The color to set- Returns:
- Reference to this builder instance for method chaining
-
axisFontColor
Description copied from interface:IXYTimeSeriesPlotBuilderSets the axis font color to use when building the plot.- Specified by:
axisFontColorin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
color- The color to set- Returns:
- Reference to this builder instance for method chaining
-
axisColor
Description copied from interface:IXYTimeSeriesPlotBuilderSets the axis color to use when building the plot.- Specified by:
axisColorin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
color- The color to set- Returns:
- Reference to this builder instance for method chaining
-
gridLines
Deprecated.This facility is replaced bymajorGrid(boolean)andminorGrid(boolean), and will be removed in a future release.For removal since v1.5.7
Sets displaying grid lines ON.- Specified by:
gridLinesin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Returns:
- Reference to this builder instance for method chaining
-
noGridLines
Description copied from interface:IXYTimeSeriesPlotBuilderSets displaying all grid lines OFF. Shorthand for calling bothIXYTimeSeriesPlotBuilder.majorGrid(boolean)andIXYTimeSeriesPlotBuilder.minorGrid(boolean)with a value offalse.- Specified by:
noGridLinesin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Returns:
- Reference to this builder instance for method chaining
-
majorGrid
Description copied from interface:IXYTimeSeriesPlotBuilderToggles displaying major grid lines ON or OFF.- Specified by:
majorGridin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
enabled- True to show major grid lines, false to turn them off.- Returns:
- Reference to this builder instance for method chaining
-
majorGridColor
Description copied from interface:IXYTimeSeriesPlotBuilderSets the major grid color to use when building the plot.- Specified by:
majorGridColorin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
color- The color to set- Returns:
- Reference to this builder instance for method chaining
-
majorGridStyle
Description copied from interface:IXYTimeSeriesPlotBuilderSets the major grid line style to use when building the plot.- Specified by:
majorGridStylein interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
style- The style to set- Returns:
- Reference to this builder instance for method chaining
-
minorGrid
Description copied from interface:IXYTimeSeriesPlotBuilderToggles displaying minor grid lines ON or OFF.- Specified by:
minorGridin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
enabled- True to show minor grid lines, false to turn them off.- Returns:
- Reference to this builder instance for method chaining
-
minorGridColor
Description copied from interface:IXYTimeSeriesPlotBuilderSets the minor grid color to use when building the plot.- Specified by:
minorGridColorin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
color- The color to set- Returns:
- Reference to this builder instance for method chaining
-
minorGridStyle
Description copied from interface:IXYTimeSeriesPlotBuilderSets the minor grid line style to use when building the plot.- Specified by:
minorGridStylein interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Parameters:
style- The style to set- Returns:
- Reference to this builder instance for method chaining
-
build
Builds the DOHLC plot. The DOHLC series is shown behind all other series that were added.- Specified by:
buildin interfaceIXYTimeSeriesPlotBuilder<OhlcPlotBuilder>- Returns:
- New instance of an plot corresponding to all configured data sets and settings
- Throws:
IllegalStateException- If an OhlcSeriesBuilder was not set, if time axis was not set, or if time data was not set.
-
majorGrid(boolean)andminorGrid(boolean), and will be removed in a future release.