Tutorials
Getting started
Working with AI
Chart interface
Web components
Chart internals
Data integration
Customization
Frameworks and bundlers
Mobile development
Plug-ins
Compact Chart
Troubleshooting
Glossary
Reference
JSFiddles

Command Line Interface (CLI)

Introduction

The CLI plugin, introduced in ChartIQ v9.6.0, provides streamlined access to chart functions through a command palette interface that enhances accessibility and enables efficient chart interaction. The CLI plugin enables you to change chart types, adjust periodicity or range, add studies and series, and perform other chart operations.

Version History & Setup

Library Version CLI Plugin AI Plugin Notes
10.4.0+ Stable Stable Two distinct use cases: visual command palette for end-user interaction and headless command execution for AI/LLM integrations. See CLI UI Tutorial & CLI Programmatic Usage Tutorial
10.1.0+ Stable Stable CLI and AI no longer experimental.
10.0.0 Experimental Experimental AI plugin introduced as experimental.
9.7.0 Experimental Experimental CLI executor() function and AI tutorial introduced.
9.6.0 Experimental Not available CLI plugin and tutorial introduced as experimental.
< 9.6.0 Not available Not available CLI/AI features not supported.

Requirements:

  • ChartIQ library version 9.6.0 or later
  • Core package

Licensing & Availability:

  • The CLI plugin is not included by default with the Core package and must be requested separately.
  • The AI Ready plugin depends on the CLI plugin.
  • To obtain the CLI plugin, contact your Account Manager.

Plugin Structure:

  • The CLI plugin includes both command infrastructure and the optional UI component (<cq-cli>).
  • You can use the plugin without displaying the UI (headless mode).
  • The UI component is optional — use it only if you need user interaction.

Setup Comparison

Feature With UI Headless
Import import "./plugins/cli/cli.js" import "./plugins/cli/headlesscli.js"
UI Component <cq-cli> web component included No UI component
How to Use Users type or select commands in the UI Code executes commands programmatically
Access Executor cliEl.getExecutor() (legacy) or stx.getExecutor() stx.getExecutor()
Best For End-user interaction & keyboard shortcuts AI/LLM, automation, APIs, headless mode
Bundle Size Larger (includes UI) Smaller (no UI)

Which One Should I Use?

Use cli.js When:

  • You want to provide end users with a visual command palette
  • Users will type commands in a UI (keyboard-driven interface)
  • You need both UI and programmatic access (cli.js includes everything)
  • Building an interactive charting application with command shortcuts

See the CLI UI Tutorial

Import:

import "./plugins/cli/cli.js";

What you get:

  • <cq-cli> web component (command palette UI)
  • Command execution infrastructure (Executor + registry)
  • Both cliEl.getExecutor() and stx.getExecutor() available

Use headlesscli.js When:

  • Building AI/LLM integrations (no UI needed)
  • Creating automation scripts or API-driven chart control
  • Running headless or server-side chart operations
  • Want a smaller bundle size (no UI component code)
  • You don't need the visual command palette

See the CLI Programmatic Usage Tutorial

Import:

import "./plugins/cli/headlesscli.js";

What you get:

  • Command execution infrastructure only (Executor + registry)
  • Defines CIQ.ChartEngine.prototype.getExecutor() — available on every stx instance automatically
  • Access via stx.getExecutor() on any chart instance
  • No UI component loaded

Important Notes:

  • Do not import both - They're mutually exclusive. Choose one based on your needs.
  • cli.js includes everything - If you have the UI, you also have headless capability.
  • headlesscli.js is lighter - Use it if you don't need the UI component.

Quick Start Examples

UI Component Example

// Load CLI UI component
import "./plugins/cli/cli.js";

// User interacts with command palette in browser
// No code needed - component handles everything

Programmatic Example

// Load CLI infrastructure without UI component
import "./plugins/cli/headlesscli.js";

// Create chart
const stxx = new CIQ.ChartEngine({ container });

// Get executor and run commands - no additional setup needed
// Requires ChartIQ v9.6.0
const executor = stxx.getExecutor();
await executor("symbol AAPL");

Migration Guide

If you were using CLI for AI/LLM integrations, you can now simplify your implementation:

Before

// Requires ChartIQ v9.6.0
import "./plugins/cli/cli.js"; // Loads UI component unnecessarily
const cliEl = document.querySelector("cq-cli");
const executor = cliEl.getExecutor();

After

// Requires ChartIQ v9.6.0
import "./plugins/cli/headlesscli.js"; 
const executor = stxx.getExecutor(); 

Command Line Interface

In addition to the Command Palette, the plugin includes a Command Line Interface.

The commands listed below are accessible through this interface but may change, be modified, or removed in future updates.

Important: The command line interface is an advanced feature. If you have experience with command line tools, you will likely find this feature familiar.


To display all available commands, type cmdlist into the CLI text input.

Command Palette displaying available commands
Figure. Command Palette interface illustrating the list of available commands for user navigation.

To get help for a specific command, you can type help <cmd>.

  • For example: help series will display:
    "Add or remove a series; use the -c option to add as a comparison series, and the -r option to remove (or -x to remove all)"

To show the usage string for a given command, you can type <cmd> -h.

  • For example: series -h will display:
    "series [-c] [-rx] <symbol> [color]"

Important Considerations:

  • In line with common command line interface syntax, optional arguments are indicated in brackets [ ], while required arguments are enclosed in angle brackets < >, as shown in the example above.
  • Commands that accept a two-word argument should be enclosed in quotes. For example: type "Hollow Candle" or study "Bollinger Bands".

Commands

chart2music

Enables Chart2Music.

clear

Removes user-added chart elements and restores the default chart type and periodicity without changing the current symbol.

Usage String: clear [-f]

  • clear Removes studies, series, drawings, markers, and events; disables the crosshair; restores the candle chart type and 1-day periodicity; and returns the chart to its home position.
  • clear -f Clears local storage and reloads the page.

Note: the -f flag is only available for the CLI and not for any AI tools.

Migration note: As of v10.5.0, the clear command replaces the reset command.

cmdlist

Lists the available commands in the CLI plugin.

customer

Displays the customer information as reflected in the key.js file.

chartstate

Returns information about the current chart state, including the symbol, chart type, periodicity, visible range, dataset sizes, studies, and series.

Usage String: chartstate

  • chartstate Displays the current chart state.

data

Display chart data from the visible range or the full dataset, with optional date filtering.

Configure the amount or size of returned data by modifying DATASET_MAX_BARS and DATASET_MAX_BYTES in chartiq/plugins/cli/registry.js. Adjust these defaults based on your needs. DATASET_MAX_BARS limits the number of returned datapoints, while DATASET_MAX_BYTES limits the total size in bytes. Whichever constraint is reached first limits the dataset.

// Requires ChartIQ v10.4.0
const DATASET_MAX_BARS = 1500;
const DATASET_MAX_BYTES = 1048576;

Usage String: data [-v] [-s start] [-e end] [avg|high|highlow|low|ohlc]

  • Display visible data:

    • data -v
  • Display all data:

    • data

    Note: When displaying visible data or all data without specifying an operation, the result is logged to the console.

  • Filter by date range:

    • data -s 2024-01-01 -e 2024-12-31
    • data -s 01/01/2024 -e 12/31/2024 (Note: The data command accepts various date formats including 'YYYY-MM-DD', 'MM/DD/YYYY', and 'MM-DD-YY'.)
  • Perform operations on the data: Specify a command after data to perform calculations:

    • data avg Display the average close price
    • data high Display the highest price
    • data low Display the lowest price
    • data highlow Display the highest and lowest prices
    • data ohlc Display open, high, low, and close data

dshade

Shades chart regions bounded by existing vertical and horizontal line drawings. All referenced drawings must be on the same panel.

Usage String: dshade [-d] | [-l] | [-x] | [-r <id>] | ([-c <color>] [-o <opacity>] <ref1> <ref2> [ref3] [ref4])

  • dshade -d Lists available drawing references. Vertical references are assigned from left to right (v1, v2, and so on); horizontal references are assigned from lowest to highest (h1, h2, and so on).
  • dshade v1 v2 Shades a vertical band between two vertical drawings.
  • dshade h1 h2 Shades a horizontal band between two horizontal drawings.
  • dshade v1 v2 h1 h2 Shades a rectangle bounded by two vertical and two horizontal drawings.
  • dshade -c blue -o 0.2 v1 v2 Applies a color and opacity to the shaded region. Options must appear before the drawing references.
  • dshade -l Lists active drawing shading configurations and their IDs.
  • dshade -r &lt;id&gt; Removes one drawing shading configuration by ID.
  • dshade -x Removes all drawing shading configurations.

Note: Only vertical and horizontal line drawings are supported. Drawing references are reassigned when drawings are added or removed, so run dshade -d before creating a new shaded region.

dtshade

Shades a vertical date range directly on the chart without requiring drawing objects.

Usage String: dtshade [-l] | [-x] | [-r <id>] | ([-c <color>] [-o <opacity>] <date1> <date2>)

  • dtshade 2025-01-01 2025-03-31 Shades a range using ISO dates.
  • dtshade 01/01/2025 03/31/2025 Shades a range using US date format.
  • dtshade last-month today Shades a range using natural-language shortcuts.
  • dtshade ytd today Shades the year to date through today.
  • dtshade -c blue -o 0.2 2025-01-01 2025-06-30 Applies a color and opacity. Options must appear before the dates.
  • dtshade -l Lists active date shading configurations and their IDs.
  • dtshade -r &lt;id&gt; Removes one date shading configuration by ID.
  • dtshade -x Removes all date shading configurations.

Supported shortcuts include today, yesterday, last-week, last-month, this-week, this-month, and ytd. Natural-language dates such as Jan 1 2025 and January 1, 2025 are also supported.

drawingline

Adds, lists, or removes vertical, horizontal, arrow, line, and ray drawings on the chart.

Usage String: drawingline [-t <vertical|horizontal|arrow|line|ray>] (-l | -x | -r <id> | <point> [color] [pattern] [lineWidth])

  • drawingline -t vertical 2026-01-02 Adds a vertical line at a date.
  • drawingline -t horizontal 150.50 Adds a horizontal line at a price level.
  • drawingline -t line 2026-01-02@150.50 2026-06-15@175.00 Adds a two-point line.
  • drawingline -t ray 2026-01-02@150.50 2026-06-15@175.00 dashed Adds a dashed ray.
  • drawingline -t arrow 2026-01-02@150.50 2026-06-15@175.00 Adds an arrow between two points.
  • drawingline -l Lists all drawings, or use -t to filter by type.
  • drawingline -r 2026-01-02 Removes a drawing using its type-specific identifier.
  • drawingline -x Removes all drawings, or all drawings of the type specified with -t.

Points can use a date, a price, date@price, or @cursor, depending on the drawing type. Line and ray drawings also accept a color, solid, dashed, or dotted pattern, and a line width of 1, 3, or 5.

drawingtext

Adds, lists, or removes annotation and callout text drawings on the chart.

Usage String: drawingtext [-t <annotation|callout>] [-c <color>] (-l | -x | -r <date> | <date[@price]> [message...])

  • drawingtext 2026-01-02 Buy signal here Adds an annotation at a date.
  • drawingtext 2026-01-02@150.50 Buy signal here Adds an annotation at a date and price.
  • drawingtext @cursor Buy signal here Adds an annotation at the current cursor position.
  • drawingtext -t callout 2026-01-02 Strong support Adds a callout drawing.
  • drawingtext -c red 2026-01-02@150.50 Stop loss Sets the text and border color.
  • drawingtext -l Lists annotation and callout drawings.
  • drawingtext -r 2026-01-02 Removes text drawings anchored at a date.
  • drawingtext -x Removes all annotation and callout drawings.

For multi-line text, wrap the message in double quotes and use \n between lines.

drawingtool

Adds, lists, or removes marking drawings. The current command supports rectangles.

Usage String: drawingtool [-t <rectangle>] [-f <fillColor>] (-l | -x | -r <date> | <point> <point2> [color] [pattern] [lineWidth])

  • drawingtool -t rectangle 2026-01-02@150.50 2026-06-15@175.00 Adds a rectangle.
  • drawingtool -t rectangle 2026-01-02@150.50 2026-06-15@175.00 green -f yellow Sets the border and fill colors.
  • drawingtool -t rectangle 2026-01-02@150.50 2026-06-15@175.00 dashed 3 Sets the line pattern and width.
  • drawingtool -l Lists rectangle drawings.
  • drawingtool -r 2026-01-02 Removes a rectangle by its start date.
  • drawingtool -x Removes all marking drawings.

Both points are required when adding a rectangle. Points can use date@price, a bare date, or @cursor.

drawingtrendline

Adds, lists, or removes two-point trendline drawings on the chart.

Usage String: drawingtrendline [-c <color>] [-f <fillColor>] [-t <textColor>] [-s <solid|dotted|dashed>] [-k] [-m <auto|custom>] (-l | -x | -r <index> | <point1> <point2>)

Each endpoint can use date@price, a bare date with the price looked up from chart data, or @cursor to use the current mouse position.

  • drawingtrendline 2026-01-02@150.50 2026-06-15@175.00 Adds a trendline between two date and price points.
  • drawingtrendline 2026-01-02 2026-06-15 Adds a trendline using prices looked up from the chart data.
  • drawingtrendline @cursor 2026-06-15@175.00 Uses the current cursor position for the first endpoint.
  • drawingtrendline -c red -s dashed 2026-01-02@150.50 2026-06-15@175.00 Sets the line color and style.
  • drawingtrendline -k -m custom 2026-01-02@150.50 2026-06-15@175.00 Enables an editable custom callout label.
  • drawingtrendline -f yellow -t black 2026-01-02@150.50 2026-06-15@175.00 Sets the callout fill and text colors.
  • drawingtrendline -l Lists trendline drawings and their indexes.
  • drawingtrendline -r &lt;index&gt; Removes one trendline by its index.
  • drawingtrendline -x Removes all trendline drawings.

Options must appear before the endpoint arguments. To change the style of an existing trendline, remove it with -r and add it again with the desired options.

echo

Echoes messages to the CLI output. It can also read text from piped input.

Usage String: echo [message1] [message2] ...

  • echo Hello world Displays the supplied message.
  • echo First message Second message Concatenates multiple arguments with spaces.

export

Logs the drawings, layouts, and preferences to the console in the form of a JSON object.

findsymbol

Searches for symbols by company name or ticker using the configured symbol server.

Usage String: findsymbol <symbolName>

  • findsymbol Apple Searches for companies matching a name.
  • findsymbol MSFT Searches for a ticker symbol.

help

Get help with using the help command. Alternatively, pass another command as an argument immediately after help to receive help for that command's usage and details.

Usage String: help [-l] [command]

  • help Displays a message on how to use the help command.
  • help -l Lists all available commands
    (returns the same output as cmdlist)
  • help [command] Displays the description and usage information for the specified command.

home

Returns the chart to the home position, placing the most recent tick on the right side of the screen.

info

Returns the customer's package info as reflected in the key.js file.

Usage String: info [field]

  • info Displays all of the customer's package information.
  • info expirationDate displays the specified info field.

layout

Retrieves the current layout settings of the chart.

Usage String: layout [field]

  • layout logs the entire layout object to the console.
  • layout studies displays the specified layout field within the CLI plugin.

List of active studies
Figure. List of active studies generated by the command layout studies.

log

Logs messages to the browser console. Objects are serialized as formatted JSON when possible, and piped input is supported.

Usage String: log [message1] [message2] ...

  • log Chart loaded Logs a message to the console.
  • log Reads and logs piped input when input is piped to the command.

ohlc

Performs OHLC calculations on JSON data piped into the command.

Usage String: ohlc [avg|high|highlow|low|ohlc]

  • data -v | ohlc avg Displays the average close price.
  • data -v | ohlc high Displays the highest high.
  • data -v | ohlc low Displays the lowest low.
  • data -v | ohlc highlow Displays the highest high and lowest low.
  • data -v | ohlc ohlc Displays the complete OHLC values.

periodicity

Usage String: periodicity <periodicity>

  • periodicity "1 D" change periodicity to 1 Day
  • periodicity "1 Hour" change periodicity to 1 hour
  • periodicity "15 Min" change periodicity to 15 minutes
    • (Note: Ensure that the periodicity passed is in quotes and is case sensitive. There should also be a space between the number and the time unit for the CLI plugin to recognize your input as a periodicity command.)

polling

Pauses or resumes the quote feed. If no argument is passed, the current polling interval of the chart is displayed.

Usage String: polling [start|stop]

  • polling Displays the current polling interval.
  • polling stop Pauses the polling.
  • polling start Resumes the polling.

preferences

Gets or sets chart preferences.

Usage String: preferences [-s value] [pref]

  • preferences Lists all chart preferences.
  • preferences whitespace Displays a specific preference.
  • preferences -s true whitespace Sets a preference value.

range

Usage String: range <range> | <start date> <end date>

  • Set the chart's range to 6M

    • range 6M
  • Set the chart's range to a custom span

    • To set a custom range, include a start date and an end date for your desired range after the command range.
    • The range command accepts various date formats.
      • Acceptable formats include, but are not limited to: 'YYYY-MM-DD', 'MM-DD-YY', and 'MM/DD/YYYY'.
    • To set a custom start range that spans to the current or nearest market date/time, include an empty string as a replacement for the end date.
      • range 2025-01-15 2025-01-30 Custom start and end date range in YYYY-MM-DD format
      • range 1/15/2025 1/30/2025 Custom start and end date range in the MM/DD/YYYY format
      • range 2025-01-15 "" Custom start date to current or closest market date/time

referencedata

Lists available Reference Data datasets, adds a dataset to the chart, or removes an active Reference Data series.

Usage String: referencedata (-l [category]) | (-r <seriesId | datasetName>) | ([-s <symbol>] [-c <color>] <datasetName>)

  • referencedata -l Lists available datasets and active Reference Data series.
  • referencedata -l Financials Filters available datasets by category.
  • referencedata Consensus Adds a dataset for the current chart symbol.
  • referencedata -s MSFT EPS Adds a dataset for a specified symbol.
  • referencedata -c red Consensus Adds a dataset with a specified series color.
  • referencedata -r Consensus Removes an active Reference Data series by dataset name.
  • referencedata -r "AAPL|Consensus|Estimates" Removes an active series by its full series ID.

Dataset names containing spaces must be enclosed in quotes.

series

Add, remove, recolor, change display type, and manage series on custom panels.

Usage String: series [-c] [-r|-x] [-t displayType] [-p panel] <symbol> [color] [colorKey=color ...]

  • Show active series:

    • series
  • Add a series:

    • series GOOG
    • series GOOG #008000
      (Note: The color parameter can be a named color or a hex color.)
  • Add a series as a comparison:

    • series -c GOOG
    • series -c GOOG Green
  • Set or update display type:

    • series -t candle GOOG Set display type to candle
    • series -t histogram MSFT Set display type to columns (Valid display types: bar, baseline_delta, candle, colored_bar, colored_hlc, colored_line, histogram, hollow_candle, line, mountain, step, vertex_line, volume_candle)
  • Add or move a series to a panel:

    • series -p volume GOOG Add series to a panel (creates panel if it doesn't exist)
    • series -p customPanel AAPL Move an existing series to a different panel
  • Apply color style overrides:

    • series GOOG fill_color_up=#00ff00 border_color_down=red
    • series -t candle MSFT border_color=#0000ff fill_color_up=#00ff00 (Available color keys: border_color, border_color_up, border_color_down, border_color_even, fill_color_up, fill_color_down, fill_color_even)
  • Combine options:

    • series -c -t line -p comparisons GOOG Add comparison with specific display type to a panel
    • series -t candle -p volume IBM fill_color_up=green Set display type, panel, and color overrides
  • Remove a series:

    • series -r GOOG Remove a specific series (Use the series symbol or ID to remove.)
  • Remove all series:

    • series -x Remove all series from the chart

shade

Shades the region between two existing series or between the main chart and one series.

Usage String: shade [-l] | [-r <renderer>] | [-x] | ([-g <greater>] [-s <lesser>] [-c <color>] [-n <name>] <series1> [series2])

  • shade IBM GE Shades the region between two comparison series.
  • shade MSFT Shades the region between the main chart and MSFT.
  • shade -c blue IBM GE Uses a fixed color regardless of which series is higher.
  • shade -g green -s red IBM GE Uses green when the primary series is higher and red when it is lower.
  • shade -n myBands IBM GE Assigns a custom name to the shading renderer.
  • shade -l Lists active shade renderers.
  • shade -r &lt;renderer&gt; Removes one shade renderer by name while keeping its series on the chart.
  • shade -x Removes all shade renderers while keeping their series on the chart.

The series must already be on the chart. Options must appear before the series arguments. When no color options are provided, the default shade color is gold.

study

Usage string: *study [-l [<study name>]] [-s <study id | signal name | > [<start date> [<end date> [<include trigger dates>]]]] [-a <study name> [study field expression | key=value ...]] [-e <study id> study field expression] [-r <study id>] [-x]

Important Consideration:
When adding a study with -a, reference the study definition ID from the library (e.g., "Aroon"). When editing or removing an existing study instance on the chart with -e or -r, reference the study instance name (e.g., "Aroon (14)").

  • Show active studies:

    • study
  • Show all available studies:

    • study -l
  • Show study's definitions

    • study -l <study name>
  • Show SignalIQ data: Use the -s option to retrieve SignalIQ data attached to an active study. You can identify the study by its instance ID or custom signal name. See SignalIQ Event Indicators for information about configuring signals.

    • study -s "myRSI" (shows a summary for the named signal)
    • study -s "*" (lists all active studies with SignalIQ data)
    • study -s "myRSI" 2026-10-01 2026-10-31 (shows the signal count for the inclusive date range)
    • study -s "myRSI" 2026-10-01 2026-10-31 true (includes individual trigger dates in the response)

    By default, the command returns a summary and counts trigger dates without listing them. A date-only end date includes the entire day. Use true only when you need the individual trigger dates; the command returns at most 500 dates.

  • Study Field Expressions:
    Use study field expressions to set input, output, or parameter values using jq-like dot notation. Chain expressions by separating them with semicolons:

    • .inputs.Period=100 (targets a specific input)
    • .outputs.RSI=14 (targets a specific output)
    • .parameters.FastPeriod=12 (targets a specific parameter)
  • Add a study:
    To add a study from the study library, use the -a option with the study name or ID:

    • study -a Aroon
    • study -a ma
    • study -a ma .inputs.Period=100 (with input parameters)
    • study -a ma .parameters.panelName="New panel" (adds study to new panel)
    • study -a rsi .parameters.flippedEnabled=true (inverts the study's Y-axis)
    • study -a "Bollinger Bands" .inputs.Period=24; .inputs.Field="Close"; .inputs["Standard Deviations"]=2.5; .inputs["Moving Average Type"]=ema; .inputs["Channel Fill"]=false; .outputs["Bollinger Bands Top"]=#6554C0; .outputs["Bollinger Bands Median"]=#0052CC; .outputs["Bollinger Bands Bottom"]=#00875A
  • Edit a study:
    To modify an active study's inputs, outputs, or parameters, use the -e option with a study field expression:

    • study -e "Aroon (14)" .inputs.Period=20 (edit the Period input)
    • study -e 'macd (12,26,9)' .inputs["Fast MA Period"]=12; .parameters.FastPeriod=12 (set multiple fields)
    • study -e 'macd (12,26,9)' .outputs.MACD=#1E90FF; .outputs.Signal=#FF6347; .outputs["Increasing Bar"]=#26A69A; .outputs["Decreasing Bar"]=#EF5350
    • study -e 'ADX (14,14,y,n)' .inputs.Period=10; .inputs["Smoothing Period"]=20; .inputs.Series=true; .inputs.Shading=true; .inputs.Histogram=true; .outputs["+DI"]=#00B8D9; .outputs["-DI"]=#FF5630; .outputs.ADX=#FFAB00; .outputs["Positive Bar"]=#36B37E; .outputs["Negative Bar"]=#FF7452
  • Remove a study:
    To remove a specific study, add -r after the word study and before the study name:

    • study -r "Aroon (14)"
      (Use the study instance name from the chart's layout object, e.g., "Aroon (14)" for Aroon.)
  • Remove all studies:
    To remove all studies from the chart, simply include -x after the word study:

    • study -x

symbol

Change the chart's main symbol.

Usage string: symbol <symbol>

  • symbol Display the current symbol.
  • symbol IBM Change the symbol to IBM.

type

  • Set the main symbol's display type.
    • type Mountain

version

Returns the current ChartIQ library version being used.

  • version

yaxis

Displays y-axis information or moves, merges, and unmerges y-axes using the same availability rules as the y-axis context menu.

Usage String: yaxis info | (move|merge <left|right> [name]) | unmerge [name]

  • yaxis info Lists active y-axes, their contents, and available actions.
  • yaxis move left myYAxis Moves an axis to the left.
  • yaxis merge right myYAxis Merges an axis to the right.
  • yaxis unmerge myYAxis Unmerges an axis.

If an axis name is omitted, the command uses the current y-axis or main chart y-axis. A target can also be resolved by series ID, symbol, or study name.

Custom Commands

To add a custom command to the command line interface or modify the name of an existing command, update the registry.js file.

For example, you can rename the clear command to restore by changing the name of the clear object in registry.js.

restore: {
  func: function clear() {
    if (clear.opts.f) {
      localStorage.clear();
      location.reload();
    } else {
      this.echo(
        "To clear the chart, use the -f option to clear local storage and reload the page."
      );
    }
  },
  man: "Clear the chart when including the -f option. \n\nThis will clear local storage and reload the page. \n\nUsage:\nrestore [-f]",
  opts: "f",
  usage: "restore [-f]"
},

To add a custom command, include it as a property within the registry object. Each property should be an object that defines the func, man, opts, and usage properties to properly configure your new command.

Note: If a particular option requires an argument (i.e. -o arg) then that option's character in the opts string must be followed by a colon, :. Not passing an argument for an option that requires one will throw an error.

Example:

gandalf: {
  func: function gandalf() {
    if (gandalf.opts.g) {
      this.echo(
        "A wizard is never late, nor is he early; he arrives precisely when he means to."
      );
    } else if (gandalf.opts.w) {
      this.echo(
        "The world is indeed full of peril, and in it there are many dark places; but still there is much that is fair."
      );
    } else if (gandalf.opts.q) {
      const characters = {
        frodo:
          "Frodo, my dear Hobbit. You have been chosen, and you must bear this burden.",
        sam: "You have a good heart, Sam. You will be a great hero.",
        aragorn:
          "You must understand, my dear Aragorn, that the fate of Middle-earth rests upon your shoulders."
      };
      this.echo(
        `Here is a quote from Gandalf spoken to ${gandalf.opts.q}:\n\n${
          characters[gandalf.opts.q]
        }`
      );
    } else {
      this.echo(
        "Please specify an option: -g for Gandalf the Grey or -w for Gandalf the White. \n\nUse the -q option to return a quote spoken to a provided character."
      );
    }
  },
  man: "Display a quote from either Gandalf the Grey or Gandalf the White.\n\nUse the -g option for Gandalf the Grey, -w for Gandalf the White, and -q to return a quote spoken to a specified character.",
  opts: "gwq:",
  usage: "gandalf [-q (frodo|sam|aragorn)] [-gw]"
}

See Also