Interface: ITimeScaleApi
Charting Library.ITimeScaleApi
API object for interacting with the time scale.
You can retrieve this interface by using the IChartWidgetApi.getTimeScale method
Methods
barSpacing
▸ barSpacing(): number
Returns the current bar spacing
Returns
number
barSpacingChanged
▸ barSpacingChanged(): ISubscription
<(newBarSpacing
: number
) => void
>
Users will be notified every time barSpacing
value is changed. This typically occurs when zooming in/out on the chart.
This is to detect when the chart has been zoomed in/out
Returns
ISubscription
<(newBarSpacing
: number
) => void
>
coordinateToTime
▸ coordinateToTime(x
): number
Returns the time associated to a given coordinate (distance in pixels from the leftmost visible bar)
Parameters
Name | Type |
---|---|
x | number |
Returns
number
defaultRightOffset
▸ defaultRightOffset(): IWatchedValue
<number
>
Object that can be used to read/set/watch the default right offset (margin)
Returns
IWatchedValue
<number
>
defaultRightOffsetPercentage
▸ defaultRightOffsetPercentage(): IWatchedValue
<number
>
Object that can be used to read/set/watch the default right offset (in percent) (margin)
Returns
IWatchedValue
<number
>
rightOffset
▸ rightOffset(): number
Returns the current right offset
Returns
number
rightOffsetChanged
▸ rightOffsetChanged(): ISubscription
<(rightOffset
: number
) => void
>
Users will be notified every time rightOffset
value is changed.
This is to detect when the chart has been scrolled left/right.
Returns
ISubscription
<(rightOffset
: number
) => void
>
setBarSpacing
▸ setBarSpacing(newBarSpacing
): void
To set a new bar spacing
Parameters
Name | Type |
---|---|
newBarSpacing | number |
Returns
void
setRightOffset
▸ setRightOffset(offset
): void
To set a new right offset
Parameters
Name | Type |
---|---|
offset | number |
Returns
void
usePercentageRightOffset
▸ usePercentageRightOffset(): IWatchedValue
<boolean
>
Object that can be used to read/set/watch whether to use defaultRightOffset
or defaultRightOffsetPercentage
option for the right offset (margin).
false
: usedefaultRightOffset
true
: usedefaultRightOffsetPercentage
Default: false
Returns
IWatchedValue
<boolean
>
width
▸ width(): number
Returns the current width of the chart in pixels
Returns
number