Returns a new instance of this Record type with all values set to their default values.
Returns a new instance of this Record type with the value for the specific key set to its default value.
Returns the value associated with the provided key, which may be the default value defined when creating the Record factory function.
If the requested key is not defined by this Record type, then notSetValue will be returned if provided. Note that this scenario would produce an error when using Flow or TypeScript.
Get cursor formatter of this NumericTickStrategy
object.
FormattingFunction
as set by user, or undefined
to indicate that the default numeric cursor formatting is configured.
Get extreme ticks formatting function of this NumericTickStrategy object.
Formatting Function.
Get extreme tick style of this NumericTickStrategy object.
Extreme tick style.
Get formattingOffset
of Tick strategy.
formattingOffset
is an optional coordinate to offset from tick coordinates when formatting tick labels and default cursor labels.
If supplied, the value of formattingOffset
will be added to every coordinate before formatting.
This can be useful for offsetting displayed data ranges in cases where actual data can't be practically rendered due to extremely large numbers for example.
// Example, specify formatting offset.
Axis.setTickStrategy(AxisTickStrategies.Numeric, (ticks) => ticks
// Will result in `0` being formatted as `1000000`
.setFormattingOffset(1000000)
)
Get major ticks formatting function of this NumericTickStrategy object.
Formatting Function.
Get major tick style of this NumericTickStrategy object.
Major tick style.
Get minor ticks formatting function of this NumericTickStrategy object.
Formatting Function.
Get minor tick style of this NumericTickStrategy object.
Minor tick style.
Set cursor formatter for this TickStrategy
object.
This will override the date time formatting used by:
TickStrategy
.Axis.formatValue
method of the Axis which uses this TickStrategy
. // Example syntax, custom cursor formatting.
Axis.setTickStrategy(AxisTickStrategies.Numeric, (ticks) => ticks
.setCursorFormatter((value, range, locale) =>
value.toFixed(3)
)
)
FormattingFunction
or undefined
to use default numeric cursor formatting.
New NumericTickStrategy object.
Set extreme ticks formatting function of this NumericTickStrategy object.
Formatting function to use with this NumericTickStrategy object.
New NumericTickStrategy object.
Construct a new NumericTickStrategy object based on this one, but with modified extreme tick style.
Example usage:
Disable extreme ticks:
Axis.setTickStrategy(
AxisTickStrategies.Numeric,
( tickStrategy: NumericTickStrategy ) => tickStrategy
.setExtremeTickStyle( emptyTick )
)
Set font of extreme ticks:
Axis.setTickStrategy(
AxisTickStrategies.Numeric,
( tickStrategy: NumericTickStrategy ) => tickStrategy
.setExtremeTickStyle(( tickStyle: VisibleTicks ) => tickStyle
.setLabelFont(( font ) => font
.setWeight( 'bold' )
)
)
)
Either a TickStyle object or a function, which creates a new one based on the existing style. Passing a function only works if the existing style is not emptyTick.
New NumericTickStrategy object.
Utility method for setting formatting function of all numeric tick levels (extreme, major, minor) as well as cursor.
Each formatting target can be individually overridden with following methods:
Function that formats a tick value to text.
New NumericTickStrategy object.
Construct a new NumericTickStrategy object based on this one, but with modified formatting offset.
formattingOffset
is an optional coordinate to offset from tick coordinates when formatting tick labels and default cursor labels.
If supplied, the value of formattingOffset
will be added to every coordinate before formatting.
This can be useful for offsetting displayed data ranges in cases where actual data can't be practically rendered due to extremely large numbers for example.
// Example, specify formatting offset.
Axis.setTickStrategy(AxisTickStrategies.Numeric, (ticks) => ticks
// Will result in `0` being formatted as `1000000`
.setFormattingOffset(1000000)
)
Set major ticks formatting function of this NumericTickStrategy object.
Formatting function to use with this NumericTickStrategy object.
New NumericTickStrategy object.
Construct a new NumericTickStrategy object based on this one, but with modified major tick style.
Example usage:
Set font of major ticks:
Axis.setTickStrategy(
AxisTickStrategies.Numeric,
( tickStrategy: NumericTickStrategy ) => tickStrategy
.setMajorTickStyle(( tickStyle ) => tickStyle
.setLabelFont(( font ) => font
.setWeight( 'bold' )
)
)
)
Either a VisibleTicks object or a function, which creates a new one based on the existing style.
New NumericTickStrategy object.
Set minor ticks formatting function of this NumericTickStrategy object.
Formatting function to use with this NumericTickStrategy object.
New NumericTickStrategy object.
Construct a new NumericTickStrategy object based on this one, but with modified minor tick style.
Example usage:
Disable minor ticks:
Axis.setTickStrategy(
AxisTickStrategies.Numeric,
( tickStrategy: NumericTickStrategy ) => tickStrategy
.setMinorTickStyle( emptyTick )
)
Set font of minor ticks:
Axis.setTickStrategy(
AxisTickStrategies.Numeric,
( tickStrategy: NumericTickStrategy ) => tickStrategy
.setMinorTickStyle(( tickStyle: VisibleTicks ) => tickStyle
.setLabelFont(( font ) => font
.setWeight( 'bold' )
)
)
)
Either a TickStyle object or a function, which creates a new one based on the existing style. Passing a function only works if the existing style is not emptyTick.
New NumericTickStrategy object.
Deeply converts this Record to equivalent native JavaScript Object.
Note: This method may not be overridden. Objects with custom serialization to plain JS may override toJSON() instead.
Shallowly converts this Record to equivalent native JavaScript Object.
Shallowly converts this Record to equivalent JavaScript Object.
Note: Not all methods can be used on a mutable collection or within
withMutations
! Only set
may be used mutatively.
Unlike other types in Immutable.js, the Record()
function creates a new
Record Factory, which is a function that creates Record instances.
See above for examples of using Record()
.
Note: Record
is a factory function and not a class, and does not use the
new
keyword during construction.
Records allow passing a second parameter to supply a descriptive name that appears when converting a Record to a string or in any error messages. A descriptive name for any record can be accessed by using this method. If one was not provided, the string "Record" is returned.
const { Record } = require('immutable')
const Person = Record({
name: null
}, 'Person')
var me = Person({ name: 'My Name' })
me.toString() // "Person { "name": "My Name" }"
Record.getDescriptiveName(me) // "Person"
True if maybeRecord
is an instance of a Record.
Axis Tick Strategy that is designed for depicting numeric values of all magnitudes.
NumericTickStrategy
is the default selection for all Axes.Axis interval ranges supported by
NumericTickStrategy
:10e-9
Note, that available axis interval ranges can be also limited by the type of Axis, refer to Axis documentation for more information.
Axis tick strategy is selected with Axis.setTickStrategy method:
Axis.setTickStrategy(AxisTickStrategies.Numeric, (numericTicks) => numericTicks)
All configuration of automatically created ticks is done using the callback from
setTickStrategy
, see example below for the idea:// Specify TickStrategy and use callback to style automatic ticks. Axis.setTickStrategy(AxisTickStrategies.Numeric, (numericTicks) => numericTicks // All methods of `NumericTickStrategy` can be used here for styling ticks. .setMajorTickStyle((majorTicks) => majorTicks .setLabelFont((font) => font .setWeight('bold') ) ) )
All available strategies for automatic Axis ticks creation can be referenced via AxisTickStrategies.