Legend
Legend is a list of series and indicators at the top-left corner of any chart. Note that the legend position cannot be changed.
Chart settings
In the Chart settings → Status line dialog, users can configure the legend.
Visibility customization
You can use featuresets or overrides to customize the legend's visibility such as hiding or displaying particular legend elements. The sections below describe customization via featuresets. For more information about override properties that affect the legend, refer to Legend.
Hide legend
You can hide the legend widget from the chart.
To do this, include the legend_widget
featureset in the disabled_features
array.
Hide legend buttons
You can hide all legend buttons by including the edit_buttons_in_legend
in disabled_features
.
Besides, disabling show_hide_button_in_legend
, format_button_in_legend
,
or delete_button_in_legend
allows customizing particular legend buttons.
For example, the Settings button is hidden in the image below.
Hide context menu
When right-clicking the legend, you can access the context menu.
To disable this feature, include legend_context_menu
in disabled_features
.
Price formatting
Prices are formatted according to the pricescale
, minmov
, minmove2
, and fractional
properties specified in the LibrarySymbolInfo
object.
For more information, refer to the Price format section.
You can also apply custom formatting using the numeric_formatting
property of Widget Constructor.
new TradingView.widget({
container: "chartContainer",
locale: "en",
library_path: "charting_library/",
datafeed: new Datafeeds.UDFCompatibleDatafeed("https://demo-feed-data.tradingview.com"),
symbol: "AAPL",
interval: "1D",
numeric_formatting: { decimal_sign: "," },
})
In the code sample above, the comma separates the decimal/fractional part of the price.
NaN values in legend
If you integrate the library with mobile applications,
you should implement the getQuotes
and subscribeQuotes
methods of the Datafeed API.
Otherwise, NaN
appears instead of the expected OHLCV values in the legend.