Skip to main content

YAxisComponent

YAxisComponent API

YAxisComponent.setExtentIdx
YAxisComponent.setExtentIdx(extentIdx: number): void

Parameters
extentIdx: number
Returns
void
YAxisComponent.registerDefaultLabelColorResolvers
YAxisComponent.registerDefaultLabelColorResolvers(): void

Registers default label color resolvers for different chart types.

Returns
void
YAxisComponent.doActivate
YAxisComponent.doActivate(): void

This method is used to activate a protected feature. It does not take any arguments and does not return anything.

Returns
void
YAxisComponent.updateCursor
YAxisComponent.updateCursor(): void

Returns
void
YAxisComponent.updateOrderedLabels
YAxisComponent.updateOrderedLabels(adjustYAxisWidth: boolean): void

Updates labels visual appearance on canvas

Parameters
adjustYAxisWidth: boolean
Returns
void
YAxisComponent.registerLabelColorResolver
YAxisComponent.registerLabelColorResolver(chartType: keyof BarTypes, resolver: LabelColorResolver): void

Registers a label color resolver for a specific chart type.

Parameters
chartType: keyof BarTypes
- The type of chart for which the label color resolver is being registered.
resolver: LabelColorResolver
- The function that will be used to resolve the color of the labels for the specified chart type.
Returns
void
YAxisComponent.getLabelsColorResolver
YAxisComponent.getLabelsColorResolver(candlesType: string): LabelColorResolver

Returns a function that resolves the color for a label based on the type of data series.

Parameters
candlesType: string
- The type of data series.
Returns
LabelColorResolver
YAxisComponent.registerYAxisLabelsProvider
YAxisComponent.registerYAxisLabelsProvider(provider: YAxisLabelsProvider, groupName: string, id: string): string

You can add a custom labels provider for additional labels on YAxis (like for drawings, symbol last price, studies, etc..)

Parameters
provider: YAxisLabelsProvider
groupName: string
- a group in which labels position recalculation algorithm will be applied, usually it's subchart name
id: string
Returns
string
YAxisComponent.addSimpleYAxisLabel
YAxisComponent.addSimpleYAxisLabel(name: string, label: VisualYAxisLabel): void

An easier way to manage custom y-axis labels, than y-axis labels providers. However, overlapping avoidance is not supported

Parameters
name: string
label: VisualYAxisLabel
Returns
void
YAxisComponent.deleteSimpleYAxisLabel
YAxisComponent.deleteSimpleYAxisLabel(name: string): void

Parameters
name: string
Returns
void
YAxisComponent.getAxisType
YAxisComponent.getAxisType(): PriceAxisType

Returns
PriceAxisType
YAxisComponent.unregisterYAxisLabelsProvider
YAxisComponent.unregisterYAxisLabelsProvider(groupName: string, id: string): string

Unregister a Y axis labels provider from the specified group.

Parameters
groupName: string
- The name of the group from which to unregister the provider. Defaults to LabelsGroups.MAIN.
id: string
- The ID of the provider to unregister.
Returns
string
YAxisComponent.getBounds
YAxisComponent.getBounds(): Bounds

Returns
Bounds
YAxisComponent.registerYAxisWidthContributor
YAxisComponent.registerYAxisWidthContributor(contributor: YAxisWidthContributor): void

If custom pane has y-axis it has to register width contributor to correctly calculate overall y-axis width.

Parameters
contributor: YAxisWidthContributor
Returns
void
YAxisComponent.setAxisType
YAxisComponent.setAxisType(type: PriceAxisType): void

Sets the type of axis: percent, regular or logarithmic.

Parameters
type: PriceAxisType
- the type of axis
Returns
void
YAxisComponent.setYAxisAlign
YAxisComponent.setYAxisAlign(align: YAxisAlign): void

Change YAxis position to left or to right

Parameters
align: YAxisAlign
Returns
void
YAxisComponent.setVisible
YAxisComponent.setVisible(isVisible: boolean): void

Controls visibility of the y-axis (additionally disable/enable component)

Parameters
isVisible: boolean
Returns
void
YAxisComponent.isVisible
YAxisComponent.isVisible(): boolean

If visible, when you can see the y-axis on the chart

Returns
boolean
YAxisComponent.setLockPriceToBarRatio
YAxisComponent.setLockPriceToBarRatio(value: boolean): void

Controls lockPriceToBarRatio of the y-axis

Parameters
value: boolean
Returns
void
YAxisComponent.changeLabelMode
YAxisComponent.changeLabelMode(type: string, mode: YAxisLabelMode): void

Changes the visual type of particular label.

Parameters
type: string
- label type
mode: YAxisLabelMode
- visual mode
Returns
void
YAxisComponent.changeLabelAppearance
YAxisComponent.changeLabelAppearance(type: string, mode: YAxisLabelAppearanceType): void

Changes the visual type of particular label.

Parameters
type: string
- label type
mode: YAxisLabelAppearanceType
- visual mode
Returns
void
YAxisComponent.togglePriceScaleInverse
YAxisComponent.togglePriceScaleInverse(inverse: boolean): void

Sets the inverse price scale mode. Inverts Y axis vertically. Inversion also works for candles, drawings and overlay studies.

Parameters
inverse: boolean
- true or false
Returns
void
YAxisComponent.changeLabelsDescriptionVisibility
YAxisComponent.changeLabelsDescriptionVisibility(descVisibility: boolean): void

Changes the visibility of the labels' descriptions.

Parameters
descVisibility: boolean
- A boolean value indicating whether the descriptions should be visible or not.
Returns
void
;