Class XYChartSeriesBuilder<X,Y>
java.lang.Object
io.github.sosuisen.jfxbuilder.controls.XYChartSeriesBuilder<X,Y>
The
XYChartSeriesBuilder class constructs instances of the Series class
and offers a fluent interface for creating and configuring it.
This class includes a static create method that accepts the same arguments as the original Series constructor
and returns an instance of the XYChartSeriesBuilder.
You can use method chaining to call the builder methods for configuring the Series.
Finally, invoke the build method to generate an instance of the Series class.
Note that intermediate builder methods are not evaluated until the build method
is called, meaning they are evaluated lazily.
- Author:
- Hidekazu Kubota <hidekazu.kubota@gmail.com>
-
Method Summary
Modifier and TypeMethodDescriptionfinal XYChartSeriesBuilder<X, Y> addData(Collection<? extends XYChart.Data<X, Y>> col) Calls theaddAllmethod on the ObservableList returned by theSeries#getData()method.final XYChartSeriesBuilder<X, Y> addData(XYChart.Data<X, Y>... elements) Calls theaddAllmethod on the ObservableList returned by theSeries#getData()method.apply(Consumer<XYChart.Series<X, Y>> func) Applies a function to the Series instance being constructed.build()Builds and returns an instance of theSeriesclass.Applies a function to thechartPropertyof the instance being constructed.static <X,Y> XYChartSeriesBuilder <X, Y> create()Returns an instance of theXYChartSeriesBuilder<X, Y>.static <X,Y> XYChartSeriesBuilder <X, Y> create(String name, ObservableList<XYChart.Data<X, Y>> data) Accepts the constructor arguments ofSeries(String, ObservableList)and returns an instance ofXYChartSeriesBuilder<X, Y>.static <X,Y> XYChartSeriesBuilder <X, Y> create(ObservableList<XYChart.Data<X, Y>> data) Accepts the constructor arguments ofSeries(ObservableList)and returns an instance ofXYChartSeriesBuilder<X, Y>.data(ObservableList<XYChart.Data<X, Y>> value) A builder method that invokes thesetDatamethod on the instance being constructed.Applies a function to thedataPropertyof the instance being constructed.A builder method that invokes thesetNamemethod on the instance being constructed.Applies a function to thenamePropertyof the instance being constructed.A builder method that invokes thesetNodemethod on the instance being constructed.Applies a function to thenodePropertyof the instance being constructed.static <X,Y> XYChartSeriesBuilder <X, Y> withData(Collection<? extends XYChart.Data<X, Y>> col) Creates an instance of the builder, then calls theaddAllmethod on the ObservableList returned by theSeries#getData()method.static <X,Y> XYChartSeriesBuilder <X, Y> withData(XYChart.Data<X, Y>... elements) Creates an instance of the builder, then calls theaddAllmethod on the ObservableList returned by theSeries#getData()method.
-
Method Details
-
create
Returns an instance of theXYChartSeriesBuilder<X, Y>.- Returns:
- an instance of the
XYChartSeriesBuilder<X, Y>.
-
create
public static <X,Y> XYChartSeriesBuilder<X,Y> create(String name, ObservableList<XYChart.Data<X, Y>> data) Accepts the constructor arguments ofSeries(String, ObservableList)and returns an instance ofXYChartSeriesBuilder<X, Y>.- Returns:
- an instance of the
XYChartSeriesBuilder<X, Y>.
-
create
Accepts the constructor arguments ofSeries(ObservableList)and returns an instance ofXYChartSeriesBuilder<X, Y>.- Returns:
- an instance of the
XYChartSeriesBuilder<X, Y>.
-
build
-
apply
Applies a function to the Series instance being constructed. Most operations on the instance can be performed using this method.- Returns:
- builder instance
-
data
A builder method that invokes thesetDatamethod on the instance being constructed.- Returns:
- builder instance
-
name
A builder method that invokes thesetNamemethod on the instance being constructed.- Returns:
- builder instance
-
node
A builder method that invokes thesetNodemethod on the instance being constructed.- Returns:
- builder instance
-
addData
Calls theaddAllmethod on the ObservableList returned by theSeries#getData()method.- Returns:
- builder instance
-
addData
Calls theaddAllmethod on the ObservableList returned by theSeries#getData()method.- Returns:
- builder instance
-
withData
Creates an instance of the builder, then calls theaddAllmethod on the ObservableList returned by theSeries#getData()method.- Returns:
- builder instance
-
withData
Creates an instance of the builder, then calls theaddAllmethod on the ObservableList returned by theSeries#getData()method.- Returns:
- builder instance
-
chartPropertyApply
public XYChartSeriesBuilder<X,Y> chartPropertyApply(Consumer<ReadOnlyObjectProperty<XYChart<X, Y>>> op) Applies a function to thechartPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.chartProperty().bind(anotherProperty)) // Use shorthand form .chartPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
dataPropertyApply
public XYChartSeriesBuilder<X,Y> dataPropertyApply(Consumer<ObjectProperty<ObservableList<XYChart.Data<X, Y>>>> op) Applies a function to thedataPropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.dataProperty().bind(anotherProperty)) // Use shorthand form .dataPropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
namePropertyApply
Applies a function to thenamePropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.nameProperty().bind(anotherProperty)) // Use shorthand form .namePropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-
nodePropertyApply
Applies a function to thenodePropertyof the instance being constructed. This serves as a shorthand form of theapplymethod.Example:
// Use apply .apply(obj -> obj.nodeProperty().bind(anotherProperty)) // Use shorthand form .nodePropertyApply(prop -> prop.bind(anotherProperty))- Returns:
- builder instance
-