SetIndexVisibility
Sets the visibility of a buffer.
Syntax
SetIndexVisibility(index: number, isVisible: boolean): void
Parameters
index
- A number representing the index of the buffer.isVisible
- A boolean indicating whether the buffer should be visible.
Return Value
This method does not return a value.
Description
The SetIndexVisibility
method sets whether a buffer should be visible on the chart. This can be used to hide buffers that are used for calculations but should not be displayed to the user.
Example
// Make buffer 0 visible
this.api.SetIndexVisibility(0, true);
// Hide buffer 1 (used for calculations only)
this.api.SetIndexVisibility(1, false);
// Conditionally show buffer based on user option
const showSignalLine = true; // This could be a user option
this.api.SetIndexVisibility(2, showSignalLine);
Last updated