> 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.

# ChartControl

The **ChartControl** class provides access to a wide range of properties and methods related to the location of objects on a chart and other chart-related properties. The **ChartControl** object provides information related to the entire hosting grid of the chart, which overlap with the [ChartPanel](/developer/desktop-sdk/references/common/charts/chartpanel), [ChartScale](/developer/desktop-sdk/references/common/charts/chartscale) and [ChartBars](/developer/desktop-sdk/references/common/charts/chartbars).

The **ChartControl** object is ONLY guaranteed to be available when a **NinjaScript** type initiates from a Chart Window. There are situations where an indicator or strategy starts from another Windows (such as the Control Center's Strategies Grid, or from a Strategy Analyzer), where the **ChartControl** object is NOT accessible. Therefore, the **ChartControl** object should always be safely accessed (e.g., from within a try-catch, or conditionally using null reference checks).

![ChartControl\_1](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/ninjatrader-public.docs.buildwithfern.com/2ee7f4e8e022c0b2f981ee73b514ed50446e544632f9ee1933956028a9083feb/docs/assets/developer/desktop-sdk/references/chartcontrol-chartcontrol-1.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260729%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260729T062113Z&X-Amz-Expires=604800&X-Amz-Signature=09ab94b3953b6ded5c599e4b3fceefd65dc119b128d2006c6ad0d31fffbb4034&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

Warning: The **ChartControl** and its methods and properties should ONLY be accessed once the **State** has reached **State.Historical**.

## Methods and Properties

| Method/Property                                                                                                          | Description                                                                                                                                                                                           |
| ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AxisXHeight](/developer/desktop-sdk/references/common/charts/chartcontrol/axisxheight)                                  | Measures the distance (in pixels) between the x-axis and the top of the horizontal scroll bar                                                                                                         |
| [AxisYLeftWidth](/developer/desktop-sdk/references/common/charts/chartcontrol/axisyleftwidth)                            | Measures the distance (in pixels) between the y-axis and the left margin of a chart                                                                                                                   |
| [AxisYRightWidth](/developer/unsorted/axisyrightwidth)                                                                   | Measures the distance (in pixels) between the y-axis and the right margin of a chart                                                                                                                  |
| [BarMarginLeft](/developer/desktop-sdk/references/common/charts/chartcontrol/barmarginleft)                              | Measures the margin to the left of each bar on the chart, in pixels                                                                                                                                   |
| [BarsArray](/developer/desktop-sdk/references/common/adddataseries/barsarray)                                            | Provides a collection of [ChartBars](/developer/desktop-sdk/references/common/charts/chartbars) objects currently configured on the chart                                                             |
| [BarSpacingType](/developer/desktop-sdk/references/common/charts/chartcontrol/barspacingtype)                            | Provides the type of bar spacing used for the primary [Bars](/developer/desktop-sdk/references/common/bars) object on the chart                                                                       |
| [BarsPeriod](/developer/desktop-sdk/references/common/charts/chartcontrol/chartcontrol-barsperiod)                       | Provides the period (interval) used for the primary [Bars](/developer/desktop-sdk/references/common/bars) object on the chart                                                                         |
| [BarWidth](/developer/desktop-sdk/references/common/charts/chartcontrol/chartcontrol-barwidth)                           | Measures the value of the bar width set for the primary [Bars](/developer/desktop-sdk/references/common/bars) object on the chart                                                                     |
| [BarWidthArray](/developer/desktop-sdk/references/common/charts/chartcontrol/barwidtharray)                              | An array containing the values of the [BarWidth](/developer/desktop-sdk/references/chart-style/barwidth) properties of all [Bars](/developer/desktop-sdk/references/common/bars) objects on the chart |
| [CanvasLeft](/developer/desktop-sdk/references/common/charts/chartcontrol/canvasleft)                                    | Indicates the x-coordinate (in pixels) of the beginning of the chart canvas area                                                                                                                      |
| [CanvasRight](/developer/desktop-sdk/references/common/charts/chartcontrol/canvasright)                                  | Indicates the x-coordinate (in pixels) of the end of the chart canvas area                                                                                                                            |
| [CanvasZoomState](/developer/desktop-sdk/references/common/charts/chartcontrol/canvaszoomstate)                          | Indicates the current state of the Zoom tool on the chart                                                                                                                                             |
| [ChartPanels](/developer/desktop-sdk/references/common/charts/chartcontrol/chartpanels)                                  | Holds a collection of [ChartPanel](/developer/desktop-sdk/references/common/charts/chartpanel) objects                                                                                                |
| [CrosshairType](/developer/desktop-sdk/references/common/charts/chartcontrol/crosshairtype)                              | Indicates the [Cross Hair](https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?cross_hair.htm) type currently enabled on the chart                                           |
| [FirstTimePainted](/developer/desktop-sdk/references/common/charts/chartcontrol/firsttimepainted)                        | Indicates a time value of the first bar painted on the chart                                                                                                                                          |
| [GetBarPaintWidth()](/developer/desktop-sdk/references/chart-style/getbarpaintwidth)                                     | Returns the width of the bars in the primary [Bars](/developer/desktop-sdk/references/common/bars) object on the chart, in pixels                                                                     |
| [GetSlotIndexByTime()](/developer/desktop-sdk/references/common/charts/chartcontrol/getslotindexbytime)                  | Returns the slot index of the primary [Bars](/developer/desktop-sdk/references/common/bars) object on the chart corresponding to a specified time value                                               |
| [GetSlotIndexByX()](/developer/desktop-sdk/references/common/charts/chartcontrol/getslotindexbyx)                        | Returns the slot index of the primary [Bars](/developer/desktop-sdk/references/common/bars) object on the chart corresponding to a specified x-coordinate on the visible chart canvas                 |
| [GetTimeBySlotIndex()](/developer/desktop-sdk/references/common/charts/chartcontrol/gettimebyslotindex)                  | Returns a time value corresponding to a specified slot index of the primary [Bars](/developer/desktop-sdk/references/common/bars) object on the chart                                                 |
| [GetTimeByX()](/developer/desktop-sdk/references/common/charts/chartcontrol/gettimebyx)                                  | Returns a time value related to the primary [Bars](/developer/desktop-sdk/references/common/bars)' slot index at a specified x-coordinate on the chart canvas                                         |
| [GetXByBarIndex()](/developer/desktop-sdk/references/common/charts/chartcontrol/getxbybarindex)                          | Returns the chart-canvas x-coordinate of the bar at a specified index of a specified [ChartBars](/developer/desktop-sdk/references/common/charts/chartbars) object on the chart                       |
| [GetXByTime()](/developer/desktop-sdk/references/common/charts/chartcontrol/getxbytime)                                  | Returns the chart-canvas x-coordinate of the slot index of the primary [Bars](/developer/desktop-sdk/references/common/bars) object corresponding to a specified time                                 |
| [Indicators](/developer/desktop-sdk/references/common/charts/chartcontrol/indicators)                                    | Returns a collection of indicators currently configured on the chart                                                                                                                                  |
| [IsScrollArrowVisible](/developer/desktop-sdk/references/common/charts/chartcontrol/isscrollarrowvisible)                | Indicates the time-axis scroll arrow is visible in the top-right corner of the chart                                                                                                                  |
| [IsStayInDrawMode](/developer/desktop-sdk/references/common/charts/chartcontrol/isstayindrawmode)                        | Indicates the [Stay in Draw Mode](https://ninjatrader.com/support/helpGuides/nt8/?working_with_drawing_tools__ob.htm) is currently enabled on the chart                                               |
| [IsYAxisDisplayedLeft](/developer/desktop-sdk/references/common/charts/chartcontrol/isyaxisdisplayedleft)                | Indicates the y-axis displays (in any chart panel) to the left side of the chart canvas                                                                                                               |
| [IsYAxisDisplayedOverlay](/developer/desktop-sdk/references/common/charts/chartcontrol/isyaxisdisplayedoverlay)          | Indicates an object on the chart is using the Overlay scale justification                                                                                                                             |
| [IsYAxisDisplayedRight](/developer/desktop-sdk/references/common/charts/chartcontrol/chartcontrol-isyaxisdisplayedright) | Indicates the y-axis displays (in any chart panel) to the right side of the chart canvas                                                                                                              |
| [LastSlotPainted](/developer/desktop-sdk/references/common/charts/chartcontrol/lastslotpainted)                          | Indicates the slot index of the most recently painted bar on the primary [Bars](/developer/desktop-sdk/references/common/bars) object configured on the chart                                         |
| [LastTimePainted](/developer/desktop-sdk/references/common/charts/chartcontrol/lasttimepainted)                          | Indicates the time of the most recently painted bar on the primary [Bars](/developer/desktop-sdk/references/common/bars) object configured on the chart                                               |
| [MouseDownPoint](/developer/desktop-sdk/references/common/charts/chartcontrol/mousedownpoint)                            | Indicates the x- and y-coordinates of the mouse cursor at the most recent **OnMouseDown()** event                                                                                                     |
| [Properties](/developer/desktop-sdk/references/common/charts/chartcontrol/chartcontrol-properties)                       | A collection of properties related to the configuration of the Chart                                                                                                                                  |
| [SlotsPainted](/developer/desktop-sdk/references/common/charts/chartcontrol/slotspainted)                                | Indicates the number of index slots in which bars are painted within the chart canvas area                                                                                                            |
| [Strategies](/developer/desktop-sdk/references/add-on/account-class/strategies)                                          | A collection of strategies configured on the chart                                                                                                                                                    |
| [TimePainted](/developer/desktop-sdk/references/common/charts/chartcontrol/timepainted)                                  | Indicates the range of time in which bars are painted on the visible chart canvas                                                                                                                     |