Struct vega_lite_4::TransformBuilder
source · pub struct TransformBuilder { /* private fields */ }
Expand description
Builder for Transform
.
Implementations§
source§impl TransformBuilder
impl TransformBuilder
sourcepub fn aggregate<VALUE: Into<Vec<AggregatedFieldDef>>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn aggregate<VALUE: Into<Vec<AggregatedFieldDef>>>( &mut self, value: VALUE ) -> &mut Self
Array of objects that define fields to aggregate.
sourcepub fn groupby<VALUE: Into<Vec<String>>>(&mut self, value: VALUE) -> &mut Self
pub fn groupby<VALUE: Into<Vec<String>>>(&mut self, value: VALUE) -> &mut Self
The data fields to group by. If not specified, a single group containing all data objects will be used.
An optional array of fields by which to group the values. Imputation will then be performed on a per-group basis.
The data fields for partitioning the data objects into separate groups. If unspecified, all data points will be in a single group.
The data fields to group by.
The data fields for partitioning the data objects into separate windows. If unspecified, all data points will be in a single window.
The optional data fields to group by. If not specified, a single group containing all data objects will be used.
sourcepub fn transform_as<VALUE: Into<LegendText>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn transform_as<VALUE: Into<LegendText>>( &mut self, value: VALUE ) -> &mut Self
The output fields at which to write the start and end bin values. This can be either a
string or an array of strings with two elements denoting the name for the fields for bin
start and bin end respectively. If a single string (e.g., "val"
) is provided, the end
field will be "val_end"
.
The field for storing the computed formula value.
The output fields for the sample value and corresponding density estimate.
Default value: ["value", "density"]
The output field names for extracted array values.
Default value: The field name of the corresponding array field
The output field names for the key and value properties produced by the fold transform.
Default value: ["key", "value"]
The output field names for the smoothed points generated by the loess transform.
Default value: The field names of the input x and y values.
The output fields on which to store the looked up data values.
For data lookups, this property may be left blank if from.fields
has been specified
(those field names will be used); if from.fields
has not been specified, as
must be a
string.
For selection lookups, this property is optional: if unspecified, looked up values will
be stored under a property named for the selection; and if specified, it must correspond
to from.fields
.
The output field names for the probability and quantile values.
Default value: ["prob", "value"]
The output field names for the smoothed points generated by the regression transform.
Default value: The field names of the input x and y values.
The output field to write the timeUnit value.
Output field names. This can be either a string or an array of strings with two elements
denoting the name for the fields for stack start and stack end respectively. If a single
string(e.g., "val"
) is provided, the end field will be "val_end"
.
sourcepub fn bin<VALUE: Into<AngleBin>>(&mut self, value: VALUE) -> &mut Self
pub fn bin<VALUE: Into<AngleBin>>(&mut self, value: VALUE) -> &mut Self
An object indicating bin properties, or simply true
for using default bin parameters.
sourcepub fn field<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn field<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The data field to bin.
The data field to apply time unit.
sourcepub fn calculate<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn calculate<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
A expression string. Use
the variable datum
to refer to the current data object.
sourcepub fn bandwidth<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
pub fn bandwidth<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
The bandwidth (standard deviation) of the Gaussian kernel. If unspecified or set to zero, the bandwidth value is automatically estimated from the input data using Scott’s rule.
A bandwidth parameter in the range [0, 1]
that determines the amount of smoothing.
Default value: 0.3
sourcepub fn counts<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn counts<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
A boolean flag indicating if the output values should be probability estimates (false) or smoothed counts (true).
Default value: false
sourcepub fn cumulative<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn cumulative<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
A boolean flag indicating whether to produce density estimates (false) or cumulative density estimates (true).
Default value: false
sourcepub fn density<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn density<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The data field for which to perform density estimation.
sourcepub fn extent<VALUE: Into<Vec<f64>>>(&mut self, value: VALUE) -> &mut Self
pub fn extent<VALUE: Into<Vec<f64>>>(&mut self, value: VALUE) -> &mut Self
A [min, max] domain from which to sample the distribution. If unspecified, the extent will be determined by the observed minimum and maximum values of the density value field.
A [min, max] domain over the independent (x) field for the starting and ending points of the generated trend line.
sourcepub fn maxsteps<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
pub fn maxsteps<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
The maximum number of samples to take along the extent domain for plotting the density.
Default value: 200
sourcepub fn minsteps<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
pub fn minsteps<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
The minimum number of samples to take along the extent domain for plotting the density.
Default value: 25
sourcepub fn steps<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
pub fn steps<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
The exact number of samples to take along the extent domain for plotting the density. If specified, overrides both minsteps and maxsteps to set an exact number of uniform samples. Potentially useful in conjunction with a fixed extent to ensure consistent sample points for stacked densities.
sourcepub fn filter<VALUE: Into<ConditionalValueDefNumberExprRefPredicateComposition>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn filter<VALUE: Into<ConditionalValueDefNumberExprRefPredicateComposition>>( &mut self, value: VALUE ) -> &mut Self
The filter
property must be a predication definition, which can take one of the
following forms:
-
an expression string, where
datum
can be used to refer to the current data object. For example,{filter: "datum.b2 > 60"}
would make the output data includes only items that have values in the fieldb2
over 60. -
one of the field predicates:
equal
,lt
,lte
,gt
,gte
,range
,oneOf
, orvalid
, -
a selection predicate, which define the names of a selection that the data point should belong to (or a logical composition of selections).
-
a logical composition of (1), (2), or (3).
sourcepub fn flatten<VALUE: Into<Vec<String>>>(&mut self, value: VALUE) -> &mut Self
pub fn flatten<VALUE: Into<Vec<String>>>(&mut self, value: VALUE) -> &mut Self
An array of one or more data fields containing arrays to flatten. If multiple fields are
specified, their array values should have a parallel structure, ideally with the same
length. If the lengths of parallel arrays do not match, the longest array will be used
with null
values added for missing entries.
sourcepub fn fold<VALUE: Into<Vec<String>>>(&mut self, value: VALUE) -> &mut Self
pub fn fold<VALUE: Into<Vec<String>>>(&mut self, value: VALUE) -> &mut Self
An array of data fields indicating the properties to fold.
sourcepub fn frame<VALUE: Into<Vec<Option<f64>>>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn frame<VALUE: Into<Vec<Option<f64>>>>( &mut self, value: VALUE ) -> &mut Self
A frame specification as a two-element array used to control the window over which the
specified method is applied. The array entries should either be a number indicating the
offset from the current data object, or null to indicate unbounded rows preceding or
following the current data object. For example, the value [-5, 5]
indicates that the
window should include five objects preceding and five objects following the current
object.
Default value:: [null, null]
indicating that the window includes all objects.
A frame specification as a two-element array indicating how the sliding window should
proceed. The array entries should either be a number indicating the offset from the
current data object, or null to indicate unbounded rows preceding or following the
current data object. The default value is [null, 0]
, indicating that the sliding window
includes the current object and all preceding objects. The value [-5, 5]
indicates that
the window should include five objects preceding and five objects following the current
object. Finally, [null, null]
indicates that the window frame should always include all
data objects. If you this frame and want to assign the same value to add objects, you can
use the simpler join aggregate
transform. The only operators
affected are the aggregation operations and the first_value
, last_value
, and
nth_value
window operations. The other window operations are not affected by this.
Default value:: [null, 0]
(includes the current object and all preceding objects)
sourcepub fn impute<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn impute<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The data field for which the missing values should be imputed.
sourcepub fn key<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn key<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
A key field that uniquely identifies data objects within a group. Missing key values (those occurring in the data but not in the current group) will be imputed.
sourcepub fn keyvals<VALUE: Into<Keyvals>>(&mut self, value: VALUE) -> &mut Self
pub fn keyvals<VALUE: Into<Keyvals>>(&mut self, value: VALUE) -> &mut Self
Defines the key values that should be considered for imputation. An array of key values or an object defining a number sequence.
If provided, this will be used in addition to the key values observed within the input
data. If not provided, the values will be derived from all unique values of the key
field. For impute
in encoding
, the key field is the x-field if the y-field is
imputed, or vice versa.
If there is no impute grouping, this property must be specified.
sourcepub fn method<VALUE: Into<TransformMethod>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn method<VALUE: Into<TransformMethod>>( &mut self, value: VALUE ) -> &mut Self
The imputation method to use for the field value of imputed data objects. One of
"value"
, "mean"
, "median"
, "max"
or "min"
.
Default value: "value"
The functional form of the regression model. One of "linear"
, "log"
, "exp"
,
"pow"
, "quad"
, or "poly"
.
Default value: "linear"
sourcepub fn value<VALUE: Into<Value>>(&mut self, value: VALUE) -> &mut Self
pub fn value<VALUE: Into<Value>>(&mut self, value: VALUE) -> &mut Self
The field value to use when the imputation method
is "value"
.
The data field to populate pivoted fields. The aggregate values of this field become the values of the new pivoted fields.
sourcepub fn joinaggregate<VALUE: Into<Vec<JoinAggregateFieldDef>>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn joinaggregate<VALUE: Into<Vec<JoinAggregateFieldDef>>>( &mut self, value: VALUE ) -> &mut Self
The definition of the fields in the join aggregate, and what calculations to use.
sourcepub fn loess<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn loess<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The data field of the dependent variable to smooth.
sourcepub fn on<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn on<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The data field of the independent variable to use a predictor.
sourcepub fn transform_default<VALUE: Into<String>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn transform_default<VALUE: Into<String>>( &mut self, value: VALUE ) -> &mut Self
The default value to use if lookup fails.
Default value: null
sourcepub fn from<VALUE: Into<Lookup>>(&mut self, value: VALUE) -> &mut Self
pub fn from<VALUE: Into<Lookup>>(&mut self, value: VALUE) -> &mut Self
Data source or selection for secondary data reference.
sourcepub fn lookup<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn lookup<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
Key in primary data source.
sourcepub fn probs<VALUE: Into<Vec<f64>>>(&mut self, value: VALUE) -> &mut Self
pub fn probs<VALUE: Into<Vec<f64>>>(&mut self, value: VALUE) -> &mut Self
An array of probabilities in the range (0, 1) for which to compute quantile values. If not specified, the step parameter will be used.
sourcepub fn quantile<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn quantile<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The data field for which to perform quantile estimation.
sourcepub fn step<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
pub fn step<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
A probability step size (default 0.01) for sampling quantile values. All values from one-half the step size up to 1 (exclusive) will be sampled. This parameter is only used if the probs parameter is not provided.
sourcepub fn order<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
pub fn order<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
The polynomial order (number of coefficients) for the ‘poly’ method.
Default value: 3
sourcepub fn params<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn params<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
A boolean flag indicating if the transform should return the regression model parameters
(one object per group), rather than trend line points. The resulting objects include a
coef
array of fitted coefficient values (starting with the intercept term and then
including terms of increasing order) and an rSquared
value (indicating the total
variance explained by the model).
Default value: false
sourcepub fn regression<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn regression<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The data field of the dependent variable to predict.
sourcepub fn time_unit<VALUE: Into<TimeUnitUnion>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn time_unit<VALUE: Into<TimeUnitUnion>>( &mut self, value: VALUE ) -> &mut Self
The timeUnit.
sourcepub fn sample<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
pub fn sample<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
The maximum number of data objects to include in the sample.
Default value: 1000
sourcepub fn offset<VALUE: Into<StackOffset>>(&mut self, value: VALUE) -> &mut Self
pub fn offset<VALUE: Into<StackOffset>>(&mut self, value: VALUE) -> &mut Self
Mode for stacking marks. One of "zero"
(default), "center"
, or "normalize"
. The
"zero"
offset will stack starting at 0
. The "center"
offset will center the stacks.
The "normalize"
offset will compute percentage values for each stack point, with output
values in the range [0,1]
.
Default value: "zero"
sourcepub fn sort<VALUE: Into<Vec<SortField>>>(&mut self, value: VALUE) -> &mut Self
pub fn sort<VALUE: Into<Vec<SortField>>>(&mut self, value: VALUE) -> &mut Self
Field that determines the order of leaves in the stacked charts.
A sort field definition for sorting data objects within a window. If two data objects are
considered equal by the comparator, they are considered “peer” values of equal rank. If
sort is not specified, the order is undefined: data objects are processed in the order
they are observed and none are considered peers (the ignorePeers parameter is ignored and
treated as if set to true
).
sourcepub fn stack<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn stack<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The field which is stacked.
sourcepub fn ignore_peers<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
pub fn ignore_peers<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self
Indicates if the sliding window frame should ignore peer values (data that are considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to true, the window frame will be defined by offset values only. This setting only affects those operations that depend on the window frame, namely aggregation operations and the first_value, last_value, and nth_value window operations.
Default value: false
sourcepub fn window<VALUE: Into<Vec<WindowFieldDef>>>(
&mut self,
value: VALUE
) -> &mut Self
pub fn window<VALUE: Into<Vec<WindowFieldDef>>>( &mut self, value: VALUE ) -> &mut Self
The definition of the fields in the window, and what calculations to use.
sourcepub fn limit<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
pub fn limit<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self
An optional parameter indicating the maximum number of pivoted fields to generate. The
default (0
) applies no limit. The pivoted pivot
names are sorted in ascending order
prior to enforcing the limit. Default value: 0
sourcepub fn op<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
pub fn op<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self
The aggregation operation to apply to grouped value
field values. Default value:
sum
Trait Implementations§
source§impl Clone for TransformBuilder
impl Clone for TransformBuilder
source§fn clone(&self) -> TransformBuilder
fn clone(&self) -> TransformBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more