> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# IsVisibleOnChart()

## Definition

Indicates a chart object is visible on the chart. When the **IsVisibleOnChart()** method determines a chart object is not visible and returns false, the object will not be used in a render pass, will not be considered in a hit test, and will not be used for alerting. The base implementation is to always return true on all chart objects, however this behavior can be overridden for your custom object if desired.

## Method Return Value

A virtual bool value which when true, the object will be rendered and can be interacted with by a user; otherwise false. Default value is true.

## Syntax

You must override this method using the following syntax:

`public override bool IsVisibleOnChart(ChartControl chartControl, ChartScale chartScale, DateTime firstTimeOnChart, DateTime lastTimeOnChart)`

## Method Parameters

| Parameter            | Description                                                                                            |
| -------------------- | ------------------------------------------------------------------------------------------------------ |
| **chartControl**     | A [ChartControl](/developer/desktop-sdk/references/common/charts/chartcontrol) representing the x-axis |
| **chartScale**       | A [ChartScale](/developer/desktop-sdk/references/common/charts/chartscale) representing the y-axis     |
| **firstTimeOnChart** | A DateTime representing the first painted bar displayed on the chart                                   |
| **lastTimeOnChart**  | A DateTime representing the last painted bar displayed on the chart                                    |

## Examples

```csharp
public override bool IsVisibleOnChart(ChartControl chartControl, ChartScale chartScale, DateTime firstTimeOnChart, DateTime lastTimeOnChart)
{
    // check if any chart anchors are visible
    foreach (ChartAnchor anchor in Anchors)
    {
        if (anchor.Time >= firstTimeOnChart && anchor.Time <= lastTimeOnChart)
            return true;
    }
    return false; // otherwise the object should not be displayed         
}
```